File size: 15,453 Bytes
3277efa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
import OAI.SetTheory.PartitionPrinciple.Definability.AssignmentQueryFormulas
import OAI.SetTheory.PartitionPrinciple.Transfinite.GroundStructuralFullIndexSize

namespace OAI

namespace PartitionPilot.Forcing

section
universe u

theorem assignmentOnIndices_indices_on {I T X A : ZFSet.{u}}
    (shape : A ⊆ stageOneAssignments I T) :
    assignmentOnIndices (assignmentIndices I T (assignmentOnIndices X T A)) T A =
      assignmentOnIndices X T A := by
  apply ZFSet.ext
  intro z
  constructor
  · intro member
    obtain ⟨hA, inside⟩ := (mem_assignmentOnIndices _ T A z).1 member
    obtain ⟨t, ht, v, hv, w, hw, rfl⟩ := (mem_stageOneAssignments _ T z).1 inside
    rw [assignmentIndices_on] at ht
    exact (assignmentOnIndices_entry X T A t v w).2
      ⟨hA, (ZFSet.mem_inter.1 ht).2, hv, hw⟩
  · intro member
    have hA := ((mem_assignmentOnIndices X T A z).1 member).1
    obtain ⟨t, ht, v, hv, w, hw, rfl⟩ := (mem_stageOneAssignments I T z).1 (shape hA)
    exact (assignmentOnIndices_entry _ T A t v w).2
      ⟨hA, (mem_assignmentIndices I T (assignmentOnIndices X T A) t).2
        ⟨ht, v, hv, w, hw, member⟩, hv, hw⟩

end

namespace TransitiveGround
open SetFormula
universe u
variable (M : TransitiveGround.{u})
variable (pairing : Realize M.sets SetFormula.pairing Fin.elim0)
variable (unions : Realize M.sets SetFormula.union Fin.elim0)
variable (powers : Realize M.sets powerSet Fin.elim0) (separation : SeparationSchema M.sets)
include pairing unions powers separation

theorem assignmentQueryRelation_mem {I T C D : ZFSet.{u}}
    (hI : I ∈ M.sets) (hT : T ∈ M.sets) (hC : C ∈ M.sets) (hD : D ∈ M.sets) :
    assignmentQueryRelation I T C D ∈ M.sets := by
  let f := productFirst I (ZFSet.prod T T)
  have hf : f ∈ M.sets := M.productFirst_mem pairing unions powers separation hI
    (M.prod_mem pairing unions powers separation hT hT)
  let params := extend I (extend f Fin.elim0)
  have selected := M.bounded_separation_mem separation
    (BoundedFormula.assignmentQueryRelationFormula 0 1 2) params
    (Fin.cases hI (Fin.cases hf (fun j => Fin.elim0 j)))
    (M.prod_mem pairing unions powers separation hC hD)
  have equal : ZFSet.sep (fun z => BoundedFormula.Truth
      (BoundedFormula.assignmentQueryRelationFormula 0 1 2) (extend z params))
      (ZFSet.prod C D) = assignmentQueryRelation I T C D := by
    apply ZFSet.ext
    intro z
    rw [ZFSet.mem_sep, assignmentQueryRelation, ZFSet.mem_sep]
    exact and_congr Iff.rfl (BoundedFormula.truth_assignmentQueryRelationFormula 0 1 2
      (extend z params) T rfl)
  exact equal ▸ selected

theorem realizedAssignmentQueries_mem {I T C D : ZFSet.{u}}
    (hI : I ∈ M.sets) (hT : T ∈ M.sets) (hC : C ∈ M.sets) (hD : D ∈ M.sets) :
    realizedAssignmentQueries I T C D ∈ M.sets :=
  M.relationImage_mem separation hD hC (M.relationConverse_mem pairing unions powers separation
    hC hD (M.assignmentQueryRelation_mem pairing unions powers separation hI hT hC hD))

theorem exists_assignmentQuerySelector
    (choice : Realize M.sets SetFormula.choice Fin.elim0)
    {I T C D : ZFSet.{u}} (hI : I ∈ M.sets) (hT : T ∈ M.sets)
    (hC : C ∈ M.sets) (hD : D ∈ M.sets) :
    ∃ F ∈ M.sets, ZFSet.IsFunc (realizedAssignmentQueries I T C D) D F ∧
      F ⊆ assignmentQueryRelation I T C D := by
  apply M.uniformize_relation pairing unions powers separation choice
    (M.realizedAssignmentQueries_mem pairing unions powers separation hI hT hC hD) hD
    (M.assignmentQueryRelation_mem pairing unions powers separation hI hT hC hD)
  intro q member
  exact ((mem_realizedAssignmentQueries I T C D q).1 member).2

