r/computerscience • • Oct 24 '26

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?

5 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/neuralbeans Oct 24 '26

The specification focuses on the what as opposed to the how. When programming you have to take decisions about how to carry out a task whereas when specifying you only say what the task is.

If the task is sorting a list, then the program would be an implementation of one of the many sorting algorithms but the specification would be something like this:

given list xs, return list ys such that:

  • ys contains all the elements in xs at the same number of times
  • for all i < j, ys[i] <= ys[j]

The synthesiser should the figure out the best program that meets the requirements.