src/HOL/Nitpick_Examples/Mini_Nits.thy
author wenzelm
Tue Oct 10 19:23:03 2017 +0200 (2017-10-10)
changeset 66831 29ea2b900a05
parent 65907 637d18b325d0
child 67399 eab6ce8368fa
permissions -rw-r--r--
tuned: each session has at most one defining entry;
blanchet@45035
     1
(*  Title:      HOL/Nitpick_Examples/Mini_Nits.thy
blanchet@45035
     2
    Author:     Jasmin Blanchette, TU Muenchen
blanchet@45035
     3
    Copyright   2009-2011
blanchet@45035
     4
blanchet@45035
     5
Examples featuring Minipick, the minimalistic version of Nitpick.
blanchet@45035
     6
*)
blanchet@45035
     7
wenzelm@63167
     8
section \<open>Examples Featuring Minipick, the Minimalistic Version of Nitpick\<close>
blanchet@45035
     9
blanchet@45035
    10
theory Mini_Nits
blanchet@45035
    11
imports Main
blanchet@45035
    12
begin
blanchet@45035
    13
wenzelm@48891
    14
ML_file "minipick.ML"
wenzelm@48891
    15
blanchet@54845
    16
nitpick_params [verbose, sat_solver = MiniSat_JNI, max_threads = 1,
blanchet@54845
    17
  total_consts = smart]
blanchet@45035
    18
wenzelm@63167
    19
ML \<open>
blanchet@45062
    20
val check = Minipick.minipick @{context}
blanchet@45062
    21
val expect = Minipick.minipick_expect @{context}
blanchet@45062
    22
val none = expect "none"
blanchet@45062
    23
val genuine = expect "genuine"
blanchet@45062
    24
val unknown = expect "unknown"
wenzelm@63167
    25
\<close>
blanchet@45035
    26
wenzelm@65907
    27
ML \<open>genuine 1 @{prop "x = Not"}\<close>
wenzelm@65907
    28
ML \<open>none 1 @{prop "\<exists>x. x = Not"}\<close>
wenzelm@65907
    29
ML \<open>none 1 @{prop "\<not> False"}\<close>
wenzelm@65907
    30
ML \<open>genuine 1 @{prop "\<not> True"}\<close>
wenzelm@65907
    31
ML \<open>none 1 @{prop "\<not> \<not> b \<longleftrightarrow> b"}\<close>
wenzelm@65907
    32
ML \<open>none 1 @{prop True}\<close>
wenzelm@65907
    33
ML \<open>genuine 1 @{prop False}\<close>
wenzelm@65907
    34
ML \<open>genuine 1 @{prop "True \<longleftrightarrow> False"}\<close>
wenzelm@65907
    35
ML \<open>none 1 @{prop "True \<longleftrightarrow> \<not> False"}\<close>
wenzelm@65907
    36
ML \<open>none 4 @{prop "\<forall>x. x = x"}\<close>
wenzelm@65907
    37
ML \<open>none 4 @{prop "\<exists>x. x = x"}\<close>
wenzelm@65907
    38
ML \<open>none 1 @{prop "\<forall>x. x = y"}\<close>
wenzelm@65907
    39
ML \<open>genuine 2 @{prop "\<forall>x. x = y"}\<close>
wenzelm@65907
    40
ML \<open>none 2 @{prop "\<exists>x. x = y"}\<close>
wenzelm@65907
    41
ML \<open>none 2 @{prop "\<forall>x::'a \<times> 'a. x = x"}\<close>
wenzelm@65907
    42
ML \<open>none 2 @{prop "\<exists>x::'a \<times> 'a. x = y"}\<close>
wenzelm@65907
    43
ML \<open>genuine 2 @{prop "\<forall>x::'a \<times> 'a. x = y"}\<close>
wenzelm@65907
    44
ML \<open>none 2 @{prop "\<exists>x::'a \<times> 'a. x = y"}\<close>
wenzelm@65907
    45
ML \<open>none 1 @{prop "All = Ex"}\<close>
wenzelm@65907
    46
ML \<open>genuine 2 @{prop "All = Ex"}\<close>
wenzelm@65907
    47
ML \<open>none 1 @{prop "All P = Ex P"}\<close>
wenzelm@65907
    48
ML \<open>genuine 2 @{prop "All P = Ex P"}\<close>
wenzelm@65907
    49
