/* -*- Prolog -*-
 * @@(#)$Id: fertilization_strong,v 1.1.4.2 1999/05/07 09:29:00 rjb Exp $
 *
 * $Log: fertilization_strong,v $
 * Revision 1.1.4.2  1999/05/07 09:29:00  rjb
 * Extended strong fertilization.
 *
 * Revision 1.1.4.1  1999/02/05 18:43:23  rjb
 * Fertilization methods now specify the whole hypothesis not just its label.
 *
 * Revision 1.1  1996/12/11 15:09:21  img
 * Merge of mthd and smthd libraries.
 *
 * Revision 1.2  1996/12/04  13:14:51  img
 * Use inductive_hypothesis.
 *
 * Revision 1.1  1994/09/16  09:34:27  dream
 * Initial revision
 */

method(fertilization_strong(strong_fertilize([],Hyp-Hypothesis)),
       H==>G,
       [matrix(_,Matrix,G),
        /* simple instance */
        inductive_hypothesis(Status,Hyp:Hypothesis,H),
        instantiate(Hypothesis,Matrix,_) ],
       [],
       [],
       fertilization_strong(strong_fertilize([],Hyp-Hypothesis))
      ).

method(fertilization_strong(strong_fertilize(Pos,Hyp-Hypothesis) then Method),
       H==>G,
       [matrix(Vs,Matrix,G),
        /* case when a hypothesis matches a wave hole */
        iswf(Matrix,InFront,_),
        /* only works for single-hole wave-fronts */
        ann_exp_at(in_front,in_hole,InFront,Pos,Hole), !,
        inductive_hypothesis(Status,Hyp:Hypothesis,H),
        instantiate(Hypothesis,Hole,_) ],
       [raw_to_used(H,Hyp,NewH),
        erase(Matrix,UMatrix),
        replace(Pos,{true},UMatrix,NewMatrix),
        matrix(Vs,NewMatrix,NewG),
        Method = elementary(_),
        applicable_submethod(NewH==>NewG,Method,_,[])],
       [],
       fertilization_strong(strong_fertilize(Pos,Hyp-Hypothesis) then Method)
      ).
