5 ms·
Logic programming is extremely powerful in offering the option to essentially run your program in reverse, asking “given this output, which inputs would cause t
by mjul 5y ago
Logic programming is extremely powerful in offering the option to essentially run your program in reverse, asking “given this output, which inputs would cause that?”
Even if you don’t use it as your principal application language it is a great addition to the development toolbox.
Running in reverse is great for testing, where you can generate test cases that hit interesting variant flows.
For example, I have used it to generate input pension payout requests that would hit the interesting special cases for the bespoke bookkeeping rules for each tenant or subsidiary like “for X, the third dimension is always 930, but for Y they have 930 or 931, but then the fourth dimension is 4,6 or 10 depending on the historical subsidiary of the account origin…”
Another great use of logic programming in the daily toolbox is with respect to compliance documentation where you want to document and verify how data points flow across systems or the variables going into aggregates calculated on the way.
This allows you to answer questions like, “our provider for X data delivered bad data for last month, which customer transactions may have been impacted?”, or “this value looks wrong, where did it come from?”
It also allows you to generate exact documentation for this, or even checking the model vs the actual APIs, schemas or data flow or change notifications.
- MrBuddyCasino 5y agoI have no experience with either one, but isn’t this essentially what a SAT solver does? Is there a difference?
- harperlee 5y agoIn SAT you are using propositional logic (“0th order” logic), whereas in prolog normally* you use predicate logic (1st order logic) so you can use existential and universal quentifiers, use variables, etc. * There’s also lambda prolog which enables higher order logic (set logic).
- mynameisash 5y ago> This allows you to answer questions like, ... I hadn't considered that. I've always done bespoke analyses for this. Do you have any suggestions for a practical intro for someone that wants to add Prolog to their toolbox? I'd love to learn not just how to use it but also how to know when to use it.
- jmnicolas 5y ago> I'd love to learn not just how to use it but also how to know when to use it. I think you have to learn it and get some experience before you can know when it's useful. FWIW the only dev I know that had any experience with Prolog told me that it was too slow so his job was to rewrite the program in C. He said it was basically a big loop with ifs and elsifs...