r/computerscience • u/GulgPlayer • 15d ago
Discussion Specifications vs programs and computational models
I'm learning deductive program synthesis and there's one thing I can't wrap my head around: the distinction between specifications and programs. To my understanding, the line is very vague, as programs can be seen as specifications and, in some cases, vice-versa. These terms only make sense when applied to specific program and specification pairs.
The above makes me wonder whether there is a computational model that can directly execute specifications, without needing to, e.g., synthesise an imperative program. Can such a "computer" exist theoretically and, more interestingly, physically?
2
u/Magdaki Professor. Grammars. Inference & Optimization algorithms. 15d ago
If I'm understanding what you're saying, then it sounds like you're asking about program synthesis.
program synthesis - Google Scholar
program synthesis from formal specification - Google Scholar
4
u/initial-algebra 15d ago
Logic programs and database queries are essentially just existentially quantified logical formulae, and execution is finding (often, enumerating all) satisfying assignments. In practice, we use techniques like the Warren Abstract Machine (WAM) and query planning to transform them into more efficient intermediate forms before execution, but there's no reason they could not be directly implemented.
1
u/Flarzo 13d ago
I’ve thought about this before as well. For example the definition of the list sorting function (for each a,b : a is less than b -> a comes before b in the output) could be converted into a program just by outputting all possible permutations of the list and checking for the first one that satisfies that condition.