src/FOL/IFOL.thy
author wenzelm
Sun, 26 Nov 2006 18:07:16 +0100
changeset 21524 7843e2fd14a9
parent 21404 eb85850d3eb7
child 21539 c5cf9243ad62
permissions -rw-r--r--
updated (binder) syntax/notation;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1268
f6ef556b3ede corrected title
clasohm
parents: 928
diff changeset
     1
(*  Title:      FOL/IFOL.thy
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
     2
    ID:         $Id$
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
     3
    Author:     Lawrence C Paulson and Markus Wenzel
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
     4
*)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
     5
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
     6
header {* Intuitionistic first-order logic *}
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
     7
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15377
diff changeset
     8
theory IFOL
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15377
diff changeset
     9
imports Pure
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 16121
diff changeset
    10
uses ("IFOL_lemmas.ML") ("fologic.ML") ("hypsubstdata.ML") ("intprover.ML")
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15377
diff changeset
    11
begin
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    12
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    14
subsection {* Syntax and axiomatic basis *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    15
3906
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    16
global
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    17
14854
61bdf2ae4dc5 removed obsolete sort 'logic';
wenzelm
parents: 14565
diff changeset
    18
classes "term"
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    19
defaultsort "term"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    21
typedecl o
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    22
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    23
judgment
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    24
  Trueprop      :: "o => prop"                  ("(_)" 5)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    26
consts
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    27
  True          :: o
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    28
  False         :: o
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    29
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    30
  (* Connectives *)
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    31
17276
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    32
  "op ="        :: "['a, 'a] => o"              (infixl "=" 50)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
    33
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    34
  Not           :: "o => o"                     ("~ _" [40] 40)
17276
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    35
  "op &"        :: "[o, o] => o"                (infixr "&" 35)
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    36
  "op |"        :: "[o, o] => o"                (infixr "|" 30)
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    37
  "op -->"      :: "[o, o] => o"                (infixr "-->" 25)
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    38
  "op <->"      :: "[o, o] => o"                (infixr "<->" 25)
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    39
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    40
  (* Quantifiers *)
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    41
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    42
  All           :: "('a => o) => o"             (binder "ALL " 10)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    43
  Ex            :: "('a => o) => o"             (binder "EX " 10)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    44
  Ex1           :: "('a => o) => o"             (binder "EX! " 10)
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    45
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19120
diff changeset
    47
abbreviation
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21210
diff changeset
    48
  not_equal :: "['a, 'a] => o"  (infixl "~=" 50) where
19120
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
    49
  "x ~= y == ~ (x = y)"
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    50
21210
c17fd2df4e9e renamed 'const_syntax' to 'notation';
wenzelm
parents: 19756
diff changeset
    51
notation (xsymbols)
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19380
diff changeset
    52
  not_equal  (infixl "\<noteq>" 50)
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19120
diff changeset
    53
21210
c17fd2df4e9e renamed 'const_syntax' to 'notation';
wenzelm
parents: 19756
diff changeset
    54
notation (HTML output)
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19380
diff changeset
    55
  not_equal  (infixl "\<noteq>" 50)
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19120
diff changeset
    56
21524
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    57
notation (xsymbols)
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    58
  Not  ("\<not> _" [40] 40) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    59
  "op &"  (infixr "\<and>" 35) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    60
  "op |"  (infixr "\<or>" 30) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    61
  All  (binder "\<forall>" 10) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    62
  Ex  (binder "\<exists>" 10) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    63
  Ex1  (binder "\<exists>!" 10) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    64
  "op -->"  (infixr "\<longrightarrow>" 25) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    65
  "op <->"  (infixr "\<longleftrightarrow>" 25)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
    66
21524
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    67
notation (HTML output)
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    68
  Not  ("\<not> _" [40] 40) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    69
  "op &"  (infixr "\<and>" 35) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    70
  "op |"  (infixr "\<or>" 30) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    71
  All  (binder "\<forall>" 10) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    72
  Ex  (binder "\<exists>" 10) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    73
  Ex1  (binder "\<exists>!" 10)
6340
7d5cbd5819a0 HTML output;
wenzelm
parents: 6027
diff changeset
    74
3932
wenzelm
parents: 3906
diff changeset
    75
local
3906
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    76
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    77
finalconsts
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    78
  False All Ex
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    79
  "op ="
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    80
  "op &"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    81
  "op |"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    82
  "op -->"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    83
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    84
axioms
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    85
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    86
  (* Equality *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    88
  refl:         "a=a"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    90
  (* Propositional logic *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    91
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    92
  conjI:        "[| P;  Q |] ==> P&Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    93
  conjunct1:    "P&Q ==> P"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    94
  conjunct2:    "P&Q ==> Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    95
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    96
  disjI1:       "P ==> P|Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    97
  disjI2:       "Q ==> P|Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    98
  disjE:        "[| P|Q;  P ==> R;  Q ==> R |] ==> R"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    99
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   100
  impI:         "(P ==> Q) ==> P-->Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   101
  mp:           "[| P-->Q;  P |] ==> Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   103
  FalseE:       "False ==> P"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   104
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
   105
  (* Quantifiers *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   107
  allI:         "(!!x. P(x)) ==> (ALL x. P(x))"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   108
  spec:         "(ALL x. P(x)) ==> P(x)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   109
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   110
  exI:          "P(x) ==> (EX x. P(x))"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   111
  exE:          "[| EX x. P(x);  !!x. P(x) ==> R |] ==> R"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   113
  (* Reflection *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   114
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   115
  eq_reflection:  "(x=y)   ==> (x==y)"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   116
  iff_reflection: "(P<->Q) ==> (P==Q)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   117
4092
9faf228771dc added simpset thy_data;
wenzelm
parents: 3932
diff changeset
   118
19756
61c4117345c6 lemmas strip;
wenzelm
parents: 19683
diff changeset
   119
lemmas strip = impI allI
61c4117345c6 lemmas strip;
wenzelm
parents: 19683
diff changeset
   120
61c4117345c6 lemmas strip;
wenzelm
parents: 19683
diff changeset
   121
15377
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   122
text{*Thanks to Stephan Merz*}
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   123
theorem subst:
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   124
  assumes eq: "a = b" and p: "P(a)"
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   125
  shows "P(b)"
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   126
proof -
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   127
  from eq have meta: "a \<equiv> b"
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   128
    by (rule eq_reflection)
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   129
  from p show ?thesis
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   130
    by (unfold meta)
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   131
qed
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   132
3d99eea28a9b proof of subst by S Merz
paulson
parents: 14854
diff changeset
   133
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   134
defs
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   135
  (* Definitions *)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   136
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   137
  True_def:     "True  == False-->False"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   138
  not_def:      "~P    == P-->False"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   139
  iff_def:      "P<->Q == (P-->Q) & (Q-->P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   140
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   141
  (* Unique existence *)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   142
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   143
  ex1_def:      "Ex1(P) == EX x. P(x) & (ALL y. P(y) --> y=x)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   144
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   145
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   146
subsection {* Lemmas and proof tools *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   147
9886
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   148
use "IFOL_lemmas.ML"
11734
7a21bf539412 declare impE iffD1 iffD2 ad elim of Pure;
wenzelm
parents: 11677
diff changeset
   149
18481
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   150
ML {*
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   151
structure ProjectRule = ProjectRuleFun
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   152
(struct
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   153
  val conjunct1 = thm "conjunct1";
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   154
  val conjunct2 = thm "conjunct2";
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   155
  val mp = thm "mp";
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   156
end)
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   157
*}
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   158
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   159
use "fologic.ML"
9886
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   160
use "hypsubstdata.ML"
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   161
setup hypsubst_setup
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   162
use "intprover.ML"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   163
4092
9faf228771dc added simpset thy_data;
wenzelm
parents: 3932
diff changeset
   164
12875
wenzelm
parents: 12662
diff changeset
   165
subsection {* Intuitionistic Reasoning *}
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   166
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   167
lemma impE':
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   168
  assumes 1: "P --> Q"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   169
    and 2: "Q ==> R"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   170
    and 3: "P --> Q ==> P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   171
  shows R
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   172
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   173
  from 3 and 1 have P .
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   174
  with 1 have Q by (rule impE)
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   175
  with 2 show R .
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   176
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   177
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   178
lemma allE':
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   179
  assumes 1: "ALL x. P(x)"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   180
    and 2: "P(x) ==> ALL x. P(x) ==> Q"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   181
  shows Q
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   182
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   183
  from 1 have "P(x)" by (rule spec)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   184
  from this and 1 show Q by (rule 2)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   185
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   186
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   187
lemma notE':
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   188
  assumes 1: "~ P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   189
    and 2: "~ P ==> P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   190
  shows R
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   191
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   192
  from 2 and 1 have P .
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   193
  with 1 show R by (rule notE)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   194
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   195
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   196
lemmas [Pure.elim!] = disjE iffE FalseE conjE exE
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   197
  and [Pure.intro!] = iffI conjI impI TrueI notI allI refl
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   198
  and [Pure.elim 2] = allE notE' impE'
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   199
  and [Pure.intro] = exI disjI2 disjI1
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   200
18708
4b3dadb4fe33 setup: theory -> theory;
wenzelm
parents: 18523
diff changeset
   201
setup {* ContextRules.addSWrapper (fn tac => hyp_subst_tac ORELSE' tac) *}
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   202
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   203
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   204
lemma iff_not_sym: "~ (Q <-> P) ==> ~ (P <-> Q)"
17591
33d409318266 renamed rules to iprover
nipkow
parents: 17276
diff changeset
   205
  by iprover
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   206
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   207
lemmas [sym] = sym iff_sym not_sym iff_not_sym
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   208
  and [Pure.elim?] = iffD1 iffD2 impE
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   209
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   210
13435
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   211
lemma eq_commute: "a=b <-> b=a"
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   212
apply (rule iffI) 
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   213
apply (erule sym)+
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   214
done
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   215
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   216
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   217
subsection {* Atomizing meta-level rules *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   218
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   219
lemma atomize_all [atomize]: "(!!x. P(x)) == Trueprop (ALL x. P(x))"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   220
proof
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   221
  assume "!!x. P(x)"
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   222
  show "ALL x. P(x)" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   223
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   224
  assume "ALL x. P(x)"
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   225
  thus "!!x. P(x)" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   226
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   227
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   228
lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   229
proof
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   230
  assume "A ==> B"
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   231
  thus "A --> B" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   232
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   233
  assume "A --> B" and A
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   234
  thus B by (rule mp)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   235
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   236
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   237
lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   238
proof
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   239
  assume "x == y"
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   240
  show "x = y" by (unfold prems) (rule refl)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   241
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   242
  assume "x = y"
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   243
  thus "x == y" by (rule eq_reflection)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   244
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   245
18813
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   246
lemma atomize_iff [atomize]: "(A == B) == Trueprop (A <-> B)"
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   247
proof
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   248
  assume "A == B"
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   249
  show "A <-> B" by (unfold prems) (rule iff_refl)
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   250
next
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   251
  assume "A <-> B"
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   252
  thus "A == B" by (rule iff_reflection)
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   253
qed
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   254
12875
wenzelm
parents: 12662
diff changeset
   255
lemma atomize_conj [atomize]:
19120
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   256
  includes meta_conjunction_syntax
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   257
  shows "(A && B) == Trueprop (A & B)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   258
proof
19120
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   259
  assume conj: "A && B"
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   260
  show "A & B"
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   261
  proof (rule conjI)
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   262
    from conj show A by (rule conjunctionD1)
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   263
    from conj show B by (rule conjunctionD2)
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   264
  qed
11953
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   265
next
19120
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   266
  assume conj: "A & B"
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   267
  show "A && B"
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   268
  proof -
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   269
    from conj show A ..
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   270
    from conj show B ..
11953
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   271
  qed
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   272
qed
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   273
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   274
lemmas [symmetric, rulify] = atomize_all atomize_imp
18861
38269ef5175a declare defn rules;
wenzelm
parents: 18813
diff changeset
   275
  and [symmetric, defn] = atomize_all atomize_imp atomize_eq atomize_iff
11771
b7b100a2de1d moved rulify to ObjectLogic;
wenzelm
parents: 11747
diff changeset
   276
11848
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   277
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   278
subsection {* Calculational rules *}
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   279
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   280
lemma forw_subst: "a = b ==> P(b) ==> P(a)"
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   281
  by (rule ssubst)
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   282
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   283
lemma back_subst: "P(a) ==> a = b ==> P(b)"
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   284
  by (rule subst)
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   285
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   286
text {*
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   287
  Note that this list of rules is in reverse order of priorities.
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   288
*}
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   289
12019
abe9b7c6016e transitive declared in Pure;
wenzelm
parents: 11976
diff changeset
   290
lemmas basic_trans_rules [trans] =
11848
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   291
  forw_subst
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   292
  back_subst
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   293
  rev_mp
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   294
  mp
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   295
  trans
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   296
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   297
subsection {* ``Let'' declarations *}
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   298
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   299
nonterminals letbinds letbind
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   300
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   301
constdefs
14854
61bdf2ae4dc5 removed obsolete sort 'logic';
wenzelm
parents: 14565
diff changeset
   302
  Let :: "['a::{}, 'a => 'b] => ('b::{})"
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   303
    "Let(s, f) == f(s)"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   304
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   305
syntax
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   306
  "_bind"       :: "[pttrn, 'a] => letbind"           ("(2_ =/ _)" 10)
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   307
  ""            :: "letbind => letbinds"              ("_")
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   308
  "_binds"      :: "[letbind, letbinds] => letbinds"  ("_;/ _")
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   309
  "_Let"        :: "[letbinds, 'a] => 'a"             ("(let (_)/ in (_))" 10)
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   310
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   311
translations
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   312
  "_Let(_binds(b, bs), e)"  == "_Let(b, _Let(bs, e))"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   313
  "let x = a in e"          == "Let(a, %x. e)"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   314
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   315
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   316
lemma LetI: 
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   317
    assumes prem: "(!!x. x=t ==> P(u(x)))"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   318
    shows "P(let x=t in u(x))"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   319
apply (unfold Let_def)
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   320
apply (rule refl [THEN prem])
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   321
done
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   322
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   323
ML
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   324
{*
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   325
val Let_def = thm "Let_def";
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   326
val LetI = thm "LetI";
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   327
*}
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   328
4854
d1850e0964f2 tuned setup;
wenzelm
parents: 4793
diff changeset
   329
end