src/HOL/ZF/HOLZF.thy
author blanchet
Fri, 31 Jan 2014 13:29:20 +0100
changeset 55206 f7358e55018f
parent 46752 e9e7209eb375
child 56073 29e308b56d23
permissions -rw-r--r--
tuning
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
     1
(*  Title:      HOL/ZF/HOLZF.thy
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
     2
    Author:     Steven Obua
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
     3
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
     4
Axiomatizes the ZFC universe as an HOL type.  See "Partizan Games in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
     5
Isabelle/HOLZF", available from http://www4.in.tum.de/~obua/partizan
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
     6
*)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
     7
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
     8
theory HOLZF 
35502
3d105282262e removed obsolete helper theory
krauss
parents: 35416
diff changeset
     9
imports Main
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    10
begin
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    11
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    12
typedecl ZF
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    13
22690
0b08f218f260 replaced axioms/finalconsts by proper axiomatization;
wenzelm
parents: 20565
diff changeset
    14
axiomatization
0b08f218f260 replaced axioms/finalconsts by proper axiomatization;
wenzelm
parents: 20565
diff changeset
    15
  Empty :: ZF and
0b08f218f260 replaced axioms/finalconsts by proper axiomatization;
wenzelm
parents: 20565
diff changeset
    16
  Elem :: "ZF \<Rightarrow> ZF \<Rightarrow> bool" and
0b08f218f260 replaced axioms/finalconsts by proper axiomatization;
wenzelm
parents: 20565
diff changeset
    17
  Sum :: "ZF \<Rightarrow> ZF" and
0b08f218f260 replaced axioms/finalconsts by proper axiomatization;
wenzelm
parents: 20565
diff changeset
    18
  Power :: "ZF \<Rightarrow> ZF" and
0b08f218f260 replaced axioms/finalconsts by proper axiomatization;
wenzelm
parents: 20565
diff changeset
    19
  Repl :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF) \<Rightarrow> ZF" and
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    20
  Inf :: ZF
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    21
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    22
definition Upair :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    23
  "Upair a b == Repl (Power (Power Empty)) (% x. if x = Empty then a else b)"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    24
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    25
definition Singleton:: "ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    26
  "Singleton x == Upair x x"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    27
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    28
definition union :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    29
  "union A B == Sum (Upair A B)"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    30
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    31
definition SucNat:: "ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    32
  "SucNat x == union x (Singleton x)"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    33
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    34
definition subset :: "ZF \<Rightarrow> ZF \<Rightarrow> bool" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    35
  "subset A B == ! x. Elem x A \<longrightarrow> Elem x B"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    36
45827
66c68453455c modernized specifications;
wenzelm
parents: 39302
diff changeset
    37
axiomatization where
66c68453455c modernized specifications;
wenzelm
parents: 39302
diff changeset
    38
  Empty: "Not (Elem x Empty)" and
66c68453455c modernized specifications;
wenzelm
parents: 39302
diff changeset
    39
  Ext: "(x = y) = (! z. Elem z x = Elem z y)" and
66c68453455c modernized specifications;
wenzelm
parents: 39302
diff changeset
    40
  Sum: "Elem z (Sum x) = (? y. Elem z y & Elem y x)" and
66c68453455c modernized specifications;
wenzelm
parents: 39302
diff changeset
    41
  Power: "Elem y (Power x) = (subset y x)" and
66c68453455c modernized specifications;
wenzelm
parents: 39302
diff changeset
    42
  Repl: "Elem b (Repl A f) = (? a. Elem a A & b = f a)" and
