src/ZF/ZF.thy
author wenzelm
Wed, 30 Dec 2015 17:45:18 +0100
changeset 61980 6b780867d426
parent 61979 d68b705719ce
child 62149 a02b79ef2339
permissions -rw-r--r--
clarified syntax;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
     1
(*  Title:      ZF/ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    Author:     Lawrence C Paulson and Martin D Coen, CU Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Copyright   1993  University of Cambridge
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
     4
*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
     6
section\<open>Zermelo-Fraenkel Set Theory\<close>
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
37781
2fbbf0a48cef moved misc legacy stuff from OldGoals to Misc_Legacy;
wenzelm
parents: 37405
diff changeset
     8
theory ZF
48462
424fd5364f15 clarified "this_name" vs. former "reset" feature -- imitate the latter by loading other session sources directly;
wenzelm
parents: 46972
diff changeset
     9
imports "~~/src/FOL/FOL"
37781
2fbbf0a48cef moved misc legacy stuff from OldGoals to Misc_Legacy;
wenzelm
parents: 37405
diff changeset
    10
begin
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
39128
93a7365fb4ee turned eta_contract into proper configuration option;
wenzelm
parents: 38798
diff changeset
    12
declare [[eta_contract = false]]
23168
fcdd4346fa6b tuned ML setup;
wenzelm
parents: 18845
diff changeset
    13
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    14
typedecl i
55380
4de48353034e prefer vacuous definitional type classes over axiomatic ones;
wenzelm
parents: 48733
diff changeset
    15
instance i :: "term" ..
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
46972
ef6fc1a0884d modernized axiomatization;
wenzelm
parents: 46907
diff changeset
    17
axiomatization
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    18
  zero :: "i"  ("0")   \<comment>\<open>the empty set\<close>  and
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    19
  Pow :: "i => i"  \<comment>\<open>power sets\<close>  and
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    20
  Inf :: "i"  \<comment>\<open>infinite set\<close>
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    22
text \<open>Bounded Quantifiers\<close>
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    23
consts
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    24
  Ball   :: "[i, i => o] => o"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    25
  Bex   :: "[i, i => o] => o"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    27
text \<open>General Union and Intersection\<close>
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    28
axiomatization Union :: "i => i"  ("\<Union>_" [90] 90)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    29
consts Inter :: "i => i"  ("\<Inter>_" [90] 90)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    31
text \<open>Variations on Replacement\<close>
46972
ef6fc1a0884d modernized axiomatization;
wenzelm
parents: 46907
diff changeset
    32
axiomatization PrimReplace :: "[i, [i, i] => o] => i"
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    33
consts
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    34
  Replace     :: "[i, [i, i] => o] => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    35
  RepFun      :: "[i, i => i] => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    36
  Collect     :: "[i, i => o] => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    38
text\<open>Definite descriptions -- via Replace over the set "1"\<close>
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    39
consts
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    40
  The         :: "(i => o) => i"      (binder "THE " 10)
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    41
  If          :: "[o, i, i] => i"     ("(if (_)/ then (_)/ else (_))" [10] 10)
6068
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    42
24826
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    43
abbreviation (input)
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    44
  old_if      :: "[o, i, i] => i"   ("if '(_,_,_')") where
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    45
  "if(P,a,b) == If(P,a,b)"
6068
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    46
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    47
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    48
text \<open>Finite Sets\<close>
6068
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    49
consts
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    50
  Upair :: "[i, i] => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    51
  cons  :: "[i, i] => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    52
  succ  :: "i => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    54
text \<open>Ordered Pairing\<close>
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    55
consts
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    56
  Pair  :: "[i, i] => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    57
  fst   :: "i => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    58
  snd   :: "i => i"
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    59
  split :: "[[i, i] => 'a, i] => 'a::{}"  \<comment>\<open>for pattern-matching\<close>
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    61
text \<open>Sigma and Pi Operators\<close>
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    62
consts
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    63
  Sigma :: "[i, i => i] => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    64
  Pi    :: "[i, i => i] => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    66
text \<open>Relations and Functions\<close>
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    67
consts
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    68
  "domain"    :: "i => i"
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    69
  range       :: "i => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    70
  field       :: "i => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    71
  converse    :: "i => i"
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    72
  relation    :: "i => o"        \<comment>\<open>recognizes sets of pairs\<close>
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    73
  "function"  :: "i => o"        \<comment>\<open>recognizes functions; can have non-pairs\<close>
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    74
  Lambda      :: "[i, i => i] => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    75
  restrict    :: "[i, i] => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    76
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    77
text \<open>Infixes in order of decreasing precedence\<close>
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 13780
diff changeset
    78
consts
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    79
  Image       :: "[i, i] => i"    (infixl "``" 90) \<comment>\<open>image\<close>
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    80
  vimage      :: "[i, i] => i"    (infixl "-``" 90) \<comment>\<open>inverse image\<close>
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    81
  "apply"     :: "[i, i] => i"    (infixl "`" 90) \<comment>\<open>function application\<close>
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    82
  "Int"       :: "[i, i] => i"    (infixl "\<inter>" 70) \<comment>\<open>binary intersection\<close>
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    83
  "Un"        :: "[i, i] => i"    (infixl "\<union>" 65) \<comment>\<open>binary union\<close>
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    84
  Diff        :: "[i, i] => i"    (infixl "-" 65) \<comment>\<open>set difference\<close>
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    85
  Subset      :: "[i, i] => o"    (infixl "\<subseteq>" 50) \<comment>\<open>subset relation\<close>
48733
18e76e2db6d4 proper axiomatization of "mem" -- do not leave it formally unspecified;
wenzelm
parents: 48462
diff changeset
    86
18e76e2db6d4 proper axiomatization of "mem" -- do not leave it formally unspecified;
wenzelm
parents: 48462
diff changeset
    87
axiomatization
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    88
  mem         :: "[i, i] => o"    (infixl "\<in>" 50) \<comment>\<open>membership relation\<close>
24826
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    89
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    90
abbreviation
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    91
  not_mem :: "[i, i] => o"  (infixl "\<notin>" 50)  \<comment>\<open>negated membership relation\<close>
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    92
  where "x \<notin> y \<equiv> \<not> (x \<in> y)"
24826
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    93
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    94
abbreviation
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    95
  cart_prod :: "[i, i] => i"    (infixr "\<times>" 80) \<comment>\<open>Cartesian product\<close>
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
    96
  where "A \<times> B \<equiv> Sigma(A, \<lambda>_. B)"
24826
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    97
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
    98
abbreviation
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
    99
  function_space :: "[i, i] => i"  (infixr "->" 60) \<comment>\<open>function space\<close>
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   100
  where "A -> B \<equiv> Pi(A, \<lambda>_. B)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   101
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
41229
d797baa3d57c replaced command 'nonterminals' by slightly modernized version 'nonterminal';
wenzelm
parents: 40714
diff changeset
   103
nonterminal "is" and patterns
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   104
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   105
syntax
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   106
  ""          :: "i => is"                   ("_")
35112
ff6f60e6ab85 numeral syntax: clarify parse trees vs. actual terms;
wenzelm
parents: 35068
diff changeset
   107
  "_Enum"     :: "[i, is] => is"             ("_,/ _")
24826
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
   108
35112
ff6f60e6ab85 numeral syntax: clarify parse trees vs. actual terms;
wenzelm
parents: 35068
diff changeset
   109
  "_Finset"   :: "is => i"                   ("{(_)}")
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   110
  "_Tuple"    :: "[i, is] => i"              ("\<langle>(_,/ _)\<rangle>")
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   111
  "_Collect"  :: "[pttrn, i, o] => i"        ("(1{_ \<in> _ ./ _})")
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   112
  "_Replace"  :: "[pttrn, pttrn, i, o] => i" ("(1{_ ./ _ \<in> _, _})")
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   113
  "_RepFun"   :: "[i, pttrn, i] => i"        ("(1{_ ./ _ \<in> _})" [51,0,51])
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   114
  "_UNION"    :: "[pttrn, i, i] => i"        ("(3\<Union>_\<in>_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   115
  "_INTER"    :: "[pttrn, i, i] => i"        ("(3\<Inter>_\<in>_./ _)" 10)
61980
6b780867d426 clarified syntax;
wenzelm
parents: 61979
diff changeset
   116
  "_PROD"     :: "[pttrn, i, i] => i"        ("(3\<Prod>_\<in>_./ _)" 10)
6b780867d426 clarified syntax;
wenzelm
parents: 61979
diff changeset
   117
  "_SUM"      :: "[pttrn, i, i] => i"        ("(3\<Sum>_\<in>_./ _)" 10)
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   118
  "_lam"      :: "[pttrn, i, i] => i"        ("(3\<lambda>_\<in>_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   119
  "_Ball"     :: "[pttrn, i, o] => o"        ("(3\<forall>_\<in>_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   120
  "_Bex"      :: "[pttrn, i, o] => o"        ("(3\<exists>_\<in>_./ _)" 10)
1106
62bdb9e5722b Added pattern-matching code from CHOL/Prod.thy. Changed
lcp
parents: 690
diff changeset
   121
62bdb9e5722b Added pattern-matching code from CHOL/Prod.thy. Changed
lcp
parents: 690
diff changeset
   122
  (** Patterns -- extends pre-defined type "pttrn" used in abstractions **)
62bdb9e5722b Added pattern-matching code from CHOL/Prod.thy. Changed
lcp
parents: 690
diff changeset
   123
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   124
  "_pattern"  :: "patterns => pttrn"         ("\<langle>_\<rangle>")
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   125
  ""          :: "pttrn => patterns"         ("_")
35112
ff6f60e6ab85 numeral syntax: clarify parse trees vs. actual terms;
wenzelm
parents: 35068
diff changeset
   126
  "_patterns" :: "[pttrn, patterns] => patterns"  ("_,/_")
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   127
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
translations
35068
544867142ea4 modernized translations;
wenzelm
parents: 32960
diff changeset
   129
  "{x, xs}"     == "CONST cons(x, {xs})"
544867142ea4 modernized translations;
wenzelm
parents: 32960
diff changeset
   130
  "{x}"         == "CONST cons(x, 0)"
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   131
  "{x\<in>A. P}"    == "CONST Collect(A, \<lambda>x. P)"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   132
  "{y. x\<in>A, Q}" == "CONST Replace(A, \<lambda>x y. Q)"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   133
  "{b. x\<in>A}"    == "CONST RepFun(A, \<lambda>x. b)"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   134
  "\<Inter>x\<in>A. B"    == "CONST Inter({B. x\<in>A})"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   135
  "\<Union>x\<in>A. B"    == "CONST Union({B. x\<in>A})"
61980
6b780867d426 clarified syntax;
wenzelm
parents: 61979
diff changeset
   136
  "\<Prod>x\<in>A. B"   == "CONST Pi(A, \<lambda>x. B)"
6b780867d426 clarified syntax;
wenzelm
parents: 61979
diff changeset
   137
  "\<Sum>x\<in>A. B"   == "CONST Sigma(A, \<lambda>x. B)"
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   138
  "\<lambda>x\<in>A. f"    == "CONST Lambda(A, \<lambda>x. f)"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   139
  "\<forall>x\<in>A. P"    == "CONST Ball(A, \<lambda>x. P)"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   140
  "\<exists>x\<in>A. P"    == "CONST Bex(A, \<lambda>x. P)"
37
cebe01deba80 added ~: for "not in"
lcp
parents: 0
diff changeset
   141
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   142
  "\<langle>x, y, z\<rangle>"   == "\<langle>x, \<langle>y, z\<rangle>\<rangle>"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   143
  "\<langle>x, y\<rangle>"      == "CONST Pair(x, y)"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   144
  "\<lambda>\<langle>x,y,zs\<rangle>.b" == "CONST split(\<lambda>x \<langle>y,zs\<rangle>.b)"
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   145
  "\<lambda>\<langle>x,y\<rangle>.b"    == "CONST split(\<lambda>x y. b)"
2286
c2f76a5bad65 removed out-dated comment;
wenzelm
parents: 1478
diff changeset
   146
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   147
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   148
notation (ASCII)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   149
  cart_prod       (infixr "*" 80) and
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   150
  Int             (infixl "Int" 70) and
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   151
  Un              (infixl "Un" 65) and
24826
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
   152
  function_space  (infixr "\<rightarrow>" 60) and
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   153
  Subset          (infixl "<=" 50) and
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   154
  mem             (infixl ":" 50) and
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   155
  not_mem         (infixl "~:" 50)
24826
78e6a3cea367 avoid unnamed infixes;
wenzelm
parents: 23168
diff changeset
   156
61979
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   157
syntax (ASCII)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   158
  "_Collect"  :: "[pttrn, i, o] => i"        ("(1{_: _ ./ _})")
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   159
  "_Replace"  :: "[pttrn, pttrn, i, o] => i" ("(1{_ ./ _: _, _})")
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   160
  "_RepFun"   :: "[i, pttrn, i] => i"        ("(1{_ ./ _: _})" [51,0,51])
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   161
  "_UNION"    :: "[pttrn, i, i] => i"        ("(3UN _:_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   162
  "_INTER"    :: "[pttrn, i, i] => i"        ("(3INT _:_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   163
  "_PROD"     :: "[pttrn, i, i] => i"        ("(3PROD _:_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   164
  "_SUM"      :: "[pttrn, i, i] => i"        ("(3SUM _:_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   165
  "_lam"      :: "[pttrn, i, i] => i"        ("(3lam _:_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   166
  "_Ball"     :: "[pttrn, i, o] => o"        ("(3ALL _:_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   167
  "_Bex"      :: "[pttrn, i, o] => o"        ("(3EX _:_./ _)" 10)
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   168
  "_Tuple"    :: "[i, is] => i"              ("<(_,/ _)>")
d68b705719ce clarified print modes;
wenzelm
parents: 61798
diff changeset
   169
  "_pattern"  :: "patterns => pttrn"         ("<_>")
2540
ba8311047f18 added symbols syntax;
wenzelm
parents: 2469
diff changeset
   170
37405
7c49988afd0e avoid references to old constdefs
haftmann
parents: 35112
diff changeset
   171
defs  (* Bounded Quantifiers *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   172
  Ball_def:      "Ball(A, P) == \<forall>x. x\<in>A \<longrightarrow> P(x)"
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   173
  Bex_def:       "Bex(A, P) == \<exists>x. x\<in>A & P(x)"
690
b2bd1d5a3d16 ZF: NEW DEFINITION OF PI(A,B)
lcp
parents: 675
diff changeset
   174
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   175
  subset_def:    "A \<subseteq> B == \<forall>x\<in>A. x\<in>B"
690
b2bd1d5a3d16 ZF: NEW DEFINITION OF PI(A,B)
lcp
parents: 675
diff changeset
   176
3906
5ae0e1324c56 global;
wenzelm
parents: 3840
diff changeset
   177
41779
a68f503805ed modernized specifications;
wenzelm
parents: 41310
diff changeset
   178
axiomatization where
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   179
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   180
  (* ZF axioms -- see Suppes p.238
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   181
     Axioms for Union, Pow and Replace state existence only,
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   182
     uniqueness is derivable using extensionality. *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   184
  extension:     "A = B <-> A \<subseteq> B & B \<subseteq> A" and
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   185
  Union_iff:     "A \<in> \<Union>(C) <-> (\<exists>B\<in>C. A\<in>B)" and
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   186
  Pow_iff:       "A \<in> Pow(B) <-> A \<subseteq> B" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   187
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   188
  (*We may name this set, though it is not uniquely defined.*)
41779
a68f503805ed modernized specifications;
wenzelm
parents: 41310
diff changeset
   189
  infinity:      "0\<in>Inf & (\<forall>y\<in>Inf. succ(y): Inf)" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   190
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   191
  (*This formulation facilitates case analysis on A.*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   192
  foundation:    "A=0 | (\<exists>x\<in>A. \<forall>y\<in>x. y\<notin>A)" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   193
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   194
  (*Schema axiom since predicate P is a higher-order variable*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   195
  replacement:   "(\<forall>x\<in>A. \<forall>y z. P(x,y) & P(x,z) \<longrightarrow> y=z) ==>
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   196
                         b \<in> PrimReplace(A,P) <-> (\<exists>x\<in>A. P(x,b))"
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   197
14883
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 14854
diff changeset
   198
690
b2bd1d5a3d16 ZF: NEW DEFINITION OF PI(A,B)
lcp
parents: 675
diff changeset
   199
defs
b2bd1d5a3d16 ZF: NEW DEFINITION OF PI(A,B)
lcp
parents: 675
diff changeset
   200
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   201
  (* Derived form of replacement, restricting P to its functional part.
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   202
     The resulting set (for functional P) is the same as with
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   203
     PrimReplace, but the rules are simpler. *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   204
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   205
  Replace_def:  "Replace(A,P) == PrimReplace(A, %x y. (EX!z. P(x,z)) & P(x,y))"
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   206
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   207
  (* Functional form of replacement -- analgous to ML's map functional *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   208
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   209
  RepFun_def:   "RepFun(A,f) == {y . x\<in>A, y=f(x)}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   210
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   211
  (* Separation and Pairing can be derived from the Replacement
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   212
     and Powerset Axioms using the following definitions. *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   213
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   214
  Collect_def:  "Collect(A,P) == {y . x\<in>A, x=y & P(x)}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   215
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   216
  (*Unordered pairs (Upair) express binary union/intersection and cons;
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   217
    set enumerations translate as {a,...,z} = cons(a,...,cons(z,0)...)*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   218
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   219
  Upair_def: "Upair(a,b) == {y. x\<in>Pow(Pow(0)), (x=0 & y=a) | (x=Pow(0) & y=b)}"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   220
  cons_def:  "cons(a,A) == Upair(a,a) \<union> A"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   221
  succ_def:  "succ(i) == cons(i, i)"
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   222
2872
ac81a17f86f8 Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
paulson
parents: 2540
diff changeset
   223
  (* Difference, general intersection, binary union and small intersection *)
ac81a17f86f8 Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
paulson
parents: 2540
diff changeset
   224
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   225
  Diff_def:      "A - B    == { x\<in>A . ~(x\<in>B) }"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   226
  Inter_def:     "\<Inter>(A) == { x\<in>\<Union>(A) . \<forall>y\<in>A. x\<in>y}"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   227
  Un_def:        "A \<union>  B  == \<Union>(Upair(A,B))"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   228
  Int_def:      "A \<inter> B  == \<Inter>(Upair(A,B))"
2872
ac81a17f86f8 Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
paulson
parents: 2540
diff changeset
   229
14883
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 14854
diff changeset
   230
  (* definite descriptions *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   231
  the_def:      "The(P)    == \<Union>({y . x \<in> {0}, P(y)})"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   232
  if_def:       "if(P,a,b) == THE z. P & z=a | ~P & z=b"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   233
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   234
  (* this "symmetric" definition works better than {{a}, {a,b}} *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   235
  Pair_def:     "<a,b>  == {{a,a}, {a,b}}"
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   236
  fst_def:      "fst(p) == THE a. \<exists>b. p=<a,b>"
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   237
  snd_def:      "snd(p) == THE b. \<exists>a. p=<a,b>"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   238
  split_def:    "split(c) == %p. c(fst(p), snd(p))"
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   239
  Sigma_def:    "Sigma(A,B) == \<Union>x\<in>A. \<Union>y\<in>B(x). {<x,y>}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   240
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   241
  (* Operations on relations *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   242
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   243
  (*converse of relation r, inverse of function*)
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   244
  converse_def: "converse(r) == {z. w\<in>r, \<exists>x y. w=<x,y> & z=<y,x>}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   245
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   246
  domain_def:   "domain(r) == {x. w\<in>r, \<exists>y. w=<x,y>}"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   247
  range_def:    "range(r) == domain(converse(r))"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   248
  field_def:    "field(r) == domain(r) \<union> range(r)"
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   249
  relation_def: "relation(r) == \<forall>z\<in>r. \<exists>x y. z = <x,y>"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   250
  function_def: "function(r) ==
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   251
                    \<forall>x y. <x,y>:r \<longrightarrow> (\<forall>y'. <x,y'>:r \<longrightarrow> y=y')"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   252
  image_def:    "r `` A  == {y \<in> range(r) . \<exists>x\<in>A. <x,y> \<in> r}"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   253
  vimage_def:   "r -`` A == converse(r)``A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   254
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   255
  (* Abstraction, application and Cartesian product of a family of sets *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   256
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   257
  lam_def:      "Lambda(A,b) == {<x,b(x)> . x\<in>A}"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   258
  apply_def:    "f`a == \<Union>(f``{a})"
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   259
  Pi_def:       "Pi(A,B)  == {f\<in>Pow(Sigma(A,B)). A<=domain(f) & function(f)}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   260
12891
92af5c3a10fb a new definition of "restrict"
paulson
parents: 12762
diff changeset
   261
  (* Restrict the relation r to the domain A *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   262
  restrict_def: "restrict(r,A) == {z \<in> r. \<exists>x\<in>A. \<exists>y. z = <x,y>}"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   263
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   264
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   265
subsection \<open>Substitution\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   266
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   267
(*Useful examples:  singletonI RS subst_elem,  subst_elem RSN (2,IntI) *)
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   268
lemma subst_elem: "[| b\<in>A;  a=b |] ==> a\<in>A"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   269
by (erule ssubst, assumption)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   270
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   271
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   272
subsection\<open>Bounded universal quantifier\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   273
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   274
lemma ballI [intro!]: "[| !!x. x\<in>A ==> P(x) |] ==> \<forall>x\<in>A. P(x)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   275
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   276
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 14883
diff changeset
   277
lemmas strip = impI allI ballI
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 14883
diff changeset
   278
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   279
lemma bspec [dest?]: "[| \<forall>x\<in>A. P(x);  x: A |] ==> P(x)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   280
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   281
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   282
(*Instantiates x first: better for automatic theorem proving?*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   283
lemma rev_ballE [elim]:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   284
    "[| \<forall>x\<in>A. P(x);  x\<notin>A ==> Q;  P(x) ==> Q |] ==> Q"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   285
by (simp add: Ball_def, blast)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   286
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   287
lemma ballE: "[| \<forall>x\<in>A. P(x);  P(x) ==> Q;  x\<notin>A ==> Q |] ==> Q"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   288
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   289
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   290
(*Used in the datatype package*)
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   291
lemma rev_bspec: "[| x: A;  \<forall>x\<in>A. P(x) |] ==> P(x)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   292
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   293
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   294
(*Trival rewrite rule;   @{term"(\<forall>x\<in>A.P)<->P"} holds only if A is nonempty!*)
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   295
lemma ball_triv [simp]: "(\<forall>x\<in>A. P) <-> ((\<exists>x. x\<in>A) \<longrightarrow> P)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   296
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   297
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   298
(*Congruence rule for rewriting*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   299
lemma ball_cong [cong]:
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   300
    "[| A=A';  !!x. x\<in>A' ==> P(x) <-> P'(x) |] ==> (\<forall>x\<in>A. P(x)) <-> (\<forall>x\<in>A'. P'(x))"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   301
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   302
18845
6cbcfac5b72e declare atomize/defn for Ball;
wenzelm
parents: 18413
diff changeset
   303
lemma atomize_ball:
6cbcfac5b72e declare atomize/defn for Ball;
wenzelm
parents: 18413
diff changeset
   304
    "(!!x. x \<in> A ==> P(x)) == Trueprop (\<forall>x\<in>A. P(x))"
6cbcfac5b72e declare atomize/defn for Ball;
wenzelm
parents: 18413
diff changeset
   305
  by (simp only: Ball_def atomize_all atomize_imp)
6cbcfac5b72e declare atomize/defn for Ball;
wenzelm
parents: 18413
diff changeset
   306
6cbcfac5b72e declare atomize/defn for Ball;
wenzelm
parents: 18413
diff changeset
   307
lemmas [symmetric, rulify] = atomize_ball
6cbcfac5b72e declare atomize/defn for Ball;
wenzelm
parents: 18413
diff changeset
   308
  and [symmetric, defn] = atomize_ball
6cbcfac5b72e declare atomize/defn for Ball;
wenzelm
parents: 18413
diff changeset
   309
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   310
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   311
subsection\<open>Bounded existential quantifier\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   312
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   313
lemma bexI [intro]: "[| P(x);  x: A |] ==> \<exists>x\<in>A. P(x)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   314
by (simp add: Bex_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   315
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   316
(*The best argument order when there is only one @{term"x\<in>A"}*)
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   317
lemma rev_bexI: "[| x\<in>A;  P(x) |] ==> \<exists>x\<in>A. P(x)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   318
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   319
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   320
(*Not of the general form for such rules. The existential quanitifer becomes universal. *)
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   321
lemma bexCI: "[| \<forall>x\<in>A. ~P(x) ==> P(a);  a: A |] ==> \<exists>x\<in>A. P(x)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   322
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   323
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   324
lemma bexE [elim!]: "[| \<exists>x\<in>A. P(x);  !!x. [| x\<in>A; P(x) |] ==> Q |] ==> Q"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   325
by (simp add: Bex_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   326
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   327
(*We do not even have @{term"(\<exists>x\<in>A. True) <-> True"} unless @{term"A" is nonempty!!*)
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   328
lemma bex_triv [simp]: "(\<exists>x\<in>A. P) <-> ((\<exists>x. x\<in>A) & P)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   329
by (simp add: Bex_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   330
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   331
lemma bex_cong [cong]:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   332
    "[| A=A';  !!x. x\<in>A' ==> P(x) <-> P'(x) |]
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   333
     ==> (\<exists>x\<in>A. P(x)) <-> (\<exists>x\<in>A'. P'(x))"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   334
by (simp add: Bex_def cong: conj_cong)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   335
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   336
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   337
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   338
subsection\<open>Rules for subsets\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   339
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   340
lemma subsetI [intro!]:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   341
    "(!!x. x\<in>A ==> x\<in>B) ==> A \<subseteq> B"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   342
by (simp add: subset_def)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   343
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   344
(*Rule in Modus Ponens style [was called subsetE] *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   345
lemma subsetD [elim]: "[| A \<subseteq> B;  c\<in>A |] ==> c\<in>B"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   346
apply (unfold subset_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   347
apply (erule bspec, assumption)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   348
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   349
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   350
(*Classical elimination rule*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   351
lemma subsetCE [elim]:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   352
    "[| A \<subseteq> B;  c\<notin>A ==> P;  c\<in>B ==> P |] ==> P"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   353
by (simp add: subset_def, blast)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   354
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   355
(*Sometimes useful with premises in this order*)
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   356
lemma rev_subsetD: "[| c\<in>A; A<=B |] ==> c\<in>B"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   357
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   358
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   359
lemma contra_subsetD: "[| A \<subseteq> B; c \<notin> B |] ==> c \<notin> A"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   360
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   361
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   362
lemma rev_contra_subsetD: "[| c \<notin> B;  A \<subseteq> B |] ==> c \<notin> A"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   363
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   364
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   365
lemma subset_refl [simp]: "A \<subseteq> A"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   366
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   367
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   368
lemma subset_trans: "[| A<=B;  B<=C |] ==> A<=C"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   369
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   370
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   371
(*Useful for proving A<=B by rewriting in some cases*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   372
lemma subset_iff:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   373
     "A<=B <-> (\<forall>x. x\<in>A \<longrightarrow> x\<in>B)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   374
apply (unfold subset_def Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   375
apply (rule iff_refl)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   376
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   377
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   378
text\<open>For calculations\<close>
46907
eea3eb057fea Structured proofs concerning the square of an infinite cardinal
paulson
parents: 46820
diff changeset
   379
declare subsetD [trans] rev_subsetD [trans] subset_trans [trans]
eea3eb057fea Structured proofs concerning the square of an infinite cardinal
paulson
parents: 46820
diff changeset
   380
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   381
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   382
subsection\<open>Rules for equality\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   383
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   384
(*Anti-symmetry of the subset relation*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   385
lemma equalityI [intro]: "[| A \<subseteq> B;  B \<subseteq> A |] ==> A = B"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   386
by (rule extension [THEN iffD2], rule conjI)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   387
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   388
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   389
lemma equality_iffI: "(!!x. x\<in>A <-> x\<in>B) ==> A = B"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   390
by (rule equalityI, blast+)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   391
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 44147
diff changeset
   392
lemmas equalityD1 = extension [THEN iffD1, THEN conjunct1]
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 44147
diff changeset
   393
lemmas equalityD2 = extension [THEN iffD1, THEN conjunct2]
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   394
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   395
lemma equalityE: "[| A = B;  [| A<=B; B<=A |] ==> P |]  ==>  P"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   396
by (blast dest: equalityD1 equalityD2)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   397
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   398
lemma equalityCE:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   399
    "[| A = B;  [| c\<in>A; c\<in>B |] ==> P;  [| c\<notin>A; c\<notin>B |] ==> P |]  ==>  P"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   400
by (erule equalityE, blast)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   401
27702
80608e96e760 Lemmas added
ballarin
parents: 24893
diff changeset
   402
lemma equality_iffD:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   403
  "A = B ==> (!!x. x \<in> A <-> x \<in> B)"
27702
80608e96e760 Lemmas added
ballarin
parents: 24893
diff changeset
   404
  by auto
80608e96e760 Lemmas added
ballarin
parents: 24893
diff changeset
   405
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   406
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   407
subsection\<open>Rules for Replace -- the derived form of replacement\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   408
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   409
lemma Replace_iff:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   410
    "b \<in> {y. x\<in>A, P(x,y)}  <->  (\<exists>x\<in>A. P(x,b) & (\<forall>y. P(x,y) \<longrightarrow> y=b))"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   411
apply (unfold Replace_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   412
apply (rule replacement [THEN iff_trans], blast+)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   413
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   414
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   415
(*Introduction; there must be a unique y such that P(x,y), namely y=b. *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   416
lemma ReplaceI [intro]:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   417
    "[| P(x,b);  x: A;  !!y. P(x,y) ==> y=b |] ==>
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   418
     b \<in> {y. x\<in>A, P(x,y)}"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   419
by (rule Replace_iff [THEN iffD2], blast)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   420
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   421
(*Elimination; may asssume there is a unique y such that P(x,y), namely y=b. *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   422
lemma ReplaceE:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   423
    "[| b \<in> {y. x\<in>A, P(x,y)};
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   424
        !!x. [| x: A;  P(x,b);  \<forall>y. P(x,y)\<longrightarrow>y=b |] ==> R
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   425
     |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   426
by (rule Replace_iff [THEN iffD1, THEN bexE], simp+)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   427
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   428
(*As above but without the (generally useless) 3rd assumption*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   429
lemma ReplaceE2 [elim!]:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   430
    "[| b \<in> {y. x\<in>A, P(x,y)};
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   431
        !!x. [| x: A;  P(x,b) |] ==> R
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   432
     |] ==> R"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   433
by (erule ReplaceE, blast)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   434
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   435
lemma Replace_cong [cong]:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   436
    "[| A=B;  !!x y. x\<in>B ==> P(x,y) <-> Q(x,y) |] ==>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   437
     Replace(A,P) = Replace(B,Q)"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   438
apply (rule equality_iffI)
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   439
apply (simp add: Replace_iff)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   440
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   441
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   442
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   443
subsection\<open>Rules for RepFun\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   444
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   445
lemma RepFunI: "a \<in> A ==> f(a) \<in> {f(x). x\<in>A}"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   446
by (simp add: RepFun_def Replace_iff, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   447
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   448
(*Useful for coinduction proofs*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   449
lemma RepFun_eqI [intro]: "[| b=f(a);  a \<in> A |] ==> b \<in> {f(x). x\<in>A}"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   450
apply (erule ssubst)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   451
apply (erule RepFunI)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   452
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   453
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   454
lemma RepFunE [elim!]:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   455
    "[| b \<in> {f(x). x\<in>A};
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   456
        !!x.[| x\<in>A;  b=f(x) |] ==> P |] ==>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   457
     P"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   458
by (simp add: RepFun_def Replace_iff, blast)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   459
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   460
lemma RepFun_cong [cong]:
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   461
    "[| A=B;  !!x. x\<in>B ==> f(x)=g(x) |] ==> RepFun(A,f) = RepFun(B,g)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   462
by (simp add: RepFun_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   463
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   464
lemma RepFun_iff [simp]: "b \<in> {f(x). x\<in>A} <-> (\<exists>x\<in>A. b=f(x))"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   465
by (unfold Bex_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   466
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   467
lemma triv_RepFun [simp]: "{x. x\<in>A} = A"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   468
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   469
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   470
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   471
subsection\<open>Rules for Collect -- forming a subset by separation\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   472
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   473
(*Separation is derivable from Replacement*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   474
lemma separation [simp]: "a \<in> {x\<in>A. P(x)} <-> a\<in>A & P(a)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   475
by (unfold Collect_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   476
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   477
lemma CollectI [intro!]: "[| a\<in>A;  P(a) |] ==> a \<in> {x\<in>A. P(x)}"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   478
by simp
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   479
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   480
lemma CollectE [elim!]: "[| a \<in> {x\<in>A. P(x)};  [| a\<in>A; P(a) |] ==> R |] ==> R"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   481
by simp
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   482
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   483
lemma CollectD1: "a \<in> {x\<in>A. P(x)} ==> a\<in>A"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   484
by (erule CollectE, assumption)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   485
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   486
lemma CollectD2: "a \<in> {x\<in>A. P(x)} ==> P(a)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   487
by (erule CollectE, assumption)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   488
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   489
lemma Collect_cong [cong]:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   490
    "[| A=B;  !!x. x\<in>B ==> P(x) <-> Q(x) |]
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   491
     ==> Collect(A, %x. P(x)) = Collect(B, %x. Q(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   492
by (simp add: Collect_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   493
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   494
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   495
subsection\<open>Rules for Unions\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   496
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   497
declare Union_iff [simp]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   498
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   499
(*The order of the premises presupposes that C is rigid; A may be flexible*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   500
lemma UnionI [intro]: "[| B: C;  A: B |] ==> A: \<Union>(C)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   501
by (simp, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   502
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   503
lemma UnionE [elim!]: "[| A \<in> \<Union>(C);  !!B.[| A: B;  B: C |] ==> R |] ==> R"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   504
by (simp, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   505
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   506
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   507
subsection\<open>Rules for Unions of families\<close>
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   508
(* @{term"\<Union>x\<in>A. B(x)"} abbreviates @{term"\<Union>({B(x). x\<in>A})"} *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   509
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   510
lemma UN_iff [simp]: "b \<in> (\<Union>x\<in>A. B(x)) <-> (\<exists>x\<in>A. b \<in> B(x))"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   511
by (simp add: Bex_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   512
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   513
(*The order of the premises presupposes that A is rigid; b may be flexible*)
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   514
lemma UN_I: "[| a: A;  b: B(a) |] ==> b: (\<Union>x\<in>A. B(x))"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   515
by (simp, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   516
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   517
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   518
lemma UN_E [elim!]:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   519
    "[| b \<in> (\<Union>x\<in>A. B(x));  !!x.[| x: A;  b: B(x) |] ==> R |] ==> R"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   520
by blast
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   521
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   522
lemma UN_cong:
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   523
    "[| A=B;  !!x. x\<in>B ==> C(x)=D(x) |] ==> (\<Union>x\<in>A. C(x)) = (\<Union>x\<in>B. D(x))"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   524
by simp
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   525
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   526
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   527
(*No "Addcongs [UN_cong]" because @{term\<Union>} is a combination of constants*)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   528
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   529
(* UN_E appears before UnionE so that it is tried first, to avoid expensive
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   530
  calls to hyp_subst_tac.  Cannot include UN_I as it is unsafe: would enlarge
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   531
  the search space.*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   532
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   533
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   534
subsection\<open>Rules for the empty set\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   535
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   536
(*The set @{term"{x\<in>0. False}"} is empty; by foundation it equals 0
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   537
  See Suppes, page 21.*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   538
lemma not_mem_empty [simp]: "a \<notin> 0"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   539
apply (cut_tac foundation)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   540
apply (best dest: equalityD2)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   541
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   542
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 44147
diff changeset
   543
lemmas emptyE [elim!] = not_mem_empty [THEN notE]
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   544
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   545
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   546
lemma empty_subsetI [simp]: "0 \<subseteq> A"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   547
by blast
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   548
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   549
lemma equals0I: "[| !!y. y\<in>A ==> False |] ==> A=0"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   550
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   551
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   552
lemma equals0D [dest]: "A=0 ==> a \<notin> A"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   553
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   554
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   555
declare sym [THEN equals0D, dest]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   556
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   557
lemma not_emptyI: "a\<in>A ==> A \<noteq> 0"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   558
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   559
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   560
lemma not_emptyE:  "[| A \<noteq> 0;  !!x. x\<in>A ==> R |] ==> R"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   561
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   562
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   563
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   564
subsection\<open>Rules for Inter\<close>
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   565
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   566
(*Not obviously useful for proving InterI, InterD, InterE*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   567
lemma Inter_iff: "A \<in> \<Inter>(C) <-> (\<forall>x\<in>C. A: x) & C\<noteq>0"
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   568
by (simp add: Inter_def Ball_def, blast)
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   569
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   570
(* Intersection is well-behaved only if the family is non-empty! *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   571
lemma InterI [intro!]:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   572
    "[| !!x. x: C ==> A: x;  C\<noteq>0 |] ==> A \<in> \<Inter>(C)"
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   573
by (simp add: Inter_iff)
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   574
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   575
(*A "destruct" rule -- every B in C contains A as an element, but
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   576
  A\<in>B can hold when B\<in>C does not!  This rule is analogous to "spec". *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   577
lemma InterD [elim, Pure.elim]: "[| A \<in> \<Inter>(C);  B \<in> C |] ==> A \<in> B"
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   578
by (unfold Inter_def, blast)
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   579
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   580
(*"Classical" elimination rule -- does not require exhibiting @{term"B\<in>C"} *)
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   581
lemma InterE [elim]:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   582
    "[| A \<in> \<Inter>(C);  B\<notin>C ==> R;  A\<in>B ==> R |] ==> R"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   583
by (simp add: Inter_def, blast)
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   584
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   585
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   586
subsection\<open>Rules for Intersections of families\<close>
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   587
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   588
(* @{term"\<Inter>x\<in>A. B(x)"} abbreviates @{term"\<Inter>({B(x). x\<in>A})"} *)
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   589
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   590
lemma INT_iff: "b \<in> (\<Inter>x\<in>A. B(x)) <-> (\<forall>x\<in>A. b \<in> B(x)) & A\<noteq>0"
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   591
by (force simp add: Inter_def)
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   592
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   593
lemma INT_I: "[| !!x. x: A ==> b: B(x);  A\<noteq>0 |] ==> b: (\<Inter>x\<in>A. B(x))"
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   594
by blast
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   595
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   596
lemma INT_E: "[| b \<in> (\<Inter>x\<in>A. B(x));  a: A |] ==> b \<in> B(a)"
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   597
by blast
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   598
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   599
lemma INT_cong:
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   600
    "[| A=B;  !!x. x\<in>B ==> C(x)=D(x) |] ==> (\<Inter>x\<in>A. C(x)) = (\<Inter>x\<in>B. D(x))"
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   601
by simp
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   602
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   603
(*No "Addcongs [INT_cong]" because @{term\<Inter>} is a combination of constants*)
14095
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   604
a1ba833d6b61 Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
paulson
parents: 14076
diff changeset
   605
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   606
subsection\<open>Rules for Powersets\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   607
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   608
lemma PowI: "A \<subseteq> B ==> A \<in> Pow(B)"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   609
by (erule Pow_iff [THEN iffD2])
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   610
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   611
lemma PowD: "A \<in> Pow(B)  ==>  A<=B"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   612
by (erule Pow_iff [THEN iffD1])
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   613
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   614
declare Pow_iff [iff]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   615
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
   616
lemmas Pow_bottom = empty_subsetI [THEN PowI]    \<comment>\<open>@{term"0 \<in> Pow(B)"}\<close>
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61378
diff changeset
   617
lemmas Pow_top = subset_refl [THEN PowI]         \<comment>\<open>@{term"A \<in> Pow(A)"}\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   618
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   619
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   620
subsection\<open>Cantor's Theorem: There is no surjection from a set to its powerset.\<close>
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   621
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   622
(*The search is undirected.  Allowing redundant introduction rules may
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   623
  make it diverge.  Variable b represents ANY map, such as
14227
0356666744ec finalconsts
paulson
parents: 14095
diff changeset
   624
  (lam x\<in>A.b(x)): A->Pow(A). *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   625
lemma cantor: "\<exists>S \<in> Pow(A). \<forall>x\<in>A. b(x) \<noteq> S"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   626
by (best elim!: equalityCE del: ReplaceI RepFun_eqI)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   627
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   628
end