src/HOL/Nitpick_Examples/Mini_Nits.thy
author wenzelm
Sun, 02 Nov 2014 18:21:45 +0100
changeset 58889 5b7a9633cfa8
parent 54845 10df188349b3
child 61076 bdc1e2f0a86a
permissions -rw-r--r--
modernized header uniformly as section;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45035
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
     1
(*  Title:      HOL/Nitpick_Examples/Mini_Nits.thy
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
     2
    Author:     Jasmin Blanchette, TU Muenchen
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
     3
    Copyright   2009-2011
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
     4
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
     5
Examples featuring Minipick, the minimalistic version of Nitpick.
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
     6
*)
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
     7
58889
5b7a9633cfa8 modernized header uniformly as section;
wenzelm
parents: 54845
diff changeset
     8
section {* Examples Featuring Minipick, the Minimalistic Version of Nitpick *}
45035
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
     9
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
    10
theory Mini_Nits
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
    11
imports Main
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
    12
begin
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
    13
48891
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 45970
diff changeset
    14
ML_file "minipick.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 45970
diff changeset
    15
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    16
nitpick_params [verbose, sat_solver = MiniSat_JNI, max_threads = 1,
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    17
  total_consts = smart]
45035
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
    18
45062
9598cada31b3 first step towards extending Minipick with more translations
blanchet
parents: 45035
diff changeset
    19
