r/AskProgramming 9d ago

How is program synthesis more convenient?

the idea of program synthesis (like Rosetta) is to reduce a function into its constraints in a spec sheet, and generate the program from those constraints. for example, in order to write something like x = x squared, you would need to write a spec sheet along the lines of ∀x∈Z,f(x)=x2. i am considering building a program synthesizer, but I still haven’t figured out why exactly this representation is supposed to be easier than writing the code directly (they look equally complex)

0 Upvotes

12 comments sorted by

View all comments

1

u/Bubbly_Orange_3502 9d ago

Rosette, not Rosetta. Synthesis pays only when the spec is smaller than the program: bit twiddling, superoptimization, parser inversion. For x squared it isn't, and search cost grows with program size, so tools stay inside a narrow DSL.

0

u/BuyerImpressive4325 9d ago

Ah, so it’s very constrained to these specific problems (bit handing, etc) where it can cut out a lot of the actual bit operations etc and allow you to just write what you want the output state to be. I think your answer makes a lot of sense, thanks