src/HOL/Tools/Function/function_core.ML
changeset 59580 cbc38731d42f
parent 59498 50b60f501b05
child 59582 0fbed69ff081
equal deleted inserted replaced
59579:d8fff0b94c53 59580:cbc38731d42f
   181 fun mk_clause_info globals G f no cdata qglr tree RCs GIntro_thm RIntro_thms =
   181 fun mk_clause_info globals G f no cdata qglr tree RCs GIntro_thm RIntro_thms =
   182   let
   182   let
   183     val Globals {h, ...} = globals
   183     val Globals {h, ...} = globals
   184 
   184 
   185     val ClauseContext { ctxt, qs, cqs, ags, ... } = cdata
   185     val ClauseContext { ctxt, qs, cqs, ags, ... } = cdata
   186     val cert = Thm.cterm_of (Proof_Context.theory_of ctxt)
   186     val cert = Proof_Context.cterm_of ctxt
   187 
   187 
   188     (* Instantiate the GIntro thm with "f" and import into the clause context. *)
   188     (* Instantiate the GIntro thm with "f" and import into the clause context. *)
   189     val lGI = GIntro_thm
   189     val lGI = GIntro_thm
   190       |> Thm.forall_elim (cert f)
   190       |> Thm.forall_elim (cert f)
   191       |> fold Thm.forall_elim cqs
   191       |> fold Thm.forall_elim cqs
   451           [] (* no parameters *)
   451           [] (* no parameters *)
   452           (map (fn t => (Attrib.empty_binding, t)) intrs) (* intro rules *)
   452           (map (fn t => (Attrib.empty_binding, t)) intrs) (* intro rules *)
   453           [] (* no special monos *)
   453           [] (* no special monos *)
   454       ||> Local_Theory.restore_naming lthy
   454       ||> Local_Theory.restore_naming lthy
   455 
   455 
   456     val cert = cterm_of (Proof_Context.theory_of lthy)
   456     val cert = Proof_Context.cterm_of lthy
   457     fun requantify orig_intro thm =
   457     fun requantify orig_intro thm =
   458       let
   458       let
   459         val (qs, t) = dest_all_all orig_intro
   459         val (qs, t) = dest_all_all orig_intro
   460         val frees = Variable.add_frees lthy t [] |> remove (op =) (Binding.name_of R, T)
   460         val frees = Variable.add_frees lthy t [] |> remove (op =) (Binding.name_of R, T)
   461         val vars = Term.add_vars (prop_of thm) []
   461         val vars = Term.add_vars (prop_of thm) []
   869       Local_Theory.abbrev Syntax.mode_default ((Binding.name (dom_name defname), NoSyn), dom) lthy
   869       Local_Theory.abbrev Syntax.mode_default ((Binding.name (dom_name defname), NoSyn), dom) lthy
   870 
   870 
   871     val newthy = Proof_Context.theory_of lthy
   871     val newthy = Proof_Context.theory_of lthy
   872     val clauses = map (transfer_clause_ctx newthy) clauses
   872     val clauses = map (transfer_clause_ctx newthy) clauses
   873 
   873 
   874     val cert = cterm_of (Proof_Context.theory_of lthy)
   874     val cert = Proof_Context.cterm_of lthy
   875 
   875 
   876     val xclauses = PROFILE "xclauses"
   876     val xclauses = PROFILE "xclauses"
   877       (@{map 7} (mk_clause_info globals G f) (1 upto n) clauses abstract_qglrs trees
   877       (@{map 7} (mk_clause_info globals G f) (1 upto n) clauses abstract_qglrs trees
   878         RCss GIntro_thms) RIntro_thmss
   878         RCss GIntro_thms) RIntro_thmss
   879 
   879