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