src/HOL/Tools/function_package/lexicographic_order.ML
changeset 24920 2a45e400fdad
parent 24576 32ddd902b0ad
child 24961 5298ee9c3fe5
equal deleted inserted replaced
24919:ad3a8569759c 24920:2a45e400fdad
   250      |> flat
   250      |> flat
   251      |> map (pr_unprovable_cell ctxt)
   251      |> map (pr_unprovable_cell ctxt)
   252 
   252 
   253 fun no_order_msg ctxt table tl measure_funs =
   253 fun no_order_msg ctxt table tl measure_funs =
   254     let
   254     let
   255       val prterm = ProofContext.string_of_term ctxt
   255       val prterm = Syntax.string_of_term ctxt
   256       fun pr_fun t i = string_of_int i ^ ") " ^ prterm t
   256       fun pr_fun t i = string_of_int i ^ ") " ^ prterm t
   257 
   257 
   258       fun pr_goal t i =
   258       fun pr_goal t i =
   259           let
   259           let
   260             val (_, _, lhs, rhs) = dest_term t
   260             val (_, _, lhs, rhs) = dest_term t
   290           handle Option => error (no_order_msg ctxt table tl measure_funs)
   290           handle Option => error (no_order_msg ctxt table tl measure_funs)
   291 
   291 
   292       val clean_table = map (fn x => map (nth x) order) table
   292       val clean_table = map (fn x => map (nth x) order) table
   293 
   293 
   294       val relation = mk_measures domT (map (nth measure_funs) order)
   294       val relation = mk_measures domT (map (nth measure_funs) order)
   295       val _ = writeln ("Found termination order: " ^ quote (ProofContext.string_of_term ctxt relation))
   295       val _ = writeln ("Found termination order: " ^ quote (Syntax.string_of_term ctxt relation))
   296 
   296 
   297     in (* 4: proof reconstruction *)
   297     in (* 4: proof reconstruction *)
   298       st |> (PRIMITIVE (cterm_instantiate [(cterm_of thy rel, cterm_of thy relation)])
   298       st |> (PRIMITIVE (cterm_instantiate [(cterm_of thy rel, cterm_of thy relation)])
   299               THEN (REPEAT (rtac @{thm "wf_mlex"} 1))
   299               THEN (REPEAT (rtac @{thm "wf_mlex"} 1))
   300               THEN (rtac @{thm "wf_empty"} 1)
   300               THEN (rtac @{thm "wf_empty"} 1)