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