theorem exists_stageOneAssignmentQuerySelector
    (choice : Realize M.sets SetFormula.choice Fin.elim0)
    {rows I T D : ZFSet.{u}} (hRows : rows ∈ M.sets) (hI : I ∈ M.sets)
    (hT : T ∈ M.sets) (omega : ZFSet.omega ∈ M.sets) (hD : D ∈ M.sets) :
    ∃ F ∈ M.sets,
      ZFSet.IsFunc (realizedAssignmentQueries I T (M.stageOneCandidateBound rows I T) D) D F ∧
      F ⊆ assignmentQueryRelation I T (M.stageOneCandidateBound rows I T) D :=
  M.exists_assignmentQuerySelector pairing unions powers separation choice hI hT
    (M.stageOneCandidateBound_mem pairing unions powers separation hRows hI hT omega) hD

end TransitiveGround

namespace TransitiveGround
open SetFormula
universe u
variable (M : TransitiveGround.{u})

theorem exists_groundOmegaOneClosure
    (pairing : Realize M.sets SetFormula.pairing Fin.elim0)
    (unions : Realize M.sets SetFormula.union Fin.elim0)
    (powers : Realize M.sets powerSet Fin.elim0) (separation : SeparationSchema M.sets)
    (collection : CollectionSchema M.sets) (infinite : Realize M.sets infinity Fin.elim0)
    (choice : Realize M.sets SetFormula.choice Fin.elim0)
    {I K : ZFSet.{u}} (hK : K ∈ M.sets) (conditions : GroundInaccessibleConditions M K)
    {n : Nat} {f : (Fin (n + 1) → ZFSet.{u}) → ZFSet.{u}}
    (defined : GroundDefinableFunction M f) (params : Fin n → ZFSet.{u})
    (members : ∀ j, params j ∈ M.sets)
    (inflationary : ∀ X ∈ M.sets, X ⊆ I → X ⊆ f (extend X params))
    (preserves : ∀ X ∈ M.sets, X ⊆ I → GroundBelow M X K →
      f (extend X params) ⊆ I ∧ GroundBelow M (f (extend X params)) K) :
    let C := M.groundOmegaOne pairing unions powers separation collection infinite
    ∃ history ∈ M.sets,
      OrdinalRecursionTrace (fun alpha prior output =>
        output = f (extend (refinementHistoryIndices alpha prior) params)) C history ∧
      let X := refinementHistoryIndices C history
      X ∈ M.sets ∧ X ⊆ I ∧ GroundBelow M X K ∧
      (∀ alpha Y, ZFSet.pair alpha Y ∈ history →
        Y ∈ M.sets ∧ Y ⊆ I ∧ GroundBelow M Y K) ∧
      (∀ alpha beta Y Z, ZFSet.pair alpha Y ∈ history →
        ZFSet.pair beta Z ∈ history → alpha ∈ beta → Y ⊆ Z) ∧
      ∀ B ∈ M.sets, M.groundEmbeddable B ZFSet.omega → B ⊆ X →
        ∃ beta ∈ C,
          let U := refinementHistoryIndices beta history
          U ∈ M.sets ∧ U ⊆ X ∧ GroundBelow M U K ∧ B ⊆ U ∧ f (extend U params) ⊆ X := by
  let C := M.groundOmegaOne pairing unions powers separation collection infinite
  have spec := M.groundOmegaOne_spec pairing unions powers separation collection infinite
  have hC := spec.1
  obtain ⟨history, hh, trace⟩ := M.exists_historyUnionTrace pairing unions separation collection
    defined params members hC spec.2.1
  have bounds := M.historyUnionTrace_below pairing unions powers separation choice hK conditions
    (fun X => f (extend X params)) preserves C
    (conditions.groundOmegaOne_mem pairing unions powers separation collection infinite hK) history hh trace
  let X := refinementHistoryIndices C history
  have hX : X ∈ M.sets := M.refinementHistoryIndices_mem unions separation hC hh
  have step (beta Y : ZFSet.{u}) (entry : ZFSet.pair beta Y ∈ history) :
      Y = f (extend (refinementHistoryIndices beta history) params) := by
    have result := trace.2 beta (trace.1.pair_source entry) Y entry
    change Y = f (extend (refinementHistoryIndices beta (graphRestriction beta history)) params) at result
    rw [refinementHistoryIndices_restrict (fun _ hx => hx)] at result
    exact result
  have earlierUnion (beta : ZFSet.{u}) (member : beta ∈ C) :
      refinementHistoryIndices beta history ∈ M.sets ∧
      refinementHistoryIndices beta history ⊆ X ∧
      GroundBelow M (refinementHistoryIndices beta history) K := by
    have ground := M.refinementHistoryIndices_mem unions separation (M.transitive hC member) hh
    have subset := refinementHistoryIndices_mono (history := history) (spec.2.1.1 beta member)
    exact ⟨ground, subset, bounds.2.2.restrict separation ground hK subset⟩
  refine ⟨history, hh, trace, hX, bounds.2.1, bounds.2.2, ?_, ?_, ?_⟩
  · intro alpha Y entry
    exact ⟨M.transitive (M.union_mem unions (M.union_mem unions hh))
      (pair_second_mem_doubleUnion entry), bounds.1 alpha Y entry⟩
  · intro alpha beta Y Z first second before x inside
    have earlier := earlierUnion beta (trace.1.pair_source second)
    rw [step beta Z second]
    exact inflationary _ earlier.1 (fun _ hx => bounds.2.1 (earlier.2.1 hx))
      ((mem_refinementHistoryIndices beta history x).2 ⟨alpha, before, Y, first, inside⟩)
  · intro B hB small subset
    obtain ⟨beta, member, captured⟩ := M.historyUnion_countable_capture
      pairing unions powers separation collection infinite choice hh hB small subset
    have earlier := earlierUnion beta member
    refine ⟨beta, member, earlier.1, earlier.2.1, earlier.2.2, captured, ?_⟩
    obtain ⟨Y, entry⟩ := trace.1.total member
    rw [← step beta Y entry]
    intro x inside
    exact (mem_refinementHistoryIndices C history x).2 ⟨beta, member, Y, entry, inside⟩

