File size: 5,124 Bytes
9dbc64e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import OAI.Computability.DegreeRigidity.Syntax.SigmaHull
import OAI.Computability.DegreeRigidity.SetModels.CollapseCoding
import Mathlib.Data.List.Basic

namespace OAI


namespace TuringRigidity.BoundedSetTheory
open TransitiveNameModel RelationCollapse
universe u
namespace FiniteTuple

noncomputable def indexSpace (t : ZFSet.{u}) : ZFSet.{u} :=
  ZFSet.prod {natSet 0} t ∪ ZFSet.prod {natSet 1} ZFSet.omega

noncomputable def finiteIndex (t : ZFSet.{u}) (xs : List ZFSet.{u}) (x : ZFSet.{u}) : ZFSet.{u} := by
  classical
  exact if x ∈ t then ZFSet.pair (natSet 0) x else ZFSet.pair (natSet 1) (natSet (xs.idxOf x))

theorem indexSpace_mem (M : ZFSet.{u}) (hM : Transitive M)
    (hP : Pairing M) (hU : BoundedSetTheory.Union M) (hPow : PowerSet M) (hS : Separation M)
    (hω : ZFSet.omega.{u} ∈ M) {t : ZFSet.{u}} (ht : t ∈ M) : indexSpace t ∈ M := by
  have hn (n : ℕ) : natSet.{u} n ∈ M := hM _ hω _ ((mem_omega _).mpr ⟨n,rfl⟩)
  exact binary_union_mem M hM hP hU
    (product_mem M hM hP hU hPow hS (singleton_mem M hM hP (hn 0)) ht)
    (product_mem M hM hP hU hPow hS (singleton_mem M hM hP (hn 1)) hω)

theorem finiteIndex_mem (t : ZFSet.{u}) (xs : List ZFSet.{u}) (x : ZFSet.{u}) :
    finiteIndex t xs x ∈ indexSpace t := by
  classical
  unfold finiteIndex
  by_cases hx : x ∈ t
  · rw [ite_eq_left hx]
    exact ZFSet.mem_union.mpr (Or.inl (ZFSet.mem_prod.mpr
      ⟨_,ZFSet.mem_singleton.mpr rfl,x,hx,rfl⟩))
  · rw [ite_eq_right hx]
    exact ZFSet.mem_union.mpr (Or.inr (ZFSet.mem_prod.mpr
      ⟨_,ZFSet.mem_singleton.mpr rfl,_,(mem_omega _).mpr ⟨xs.idxOf x,rfl⟩,rfl⟩))

theorem finiteIndex_injective (t : ZFSet.{u}) (xs : List ZFSet.{u})
    (x : ZFSet.{u}) (hx : x ∈ t ∪ elements xs) (y : ZFSet.{u}) (_hy : y ∈ t ∪ elements xs)
    (he : finiteIndex t xs x = finiteIndex t xs y) : x = y := by
  classical
  unfold finiteIndex at he
  by_cases hxt : x ∈ t <;> by_cases hyt : y ∈ t
  · rw [ite_eq_left hxt,ite_eq_left hyt] at he
    exact (ZFSet.pair_inj.mp he).2
  · rw [ite_eq_left hxt,ite_eq_right hyt] at he
    have hf := natSet_injective (ZFSet.pair_inj.mp he).1
    omega
  · rw [ite_eq_right hxt,ite_eq_left hyt] at he
    have hf := natSet_injective (ZFSet.pair_inj.mp he).1
    omega
  · rw [ite_eq_right hxt,ite_eq_right hyt] at he
    have hidx := natSet_injective (ZFSet.pair_inj.mp he).2
    have hxl : x ∈ xs := (mem_elements x xs).mp ((ZFSet.mem_union.mp hx).resolve_left hxt)
    exact (List.idxOf_inj hxl).mp hidx

theorem internal_finite_extension_injection (M : ZFSet.{u}) (hM : Transitive M)
    (hP : Pairing M) (hU : BoundedSetTheory.Union M) (hPow : PowerSet M)
    (hS : Separation M) (hR : SigmaReplacement M) (hω : ZFSet.omega.{u} ∈ M)
    {t : ZFSet.{u}} (ht : t ∈ M) (xs : List ZFSet.{u}) (hxs : ∀ x ∈ xs, x ∈ M) :
    ∃ f ∈ M, Presents (t ∪ elements xs) f (finiteIndex t xs) := by
  classical
  have hn (n : ℕ) : natSet.{u} n ∈ M := hM _ hω _ ((mem_omega _).mpr ⟨n,rfl⟩)
  have hk := indexSpace_mem M hM hP hU hPow hS hω ht
  let j := finiteIndex t xs
  have hj (x : ZFSet.{u}) : j x ∈ M := hM _ hk _ (finiteIndex_mem t xs x)
  let φ : Formula := .existsMem 2 (.conj (.orderedPair 1 2 0) (.orderedPair 0 4 2))
  let e := cons (indexSpace t) (fun _ => natSet 0)
  have he : ∀ i, e i ∈ M := by intro i; cases i with
    | zero => exact hk
    | succ => exact hn 0
  obtain ⟨b,hb,hbdef⟩ := replacement_image M hM hR (.bounded φ) e he ht
    (fun x => ZFSet.pair x (ZFSet.pair (natSet 0) x))
    (fun x hx => orderedPair_mem M hM hP (hM t ht x hx)
      (orderedPair_mem M hM hP (hn 0) (hM t ht x hx))) (by
      intro x hx y hy
      change φ.Realize M (cons y (cons x e)) ↔ _
      rw [Formula.absolute _ M hM _ (by
        intro i; rcases i with _|i; exact hy
        rcases i with _|i; exact hM t ht x hx
        exact he i)]
      simp only [φ,Formula.Eval,Formula.eval_orderedPair,cons_zero,cons_succ,e]
      constructor
      · rintro ⟨v,_,hy,rfl⟩; exact hy
      · intro hy
        have hjx := finiteIndex_mem t xs x
        rw [finiteIndex,ite_eq_left hx] at hjx
        exact ⟨_,hjx,hy,rfl⟩)
  let f := b ∪ elements (xs.map (fun x => ZFSet.pair x (j x)))
  have hf : f ∈ M := binary_union_mem M hM hP hU hb
    (elements_mem M hM hP hU (hn 0) _ (by
      intro z hz
      obtain ⟨x,hx,rfl⟩ := List.mem_map.mp hz
      exact orderedPair_mem M hM hP (hxs x hx) (hj x)))
  refine ⟨f,hf,?_⟩
  intro z
  change z ∈ b ∪ elements (xs.map (fun x => ZFSet.pair x (j x))) ↔ _
  rw [ZFSet.mem_union,hbdef,mem_elements,List.mem_map]
  constructor
  · rintro (⟨x,hx,rfl⟩|⟨x,hx,rfl⟩)
    · refine ⟨x,ZFSet.mem_union.mpr (Or.inl hx),?_⟩
      simp only [finiteIndex,ite_eq_left hx]
    · exact ⟨x,ZFSet.mem_union.mpr (Or.inr ((mem_elements x xs).mpr hx)),rfl⟩
  · rintro ⟨x,hx,rfl⟩
    rcases ZFSet.mem_union.mp hx with hx|hx
    · apply Or.inl
      exact ⟨x,hx,by simp only [finiteIndex,ite_eq_left hx]⟩
    · exact Or.inr ⟨x,(mem_elements x xs).mp hx,rfl⟩

end FiniteTuple
end TuringRigidity.BoundedSetTheory

end OAI