ML \<open>none 4 @{prop "x = y \<longrightarrow> P x = P y"}\<close>
wenzelm@65907
    50
ML \<open>none 4 @{prop "(x::'a \<times> 'a) = y \<longrightarrow> P x = P y"}\<close>
wenzelm@65907
    51
ML \<open>none 2 @{prop "(x::'a \<times> 'a) = y \<longrightarrow> P x y = P y x"}\<close>
wenzelm@65907
    52
ML \<open>none 4 @{prop "\<exists>x::'a \<times> 'a. x = y \<longrightarrow> P x = P y"}\<close>
wenzelm@65907
    53
ML \<open>none 2 @{prop "(x::'a \<Rightarrow> 'a) = y \<longrightarrow> P x = P y"}\<close>
wenzelm@65907
    54
ML \<open>none 2 @{prop "\<exists>x::'a \<Rightarrow> 'a. x = y \<longrightarrow> P x = P y"}\<close>
wenzelm@65907
    55
ML \<open>genuine 1 @{prop "(op =) X = Ex"}\<close>
wenzelm@65907
    56
ML \<open>none 2 @{prop "\<forall>x::'a \<Rightarrow> 'a. x = x"}\<close>
wenzelm@65907
    57
ML \<open>none 1 @{prop "x = y"}\<close>
wenzelm@65907
    58
ML \<open>genuine 1 @{prop "x \<longleftrightarrow> y"}\<close>
wenzelm@65907
    59
ML \<open>genuine 2 @{prop "x = y"}\<close>
wenzelm@65907
    60
ML \<open>genuine 1 @{prop "X \<subseteq> Y"}\<close>
wenzelm@65907
    61
ML \<open>none 1 @{prop "P \<and> Q \<longleftrightarrow> Q \<and> P"}\<close>
wenzelm@65907
    62
ML \<open>none 1 @{prop "P \<and> Q \<longrightarrow> P"}\<close>
wenzelm@65907
    63
ML \<open>none 1 @{prop "P \<or> Q \<longleftrightarrow> Q \<or> P"}\<close>
wenzelm@65907
    64
ML \<open>genuine 1 @{prop "P \<or> Q \<longrightarrow> P"}\<close>
wenzelm@65907
    65
ML \<open>none 1 @{prop "(P \<longrightarrow> Q) \<longleftrightarrow> (\<not> P \<or> Q)"}\<close>
wenzelm@65907
    66
ML \<open>none 4 @{prop "{a} = {a, a}"}\<close>
wenzelm@65907
    67
ML \<open>genuine 2 @{prop "{a} = {a, b}"}\<close>
wenzelm@65907
    68
ML \<open>genuine 1 @{prop "{a} \<noteq> {a, b}"}\<close>
wenzelm@65907
    69
ML \<open>none 4 @{prop "{}\<^sup>+ = {}"}\<close>
wenzelm@65907
    70
ML \<open>none 4 @{prop "UNIV\<^sup>+ = UNIV"}\<close>
wenzelm@65907
    71
ML \<open>none 4 @{prop "(UNIV :: ('a \<times> 'b) set) - {} = UNIV"}\<close>
wenzelm@65907
    72
ML \<open>none 4 @{prop "{} - (UNIV :: ('a \<times> 'b) set) = {}"}\<close>
wenzelm@65907
    73
ML \<open>none 1 @{prop "{(a, b), (b, c)}\<^sup>+ = {(a, b), (a, c), (b, c)}"}\<close>
wenzelm@65907
    74
ML \<open>genuine 2 @{prop "{(a, b), (b, c)}\<^sup>+ = {(a, b), (a, c), (b, c)}"}\<close>
wenzelm@65907
    75
ML \<open>none 4 @{prop "a \<noteq> c \<Longrightarrow> {(a, b), (b, c)}\<^sup>+ = {(a, b), (a, c), (b, c)}"}\<close>
wenzelm@65907
    76
ML \<open>none 4 @{prop "A \<union> B = {x. x \<in> A \<or> x \<in> B}"}\<close>
wenzelm@65907
    77
ML \<open>none 4 @{prop "A \<inter> B = {x. x \<in> A \<and> x \<in> B}"}\<close>
wenzelm@65907
    78
ML \<open>none 4 @{prop "A - B = (\<lambda>x. A x \<and> \<not> B x)"}\<close>
wenzelm@65907
    79
