src/HOL/HOL.thy
author wenzelm
Sun Jul 16 20:48:35 2000 +0200 (2000-07-16)
changeset 9352 416b2ecd97a1
parent 9060 b0dd884b1848
child 9488 f11bece4e2db
permissions -rw-r--r--
syntax (symbols) "op o" moved from HOL to Fun;
     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 axclass plus_ac0 < plus, zero
    72     commute: "x + y = y + x"
    73     assoc:   "(x + y) + z = x + (y + z)"
    74     zero:    "0 + x = x"
    75 
    76 
    77 (** Additional concrete syntax **)
    78 
    79 nonterminals
    80   letbinds  letbind
    81   case_syn  cases_syn
    82 
    83 syntax
    84   ~=            :: "['a, 'a] => bool"                    (infixl 50)
    85   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3SOME _./ _)" [0, 10] 10)
    86 
    87   (* Let expressions *)
    88 
    89   "_bind"       :: "[pttrn, 'a] => letbind"              ("(2_ =/ _)" 10)
    90   ""            :: "letbind => letbinds"                 ("_")
    91   "_binds"      :: "[letbind, letbinds] => letbinds"     ("_;/ _")
    92   "_Let"        :: "[letbinds, 'a] => 'a"                ("(let (_)/ in (_))" 10)
    93 
    94   (* Case expressions *)
    95 
    96   "_case_syntax":: "['a, cases_syn] => 'b"               ("(case _ of/ _)" 10)
    97   "_case1"      :: "['a, 'b] => case_syn"                ("(2_ =>/ _)" 10)
    98   ""            :: "case_syn => cases_syn"               ("_")
    99   "_case2"      :: "[case_syn, cases_syn] => cases_syn"  ("_/ | _")
   100 
   101 translations
   102   "x ~= y"                == "~ (x = y)"
   103   "SOME x. P"             == "Eps (%x. P)"
   104   "_Let (_binds b bs) e"  == "_Let b (_Let bs e)"
   105   "let x = a in e"        == "Let a (%x. e)"
   106 
   107 syntax ("" output)
   108   "op ="        :: "['a, 'a] => bool"                    ("(_ =/ _)" [51, 51] 50)
   109   "op ~="       :: "['a, 'a] => bool"                    ("(_ ~=/ _)" [51, 51] 50)
   110 
   111 syntax (symbols)
   112   Not           :: "bool => bool"                        ("\\<not> _" [40] 40)
   113   "op &"        :: "[bool, bool] => bool"                (infixr "\\<and>" 35)
   114   "op |"        :: "[bool, bool] => bool"                (infixr "\\<or>" 30)
   115   "op -->"      :: "[bool, bool] => bool"                (infixr "\\<midarrow>\\<rightarrow>" 25)
   116   "op ~="       :: "['a, 'a] => bool"                    (infixl "\\<noteq>" 50)
   117   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3\\<epsilon>_./ _)" [0, 10] 10)
   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 (symbols output)
   125   "op ~="       :: "['a, 'a] => bool"                    ("(_ \\<noteq>/ _)" [51, 51] 50)
   126 
   127 syntax (xsymbols)
   128   "op -->"      :: "[bool, bool] => bool"                (infixr "\\<longrightarrow>" 25)
   129 
   130 syntax (HTML output)
   131   Not           :: "bool => bool"                        ("\\<not> _" [40] 40)
   132 
   133 syntax (HOL)
   134   "_Eps"        :: "[pttrn, bool] => 'a"                 ("(3@ _./ _)" [0, 10] 10)
   135   "ALL "        :: "[idts, bool] => bool"                ("(3! _./ _)" [0, 10] 10)
   136   "EX "         :: "[idts, bool] => bool"                ("(3? _./ _)" [0, 10] 10)
   137   "EX! "        :: "[idts, bool] => bool"                ("(3?! _./ _)" [0, 10] 10)
   138 
   139 
   140 
   141 (** Rules and definitions **)
   142 
   143 local
   144 
   145 axioms
   146 
   147   eq_reflection: "(x=y) ==> (x==y)"
   148 
   149   (* Basic Rules *)
   150 
   151   refl:         "t = (t::'a)"
   152   subst:        "[| s = t; P(s) |] ==> P(t::'a)"
   153 
   154   (*Extensionality is built into the meta-logic, and this rule expresses
   155     a related property.  It is an eta-expanded version of the traditional
   156     rule, and similar to the ABS rule of HOL.*)
   157   ext:          "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)"
   158 
   159   selectI:      "P (x::'a) ==> P (@x. P x)"
   160 
   161   impI:         "(P ==> Q) ==> P-->Q"
   162   mp:           "[| P-->Q;  P |] ==> Q"
   163 
   164 defs
   165 
   166   True_def:     "True      == ((%x::bool. x) = (%x. x))"
   167   All_def:      "All(P)    == (P = (%x. True))"
   168   Ex_def:       "Ex(P)     == P(@x. P(x))"
   169   False_def:    "False     == (!P. P)"
   170   not_def:      "~ P       == P-->False"
   171   and_def:      "P & Q     == !R. (P-->Q-->R) --> R"
   172   or_def:       "P | Q     == !R. (P-->R) --> (Q-->R) --> R"
   173   Ex1_def:      "Ex1(P)    == ? x. P(x) & (! y. P(y) --> y=x)"
   174 
   175 axioms
   176   (* Axioms *)
   177 
   178   iff:          "(P-->Q) --> (Q-->P) --> (P=Q)"
   179   True_or_False:  "(P=True) | (P=False)"
   180 
   181 defs
   182   (*misc definitions*)
   183   Let_def:      "Let s f == f(s)"
   184   if_def:       "If P x y == @z::'a. (P=True --> z=x) & (P=False --> z=y)"
   185 
   186   (*arbitrary is completely unspecified, but is made to appear as a
   187     definition syntactically*)
   188   arbitrary_def:  "False ==> arbitrary == (@x. False)"
   189 
   190 
   191 
   192 (* theory and package setup *)
   193 
   194 use "HOL_lemmas.ML"	setup attrib_setup
   195 use "cladata.ML"	setup Classical.setup setup clasetup
   196 use "blastdata.ML"	setup Blast.setup
   197 use "simpdata.ML"	setup Simplifier.setup
   198 			setup "Simplifier.method_setup Splitter.split_modifiers"
   199 			setup simpsetup setup cong_attrib_setup
   200                         setup Splitter.setup setup Clasimp.setup setup iff_attrib_setup
   201 
   202 
   203 end