src/HOL/Tools/Nitpick/nitpick_preproc.ML
changeset 35311 8f9a66fc9f80
parent 35284 9edc2bd6d2bd
child 35312 99cd1f96b400
equal deleted inserted replaced
35309:997aa3a3e4bb 35311:8f9a66fc9f80
   291       | @{const "op -->"} $ t1 $ t2 =>
   291       | @{const "op -->"} $ t1 $ t2 =>
   292         @{const "op -->"} $ do_term new_Ts old_Ts (flip_polarity polar) t1
   292         @{const "op -->"} $ do_term new_Ts old_Ts (flip_polarity polar) t1
   293         $ do_term new_Ts old_Ts polar t2
   293         $ do_term new_Ts old_Ts polar t2
   294       | Const (s as @{const_name The}, T) => do_description_operator s T
   294       | Const (s as @{const_name The}, T) => do_description_operator s T
   295       | Const (s as @{const_name Eps}, T) => do_description_operator s T
   295       | Const (s as @{const_name Eps}, T) => do_description_operator s T
   296       | Const (@{const_name quot_normal}, Type ("fun", [T, _])) =>
       
   297         let val T' = box_type hol_ctxt InFunLHS T in
       
   298           Const (@{const_name quot_normal}, T' --> T')
       
   299         end
       
   300       | Const (s as @{const_name Tha}, T) => do_description_operator s T
   296       | Const (s as @{const_name Tha}, T) => do_description_operator s T
   301       | Const (x as (s, T)) =>
   297       | Const (x as (s, T)) =>
   302         Const (s, if s = @{const_name converse} orelse
   298         Const (s, if s = @{const_name converse} orelse
   303                      s = @{const_name trancl} then
   299                      s = @{const_name trancl} then
   304                     box_relational_operator_type T
   300                     box_relational_operator_type T
       
   301                   else if String.isPrefix quot_normal_prefix s then
       
   302                     let val T' = box_type hol_ctxt InFunLHS (domain_type T) in
       
   303                       T' --> T'
       
   304                     end
   305                   else if is_built_in_const thy stds fast_descrs x orelse
   305                   else if is_built_in_const thy stds fast_descrs x orelse
   306                           s = @{const_name Sigma} then
   306                           s = @{const_name Sigma} then
   307                     T
   307                     T
   308                   else if is_constr_like thy x then
   308                   else if is_constr_like thy x then
   309                     box_type hol_ctxt InConstr T
   309                     box_type hol_ctxt InConstr T
  1020 (* Prevents divergence in case of cyclic or infinite axiom dependencies. *)
  1020 (* Prevents divergence in case of cyclic or infinite axiom dependencies. *)
  1021 val axioms_max_depth = 255
  1021 val axioms_max_depth = 255
  1022 
  1022 
  1023 (* hol_context -> term -> (term list * term list) * (bool * bool) *)
  1023 (* hol_context -> term -> (term list * term list) * (bool * bool) *)
  1024 fun axioms_for_term
  1024 fun axioms_for_term
  1025         (hol_ctxt as {thy, max_bisim_depth, stds, user_axioms, fast_descrs,
  1025         (hol_ctxt as {thy, ctxt, max_bisim_depth, stds, user_axioms,
  1026                       evals, def_table, nondef_table, user_nondefs, ...}) t =
  1026                       fast_descrs, evals, def_table, nondef_table, user_nondefs,
       
  1027                       ...}) t =
  1027   let
  1028   let
  1028     type accumulator = styp list * (term list * term list)
  1029     type accumulator = styp list * (term list * term list)
  1029     (* (term list * term list -> term list)
  1030     (* (term list * term list -> term list)
  1030        -> ((term list -> term list) -> term list * term list
  1031        -> ((term list -> term list) -> term list * term list
  1031            -> term list * term list)
  1032            -> term list * term list)
  1132       | Type (z as (_, Ts)) =>
  1133       | Type (z as (_, Ts)) =>
  1133         fold (add_axioms_for_type depth) Ts
  1134         fold (add_axioms_for_type depth) Ts
  1134         #> (if is_pure_typedef thy T then
  1135         #> (if is_pure_typedef thy T then
  1135               fold (add_maybe_def_axiom depth) (optimized_typedef_axioms thy z)
  1136               fold (add_maybe_def_axiom depth) (optimized_typedef_axioms thy z)
  1136             else if is_quot_type thy T then
  1137             else if is_quot_type thy T then
  1137               fold (add_def_axiom depth) (optimized_quot_type_axioms thy stds z)
  1138               fold (add_def_axiom depth)
       
  1139                    (optimized_quot_type_axioms ctxt stds z)
  1138             else if max_bisim_depth >= 0 andalso is_codatatype thy T then
  1140             else if max_bisim_depth >= 0 andalso is_codatatype thy T then
  1139               fold (add_maybe_def_axiom depth)
  1141               fold (add_maybe_def_axiom depth)
  1140                    (codatatype_bisim_axioms hol_ctxt T)
  1142                    (codatatype_bisim_axioms hol_ctxt T)
  1141             else
  1143             else
  1142               I)
  1144               I)