src/HOL/Tools/Function/termination.ML
changeset 59582 0fbed69ff081
parent 57959 1bfed12a7646
child 59618 e6939796717e
equal deleted inserted replaced
59580:cbc38731d42f 59582:0fbed69ff081
   142     val goal =
   142     val goal =
   143       HOLogic.mk_eq (HOLogic.mk_binop @{const_name Relation.relcomp} (c1, c2),
   143       HOLogic.mk_eq (HOLogic.mk_binop @{const_name Relation.relcomp} (c1, c2),
   144         Const (@{const_abbrev Set.empty}, fastype_of c1))
   144         Const (@{const_abbrev Set.empty}, fastype_of c1))
   145       |> HOLogic.mk_Trueprop (* "C1 O C2 = {}" *)
   145       |> HOLogic.mk_Trueprop (* "C1 O C2 = {}" *)
   146   in
   146   in
   147     case Function_Lib.try_proof (cterm_of thy goal) chain_tac of
   147     case Function_Lib.try_proof (Thm.cterm_of thy goal) chain_tac of
   148       Function_Lib.Solved thm => SOME thm
   148       Function_Lib.Solved thm => SOME thm
   149     | _ => NONE
   149     | _ => NONE
   150   end
   150   end
   151 
   151 
   152 
   152 
   167 fun dest_call (sk, _, _, _, _) = dest_call' sk
   167 fun dest_call (sk, _, _, _, _) = dest_call' sk
   168 
   168 
   169 fun mk_desc thy tac vs Gam l r m1 m2 =
   169 fun mk_desc thy tac vs Gam l r m1 m2 =
   170   let
   170   let
   171     fun try rel =
   171     fun try rel =
   172       try_proof (cterm_of thy
   172       try_proof (Thm.cterm_of thy
   173         (Logic.list_all (vs,
   173         (Logic.list_all (vs,
   174            Logic.mk_implies (HOLogic.mk_Trueprop Gam,
   174            Logic.mk_implies (HOLogic.mk_Trueprop Gam,
   175              HOLogic.mk_Trueprop (Const (rel, @{typ "nat => nat => bool"})
   175              HOLogic.mk_Trueprop (Const (rel, @{typ "nat => nat => bool"})
   176                $ (m2 $ r) $ (m1 $ l)))))) tac
   176                $ (m2 $ r) $ (m1 $ l)))))) tac
   177   in
   177   in
   179        Solved thm => Less thm
   179        Solved thm => Less thm
   180      | Stuck thm =>
   180      | Stuck thm =>
   181        (case try @{const_name Orderings.less_eq} of
   181        (case try @{const_name Orderings.less_eq} of
   182           Solved thm2 => LessEq (thm2, thm)
   182           Solved thm2 => LessEq (thm2, thm)
   183         | Stuck thm2 =>
   183         | Stuck thm2 =>
   184           if prems_of thm2 = [HOLogic.Trueprop $ @{term False}]
   184           if Thm.prems_of thm2 = [HOLogic.Trueprop $ @{term False}]
   185           then False thm2 else None (thm2, thm)
   185           then False thm2 else None (thm2, thm)
   186         | _ => raise Match) (* FIXME *)
   186         | _ => raise Match) (* FIXME *)
   187      | _ => raise Match
   187      | _ => raise Match
   188 end
   188 end
   189 
   189 
   273 in
   273 in
   274 
   274 
   275 fun wf_union_tac ctxt st = SUBGOAL (fn _ =>
   275 fun wf_union_tac ctxt st = SUBGOAL (fn _ =>
   276   let
   276   let
   277     val thy = Proof_Context.theory_of ctxt
   277     val thy = Proof_Context.theory_of ctxt
   278     val cert = cterm_of thy
   278     val cert = Thm.cterm_of thy
   279     val ((_ $ (_ $ rel)) :: ineqs) = prems_of st
   279     val ((_ $ (_ $ rel)) :: ineqs) = Thm.prems_of st
   280 
   280 
   281     fun mk_compr ineq =
   281     fun mk_compr ineq =
   282       let
   282       let
   283         val (vars, prems, lhs, rhs) = dest_term ineq
   283         val (vars, prems, lhs, rhs) = dest_term ineq
   284       in
   284       in