src/HOL/Tools/Nitpick/nitpick_tests.ML
changeset 38190 b02e204b613a
parent 38186 c28018f5a1d6
child 41793 c7a2669ae75d
     1.1 --- a/src/HOL/Tools/Nitpick/nitpick_tests.ML	Tue Aug 03 21:37:12 2010 +0200
     1.2 +++ b/src/HOL/Tools/Nitpick/nitpick_tests.ML	Wed Aug 04 10:39:35 2010 +0200
     1.3 @@ -23,10 +23,8 @@
     1.4  
     1.5  fun cast_to_rep R u = Op1 (Cast, type_of u, R, u)
     1.6  
     1.7 -val unit_T = @{typ unit}
     1.8  val dummy_T = @{typ 'a}
     1.9  
    1.10 -val unity = Cst (Unity, unit_T, Unit)
    1.11  val atom1_v1 = FreeName ("atom1_v1", dummy_T, Atom (1, 0))
    1.12  val atom2_v1 = FreeName ("atom2_v1", dummy_T, Atom (2, 0))
    1.13  val atom6_v1 = FreeName ("atom6_v1", dummy_T, Atom (6, 0))
    1.14 @@ -36,19 +34,14 @@
    1.15  val atom81_v1 = FreeName ("atom81_v1", dummy_T, Atom (81, 0))
    1.16  val struct_atom1_atom1_v1 =
    1.17    FreeName ("struct_atom1_atom1_v1", dummy_T, Struct [Atom (1, 0), Atom (1, 0)])
    1.18 -val struct_atom1_unit_v1 =
    1.19 -  FreeName ("struct_atom1_atom1_v1", dummy_T, Struct [Atom (1, 0), Unit])
    1.20 -val struct_unit_atom1_v1 =
    1.21 -  FreeName ("struct_atom1_atom1_v1", dummy_T, Struct [Unit, Atom (1, 0)])
    1.22  
    1.23  (*
    1.24 -              Formula    Unit   Atom    Struct    Vect    Func
    1.25 -    Formula      X       N/A     X        X       N/A     N/A
    1.26 -    Unit        N/A      N/A    N/A      N/A      N/A     N/A
    1.27 -    Atom         X       N/A     X        X        X       X
    1.28 -    Struct      N/A      N/A     X        X       N/A     N/A
    1.29 -    Vect        N/A      N/A     X       N/A       X       X
    1.30 -    Func        N/A      N/A     X       N/A       X       X
    1.31 +              Formula    Atom    Struct    Vect    Func
    1.32 +    Formula      X       X        X       N/A     N/A
    1.33 +    Atom         X       X        X        X       X
    1.34 +    Struct      N/A      X        X       N/A     N/A
    1.35 +    Vect        N/A      X       N/A       X       X
    1.36 +    Func        N/A      X       N/A       X       X
    1.37  *)
    1.38  
    1.39  val tests =
    1.40 @@ -77,22 +70,6 @@
    1.41                                     Struct [Atom (2, 0), Atom (3, 0)]])
    1.42                            atom24_v1),
    1.43           atom24_v1)),
    1.44 -   ("rep_conversion_struct_struct_4",
    1.45 -    Op2 (Eq, bool_T, Formula Neut,
    1.46 -         cast_to_rep (Struct [Atom (24, 0), Unit])
    1.47 -             (cast_to_rep (Struct [Atom (24, 0), Atom (1, 0)]) atom24_v1),
    1.48 -         atom24_v1)),
    1.49 -   ("rep_conversion_struct_struct_5",
    1.50 -    Op2 (Eq, bool_T, Formula Neut,
    1.51 -         cast_to_rep (Struct [Atom (24, 0), Atom (1, 0)])
    1.52 -             (cast_to_rep (Struct [Atom (24, 0), Unit]) atom24_v1),
    1.53 -         atom24_v1)),
    1.54 -   ("rep_conversion_struct_struct_6",
    1.55 -    Op2 (Eq, bool_T, Formula Neut,
    1.56 -         cast_to_rep (Struct [Atom (1, 0), Atom (1, 0)])
    1.57 -             (cast_to_rep (Struct [Atom (1, 0), Unit])
    1.58 -                 (cast_to_rep (Struct [Unit, Atom (1, 0)]) atom1_v1)),
    1.59 -         atom1_v1)),
    1.60     ("rep_conversion_vect_vect_1",
    1.61      Op2 (Eq, bool_T, Formula Neut,
    1.62           cast_to_rep (Atom (16, 0))
    1.63 @@ -133,50 +110,10 @@
    1.64                                  Struct [Atom (2, 0), Atom (3, 0)]))
    1.65                         atom36_v1)),
    1.66           atom36_v1)),
    1.67 -   ("rep_conversion_func_func_3",
    1.68 -    Op2 (Eq, bool_T, Formula Neut,
    1.69 -         cast_to_rep (Atom (36, 0))
    1.70 -             (cast_to_rep (Func (Unit, Struct [Atom (6, 0), Atom (6, 0)]))
    1.71 -                  (cast_to_rep (Func (Atom (1, 0), Atom (36, 0))) atom36_v1)),
    1.72 -         atom36_v1)),
    1.73 -   ("rep_conversion_func_func_4",
    1.74 -    Op2 (Eq, bool_T, Formula Neut,
    1.75 -         cast_to_rep (Atom (36, 0))
    1.76 -             (cast_to_rep (Func (Atom (1, 0), Atom (36, 0)))
    1.77 -                  (cast_to_rep (Func (Unit, Struct [Atom (6, 0), Atom (6, 0)]))
    1.78 -                       atom36_v1)),
    1.79 -         atom36_v1)),
    1.80 -   ("rep_conversion_func_func_5",
    1.81 -    Op2 (Eq, bool_T, Formula Neut,
    1.82 -         cast_to_rep (Atom (36, 0))
    1.83 -             (cast_to_rep (Func (Unit, Vect (2, Atom (6, 0))))
    1.84 -                  (cast_to_rep (Func (Atom (1, 0), Atom (36, 0))) atom36_v1)),
    1.85 -         atom36_v1)),
    1.86 -   ("rep_conversion_func_func_6",
    1.87 -    Op2 (Eq, bool_T, Formula Neut,
    1.88 -         cast_to_rep (Atom (36, 0))
    1.89 -             (cast_to_rep (Func (Atom (1, 0), Atom (36, 0)))
    1.90 -                  (cast_to_rep (Func (Unit, Vect (2, Atom (6, 0))))
    1.91 -                       atom36_v1)),
    1.92 -         atom36_v1)),
    1.93 -   ("rep_conversion_func_func_7",
    1.94 -    Op2 (Eq, bool_T, Formula Neut,
    1.95 -         cast_to_rep (Atom (2, 0))
    1.96 -             (cast_to_rep (Func (Unit, Atom (2, 0)))
    1.97 -                  (cast_to_rep (Func (Atom (1, 0), Formula Neut)) atom2_v1)),
    1.98 -         atom2_v1)),
    1.99 -   ("rep_conversion_func_func_8",
   1.100 -    Op2 (Eq, bool_T, Formula Neut,
   1.101 -         cast_to_rep (Atom (2, 0))
   1.102 -             (cast_to_rep (Func (Atom (1, 0), Formula Neut))
   1.103 -                  (cast_to_rep (Func (Unit, Atom (2, 0))) atom2_v1)),
   1.104 -         atom2_v1)),
   1.105     ("rep_conversion_atom_formula_atom",
   1.106      Op2 (Eq, bool_T, Formula Neut,
   1.107           cast_to_rep (Atom (2, 0)) (cast_to_rep (Formula Neut) atom2_v1),
   1.108           atom2_v1)),
   1.109 -   ("rep_conversion_unit_atom",
   1.110 -    Op2 (Eq, bool_T, Formula Neut, cast_to_rep (Atom (1, 0)) unity, unity)),
   1.111     ("rep_conversion_atom_struct_atom1",
   1.112      Op2 (Eq, bool_T, Formula Neut,
   1.113           cast_to_rep (Atom (6, 0))
   1.114 @@ -188,17 +125,6 @@
   1.115               (cast_to_rep (Struct [Struct [Atom (3, 0), Atom (4, 0)],
   1.116                                     Atom (2, 0)]) atom24_v1),
   1.117           atom24_v1)),
   1.118 -   ("rep_conversion_atom_struct_atom_3",
   1.119 -    Op2 (Eq, bool_T, Formula Neut,
   1.120 -         cast_to_rep (Atom (6, 0))
   1.121 -                     (cast_to_rep (Struct [Atom (6, 0), Unit]) atom6_v1),
   1.122 -         atom6_v1)),
   1.123 -   ("rep_conversion_atom_struct_atom_4",
   1.124 -    Op2 (Eq, bool_T, Formula Neut,
   1.125 -         cast_to_rep (Atom (6, 0))
   1.126 -             (cast_to_rep (Struct [Struct [Atom (3, 0), Unit], Atom (2, 0)]) 
   1.127 -             atom6_v1),
   1.128 -         atom6_v1)),
   1.129     ("rep_conversion_atom_vect_func_atom_1",
   1.130      Op2 (Eq, bool_T, Formula Neut,
   1.131           cast_to_rep (Atom (16, 0))
   1.132 @@ -217,18 +143,6 @@
   1.133               (cast_to_rep (Vect (4, Atom (2, 0)))
   1.134                    (cast_to_rep (Func (Atom (4, 0), Formula Neut)) atom16_v1)),
   1.135           atom16_v1)),
   1.136 -   ("rep_conversion_atom_vect_func_atom_4",
   1.137 -    Op2 (Eq, bool_T, Formula Neut,
   1.138 -         cast_to_rep (Atom (16, 0))
   1.139 -             (cast_to_rep (Vect (1, Atom (16, 0)))
   1.140 -                  (cast_to_rep (Func (Unit, Atom (16, 0))) atom16_v1)),
   1.141 -         atom16_v1)),
   1.142 -   ("rep_conversion_atom_vect_func_atom_5",
   1.143 -    Op2 (Eq, bool_T, Formula Neut,
   1.144 -         cast_to_rep (Atom (16, 0))
   1.145 -             (cast_to_rep (Vect (1, Atom (16, 0)))
   1.146 -                  (cast_to_rep (Func (Unit, Atom (16, 0))) atom16_v1)),
   1.147 -         atom16_v1)),
   1.148     ("rep_conversion_atom_func_vect_atom_1",
   1.149      Op2 (Eq, bool_T, Formula Neut,
   1.150           cast_to_rep (Atom (16, 0))
   1.151 @@ -247,12 +161,6 @@
   1.152               (cast_to_rep (Func (Atom (4, 0), Formula Neut))
   1.153                    (cast_to_rep (Vect (4, Atom (2, 0))) atom16_v1)),
   1.154           atom16_v1)),
   1.155 -   ("rep_conversion_atom_func_vect_atom_4",
   1.156 -    Op2 (Eq, bool_T, Formula Neut,
   1.157 -         cast_to_rep (Atom (16, 0))
   1.158 -             (cast_to_rep (Func (Unit, Atom (16, 0)))
   1.159 -                  (cast_to_rep (Vect (1, Atom (16, 0))) atom16_v1)),
   1.160 -         atom16_v1)),
   1.161     ("rep_conversion_atom_func_vect_atom_5",
   1.162      Op2 (Eq, bool_T, Formula Neut,
   1.163           cast_to_rep (Atom (16, 0))
   1.164 @@ -274,23 +182,7 @@
   1.165     ("rep_conversion_struct_atom1_1",
   1.166      Op2 (Eq, bool_T, Formula Neut,
   1.167           cast_to_rep (Struct [Atom (1, 0), Atom (1, 0)]) atom1_v1,
   1.168 -                      struct_atom1_atom1_v1)),
   1.169 -   ("rep_conversion_struct_atom1_2",
   1.170 -    Op2 (Eq, bool_T, Formula Neut,
   1.171 -         cast_to_rep (Struct [Atom (1, 0), Unit]) atom1_v1,
   1.172 -                      struct_atom1_unit_v1)),
   1.173 -   ("rep_conversion_struct_atom1_3",
   1.174 -    Op2 (Eq, bool_T, Formula Neut,
   1.175 -         cast_to_rep (Struct [Unit, Atom (1, 0)]) atom1_v1,
   1.176 -                      struct_unit_atom1_v1))
   1.177 -(*
   1.178 -   ("rep_conversion_struct_formula_struct_1",
   1.179 -    Op2 (Eq, bool_T, Formula Neut,
   1.180 -         cast_to_rep (Struct [Atom (2, 0), Unit])
   1.181 -             (cast_to_rep (Formula Neut) struct_atom_2_unit_v1),
   1.182 -         struct_atom_2_unit_v1))
   1.183 -*)
   1.184 -  ]
   1.185 +                      struct_atom1_atom1_v1))]
   1.186  
   1.187  fun problem_for_nut ctxt (name, u) =
   1.188    let
   1.189 @@ -319,13 +211,14 @@
   1.190  
   1.191  fun run_all_tests () =
   1.192    let
   1.193 -    val {overlord, ...} = Nitpick_Isar.default_params thy []
   1.194 +    val {overlord, ...} = Nitpick_Isar.default_params @{theory} []
   1.195      val max_threads = 1
   1.196      val max_solutions = 1
   1.197    in
   1.198      case Kodkod.solve_any_problem overlord NONE max_threads max_solutions
   1.199                                    (map (problem_for_nut @{context}) tests) of
   1.200 -    Kodkod.Normal ([], _, _) => ()
   1.201 -  | _ => error "Tests failed."
   1.202 +      Kodkod.Normal ([], _, _) => ()
   1.203 +    | _ => error "Tests failed."
   1.204 +  end
   1.205  
   1.206  end;