src/HOL/HOL.thy
author wenzelm
Wed Sep 13 22:29:17 2000 +0200 (2000-09-13)
changeset 9950 879e88b1e552
parent 9890 144ecc001b8f
child 9970 dfe4747c8318
permissions -rw-r--r--
\<epsilon>: syntax (input);
     1 (*  Title:      HOL/HOL.thy
     2     ID:         $Id$
     3     Author:     Tobias Nipkow
     4     Copyright   1993  University of Cambridge
     5 
     6 Higher-Order Logic.
     7 *)
     8 
     9 theory HOL = CPure
    10 files ("HOL_lemmas.ML") ("cladata.ML") ("blastdata.ML") ("simpdata.ML")
    11   ("meson_lemmas.ML") ("Tools/meson.ML"):
    12 
    13 
    14 (** Core syntax **)
    15 
    16 global
    17 
    18 classes "term" < logic
    19 defaultsort "term"
    20 
    21 typedecl bool
    22 
    23 arities
    24   bool :: "term"
    25   fun :: ("term", "term") "term"
    26 
    27 
    28 consts
    29 
    30   (* Constants *)
    31 
    32   Trueprop      :: "bool => prop"                   ("(_)" 5)
    33   Not           :: "bool => bool"                   ("~ _" [40] 40)
    34   True          :: bool
    35   False         :: bool
    36   If            :: "[bool, 'a, 'a] => 'a"           ("(if (_)/ then (_)/ else (_))" 10)
    37   arbitrary     :: 'a
    38 
    39   (* Binders *)
    40 
    41   Eps           :: "('a => bool) => 'a"
    42   All           :: "('a => bool) => bool"           (binder "ALL " 10)
    43   Ex            :: "('a => bool) => bool"           (binder "EX " 10)
    44   Ex1           :: "('a => bool) => bool"           (binder "EX! " 10)
    45   Let           :: "['a, 'a => 'b] => 'b"
    46 
    47   (* Infixes *)
    48 
    49   "="           :: "['a, 'a] => bool"               (infixl 50)
    50   &             :: "[bool, bool] => bool"           (infixr 35)
    51   "|"           :: "[bool, bool] => bool"           (infixr 30)
    52   -->           :: "[bool, bool] => bool"           (infixr 25)
    53 
    54 
    55 (* Overloaded Constants *)
    56 
    57 axclass zero  < "term"
    58 axclass plus  < "term"
    59 axclass minus < "term"
    60 axclass times < "term"
    61 axclass power < "term"
    62 
    63 consts
    64   "0"           :: "('a::zero)"                     ("0")
    65   "+"           :: "['a::plus, 'a]  => 'a"          (infixl 65)
    66   -             :: "['a::minus, 'a] => 'a"          (infixl 65)
    67   uminus        :: "['a::minus] => 'a"              ("- _" [81] 80)
    68   abs           :: "('a::minus) => 'a"
    69   *             :: "['a::times, 'a] => 'a"          (infixl 70)
    70   (*See Nat.thy for "^"*)
    71 
    72 axclass plus_ac0 < plus, zero
    73     commute: "x + y = y + x"
    74     assoc:   "(x + y) + z = x + (y + z)"
    75     zero:    "0 + x = x"
    76 
    77 
    78 (** Additional concrete syntax **)
    79 
    80 nonterminals
    81   letbinds  letbind
    82   case_syn  cases_syn
    83 
    84 syntax
    85   ~=            :: "['a, 'a] => bool"                    (infixl 50)
    86   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3SOME _./ _)" [0, 10] 10)
    87 
    88   (* Let expressions *)
    89 
    90   "_bind"       :: "[pttrn, 'a] => letbind"              ("(2_ =/ _)" 10)
    91   ""            :: "letbind => letbinds"                 ("_")
    92   "_binds"      :: "[letbind, letbinds] => letbinds"     ("_;/ _")
    93   "_Let"        :: "[letbinds, 'a] => 'a"                ("(let (_)/ in (_))" 10)
    94 
    95   (* Case expressions *)
    96 
    97   "_case_syntax":: "['a, cases_syn] => 'b"               ("(case _ of/ _)" 10)
    98   "_case1"      :: "['a, 'b] => case_syn"                ("(2_ =>/ _)" 10)
    99   ""            :: "case_syn => cases_syn"               ("_")
   100   "_case2"      :: "[case_syn, cases_syn] => cases_syn"  ("_/ | _")
   101 
   102 translations
   103   "x ~= y"                == "~ (x = y)"
   104   "SOME x. P"             == "Eps (%x. P)"
   105   "_Let (_binds b bs) e"  == "_Let b (_Let bs e)"
   106   "let x = a in e"        == "Let a (%x. e)"
   107 
   108 syntax ("" output)
   109   "op ="        :: "['a, 'a] => bool"                    ("(_ =/ _)" [51, 51] 50)
   110   "op ~="       :: "['a, 'a] => bool"                    ("(_ ~=/ _)" [51, 51] 50)
   111 
   112 syntax (symbols)
   113   Not           :: "bool => bool"                        ("\\<not> _" [40] 40)
   114   "op &"        :: "[bool, bool] => bool"                (infixr "\\<and>" 35)
   115   "op |"        :: "[bool, bool] => bool"                (infixr "\\<or>" 30)
   116   "op -->"      :: "[bool, bool] => bool"                (infixr "\\<midarrow>\\<rightarrow>" 25)
   117   "op ~="       :: "['a, 'a] => bool"                    (infixl "\\<noteq>" 50)
   118   "ALL "        :: "[idts, bool] => bool"                ("(3\\<forall>_./ _)" [0, 10] 10)
   119   "EX "         :: "[idts, bool] => bool"                ("(3\\<exists>_./ _)" [0, 10] 10)
   120   "EX! "        :: "[idts, bool] => bool"                ("(3\\<exists>!_./ _)" [0, 10] 10)
   121   "_case1"      :: "['a, 'b] => case_syn"                ("(2_ \\<Rightarrow>/ _)" 10)
   122 (*"_case2"      :: "[case_syn, cases_syn] => cases_syn"  ("_/ \\<orelse> _")*)
   123 
   124 syntax (input)
   125   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3\\<epsilon>_./ _)" [0, 10] 10)
   126 
   127 syntax (symbols output)
   128   "op ~="       :: "['a, 'a] => bool"                    ("(_ \\<noteq>/ _)" [51, 51] 50)
   129 
   130 syntax (xsymbols)
   131   "op -->"      :: "[bool, bool] => bool"                (infixr "\\<longrightarrow>" 25)
   132 
   133 syntax (HTML output)
   134   Not           :: "bool => bool"                        ("\\<not> _" [40] 40)
   135 
   136 syntax (HOL)
   137   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3@ _./ _)" [0, 10] 10)
   138   "ALL "        :: "[idts, bool] => bool"                ("(3! _./ _)" [0, 10] 10)
   139   "EX "         :: "[idts, bool] => bool"                ("(3? _./ _)" [0, 10] 10)
   140   "EX! "        :: "[idts, bool] => bool"                ("(3?! _./ _)" [0, 10] 10)
   141 
   142 
   143 
   144 (** Rules and definitions **)
   145 
   146 local
   147 
   148 axioms
   149 
   150   eq_reflection: "(x=y) ==> (x==y)"
   151 
   152   (* Basic Rules *)
   153 
   154   refl:         "t = (t::'a)"
   155   subst:        "[| s = t; P(s) |] ==> P(t::'a)"
   156 
   157   (*Extensionality is built into the meta-logic, and this rule expresses
   158     a related property.  It is an eta-expanded version of the traditional
   159     rule, and similar to the ABS rule of HOL.*)
   160   ext:          "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)"
   161 
   162   selectI:      "P (x::'a) ==> P (@x. P x)"
   163 
   164   impI:         "(P ==> Q) ==> P-->Q"
   165   mp:           "[| P-->Q;  P |] ==> Q"
   166 
   167 defs
   168 
   169   True_def:     "True      == ((%x::bool. x) = (%x. x))"
   170   All_def:      "All(P)    == (P = (%x. True))"
   171   Ex_def:       "Ex(P)     == P(@x. P(x))"
   172   False_def:    "False     == (!P. P)"
   173   not_def:      "~ P       == P-->False"
   174   and_def:      "P & Q     == !R. (P-->Q-->R) --> R"
   175   or_def:       "P | Q     == !R. (P-->R) --> (Q-->R) --> R"
   176   Ex1_def:      "Ex1(P)    == ? x. P(x) & (! y. P(y) --> y=x)"
   177 
   178 axioms
   179   (* Axioms *)
   180 
   181   iff:          "(P-->Q) --> (Q-->P) --> (P=Q)"
   182   True_or_False:  "(P=True) | (P=False)"
   183 
   184 defs
   185   (*misc definitions*)
   186   Let_def:      "Let s f == f(s)"
   187   if_def:       "If P x y == @z::'a. (P=True --> z=x) & (P=False --> z=y)"
   188 
   189   (*arbitrary is completely unspecified, but is made to appear as a
   190     definition syntactically*)
   191   arbitrary_def:  "False ==> arbitrary == (@x. False)"
   192 
   193 
   194 
   195 (* theory and package setup *)
   196 
   197 use "HOL_lemmas.ML"
   198 
   199 use "cladata.ML"
   200 setup hypsubst_setup
   201 setup Classical.setup
   202 setup clasetup
   203 
   204 lemma all_eq: "(!!x. P x) == Trueprop (ALL x. P x)"
   205 proof (rule equal_intr_rule)
   206   assume "!!x. P x"
   207   show "ALL x. P x" ..
   208 next
   209   assume "ALL x. P x"
   210   thus "!!x. P x" ..
   211 qed
   212 
   213 lemma imp_eq: "(A ==> B) == Trueprop (A --> B)"
   214 proof (rule equal_intr_rule)
   215   assume r: "A ==> B"
   216   show "A --> B"
   217     by (rule) (rule r)
   218 next
   219   assume "A --> B" and A
   220   thus B ..
   221 qed
   222 
   223 lemmas atomize = all_eq imp_eq
   224 
   225 use "blastdata.ML"
   226 setup Blast.setup
   227 
   228 use "simpdata.ML"
   229 setup Simplifier.setup
   230 setup "Simplifier.method_setup Splitter.split_modifiers" setup simpsetup
   231 setup Splitter.setup setup Clasimp.setup
   232 
   233 use "meson_lemmas.ML"
   234 use "Tools/meson.ML"
   235 setup meson_setup
   236 
   237 end