src/HOL/Nitpick_Examples/Core_Nits.thy
author wenzelm
Fri Apr 23 23:35:43 2010 +0200 (2010-04-23)
changeset 36319 8feb2c4bef1a
parent 35386 45a4e19d3ebd
child 37181 23ab9a5c41cf
permissions -rw-r--r--
mark schematic statements explicitly;
blanchet@33197
     1
(*  Title:      HOL/Nitpick_Examples/Core_Nits.thy
blanchet@33197
     2
    Author:     Jasmin Blanchette, TU Muenchen
blanchet@35076
     3
    Copyright   2009, 2010
blanchet@33197
     4
blanchet@33197
     5
Examples featuring Nitpick's functional core.
blanchet@33197
     6
*)
blanchet@33197
     7
blanchet@33197
     8
header {* Examples Featuring Nitpick's Functional Core *}
blanchet@33197
     9
blanchet@33197
    10
theory Core_Nits
blanchet@33197
    11
imports Main
blanchet@33197
    12
begin
blanchet@33197
    13
blanchet@35284
    14
nitpick_params [max_potential = 0, sat_solver = MiniSat_JNI, max_threads = 1,
blanchet@35284
    15
                timeout = 60 s]
blanchet@34082
    16
blanchet@33197
    17
subsection {* Curry in a Hurry *}
blanchet@33197
    18
blanchet@33197
    19
lemma "(\<lambda>f x y. (curry o split) f x y) = (\<lambda>f x y. (\<lambda>x. x) f x y)"
blanchet@35284
    20
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    21
by auto
blanchet@33197
    22
blanchet@33197
    23
lemma "(\<lambda>f p. (split o curry) f p) = (\<lambda>f p. (\<lambda>x. x) f p)"
blanchet@35284
    24
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    25
by auto
blanchet@33197
    26
blanchet@33197
    27
lemma "split (curry f) = f"
blanchet@35284
    28
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    29
by auto
blanchet@33197
    30
blanchet@33197
    31
lemma "curry (split f) = f"
blanchet@35284
    32
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    33
by auto
blanchet@33197
    34
blanchet@33197
    35
lemma "(split o curry) f = f"
blanchet@35284
    36
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    37
by auto
blanchet@33197
    38
blanchet@33197
    39
lemma "(curry o split) f = f"
blanchet@35284
    40
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    41
by auto
blanchet@33197
    42
blanchet@33197
    43
lemma "(split o curry) f = (\<lambda>x. x) f"
blanchet@35284
    44
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    45
by auto
blanchet@33197
    46
blanchet@33197
    47
lemma "(curry o split) f = (\<lambda>x. x) f"
blanchet@35284
    48
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    49
by auto
blanchet@33197
    50
blanchet@33197
    51
lemma "((split o curry) f) p = ((\<lambda>x. x) f) p"
blanchet@35284
    52
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    53
by auto
blanchet@33197
    54
blanchet@33197
    55
lemma "((curry o split) f) x = ((\<lambda>x. x) f) x"
blanchet@35284
    56
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    57
by auto
blanchet@33197
    58
blanchet@33197
    59
lemma "((curry o split) f) x y = ((\<lambda>x. x) f) x y"
blanchet@35284
    60
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    61
by auto
blanchet@33197
    62
blanchet@33197
    63
lemma "split o curry = (\<lambda>x. x)"
blanchet@35284
    64
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    65
apply (rule ext)+
blanchet@33197
    66
by auto
blanchet@33197
    67
blanchet@33197
    68
lemma "curry o split = (\<lambda>x. x)"
blanchet@35284
    69
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    70
apply (rule ext)+
blanchet@33197
    71
by auto
blanchet@33197
    72
blanchet@33197
    73
lemma "split (\<lambda>x y. f (x, y)) = f"
blanchet@35284
    74
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
    75
by auto
blanchet@33197
    76
blanchet@33197
    77
subsection {* Representations *}
blanchet@33197
    78
blanchet@33197
    79
lemma "\<exists>f. f = (\<lambda>x. x) \<and> f y = y"
blanchet@33197
    80
nitpick [expect = none]
blanchet@33197
    81
by auto
blanchet@33197
    82
blanchet@33197
    83
lemma "(\<exists>g. \<forall>x. g (f x) = x) \<longrightarrow> (\<forall>y. \<exists>x. y = f x)"
blanchet@35284
    84
nitpick [card 'a = 25, card 'b = 24, expect = genuine]
blanchet@35284
    85
nitpick [card = 1\<midarrow>10, mono, expect = none]
blanchet@33197
    86
oops
blanchet@33197
    87
blanchet@33197
    88
lemma "\<exists>f. f = (\<lambda>x. x) \<and> f y \<noteq> y"
blanchet@33197
    89
nitpick [card = 1, expect = genuine]
blanchet@33197
    90
nitpick [card = 5, expect = genuine]
blanchet@33197
    91
oops
blanchet@33197
    92
blanchet@33197
    93
lemma "P (\<lambda>x. x)"
blanchet@33197
    94
nitpick [card = 1, expect = genuine]
blanchet@33197
    95
nitpick [card = 5, expect = genuine]
blanchet@33197
    96
oops
blanchet@33197
    97
blanchet@33197
    98
lemma "{(a\<Colon>'a\<times>'a, b\<Colon>'b)}^-1 = {(b, a)}"
blanchet@35284
    99
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
   100
by auto
blanchet@33197
   101
blanchet@33197
   102
lemma "fst (a, b) = a"
blanchet@33197
   103
nitpick [card = 1\<midarrow>20, expect = none]
blanchet@33197
   104
by auto
blanchet@33197
   105
blanchet@33197
   106
lemma "\<exists>P. P = Id"
blanchet@35284
   107
nitpick [card = 1\<midarrow>20, expect = none]
blanchet@33197
   108
by auto
blanchet@33197
   109
blanchet@33197
   110
lemma "(a\<Colon>'a\<Rightarrow>'b, a) \<in> Id\<^sup>*"
blanchet@33197
   111
nitpick [card = 1\<midarrow>3, expect = none]
blanchet@33197
   112
by auto
blanchet@33197
   113
blanchet@33197
   114
lemma "(a\<Colon>'a\<times>'a, a) \<in> Id\<^sup>* \<union> {(a, b)}\<^sup>*"
blanchet@35284
   115
nitpick [card = 1\<midarrow>4, expect = none]
blanchet@33197
   116
by auto
blanchet@33197
   117
blanchet@33197
   118
lemma "Id (a, a)"
blanchet@35284
   119
nitpick [card = 1\<midarrow>50, expect = none]
blanchet@33197
   120
by (auto simp: Id_def Collect_def)
blanchet@33197
   121
blanchet@33197
   122
lemma "Id ((a\<Colon>'a, b\<Colon>'a), (a, b))"
blanchet@34082
   123
nitpick [card = 1\<midarrow>10, expect = none]
blanchet@33197
   124
by (auto simp: Id_def Collect_def)
blanchet@33197
   125
blanchet@33197
   126
lemma "UNIV (x\<Colon>'a\<times>'a)"
blanchet@33197
   127
nitpick [card = 1\<midarrow>50, expect = none]
blanchet@33197
   128
sorry
blanchet@33197
   129
blanchet@33197
   130
lemma "{} = A - A"
blanchet@33197
   131
nitpick [card = 1\<midarrow>100, expect = none]
blanchet@33197
   132
by auto
blanchet@33197
   133
blanchet@33197
   134
lemma "g = Let (A \<or> B)"
blanchet@33197
   135
nitpick [card = 1, expect = none]
blanchet@33197
   136
nitpick [card = 2, expect = genuine]
blanchet@35284
   137
nitpick [card = 12, expect = genuine]
blanchet@33197
   138
oops
blanchet@33197
   139
blanchet@33197
   140
lemma "(let a_or_b = A \<or> B in a_or_b \<or> \<not> a_or_b)"
blanchet@33197
   141
nitpick [expect = none]
blanchet@33197
   142
by auto
blanchet@33197
   143
blanchet@33197
   144
lemma "A \<subseteq> B"
blanchet@33197
   145
nitpick [card = 100, expect = genuine]
blanchet@33197
   146
oops
blanchet@33197
   147
blanchet@33197
   148
lemma "A = {b}"
blanchet@33197
   149
nitpick [card = 100, expect = genuine]
blanchet@33197
   150
oops
blanchet@33197
   151
blanchet@33197
   152
lemma "{a, b} = {b}"
blanchet@33197
   153
nitpick [card = 100, expect = genuine]
blanchet@33197
   154
oops
blanchet@33197
   155
blanchet@33197
   156
lemma "(a\<Colon>'a\<times>'a, a\<Colon>'a\<times>'a) \<in> R"
blanchet@33197
   157
nitpick [card = 1, expect = genuine]
blanchet@33197
   158
nitpick [card = 20, expect = genuine]
blanchet@35284
   159
nitpick [card = 5, dont_box, expect = genuine]
blanchet@33197
   160
oops
blanchet@33197
   161
blanchet@33197
   162
lemma "f (g\<Colon>'a\<Rightarrow>'a) = x"
blanchet@33197
   163
nitpick [card = 3, expect = genuine]
blanchet@33197
   164
nitpick [card = 3, dont_box, expect = genuine]
blanchet@33197
   165
nitpick [card = 10, expect = genuine]
blanchet@33197
   166
oops
blanchet@33197
   167
blanchet@33197
   168
lemma "f (a, b) = x"
blanchet@35284
   169
nitpick [card = 12, expect = genuine]
blanchet@33197
   170
oops
blanchet@33197
   171
blanchet@33197
   172
lemma "f (a, a) = f (c, d)"
blanchet@35284
   173
nitpick [card = 12, expect = genuine]
blanchet@33197
   174
oops
blanchet@33197
   175
blanchet@33197
   176
lemma "(x\<Colon>'a) = (\<lambda>a. \<lambda>b. \<lambda>c. if c then a else b) x x True"
blanchet@35284
   177
nitpick [card = 1\<midarrow>12, expect = none]
blanchet@33197
   178
by auto
blanchet@33197
   179
blanchet@33197
   180
lemma "\<exists>F. F a b = G a b"
blanchet@35284
   181
nitpick [card = 2, expect = none]
blanchet@33197
   182
by auto
blanchet@33197
   183
blanchet@33197
   184
lemma "f = split"
blanchet@33197
   185
nitpick [card = 1, expect = none]
blanchet@33197
   186
nitpick [card = 2, expect = genuine]
blanchet@33197
   187
oops
blanchet@33197
   188
blanchet@33197
   189
lemma "(A\<Colon>'a\<times>'a, B\<Colon>'a\<times>'a) \<in> R \<Longrightarrow> (A, B) \<in> R"
blanchet@33197
   190
nitpick [card = 20, expect = none]
blanchet@33197
   191
by auto
blanchet@33197
   192
blanchet@33197
   193
lemma "(A, B) \<in> R \<or> (\<exists>C. (A, C) \<in> R \<and> (C, B) \<in> R) \<Longrightarrow> 
blanchet@33197
   194
       A = B \<or> (A, B) \<in> R \<or> (\<exists>C. (A, C) \<in> R \<and> (C, B) \<in> R)"
blanchet@35284
   195
nitpick [card = 1\<midarrow>25, expect = none]
blanchet@33197
   196
by auto
blanchet@33197
   197
blanchet@33197
   198
lemma "f = (\<lambda>x\<Colon>'a\<times>'b. x)"
blanchet@33197
   199
nitpick [card = 8, expect = genuine]
blanchet@33197
   200
oops
blanchet@33197
   201
blanchet@33197
   202
subsection {* Quantifiers *}
blanchet@33197
   203
blanchet@33197
   204
lemma "x = y"
blanchet@33197
   205
nitpick [card 'a = 1, expect = none]
blanchet@33197
   206
nitpick [card 'a = 2, expect = genuine]
blanchet@35284
   207
nitpick [card 'a = 200, expect = genuine]
blanchet@33197
   208
oops
blanchet@33197
   209
blanchet@33197
   210
lemma "\<forall>x. x = y"
blanchet@33197
   211
nitpick [card 'a = 1, expect = none]
blanchet@33197
   212
nitpick [card 'a = 2, expect = genuine]
blanchet@35284
   213
nitpick [card 'a = 200, expect = genuine]
blanchet@33197
   214
oops
blanchet@33197
   215
blanchet@33197
   216
lemma "\<forall>x\<Colon>'a \<Rightarrow> bool. x = y"
blanchet@33197
   217
nitpick [card 'a = 1, expect = genuine]
blanchet@35284
   218
nitpick [card 'a = 200, expect = genuine]
blanchet@33197
   219
oops
blanchet@33197
   220
blanchet@33197
   221
lemma "\<exists>x\<Colon>'a \<Rightarrow> bool. x = y"
blanchet@35284
   222
nitpick [card 'a = 1\<midarrow>20, expect = none]
blanchet@33197
   223
by auto
blanchet@33197
   224
blanchet@33197
   225
lemma "\<exists>x y\<Colon>'a \<Rightarrow> bool. x = y"
blanchet@35284
   226
nitpick [card = 1\<midarrow>20, expect = none]
blanchet@33197
   227
by auto
blanchet@33197
   228
blanchet@33197
   229
lemma "\<forall>x. \<exists>y. f x y = f x (g x)"
blanchet@33197
   230
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   231
by auto
blanchet@33197
   232
blanchet@33197
   233
lemma "\<forall>u. \<exists>v. \<forall>w. \<exists>x. f u v w x = f u (g u) w (h u w)"
blanchet@35284
   234
nitpick [card = 1\<midarrow>4, expect = none]
blanchet@33197
   235
by auto
blanchet@33197
   236
blanchet@33197
   237
lemma "\<forall>u. \<exists>v. \<forall>w. \<exists>x. f u v w x = f u (g u w) w (h u)"
blanchet@33197
   238
nitpick [card = 3, expect = genuine]
blanchet@33197
   239
oops
blanchet@33197
   240
blanchet@33197
   241
lemma "\<forall>u. \<exists>v. \<forall>w. \<exists>x. \<forall>y. \<exists>z.
blanchet@33197
   242
       f u v w x y z = f u (g u) w (h u w) y (k u w y)"
blanchet@33197
   243
nitpick [card = 1\<midarrow>2, expect = none]
blanchet@33197
   244
nitpick [card = 3, expect = none]
blanchet@33197
   245
sorry
blanchet@33197
   246
blanchet@33197
   247
lemma "\<forall>u. \<exists>v. \<forall>w. \<exists>x. \<forall>y. \<exists>z.
blanchet@33197
   248
       f u v w x y z = f u (g u) w (h u w y) y (k u w y)"
blanchet@33197
   249
nitpick [card = 1\<midarrow>2, expect = genuine]
blanchet@33197
   250
oops
blanchet@33197
   251
blanchet@33197
   252
lemma "\<forall>u. \<exists>v. \<forall>w. \<exists>x. \<forall>y. \<exists>z.
blanchet@33197
   253
       f u v w x y z = f u (g u w) w (h u w) y (k u w y)"
blanchet@33197
   254
nitpick [card = 1\<midarrow>2, expect = genuine]
blanchet@33197
   255
oops
blanchet@33197
   256
blanchet@33197
   257
lemma "\<forall>u\<Colon>'a \<times> 'b. \<exists>v\<Colon>'c. \<forall>w\<Colon>'d. \<exists>x\<Colon>'e \<times> 'f.
blanchet@33197
   258
       f u v w x = f u (g u) w (h u w)"
blanchet@33197
   259
nitpick [card = 1\<midarrow>2, expect = none]
blanchet@33197
   260
sorry
blanchet@33197
   261
blanchet@33197
   262
lemma "\<forall>u\<Colon>'a \<times> 'b. \<exists>v\<Colon>'c. \<forall>w\<Colon>'d. \<exists>x\<Colon>'e \<times> 'f.
blanchet@33197
   263
       f u v w x = f u (g u w) w (h u)"
blanchet@33197
   264
nitpick [card = 1\<midarrow>2, dont_box, expect = genuine]
blanchet@33197
   265
oops
blanchet@33197
   266
blanchet@33197
   267
lemma "\<forall>u\<Colon>'a \<Rightarrow> 'b. \<exists>v\<Colon>'c. \<forall>w\<Colon>'d. \<exists>x\<Colon>'e \<Rightarrow> 'f.
blanchet@33197
   268
       f u v w x = f u (g u) w (h u w)"
blanchet@33197
   269
nitpick [card = 1\<midarrow>2, dont_box, expect = none]
blanchet@33197
   270
sorry
blanchet@33197
   271
blanchet@33197
   272
lemma "\<forall>u\<Colon>'a \<Rightarrow> 'b. \<exists>v\<Colon>'c. \<forall>w\<Colon>'d. \<exists>x\<Colon>'e \<Rightarrow> 'f.
blanchet@33197
   273
       f u v w x = f u (g u w) w (h u)"
blanchet@33197
   274
nitpick [card = 1\<midarrow>2, dont_box, expect = genuine]
blanchet@33197
   275
oops
blanchet@33197
   276
blanchet@33197
   277
lemma "\<forall>x. if (\<forall>y. x = y) then False else True"
blanchet@33197
   278
nitpick [card = 1, expect = genuine]
blanchet@33197
   279
nitpick [card = 2\<midarrow>5, expect = none]
blanchet@33197
   280
oops
blanchet@33197
   281
blanchet@33197
   282
lemma "\<forall>x\<Colon>'a\<times>'b. if (\<forall>y. x = y) then False else True"
blanchet@33197
   283
nitpick [card = 1, expect = genuine]
blanchet@33197
   284
nitpick [card = 2, expect = none]
blanchet@33197
   285
oops
blanchet@33197
   286
blanchet@33197
   287
lemma "\<forall>x. if (\<exists>y. x = y) then True else False"
blanchet@33197
   288
nitpick [expect = none]
blanchet@33197
   289
sorry
blanchet@33197
   290
blanchet@33197
   291
lemma "\<forall>x\<Colon>'a\<times>'b. if (\<exists>y. x = y) then True else False"
blanchet@33197
   292
nitpick [expect = none]
blanchet@33197
   293
sorry
blanchet@33197
   294
blanchet@33197
   295
lemma "(\<not> (\<exists>x. P x)) \<longleftrightarrow> (\<forall>x. \<not> P x)"
blanchet@33197
   296
nitpick [expect = none]
blanchet@33197
   297
by auto
blanchet@33197
   298
blanchet@33197
   299
lemma "(\<not> \<not> (\<exists>x. P x)) \<longleftrightarrow> (\<not> (\<forall>x. \<not> P x))"
blanchet@33197
   300
nitpick [expect = none]
blanchet@33197
   301
by auto
blanchet@33197
   302
blanchet@33197
   303
lemma "(\<exists>x\<Colon>'a. \<forall>y. P x y) \<or> (\<exists>x\<Colon>'a \<times> 'a. \<forall>y. P y x)"
blanchet@33197
   304
nitpick [card 'a = 1, expect = genuine]
blanchet@33197
   305
nitpick [card 'a = 5, expect = genuine]
blanchet@33197
   306
oops
blanchet@33197
   307
blanchet@33197
   308
lemma "\<exists>x. if x = y then (\<forall>y. y = x \<or> y \<noteq> x)
blanchet@33197
   309
           else (\<forall>y. y = (x, x) \<or> y \<noteq> (x, x))"
blanchet@33197
   310
nitpick [expect = none]
blanchet@33197
   311
by auto
blanchet@33197
   312
blanchet@33197
   313
lemma "\<exists>x. if x = y then (\<exists>y. y = x \<or> y \<noteq> x)
blanchet@33197
   314
           else (\<exists>y. y = (x, x) \<or> y \<noteq> (x, x))"
blanchet@33197
   315
nitpick [expect = none]
blanchet@33197
   316
by auto
blanchet@33197
   317
blanchet@33197
   318
lemma "let x = (\<forall>x. P x) in if x then x else \<not> x"
blanchet@33197
   319
nitpick [expect = none]
blanchet@33197
   320
by auto
blanchet@33197
   321
blanchet@33197
   322
lemma "let x = (\<forall>x\<Colon>'a \<times> 'b. P x) in if x then x else \<not> x"
blanchet@33197
   323
nitpick [expect = none]
blanchet@33197
   324
by auto
blanchet@33197
   325
blanchet@33197
   326
subsection {* Schematic Variables *}
blanchet@33197
   327
wenzelm@36319
   328
schematic_lemma "x = ?x"
blanchet@33197
   329
nitpick [expect = none]
blanchet@33197
   330
by auto
blanchet@33197
   331
wenzelm@36319
   332
schematic_lemma "\<forall>x. x = ?x"
blanchet@33197
   333
nitpick [expect = genuine]
blanchet@33197
   334
oops
blanchet@33197
   335
wenzelm@36319
   336
schematic_lemma "\<exists>x. x = ?x"
blanchet@33197
   337
nitpick [expect = none]
blanchet@33197
   338
by auto
blanchet@33197
   339
wenzelm@36319
   340
schematic_lemma "\<exists>x\<Colon>'a \<Rightarrow> 'b. x = ?x"
blanchet@33197
   341
nitpick [expect = none]
blanchet@33197
   342
by auto
blanchet@33197
   343
wenzelm@36319
   344
schematic_lemma "\<forall>x. ?x = ?y"
blanchet@33197
   345
nitpick [expect = none]
blanchet@33197
   346
by auto
blanchet@33197
   347
wenzelm@36319
   348
schematic_lemma "\<exists>x. ?x = ?y"
blanchet@33197
   349
nitpick [expect = none]
blanchet@33197
   350
by auto
blanchet@33197
   351
blanchet@33197
   352
subsection {* Known Constants *}
blanchet@33197
   353
blanchet@33197
   354
lemma "x \<equiv> all \<Longrightarrow> False"
blanchet@33197
   355
nitpick [card = 1, expect = genuine]
blanchet@33197
   356
nitpick [card = 1, box "('a \<Rightarrow> prop) \<Rightarrow> prop", expect = genuine]
blanchet@33197
   357
nitpick [card = 2, expect = genuine]
blanchet@35284
   358
nitpick [card = 6, expect = genuine]
blanchet@33197
   359
oops
blanchet@33197
   360
blanchet@33197
   361
lemma "\<And>x. f x y = f x y"
blanchet@33197
   362
nitpick [expect = none]
blanchet@33197
   363
oops
blanchet@33197
   364
blanchet@33197
   365
lemma "\<And>x. f x y = f y x"
blanchet@33197
   366
nitpick [expect = genuine]
blanchet@33197
   367
oops
blanchet@33197
   368
blanchet@33197
   369
lemma "all (\<lambda>x. Trueprop (f x y = f x y)) \<equiv> Trueprop True"
blanchet@33197
   370
nitpick [expect = none]
blanchet@33197
   371
by auto
blanchet@33197
   372
blanchet@33197
   373
lemma "all (\<lambda>x. Trueprop (f x y = f x y)) \<equiv> Trueprop False"
blanchet@33197
   374
nitpick [expect = genuine]
blanchet@33197
   375
oops
blanchet@33197
   376
blanchet@33197
   377
lemma "I = (\<lambda>x. x) \<Longrightarrow> all P \<equiv> all (\<lambda>x. P (I x))"
blanchet@33197
   378
nitpick [expect = none]
blanchet@33197
   379
by auto
blanchet@33197
   380
blanchet@33197
   381
lemma "x \<equiv> (op \<equiv>) \<Longrightarrow> False"
blanchet@33197
   382
nitpick [card = 1, expect = genuine]
blanchet@35284
   383
nitpick [card = 20, expect = genuine]
blanchet@33197
   384
oops
blanchet@33197
   385
blanchet@33197
   386
lemma "I = (\<lambda>x. x) \<Longrightarrow> (op \<equiv> x) \<equiv> (\<lambda>y. (x \<equiv> I y))"
blanchet@33197
   387
nitpick [expect = none]
blanchet@33197
   388
by auto
blanchet@33197
   389
blanchet@33197
   390
lemma "P x \<equiv> P x"
blanchet@33197
   391
nitpick [card = 1\<midarrow>10, expect = none]
blanchet@33197
   392
by auto
blanchet@33197
   393
blanchet@33197
   394
lemma "P x \<equiv> Q x \<Longrightarrow> P x = Q x"
blanchet@33197
   395
nitpick [card = 1\<midarrow>10, expect = none]
blanchet@33197
   396
by auto
blanchet@33197
   397
blanchet@33197
   398
lemma "P x = Q x \<Longrightarrow> P x \<equiv> Q x"
blanchet@33197
   399
nitpick [card = 1\<midarrow>10, expect = none]
blanchet@33197
   400
by auto
blanchet@33197
   401
blanchet@33197
   402
lemma "x \<equiv> (op \<Longrightarrow>) \<Longrightarrow> False"
blanchet@33197
   403
nitpick [expect = genuine]
blanchet@33197
   404
oops
blanchet@33197
   405
blanchet@33197
   406
lemma "I \<equiv> (\<lambda>x. x) \<Longrightarrow> (op \<Longrightarrow> x) \<equiv> (\<lambda>y. (op \<Longrightarrow> x (I y)))"
blanchet@33197
   407
nitpick [expect = none]
blanchet@33197
   408
by auto
blanchet@33197
   409
blanchet@33197
   410
lemma "P x \<Longrightarrow> P x"
blanchet@33197
   411
nitpick [card = 1\<midarrow>10, expect = none]
blanchet@33197
   412
by auto
blanchet@33197
   413
blanchet@33197
   414
lemma "True \<Longrightarrow> True" "False \<Longrightarrow> True" "False \<Longrightarrow> False"
blanchet@33197
   415
nitpick [expect = none]
blanchet@33197
   416
by auto
blanchet@33197
   417
blanchet@33197
   418
lemma "True \<Longrightarrow> False"
blanchet@33197
   419
nitpick [expect = genuine]
blanchet@33197
   420
oops
blanchet@33197
   421
blanchet@33197
   422
lemma "x = Not"
blanchet@33197
   423
nitpick [expect = genuine]
blanchet@33197
   424
oops
blanchet@33197
   425
blanchet@33197
   426
lemma "I = (\<lambda>x. x) \<Longrightarrow> Not = (\<lambda>x. Not (I x))"
blanchet@33197
   427
nitpick [expect = none]
blanchet@33197
   428
by auto
blanchet@33197
   429
blanchet@33197
   430
lemma "x = True"
blanchet@33197
   431
nitpick [expect = genuine]
blanchet@33197
   432
oops
blanchet@33197
   433
blanchet@33197
   434
lemma "x = False"
blanchet@33197
   435
nitpick [expect = genuine]
blanchet@33197
   436
oops
blanchet@33197
   437
blanchet@33197
   438
lemma "x = undefined"
blanchet@33197
   439
nitpick [expect = genuine]
blanchet@33197
   440
oops
blanchet@33197
   441
blanchet@33197
   442
lemma "(False, ()) = undefined \<Longrightarrow> ((), False) = undefined"
blanchet@33197
   443
nitpick [expect = genuine]
blanchet@33197
   444
oops
blanchet@33197
   445
blanchet@33197
   446
lemma "undefined = undefined"
blanchet@33197
   447
nitpick [expect = none]
blanchet@33197
   448
by auto
blanchet@33197
   449
blanchet@33197
   450
lemma "f undefined = f undefined"
blanchet@33197
   451
nitpick [expect = none]
blanchet@33197
   452
by auto
blanchet@33197
   453
blanchet@33197
   454
lemma "f undefined = g undefined"
blanchet@33197
   455
nitpick [card = 33, expect = genuine]
blanchet@33197
   456
oops
blanchet@33197
   457
blanchet@33197
   458
lemma "\<exists>!x. x = undefined"
blanchet@33197
   459
nitpick [card = 30, expect = none]
blanchet@33197
   460
by auto
blanchet@33197
   461
blanchet@33197
   462
lemma "x = All \<Longrightarrow> False"
blanchet@33197
   463
nitpick [card = 1, dont_box, expect = genuine]
blanchet@33197
   464
nitpick [card = 2, dont_box, expect = genuine]
blanchet@33197
   465
nitpick [card = 8, dont_box, expect = genuine]
blanchet@33197
   466
nitpick [card = 10, dont_box, expect = unknown]
blanchet@33197
   467
oops
blanchet@33197
   468
blanchet@33197
   469
lemma "\<forall>x. f x y = f x y"
blanchet@33197
   470
nitpick [expect = none]
blanchet@33197
   471
oops
blanchet@33197
   472
blanchet@33197
   473
lemma "\<forall>x. f x y = f y x"
blanchet@33197
   474
nitpick [expect = genuine]
blanchet@33197
   475
oops
blanchet@33197
   476
blanchet@33197
   477
lemma "All (\<lambda>x. f x y = f x y) = True"
blanchet@33197
   478
nitpick [expect = none]
blanchet@33197
   479
by auto
blanchet@33197
   480
blanchet@33197
   481
lemma "All (\<lambda>x. f x y = f x y) = False"
blanchet@33197
   482
nitpick [expect = genuine]
blanchet@33197
   483
oops
blanchet@33197
   484
blanchet@33197
   485
lemma "I = (\<lambda>x. x) \<Longrightarrow> All P = All (\<lambda>x. P (I x))"
blanchet@33197
   486
nitpick [expect = none]
blanchet@33197
   487
by auto
blanchet@33197
   488
blanchet@33197
   489
lemma "x = Ex \<Longrightarrow> False"
blanchet@33197
   490
nitpick [card = 1, dont_box, expect = genuine]
blanchet@33197
   491
nitpick [card = 2, dont_box, expect = genuine]
blanchet@35284
   492
nitpick [card = 6, dont_box, expect = genuine]
blanchet@33197
   493
nitpick [card = 10, dont_box, expect = unknown]
blanchet@33197
   494
oops
blanchet@33197
   495
blanchet@33197
   496
lemma "\<exists>x. f x y = f x y"
blanchet@33197
   497
nitpick [expect = none]
blanchet@33197
   498
oops
blanchet@33197
   499
blanchet@33197
   500
lemma "\<exists>x. f x y = f y x"
blanchet@33197
   501
nitpick [expect = none]
blanchet@33197
   502
oops
blanchet@33197
   503
blanchet@33197
   504
lemma "Ex (\<lambda>x. f x y = f x y) = True"
blanchet@33197
   505
nitpick [expect = none]
blanchet@33197
   506
by auto
blanchet@33197
   507
blanchet@33197
   508
lemma "Ex (\<lambda>x. f x y = f y x) = True"
blanchet@33197
   509
nitpick [expect = none]
blanchet@33197
   510
by auto
blanchet@33197
   511
blanchet@33197
   512
lemma "Ex (\<lambda>x. f x y = f x y) = False"
blanchet@33197
   513
nitpick [expect = genuine]
blanchet@33197
   514
oops
blanchet@33197
   515
blanchet@33197
   516
lemma "Ex (\<lambda>x. f x y = f y x) = False"
blanchet@33197
   517
nitpick [expect = genuine]
blanchet@33197
   518
oops
blanchet@33197
   519
blanchet@33197
   520
lemma "Ex (\<lambda>x. f x y \<noteq> f x y) = False"
blanchet@33197
   521
nitpick [expect = none]
blanchet@33197
   522
by auto
blanchet@33197
   523
blanchet@33197
   524
lemma "I = (\<lambda>x. x) \<Longrightarrow> Ex P = Ex (\<lambda>x. P (I x))"
blanchet@33197
   525
nitpick [expect = none]
blanchet@33197
   526
by auto
blanchet@33197
   527
blanchet@33197
   528
lemma "I = (\<lambda>x. x) \<Longrightarrow> (op =) = (\<lambda>x. (op= (I x)))"
blanchet@33197
   529
      "I = (\<lambda>x. x) \<Longrightarrow> (op =) = (\<lambda>x y. x = (I y))"
blanchet@33197
   530
nitpick [expect = none]
blanchet@33197
   531
by auto
blanchet@33197
   532
blanchet@33197
   533
lemma "x = y \<Longrightarrow> y = x"
blanchet@33197
   534
nitpick [expect = none]
blanchet@33197
   535
by auto
blanchet@33197
   536
blanchet@33197
   537
lemma "x = y \<Longrightarrow> f x = f y"
blanchet@33197
   538
nitpick [expect = none]
blanchet@33197
   539
by auto
blanchet@33197
   540
blanchet@33197
   541
lemma "x = y \<and> y = z \<Longrightarrow> x = z"
blanchet@33197
   542
nitpick [expect = none]
blanchet@33197
   543
by auto
blanchet@33197
   544
blanchet@35284
   545
lemma "I = (\<lambda>x. x) \<Longrightarrow> (op \<and>) = (\<lambda>x. op \<and> (I x))"
blanchet@35284
   546
      "I = (\<lambda>x. x) \<Longrightarrow> (op \<and>) = (\<lambda>x y. x \<and> (I y))"
blanchet@33197
   547
nitpick [expect = none]
blanchet@33197
   548
by auto
blanchet@33197
   549
blanchet@33197
   550
lemma "(a \<and> b) = (\<not> (\<not> a \<or> \<not> b))"
blanchet@33197
   551
nitpick [expect = none]
blanchet@33197
   552
by auto
blanchet@33197
   553
blanchet@33197
   554
lemma "a \<and> b \<Longrightarrow> a" "a \<and> b \<Longrightarrow> b"
blanchet@33197
   555
nitpick [expect = none]
blanchet@33197
   556
by auto
blanchet@33197
   557
blanchet@33197
   558
lemma "\<not> a \<Longrightarrow> \<not> (a \<and> b)" "\<not> b \<Longrightarrow> \<not> (a \<and> b)"
blanchet@33197
   559
nitpick [expect = none]
blanchet@33197
   560
by auto
blanchet@33197
   561
blanchet@33197
   562
lemma "I = (\<lambda>x. x) \<Longrightarrow> (op \<or>) = (\<lambda>x. op \<or> (I x))"
blanchet@33197
   563
      "I = (\<lambda>x. x) \<Longrightarrow> (op \<or>) = (\<lambda>x y. x \<or> (I y))"
blanchet@33197
   564
nitpick [expect = none]
blanchet@33197
   565
by auto
blanchet@33197
   566
blanchet@33197
   567
lemma "a \<Longrightarrow> a \<or> b" "b \<Longrightarrow> a \<or> b"
blanchet@33197
   568
nitpick [expect = none]
blanchet@33197
   569
by auto
blanchet@33197
   570
blanchet@33197
   571
lemma "\<not> (a \<or> b) \<Longrightarrow> \<not> a" "\<not> (a \<or> b) \<Longrightarrow> \<not> b"
blanchet@33197
   572
nitpick [expect = none]
blanchet@33197
   573
by auto
blanchet@33197
   574
blanchet@33197
   575
lemma "(op \<longrightarrow>) = (\<lambda>x. op\<longrightarrow> x)" "(op\<longrightarrow> ) = (\<lambda>x y. x \<longrightarrow> y)"
blanchet@33197
   576
nitpick [expect = none]
blanchet@33197
   577
by auto
blanchet@33197
   578
blanchet@33197
   579
lemma "\<not>a \<Longrightarrow> a \<longrightarrow> b" "b \<Longrightarrow> a \<longrightarrow> b"
blanchet@33197
   580
nitpick [expect = none]
blanchet@33197
   581
by auto
blanchet@33197
   582
blanchet@33197
   583
lemma "\<lbrakk>a; \<not> b\<rbrakk> \<Longrightarrow> \<not> (a \<longrightarrow> b)"
blanchet@33197
   584
nitpick [expect = none]
blanchet@33197
   585
by auto
blanchet@33197
   586
blanchet@33197
   587
lemma "((if a then b else c) = d) = ((a \<longrightarrow> (b = d)) \<and> (\<not> a \<longrightarrow> (c = d)))"
blanchet@33197
   588
nitpick [expect = none]
blanchet@33197
   589
by auto
blanchet@33197
   590
blanchet@33197
   591
lemma "(if a then b else c) = (THE d. (a \<longrightarrow> (d = b)) \<and> (\<not> a \<longrightarrow> (d = c)))"
blanchet@33197
   592
nitpick [expect = none]
blanchet@33197
   593
by auto
blanchet@33197
   594
blanchet@33197
   595
lemma "I = (\<lambda>x. x) \<Longrightarrow> If = (\<lambda>x. If (I x))"
blanchet@33197
   596
      "J = (\<lambda>x. x) \<Longrightarrow> If = (\<lambda>x y. If x (J y))"
blanchet@33197
   597
      "K = (\<lambda>x. x) \<Longrightarrow> If = (\<lambda>x y z. If x y (K z))"
blanchet@33197
   598
nitpick [expect = none]
blanchet@33197
   599
by auto
blanchet@33197
   600
blanchet@33197
   601
lemma "fst (x, y) = x"
blanchet@33197
   602
nitpick [expect = none]
blanchet@33197
   603
by (simp add: fst_def)
blanchet@33197
   604
blanchet@33197
   605
lemma "snd (x, y) = y"
blanchet@33197
   606
nitpick [expect = none]
blanchet@33197
   607
by (simp add: snd_def)
blanchet@33197
   608
blanchet@33197
   609
lemma "fst (x\<Colon>'a\<Rightarrow>'b, y) = x"
blanchet@33197
   610
nitpick [expect = none]
blanchet@33197
   611
by (simp add: fst_def)
blanchet@33197
   612
blanchet@33197
   613
lemma "snd (x\<Colon>'a\<Rightarrow>'b, y) = y"
blanchet@33197
   614
nitpick [expect = none]
blanchet@33197
   615
by (simp add: snd_def)
blanchet@33197
   616
blanchet@33197
   617
lemma "fst (x, y\<Colon>'a\<Rightarrow>'b) = x"
blanchet@33197
   618
nitpick [expect = none]
blanchet@33197
   619
by (simp add: fst_def)
blanchet@33197
   620
blanchet@33197
   621
lemma "snd (x, y\<Colon>'a\<Rightarrow>'b) = y"
blanchet@33197
   622
nitpick [expect = none]
blanchet@33197
   623
by (simp add: snd_def)
blanchet@33197
   624
blanchet@33197
   625
lemma "fst (x\<Colon>'a\<times>'b, y) = x"
blanchet@33197
   626
nitpick [expect = none]
blanchet@33197
   627
by (simp add: fst_def)
blanchet@33197
   628
blanchet@33197
   629
lemma "snd (x\<Colon>'a\<times>'b, y) = y"
blanchet@33197
   630
nitpick [expect = none]
blanchet@33197
   631
by (simp add: snd_def)
blanchet@33197
   632
blanchet@33197
   633
lemma "fst (x, y\<Colon>'a\<times>'b) = x"
blanchet@33197
   634
nitpick [expect = none]
blanchet@33197
   635
by (simp add: fst_def)
blanchet@33197
   636
blanchet@33197
   637
lemma "snd (x, y\<Colon>'a\<times>'b) = y"
blanchet@33197
   638
nitpick [expect = none]
blanchet@33197
   639
by (simp add: snd_def)
blanchet@33197
   640
blanchet@33197
   641
lemma "fst p = (THE a. \<exists>b. p = Pair a b)"
blanchet@33197
   642
nitpick [expect = none]
blanchet@33197
   643
by (simp add: fst_def)
blanchet@33197
   644
blanchet@33197
   645
lemma "snd p = (THE b. \<exists>a. p = Pair a b)"
blanchet@33197
   646
nitpick [expect = none]
blanchet@33197
   647
by (simp add: snd_def)
blanchet@33197
   648
blanchet@33197
   649
lemma "I = (\<lambda>x. x) \<Longrightarrow> fst = (\<lambda>x. fst (I x))"
blanchet@33197
   650
nitpick [expect = none]
blanchet@33197
   651
by auto
blanchet@33197
   652
blanchet@33197
   653
lemma "I = (\<lambda>x. x) \<Longrightarrow> snd = (\<lambda>x. snd (I x))"
blanchet@33197
   654
nitpick [expect = none]
blanchet@33197
   655
by auto
blanchet@33197
   656
blanchet@33197
   657
lemma "fst (x, y) = snd (y, x)"
blanchet@33197
   658
nitpick [expect = none]
blanchet@33197
   659
by auto
blanchet@33197
   660
blanchet@33197
   661
lemma "(x, x) \<in> Id"
blanchet@33197
   662
nitpick [expect = none]
blanchet@33197
   663
by auto
blanchet@33197
   664
blanchet@33197
   665
lemma "(x, y) \<in> Id \<Longrightarrow> x = y"
blanchet@33197
   666
nitpick [expect = none]
blanchet@33197
   667
by auto
blanchet@33197
   668
blanchet@33197
   669
lemma "I = (\<lambda>x. x) \<Longrightarrow> Id = (\<lambda>x. Id (I x))"
blanchet@33197
   670
nitpick [expect = none]
blanchet@33197
   671
by auto
blanchet@33197
   672
blanchet@33197
   673
lemma "I = (\<lambda>x. x) \<Longrightarrow> curry Id = (\<lambda>x y. Id (x, I y))"
blanchet@33197
   674
nitpick [expect = none]
blanchet@33197
   675
by (simp add: curry_def)
blanchet@33197
   676
blanchet@33197
   677
lemma "{} = (\<lambda>x. False)"
blanchet@33197
   678
nitpick [expect = none]
blanchet@33199
   679
by (metis Collect_def empty_def)
blanchet@33197
   680
blanchet@33197
   681
lemma "x \<in> {}"
blanchet@33197
   682
nitpick [expect = genuine]
blanchet@33197
   683
oops
blanchet@33197
   684
blanchet@33197
   685
lemma "{a, b} = {b}"
blanchet@33197
   686
nitpick [expect = genuine]
blanchet@33197
   687
oops
blanchet@33197
   688
blanchet@33197
   689
lemma "{a, b} \<noteq> {b}"
blanchet@33197
   690
nitpick [expect = genuine]
blanchet@33197
   691
oops
blanchet@33197
   692
blanchet@33197
   693
lemma "{a} = {b}"
blanchet@33197
   694
nitpick [expect = genuine]
blanchet@33197
   695
oops
blanchet@33197
   696
blanchet@33197
   697
lemma "{a} \<noteq> {b}"
blanchet@33197
   698
nitpick [expect = genuine]
blanchet@33197
   699
oops
blanchet@33197
   700
blanchet@33197
   701
lemma "{a, b, c} = {c, b, a}"
blanchet@33197
   702
nitpick [expect = none]
blanchet@33197
   703
by auto
blanchet@33197
   704
blanchet@33197
   705
lemma "UNIV = (\<lambda>x. True)"
blanchet@33197
   706
nitpick [expect = none]
blanchet@33197
   707
by (simp only: UNIV_def Collect_def)
blanchet@33197
   708
blanchet@33197
   709
lemma "UNIV x = True"
blanchet@33197
   710
nitpick [expect = none]
blanchet@33197
   711
by (simp only: UNIV_def Collect_def)
blanchet@33197
   712
blanchet@33197
   713
lemma "x \<notin> UNIV"
blanchet@33197
   714
nitpick [expect = genuine]
blanchet@33197
   715
oops
blanchet@33197
   716
blanchet@33197
   717
lemma "op \<in> = (\<lambda>x P. P x)"
blanchet@33197
   718
nitpick [expect = none]
blanchet@33197
   719
apply (rule ext)
blanchet@33197
   720
apply (rule ext)
blanchet@33197
   721
by (simp add: mem_def)
blanchet@33197
   722
blanchet@33197
   723
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<in> = (\<lambda>x. (op \<in> (I x)))"
blanchet@33197
   724
nitpick [expect = none]
blanchet@33197
   725
apply (rule ext)
blanchet@33197
   726
apply (rule ext)
blanchet@33197
   727
by (simp add: mem_def)
blanchet@33197
   728
blanchet@33197
   729
lemma "P x = (x \<in> P)"
blanchet@33197
   730
nitpick [expect = none]
blanchet@33197
   731
by (simp add: mem_def)
blanchet@33197
   732
blanchet@33197
   733
lemma "I = (\<lambda>x. x) \<Longrightarrow> insert = (\<lambda>x. insert (I x))"
blanchet@33197
   734
nitpick [expect = none]
blanchet@33197
   735
by simp
blanchet@33197
   736
blanchet@33197
   737
lemma "insert = (\<lambda>x y. insert x (y \<union> y))"
blanchet@33197
   738
nitpick [expect = none]
blanchet@33197
   739
by simp
blanchet@33197
   740
blanchet@33197
   741
lemma "I = (\<lambda>x. x) \<Longrightarrow> trancl = (\<lambda>x. trancl (I x))"
blanchet@33197
   742
nitpick [card = 1\<midarrow>2, expect = none]
blanchet@33197
   743
by auto
blanchet@33197
   744
blanchet@33197
   745
lemma "rtrancl = (\<lambda>x. rtrancl x \<union> {(y, y)})"
blanchet@33197
   746
nitpick [card = 1\<midarrow>3, expect = none]
blanchet@33197
   747
apply (rule ext)
blanchet@33197
   748
by auto
blanchet@33197
   749
blanchet@33197
   750
lemma "(x, x) \<in> rtrancl {(y, y)}"
blanchet@33197
   751
nitpick [expect = none]
blanchet@33197
   752
by auto
blanchet@33197
   753
blanchet@33197
   754
lemma "I = (\<lambda>x. x) \<Longrightarrow> rtrancl = (\<lambda>x. rtrancl (I x))"
blanchet@33197
   755
nitpick [card = 1\<midarrow>2, expect = none]
blanchet@33197
   756
by auto
blanchet@33197
   757
blanchet@33197
   758
lemma "((x, x), (x, x)) \<in> rtrancl {}"
blanchet@35284
   759
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   760
by auto
blanchet@33197
   761
blanchet@33197
   762
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<union> = (\<lambda>x. op \<union> (I x))"
blanchet@33197
   763
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   764
by auto
blanchet@33197
   765
blanchet@33197
   766
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<union> = (\<lambda>x y. op \<union> x (I y))"
blanchet@33197
   767
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   768
by auto
blanchet@33197
   769
blanchet@33197
   770
lemma "a \<in> A \<Longrightarrow> a \<in> (A \<union> B)" "b \<in> B \<Longrightarrow> b \<in> (A \<union> B)"
blanchet@33197
   771
nitpick [expect = none]
blanchet@33197
   772
by auto
blanchet@33197
   773
blanchet@33197
   774
lemma "a \<in> (A \<union> B) \<Longrightarrow> a \<in> A \<or> a \<in> B"
blanchet@33197
   775
nitpick [expect = none]
blanchet@33197
   776
by auto
blanchet@33197
   777
blanchet@33197
   778
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<inter> = (\<lambda>x. op \<inter> (I x))"
blanchet@33197
   779
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   780
by auto
blanchet@33197
   781
blanchet@33197
   782
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<inter> = (\<lambda>x y. op \<inter> x (I y))"
blanchet@33197
   783
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   784
by auto
blanchet@33197
   785
blanchet@33197
   786
lemma "a \<notin> A \<Longrightarrow> a \<notin> (A \<inter> B)" "b \<notin> B \<Longrightarrow> b \<notin> (A \<inter> B)"
blanchet@33197
   787
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   788
by auto
blanchet@33197
   789
blanchet@33197
   790
lemma "a \<notin> (A \<inter> B) \<Longrightarrow> a \<notin> A \<or> a \<notin> B"
blanchet@33197
   791
nitpick [expect = none]
blanchet@33197
   792
by auto
blanchet@33197
   793
blanchet@33197
   794
lemma "I = (\<lambda>x. x) \<Longrightarrow> op - = (\<lambda>x\<Colon>'a set. op - (I x))"
blanchet@33197
   795
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   796
by auto
blanchet@33197
   797
blanchet@33197
   798
lemma "I = (\<lambda>x. x) \<Longrightarrow> op - = (\<lambda>x y\<Colon>'a set. op - x (I y))"
blanchet@33197
   799
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   800
by auto
blanchet@33197
   801
blanchet@33197
   802
lemma "x \<in> ((A\<Colon>'a set) - B) \<longleftrightarrow> x \<in> A \<and> x \<notin> B"
blanchet@33197
   803
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   804
by auto
blanchet@33197
   805
blanchet@33197
   806
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<subset> = (\<lambda>x. op \<subset> (I x))"
blanchet@33197
   807
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   808
by auto
blanchet@33197
   809
blanchet@33197
   810
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<subset> = (\<lambda>x y. op \<subset> x (I y))"
blanchet@33197
   811
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   812
by auto
blanchet@33197
   813
blanchet@33197
   814
lemma "A \<subset> B \<Longrightarrow> (\<forall>a \<in> A. a \<in> B) \<and> (\<exists>b \<in> B. b \<notin> A)"
blanchet@33197
   815
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   816
by auto
blanchet@33197
   817
blanchet@33197
   818
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<subseteq> = (\<lambda>x. op \<subseteq> (I x))"
blanchet@33197
   819
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   820
by auto
blanchet@33197
   821
blanchet@33197
   822
lemma "I = (\<lambda>x. x) \<Longrightarrow> op \<subseteq> = (\<lambda>x y. op \<subseteq> x (I y))"
blanchet@33197
   823
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   824
by auto
blanchet@33197
   825
blanchet@33197
   826
lemma "A \<subseteq> B \<Longrightarrow> \<forall>a \<in> A. a \<in> B"
blanchet@33197
   827
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   828
by auto
blanchet@33197
   829
blanchet@33197
   830
lemma "A \<subseteq> B \<Longrightarrow> A \<subset> B"
blanchet@33197
   831
nitpick [card = 5, expect = genuine]
blanchet@33197
   832
oops
blanchet@33197
   833
blanchet@33197
   834
lemma "A \<subset> B \<Longrightarrow> A \<subseteq> B"
blanchet@33197
   835
nitpick [expect = none]
blanchet@33197
   836
by auto
blanchet@33197
   837
blanchet@33197
   838
lemma "I = (\<lambda>x\<Colon>'a set. x) \<Longrightarrow> uminus = (\<lambda>x. uminus (I x))"
blanchet@34126
   839
nitpick [card = 1\<midarrow>7, expect = none]
blanchet@33197
   840
by auto
blanchet@33197
   841
blanchet@33197
   842
lemma "A \<union> - A = UNIV"
blanchet@33197
   843
nitpick [expect = none]
blanchet@33197
   844
by auto
blanchet@33197
   845
blanchet@33197
   846
lemma "A \<inter> - A = {}"
blanchet@33197
   847
nitpick [expect = none]
blanchet@33197
   848
by auto
blanchet@33197
   849
blanchet@33197
   850
lemma "A = -(A\<Colon>'a set)"
blanchet@33197
   851
nitpick [card 'a = 10, expect = genuine]
blanchet@33197
   852
oops
blanchet@33197
   853
blanchet@33197
   854
lemma "I = (\<lambda>x. x) \<Longrightarrow> finite = (\<lambda>x. finite (I x))"
blanchet@34126
   855
nitpick [card = 1\<midarrow>7, expect = none]
blanchet@33197
   856
oops
blanchet@33197
   857
blanchet@33197
   858
lemma "finite A"
blanchet@33197
   859
nitpick [expect = none]
blanchet@33197
   860
oops
blanchet@33197
   861
blanchet@33197
   862
lemma "finite A \<Longrightarrow> finite B"
blanchet@33197
   863
nitpick [expect = none]
blanchet@33197
   864
oops
blanchet@33197
   865
blanchet@33197
   866
lemma "All finite"
blanchet@33197
   867
nitpick [expect = none]
blanchet@33197
   868
oops
blanchet@33197
   869
blanchet@33197
   870
subsection {* The and Eps *}
blanchet@33197
   871
blanchet@33197
   872
lemma "x = The"
blanchet@33197
   873
nitpick [card = 5, expect = genuine]
blanchet@33197
   874
oops
blanchet@33197
   875
blanchet@33197
   876
lemma "\<exists>x. x = The"
blanchet@33197
   877
nitpick [card = 1\<midarrow>3]
blanchet@33197
   878
by auto
blanchet@33197
   879
blanchet@33197
   880
lemma "P x \<and> (\<forall>y. P y \<longrightarrow> y = x) \<longrightarrow> The P = x"
blanchet@33197
   881
nitpick [expect = none]
blanchet@33197
   882
by auto
blanchet@33197
   883
blanchet@33197
   884
lemma "P x \<and> P y \<and> x \<noteq> y \<longrightarrow> The P = z"
blanchet@33197
   885
nitpick [expect = genuine]
blanchet@33197
   886
oops
blanchet@33197
   887
blanchet@33197
   888
lemma "P x \<and> P y \<and> x \<noteq> y \<longrightarrow> The P = x \<or> The P = y"
blanchet@33197
   889
nitpick [card = 2, expect = none]
blanchet@33197
   890
nitpick [card = 3\<midarrow>5, expect = genuine]
blanchet@33197
   891
oops
blanchet@33197
   892
blanchet@33197
   893
lemma "P x \<Longrightarrow> P (The P)"
blanchet@33197
   894
nitpick [card = 1\<midarrow>2, expect = none]
blanchet@35284
   895
nitpick [card = 3, expect = genuine]
blanchet@33197
   896
nitpick [card = 8, expect = genuine]
blanchet@33197
   897
oops
blanchet@33197
   898
blanchet@33197
   899
lemma "(\<forall>x. \<not> P x) \<longrightarrow> The P = y"
blanchet@33197
   900
nitpick [expect = genuine]
blanchet@33197
   901
oops
blanchet@33197
   902
blanchet@33197
   903
lemma "I = (\<lambda>x. x) \<Longrightarrow> The = (\<lambda>x. The (I x))"
blanchet@33197
   904
nitpick [card = 1\<midarrow>5, expect = none]
blanchet@33197
   905
by auto
blanchet@33197
   906
blanchet@33197
   907
lemma "x = Eps"
blanchet@33197
   908
nitpick [card = 5, expect = genuine]
blanchet@33197
   909
oops
blanchet@33197
   910
blanchet@33197
   911
lemma "\<exists>x. x = Eps"
blanchet@33197
   912
nitpick [card = 1\<midarrow>3, expect = none]
blanchet@33197
   913
by auto
blanchet@33197
   914
blanchet@33197
   915
lemma "P x \<and> (\<forall>y. P y \<longrightarrow> y = x) \<longrightarrow> Eps P = x"
blanchet@33197
   916
nitpick [expect = none]
blanchet@33197
   917
by auto
blanchet@33197
   918
blanchet@33197
   919
lemma "P x \<and> P y \<and> x \<noteq> y \<longrightarrow> Eps P = z"
blanchet@33197
   920
nitpick [expect = genuine]
blanchet@33197
   921
apply auto
blanchet@33197
   922
oops
blanchet@33197
   923
blanchet@33197
   924
lemma "P x \<Longrightarrow> P (Eps P)"
blanchet@33197
   925
nitpick [card = 1\<midarrow>8, expect = none]
blanchet@33197
   926
by (metis exE_some)
blanchet@33197
   927
blanchet@33197
   928
lemma "\<forall>x. \<not> P x \<longrightarrow> Eps P = y"
blanchet@33197
   929
nitpick [expect = genuine]
blanchet@33197
   930
oops
blanchet@33197
   931
blanchet@33197
   932
lemma "P (Eps P)"
blanchet@33197
   933
nitpick [expect = genuine]
blanchet@33197
   934
oops
blanchet@33197
   935
blanchet@33197
   936
lemma "(P\<Colon>nat set) (Eps P)"
blanchet@33197
   937
nitpick [expect = genuine]
blanchet@33197
   938
oops
blanchet@33197
   939
blanchet@33197
   940
lemma "\<not> P (Eps P)"
blanchet@33197
   941
nitpick [expect = genuine]
blanchet@33197
   942
oops
blanchet@33197
   943
blanchet@33197
   944
lemma "\<not> (P\<Colon>nat set) (Eps P)"
blanchet@33197
   945
nitpick [expect = genuine]
blanchet@33197
   946
oops
blanchet@33197
   947
blanchet@33197
   948
lemma "P \<noteq> {} \<Longrightarrow> P (Eps P)"
blanchet@33197
   949
nitpick [expect = none]
blanchet@33197
   950
sorry
blanchet@33197
   951
blanchet@33197
   952
lemma "(P\<Colon>nat set) \<noteq> {} \<Longrightarrow> P (Eps P)"
blanchet@33197
   953
nitpick [expect = none]
blanchet@33197
   954
sorry
blanchet@33197
   955
blanchet@33197
   956
lemma "P (The P)"
blanchet@33197
   957
nitpick [expect = genuine]
blanchet@33197
   958
oops
blanchet@33197
   959
blanchet@33197
   960
lemma "(P\<Colon>nat set) (The P)"
blanchet@33197
   961
nitpick [expect = genuine]
blanchet@33197
   962
oops
blanchet@33197
   963
blanchet@33197
   964
lemma "\<not> P (The P)"
blanchet@33197
   965
nitpick [expect = genuine]
blanchet@33197
   966
oops
blanchet@33197
   967
blanchet@33197
   968
lemma "\<not> (P\<Colon>nat set) (The P)"
blanchet@33197
   969
nitpick [expect = genuine]
blanchet@33197
   970
oops
blanchet@33197
   971
blanchet@33197
   972
lemma "The P \<noteq> x"
blanchet@33197
   973
nitpick [expect = genuine]
blanchet@33197
   974
oops
blanchet@33197
   975
blanchet@33197
   976
lemma "The P \<noteq> (x\<Colon>nat)"
blanchet@33197
   977
nitpick [expect = genuine]
blanchet@33197
   978
oops
blanchet@33197
   979
blanchet@33197
   980
lemma "P x \<Longrightarrow> P (The P)"
blanchet@33197
   981
nitpick [expect = genuine]
blanchet@33197
   982
oops
blanchet@33197
   983
blanchet@33197
   984
lemma "P (x\<Colon>nat) \<Longrightarrow> P (The P)"
blanchet@33197
   985
nitpick [expect = genuine]
blanchet@33197
   986
oops
blanchet@33197
   987
blanchet@33197
   988
lemma "P = {x} \<Longrightarrow> P (The P)"
blanchet@33197
   989
nitpick [expect = none]
blanchet@33197
   990
oops
blanchet@33197
   991
blanchet@33197
   992
lemma "P = {x\<Colon>nat} \<Longrightarrow> P (The P)"
blanchet@33197
   993
nitpick [expect = none]
blanchet@33197
   994
oops
blanchet@33197
   995
blanchet@33197
   996
consts Q :: 'a
blanchet@33197
   997
blanchet@33197
   998
lemma "Q (Eps Q)"
blanchet@33197
   999
nitpick [expect = genuine]
blanchet@33197
  1000
oops
blanchet@33197
  1001
blanchet@33197
  1002
lemma "(Q\<Colon>nat set) (Eps Q)"
blanchet@35386
  1003
nitpick [expect = none] (* unfortunate *)
blanchet@33197
  1004
oops
blanchet@33197
  1005
blanchet@33197
  1006
lemma "\<not> Q (Eps Q)"
blanchet@33197
  1007
nitpick [expect = genuine]
blanchet@33197
  1008
oops
blanchet@33197
  1009
blanchet@33197
  1010
lemma "\<not> (Q\<Colon>nat set) (Eps Q)"
blanchet@33197
  1011
nitpick [expect = genuine]
blanchet@33197
  1012
oops
blanchet@33197
  1013
blanchet@33197
  1014
lemma "(Q\<Colon>'a set) \<noteq> {} \<Longrightarrow> (Q\<Colon>'a set) (Eps Q)"
blanchet@33197
  1015
nitpick [expect = none]
blanchet@33197
  1016
sorry
blanchet@33197
  1017
blanchet@33197
  1018
lemma "(Q\<Colon>nat set) \<noteq> {} \<Longrightarrow> (Q\<Colon>nat set) (Eps Q)"
blanchet@33197
  1019
nitpick [expect = none]
blanchet@33197
  1020
sorry
blanchet@33197
  1021
blanchet@33197
  1022
lemma "Q (The Q)"
blanchet@33197
  1023
nitpick [expect = genuine]
blanchet@33197
  1024
oops
blanchet@33197
  1025
blanchet@33197
  1026
lemma "(Q\<Colon>nat set) (The Q)"
blanchet@33197
  1027
nitpick [expect = genuine]
blanchet@33197
  1028
oops
blanchet@33197
  1029
blanchet@33197
  1030
lemma "\<not> Q (The Q)"
blanchet@33197
  1031
nitpick [expect = genuine]
blanchet@33197
  1032
oops
blanchet@33197
  1033
blanchet@33197
  1034
lemma "\<not> (Q\<Colon>nat set) (The Q)"
blanchet@33197
  1035
nitpick [expect = genuine]
blanchet@33197
  1036
oops
blanchet@33197
  1037
blanchet@33197
  1038
lemma "The Q \<noteq> x"
blanchet@33197
  1039
nitpick [expect = genuine]
blanchet@33197
  1040
oops
blanchet@33197
  1041
blanchet@33197
  1042
lemma "The Q \<noteq> (x\<Colon>nat)"
blanchet@33197
  1043
nitpick [expect = genuine]
blanchet@33197
  1044
oops
blanchet@33197
  1045
blanchet@33197
  1046
lemma "Q x \<Longrightarrow> Q (The Q)"
blanchet@33197
  1047
nitpick [expect = genuine]
blanchet@33197
  1048
oops
blanchet@33197
  1049
blanchet@33197
  1050
lemma "Q (x\<Colon>nat) \<Longrightarrow> Q (The Q)"
blanchet@33197
  1051
nitpick [expect = genuine]
blanchet@33197
  1052
oops
blanchet@33197
  1053
blanchet@33197
  1054
lemma "Q = {x\<Colon>'a} \<Longrightarrow> (Q\<Colon>'a set) (The Q)"
blanchet@33197
  1055
nitpick [expect = none]
blanchet@35386
  1056
sorry
blanchet@33197
  1057
blanchet@33197
  1058
lemma "Q = {x\<Colon>nat} \<Longrightarrow> (Q\<Colon>nat set) (The Q)"
blanchet@33197
  1059
nitpick [expect = none]
blanchet@35386
  1060
sorry
blanchet@33197
  1061
blanchet@33197
  1062
subsection {* Destructors and Recursors *}
blanchet@33197
  1063
blanchet@33197
  1064
lemma "(x\<Colon>'a) = (case True of True \<Rightarrow> x | False \<Rightarrow> x)"
blanchet@33197
  1065
nitpick [card = 2, expect = none]
blanchet@33197
  1066
by auto
blanchet@33197
  1067
blanchet@33197
  1068
lemma "bool_rec x y True = x"
blanchet@33197
  1069
nitpick [card = 2, expect = none]
blanchet@33197
  1070
by auto
blanchet@33197
  1071
blanchet@33197
  1072
lemma "bool_rec x y False = y"
blanchet@33197
  1073
nitpick [card = 2, expect = none]
blanchet@33197
  1074
by auto
blanchet@33197
  1075
blanchet@33197
  1076
lemma "(x\<Colon>bool) = bool_rec x x True"
blanchet@33197
  1077
nitpick [card = 2, expect = none]
blanchet@33197
  1078
by auto
blanchet@33197
  1079
blanchet@33197
  1080
lemma "x = (case (x, y) of (x', y') \<Rightarrow> x')"
blanchet@33197
  1081
nitpick [expect = none]
blanchet@33197
  1082
sorry
blanchet@33197
  1083
blanchet@33197
  1084
end