proper positions for 'termination' command instead of original 'function' command, e.g. relevant for isabelle mmt_import;
authorwenzelm
Sun, 25 Aug 2019 22:17:24 +0200
changeset 70609 5549e686d6ac
parent 70608 d997c7ba3305
child 70610 d14ddb1df52c
child 70614 6a2c982363e9
proper positions for 'termination' command instead of original 'function' command, e.g. relevant for isabelle mmt_import;
src/HOL/Tools/Function/function.ML
--- a/src/HOL/Tools/Function/function.ML	Sat Aug 24 12:03:00 2019 +0200
+++ b/src/HOL/Tools/Function/function.ML	Sun Aug 25 22:17:24 2019 +0200
@@ -165,7 +165,7 @@
 val function = gen_function false Specification.check_multi_specs
 fun function_cmd a b c int = gen_function int Specification.read_multi_specs a b c
 
-fun prepare_termination_proof prep_term raw_term_opt lthy =
+fun prepare_termination_proof mod_binding prep_term raw_term_opt lthy =
   let
     val term_opt = Option.map (prep_term lthy) raw_term_opt
     val info =
@@ -194,17 +194,18 @@
         val telims = map (map remove_domain_condition) pelims
       in
         lthy
-        |> add_simps I "simps" I simp_attribs tsimps
+        |> add_simps I "simps" mod_binding simp_attribs tsimps
         ||> Code.declare_default_eqns (map (rpair true) tsimps)
         ||>> Local_Theory.note
-          ((derived_name defname "induct", [Attrib.case_names case_names]), tinduct)
+          ((mod_binding (derived_name defname "induct"), [Attrib.case_names case_names]), tinduct)
         ||>> fold_map (note_derived ("elims", [Attrib.consumes 1, Attrib.constraints 1]))
-          (fnames ~~ telims)
+          (map mod_binding fnames ~~ telims)
         |-> (fn ((simps,(_,inducts)), elims) => fn lthy =>
           let val info' = { is_partial=false, defname=defname, fnames=fnames, add_simps=add_simps,
             case_names=case_names, fs=fs, R=R, dom=dom, psimps=psimps, pinducts=pinducts,
             simps=SOME simps, inducts=SOME inducts, termination=termination, totality=SOME totality,
             cases=cases, pelims=pelims, elims=SOME elims}
+            |> transform_function_data (Morphism.binding_morphism "" mod_binding)
           in
             (info',
              lthy
@@ -220,7 +221,7 @@
 fun gen_prove_termination prep_term raw_term_opt tac lthy =
   let
     val (goal, afterqed, termination) =
-      prepare_termination_proof prep_term raw_term_opt lthy
+      prepare_termination_proof I prep_term raw_term_opt lthy
 
     val totality = Goal.prove lthy [] [] goal (K tac)
   in
@@ -232,7 +233,8 @@
 
 fun gen_termination prep_term raw_term_opt lthy =
   let
-    val (goal, afterqed, termination) = prepare_termination_proof prep_term raw_term_opt lthy
+    val (goal, afterqed, termination) =
+      prepare_termination_proof Binding.reset_pos prep_term raw_term_opt lthy
   in
     lthy
     |> Proof_Context.note_thms ""