/*
 * @(#)$Id: backchain_lemma,v 1.1 1994/09/16 09:33:29 dream Exp $
 *
 * $Log: backchain_lemma,v $
 * Revision 1.1  1994/09/16 09:33:29  dream
 * Initial revision
 *
 */

	% BACKCHAIN_LEMMA METHOD: as lemma, but this time looks
	% for lemma that instantiates to C=>G, with G goal and C a
	% condition which is trivially true.
	%
	% Same hack with commutativity of = as above with lemma.
	% I realise that lemma above is only a special case of
	% backchain_lemma (namely with 0 conjuncts), but it's too tricky
	% to formulate it all in one method, so we use two.
method(backchain_lemma(Lemma),
       H==>G,
       [strip_meta_annotations(G,GG),
        matrix(_,Matrix,GG),
        theorem(Lemma,LemmaGoal),
        (instantiate(LemmaGoal,Cond=>Matrix,_)
         v
         (Matrix=(L=R in T), instantiate(LemmaGoal,Cond=>R=L in T,_))
        ),
        elementary(H==>Cond,_)
       ],
       [],
       [],
       backchain_lemma(Lemma)
      ).       