theorem assignmentQueryClosure_representatives
    (pairing : Realize M.sets SetFormula.pairing Fin.elim0)
    (unions : Realize M.sets SetFormula.union Fin.elim0)
    (powers : Realize M.sets powerSet Fin.elim0) (separation : SeparationSchema M.sets)
    (choice : Realize M.sets SetFormula.choice Fin.elim0)
    {rows I T D c X : ZFSet.{u}} (hI : I ∈ M.sets) (hT : T ∈ M.sets)
    (omega : ZFSet.omega ∈ M.sets) (hX : X ∈ M.sets)
    (shape : D ⊆ M.stageOneCandidateBound rows I T)
    (selector : ZFSet.IsFunc
      (realizedAssignmentQueries I T (M.stageOneCandidateBound rows I T) D) D c)
    (selected : c ⊆ assignmentQueryRelation I T (M.stageOneCandidateBound rows I T) D)
    (capture : ∀ B ∈ M.sets, M.groundEmbeddable B ZFSet.omega → B ⊆ X →
      ∃ U, B ⊆ U ∧ representativeIndexStep I T
        (realizedAssignmentQueries I T (M.stageOneCandidateBound rows I T) D) c U ⊆ X) :
    ∀ row A, ZFSet.pair row A ∈ D →
      ∃ C, ZFSet.pair row C ∈ D ∧ assignmentIndices I T C ⊆ X ∧
        assignmentOnIndices (assignmentIndices I T (assignmentOnIndices X T A)) T C =
          assignmentOnIndices X T A := by
  intro row A member
  let L := assignmentOnIndices X T A
  let B := assignmentIndices I T L
  let Q := realizedAssignmentQueries I T (M.stageOneCandidateBound rows I T) D
  have data := (M.pair_mem_stageOneCandidateBound rows I T row A).1 (shape member)
  have hL : L ∈ M.sets := M.assignmentOnIndices_mem pairing unions powers separation hX hT data.2.1
  have smallL := M.assignmentOnIndices_small pairing unions powers separation hX hT data.2.1
    omega data.2.2.2
  have listShape : L ⊆ stageOneAssignments I T :=
    fun _ h => data.2.2.1 ((mem_assignmentOnIndices X T A _).1 h).1
  have queryCandidate : ZFSet.pair row L ∈ M.stageOneCandidateBound rows I T :=
    (M.pair_mem_stageOneCandidateBound rows I T row L).2 ⟨data.1, hL, listShape, smallL⟩
  have query : ZFSet.pair row L ∈ Q :=
    (mem_realizedAssignmentQueries I T (M.stageOneCandidateBound rows I T) D _).2
      ⟨queryCandidate, ZFSet.pair row A, member,
        (assignmentQueryRelation_entry I T (M.stageOneCandidateBound rows I T) D row L row A).2
          ⟨queryCandidate, member, rfl, assignmentOnIndices_indices_on data.2.2.1⟩⟩
  have hB : B ∈ M.sets := M.assignmentIndices_mem pairing unions powers separation hI hT hL
  have smallB := M.assignmentIndices_small pairing unions powers separation choice hI hT hL omega smallL
  have subsetB : B ⊆ X := by
    intro i hi
    change i ∈ assignmentIndices I T (assignmentOnIndices X T A) at hi
    rw [assignmentIndices_on] at hi
    exact (ZFSet.mem_inter.1 hi).2
  obtain ⟨U, captured, closed⟩ := capture B hB smallB subsetB
  obtain ⟨p, entry, _⟩ := selector.2 (ZFSet.pair row L) query
  have inD := (ZFSet.pair_mem_prod.1 (selector.1 entry)).2
  obtain ⟨other, _, C, _, _, _, rfl⟩ :=
    (M.mem_stageOneCandidateBound rows I T p).1 (shape inD)
  have matched := (assignmentQueryRelation_entry I T (M.stageOneCandidateBound rows I T) D
    row L other C).1 (selected entry)
  obtain rfl := matched.2.2.1
  refine ⟨C, inD, ?_, matched.2.2.2⟩
  have localQuery : AssignmentQueryWithin U T (ZFSet.pair row L) :=
    ⟨row, L, rfl, (assignment_subset_iff_indices_subset listShape).2 captured⟩
  exact fun _ h => closed (representativeIndexStep_covers query localQuery entry h)