66c68453455c modernized specifications;
wenzelm
parents: 39302
diff changeset
    43
  Regularity: "A \<noteq> Empty \<longrightarrow> (? x. Elem x A & (! y. Elem y x \<longrightarrow> Not (Elem y A)))" and
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    44
  Infinity: "Elem Empty Inf & (! x. Elem x Inf \<longrightarrow> Elem (SucNat x) Inf)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    45
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    46
definition Sep :: "ZF \<Rightarrow> (ZF \<Rightarrow> bool) \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    47
  "Sep A p == (if (!x. Elem x A \<longrightarrow> Not (p x)) then Empty else 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    48
  (let z = (\<some> x. Elem x A & p x) in
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    49
   let f = % x. (if p x then x else z) in Repl A f))" 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    50
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    51
thm Power[unfolded subset_def]
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    52
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    53
theorem Sep: "Elem b (Sep A p) = (Elem b A & p b)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    54
  apply (auto simp add: Sep_def Empty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    55
  apply (auto simp add: Let_def Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    56
  apply (rule someI2, auto)+
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    57
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    58
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    59
lemma subset_empty: "subset Empty A"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    60
  by (simp add: subset_def Empty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    61
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    62
theorem Upair: "Elem x (Upair a b) = (x = a | x = b)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    63
  apply (auto simp add: Upair_def Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    64
  apply (rule exI[where x=Empty])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    65
  apply (simp add: Power subset_empty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    66
  apply (rule exI[where x="Power Empty"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    67
  apply (auto)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    68
  apply (auto simp add: Ext Power subset_def Empty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    69
  apply (drule spec[where x=Empty], simp add: Empty)+
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    70
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    71
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    72
lemma Singleton: "Elem x (Singleton y) = (x = y)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    73
  by (simp add: Singleton_def Upair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    74
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
    75
definition Opair :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    76
  "Opair a b == Upair (Upair a a) (Upair a b)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    77
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    78
lemma Upair_singleton: "(Upair a a = Upair c d) = (a = c & a = d)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    79
  by (auto simp add: Ext[where x="Upair a a"] Upair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    80
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    81
lemma Upair_fsteq: "(Upair a b = Upair a c) = ((a = b & a = c) | (b = c))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    82
  by (auto simp add: Ext[where x="Upair a b"] Upair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    83
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    84
lemma Upair_comm: "Upair a b = Upair b a"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    85
  by (auto simp add: Ext Upair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    86
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    87
theorem Opair: "(Opair a b = Opair c d) = (a = c & b = d)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    88
  proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    89
    have fst: "(Opair a b = Opair c d) \<Longrightarrow> a = c"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    90
      apply (simp add: Opair_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    91
      apply (simp add: Ext[where x="Upair (Upair a a) (Upair a b)"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    92
      apply (drule spec[where x="Upair a a"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    93
      apply (auto simp add: Upair Upair_singleton)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    94
      done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    95
    show ?thesis
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    96
      apply (auto)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    97
      apply (erule fst)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    98
      apply (frule fst)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
    99
      apply (auto simp add: Opair_def Upair_fsteq)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   100
      done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   101
  qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   102
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   103
definition Replacement :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF option) \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   104
  "Replacement A f == Repl (Sep A (% a. f a \<noteq> None)) (the o f)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   105
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   106
theorem Replacement: "Elem y (Replacement A f) = (? x. Elem x A & f x = Some y)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   107
  by (auto simp add: Replacement_def Repl Sep) 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   108
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   109
definition Fst :: "ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   110
  "Fst q == SOME x. ? y. q = Opair x y"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   111
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   112
definition Snd :: "ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   113
  "Snd q == SOME y. ? x. q = Opair x y"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   114
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   115
theorem Fst: "Fst (Opair x y) = x"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   116
  apply (simp add: Fst_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   117
  apply (rule someI2)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   118
  apply (simp_all add: Opair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   119
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   120
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   121
theorem Snd: "Snd (Opair x y) = y"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   122
  apply (simp add: Snd_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   123
  apply (rule someI2)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   124
  apply (simp_all add: Opair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   125
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   126
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   127
definition isOpair :: "ZF \<Rightarrow> bool" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   128
  "isOpair q == ? x y. q = Opair x y"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   129
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   130
lemma isOpair: "isOpair (Opair x y) = True"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   131
  by (auto simp add: isOpair_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   132
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   133
lemma FstSnd: "isOpair x \<Longrightarrow> Opair (Fst x) (Snd x) = x"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   134
  by (auto simp add: isOpair_def Fst Snd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   135
  
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   136
definition CartProd :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   137
  "CartProd A B == Sum(Repl A (% a. Repl B (% b. Opair a b)))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   138
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   139
lemma CartProd: "Elem x (CartProd A B) = (? a b. Elem a A & Elem b B & x = (Opair a b))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   140
  apply (auto simp add: CartProd_def Sum Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   141
  apply (rule_tac x="Repl B (Opair a)" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   142
  apply (auto simp add: Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   143
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   144
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   145
definition explode :: "ZF \<Rightarrow> ZF set" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   146
  "explode z == { x. Elem x z }"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   147
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   148
lemma explode_Empty: "(explode x = {}) = (x = Empty)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   149
  by (auto simp add: explode_def Ext Empty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   150
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   151
lemma explode_Elem: "(x \<in> explode X) = (Elem x X)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   152
  by (simp add: explode_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   153
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   154
lemma Elem_explode_in: "\<lbrakk> Elem a A; explode A \<subseteq> B\<rbrakk> \<Longrightarrow> a \<in> B"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   155
  by (auto simp add: explode_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   156
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   157
lemma explode_CartProd_eq: "explode (CartProd a b) = (% (x,y). Opair x y) ` ((explode a) \<times> (explode b))"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39246
diff changeset
   158
  by (simp add: explode_def set_eq_iff CartProd image_def)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   159
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   160
lemma explode_Repl_eq: "explode (Repl A f) = image f (explode A)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   161
  by (simp add: explode_def Repl image_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   162
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   163
definition Domain :: "ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   164
  "Domain f == Replacement f (% p. if isOpair p then Some (Fst p) else None)"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   165
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   166
definition Range :: "ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   167
  "Range f == Replacement f (% p. if isOpair p then Some (Snd p) else None)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   168
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   169
theorem Domain: "Elem x (Domain f) = (? y. Elem (Opair x y) f)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   170
  apply (auto simp add: Domain_def Replacement)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   171
  apply (rule_tac x="Snd x" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   172
  apply (simp add: FstSnd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   173
  apply (rule_tac x="Opair x y" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   174
  apply (simp add: isOpair Fst)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   175
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   176
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   177
theorem Range: "Elem y (Range f) = (? x. Elem (Opair x y) f)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   178
  apply (auto simp add: Range_def Replacement)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   179
  apply (rule_tac x="Fst x" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   180
  apply (simp add: FstSnd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   181
  apply (rule_tac x="Opair x y" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   182
  apply (simp add: isOpair Snd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   183
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   184
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   185
theorem union: "Elem x (union A B) = (Elem x A | Elem x B)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   186
  by (auto simp add: union_def Sum Upair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   187
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   188
definition Field :: "ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   189
  "Field A == union (Domain A) (Range A)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   190
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   191
definition app :: "ZF \<Rightarrow> ZF => ZF" (infixl "\<acute>" 90) --{*function application*} where
24784
102e0e732495 avoid unnamed infixes;
wenzelm
parents: 24124
diff changeset
   192
  "f \<acute> x == (THE y. Elem (Opair x y) f)"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   193
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   194
definition isFun :: "ZF \<Rightarrow> bool" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   195
  "isFun f == (! x y1 y2. Elem (Opair x y1) f & Elem (Opair x y2) f \<longrightarrow> y1 = y2)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   196
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   197
definition Lambda :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF) \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   198
  "Lambda A f == Repl A (% x. Opair x (f x))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   199
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   200
lemma Lambda_app: "Elem x A \<Longrightarrow> (Lambda A f)\<acute>x = f x"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   201
  by (simp add: app_def Lambda_def Repl Opair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   202
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   203
lemma isFun_Lambda: "isFun (Lambda A f)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   204
  by (auto simp add: isFun_def Lambda_def Repl Opair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   205
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   206
lemma domain_Lambda: "Domain (Lambda A f) = A"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   207
  apply (auto simp add: Domain_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   208
  apply (subst Ext)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   209
  apply (auto simp add: Replacement)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   210
  apply (simp add: Lambda_def Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   211
  apply (auto simp add: Fst)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   212
  apply (simp add: Lambda_def Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   213
  apply (rule_tac x="Opair z (f z)" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   214
  apply (auto simp add: Fst isOpair_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   215
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   216
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   217
lemma Lambda_ext: "(Lambda s f = Lambda t g) = (s = t & (! x. Elem x s \<longrightarrow> f x = g x))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   218
proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   219
  have "Lambda s f = Lambda t g \<Longrightarrow> s = t"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   220
    apply (subst domain_Lambda[where A = s and f = f, symmetric])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   221
    apply (subst domain_Lambda[where A = t and f = g, symmetric])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   222
    apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   223
    done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   224
  then show ?thesis
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   225
    apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   226
    apply (subst Lambda_app[where f=f, symmetric], simp)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   227
    apply (subst Lambda_app[where f=g, symmetric], simp)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   228
    apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   229
    apply (auto simp add: Lambda_def Repl Ext)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   230
    apply (auto simp add: Ext[symmetric])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   231
    done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   232
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   233
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   234
definition PFun :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   235
  "PFun A B == Sep (Power (CartProd A B)) isFun"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   236
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   237
definition Fun :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   238
  "Fun A B == Sep (PFun A B) (\<lambda> f. Domain f = A)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   239
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   240
lemma Fun_Range: "Elem f (Fun U V) \<Longrightarrow> subset (Range f) V"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   241
  apply (simp add: Fun_def Sep PFun_def Power subset_def CartProd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   242
  apply (auto simp add: Domain Range)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   243
  apply (erule_tac x="Opair xa x" in allE)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   244
  apply (auto simp add: Opair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   245
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   246
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   247
lemma Elem_Elem_PFun: "Elem F (PFun U V) \<Longrightarrow> Elem p F \<Longrightarrow> isOpair p & Elem (Fst p) U & Elem (Snd p) V"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   248
  apply (simp add: PFun_def Sep Power subset_def, clarify)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   249
  apply (erule_tac x=p in allE)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   250
  apply (auto simp add: CartProd isOpair Fst Snd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   251
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   252
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   253
lemma Fun_implies_PFun[simp]: "Elem f (Fun U V) \<Longrightarrow> Elem f (PFun U V)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   254
  by (simp add: Fun_def Sep)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   255
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   256
lemma Elem_Elem_Fun: "Elem F (Fun U V) \<Longrightarrow> Elem p F \<Longrightarrow> isOpair p & Elem (Fst p) U & Elem (Snd p) V" 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   257
  by (auto simp add: Elem_Elem_PFun dest: Fun_implies_PFun)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   258
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   259
lemma PFun_inj: "Elem F (PFun U V) \<Longrightarrow> Elem x F \<Longrightarrow> Elem y F \<Longrightarrow> Fst x = Fst y \<Longrightarrow> Snd x = Snd y"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   260
  apply (frule Elem_Elem_PFun[where p=x], simp)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   261
  apply (frule Elem_Elem_PFun[where p=y], simp)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   262
  apply (subgoal_tac "isFun F")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   263
  apply (simp add: isFun_def isOpair_def)  
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   264
  apply (auto simp add: Fst Snd, blast)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   265
  apply (auto simp add: PFun_def Sep)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   266
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   267
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   268
lemma Fun_total: "\<lbrakk>Elem F (Fun U V); Elem a U\<rbrakk> \<Longrightarrow> \<exists>x. Elem (Opair a x) F"
24124
4399175e3014 turned simp_depth_limit into configuration option;
wenzelm
parents: 23315
diff changeset
   269
  using [[simp_depth_limit = 2]]
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   270
  by (auto simp add: Fun_def Sep Domain)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   271
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   272
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   273
lemma unique_fun_value: "\<lbrakk>isFun f; Elem x (Domain f)\<rbrakk> \<Longrightarrow> ?! y. Elem (Opair x y) f"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   274
  by (auto simp add: Domain isFun_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   275
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   276
lemma fun_value_in_range: "\<lbrakk>isFun f; Elem x (Domain f)\<rbrakk> \<Longrightarrow> Elem (f\<acute>x) (Range f)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   277
  apply (auto simp add: Range)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   278
  apply (drule unique_fun_value)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   279
  apply simp
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   280
  apply (simp add: app_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   281
  apply (rule exI[where x=x])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   282
  apply (auto simp add: the_equality)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   283
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   284
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   285
lemma fun_range_witness: "\<lbrakk>isFun f; Elem y (Range f)\<rbrakk> \<Longrightarrow> ? x. Elem x (Domain f) & f\<acute>x = y"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   286
  apply (auto simp add: Range)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   287
  apply (rule_tac x="x" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   288
  apply (auto simp add: app_def the_equality isFun_def Domain)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   289
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   290
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   291
lemma Elem_Fun_Lambda: "Elem F (Fun U V) \<Longrightarrow> ? f. F = Lambda U f"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   292
  apply (rule exI[where x= "% x. (THE y. Elem (Opair x y) F)"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   293
  apply (simp add: Ext Lambda_def Repl Domain)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   294
  apply (simp add: Ext[symmetric])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   295
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   296
  apply (frule Elem_Elem_Fun)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   297
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   298
  apply (rule_tac x="Fst z" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   299
  apply (simp add: isOpair_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   300
  apply (auto simp add: Fst Snd Opair)
35502
3d105282262e removed obsolete helper theory
krauss
parents: 35416
diff changeset
   301
  apply (rule the1I2)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   302
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   303
  apply (drule Fun_implies_PFun)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   304
  apply (drule_tac x="Opair x ya" and y="Opair x yb" in PFun_inj)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   305
  apply (auto simp add: Fst Snd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   306
  apply (drule Fun_implies_PFun)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   307
  apply (drule_tac x="Opair x y" and y="Opair x ya" in PFun_inj)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   308
  apply (auto simp add: Fst Snd)
35502
3d105282262e removed obsolete helper theory
krauss
parents: 35416
diff changeset
   309
  apply (rule the1I2)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   310
  apply (auto simp add: Fun_total)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   311
  apply (drule Fun_implies_PFun)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   312
  apply (drule_tac x="Opair a x" and y="Opair a y" in PFun_inj)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   313
  apply (auto simp add: Fst Snd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   314
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   315
 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   316
lemma Elem_Lambda_Fun: "Elem (Lambda A f) (Fun U V) = (A = U & (! x. Elem x A \<longrightarrow> Elem (f x) V))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   317
proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   318
  have "Elem (Lambda A f) (Fun U V) \<Longrightarrow> A = U"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   319
    by (simp add: Fun_def Sep domain_Lambda)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   320
  then show ?thesis
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   321
    apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   322
    apply (drule Fun_Range)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   323
    apply (subgoal_tac "f x = ((Lambda U f) \<acute> x)")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   324
    prefer 2
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   325
    apply (simp add: Lambda_app)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   326
    apply simp
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   327
    apply (subgoal_tac "Elem (Lambda U f \<acute> x) (Range (Lambda U f))")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   328
    apply (simp add: subset_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   329
    apply (rule fun_value_in_range)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   330
    apply (simp_all add: isFun_Lambda domain_Lambda)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   331
    apply (simp add: Fun_def Sep PFun_def Power domain_Lambda isFun_Lambda)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   332
    apply (auto simp add: subset_def CartProd)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   333
    apply (rule_tac x="Fst x" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   334
    apply (auto simp add: Lambda_def Repl Fst)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   335
    done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   336
qed    
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   337
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   338
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   339
definition is_Elem_of :: "(ZF * ZF) set" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   340
  "is_Elem_of == { (a,b) | a b. Elem a b }"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   341
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   342
lemma cond_wf_Elem:
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   343
  assumes hyps:"\<forall>x. (\<forall>y. Elem y x \<longrightarrow> Elem y U \<longrightarrow> P y) \<longrightarrow> Elem x U \<longrightarrow> P x" "Elem a U"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   344
  shows "P a"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   345
proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   346
  {
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   347
    fix P
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   348
    fix U
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   349
    fix a
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   350
    assume P_induct: "(\<forall>x. (\<forall>y. Elem y x \<longrightarrow> Elem y U \<longrightarrow> P y) \<longrightarrow> (Elem x U \<longrightarrow> P x))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   351
    assume a_in_U: "Elem a U"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   352
    have "P a"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   353
      proof -
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   354
        term "P"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   355
        term Sep
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   356
        let ?Z = "Sep U (Not o P)"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   357
        have "?Z = Empty \<longrightarrow> P a" by (simp add: Ext Sep Empty a_in_U)     
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   358
        moreover have "?Z \<noteq> Empty \<longrightarrow> False"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   359
          proof 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   360
            assume not_empty: "?Z \<noteq> Empty" 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   361
            note thereis_x = Regularity[where A="?Z", simplified not_empty, simplified]
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   362
            then obtain x where x_def: "Elem x ?Z & (! y. Elem y x \<longrightarrow> Not (Elem y ?Z))" ..
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   363
            then have x_induct:"! y. Elem y x \<longrightarrow> Elem y U \<longrightarrow> P y" by (simp add: Sep)
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   364
            have "Elem x U \<longrightarrow> P x" 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   365
              by (rule impE[OF spec[OF P_induct, where x=x], OF x_induct], assumption)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   366
            moreover have "Elem x U & Not(P x)"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   367
              apply (insert x_def)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   368
              apply (simp add: Sep)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   369
              done
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   370
            ultimately show "False" by auto
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   371
          qed
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   372
        ultimately show "P a" by auto
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   373
      qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   374
  }
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   375
  with hyps show ?thesis by blast
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   376
qed    
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   377
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   378
lemma cond2_wf_Elem:
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   379
  assumes 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   380
     special_P: "? U. ! x. Not(Elem x U) \<longrightarrow> (P x)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   381
     and P_induct: "\<forall>x. (\<forall>y. Elem y x \<longrightarrow> P y) \<longrightarrow> P x"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   382
  shows
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   383
     "P a"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   384
proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   385
  have "? U Q. P = (\<lambda> x. (Elem x U \<longrightarrow> Q x))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   386
  proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   387
    from special_P obtain U where U:"! x. Not(Elem x U) \<longrightarrow> (P x)" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   388
    show ?thesis
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   389
      apply (rule_tac exI[where x=U])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   390
      apply (rule exI[where x="P"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   391
      apply (rule ext)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   392
      apply (auto simp add: U)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   393
      done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   394
  qed    
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   395
  then obtain U where "? Q. P = (\<lambda> x. (Elem x U \<longrightarrow> Q x))" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   396
  then obtain Q where UQ: "P = (\<lambda> x. (Elem x U \<longrightarrow> Q x))" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   397
  show ?thesis
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   398
    apply (auto simp add: UQ)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   399
    apply (rule cond_wf_Elem)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   400
    apply (rule P_induct[simplified UQ])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   401
    apply simp
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   402
    done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   403
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   404
39246
9e58f0499f57 modernized primrec
haftmann
parents: 39198
diff changeset
   405
primrec nat2Nat :: "nat \<Rightarrow> ZF" where
9e58f0499f57 modernized primrec
haftmann
parents: 39198
diff changeset
   406
  nat2Nat_0[intro]:  "nat2Nat 0 = Empty"
9e58f0499f57 modernized primrec
haftmann
parents: 39198
diff changeset
   407
| nat2Nat_Suc[intro]:  "nat2Nat (Suc n) = SucNat (nat2Nat n)"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   408
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   409
definition Nat2nat :: "ZF \<Rightarrow> nat" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   410
  "Nat2nat == inv nat2Nat"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   411
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   412
lemma Elem_nat2Nat_inf[intro]: "Elem (nat2Nat n) Inf"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   413
  apply (induct n)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   414
  apply (simp_all add: Infinity)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   415
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   416
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   417
definition Nat :: ZF
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   418
 where  "Nat == Sep Inf (\<lambda> N. ? n. nat2Nat n = N)"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   419
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   420
lemma Elem_nat2Nat_Nat[intro]: "Elem (nat2Nat n) Nat"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   421
  by (auto simp add: Nat_def Sep)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   422
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   423
lemma Elem_Empty_Nat: "Elem Empty Nat"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   424
  by (auto simp add: Nat_def Sep Infinity)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   425
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   426
lemma Elem_SucNat_Nat: "Elem N Nat \<Longrightarrow> Elem (SucNat N) Nat"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   427
  by (auto simp add: Nat_def Sep Infinity)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   428
  
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   429
lemma no_infinite_Elem_down_chain:
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   430
  "Not (? f. isFun f & Domain f = Nat & (! N. Elem N Nat \<longrightarrow> Elem (f\<acute>(SucNat N)) (f\<acute>N)))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   431
proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   432
  {
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   433
    fix f
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   434
    assume f:"isFun f & Domain f = Nat & (! N. Elem N Nat \<longrightarrow> Elem (f\<acute>(SucNat N)) (f\<acute>N))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   435
    let ?r = "Range f"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   436
    have "?r \<noteq> Empty"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   437
      apply (auto simp add: Ext Empty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   438
      apply (rule exI[where x="f\<acute>Empty"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   439
      apply (rule fun_value_in_range)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   440
      apply (auto simp add: f Elem_Empty_Nat)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   441
      done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   442
    then have "? x. Elem x ?r & (! y. Elem y x \<longrightarrow> Not(Elem y ?r))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   443
      by (simp add: Regularity)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   444
    then obtain x where x: "Elem x ?r & (! y. Elem y x \<longrightarrow> Not(Elem y ?r))" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   445
    then have "? N. Elem N (Domain f) & f\<acute>N = x" 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   446
      apply (rule_tac fun_range_witness)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   447
      apply (simp_all add: f)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   448
      done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   449
    then have "? N. Elem N Nat & f\<acute>N = x" 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   450
      by (simp add: f)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   451
    then obtain N where N: "Elem N Nat & f\<acute>N = x" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   452
    from N have N': "Elem N Nat" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   453
    let ?y = "f\<acute>(SucNat N)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   454
    have Elem_y_r: "Elem ?y ?r"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   455
      by (simp_all add: f Elem_SucNat_Nat N fun_value_in_range)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   456
    have "Elem ?y (f\<acute>N)" by (auto simp add: f N')
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   457
    then have "Elem ?y x" by (simp add: N)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   458
    with x have "Not (Elem ?y ?r)" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   459
    with Elem_y_r have "False" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   460
  }
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   461
  then show ?thesis by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   462
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   463
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   464
lemma Upair_nonEmpty: "Upair a b \<noteq> Empty"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   465
  by (auto simp add: Ext Empty Upair)  
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   466
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   467
lemma Singleton_nonEmpty: "Singleton x \<noteq> Empty"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   468
  by (auto simp add: Singleton_def Upair_nonEmpty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   469
26304
02fbd0e7954a avoid rebinding of existing facts;
wenzelm
parents: 24784
diff changeset
   470
lemma notsym_Elem: "Not(Elem a b & Elem b a)"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   471
proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   472
  {
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   473
    fix a b
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   474
    assume ab: "Elem a b"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   475
    assume ba: "Elem b a"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   476
    let ?Z = "Upair a b"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   477
    have "?Z \<noteq> Empty" by (simp add: Upair_nonEmpty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   478
    then have "? x. Elem x ?Z & (! y. Elem y x \<longrightarrow> Not(Elem y ?Z))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   479
      by (simp add: Regularity)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   480
    then obtain x where x:"Elem x ?Z & (! y. Elem y x \<longrightarrow> Not(Elem y ?Z))" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   481
    then have "x = a \<or> x = b" by (simp add: Upair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   482
    moreover have "x = a \<longrightarrow> Not (Elem b ?Z)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   483
      by (auto simp add: x ba)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   484
    moreover have "x = b \<longrightarrow> Not (Elem a ?Z)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   485
      by (auto simp add: x ab)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   486
    ultimately have "False"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   487
      by (auto simp add: Upair)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   488
  }    
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   489
  then show ?thesis by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   490
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   491
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   492
lemma irreflexiv_Elem: "Not(Elem a a)"
26304
02fbd0e7954a avoid rebinding of existing facts;
wenzelm
parents: 24784
diff changeset
   493
  by (simp add: notsym_Elem[of a a, simplified])
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   494
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   495
lemma antisym_Elem: "Elem a b \<Longrightarrow> Not (Elem b a)"
26304
02fbd0e7954a avoid rebinding of existing facts;
wenzelm
parents: 24784
diff changeset
   496
  apply (insert notsym_Elem[of a b])
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   497
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   498
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   499
39246
9e58f0499f57 modernized primrec
haftmann
parents: 39198
diff changeset
   500
primrec NatInterval :: "nat \<Rightarrow> nat \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   501
  "NatInterval n 0 = Singleton (nat2Nat n)"
39246
9e58f0499f57 modernized primrec
haftmann
parents: 39198
diff changeset
   502
| "NatInterval n (Suc m) = union (NatInterval n m) (Singleton (nat2Nat (n+m+1)))"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   503
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   504
lemma n_Elem_NatInterval[rule_format]: "! q. q <= m \<longrightarrow> Elem (nat2Nat (n+q)) (NatInterval n m)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   505
  apply (induct m)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   506
  apply (auto simp add: Singleton union)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   507
  apply (case_tac "q <= m")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   508
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   509
  apply (subgoal_tac "q = Suc m")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   510
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   511
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   512
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   513
lemma NatInterval_not_Empty: "NatInterval n m \<noteq> Empty"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   514
  by (auto intro:   n_Elem_NatInterval[where q = 0, simplified] simp add: Empty Ext)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   515
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   516
lemma increasing_nat2Nat[rule_format]: "0 < n \<longrightarrow> Elem (nat2Nat (n - 1)) (nat2Nat n)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   517
  apply (case_tac "? m. n = Suc m")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   518
  apply (auto simp add: SucNat_def union Singleton)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   519
  apply (drule spec[where x="n - 1"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   520
  apply arith
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   521
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   522
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   523
lemma represent_NatInterval[rule_format]: "Elem x (NatInterval n m) \<longrightarrow> (? u. n \<le> u & u \<le> n+m & nat2Nat u = x)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   524
  apply (induct m)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   525
  apply (auto simp add: Singleton union)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   526
  apply (rule_tac x="Suc (n+m)" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   527
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   528
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   529
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   530
lemma inj_nat2Nat: "inj nat2Nat"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   531
proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   532
  {
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   533
    fix n m :: nat
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   534
    assume nm: "nat2Nat n = nat2Nat (n+m)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   535
    assume mg0: "0 < m"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   536
    let ?Z = "NatInterval n m"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   537
    have "?Z \<noteq> Empty" by (simp add: NatInterval_not_Empty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   538
    then have "? x. (Elem x ?Z) & (! y. Elem y x \<longrightarrow> Not (Elem y ?Z))" 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   539
      by (auto simp add: Regularity)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   540
    then obtain x where x:"Elem x ?Z & (! y. Elem y x \<longrightarrow> Not (Elem y ?Z))" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   541
    then have "? u. n \<le> u & u \<le> n+m & nat2Nat u = x" 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   542
      by (simp add: represent_NatInterval)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   543
    then obtain u where u: "n \<le> u & u \<le> n+m & nat2Nat u = x" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   544
    have "n < u \<longrightarrow> False"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   545
    proof 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   546
      assume n_less_u: "n < u"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   547
      let ?y = "nat2Nat (u - 1)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   548
      have "Elem ?y (nat2Nat u)"
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   549
        apply (rule increasing_nat2Nat)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   550
        apply (insert n_less_u)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   551
        apply arith
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   552
        done
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   553
      with u have "Elem ?y x" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   554
      with x have "Not (Elem ?y ?Z)" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   555
      moreover have "Elem ?y ?Z" 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   556
        apply (insert n_Elem_NatInterval[where q = "u - n - 1" and n=n and m=m])
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   557
        apply (insert n_less_u)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   558
        apply (insert u)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   559
        apply auto
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   560
        done
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   561
      ultimately show False by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   562
    qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   563
    moreover have "u = n \<longrightarrow> False"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   564
    proof 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   565
      assume "u = n"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   566
      with u have "nat2Nat n = x" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   567
      then have nm_eq_x: "nat2Nat (n+m) = x" by (simp add: nm)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   568
      let ?y = "nat2Nat (n+m - 1)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   569
      have "Elem ?y (nat2Nat (n+m))"
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   570
        apply (rule increasing_nat2Nat)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   571
        apply (insert mg0)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   572
        apply arith
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   573
        done
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   574
      with nm_eq_x have "Elem ?y x" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   575
      with x have "Not (Elem ?y ?Z)" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   576
      moreover have "Elem ?y ?Z" 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   577
        apply (insert n_Elem_NatInterval[where q = "m - 1" and n=n and m=m])
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   578
        apply (insert mg0)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   579
        apply auto
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   580
        done
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   581
      ultimately show False by auto      
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   582
    qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   583
    ultimately have "False" using u by arith
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   584
  }
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   585
  note lemma_nat2Nat = this
23315
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   586
  have th:"\<And>x y. \<not> (x < y \<and> (\<forall>(m\<Colon>nat). y \<noteq> x + m))" by presburger
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   587
  have th': "\<And>x y. \<not> (x \<noteq> y \<and> (\<not> x < y) \<and> (\<forall>(m\<Colon>nat). x \<noteq> y + m))" by presburger
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   588
  show ?thesis
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   589
    apply (auto simp add: inj_on_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   590
    apply (case_tac "x = y")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   591
    apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   592
    apply (case_tac "x < y")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   593
    apply (case_tac "? m. y = x + m & 0 < m")
23315
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   594
    apply (auto intro: lemma_nat2Nat)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   595
    apply (case_tac "y < x")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   596
    apply (case_tac "? m. x = y + m & 0 < m")
23315
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   597
    apply simp
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   598
    apply simp
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   599
    using th apply blast
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   600
    apply (case_tac "? m. x = y + m")
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   601
    apply (auto intro: lemma_nat2Nat)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   602
    apply (drule sym)
23315
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   603
    using lemma_nat2Nat apply blast
df3a7e9ebadb tuned Proof
chaieb
parents: 22690
diff changeset
   604
    using th' apply blast    
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   605
    done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   606
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   607
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   608
lemma Nat2nat_nat2Nat[simp]: "Nat2nat (nat2Nat n) = n"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   609
  by (simp add: Nat2nat_def inv_f_f[OF inj_nat2Nat])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   610
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   611
lemma nat2Nat_Nat2nat[simp]: "Elem n Nat \<Longrightarrow> nat2Nat (Nat2nat n) = n"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   612
  apply (simp add: Nat2nat_def)
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32989
diff changeset
   613
  apply (rule_tac f_inv_into_f)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   614
  apply (auto simp add: image_def Nat_def Sep)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   615
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   616
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   617
lemma Nat2nat_SucNat: "Elem N Nat \<Longrightarrow> Nat2nat (SucNat N) = Suc (Nat2nat N)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   618
  apply (auto simp add: Nat_def Sep Nat2nat_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   619
  apply (auto simp add: inv_f_f[OF inj_nat2Nat])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   620
  apply (simp only: nat2Nat.simps[symmetric])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   621
  apply (simp only: inv_f_f[OF inj_nat2Nat])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   622
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   623
  
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   624
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   625
(*lemma Elem_induct: "(\<And>x. \<forall>y. Elem y x \<longrightarrow> P y \<Longrightarrow> P x) \<Longrightarrow> P a"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   626
  by (erule wf_induct[OF wf_is_Elem_of, simplified is_Elem_of_def, simplified])*)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   627
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   628
lemma Elem_Opair_exists: "? z. Elem x z & Elem y z & Elem z (Opair x y)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   629
  apply (rule exI[where x="Upair x y"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   630
  by (simp add: Upair Opair_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   631
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   632
lemma UNIV_is_not_in_ZF: "UNIV \<noteq> explode R"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   633
proof
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   634
  let ?Russell = "{ x. Not(Elem x x) }"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   635
  have "?Russell = UNIV" by (simp add: irreflexiv_Elem)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   636
  moreover assume "UNIV = explode R"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   637
  ultimately have russell: "?Russell = explode R" by simp
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   638
  then show "False"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   639
  proof(cases "Elem R R")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   640
    case True     
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   641
    then show ?thesis 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   642
      by (insert irreflexiv_Elem, auto)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   643
  next
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   644
    case False
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   645
    then have "R \<in> ?Russell" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   646
    then have "Elem R R" by (simp add: russell explode_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   647
    with False show ?thesis by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   648
  qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   649
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   650
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   651
definition SpecialR :: "(ZF * ZF) set" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   652
  "SpecialR \<equiv> { (x, y) . x \<noteq> Empty \<and> y = Empty}"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   653
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   654
lemma "wf SpecialR"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   655
  apply (subst wf_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   656
  apply (auto simp add: SpecialR_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   657
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   658
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   659
definition Ext :: "('a * 'b) set \<Rightarrow> 'b \<Rightarrow> 'a set" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   660
  "Ext R y \<equiv> { x . (x, y) \<in> R }" 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   661
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   662
lemma Ext_Elem: "Ext is_Elem_of = explode"
46752
e9e7209eb375 more fundamental pred-to-set conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents: 45827
diff changeset
   663
  by (auto simp add: Ext_def is_Elem_of_def explode_def)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   664
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   665
lemma "Ext SpecialR Empty \<noteq> explode z"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   666
proof 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   667
  have "Ext SpecialR Empty = UNIV - {Empty}"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   668
    by (auto simp add: Ext_def SpecialR_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   669
  moreover assume "Ext SpecialR Empty = explode z"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   670
  ultimately have "UNIV = explode(union z (Singleton Empty)) "
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   671
    by (auto simp add: explode_def union Singleton)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   672
  then show "False" by (simp add: UNIV_is_not_in_ZF)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   673
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   674
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   675
definition implode :: "ZF set \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   676
  "implode == inv explode"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   677
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   678
lemma inj_explode: "inj explode"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   679
  by (auto simp add: inj_on_def explode_def Ext)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   680
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   681
lemma implode_explode[simp]: "implode (explode x) = x"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   682
  by (simp add: implode_def inj_explode)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   683
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   684
definition regular :: "(ZF * ZF) set \<Rightarrow> bool" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   685
  "regular R == ! A. A \<noteq> Empty \<longrightarrow> (? x. Elem x A & (! y. (y, x) \<in> R \<longrightarrow> Not (Elem y A)))"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   686
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   687
definition set_like :: "(ZF * ZF) set \<Rightarrow> bool" where
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   688
  "set_like R == ! y. Ext R y \<in> range explode"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   689
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   690
definition wfzf :: "(ZF * ZF) set \<Rightarrow> bool" where
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   691
  "wfzf R == regular R & set_like R"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   692
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   693
lemma regular_Elem: "regular is_Elem_of"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   694
  by (simp add: regular_def is_Elem_of_def Regularity)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   695
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   696
lemma set_like_Elem: "set_like is_Elem_of"
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   697
  by (auto simp add: set_like_def image_def Ext_Elem)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   698
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   699
lemma wfzf_is_Elem_of: "wfzf is_Elem_of"
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   700
  by (auto simp add: wfzf_def regular_Elem set_like_Elem)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   701
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   702
definition SeqSum :: "(nat \<Rightarrow> ZF) \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   703
  "SeqSum f == Sum (Repl Nat (f o Nat2nat))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   704
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   705
lemma SeqSum: "Elem x (SeqSum f) = (? n. Elem x (f n))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   706
  apply (auto simp add: SeqSum_def Sum Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   707
  apply (rule_tac x = "f n" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   708
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   709
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   710
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   711
definition Ext_ZF :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   712
  "Ext_ZF R s == implode (Ext R s)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   713
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   714
lemma Elem_implode: "A \<in> range explode \<Longrightarrow> Elem x (implode A) = (x \<in> A)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   715
  apply (auto)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   716
  apply (simp_all add: explode_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   717
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   718
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   719
lemma Elem_Ext_ZF: "set_like R \<Longrightarrow> Elem x (Ext_ZF R s) = ((x,s) \<in> R)"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   720
  apply (simp add: Ext_ZF_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   721
  apply (subst Elem_implode)
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   722
  apply (simp add: set_like_def)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   723
  apply (simp add: Ext_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   724
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   725
39246
9e58f0499f57 modernized primrec
haftmann
parents: 39198
diff changeset
   726
primrec Ext_ZF_n :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> nat \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   727
  "Ext_ZF_n R s 0 = Ext_ZF R s"
39246
9e58f0499f57 modernized primrec
haftmann
parents: 39198
diff changeset
   728
| "Ext_ZF_n R s (Suc n) = Sum (Repl (Ext_ZF_n R s n) (Ext_ZF R))"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   729
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 33057
diff changeset
   730
definition Ext_ZF_hull :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> ZF" where
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   731
  "Ext_ZF_hull R s == SeqSum (Ext_ZF_n R s)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   732
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   733
lemma Elem_Ext_ZF_hull:
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   734
  assumes set_like_R: "set_like R" 
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   735
  shows "Elem x (Ext_ZF_hull R S) = (? n. Elem x (Ext_ZF_n R S n))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   736
  by (simp add: Ext_ZF_hull_def SeqSum)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   737
  
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   738
lemma Elem_Elem_Ext_ZF_hull:
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   739
  assumes set_like_R: "set_like R" 
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   740
          and x_hull: "Elem x (Ext_ZF_hull R S)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   741
          and y_R_x: "(y, x) \<in> R"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   742
  shows "Elem y (Ext_ZF_hull R S)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   743
proof -
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   744
  from Elem_Ext_ZF_hull[OF set_like_R] x_hull 
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   745
  have "? n. Elem x (Ext_ZF_n R S n)" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   746
  then obtain n where n:"Elem x (Ext_ZF_n R S n)" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   747
  with y_R_x have "Elem y (Ext_ZF_n R S (Suc n))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   748
    apply (auto simp add: Repl Sum)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   749
    apply (rule_tac x="Ext_ZF R x" in exI) 
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   750
    apply (auto simp add: Elem_Ext_ZF[OF set_like_R])
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   751
    done
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   752
  with Elem_Ext_ZF_hull[OF set_like_R, where x=y] show ?thesis
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   753
    by (auto simp del: Ext_ZF_n.simps)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   754
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   755
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   756
lemma wfzf_minimal:
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   757
  assumes hyps: "wfzf R" "C \<noteq> {}"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   758
  shows "\<exists>x. x \<in> C \<and> (\<forall>y. (y, x) \<in> R \<longrightarrow> y \<notin> C)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   759
proof -
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   760
  from hyps have "\<exists>S. S \<in> C" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   761
  then obtain S where S:"S \<in> C" by auto  
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   762
  let ?T = "Sep (Ext_ZF_hull R S) (\<lambda> s. s \<in> C)"
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   763
  from hyps have set_like_R: "set_like R" by (simp add: wfzf_def)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   764
  show ?thesis
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   765
  proof (cases "?T = Empty")
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   766
    case True
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   767
    then have "\<forall> z. \<not> (Elem z (Sep (Ext_ZF R S) (\<lambda> s. s \<in> C)))"      
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   768
      apply (auto simp add: Ext Empty Sep Ext_ZF_hull_def SeqSum)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   769
      apply (erule_tac x="z" in allE, auto)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   770
      apply (erule_tac x=0 in allE, auto)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   771
      done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   772
    then show ?thesis 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   773
      apply (rule_tac exI[where x=S])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   774
      apply (auto simp add: Sep Empty S)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   775
      apply (erule_tac x=y in allE)
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   776
      apply (simp add: set_like_R Elem_Ext_ZF)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   777
      done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   778
  next
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   779
    case False
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   780
    from hyps have regular_R: "regular R" by (simp add: wfzf_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   781
    from 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   782
      regular_R[simplified regular_def, rule_format, OF False, simplified Sep] 
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   783
      Elem_Elem_Ext_ZF_hull[OF set_like_R]
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   784
    show ?thesis by blast
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   785
  qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   786
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   787
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   788
lemma wfzf_implies_wf: "wfzf R \<Longrightarrow> wf R"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   789
proof (subst wf_def, rule allI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   790
  assume wfzf: "wfzf R"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   791
  fix P :: "ZF \<Rightarrow> bool"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   792
  let ?C = "{x. P x}"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   793
  {
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   794
    assume induct: "(\<forall>x. (\<forall>y. (y, x) \<in> R \<longrightarrow> P y) \<longrightarrow> P x)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   795
    let ?C = "{x. \<not> (P x)}"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   796
    have "?C = {}"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   797
    proof (rule ccontr)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   798
      assume C: "?C \<noteq> {}"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   799
      from
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   800
        wfzf_minimal[OF wfzf C]
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   801
      obtain x where x: "x \<in> ?C \<and> (\<forall>y. (y, x) \<in> R \<longrightarrow> y \<notin> ?C)" ..
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   802
      then have "P x"
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   803
        apply (rule_tac induct[rule_format])
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   804
        apply auto
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26304
diff changeset
   805
        done
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   806
      with x show "False" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   807
    qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   808
    then have "! x. P x" by auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   809
  }
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   810
  then show "(\<forall>x. (\<forall>y. (y, x) \<in> R \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> (! x. P x)" by blast
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   811
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   812
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   813
lemma wf_is_Elem_of: "wf is_Elem_of"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   814
  by (auto simp add: wfzf_is_Elem_of wfzf_implies_wf)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   815
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   816
lemma in_Ext_RTrans_implies_Elem_Ext_ZF_hull:  
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   817
  "set_like R \<Longrightarrow> x \<in> (Ext (R^+) s) \<Longrightarrow> Elem x (Ext_ZF_hull R s)"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   818
  apply (simp add: Ext_def Elem_Ext_ZF_hull)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   819
  apply (erule converse_trancl_induct[where r="R"])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   820
  apply (rule exI[where x=0])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   821
  apply (simp add: Elem_Ext_ZF)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   822
  apply auto
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   823
  apply (rule_tac x="Suc n" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   824
  apply (simp add: Sum Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   825
  apply (rule_tac x="Ext_ZF R z" in exI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   826
  apply (auto simp add: Elem_Ext_ZF)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   827
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   828
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   829
lemma implodeable_Ext_trancl: "set_like R \<Longrightarrow> set_like (R^+)"
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   830
  apply (subst set_like_def)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   831
  apply (auto simp add: image_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   832
  apply (rule_tac x="Sep (Ext_ZF_hull R y) (\<lambda> z. z \<in> (Ext (R^+) y))" in exI)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39246
diff changeset
   833
  apply (auto simp add: explode_def Sep set_eqI 
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   834
    in_Ext_RTrans_implies_Elem_Ext_ZF_hull)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   835
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   836
 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   837
lemma Elem_Ext_ZF_hull_implies_in_Ext_RTrans[rule_format]:
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   838
  "set_like R \<Longrightarrow> ! x. Elem x (Ext_ZF_n R s n) \<longrightarrow> x \<in> (Ext (R^+) s)"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   839
  apply (induct_tac n)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   840
  apply (auto simp add: Elem_Ext_ZF Ext_def Sum Repl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   841
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   842
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   843
lemma "set_like R \<Longrightarrow> Ext_ZF (R^+) s = Ext_ZF_hull R s"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   844
  apply (frule implodeable_Ext_trancl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   845
  apply (auto simp add: Ext)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   846
  apply (erule in_Ext_RTrans_implies_Elem_Ext_ZF_hull)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   847
  apply (simp add: Elem_Ext_ZF Ext_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   848
  apply (auto simp add: Elem_Ext_ZF Elem_Ext_ZF_hull)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   849
  apply (erule Elem_Ext_ZF_hull_implies_in_Ext_RTrans[simplified Ext_def, simplified], assumption)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   850
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   851
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   852
lemma wf_implies_regular: "wf R \<Longrightarrow> regular R"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   853
proof (simp add: regular_def, rule allI)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   854
  assume wf: "wf R"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   855
  fix A
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   856
  show "A \<noteq> Empty \<longrightarrow> (\<exists>x. Elem x A \<and> (\<forall>y. (y, x) \<in> R \<longrightarrow> \<not> Elem y A))"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   857
  proof
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   858
    assume A: "A \<noteq> Empty"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   859
    then have "? x. x \<in> explode A" 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   860
      by (auto simp add: explode_def Ext Empty)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   861
    then obtain x where x:"x \<in> explode A" ..   
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   862
    from iffD1[OF wf_eq_minimal wf, rule_format, where Q="explode A", OF x]
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   863
    obtain z where "z \<in> explode A \<and> (\<forall>y. (y, z) \<in> R \<longrightarrow> y \<notin> explode A)" by auto    
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   864
    then show "\<exists>x. Elem x A \<and> (\<forall>y. (y, x) \<in> R \<longrightarrow> \<not> Elem y A)"      
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   865
      apply (rule_tac exI[where x = z])
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   866
      apply (simp add: explode_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   867
      done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   868
  qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   869
qed
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   870
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   871
lemma wf_eq_wfzf: "(wf R \<and> set_like R) = wfzf R"
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   872
  apply (auto simp add: wfzf_implies_wf)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   873
  apply (auto simp add: wfzf_def wf_implies_regular)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   874
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   875
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   876
lemma wfzf_trancl: "wfzf R \<Longrightarrow> wfzf (R^+)"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   877
  by (auto simp add: wf_eq_wfzf[symmetric] implodeable_Ext_trancl wf_trancl)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   878
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   879
lemma Ext_subset_mono: "R \<subseteq> S \<Longrightarrow> Ext R y \<subseteq> Ext S y"
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   880
  by (auto simp add: Ext_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   881
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   882
lemma set_like_subset: "set_like R \<Longrightarrow> S \<subseteq> R \<Longrightarrow> set_like S"
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   883
  apply (auto simp add: set_like_def)
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   884
  apply (erule_tac x=y in allE)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   885
  apply (drule_tac y=y in Ext_subset_mono)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   886
  apply (auto simp add: image_def)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   887
  apply (rule_tac x="Sep x (% z. z \<in> (Ext S y))" in exI) 
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   888
  apply (auto simp add: explode_def Sep)
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   889
  done
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   890
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   891
lemma wfzf_subset: "wfzf S \<Longrightarrow> R \<subseteq> S \<Longrightarrow> wfzf R"
20565
4440dd392048 replaced implodeable_Ext by set_like
obua
parents: 20217
diff changeset
   892
  by (auto intro: set_like_subset wf_subset simp add: wf_eq_wfzf[symmetric])  
19203
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   893
778507520684 Added HOL-ZF to Isabelle.
obua
parents:
diff changeset
   894
end
46752
e9e7209eb375 more fundamental pred-to-set conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents: 45827
diff changeset
   895