ML \<open>none 4 @{prop "\<exists>a b. (a, b) = (b, a)"}\<close>
wenzelm@65907
    80
ML \<open>genuine 2 @{prop "(a, b) = (b, a)"}\<close>
wenzelm@65907
    81
ML \<open>genuine 2 @{prop "(a, b) \<noteq> (b, a)"}\<close>
wenzelm@65907
    82
ML \<open>none 4 @{prop "\<exists>a b::'a \<times> 'a. (a, b) = (b, a)"}\<close>
wenzelm@65907
    83
ML \<open>genuine 2 @{prop "(a::'a \<times> 'a, b) = (b, a)"}\<close>
wenzelm@65907
    84
ML \<open>none 4 @{prop "\<exists>a b::'a \<times> 'a \<times> 'a. (a, b) = (b, a)"}\<close>
wenzelm@65907
    85
ML \<open>genuine 2 @{prop "(a::'a \<times> 'a \<times> 'a, b) \<noteq> (b, a)"}\<close>
wenzelm@65907
    86
ML \<open>none 4 @{prop "\<exists>a b::'a \<Rightarrow> 'a. (a, b) = (b, a)"}\<close>
wenzelm@65907
    87
ML \<open>genuine 1 @{prop "(a::'a \<Rightarrow> 'a, b) \<noteq> (b, a)"}\<close>
wenzelm@65907
    88
ML \<open>none 4 @{prop "fst (a, b) = a"}\<close>
wenzelm@65907
    89
ML \<open>none 1 @{prop "fst (a, b) = b"}\<close>
wenzelm@65907
    90
ML \<open>genuine 2 @{prop "fst (a, b) = b"}\<close>
wenzelm@65907
    91
ML \<open>genuine 2 @{prop "fst (a, b) \<noteq> b"}\<close>
wenzelm@65907
    92
ML \<open>genuine 2 @{prop "f ((x, z), y) = (x, z)"}\<close>
wenzelm@65907
    93
ML \<open>none 2 @{prop "(ALL x. f x = fst x) \<longrightarrow> f ((x, z), y) = (x, z)"}\<close>
wenzelm@65907
    94
ML \<open>none 4 @{prop "snd (a, b) = b"}\<close>
wenzelm@65907
    95
ML \<open>none 1 @{prop "snd (a, b) = a"}\<close>
wenzelm@65907
    96
ML \<open>genuine 2 @{prop "snd (a, b) = a"}\<close>
wenzelm@65907
    97
ML \<open>genuine 2 @{prop "snd (a, b) \<noteq> a"}\<close>
wenzelm@65907
    98
ML \<open>genuine 1 @{prop P}\<close>
wenzelm@65907
    99
ML \<open>genuine 1 @{prop "(\<lambda>x. P) a"}\<close>
wenzelm@65907
   100
ML \<open>genuine 1 @{prop "(\<lambda>x y z. P y x z) a b c"}\<close>
wenzelm@65907
   101
ML \<open>none 4 @{prop "\<exists>f. f = (\<lambda>x. x) \<and> f y = y"}\<close>
wenzelm@65907
   102
ML \<open>genuine 1 @{prop "\<exists>f. f p \<noteq> p \<and> (\<forall>a b. f (a, b) = (a, b))"}\<close>
wenzelm@65907
   103
ML \<open>none 2 @{prop "\<exists>f. \<forall>a b. f (a, b) = (a, b)"}\<close>
wenzelm@65907
   104
ML \<open>none 3 @{prop "f = (\<lambda>a b. (b, a)) \<longrightarrow> f x y = (y, x)"}\<close>
wenzelm@65907
   105
ML \<open>genuine 2 @{prop "f = (\<lambda>a b. (b, a)) \<longrightarrow> f x y = (x, y)"}\<close>
wenzelm@65907
   106
ML \<open>none 4 @{prop "f = (\<lambda>x. f x)"}\<close>
wenzelm@65907
   107
ML \<open>none 4 @{prop "f = (\<lambda>x. f x::'a \<Rightarrow> bool)"}\<close>
wenzelm@65907
   108
ML \<open>none 4 @{prop "f = (\<lambda>x y. f x y)"}\<close>
wenzelm@65907
   109
ML \<open>none 4 @{prop "f = (\<lambda>x y. f x y::'a \<Rightarrow> bool)"}\<close>
blanchet@45035
   110
blanchet@45035
   111
end