theorem exists_assignmentRepresentativeClosure
    (pairing : Realize M.sets SetFormula.pairing Fin.elim0)
    (unions : Realize M.sets SetFormula.union Fin.elim0)
    (powers : Realize M.sets powerSet Fin.elim0) (separation : SeparationSchema M.sets)
    (collection : CollectionSchema M.sets) (infinite : Realize M.sets infinity Fin.elim0)
    (choice : Realize M.sets SetFormula.choice Fin.elim0)
    {rows I T D K : ZFSet.{u}} (hRows : rows ∈ M.sets) (hI : I ∈ M.sets)
    (hT : T ∈ M.sets) (hD : D ∈ M.sets) (hK : K ∈ M.sets)
    (conditions : GroundInaccessibleConditions M K)
    (smallRows : GroundBelow M rows K) (smallT : GroundBelow M T K)
    (shape : D ⊆ M.stageOneCandidateBound rows I T) :
    ∃ X ∈ M.sets, X ⊆ I ∧ GroundBelow M X K ∧
      ∀ row A, ZFSet.pair row A ∈ D →
        ∃ C, ZFSet.pair row C ∈ D ∧ assignmentIndices I T C ⊆ X ∧
          assignmentOnIndices (assignmentIndices I T (assignmentOnIndices X T A)) T C =
            assignmentOnIndices X T A := by
  have omega := M.omega_mem separation infinite
  let Q := realizedAssignmentQueries I T (M.stageOneCandidateBound rows I T) D
  have hQ : Q ∈ M.sets := M.realizedAssignmentQueries_mem pairing unions powers separation hI hT
    (M.stageOneCandidateBound_mem pairing unions powers separation hRows hI hT omega) hD
  have queries : Q ⊆ M.stageOneCandidateBound rows I T :=
    fun _ h => ((mem_realizedAssignmentQueries I T (M.stageOneCandidateBound rows I T) D _).1 h).1
  obtain ⟨c, hc, selector, selected⟩ := M.exists_stageOneAssignmentQuerySelector
    pairing unions powers separation choice hRows hI hT omega hD
  let params : Fin 4 → ZFSet.{u} := extend I (extend T (extend Q (extend c Fin.elim0)))
  have members : ∀ j, params j ∈ M.sets :=
    Fin.cases hI (Fin.cases hT (Fin.cases hQ (Fin.cases hc (fun j => Fin.elim0 j))))
  have inflationary : ∀ X ∈ M.sets, X ⊆ I →
      X ⊆ representativeIndexStep I T Q c X :=
    fun X _ _ => representativeIndexStep_contains I T Q c X
  have preserves : ∀ X ∈ M.sets, X ⊆ I → GroundBelow M X K →
      representativeIndexStep I T Q c X ⊆ I ∧
        GroundBelow M (representativeIndexStep I T Q c X) K := by
    intro X hX subset smallX
    exact ⟨representativeIndexStep_subset subset,
      M.representativeIndexStep_below pairing unions powers separation infinite choice
        hRows hI hT hQ hc hD hX hK conditions selector queries shape smallRows smallT smallX⟩
  obtain ⟨history, _, _, hX, subsetX, smallX, _, _, capture⟩ :=
    M.exists_groundOmegaOneClosure pairing unions powers separation collection infinite choice
      hK conditions (M.definable_representativeIndexStep pairing unions separation)
      params members inflationary preserves
  refine ⟨_, hX, subsetX, smallX,
    M.assignmentQueryClosure_representatives pairing unions powers separation choice
      hI hT omega hX shape selector selected ?_⟩
  intro B hB countable subset
  obtain ⟨beta, _, _, _, _, bounded, closed⟩ := capture B hB countable subset
  exact ⟨refinementHistoryIndices beta history, bounded, closed⟩

end TransitiveGround

end PartitionPilot.Forcing

end OAI