src/HOL/HOL.thy
author paulson
Tue May 23 18:22:19 2000 +0200 (2000-05-23)
changeset 8940 55bc03d9f168
parent 8800 e3688ef49f12
child 8959 9d793220a46a
permissions -rw-r--r--
new type class "zero" so that 0 can be overloaded
     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 
    12 
    13 (** Core syntax **)
    14 
    15 global
    16 
    17 classes "term" < logic
    18 defaultsort "term"
    19 
    20 typedecl bool
    21 
    22 arities
    23   bool :: "term"
    24   fun :: ("term", "term") "term"
    25 
    26 
    27 consts
    28 
    29   (* Constants *)
    30 
    31   Trueprop      :: "bool => prop"                   ("(_)" 5)
    32   Not           :: "bool => bool"                   ("~ _" [40] 40)
    33   True          :: bool
    34   False         :: bool
    35   If            :: "[bool, 'a, 'a] => 'a"           ("(if (_)/ then (_)/ else (_))" 10)
    36   arbitrary     :: 'a
    37 
    38   (* Binders *)
    39 
    40   Eps           :: "('a => bool) => 'a"
    41   All           :: "('a => bool) => bool"           (binder "ALL " 10)
    42   Ex            :: "('a => bool) => bool"           (binder "EX " 10)
    43   Ex1           :: "('a => bool) => bool"           (binder "EX! " 10)
    44   Let           :: "['a, 'a => 'b] => 'b"
    45 
    46   (* Infixes *)
    47 
    48   "="           :: "['a, 'a] => bool"               (infixl 50)
    49   &             :: "[bool, bool] => bool"           (infixr 35)
    50   "|"           :: "[bool, bool] => bool"           (infixr 30)
    51   -->           :: "[bool, bool] => bool"           (infixr 25)
    52 
    53 
    54 (* Overloaded Constants *)
    55 
    56 axclass zero  < "term" 
    57 axclass plus  < "term"
    58 axclass minus < "term"
    59 axclass times < "term"
    60 axclass power < "term"
    61 
    62 consts
    63   "0"           :: "('a::zero)"                     ("0")
    64   "+"           :: "['a::plus, 'a]  => 'a"          (infixl 65)
    65   -             :: "['a::minus, 'a] => 'a"          (infixl 65)
    66   uminus        :: "['a::minus] => 'a"              ("- _" [81] 80)
    67   abs		:: "('a::minus) => 'a"
    68   *             :: "['a::times, 'a] => 'a"          (infixl 70)
    69   (*See Nat.thy for "^"*)
    70 
    71 
    72 
    73 (** Additional concrete syntax **)
    74 
    75 nonterminals
    76   letbinds  letbind
    77   case_syn  cases_syn
    78 
    79 syntax
    80   ~=            :: "['a, 'a] => bool"                    (infixl 50)
    81   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3SOME _./ _)" [0, 10] 10)
    82 
    83   (* Let expressions *)
    84 
    85   "_bind"       :: "[pttrn, 'a] => letbind"              ("(2_ =/ _)" 10)
    86   ""            :: "letbind => letbinds"                 ("_")
    87   "_binds"      :: "[letbind, letbinds] => letbinds"     ("_;/ _")
    88   "_Let"        :: "[letbinds, 'a] => 'a"                ("(let (_)/ in (_))" 10)
    89 
    90   (* Case expressions *)
    91 
    92   "@case"       :: "['a, cases_syn] => 'b"               ("(case _ of/ _)" 10)
    93   "@case1"      :: "['a, 'b] => case_syn"                ("(2_ =>/ _)" 10)
    94   ""            :: "case_syn => cases_syn"               ("_")
    95   "@case2"      :: "[case_syn, cases_syn] => cases_syn"  ("_/ | _")
    96 
    97 translations
    98   "x ~= y"                == "~ (x = y)"
    99   "SOME x. P"             == "Eps (%x. P)"
   100   "_Let (_binds b bs) e"  == "_Let b (_Let bs e)"
   101   "let x = a in e"        == "Let a (%x. e)"
   102 
   103 syntax ("" output)
   104   "op ="        :: "['a, 'a] => bool"                    ("(_ =/ _)" [51, 51] 50)
   105   "op ~="       :: "['a, 'a] => bool"                    ("(_ ~=/ _)" [51, 51] 50)
   106 
   107 syntax (symbols)
   108   Not           :: "bool => bool"                        ("\\<not> _" [40] 40)
   109   "op &"        :: "[bool, bool] => bool"                (infixr "\\<and>" 35)
   110   "op |"        :: "[bool, bool] => bool"                (infixr "\\<or>" 30)
   111   "op -->"      :: "[bool, bool] => bool"                (infixr "\\<midarrow>\\<rightarrow>" 25)
   112   "op o"        :: "['b => 'c, 'a => 'b, 'a] => 'c"      (infixl "\\<circ>" 55)
   113   "op ~="       :: "['a, 'a] => bool"                    (infixl "\\<noteq>" 50)
   114   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3\\<epsilon>_./ _)" [0, 10] 10)
   115   "ALL "        :: "[idts, bool] => bool"                ("(3\\<forall>_./ _)" [0, 10] 10)
   116   "EX "         :: "[idts, bool] => bool"                ("(3\\<exists>_./ _)" [0, 10] 10)
   117   "EX! "        :: "[idts, bool] => bool"                ("(3\\<exists>!_./ _)" [0, 10] 10)
   118   "@case1"      :: "['a, 'b] => case_syn"                ("(2_ \\<Rightarrow>/ _)" 10)
   119 (*"@case2"      :: "[case_syn, cases_syn] => cases_syn"  ("_/ \\<orelse> _")*)
   120 
   121 syntax (symbols output)
   122   "op ~="       :: "['a, 'a] => bool"                    ("(_ \\<noteq>/ _)" [51, 51] 50)
   123 
   124 syntax (xsymbols)
   125   "op -->"      :: "[bool, bool] => bool"                (infixr "\\<longrightarrow>" 25)
   126 
   127 syntax (HTML output)
   128   Not           :: "bool => bool"                        ("\\<not> _" [40] 40)
   129 
   130 syntax (HOL)
   131   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3@ _./ _)" [0, 10] 10)
   132   "ALL "        :: "[idts, bool] => bool"                ("(3! _./ _)" [0, 10] 10)
   133   "EX "         :: "[idts, bool] => bool"                ("(3? _./ _)" [0, 10] 10)
   134   "EX! "        :: "[idts, bool] => bool"                ("(3?! _./ _)" [0, 10] 10)
   135 
   136 
   137 
   138 (** Rules and definitions **)
   139 
   140 local
   141 
   142 axioms
   143 
   144   eq_reflection: "(x=y) ==> (x==y)"
   145 
   146   (* Basic Rules *)
   147 
   148   refl:         "t = (t::'a)"
   149   subst:        "[| s = t; P(s) |] ==> P(t::'a)"
   150 
   151   (*Extensionality is built into the meta-logic, and this rule expresses
   152     a related property.  It is an eta-expanded version of the traditional
   153     rule, and similar to the ABS rule of HOL.*)
   154   ext:          "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)"
   155 
   156   selectI:      "P (x::'a) ==> P (@x. P x)"
   157 
   158   impI:         "(P ==> Q) ==> P-->Q"
   159   mp:           "[| P-->Q;  P |] ==> Q"
   160 
   161 defs
   162 
   163   True_def:     "True      == ((%x::bool. x) = (%x. x))"
   164   All_def:      "All(P)    == (P = (%x. True))"
   165   Ex_def:       "Ex(P)     == P(@x. P(x))"
   166   False_def:    "False     == (!P. P)"
   167   not_def:      "~ P       == P-->False"
   168   and_def:      "P & Q     == !R. (P-->Q-->R) --> R"
   169   or_def:       "P | Q     == !R. (P-->R) --> (Q-->R) --> R"
   170   Ex1_def:      "Ex1(P)    == ? x. P(x) & (! y. P(y) --> y=x)"
   171 
   172 axioms
   173   (* Axioms *)
   174 
   175   iff:          "(P-->Q) --> (Q-->P) --> (P=Q)"
   176   True_or_False:  "(P=True) | (P=False)"
   177 
   178 defs
   179   (*misc definitions*)
   180   Let_def:      "Let s f == f(s)"
   181   if_def:       "If P x y == @z::'a. (P=True --> z=x) & (P=False --> z=y)"
   182 
   183   (*arbitrary is completely unspecified, but is made to appear as a
   184     definition syntactically*)
   185   arbitrary_def:  "False ==> arbitrary == (@x. False)"
   186 
   187 
   188 
   189 (* theory and package setup *)
   190 
   191 use "HOL_lemmas.ML"	setup attrib_setup
   192 use "cladata.ML"	setup Classical.setup setup clasetup
   193 use "blastdata.ML"	setup Blast.setup
   194 use "simpdata.ML"	setup Simplifier.setup
   195 			setup "Simplifier.method_setup Splitter.split_modifiers"
   196 			setup simpsetup setup cong_attrib_setup
   197                         setup Splitter.setup setup Clasimp.setup setup iff_attrib_setup
   198 
   199 
   200 end