src/FOL/IFOL.thy
author wenzelm
Sat Oct 20 20:18:45 2001 +0200 (2001-10-20)
changeset 11848 6e3017adb8c0
parent 11771 b7b100a2de1d
child 11953 f98623fdf6ef
permissions -rw-r--r--
calculational rules moved from FOL to IFOL;
clasohm@1268
     1
(*  Title:      FOL/IFOL.thy
lcp@35
     2
    ID:         $Id$
wenzelm@11677
     3
    Author:     Lawrence C Paulson and Markus Wenzel
wenzelm@11677
     4
*)
lcp@35
     5
wenzelm@11677
     6
header {* Intuitionistic first-order logic *}
lcp@35
     7
wenzelm@7355
     8
theory IFOL = Pure
wenzelm@7355
     9
files ("IFOL_lemmas.ML") ("fologic.ML") ("hypsubstdata.ML") ("intprover.ML"):
wenzelm@7355
    10
clasohm@0
    11
wenzelm@11677
    12
subsection {* Syntax and axiomatic basis *}
wenzelm@11677
    13
wenzelm@3906
    14
global
wenzelm@3906
    15
wenzelm@7355
    16
classes "term" < logic
wenzelm@7355
    17
defaultsort "term"
clasohm@0
    18
wenzelm@7355
    19
typedecl o
wenzelm@79
    20
wenzelm@11747
    21
judgment
wenzelm@11747
    22
  Trueprop      :: "o => prop"                  ("(_)" 5)
clasohm@0
    23
wenzelm@11747
    24
consts
wenzelm@7355
    25
  True          :: o
wenzelm@7355
    26
  False         :: o
wenzelm@79
    27
wenzelm@79
    28
  (* Connectives *)
wenzelm@79
    29
wenzelm@7355
    30
  "="           :: "['a, 'a] => o"              (infixl 50)
lcp@35
    31
wenzelm@7355
    32
  Not           :: "o => o"                     ("~ _" [40] 40)
wenzelm@7355
    33
  &             :: "[o, o] => o"                (infixr 35)
wenzelm@7355
    34
  "|"           :: "[o, o] => o"                (infixr 30)
wenzelm@7355
    35
  -->           :: "[o, o] => o"                (infixr 25)
wenzelm@7355
    36
  <->           :: "[o, o] => o"                (infixr 25)
wenzelm@79
    37
wenzelm@79
    38
  (* Quantifiers *)
wenzelm@79
    39
wenzelm@7355
    40
  All           :: "('a => o) => o"             (binder "ALL " 10)
wenzelm@7355
    41
  Ex            :: "('a => o) => o"             (binder "EX " 10)
wenzelm@7355
    42
  Ex1           :: "('a => o) => o"             (binder "EX! " 10)
wenzelm@79
    43
clasohm@0
    44
lcp@928
    45
syntax
wenzelm@7355
    46
  "~="          :: "['a, 'a] => o"              (infixl 50)
lcp@35
    47
translations
wenzelm@79
    48
  "x ~= y"      == "~ (x = y)"
wenzelm@79
    49
wenzelm@2257
    50
syntax (symbols)
wenzelm@11677
    51
  Not           :: "o => o"                     ("\<not> _" [40] 40)
wenzelm@11677
    52
  "op &"        :: "[o, o] => o"                (infixr "\<and>" 35)
wenzelm@11677
    53
  "op |"        :: "[o, o] => o"                (infixr "\<or>" 30)
wenzelm@11677
    54
  "op -->"      :: "[o, o] => o"                (infixr "\<midarrow>\<rightarrow>" 25)
wenzelm@11677
    55
  "op <->"      :: "[o, o] => o"                (infixr "\<leftarrow>\<rightarrow>" 25)
wenzelm@11677
    56
  "ALL "        :: "[idts, o] => o"             ("(3\<forall>_./ _)" [0, 10] 10)
wenzelm@11677
    57
  "EX "         :: "[idts, o] => o"             ("(3\<exists>_./ _)" [0, 10] 10)
wenzelm@11677
    58
  "EX! "        :: "[idts, o] => o"             ("(3\<exists>!_./ _)" [0, 10] 10)
wenzelm@11677
    59
  "op ~="       :: "['a, 'a] => o"              (infixl "\<noteq>" 50)
wenzelm@2205
    60
oheimb@6027
    61
syntax (xsymbols)
wenzelm@11677
    62
  "op -->"      :: "[o, o] => o"                (infixr "\<longrightarrow>" 25)
wenzelm@11677
    63
  "op <->"      :: "[o, o] => o"                (infixr "\<longleftrightarrow>" 25)
lcp@35
    64
wenzelm@6340
    65
syntax (HTML output)
wenzelm@11677
    66
  Not           :: "o => o"                     ("\<not> _" [40] 40)
wenzelm@6340
    67
wenzelm@6340
    68
wenzelm@3932
    69
local
wenzelm@3906
    70
wenzelm@7355
    71
axioms
clasohm@0
    72
wenzelm@79
    73
  (* Equality *)
clasohm@0
    74
wenzelm@7355
    75
  refl:         "a=a"
wenzelm@7355
    76
  subst:        "[| a=b;  P(a) |] ==> P(b)"
clasohm@0
    77
wenzelm@79
    78
  (* Propositional logic *)
clasohm@0
    79
wenzelm@7355
    80
  conjI:        "[| P;  Q |] ==> P&Q"
wenzelm@7355
    81
  conjunct1:    "P&Q ==> P"
wenzelm@7355
    82
  conjunct2:    "P&Q ==> Q"
clasohm@0
    83
wenzelm@7355
    84
  disjI1:       "P ==> P|Q"
wenzelm@7355
    85
  disjI2:       "Q ==> P|Q"
