src/HOL/HOL.thy
author regensbu
Fri, 06 Oct 1995 16:17:08 +0100
changeset 1273 6960ec882bca
parent 1232 454eb424c223
child 1370 7361ac9b024d
permissions -rw-r--r--
added 8bit pragmas
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     1
(*  Title:      HOL/HOL.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     3
    Author:     Tobias Nipkow
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
Higher-Order Logic
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     9
HOL = CPure +
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
classes
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
  term < logic
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
axclass
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
  plus < term
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
axclass
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
  minus < term
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
axclass
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
  times < term
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
default
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
  term
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
types
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
  bool
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
arities
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
  fun :: (term, term) term
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
  bool :: term
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
consts
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
  (* Constants *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    37
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
  Trueprop      :: "bool => prop"                     ("(_)" 5)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
  not           :: "bool => bool"                     ("~ _" [40] 40)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
  True, False   :: "bool"
965
24eef3860714 changed syntax of "if"
clasohm
parents: 923
diff changeset
    41
  If            :: "[bool, 'a, 'a] => 'a"   ("(if (_)/ then (_)/ else (_))" 10)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
  Inv           :: "('a => 'b) => ('b => 'a)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    44
  (* Binders *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    45
1068
e0f2dffab506 HOL.thy:
nipkow
parents: 973
diff changeset
    46
  Eps           :: "('a => bool) => 'a"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
  All           :: "('a => bool) => bool"             (binder "! " 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
  Ex            :: "('a => bool) => bool"             (binder "? " 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
  Ex1           :: "('a => bool) => bool"             (binder "?! " 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
  Let           :: "['a, 'a => 'b] => 'b"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
  (* Infixes *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
1232
454eb424c223 changed "o" to (infixl 55)
nipkow
parents: 1114
diff changeset
    54
  o             :: "['b => 'c, 'a => 'b, 'a] => 'c"   (infixl 55)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
  "="           :: "['a, 'a] => bool"                 (infixl 50)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
  "&"           :: "[bool, bool] => bool"             (infixr 35)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    57
  "|"           :: "[bool, bool] => bool"             (infixr 30)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
  "-->"         :: "[bool, bool] => bool"             (infixr 25)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
  (* Overloaded Constants *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
  "+"           :: "['a::plus, 'a] => 'a"             (infixl 65)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
  "-"           :: "['a::minus, 'a] => 'a"            (infixl 65)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
  "*"           :: "['a::times, 'a] => 'a"            (infixl 70)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
types
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    68
  letbinds  letbind
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
  case_syn  cases_syn
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
syntax
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
  "~="          :: "['a, 'a] => bool"                 (infixl 50)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    74
1068
e0f2dffab506 HOL.thy:
nipkow
parents: 973
diff changeset
    75
  "@Eps"        :: "[pttrn,bool] => 'a"               ("(3@ _./ _)" 10)
e0f2dffab506 HOL.thy:
nipkow
parents: 973
diff changeset
    76
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
  (* Alternative Quantifiers *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
  "*All"        :: "[idts, bool] => bool"             ("(3ALL _./ _)" 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    80
  "*Ex"         :: "[idts, bool] => bool"             ("(3EX _./ _)" 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
  "*Ex1"        :: "[idts, bool] => bool"             ("(3EX! _./ _)" 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    82
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    83
  (* Let expressions *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
1068
e0f2dffab506 HOL.thy:
nipkow
parents: 973
diff changeset
    85
  "_bind"       :: "[pttrn, 'a] => letbind"           ("(2_ =/ _)" 10)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
  ""            :: "letbind => letbinds"              ("_")
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    87
  "_binds"      :: "[letbind, letbinds] => letbinds"  ("_;/ _")
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
  "_Let"        :: "[letbinds, 'a] => 'a"             ("(let (_)/ in (_))" 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    90
  (* Case expressions *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    91
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
  "@case"       :: "['a, cases_syn] => 'b"            ("(case _ of/ _)" 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
  "@case1"      :: "['a, 'b] => case_syn"             ("(2_ =>/ _)" 10)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    94
  ""            :: "case_syn => cases_syn"            ("_")
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    95
  "@case2"      :: "[case_syn, cases_syn] => cases_syn"   ("_/ | _")
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
translations
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
  "x ~= y"      == "~ (x = y)"
1068
e0f2dffab506 HOL.thy:
nipkow
parents: 973
diff changeset
    99
  "@ x.b"       == "Eps(%x.b)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   100
  "ALL xs. P"   => "! xs. P"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   101
  "EX xs. P"    => "? xs. P"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   102
  "EX! xs. P"   => "?! xs. P"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   103
  "_Let (_binds b bs) e"  == "_Let b (_Let bs e)"
1114
c8dfb56a7e95 Prod is now a parent of Lfp.
nipkow
parents: 1068
diff changeset
   104
  "let x = a in e"        == "Let a (%x. e)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   105
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   106
rules
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   107
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   108
  eq_reflection "(x=y) ==> (x==y)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   109
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   110
  (* Basic Rules *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   111
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   112
  refl          "t = (t::'a)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   113
  subst         "[| s = t; P(s) |] ==> P(t::'a)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   114
  ext           "(!!x::'a. (f(x)::'b) = g(x)) ==> (%x.f(x)) = (%x.g(x))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   115
  selectI       "P(x::'a) ==> P(@x.P(x))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   116
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   117
  impI          "(P ==> Q) ==> P-->Q"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   118
  mp            "[| P-->Q;  P |] ==> Q"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   119
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   120
defs
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   121
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   122
  True_def      "True      == ((%x::bool.x)=(%x.x))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   123
  All_def       "All(P)    == (P = (%x.True))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   124
  Ex_def        "Ex(P)     == P(@x.P(x))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   125
  False_def     "False     == (!P.P)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   126
  not_def       "~ P       == P-->False"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   127
  and_def       "P & Q     == !R. (P-->Q-->R) --> R"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   128
  or_def        "P | Q     == !R. (P-->R) --> (Q-->R) --> R"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   129
  Ex1_def       "Ex1(P)    == ? x. P(x) & (! y. P(y) --> y=x)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   130
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   131
rules
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   132
  (* Axioms *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   134
  iff           "(P-->Q) --> (Q-->P) --> (P=Q)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   135
  True_or_False "(P=True) | (P=False)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   136
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   137
defs
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   138
  (* Misc Definitions *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   139
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   140
  Let_def       "Let s f == f(s)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   141
  Inv_def       "Inv(f::'a=>'b)  == (% y. @x. f(x)=y)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   142
  o_def         "(f::'b=>'c) o g == (%(x::'a). f(g(x)))"
973
f57fb576520f Modified If_def to avoid ambiguity.
nipkow
parents: 965
diff changeset
   143
  if_def        "If P x y == @z::'a. (P=True --> z=x) & (P=False --> z=y)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   144
1273
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   145
(* start 8bit 1 *)
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   146
(* end 8bit 1 *)
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   147
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   148
end
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   149
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   150
ML
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   151
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   152
(** Choice between the HOL and Isabelle style of quantifiers **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   153
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   154
val HOL_quantifiers = ref true;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   155
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   156
fun alt_ast_tr' (name, alt_name) =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   157
  let
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   158
    fun ast_tr' (*name*) args =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   159
      if ! HOL_quantifiers then raise Match
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   160
      else Syntax.mk_appl (Syntax.Constant alt_name) args;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   161
  in
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   162
    (name, ast_tr')
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   163
  end;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   164
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   165
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   166
val print_ast_translation =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   167
  map alt_ast_tr' [("! ", "*All"), ("? ", "*Ex"), ("?! ", "*Ex1")];
1273
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   168
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   169
(* start 8bit 2 *)
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   170
(* end 8bit 2 *)
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   171
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   172
6960ec882bca added 8bit pragmas
regensbu
parents: 1232
diff changeset
   173