src/HOL/HOL.thy
changeset 46973 d68798000e46
parent 46950 d0181abdbdac
child 47657 1ba213363d0c
equal deleted inserted replaced
46972:ef6fc1a0884d 46973:d68798000e46
    55 typedecl bool
    55 typedecl bool
    56 
    56 
    57 judgment
    57 judgment
    58   Trueprop      :: "bool => prop"                   ("(_)" 5)
    58   Trueprop      :: "bool => prop"                   ("(_)" 5)
    59 
    59 
       
    60 axiomatization
       
    61   implies       :: "[bool, bool] => bool"           (infixr "-->" 25)  and
       
    62   eq            :: "['a, 'a] => bool"               (infixl "=" 50)  and
       
    63   The           :: "('a => bool) => 'a"
       
    64 
    60 consts
    65 consts
    61   True          :: bool
    66   True          :: bool
    62   False         :: bool
    67   False         :: bool
    63   Not           :: "bool => bool"                   ("~ _" [40] 40)
    68   Not           :: "bool => bool"                   ("~ _" [40] 40)
    64 
    69 
    65   conj          :: "[bool, bool] => bool"           (infixr "&" 35)
    70   conj          :: "[bool, bool] => bool"           (infixr "&" 35)
    66   disj          :: "[bool, bool] => bool"           (infixr "|" 30)
    71   disj          :: "[bool, bool] => bool"           (infixr "|" 30)
    67   implies       :: "[bool, bool] => bool"           (infixr "-->" 25)
    72 
    68 
       
    69   eq            :: "['a, 'a] => bool"               (infixl "=" 50)
       
    70 
       
    71   The           :: "('a => bool) => 'a"
       
    72   All           :: "('a => bool) => bool"           (binder "ALL " 10)
    73   All           :: "('a => bool) => bool"           (binder "ALL " 10)
    73   Ex            :: "('a => bool) => bool"           (binder "EX " 10)
    74   Ex            :: "('a => bool) => bool"           (binder "EX " 10)
    74   Ex1           :: "('a => bool) => bool"           (binder "EX! " 10)
    75   Ex1           :: "('a => bool) => bool"           (binder "EX! " 10)
    75 
    76 
    76 
    77 
   104   "A <-> B == A = B"
   105   "A <-> B == A = B"
   105 
   106 
   106 notation (xsymbols)
   107 notation (xsymbols)
   107   iff  (infixr "\<longleftrightarrow>" 25)
   108   iff  (infixr "\<longleftrightarrow>" 25)
   108 
   109 
   109 syntax
   110 syntax "_The" :: "[pttrn, bool] => 'a"  ("(3THE _./ _)" [0, 10] 10)
   110   "_The" :: "[pttrn, bool] => 'a"  ("(3THE _./ _)" [0, 10] 10)
   111 translations "THE x. P" == "CONST The (%x. P)"
   111 translations
       
   112   "THE x. P" == "CONST The (%x. P)"
       
   113 print_translation {*
   112 print_translation {*
   114   [(@{const_syntax The}, fn [Abs abs] =>
   113   [(@{const_syntax The}, fn [Abs abs] =>
   115       let val (x, t) = Syntax_Trans.atomic_abs_tr' abs
   114       let val (x, t) = Syntax_Trans.atomic_abs_tr' abs
   116       in Syntax.const @{syntax_const "_The"} $ x $ t end)]
   115       in Syntax.const @{syntax_const "_The"} $ x $ t end)]
   117 *}  -- {* To avoid eta-contraction of body *}
   116 *}  -- {* To avoid eta-contraction of body *}
   148   Ex1  (binder "?! " 10)
   147   Ex1  (binder "?! " 10)
   149 
   148 
   150 
   149 
   151 subsubsection {* Axioms and basic definitions *}
   150 subsubsection {* Axioms and basic definitions *}
   152 
   151 
   153 axioms
   152 axiomatization where
   154   refl:           "t = (t::'a)"
   153   refl: "t = (t::'a)" and
   155   subst:          "s = t \<Longrightarrow> P s \<Longrightarrow> P t"
   154   subst: "s = t \<Longrightarrow> P s \<Longrightarrow> P t" and
   156   ext:            "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)"
   155   ext: "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)"
   157     -- {*Extensionality is built into the meta-logic, and this rule expresses
   156     -- {*Extensionality is built into the meta-logic, and this rule expresses
   158          a related property.  It is an eta-expanded version of the traditional
   157          a related property.  It is an eta-expanded version of the traditional
   159          rule, and similar to the ABS rule of HOL*}
   158          rule, and similar to the ABS rule of HOL*} and
   160 
   159 
   161   the_eq_trivial: "(THE x. x = a) = (a::'a)"
   160   the_eq_trivial: "(THE x. x = a) = (a::'a)"
   162 
   161 
   163   impI:           "(P ==> Q) ==> P-->Q"
   162 axiomatization where
   164   mp:             "[| P-->Q;  P |] ==> Q"
   163   impI: "(P ==> Q) ==> P-->Q" and
   165 
   164   mp: "[| P-->Q;  P |] ==> Q" and
       
   165 
       
   166   iff: "(P-->Q) --> (Q-->P) --> (P=Q)" and
       
   167   True_or_False: "(P=True) | (P=False)"
   166 
   168 
   167 defs
   169 defs
   168   True_def:     "True      == ((%x::bool. x) = (%x. x))"
   170   True_def:     "True      == ((%x::bool. x) = (%x. x))"
   169   All_def:      "All(P)    == (P = (%x. True))"
   171   All_def:      "All(P)    == (P = (%x. True))"
   170   Ex_def:       "Ex(P)     == !Q. (!x. P x --> Q) --> Q"
   172   Ex_def:       "Ex(P)     == !Q. (!x. P x --> Q) --> Q"
   172   not_def:      "~ P       == P-->False"
   174   not_def:      "~ P       == P-->False"
   173   and_def:      "P & Q     == !R. (P-->Q-->R) --> R"
   175   and_def:      "P & Q     == !R. (P-->Q-->R) --> R"
   174   or_def:       "P | Q     == !R. (P-->R) --> (Q-->R) --> R"
   176   or_def:       "P | Q     == !R. (P-->R) --> (Q-->R) --> R"
   175   Ex1_def:      "Ex1(P)    == ? x. P(x) & (! y. P(y) --> y=x)"
   177   Ex1_def:      "Ex1(P)    == ? x. P(x) & (! y. P(y) --> y=x)"
   176 
   178 
   177 axioms
   179 definition If :: "bool \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a" ("(if (_)/ then (_)/ else (_))" [0, 0, 10] 10)
   178   iff:          "(P-->Q) --> (Q-->P) --> (P=Q)"
   180   where "If P x y \<equiv> (THE z::'a. (P=True --> z=x) & (P=False --> z=y))"
   179   True_or_False:  "(P=True) | (P=False)"
   181 
   180 
   182 definition Let :: "'a \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b"
   181 finalconsts
   183   where "Let s f \<equiv> f s"
   182   eq
       
   183   implies
       
   184   The
       
   185 
       
   186 definition If :: "bool \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a" ("(if (_)/ then (_)/ else (_))" [0, 0, 10] 10) where
       
   187   "If P x y \<equiv> (THE z::'a. (P=True --> z=x) & (P=False --> z=y))"
       
   188 
       
   189 definition Let :: "'a \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b" where
       
   190   "Let s f \<equiv> f s"
       
   191 
   184 
   192 translations
   185 translations
   193   "_Let (_binds b bs) e"  == "_Let b (_Let bs e)"
   186   "_Let (_binds b bs) e"  == "_Let b (_Let bs e)"
   194   "let x = a in e"        == "CONST Let a (%x. e)"
   187   "let x = a in e"        == "CONST Let a (%x. e)"
   195 
   188 
   196 axiomatization
   189 axiomatization undefined :: 'a
   197   undefined :: 'a
   190 
   198 
   191 class default = fixes default :: 'a
   199 class default =
       
   200   fixes default :: 'a
       
   201 
   192 
   202 
   193 
   203 subsection {* Fundamental rules *}
   194 subsection {* Fundamental rules *}
   204 
   195 
   205 subsubsection {* Equality *}
   196 subsubsection {* Equality *}