src/Provers/simp.ML
changeset 14772 c52060b69a8c
parent 14643 130076a81b84
child 15531 08c8dad8e399
equal deleted inserted replaced
14771:c2bf21b5564e 14772:c52060b69a8c
   573 fun find_subst tsig T =
   573 fun find_subst tsig T =
   574 let fun find (thm::thms) =
   574 let fun find (thm::thms) =
   575 	let val (Const(_,cT), va, vb) =	dest_red(hd(prems_of thm));
   575 	let val (Const(_,cT), va, vb) =	dest_red(hd(prems_of thm));
   576 	    val [P] = term_vars(concl_of thm) \\ [va,vb]
   576 	    val [P] = term_vars(concl_of thm) \\ [va,vb]
   577 	    val eqT::_ = binder_types cT
   577 	    val eqT::_ = binder_types cT
   578         in if Type.typ_instance(tsig,T,eqT) then Some(thm,va,vb,P)
   578         in if Type.typ_instance tsig (T,eqT) then Some(thm,va,vb,P)
   579 	   else find thms
   579 	   else find thms
   580 	end
   580 	end
   581       | find [] = None
   581       | find [] = None
   582 in find subst_thms end;
   582 in find subst_thms end;
   583 
   583 
   605 fun mk_cong_type sg (f,T) =
   605 fun mk_cong_type sg (f,T) =
   606 let val (aTs,rT) = strip_type T;
   606 let val (aTs,rT) = strip_type T;
   607     val tsig = Sign.tsig_of sg;
   607     val tsig = Sign.tsig_of sg;
   608     fun find_refl(r::rs) =
   608     fun find_refl(r::rs) =
   609 	let val (Const(eq,eqT),_,_) = dest_red(concl_of r)
   609 	let val (Const(eq,eqT),_,_) = dest_red(concl_of r)
   610 	in if Type.typ_instance(tsig, rT, hd(binder_types eqT))
   610 	in if Type.typ_instance tsig (rT, hd(binder_types eqT))
   611 	   then Some(r,(eq,body_type eqT)) else find_refl rs
   611 	   then Some(r,(eq,body_type eqT)) else find_refl rs
   612 	end
   612 	end
   613       | find_refl([]) = None;
   613       | find_refl([]) = None;
   614 in case find_refl refl_thms of
   614 in case find_refl refl_thms of
   615      None => []  |  Some(refl) => [mk_cong sg (f,aTs,rT) refl]
   615      None => []  |  Some(refl) => [mk_cong sg (f,aTs,rT) refl]