ML {*
9598cada31b3 first step towards extending Minipick with more translations
blanchet
parents: 45035
diff changeset
    20
val check = Minipick.minipick @{context}
9598cada31b3 first step towards extending Minipick with more translations
blanchet
parents: 45035
diff changeset
    21
val expect = Minipick.minipick_expect @{context}
9598cada31b3 first step towards extending Minipick with more translations
blanchet
parents: 45035
diff changeset
    22
val none = expect "none"
9598cada31b3 first step towards extending Minipick with more translations
blanchet
parents: 45035
diff changeset
    23
val genuine = expect "genuine"
9598cada31b3 first step towards extending Minipick with more translations
blanchet
parents: 45035
diff changeset
    24
val unknown = expect "unknown"
45035
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
    25
*}
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
    26
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    27
ML_val {* genuine 1 @{prop "x = Not"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    28
ML_val {* none 1 @{prop "\<exists>x. x = Not"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    29
ML_val {* none 1 @{prop "\<not> False"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    30
ML_val {* genuine 1 @{prop "\<not> True"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    31
ML_val {* none 1 @{prop "\<not> \<not> b \<longleftrightarrow> b"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    32
ML_val {* none 1 @{prop True} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    33
ML_val {* genuine 1 @{prop False} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    34
ML_val {* genuine 1 @{prop "True \<longleftrightarrow> False"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    35
ML_val {* none 1 @{prop "True \<longleftrightarrow> \<not> False"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    36
ML_val {* none 4 @{prop "\<forall>x. x = x"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    37
ML_val {* none 4 @{prop "\<exists>x. x = x"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    38
ML_val {* none 1 @{prop "\<forall>x. x = y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    39
ML_val {* genuine 2 @{prop "\<forall>x. x = y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    40
ML_val {* none 2 @{prop "\<exists>x. x = y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    41
ML_val {* none 2 @{prop "\<forall>x\<Colon>'a \<times> 'a. x = x"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    42
ML_val {* none 2 @{prop "\<exists>x\<Colon>'a \<times> 'a. x = y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    43
ML_val {* genuine 2 @{prop "\<forall>x\<Colon>'a \<times> 'a. x = y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    44
ML_val {* none 2 @{prop "\<exists>x\<Colon>'a \<times> 'a. x = y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    45
ML_val {* none 1 @{prop "All = Ex"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    46
ML_val {* genuine 2 @{prop "All = Ex"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    47
ML_val {* none 1 @{prop "All P = Ex P"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    48
ML_val {* genuine 2 @{prop "All P = Ex P"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    49
ML_val {* none 4 @{prop "x = y \<longrightarrow> P x = P y"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    50
ML_val {* none 4 @{prop "(x\<Colon>'a \<times> 'a) = y \<longrightarrow> P x = P y"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    51
ML_val {* none 2 @{prop "(x\<Colon>'a \<times> 'a) = y \<longrightarrow> P x y = P y x"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    52
ML_val {* none 4 @{prop "\<exists>x\<Colon>'a \<times> 'a. x = y \<longrightarrow> P x = P y"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    53
ML_val {* none 2 @{prop "(x\<Colon>'a \<Rightarrow> 'a) = y \<longrightarrow> P x = P y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    54
ML_val {* none 2 @{prop "\<exists>x\<Colon>'a \<Rightarrow> 'a. x = y \<longrightarrow> P x = P y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    55
ML_val {* genuine 1 @{prop "(op =) X = Ex"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    56
ML_val {* none 2 @{prop "\<forall>x::'a \<Rightarrow> 'a. x = x"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    57
ML_val {* none 1 @{prop "x = y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    58
ML_val {* genuine 1 @{prop "x \<longleftrightarrow> y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    59
ML_val {* genuine 2 @{prop "x = y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    60
ML_val {* genuine 1 @{prop "X \<subseteq> Y"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    61
ML_val {* none 1 @{prop "P \<and> Q \<longleftrightarrow> Q \<and> P"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    62
ML_val {* none 1 @{prop "P \<and> Q \<longrightarrow> P"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    63
ML_val {* none 1 @{prop "P \<or> Q \<longleftrightarrow> Q \<or> P"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    64
ML_val {* genuine 1 @{prop "P \<or> Q \<longrightarrow> P"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    65
ML_val {* none 1 @{prop "(P \<longrightarrow> Q) \<longleftrightarrow> (\<not> P \<or> Q)"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    66
ML_val {* none 4 @{prop "{a} = {a, a}"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    67
ML_val {* genuine 2 @{prop "{a} = {a, b}"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    68
ML_val {* genuine 1 @{prop "{a} \<noteq> {a, b}"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    69
ML_val {* none 4 @{prop "{}\<^sup>+ = {}"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    70
ML_val {* none 4 @{prop "UNIV\<^sup>+ = UNIV"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    71
ML_val {* none 4 @{prop "(UNIV \<Colon> ('a \<times> 'b) set) - {} = UNIV"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    72
ML_val {* none 4 @{prop "{} - (UNIV \<Colon> ('a \<times> 'b) set) = {}"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    73
ML_val {* none 1 @{prop "{(a, b), (b, c)}\<^sup>+ = {(a, b), (a, c), (b, c)}"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    74
ML_val {* genuine 2 @{prop "{(a, b), (b, c)}\<^sup>+ = {(a, b), (a, c), (b, c)}"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    75
ML_val {* none 4 @{prop "a \<noteq> c \<Longrightarrow> {(a, b), (b, c)}\<^sup>+ = {(a, b), (a, c), (b, c)}"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    76
ML_val {* none 4 @{prop "A \<union> B = {x. x \<in> A \<or> x \<in> B}"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    77
ML_val {* none 4 @{prop "A \<inter> B = {x. x \<in> A \<and> x \<in> B}"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    78
ML_val {* none 4 @{prop "A - B = (\<lambda>x. A x \<and> \<not> B x)"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    79
ML_val {* none 4 @{prop "\<exists>a b. (a, b) = (b, a)"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    80
ML_val {* genuine 2 @{prop "(a, b) = (b, a)"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    81
ML_val {* genuine 2 @{prop "(a, b) \<noteq> (b, a)"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    82
ML_val {* none 4 @{prop "\<exists>a b\<Colon>'a \<times> 'a. (a, b) = (b, a)"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    83
ML_val {* genuine 2 @{prop "(a\<Colon>'a \<times> 'a, b) = (b, a)"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    84
ML_val {* none 4 @{prop "\<exists>a b\<Colon>'a \<times> 'a \<times> 'a. (a, b) = (b, a)"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    85
ML_val {* genuine 2 @{prop "(a\<Colon>'a \<times> 'a \<times> 'a, b) \<noteq> (b, a)"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    86
ML_val {* none 4 @{prop "\<exists>a b\<Colon>'a \<Rightarrow> 'a. (a, b) = (b, a)"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    87
ML_val {* genuine 1 @{prop "(a\<Colon>'a \<Rightarrow> 'a, b) \<noteq> (b, a)"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    88
ML_val {* none 4 @{prop "fst (a, b) = a"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    89
ML_val {* none 1 @{prop "fst (a, b) = b"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    90
ML_val {* genuine 2 @{prop "fst (a, b) = b"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    91
ML_val {* genuine 2 @{prop "fst (a, b) \<noteq> b"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    92
ML_val {* genuine 2 @{prop "f ((x, z), y) = (x, z)"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    93
ML_val {* none 2 @{prop "(ALL x. f x = fst x) \<longrightarrow> f ((x, z), y) = (x, z)"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
    94
ML_val {* none 4 @{prop "snd (a, b) = b"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    95
ML_val {* none 1 @{prop "snd (a, b) = a"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    96
ML_val {* genuine 2 @{prop "snd (a, b) = a"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    97
ML_val {* genuine 2 @{prop "snd (a, b) \<noteq> a"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    98
ML_val {* genuine 1 @{prop P} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
    99
ML_val {* genuine 1 @{prop "(\<lambda>x. P) a"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
   100
ML_val {* genuine 1 @{prop "(\<lambda>x y z. P y x z) a b c"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
   101
ML_val {* none 4 @{prop "\<exists>f. f = (\<lambda>x. x) \<and> f y = y"} *}
51272
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
   102
ML_val {* genuine 1 @{prop "\<exists>f. f p \<noteq> p \<and> (\<forall>a b. f (a, b) = (a, b))"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
   103
ML_val {* none 2 @{prop "\<exists>f. \<forall>a b. f (a, b) = (a, b)"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
   104
ML_val {* none 3 @{prop "f = (\<lambda>a b. (b, a)) \<longrightarrow> f x y = (y, x)"} *}
9c8d63b4b6be prefer stateless 'ML_val' for tests;
wenzelm
parents: 48891
diff changeset
   105
ML_val {* genuine 2 @{prop "f = (\<lambda>a b. (b, a)) \<longrightarrow> f x y = (x, y)"} *}
54845
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
   106
ML_val {* none 4 @{prop "f = (\<lambda>x. f x)"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
   107
ML_val {* none 4 @{prop "f = (\<lambda>x. f x\<Colon>'a \<Rightarrow> bool)"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
   108
ML_val {* none 4 @{prop "f = (\<lambda>x y. f x y)"} *}
10df188349b3 compile + reduce problem size by a notch
blanchet
parents: 54680
diff changeset
   109
ML_val {* none 4 @{prop "f = (\<lambda>x y. f x y\<Colon>'a \<Rightarrow> bool)"} *}
45035
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
   110
60d2c03d5c70 reintroduced Minipick as Nitpick example
blanchet
parents:
diff changeset
   111
end