src/ZF/ZF.thy
author paulson
Wed, 15 Jan 2003 16:45:32 +0100
changeset 13780 af7b79271364
parent 13175 81082cfa5618
child 14076 5cfc8b9fb880
permissions -rw-r--r--
more new-style theories
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
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author:     Lawrence C Paulson and Martin D Coen, CU Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Zermelo-Fraenkel Set Theory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
     9
theory ZF = FOL:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
3906
5ae0e1324c56 global;
wenzelm
parents: 3840
diff changeset
    11
global
5ae0e1324c56 global;
wenzelm
parents: 3840
diff changeset
    12
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    13
typedecl
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
    14
  i
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
arities
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    17
  i :: "term"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
consts
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    21
  "0"         :: "i"                  ("0")   (*the empty set*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    22
  Pow         :: "i => i"                     (*power sets*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    23
  Inf         :: "i"                          (*infinite set*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
  (* Bounded Quantifiers *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    26
  Ball   :: "[i, i => o] => o"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    27
  Bex   :: "[i, i => o] => o"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
  (* General Union and Intersection *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    30
  Union :: "i => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    31
  Inter :: "i => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
  (* Variations on Replacement *)
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    34
  PrimReplace :: "[i, [i, i] => o] => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    35
  Replace     :: "[i, [i, i] => o] => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    36
  RepFun      :: "[i, i => i] => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    37
  Collect     :: "[i, i => o] => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
  (* Descriptions *)
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
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    43
syntax
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    44
  old_if      :: "[o, i, i] => i"   ("if '(_,_,_')")
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
6068
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    46
translations
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    47
  "if(P,a,b)" => "If(P,a,b)"
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    48
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    49
2d8f3e1f1151 if-then-else syntax for ZF
paulson
parents: 3940
diff changeset
    50
consts
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    51
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
  (* Finite Sets *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    53
  Upair :: "[i, i] => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    54
  cons  :: "[i, i] => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    55
  succ  :: "i => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
    57
  (* Ordered Pairing *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    58
  Pair  :: "[i, i] => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    59
  fst   :: "i => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    60
  snd   :: "i => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    61
  split :: "[[i, i] => 'a, i] => 'a::logic"  (*for pattern-matching*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
  (* Sigma and Pi Operators *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    64
  Sigma :: "[i, i => i] => i"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    65
  Pi    :: "[i, i => i] => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
  (* Relations and Functions *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    69
  "domain"      :: "i => i"
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    70
  range       :: "i => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    71
  field       :: "i => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    72
  converse    :: "i => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    73
  relation    :: "i => o"         (*recognizes sets of pairs*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    74
  function    :: "i => o"         (*recognizes functions; can have non-pairs*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    75
  Lambda      :: "[i, i => i] => i"
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    76
  restrict    :: "[i, i] => i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    78
  (* Infixes in order of decreasing precedence *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    79
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    80
  "``"        :: "[i, i] => i"    (infixl 90) (*image*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    81
  "-``"       :: "[i, i] => i"    (infixl 90) (*inverse image*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    82
  "`"         :: "[i, i] => i"    (infixl 90) (*function application*)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    83
(*"*"         :: "[i, i] => i"    (infixr 80) [virtual] Cartesian product*)
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    84
  "Int"       :: "[i, i] => i"    (infixl 70) (*binary intersection*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    85
  "Un"        :: "[i, i] => i"    (infixl 65) (*binary union*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    86
  "-"         :: "[i, i] => i"    (infixl 65) (*set difference*)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    87
(*"->"        :: "[i, i] => i"    (infixr 60) [virtual] function spac\<epsilon>*)
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    88
  "<="        :: "[i, i] => o"    (infixl 50) (*subset relation*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    89
  ":"         :: "[i, i] => o"    (infixl 50) (*membership relation*)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    90
(*"~:"        :: "[i, i] => o"    (infixl 50) (*negated membership relation*)*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    91
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
    93
nonterminals "is" patterns
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
    94
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
    95
syntax
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    96
  ""          :: "i => is"                   ("_")
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    97
  "@Enum"     :: "[i, is] => is"             ("_,/ _")
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    98
  "~:"        :: "[i, i] => o"               (infixl 50)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
    99
  "@Finset"   :: "is => i"                   ("{(_)}")
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   100
  "@Tuple"    :: "[i, is] => i"              ("<(_,/ _)>")
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   101
  "@Collect"  :: "[pttrn, i, o] => i"        ("(1{_: _ ./ _})")
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   102
  "@Replace"  :: "[pttrn, pttrn, i, o] => i" ("(1{_ ./ _: _, _})")
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   103
  "@RepFun"   :: "[i, pttrn, i] => i"        ("(1{_ ./ _: _})" [51,0,51])
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   104
  "@INTER"    :: "[pttrn, i, i] => i"        ("(3INT _:_./ _)" 10)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   105
  "@UNION"    :: "[pttrn, i, i] => i"        ("(3UN _:_./ _)" 10)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   106
  "@PROD"     :: "[pttrn, i, i] => i"        ("(3PROD _:_./ _)" 10)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   107
  "@SUM"      :: "[pttrn, i, i] => i"        ("(3SUM _:_./ _)" 10)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   108
  "->"        :: "[i, i] => i"               (infixr 60)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   109
  "*"         :: "[i, i] => i"               (infixr 80)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   110
  "@lam"      :: "[pttrn, i, i] => i"        ("(3lam _:_./ _)" 10)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   111
  "@Ball"     :: "[pttrn, i, o] => o"        ("(3ALL _:_./ _)" 10)
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   112
  "@Bex"      :: "[pttrn, i, o] => o"        ("(3EX _:_./ _)" 10)
1106
62bdb9e5722b Added pattern-matching code from CHOL/Prod.thy. Changed
lcp
parents: 690
diff changeset
   113
62bdb9e5722b Added pattern-matching code from CHOL/Prod.thy. Changed
lcp
parents: 690
diff changeset
   114
  (** Patterns -- extends pre-defined type "pttrn" used in abstractions **)
62bdb9e5722b Added pattern-matching code from CHOL/Prod.thy. Changed
lcp
parents: 690
diff changeset
   115
13144
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   116
  "@pattern"  :: "patterns => pttrn"         ("<_>")
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   117
  ""          :: "pttrn => patterns"         ("_")
c5ae1522fb82 quotes around types
paulson
parents: 13121
diff changeset
   118
  "@patterns" :: "[pttrn, patterns] => patterns"  ("_,/_")
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   119
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   120
translations
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   121
  "x ~: y"      == "~ (x : y)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   122
  "{x, xs}"     == "cons(x, {xs})"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   123
  "{x}"         == "cons(x, 0)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   124
  "{x:A. P}"    == "Collect(A, %x. P)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
  "{y. x:A, Q}" == "Replace(A, %x y. Q)"
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   126
  "{b. x:A}"    == "RepFun(A, %x. b)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   127
  "INT x:A. B"  == "Inter({B. x:A})"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
  "UN x:A. B"   == "Union({B. x:A})"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   129
  "PROD x:A. B" => "Pi(A, %x. B)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
  "SUM x:A. B"  => "Sigma(A, %x. B)"
49
c78503b345c4 "The" now a binder, removed translation;
wenzelm
parents: 37
diff changeset
   131
  "A -> B"      => "Pi(A, _K(B))"
c78503b345c4 "The" now a binder, removed translation;
wenzelm
parents: 37
diff changeset
   132
  "A * B"       => "Sigma(A, _K(B))"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
  "lam x:A. f"  == "Lambda(A, %x. f)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
  "ALL x:A. P"  == "Ball(A, %x. P)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   135
  "EX x:A. P"   == "Bex(A, %x. P)"
37
cebe01deba80 added ~: for "not in"
lcp
parents: 0
diff changeset
   136
1106
62bdb9e5722b Added pattern-matching code from CHOL/Prod.thy. Changed
lcp
parents: 690
diff changeset
   137
  "<x, y, z>"   == "<x, <y, z>>"
62bdb9e5722b Added pattern-matching code from CHOL/Prod.thy. Changed
lcp
parents: 690
diff changeset
   138
  "<x, y>"      == "Pair(x, y)"
2286
c2f76a5bad65 removed out-dated comment;
wenzelm
parents: 1478
diff changeset
   139
  "%<x,y,zs>.b" == "split(%x <y,zs>.b)"
3840
e0baea4d485a fixed dots;
wenzelm
parents: 3692
diff changeset
   140
  "%<x,y>.b"    == "split(%x y. b)"
2286
c2f76a5bad65 removed out-dated comment;
wenzelm
parents: 1478
diff changeset
   141
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   142
12114
a8e860c86252 eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents: 11322
diff changeset
   143
syntax (xsymbols)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   144
  "op *"      :: "[i, i] => i"               (infixr "\<times>" 80)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   145
  "op Int"    :: "[i, i] => i"    	     (infixl "\<inter>" 70)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   146
  "op Un"     :: "[i, i] => i"    	     (infixl "\<union>" 65)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   147
  "op ->"     :: "[i, i] => i"               (infixr "\<rightarrow>" 60)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   148
  "op <="     :: "[i, i] => o"    	     (infixl "\<subseteq>" 50)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   149
  "op :"      :: "[i, i] => o"    	     (infixl "\<in>" 50)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   150
  "op ~:"     :: "[i, i] => o"               (infixl "\<notin>" 50)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   151
  "@Collect"  :: "[pttrn, i, o] => i"        ("(1{_ \<in> _ ./ _})")
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   152
  "@Replace"  :: "[pttrn, pttrn, i, o] => i" ("(1{_ ./ _ \<in> _, _})")
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   153
  "@RepFun"   :: "[i, pttrn, i] => i"        ("(1{_ ./ _ \<in> _})" [51,0,51])
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   154
  "@UNION"    :: "[pttrn, i, i] => i"        ("(3\<Union>_\<in>_./ _)" 10)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   155
  "@INTER"    :: "[pttrn, i, i] => i"        ("(3\<Inter>_\<in>_./ _)" 10)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   156
  Union       :: "i =>i"                     ("\<Union>_" [90] 90)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   157
  Inter       :: "i =>i"                     ("\<Inter>_" [90] 90)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   158
  "@PROD"     :: "[pttrn, i, i] => i"        ("(3\<Pi>_\<in>_./ _)" 10)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   159
  "@SUM"      :: "[pttrn, i, i] => i"        ("(3\<Sigma>_\<in>_./ _)" 10)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   160
  "@lam"      :: "[pttrn, i, i] => i"        ("(3\<lambda>_\<in>_./ _)" 10)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   161
  "@Ball"     :: "[pttrn, i, o] => o"        ("(3\<forall>_\<in>_./ _)" 10)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   162
  "@Bex"      :: "[pttrn, i, o] => o"        ("(3\<exists>_\<in>_./ _)" 10)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   163
  "@Tuple"    :: "[i, is] => i"              ("\<langle>(_,/ _)\<rangle>")
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   164
  "@pattern"  :: "patterns => pttrn"         ("\<langle>_\<rangle>")
2540
ba8311047f18 added symbols syntax;
wenzelm
parents: 2469
diff changeset
   165
6340
7d5cbd5819a0 HTML output;
wenzelm
parents: 6068
diff changeset
   166
syntax (HTML output)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   167
  "op *"      :: "[i, i] => i"               (infixr "\<times>" 80)
6340
7d5cbd5819a0 HTML output;
wenzelm
parents: 6068
diff changeset
   168
2540
ba8311047f18 added symbols syntax;
wenzelm
parents: 2469
diff changeset
   169
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   170
defs 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   171
(*don't try to use constdefs: the declaration order is tightly constrained*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   172
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   173
  (* Bounded Quantifiers *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   174
  Ball_def:      "Ball(A, P) == ALL x. x:A --> P(x)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   175
  Bex_def:       "Bex(A, P) == EX x. x:A & P(x)"
690
b2bd1d5a3d16 ZF: NEW DEFINITION OF PI(A,B)
lcp
parents: 675
diff changeset
   176
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   177
  subset_def:    "A <= B == ALL x:A. x:B"
690
b2bd1d5a3d16 ZF: NEW DEFINITION OF PI(A,B)
lcp
parents: 675
diff changeset
   178
3906
5ae0e1324c56 global;
wenzelm
parents: 3840
diff changeset
   179
3940
wenzelm
parents: 3906
diff changeset
   180
local
3906
5ae0e1324c56 global;
wenzelm
parents: 3840
diff changeset
   181
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   182
axioms
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   184
  (* ZF axioms -- see Suppes p.238
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   185
     Axioms for Union, Pow and Replace state existence only,
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   186
     uniqueness is derivable using extensionality. *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   187
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   188
  extension:     "A = B <-> A <= B & B <= A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   189
  Union_iff:     "A : Union(C) <-> (EX B:C. A:B)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   190
  Pow_iff:       "A : Pow(B) <-> A <= B"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   191
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   192
  (*We may name this set, though it is not uniquely defined.*)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   193
  infinity:      "0:Inf & (ALL y:Inf. succ(y): Inf)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   194
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   195
  (*This formulation facilitates case analysis on A.*)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   196
  foundation:    "A=0 | (EX x:A. ALL y:x. y~:A)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   197
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   198
  (*Schema axiom since predicate P is a higher-order variable*)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   199
  replacement:   "(ALL x:A. ALL y z. P(x,y) & P(x,z) --> y=z) ==>
1155
928a16e02f9f removed \...\ inside strings
clasohm
parents: 1116
diff changeset
   200
                         b : PrimReplace(A,P) <-> (EX x:A. P(x,b))"
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   201
690
b2bd1d5a3d16 ZF: NEW DEFINITION OF PI(A,B)
lcp
parents: 675
diff changeset
   202
defs
b2bd1d5a3d16 ZF: NEW DEFINITION OF PI(A,B)
lcp
parents: 675
diff changeset
   203
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   204
  (* Derived form of replacement, restricting P to its functional part.
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   205
     The resulting set (for functional P) is the same as with
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   206
     PrimReplace, but the rules are simpler. *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   207
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   208
  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
   209
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   210
  (* Functional form of replacement -- analgous to ML's map functional *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   211
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   212
  RepFun_def:   "RepFun(A,f) == {y . x:A, y=f(x)}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   213
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   214
  (* Separation and Pairing can be derived from the Replacement
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   215
     and Powerset Axioms using the following definitions. *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   216
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   217
  Collect_def:  "Collect(A,P) == {y . x:A, x=y & P(x)}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   218
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   219
  (*Unordered pairs (Upair) express binary union/intersection and cons;
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   220
    set enumerations translate as {a,...,z} = cons(a,...,cons(z,0)...)*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   221
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   222
  Upair_def: "Upair(a,b) == {y. x:Pow(Pow(0)), (x=0 & y=a) | (x=Pow(0) & y=b)}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   223
  cons_def:  "cons(a,A) == Upair(a,a) Un A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   224
  succ_def:  "succ(i) == cons(i, i)"
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   225
2872
ac81a17f86f8 Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
paulson
parents: 2540
diff changeset
   226
  (* 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
   227
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   228
  Diff_def:      "A - B    == { x:A . ~(x:B) }"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   229
  Inter_def:     "Inter(A) == { x:Union(A) . ALL y:A. x:y}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   230
  Un_def:        "A Un  B  == Union(Upair(A,B))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   231
  Int_def:      "A Int B  == Inter(Upair(A,B))"
2872
ac81a17f86f8 Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
paulson
parents: 2540
diff changeset
   232
ac81a17f86f8 Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
paulson
parents: 2540
diff changeset
   233
  (* Definite descriptions -- via Replace over the set "1" *)
ac81a17f86f8 Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
paulson
parents: 2540
diff changeset
   234
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   235
  the_def:      "The(P)    == Union({y . x:{0}, P(y)})"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   236
  if_def:       "if(P,a,b) == THE z. P & z=a | ~P & z=b"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   237
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   238
  (* this "symmetric" definition works better than {{a}, {a,b}} *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   239
  Pair_def:     "<a,b>  == {{a,a}, {a,b}}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   240
  fst_def:      "fst(p) == THE a. EX b. p=<a,b>"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   241
  snd_def:      "snd(p) == THE b. EX a. p=<a,b>"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   242
  split_def:    "split(c) == %p. c(fst(p), snd(p))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   243
  Sigma_def:    "Sigma(A,B) == UN x:A. UN y:B(x). {<x,y>}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   244
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   245
  (* Operations on relations *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   246
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   247
  (*converse of relation r, inverse of function*)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   248
  converse_def: "converse(r) == {z. w:r, EX x y. w=<x,y> & z=<y,x>}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   250
  domain_def:   "domain(r) == {x. w:r, EX y. w=<x,y>}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   251
  range_def:    "range(r) == domain(converse(r))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   252
  field_def:    "field(r) == domain(r) Un range(r)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   253
  relation_def: "relation(r) == ALL z:r. EX x y. z = <x,y>"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   254
  function_def: "function(r) ==
13121
4888694b2829 the new predicate "relation"
paulson
parents: 13108
diff changeset
   255
		    ALL x y. <x,y>:r --> (ALL y'. <x,y'>:r --> y=y')"
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   256
  image_def:    "r `` A  == {y : range(r) . EX x:A. <x,y> : r}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   257
  vimage_def:   "r -`` A == converse(r)``A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   258
615
84ac5f101bd1 minor cleanup, added 'syntax' section;
wenzelm
parents: 516
diff changeset
   259
  (* Abstraction, application and Cartesian product of a family of sets *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   260
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   261
  lam_def:      "Lambda(A,b) == {<x,b(x)> . x:A}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   262
  apply_def:    "f`a == Union(f``{a})"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   263
  Pi_def:       "Pi(A,B)  == {f: Pow(Sigma(A,B)). A<=domain(f) & function(f)}"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   264
12891
92af5c3a10fb a new definition of "restrict"
paulson
parents: 12762
diff changeset
   265
  (* Restrict the relation r to the domain A *)
13780
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   266
  restrict_def: "restrict(r,A) == {z : r. EX x:A. EX y. z = <x,y>}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   267
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   268
(* Pattern-matching and 'Dependent' type operators *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   269
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   270
print_translation {*
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   271
  [("Pi",    dependent_tr' ("@PROD", "op ->")),
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   272
   ("Sigma", dependent_tr' ("@SUM", "op *"))];
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   273
*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   274
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   275
subsection {* Substitution*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   276
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   277
(*Useful examples:  singletonI RS subst_elem,  subst_elem RSN (2,IntI) *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   278
lemma subst_elem: "[| b:A;  a=b |] ==> a:A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   279
by (erule ssubst, assumption)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   280
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   281
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   282
subsection{*Bounded universal quantifier*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   283
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   284
lemma ballI [intro!]: "[| !!x. x:A ==> P(x) |] ==> ALL x:A. P(x)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   285
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   286
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   287
lemma bspec [dest?]: "[| ALL x:A. P(x);  x: A |] ==> P(x)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   288
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   289
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   290
(*Instantiates x first: better for automatic theorem proving?*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   291
lemma rev_ballE [elim]: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   292
    "[| ALL x:A. P(x);  x~:A ==> Q;  P(x) ==> Q |] ==> Q"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   293
by (simp add: Ball_def, blast) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   294
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   295
lemma ballE: "[| ALL x:A. P(x);  P(x) ==> Q;  x~:A ==> Q |] ==> Q"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   296
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   297
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   298
(*Used in the datatype package*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   299
lemma rev_bspec: "[| x: A;  ALL x:A. P(x) |] ==> P(x)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   300
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   301
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   302
(*Trival rewrite rule;   (ALL x:A.P)<->P holds only if A is nonempty!*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   303
lemma ball_triv [simp]: "(ALL x:A. P) <-> ((EX x. x:A) --> P)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   304
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   305
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   306
(*Congruence rule for rewriting*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   307
lemma ball_cong [cong]:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   308
    "[| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] ==> (ALL x:A. P(x)) <-> (ALL x:A'. P'(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   309
by (simp add: Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   310
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   311
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   312
subsection{*Bounded existential quantifier*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   313
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   314
lemma bexI [intro]: "[| P(x);  x: A |] ==> EX x:A. P(x)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   315
by (simp add: Bex_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   316
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   317
(*The best argument order when there is only one x:A*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   318
lemma rev_bexI: "[| x:A;  P(x) |] ==> EX x:A. P(x)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   319
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   320
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   321
(*Not of the general form for such rules; ~EX has become ALL~ *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   322
lemma bexCI: "[| ALL x:A. ~P(x) ==> P(a);  a: A |] ==> EX x:A. P(x)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   323
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   324
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   325
lemma bexE [elim!]: "[| EX x:A. P(x);  !!x. [| x:A; P(x) |] ==> Q |] ==> Q"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   326
by (simp add: Bex_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   327
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   328
(*We do not even have (EX x:A. True) <-> True unless A is nonempty!!*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   329
lemma bex_triv [simp]: "(EX x:A. P) <-> ((EX x. x:A) & P)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   330
by (simp add: Bex_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   331
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   332
lemma bex_cong [cong]:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   333
    "[| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   334
     ==> (EX x:A. P(x)) <-> (EX x:A'. P'(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   335
by (simp add: Bex_def cong: conj_cong)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   336
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   337
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   338
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   339
subsection{*Rules for subsets*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   340
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   341
lemma subsetI [intro!]:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   342
    "(!!x. x:A ==> x:B) ==> A <= B"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   343
by (simp add: subset_def) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   344
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   345
(*Rule in Modus Ponens style [was called subsetE] *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   346
lemma subsetD [elim]: "[| A <= B;  c:A |] ==> c:B"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   347
apply (unfold subset_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   348
apply (erule bspec, assumption)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   349
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   350
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   351
(*Classical elimination rule*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   352
lemma subsetCE [elim]:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   353
    "[| A <= B;  c~:A ==> P;  c:B ==> P |] ==> P"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   354
by (simp add: subset_def, blast) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   355
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   356
(*Sometimes useful with premises in this order*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   357
lemma rev_subsetD: "[| c:A; A<=B |] ==> c:B"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   358
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   359
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   360
lemma contra_subsetD: "[| A <= B; c ~: B |] ==> c ~: A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   361
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   362
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   363
lemma rev_contra_subsetD: "[| c ~: B;  A <= B |] ==> c ~: A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   364
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   365
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   366
lemma subset_refl [simp]: "A <= A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   367
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   368
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   369
lemma subset_trans: "[| A<=B;  B<=C |] ==> A<=C"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   370
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   371
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   372
(*Useful for proving A<=B by rewriting in some cases*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   373
lemma subset_iff: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   374
     "A<=B <-> (ALL x. x:A --> x:B)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   375
apply (unfold subset_def Ball_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   376
apply (rule iff_refl)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   377
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   378
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   379
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   380
subsection{*Rules for equality*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   381
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   382
(*Anti-symmetry of the subset relation*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   383
lemma equalityI [intro]: "[| A <= B;  B <= A |] ==> A = B"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   384
by (rule extension [THEN iffD2], rule conjI) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   385
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   386
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   387
lemma equality_iffI: "(!!x. x:A <-> x:B) ==> A = B"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   388
by (rule equalityI, blast+)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   389
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   390
lemmas equalityD1 = extension [THEN iffD1, THEN conjunct1, standard]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   391
lemmas equalityD2 = extension [THEN iffD1, THEN conjunct2, standard]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   392
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   393
lemma equalityE: "[| A = B;  [| A<=B; B<=A |] ==> P |]  ==>  P"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   394
by (blast dest: equalityD1 equalityD2) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   395
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   396
lemma equalityCE:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   397
    "[| A = B;  [| c:A; c:B |] ==> P;  [| c~:A; c~:B |] ==> P |]  ==>  P"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   398
by (erule equalityE, blast) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   399
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   400
(*Lemma for creating induction formulae -- for "pattern matching" on p
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   401
  To make the induction hypotheses usable, apply "spec" or "bspec" to
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   402
  put universal quantifiers over the free variables in p. 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   403
  Would it be better to do subgoal_tac "ALL z. p = f(z) --> R(z)" ??*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   404
lemma setup_induction: "[| p: A;  !!z. z: A ==> p=z --> R |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   405
by auto 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   406
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   407
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   408
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   409
subsection{*Rules for Replace -- the derived form of replacement*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   410
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   411
lemma Replace_iff: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   412
    "b : {y. x:A, P(x,y)}  <->  (EX x:A. P(x,b) & (ALL y. P(x,y) --> y=b))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   413
apply (unfold Replace_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   414
apply (rule replacement [THEN iff_trans], blast+)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   415
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   416
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   417
(*Introduction; there must be a unique y such that P(x,y), namely y=b. *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   418
lemma ReplaceI [intro]: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   419
    "[| P(x,b);  x: A;  !!y. P(x,y) ==> y=b |] ==>  
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   420
     b : {y. x:A, P(x,y)}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   421
by (rule Replace_iff [THEN iffD2], blast) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   422
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   423
(*Elimination; may asssume there is a unique y such that P(x,y), namely y=b. *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   424
lemma ReplaceE: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   425
    "[| b : {y. x:A, P(x,y)};   
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   426
        !!x. [| x: A;  P(x,b);  ALL y. P(x,y)-->y=b |] ==> R  
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   427
     |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   428
by (rule Replace_iff [THEN iffD1, THEN bexE], simp+)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   429
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   430
(*As above but without the (generally useless) 3rd assumption*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   431
lemma ReplaceE2 [elim!]: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   432
    "[| b : {y. x:A, P(x,y)};   
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   433
        !!x. [| x: A;  P(x,b) |] ==> R  
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   434
     |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   435
by (erule ReplaceE, blast) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   436
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   437
lemma Replace_cong [cong]:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   438
    "[| A=B;  !!x y. x:B ==> P(x,y) <-> Q(x,y) |] ==>  
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   439
     Replace(A,P) = Replace(B,Q)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   440
apply (rule equality_iffI) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   441
apply (simp add: Replace_iff) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   442
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   443
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   444
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   445
subsection{*Rules for RepFun*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   446
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   447
lemma RepFunI: "a : A ==> f(a) : {f(x). x:A}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   448
by (simp add: RepFun_def Replace_iff, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   449
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   450
(*Useful for coinduction proofs*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   451
lemma RepFun_eqI [intro]: "[| b=f(a);  a : A |] ==> b : {f(x). x:A}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   452
apply (erule ssubst)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   453
apply (erule RepFunI)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   454
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   455
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   456
lemma RepFunE [elim!]:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   457
    "[| b : {f(x). x:A};   
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   458
        !!x.[| x:A;  b=f(x) |] ==> P |] ==>  
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   459
     P"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   460
by (simp add: RepFun_def Replace_iff, blast) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   461
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   462
lemma RepFun_cong [cong]: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   463
    "[| A=B;  !!x. x:B ==> f(x)=g(x) |] ==> RepFun(A,f) = RepFun(B,g)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   464
by (simp add: RepFun_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   465
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   466
lemma RepFun_iff [simp]: "b : {f(x). x:A} <-> (EX x:A. b=f(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   467
by (unfold Bex_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   468
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   469
lemma triv_RepFun [simp]: "{x. x:A} = A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   470
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   471
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   472
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   473
subsection{*Rules for Collect -- forming a subset by separation*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   474
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   475
(*Separation is derivable from Replacement*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   476
lemma separation [simp]: "a : {x:A. P(x)} <-> a:A & P(a)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   477
by (unfold Collect_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   478
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   479
lemma CollectI [intro!]: "[| a:A;  P(a) |] ==> a : {x:A. P(x)}"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   480
by simp
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   481
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   482
lemma CollectE [elim!]: "[| a : {x:A. P(x)};  [| a:A; P(a) |] ==> R |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   483
by simp
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   484
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   485
lemma CollectD1: "a : {x:A. P(x)} ==> a:A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   486
by (erule CollectE, assumption)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   487
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   488
lemma CollectD2: "a : {x:A. P(x)} ==> P(a)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   489
by (erule CollectE, assumption)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   490
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   491
lemma Collect_cong [cong]:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   492
    "[| A=B;  !!x. x:B ==> P(x) <-> Q(x) |]  
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   493
     ==> Collect(A, %x. P(x)) = Collect(B, %x. Q(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   494
by (simp add: Collect_def)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   495
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   496
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   497
subsection{*Rules for Unions*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   498
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   499
declare Union_iff [simp]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   500
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   501
(*The order of the premises presupposes that C is rigid; A may be flexible*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   502
lemma UnionI [intro]: "[| B: C;  A: B |] ==> A: Union(C)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   503
by (simp, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   504
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   505
lemma UnionE [elim!]: "[| A : Union(C);  !!B.[| A: B;  B: C |] ==> R |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   506
by (simp, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   507
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   508
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   509
subsection{*Rules for Unions of families*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   510
(* UN x:A. B(x) abbreviates Union({B(x). x:A}) *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   511
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   512
lemma UN_iff [simp]: "b : (UN x:A. B(x)) <-> (EX x:A. b : B(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   513
by (simp add: Bex_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   514
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   515
(*The order of the premises presupposes that A is rigid; b may be flexible*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   516
lemma UN_I: "[| a: A;  b: B(a) |] ==> b: (UN x:A. B(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   517
by (simp, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   518
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   519
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   520
lemma UN_E [elim!]: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   521
    "[| b : (UN x:A. B(x));  !!x.[| x: A;  b: B(x) |] ==> R |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   522
by blast 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   523
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   524
lemma UN_cong: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   525
    "[| A=B;  !!x. x:B ==> C(x)=D(x) |] ==> (UN x:A. C(x)) = (UN x:B. D(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   526
by simp 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   527
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   528
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   529
(*No "Addcongs [UN_cong]" because UN is a combination of constants*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   530
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   531
(* UN_E appears before UnionE so that it is tried first, to avoid expensive
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   532
  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
   533
  the search space.*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   534
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   535
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   536
subsection{*Rules for Inter*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   537
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   538
(*Not obviously useful for proving InterI, InterD, InterE*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   539
lemma Inter_iff:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   540
    "A : Inter(C) <-> (ALL x:C. A: x) & (EX x. x:C)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   541
by (simp add: Inter_def Ball_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   542
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   543
(* Intersection is well-behaved only if the family is non-empty! *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   544
lemma InterI [intro!]: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   545
    "[| !!x. x: C ==> A: x;  EX c. c:C |] ==> A : Inter(C)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   546
by (simp add: Inter_iff)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   547
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   548
(*A "destruct" rule -- every B in C contains A as an element, but
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   549
  A:B can hold when B:C does not!  This rule is analogous to "spec". *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   550
lemma InterD [elim]: "[| A : Inter(C);  B : C |] ==> A : B"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   551
by (unfold Inter_def, blast)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   552
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   553
(*"Classical" elimination rule -- does not require exhibiting B:C *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   554
lemma InterE [elim]: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   555
    "[| A : Inter(C);  B~:C ==> R;  A:B ==> R |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   556
by (simp add: Inter_def, blast) 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   557
  
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   558
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   559
subsection{*Rules for Intersections of families*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   560
(* INT x:A. B(x) abbreviates Inter({B(x). x:A}) *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   561
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   562
lemma INT_iff: "b : (INT x:A. B(x)) <-> (ALL x:A. b : B(x)) & (EX x. x:A)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   563
by (simp add: Inter_def, best)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   564
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   565
lemma INT_I: 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   566
    "[| !!x. x: A ==> b: B(x);  a: A |] ==> b: (INT x:A. B(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   567
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   568
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   569
lemma INT_E: "[| b : (INT x:A. B(x));  a: A |] ==> b : B(a)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   570
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   571
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   572
lemma INT_cong:
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   573
    "[| A=B;  !!x. x:B ==> C(x)=D(x) |] ==> (INT x:A. C(x)) = (INT x:B. D(x))"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   574
by simp
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   575
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   576
(*No "Addcongs [INT_cong]" because INT is a combination of constants*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   577
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   578
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   579
subsection{*Rules for the empty set*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   580
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   581
(*The set {x:0.False} is empty; by foundation it equals 0 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   582
  See Suppes, page 21.*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   583
lemma not_mem_empty [simp]: "a ~: 0"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   584
apply (cut_tac foundation)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   585
apply (best dest: equalityD2)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   586
done
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   587
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   588
lemmas emptyE [elim!] = not_mem_empty [THEN notE, standard]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   589
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   590
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   591
lemma empty_subsetI [simp]: "0 <= A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   592
by blast 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   593
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   594
lemma equals0I: "[| !!y. y:A ==> False |] ==> A=0"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   595
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   596
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   597
lemma equals0D [dest]: "A=0 ==> a ~: A"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   598
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   599
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   600
declare sym [THEN equals0D, dest]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   601
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   602
lemma not_emptyI: "a:A ==> A ~= 0"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   603
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   604
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   605
lemma not_emptyE:  "[| A ~= 0;  !!x. x:A ==> R |] ==> R"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   606
by blast
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   607
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   608
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   609
subsection{*Rules for Powersets*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   610
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   611
lemma PowI: "A <= B ==> A : Pow(B)"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   612
by (erule Pow_iff [THEN iffD2])
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   613
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   614
lemma PowD: "A : Pow(B)  ==>  A<=B"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   615
by (erule Pow_iff [THEN iffD1])
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   616
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   617
declare Pow_iff [iff]
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   618
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   619
lemmas Pow_bottom = empty_subsetI [THEN PowI] (* 0 : Pow(B) *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   620
lemmas Pow_top = subset_refl [THEN PowI] (* A : Pow(A) *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   621
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   622
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   623
subsection{*Cantor's Theorem: There is no surjection from a set to its powerset.*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   624
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   625
(*The search is undirected.  Allowing redundant introduction rules may 
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   626
  make it diverge.  Variable b represents ANY map, such as
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   627
  (lam x:A.b(x)): A->Pow(A). *)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   628
lemma cantor: "EX S: Pow(A). ALL x:A. b(x) ~= S"
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   629
by (best elim!: equalityCE del: ReplaceI RepFun_eqI)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   630
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   631
ML
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   632
{*
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   633
val lam_def = thm "lam_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   634
val domain_def = thm "domain_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   635
val range_def = thm "range_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   636
val image_def = thm "image_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   637
val vimage_def = thm "vimage_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   638
val field_def = thm "field_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   639
val Inter_def = thm "Inter_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   640
val Ball_def = thm "Ball_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   641
val Bex_def = thm "Bex_def";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   642
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   643
val ballI = thm "ballI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   644
val bspec = thm "bspec";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   645
val rev_ballE = thm "rev_ballE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   646
val ballE = thm "ballE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   647
val rev_bspec = thm "rev_bspec";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   648
val ball_triv = thm "ball_triv";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   649
val ball_cong = thm "ball_cong";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   650
val bexI = thm "bexI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   651
val rev_bexI = thm "rev_bexI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   652
val bexCI = thm "bexCI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   653
val bexE = thm "bexE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   654
val bex_triv = thm "bex_triv";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   655
val bex_cong = thm "bex_cong";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   656
val subst_elem = thm "subst_elem";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   657
val subsetI = thm "subsetI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   658
val subsetD = thm "subsetD";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   659
val subsetCE = thm "subsetCE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   660
val rev_subsetD = thm "rev_subsetD";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   661
val contra_subsetD = thm "contra_subsetD";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   662
val rev_contra_subsetD = thm "rev_contra_subsetD";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   663
val subset_refl = thm "subset_refl";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   664
val subset_trans = thm "subset_trans";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   665
val subset_iff = thm "subset_iff";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   666
val equalityI = thm "equalityI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   667
val equality_iffI = thm "equality_iffI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   668
val equalityD1 = thm "equalityD1";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   669
val equalityD2 = thm "equalityD2";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   670
val equalityE = thm "equalityE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   671
val equalityCE = thm "equalityCE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   672
val setup_induction = thm "setup_induction";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   673
val Replace_iff = thm "Replace_iff";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   674
val ReplaceI = thm "ReplaceI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   675
val ReplaceE = thm "ReplaceE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   676
val ReplaceE2 = thm "ReplaceE2";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   677
val Replace_cong = thm "Replace_cong";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   678
val RepFunI = thm "RepFunI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   679
val RepFun_eqI = thm "RepFun_eqI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   680
val RepFunE = thm "RepFunE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   681
val RepFun_cong = thm "RepFun_cong";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   682
val RepFun_iff = thm "RepFun_iff";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   683
val triv_RepFun = thm "triv_RepFun";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   684
val separation = thm "separation";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   685
val CollectI = thm "CollectI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   686
val CollectE = thm "CollectE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   687
val CollectD1 = thm "CollectD1";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   688
val CollectD2 = thm "CollectD2";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   689
val Collect_cong = thm "Collect_cong";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   690
val UnionI = thm "UnionI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   691
val UnionE = thm "UnionE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   692
val UN_iff = thm "UN_iff";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   693
val UN_I = thm "UN_I";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   694
val UN_E = thm "UN_E";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   695
val UN_cong = thm "UN_cong";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   696
val Inter_iff = thm "Inter_iff";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   697
val InterI = thm "InterI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   698
val InterD = thm "InterD";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   699
val InterE = thm "InterE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   700
val INT_iff = thm "INT_iff";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   701
val INT_I = thm "INT_I";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   702
val INT_E = thm "INT_E";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   703
val INT_cong = thm "INT_cong";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   704
val PowI = thm "PowI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   705
val PowD = thm "PowD";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   706
val Pow_bottom = thm "Pow_bottom";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   707
val Pow_top = thm "Pow_top";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   708
val not_mem_empty = thm "not_mem_empty";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   709
val emptyE = thm "emptyE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   710
val empty_subsetI = thm "empty_subsetI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   711
val equals0I = thm "equals0I";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   712
val equals0D = thm "equals0D";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   713
val not_emptyI = thm "not_emptyI";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   714
val not_emptyE = thm "not_emptyE";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   715
val cantor = thm "cantor";
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   716
*}
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   717
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   718
(*Functions for ML scripts*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   719
ML
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   720
{*
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   721
(*Converts A<=B to x:A ==> x:B*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   722
fun impOfSubs th = th RSN (2, rev_subsetD);
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   723
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   724
(*Takes assumptions ALL x:A.P(x) and a:A; creates assumption P(a)*)
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   725
val ball_tac = dtac bspec THEN' assume_tac
af7b79271364 more new-style theories
paulson
parents: 13175
diff changeset
   726
*}
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   727
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   728
end
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   729