Deductive synthesis of the unification algorithm

Zohar Manna, Richard Waldinger
1981 Science of Computer Programming  
Abstnet. The deductive appmuch is a formal program construction method in which the derivation of a program from a given specification is regarded as a theorem-proving task. To construct a program whose output satisfies the conditions of the specification, we prove a theorem stating the existence of such an output. The proof is restricted to be sufficrent!y constructive so tha: a program computing the desired output can be extracted directly from the proof. The program we obtain is applicative
more » ... nd may consist of several ~mtitually recursive procedures. The proof constitutes a demonstration of the correctness of this program. To exhibit the full power of the deductive approach, we apply it to a nontrivial example-the synthesis of a unification algorithm. Unificztion is the process of finding a common instance of two expressions. Algorithms to perform unification have been central to manv theorem-proving systems :qnd to some programming-langzage processors. The tack of deriving a unification algorithm automatically is beyond tbe power of existing program synthesis systems. In this paper, we use the deductive approach to> derive an algorithm from a simple, h&&-level specification of the unification task. We will identify some of capabilities required of a theorem-provi,rrg system to perform this derivation automatically. the [ 121) we describe a deductive approach to program synthesis. In this approach, ; -rograrn synthesis is regarded as a theoremproving task: Given a high-level specif Ition of the purpose of the program, we prove a theorem that establishes the existence of an output satisfying this specification. The proof is restricted to be sticiently constructive so that the desired program can be extracted directly. This approach is the direct descendant of the technique applied, e.g., bar Green [5] and by Waldinger and be [20]. * 1~ &e ea&r paper" we only applied the techaique 80 very simple examples. In taco papr, we ansijderr a somewhat more difficult t~k: the synthesis of a unification on is the pmxss of finding a common instance of two expressions. If eb a ,imsga& eai$tg+ tb algorithm is -to prodti&"r :st&stiltuti& that will yield nsmc4: when app&d to either of the expressions. If nxi common instance the algorithm !S to produce a special symbol indicating this situation. The r&m appeared in Herbrand's [6] thesis, but the procedure did pread attention until it was re$iscovered by Prawitz [16] and ~~p~~~~ by Robinson [17] in his resolution principle for automatic theorem-" Sime then" time algorithm has been used not only for resolution theoremmany nonresolution theorem provers (see Bledsoe [l]) and ari Usage prt%essors (e.g. In an earlier paper (Manna and Waldinger
doi:10.1016/0167-6423(81)90004-6 fatcat:h5t3cvxdrjf5zjdxzn2vw7ltpm