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

	% LEMMA METHOD: optionally loaded. Is useful in places, but
	% expensive in general.
	% Bit of a hack to deal with commutativity of =.
	% Possibly a more elegant solution to this would be to teach
	% instantiate/3 about the commutativity of =, but that would
	% increase the general cost of instantiate/3. 
method(apply_lemma(Lemma),
       _==>G,
       [strip_meta_annotations(G,GG),
        precon_matrix(_,AllPre=>Concl,GG),
	append( _, Pre, AllPre ),
	precon_matrix( [], Pre=>Concl, Matrix ),
        theorem(Lemma,LemmaGoal),
        (instantiate(LemmaGoal,Matrix,_)
         v
         (Matrix=(L=R in T),instantiate(LemmaGoal,R=L in T,_))
        )
       ],
       [],
       [],
       apply_lemma(Lemma)
      ).
