src/HOL/Tools/SMT/smt_normalize.ML
changeset 75274 e89709b80b6e
parent 74561 8e6c973003c8
child 77879 dd222e2af01a
equal deleted inserted replaced
75273:f1c6e778e412 75274:e89709b80b6e
    13   val case_bool_entry: string * thm
    13   val case_bool_entry: string * thm
    14   val abs_min_max_table: (string * thm) list
    14   val abs_min_max_table: (string * thm) list
    15 
    15 
    16   type extra_norm = Proof.context -> thm list * thm list -> thm list * thm list
    16   type extra_norm = Proof.context -> thm list * thm list -> thm list * thm list
    17   val add_extra_norm: SMT_Util.class * extra_norm -> Context.generic -> Context.generic
    17   val add_extra_norm: SMT_Util.class * extra_norm -> Context.generic -> Context.generic
    18   val normalize: Proof.context -> thm list -> (int * thm) list
    18   val normalize: Proof.context -> (SMT_Util.role * thm) list -> ((int * SMT_Util.role) * thm) list
    19 end;
    19 end;
    20 
    20 
    21 structure SMT_Normalize: SMT_NORMALIZE =
    21 structure SMT_Normalize: SMT_NORMALIZE =
    22 struct
    22 struct
    23 
    23 
   446 
   446 
   447 fun burrow_ids f ithms =
   447 fun burrow_ids f ithms =
   448   let
   448   let
   449     val (is, thms) = split_list ithms
   449     val (is, thms) = split_list ithms
   450     val (thms', extra_thms) = f thms
   450     val (thms', extra_thms) = f thms
   451   in (is ~~ thms') @ map (pair ~1) extra_thms end
   451   in (is ~~ thms') @ map (pair (~1, SMT_Util.Axiom)) extra_thms end
   452 
   452 
   453 fun unfold_conv ctxt =
   453 fun unfold_conv ctxt =
   454   rewrite_case_bool_conv ctxt then_conv
   454   rewrite_case_bool_conv ctxt then_conv
   455   unfold_abs_min_max_conv ctxt then_conv
   455   unfold_abs_min_max_conv ctxt then_conv
   456   (if Config.get ctxt SMT_Config.nat_as_int then nat_as_int_conv ctxt
   456   (if Config.get ctxt SMT_Config.nat_as_int then nat_as_int_conv ctxt
   513 
   513 
   514 end
   514 end
   515 
   515 
   516 fun normalize ctxt wthms =
   516 fun normalize ctxt wthms =
   517   wthms
   517   wthms
   518   |> map_index I
   518   |> map_index (fn (n, (role, thm)) => ((n, role), thm))
   519   |> gen_normalize ctxt
   519   |> gen_normalize ctxt
   520   |> unfold_polymorph ctxt
   520   |> unfold_polymorph ctxt
   521   |> monomorph ctxt
   521   |> monomorph ctxt
   522   |> unfold_monomorph ctxt
   522   |> unfold_monomorph ctxt
   523   |> apply_extra_norms ctxt
   523   |> apply_extra_norms ctxt