src/Pure/drule.ML
changeset 4270 957c887b89b5
parent 4057 edd8cb346109
child 4281 6c6073b13600
equal deleted inserted replaced
4269:a045600f0c98 4270:957c887b89b5
   254                          (sP, propT)))
   254                          (sP, propT)))
   255     in forall_elim_vars 0 (assume (cterm_of sign prop))  end;
   255     in forall_elim_vars 0 (assume (cterm_of sign prop))  end;
   256 
   256 
   257 (*Resolution: exactly one resolvent must be produced.*)
   257 (*Resolution: exactly one resolvent must be produced.*)
   258 fun tha RSN (i,thb) =
   258 fun tha RSN (i,thb) =
   259   case Sequence.chop (2, biresolution false [(false,tha)] i thb) of
   259   case Seq.chop (2, biresolution false [(false,tha)] i thb) of
   260       ([th],_) => th
   260       ([th],_) => th
   261     | ([],_)   => raise THM("RSN: no unifiers", i, [tha,thb])
   261     | ([],_)   => raise THM("RSN: no unifiers", i, [tha,thb])
   262     |      _   => raise THM("RSN: multiple unifiers", i, [tha,thb]);
   262     |      _   => raise THM("RSN: multiple unifiers", i, [tha,thb]);
   263 
   263 
   264 (*resolution: P==>Q, Q==>R gives P==>R. *)
   264 (*resolution: P==>Q, Q==>R gives P==>R. *)
   265 fun tha RS thb = tha RSN (1,thb);
   265 fun tha RS thb = tha RSN (1,thb);
   266 
   266 
   267 (*For joining lists of rules*)
   267 (*For joining lists of rules*)
   268 fun thas RLN (i,thbs) =
   268 fun thas RLN (i,thbs) =
   269   let val resolve = biresolution false (map (pair false) thas) i
   269   let val resolve = biresolution false (map (pair false) thas) i
   270       fun resb thb = Sequence.list_of_s (resolve thb) handle THM _ => []
   270       fun resb thb = Seq.list_of (resolve thb) handle THM _ => []
   271   in  List.concat (map resb thbs)  end;
   271   in  List.concat (map resb thbs)  end;
   272 
   272 
   273 fun thas RL thbs = thas RLN (1,thbs);
   273 fun thas RL thbs = thas RLN (1,thbs);
   274 
   274 
   275 (*Resolve a list of rules against bottom_rl from right to left;
   275 (*Resolve a list of rules against bottom_rl from right to left;
   287 
   287 
   288 (*compose Q and [...,Qi,Q(i+1),...]==>R to [...,Q(i+1),...]==>R
   288 (*compose Q and [...,Qi,Q(i+1),...]==>R to [...,Q(i+1),...]==>R
   289   with no lifting or renaming!  Q may contain ==> or meta-quants
   289   with no lifting or renaming!  Q may contain ==> or meta-quants
   290   ALWAYS deletes premise i *)
   290   ALWAYS deletes premise i *)
   291 fun compose(tha,i,thb) =
   291 fun compose(tha,i,thb) =
   292     Sequence.list_of_s (bicompose false (false,tha,0) i thb);
   292     Seq.list_of (bicompose false (false,tha,0) i thb);
   293 
   293 
   294 (*compose Q and [Q1,Q2,...,Qk]==>R to [Q2,...,Qk]==>R getting unique result*)
   294 (*compose Q and [Q1,Q2,...,Qk]==>R to [Q2,...,Qk]==>R getting unique result*)
   295 fun tha COMP thb =
   295 fun tha COMP thb =
   296     case compose(tha,1,thb) of
   296     case compose(tha,1,thb) of
   297         [th] => th
   297         [th] => th