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