File size: 3,468 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
import OAI.Computability.DegreeRigidity.Syntax.SetSatisfactionBounded
import OAI.Computability.DegreeRigidity.Constructibility.ConstructibleTupleSpace

namespace OAI


namespace TuringRigidity.RelativeConstructible
open ElementaryModel BoundedSetTheory TransitiveNameModel
universe u

def prependValues (w : ℕ → ZFSet.{u}) : ℕ → (ℕ → ZFSet.{u}) → ℕ → ZFSet.{u}
  | 0, e => e
  | n+1, e => prependValues w n (cons (w n) e)

theorem prependValues_tail (w : ℕ → ZFSet.{u}) (n : ℕ) (e : ℕ → ZFSet.{u}) (i : ℕ) :
    prependValues w n e (n+i) = e i := by
  induction n generalizing e i with
  | zero => simp [prependValues]
  | succ n ih =>
    change prependValues w n (cons (w n) e) (n+1+i) = e i
    rw [show n+1+i = n+(i+1) by omega,ih]
    rfl

theorem prependValues_lt (w : ℕ → ZFSet.{u}) (n : ℕ) (e : ℕ → ZFSet.{u})
    (i : ℕ) (hi : i < n) : prependValues w n e i = w i := by
  induction n generalizing e with
  | zero => omega
  | succ n ih =>
    by_cases hin : i < n
    · exact ih _ hin
    · have he : i = n := by omega
      subst i
      exact prependValues_tail w n (cons (w n) e) 0

def readGraph : ℕ → ℕ → ℕ → (ℕ → ℕ) → Formula → Formula
  | 0, _, _, _, ψ => ψ
  | n+1, a, g, idx, ψ => .existsMem a
      (.conj (.pairMem (idx n+1) 0 (g+1))
        (readGraph n (a+1) (g+1) (fun i => idx i+1) ψ))

theorem readGraph_eval (n a g : ℕ) (idx : ℕ → ℕ) (ψ : Formula)
    (e w : ℕ → ZFSet.{u}) (hw : ∀ i, i < n → w i ∈ e a)
    (hg : ∀ i, i < n → ∀ y ∈ e a,
      (ZFSet.pair (e (idx i)) y ∈ e g ↔ y = w i)) :
    (readGraph n a g idx ψ).Eval e ↔ ψ.Eval (prependValues w n e) := by
  induction n generalizing a g idx e with
  | zero => rfl
  | succ n ih =>
    simp only [readGraph,Formula.Eval,Formula.eval_pairMem,cons_zero,cons_succ]
    constructor
    · rintro ⟨x,hx,hpair,hbody⟩
      have he : x = w n := (hg n (by omega) x hx).mp hpair
      subst x
      exact (ih (a+1) (g+1) (fun i => idx i+1) (cons (w n) e)
        (fun i hi => hw i (by omega)) (fun i hi => hg i (by omega))).mp hbody
    · intro h
      refine ⟨w n,hw n (by omega),(hg n (by omega) _ (hw n (by omega))).mpr rfl,?_⟩
      exact (ih (a+1) (g+1) (fun i => idx i+1) (cons (w n) e)
        (fun i hi => hw i (by omega)) (fun i hi => hg i (by omega))).mpr h

def graphTruth (p : SentenceForm) (a g : ℕ) (idx : ℕ → ℕ) : Formula :=
  readGraph p.bound a g idx (setBounded p (p.bound+a) id)

theorem graphTruth_spec (p : SentenceForm) (a g : ℕ) (idx : ℕ → ℕ)
    (e : ℕ → ZFSet.{u}) {n : ℕ} (v : Fin n → ZFSet.{u})
    (hv : ∀ i, v i ∈ e a) (hb : p.bound ≤ n) (hg : e g = tupleGraph v)
    (hi : ∀ i, i < p.bound → e (idx i) = natSet i) :
    (graphTruth p a g idx).Eval e ↔ p.Sat (e a : Set ZFSet) (tupleEnv v) := by
  have hw (i : ℕ) (h : i < p.bound) : tupleEnv v i ∈ e a := by
    simpa [tupleEnv,show i < n by omega] using hv ⟨i,by omega⟩
  have hlookup (i : ℕ) (h : i < p.bound) (y : ZFSet.{u}) (_hy : y ∈ e a) :
      ZFSet.pair (e (idx i)) y ∈ e g ↔ y = tupleEnv v i := by
    rw [hg,hi i h]
    simpa [tupleEnv,show i < n by omega] using tupleGraph_pair v ⟨i,by omega⟩ y
  rw [graphTruth,readGraph_eval p.bound a g idx _ e (tupleEnv v) hw hlookup,setBounded_eval,
    prependValues_tail]
  exact p.finite_support _ _ _ (fun i h => prependValues_lt _ _ _ i h)

end TuringRigidity.RelativeConstructible

end OAI