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