src/HOL/Tools/BNF/bnf_def.ML
changeset 66272 c6714a9562ae
parent 66198 4a5589dd8e1a
child 67222 19809bc9d7ff
equal deleted inserted replaced
66271:d157195a468a 66272:c6714a9562ae
   141   datatype fact_policy = Dont_Note | Note_Some | Note_All
   141   datatype fact_policy = Dont_Note | Note_Some | Note_All
   142 
   142 
   143   val bnf_internals: bool Config.T
   143   val bnf_internals: bool Config.T
   144   val bnf_timing: bool Config.T
   144   val bnf_timing: bool Config.T
   145   val user_policy: fact_policy -> Proof.context -> fact_policy
   145   val user_policy: fact_policy -> Proof.context -> fact_policy
   146   val note_bnf_thms: fact_policy -> (binding -> binding) -> binding -> bnf -> Proof.context ->
   146   val note_bnf_thms: fact_policy -> (binding -> binding) -> binding -> bnf -> local_theory ->
   147     bnf * Proof.context
   147     bnf * local_theory
       
   148   val note_bnf_defs: bnf -> local_theory -> bnf * local_theory
   148 
   149 
   149   val print_bnfs: Proof.context -> unit
   150   val print_bnfs: Proof.context -> unit
   150   val prepare_def: inline_policy -> (Proof.context -> fact_policy) -> bool ->
   151   val prepare_def: inline_policy -> (Proof.context -> fact_policy) -> bool ->
   151     (binding -> binding) -> (Proof.context -> 'a -> typ) -> (Proof.context -> 'b -> term) ->
   152     (binding -> binding) -> (Proof.context -> 'a -> typ) -> (Proof.context -> 'b -> term) ->
   152     typ list option -> binding -> binding -> binding -> binding list ->
   153     typ list option -> binding -> binding -> binding -> binding list ->
   981     |> fact_policy = Note_All ? note_if_note_all
   982     |> fact_policy = Note_All ? note_if_note_all
   982     |> fact_policy <> Dont_Note ? note_unless_dont_note
   983     |> fact_policy <> Dont_Note ? note_unless_dont_note
   983     |>> (fn [] => bnf | noted => morph_bnf (substitute_noted_thm noted) bnf)
   984     |>> (fn [] => bnf | noted => morph_bnf (substitute_noted_thm noted) bnf)
   984   end;
   985   end;
   985 
   986 
       
   987 fun note_bnf_defs bnf lthy =
       
   988   let
       
   989     fun mk_def_binding cst_of =
       
   990       Thm.def_binding (Binding.qualified_name (dest_Const (cst_of bnf) |> fst));
       
   991     val notes =
       
   992       [(mk_def_binding map_of_bnf, map_def_of_bnf bnf),
       
   993        (mk_def_binding rel_of_bnf, rel_def_of_bnf bnf),
       
   994        (mk_def_binding pred_of_bnf, pred_def_of_bnf bnf)] @
       
   995       @{map 2} (pair o mk_def_binding o K) (sets_of_bnf bnf) (set_defs_of_bnf bnf)
       
   996       |> map (fn (b, thm) => ((b, []), [([thm], [])]));
       
   997   in
       
   998     lthy
       
   999     |> Local_Theory.notes notes
       
  1000     |>> (fn noted => morph_bnf (substitute_noted_thm noted) bnf)
       
  1001   end;
       
  1002 
   986 fun mk_wit_goals zs bs sets (I, wit) =
  1003 fun mk_wit_goals zs bs sets (I, wit) =
   987   let
  1004   let
   988     val xs = map (nth bs) I;
  1005     val xs = map (nth bs) I;
   989     fun wit_goal i =
  1006     fun wit_goal i =
   990       let
  1007       let