src/FOL/IFOL.thy
author paulson
Thu, 16 Oct 2003 10:31:40 +0200
changeset 14236 c73d62ce9d1c
parent 13779 2a34dc5cf79e
child 14565 c6dc17aab88a
permissions -rw-r--r--
partial conversion to Isar scripts
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
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
     8
theory IFOL = Pure
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
     9
files ("IFOL_lemmas.ML") ("fologic.ML") ("hypsubstdata.ML") ("intprover.ML"):
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    10
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    12
subsection {* Syntax and axiomatic basis *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    13
3906
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    14
global
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    15
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    16
classes "term" < logic
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    17
defaultsort "term"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    19
typedecl o
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    20
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    21
judgment
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    22
  Trueprop      :: "o => prop"                  ("(_)" 5)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    24
consts
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    25
  True          :: o
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    26
  False         :: o
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    27
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    28
  (* Connectives *)
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    29
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    30
  "="           :: "['a, 'a] => o"              (infixl 50)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
    31
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    32
  Not           :: "o => o"                     ("~ _" [40] 40)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    33
  &             :: "[o, o] => o"                (infixr 35)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    34
  "|"           :: "[o, o] => o"                (infixr 30)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    35
  -->           :: "[o, o] => o"                (infixr 25)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    36
  <->           :: "[o, o] => o"                (infixr 25)
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    37
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    38
  (* Quantifiers *)
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    39
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    40
  All           :: "('a => o) => o"             (binder "ALL " 10)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    41
  Ex            :: "('a => o) => o"             (binder "EX " 10)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    42
  Ex1           :: "('a => o) => o"             (binder "EX! " 10)
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    43
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
928
cb31a4e97f75 Moved declaration of ~= to a syntax section
lcp
parents: 278
diff changeset
    45
syntax
12662
a9bbba3473f3 syntax "_not_equal";
wenzelm
parents: 12368
diff changeset
    46
  "_not_equal"  :: "['a, 'a] => o"              (infixl "~=" 50)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
    47
translations
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    48
  "x ~= y"      == "~ (x = y)"
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    49
12114
a8e860c86252 eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents: 12019
diff changeset
    50
syntax (xsymbols)
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    51
  Not           :: "o => o"                     ("\<not> _" [40] 40)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    52
  "op &"        :: "[o, o] => o"                (infixr "\<and>" 35)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    53
  "op |"        :: "[o, o] => o"                (infixr "\<or>" 30)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    54
  "ALL "        :: "[idts, o] => o"             ("(3\<forall>_./ _)" [0, 10] 10)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    55
  "EX "         :: "[idts, o] => o"             ("(3\<exists>_./ _)" [0, 10] 10)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    56
  "EX! "        :: "[idts, o] => o"             ("(3\<exists>!_./ _)" [0, 10] 10)
12662
a9bbba3473f3 syntax "_not_equal";
wenzelm
parents: 12368
diff changeset
    57
  "_not_equal"  :: "['a, 'a] => o"              (infixl "\<noteq>" 50)
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    58
  "op -->"      :: "[o, o] => o"                (infixr "\<longrightarrow>" 25)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    59
  "op <->"      :: "[o, o] => o"                (infixr "\<longleftrightarrow>" 25)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
    60
6340
7d5cbd5819a0 HTML output;
wenzelm
parents: 6027
diff changeset
    61
syntax (HTML output)
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    62
  Not           :: "o => o"                     ("\<not> _" [40] 40)
6340
7d5cbd5819a0 HTML output;
wenzelm
parents: 6027
diff changeset
    63
7d5cbd5819a0 HTML output;
wenzelm
parents: 6027
diff changeset
    64
3932
wenzelm
parents: 3906
diff changeset
    65
local
3906
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    66
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    67
finalconsts
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    68
  False All Ex
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    69
  "op ="
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    70
  "op &"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    71
  "op |"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    72
  "op -->"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    73
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    74
axioms
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    75
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    76
  (* Equality *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    78
  refl:         "a=a"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    79
  subst:        "[| a=b;  P(a) |] ==> P(b)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    81
  (* Propositional logic *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    82
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    83
  conjI:        "[| P;  Q |] ==> P&Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    84
  conjunct1:    "P&Q ==> P"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    85
  conjunct2:    "P&Q ==> Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    86
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    87
  disjI1:       "P ==> P|Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    88
  disjI2:       "Q ==> P|Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    89
  disjE:        "[| P|Q;  P ==> R;  Q ==> R |] ==> R"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    90
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    91
  impI:         "(P ==> Q) ==> P-->Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    92
  mp:           "[| P-->Q;  P |] ==> Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    93
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    94
  FalseE:       "False ==> P"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    95
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    96
  (* Quantifiers *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    98
  allI:         "(!!x. P(x)) ==> (ALL x. P(x))"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    99
  spec:         "(ALL x. P(x)) ==> P(x)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   100
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   101
  exI:          "P(x) ==> (EX x. P(x))"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   102
  exE:          "[| EX x. P(x);  !!x. P(x) ==> R |] ==> R"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
  (* Reflection *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   106
  eq_reflection:  "(x=y)   ==> (x==y)"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   107
  iff_reflection: "(P<->Q) ==> (P==Q)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   108
4092
9faf228771dc added simpset thy_data;
wenzelm
parents: 3932
diff changeset
   109
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   110
defs
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   111
  (* Definitions *)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   112
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   113
  True_def:     "True  == False-->False"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   114
  not_def:      "~P    == P-->False"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   115
  iff_def:      "P<->Q == (P-->Q) & (Q-->P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   116
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   117
  (* Unique existence *)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   118
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   119
  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
   120
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   121
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   122
subsection {* Lemmas and proof tools *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   123
9886
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   124
setup Simplifier.setup
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   125
use "IFOL_lemmas.ML"
11734
7a21bf539412 declare impE iffD1 iffD2 ad elim of Pure;
wenzelm
parents: 11677
diff changeset
   126
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   127
use "fologic.ML"
9886
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   128
use "hypsubstdata.ML"
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   129
setup hypsubst_setup
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   130
use "intprover.ML"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   131
4092
9faf228771dc added simpset thy_data;
wenzelm
parents: 3932
diff changeset
   132
12875
wenzelm
parents: 12662
diff changeset
   133
subsection {* Intuitionistic Reasoning *}
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   134
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   135
lemma impE':
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   136
  assumes 1: "P --> Q"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   137
    and 2: "Q ==> R"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   138
    and 3: "P --> Q ==> P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   139
  shows R
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   140
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   141
  from 3 and 1 have P .
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   142
  with 1 have Q by (rule impE)
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   143
  with 2 show R .
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   144
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   145
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   146
lemma allE':
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   147
  assumes 1: "ALL x. P(x)"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   148
    and 2: "P(x) ==> ALL x. P(x) ==> Q"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   149
  shows Q
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   150
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   151
  from 1 have "P(x)" by (rule spec)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   152
  from this and 1 show Q by (rule 2)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   153
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   154
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   155
lemma notE':
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   156
  assumes 1: "~ P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   157
    and 2: "~ P ==> P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   158
  shows R
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   159
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   160
  from 2 and 1 have P .
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   161
  with 1 show R by (rule notE)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   162
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   163
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   164
lemmas [Pure.elim!] = disjE iffE FalseE conjE exE
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   165
  and [Pure.intro!] = iffI conjI impI TrueI notI allI refl
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   166
  and [Pure.elim 2] = allE notE' impE'
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   167
  and [Pure.intro] = exI disjI2 disjI1
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   168
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   169
ML_setup {*
12352
92c48cc45e78 renamed RuleContext to ContextRules;
wenzelm
parents: 12349
diff changeset
   170
  Context.>> (ContextRules.addSWrapper (fn tac => hyp_subst_tac ORELSE' tac));
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   171
*}
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   172
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   173
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   174
lemma iff_not_sym: "~ (Q <-> P) ==> ~ (P <-> Q)"
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   175
  by rules
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   176
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   177
lemmas [sym] = sym iff_sym not_sym iff_not_sym
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   178
  and [Pure.elim?] = iffD1 iffD2 impE
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   179
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   180
13435
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   181
lemma eq_commute: "a=b <-> b=a"
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   182
apply (rule iffI) 
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   183
apply (erule sym)+
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   184
done
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   185
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   186
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   187
subsection {* Atomizing meta-level rules *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   188
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   189
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
   190
proof
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   191
  assume "!!x. P(x)"
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   192
  show "ALL x. P(x)" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   193
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   194
  assume "ALL x. P(x)"
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   195
  thus "!!x. P(x)" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   196
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   197
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   198
lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   199
proof
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   200
  assume "A ==> B"
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   201
  thus "A --> B" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   202
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   203
  assume "A --> B" and A
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   204
  thus B by (rule mp)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   205
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   206
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   207
lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   208
proof
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   209
  assume "x == y"
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   210
  show "x = y" by (unfold prems) (rule refl)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   211
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   212
  assume "x = y"
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   213
  thus "x == y" by (rule eq_reflection)
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   214
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   215
12875
wenzelm
parents: 12662
diff changeset
   216
lemma atomize_conj [atomize]:
wenzelm
parents: 12662
diff changeset
   217
  "(!!C. (A ==> B ==> PROP C) ==> PROP C) == Trueprop (A & B)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   218
proof
11953
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   219
  assume "!!C. (A ==> B ==> PROP C) ==> PROP C"
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   220
  show "A & B" by (rule conjI)
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   221
next
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   222
  fix C
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   223
  assume "A & B"
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   224
  assume "A ==> B ==> PROP C"
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   225
  thus "PROP C"
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   226
  proof this
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   227
    show A by (rule conjunct1)
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   228
    show B by (rule conjunct2)
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   229
  qed
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   230
qed
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   231
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   232
lemmas [symmetric, rulify] = atomize_all atomize_imp
11771
b7b100a2de1d moved rulify to ObjectLogic;
wenzelm
parents: 11747
diff changeset
   233
11848
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   234
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   235
subsection {* Calculational rules *}
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   236
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   237
lemma forw_subst: "a = b ==> P(b) ==> P(a)"
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   238
  by (rule ssubst)
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   239
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   240
lemma back_subst: "P(a) ==> a = b ==> P(b)"
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   241
  by (rule subst)
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   242
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   243
text {*
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   244
  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
   245
*}
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   246
12019
abe9b7c6016e transitive declared in Pure;
wenzelm
parents: 11976
diff changeset
   247
lemmas basic_trans_rules [trans] =
11848
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   248
  forw_subst
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   249
  back_subst
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   250
  rev_mp
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   251
  mp
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   252
  trans
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   253
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   254
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   255
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   256
subsection {* ``Let'' declarations *}
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   257
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   258
nonterminals letbinds letbind
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   259
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   260
constdefs
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   261
  Let :: "['a::logic, 'a => 'b] => ('b::logic)"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   262
    "Let(s, f) == f(s)"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   263
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   264
syntax
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   265
  "_bind"       :: "[pttrn, 'a] => letbind"           ("(2_ =/ _)" 10)
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   266
  ""            :: "letbind => letbinds"              ("_")
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   267
  "_binds"      :: "[letbind, letbinds] => letbinds"  ("_;/ _")
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   268
  "_Let"        :: "[letbinds, 'a] => 'a"             ("(let (_)/ in (_))" 10)
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   269
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   270
translations
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   271
  "_Let(_binds(b, bs), e)"  == "_Let(b, _Let(bs, e))"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   272
  "let x = a in e"          == "Let(a, %x. e)"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   273
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   274
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   275
lemma LetI: 
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   276
    assumes prem: "(!!x. x=t ==> P(u(x)))"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   277
    shows "P(let x=t in u(x))"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   278
apply (unfold Let_def)
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   279
apply (rule refl [THEN prem])
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   280
done
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   281
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   282
ML
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   283
{*
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   284
val Let_def = thm "Let_def";
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   285
val LetI = thm "LetI";
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   286
*}
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   287
4854
d1850e0964f2 tuned setup;
wenzelm
parents: 4793
diff changeset
   288
end