wenzelm@7355
    86
  disjE:        "[| P|Q;  P ==> R;  Q ==> R |] ==> R"
clasohm@0
    87
wenzelm@7355
    88
  impI:         "(P ==> Q) ==> P-->Q"
wenzelm@7355
    89
  mp:           "[| P-->Q;  P |] ==> Q"
clasohm@0
    90
wenzelm@7355
    91
  FalseE:       "False ==> P"
wenzelm@7355
    92
clasohm@0
    93
wenzelm@79
    94
  (* Definitions *)
clasohm@0
    95
wenzelm@7355
    96
  True_def:     "True  == False-->False"
wenzelm@7355
    97
  not_def:      "~P    == P-->False"
wenzelm@7355
    98
  iff_def:      "P<->Q == (P-->Q) & (Q-->P)"
wenzelm@79
    99
wenzelm@79
   100
  (* Unique existence *)
clasohm@0
   101
wenzelm@7355
   102
  ex1_def:      "EX! x. P(x) == EX x. P(x) & (ALL y. P(y) --> y=x)"
wenzelm@7355
   103
clasohm@0
   104
wenzelm@79
   105
  (* Quantifiers *)
clasohm@0
   106
wenzelm@7355
   107
  allI:         "(!!x. P(x)) ==> (ALL x. P(x))"
wenzelm@7355
   108
  spec:         "(ALL x. P(x)) ==> P(x)"
clasohm@0
   109
wenzelm@7355
   110
  exI:          "P(x) ==> (EX x. P(x))"
wenzelm@7355
   111
  exE:          "[| EX x. P(x);  !!x. P(x) ==> R |] ==> R"
clasohm@0
   112
clasohm@0
   113
  (* Reflection *)
clasohm@0
   114
wenzelm@7355
   115
  eq_reflection:  "(x=y)   ==> (x==y)"
wenzelm@7355
   116
  iff_reflection: "(P<->Q) ==> (P==Q)"
clasohm@0
   117
wenzelm@4092
   118
wenzelm@11677
   119
subsection {* Lemmas and proof tools *}
wenzelm@11677
   120
wenzelm@9886
   121
setup Simplifier.setup
wenzelm@9886
   122
use "IFOL_lemmas.ML"
wenzelm@11734
   123
wenzelm@11734
   124
declare impE [Pure.elim]  iffD1 [Pure.elim]  iffD2 [Pure.elim]
wenzelm@11734
   125
wenzelm@7355
   126
use "fologic.ML"
wenzelm@9886
   127
use "hypsubstdata.ML"
wenzelm@9886
   128
setup hypsubst_setup
wenzelm@7355
   129
use "intprover.ML"
wenzelm@7355
   130
wenzelm@4092
   131
wenzelm@11677
   132
subsection {* Atomizing meta-level rules *}
wenzelm@11677
   133
wenzelm@11747
   134
lemma atomize_all [atomize]: "(!!x. P(x)) == Trueprop (ALL x. P(x))"
wenzelm@11677
   135
proof (rule equal_intr_rule)
wenzelm@11677
   136
  assume "!!x. P(x)"
wenzelm@11677
   137
  show "ALL x. P(x)" by (rule allI)
wenzelm@11677
   138
next
wenzelm@11677
   139
  assume "ALL x. P(x)"
wenzelm@11677
   140
  thus "!!x. P(x)" by (rule allE)
wenzelm@11677
   141
qed
wenzelm@11677
   142
wenzelm@11747
   143
lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)"
wenzelm@11677
   144
proof (rule equal_intr_rule)
wenzelm@11677
   145
  assume r: "A ==> B"
wenzelm@11677
   146
  show "A --> B" by (rule impI) (rule r)
wenzelm@11677
   147
next
wenzelm@11677
   148
  assume "A --> B" and A
wenzelm@11677
   149
  thus B by (rule mp)
wenzelm@11677
   150
qed
wenzelm@11677
   151
wenzelm@11747
   152
lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)"
wenzelm@11677
   153
proof (rule equal_intr_rule)
wenzelm@11677
   154
  assume "x == y"
wenzelm@11677
   155
  show "x = y" by (unfold prems) (rule refl)
wenzelm@11677
   156
next
wenzelm@11677
   157
  assume "x = y"
wenzelm@11677
   158
  thus "x == y" by (rule eq_reflection)
wenzelm@11677
   159
qed
wenzelm@11677
   160
wenzelm@11771
   161
declare atomize_all [symmetric, rulify]  atomize_imp [symmetric, rulify]
wenzelm@11771
   162
wenzelm@11848
   163
wenzelm@11848
   164
subsection {* Calculational rules *}
wenzelm@11848
   165
wenzelm@11848
   166
lemma forw_subst: "a = b ==> P(b) ==> P(a)"
wenzelm@11848
   167
  by (rule ssubst)
wenzelm@11848
   168
wenzelm@11848
   169
lemma back_subst: "P(a) ==> a = b ==> P(b)"
wenzelm@11848
   170
  by (rule subst)
wenzelm@11848
   171
wenzelm@11848
   172
text {*
wenzelm@11848
   173
  Note that this list of rules is in reverse order of priorities.
wenzelm@11848
   174
*}
wenzelm@11848
   175
wenzelm@11848
   176
lemmas trans_rules [trans] =
wenzelm@11848
   177
  forw_subst
wenzelm@11848
   178
  back_subst
wenzelm@11848
   179
  rev_mp
wenzelm@11848
   180
  mp
wenzelm@11848
   181
  transitive
wenzelm@11848
   182
  trans
wenzelm@11848
   183
wenzelm@11848
   184
lemmas [Pure.elim] = sym
wenzelm@11848
   185
wenzelm@4854
   186
end