We give here a brief characterization of our methodology, and then we insist on its ... theorems, a common reaction is: " It is clear, you have investigated some ...
A Methodology for Automatic Programming based on the Constructive Matching Strategy Marta Fra~ov~f Laboratoire de Recherche en Informatique, B~t.490, Orsay, 91405 France We give here a brief characterization of our methodology, and then we insist on its novelty by a comparaison of each characteristic of our approach with two others (Manna & Waldinger (M&W) and Boyer & Moore (B&M), characterised in the same way). Our methodology for automatic programming (AP) uses the following tools: - the deductive approach to program synthesis (Manna & Wa2dinger [mO~]), an inductive proving of theorems (Bo2~er & Moore [b 12], Manna & We2dinger [m08]) - a search for transformations of expressions into a given form (tranformational al3oroaeh: Arsac de Kodeao H [a08], Bibe! & Homing [b09]) - a decomposition of problems into subproblems (Smith [sO4]) - recurslve (or constructively defined) data-types (Martin-Lof [mO$]. LMrlington [dO4]); and includes - immntlon of "missing lemmas" (= Kreisel's hope [k12]) - generalization of a generated sequence of sublemmas (Boxer de Moore [b12]). First of all, we wish to refute the possible assertion that our methodology is a mixture of ideas of persons referred to in brackets. The fact that our introduction is somewhat sarcastic is due to the kind of reaction our work has provoked so far. For instance, when we say that we inductively prove theorems, a common reaction is: " It is clear, you have investigated some new techniques (maybe useful) that improve the methodology of M&W, or B&M, or maybe both of them". As another instance, one often identifies our "constructivlsm" (based on clastcal first order logic) with the MartinLof's one! Because of the limited space, we will ordy illustrate the difference between our "inductive-theorem-proving-approach" and that of M&Wand BaM. -
When provtog theorems of the form Vx F(x) by induction, we have at our disposal a hypothesis: For all p smaller th=n ¢tgiven (6u* arbitraod) *¢stqopose the ~a~idity of F(p). One realizes that we cannot argue with a computer In that way, and so we need to automatically propose (or generate) induction hypotheses. How to to it? B&M are directed by a recursive definition of functions, and they formulate induction hypotheses depending on recursive calls occurlng in the "body" of definitions. For instance, when they want to prove the theorem Vx Vy (EQUAL(MC.FLATIXNx y) (APPEND( ~ T I E N x) y)) for functions ~TtXN: ARBRE -, LIST and Me.FLATTEN: ARBRE x LIST -* LIST given by the followingdefinitiorm: '(OON8
z ha)
, ~ n
= is
~m tdom
(FLAT'I'KNz) = (APPEND (FLATTEN (CAR z)) (FLATTEN (CDR z))) ,when z ~ =a =rbr=
(CONS z V) (RC.FIMTTEN z) = [(MCFIMTTKN (CAR z) [ (MCFIMTTEN(CDR=))
,whsn z ~ =,* =tom ,~lwr~zis=m'b~
with regard to the definition of MC.FLATTENthey generate twoplausible (for their purposes) induction hypotheses which will be applied in the "general case" (i.e, when x is represented by (APPEND(CARx) (CDR y))): (1) (EQUAL (MC.FLATTEN (CAR x) (MC.FLATTEN (CDR x) y)) (APPEND (FLATTEN (CAR x).(MC.FLATTEN (CDR x) y)) (If)(EQUAL (MC.FLATTEN (CDR x) y) (APPEND (FLATTEN {CDR x) y)) Then they start to prove the desired theorem. The application of the induction hypotheses is not
performed immediately, but only after several transformations ([h12],pg.89). On the other hand, M&Wgenerate a "general" induction hypothesis, the application of which is, as in B&M's approach, performed as a last operation. For instance, when proving Vx, Vz 2 ((xu>0) =~ (:gz I ~[za ((.~I=.~StZI+Z/~) A (Z8¢7~8)))) they generate the induction hypothesis: Vu (u