Download lean/OAI/Computability/DegreeRigidity/Syntax/BoundedDefinability.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 5.91 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/DegreeRigidity/Syntax/BoundedDefinability.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Computability/DegreeRigidity/Syntax/BoundedDefinability.lean
-
curl -L -o BoundedDefinability.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/DegreeRigidity/Syntax/BoundedDefinability.lean
5.91 kB
| import OAI.Computability.DegreeRigidity.SetModels.SetModelFunctionGraphs | |
| namespace OAI | |
| namespace TuringRigidity.BoundedDefinability | |
| open BoundedSetTheory TransitiveNameModel SetModelReals SetModelFunctions | |
| universe u | |
| noncomputable section | |
| def mix (e d : ℕ → ZFSet.{u}) (n : ℕ) : ZFSet.{u} := | |
| if n % 2 = 0 then e (n/2) else d (n/2) | |
| @[simp] theorem mix_even (e d : ℕ → ZFSet.{u}) (n : ℕ) : mix e d (2*n) = e n := by | |
| simp [mix] | |
| @[simp] theorem mix_odd (e d : ℕ → ZFSet.{u}) (n : ℕ) : mix e d (2*n+1) = d n := by | |
| simp [mix,Nat.add_div] | |
| theorem parity_ext {α : Sort*} {f g : ℕ → α} (he : ∀ n, f (2*n) = g (2*n)) | |
| (ho : ∀ n, f (2*n+1) = g (2*n+1)) : f = g := by | |
| funext n | |
| have hm : n%2 < 2 := Nat.mod_lt n (by decide) | |
| by_cases h : n%2=0 | |
| · have hn : n=2*(n/2) := by omega | |
| rw [hn] | |
| exact he _ | |
| · have hn : n=2*(n/2)+1 := by omega | |
| rw [hn] | |
| exact ho _ | |
| def slotMap (r s : ℕ → ℕ) (n : ℕ) : ℕ := | |
| if n%2=0 then 2*r (n/2) else 2*s (n/2)+1 | |
| @[simp] theorem slotMap_even (r s : ℕ → ℕ) (n : ℕ) : slotMap r s (2*n) = 2*r n := by | |
| simp [slotMap] | |
| @[simp] theorem slotMap_odd (r s : ℕ → ℕ) (n : ℕ) : slotMap r s (2*n+1) = 2*s n+1 := by | |
| simp [slotMap,Nat.add_div] | |
| @[simp] theorem mix_slotMap (e d : ℕ → ZFSet.{u}) (r s : ℕ → ℕ) : | |
| mix e d ∘ slotMap r s = mix (e ∘ r) (d ∘ s) := by | |
| apply parity_ext <;> intro n <;> simp | |
| def Definable (M : ZFSet.{u}) (P : (ℕ → ZFSet.{u}) → Prop) : Prop := | |
| ∃ p : Formula, ∃ d : ℕ → ZFSet.{u}, (∀ i, d i ∈ M) ∧ | |
| ∀ e, p.Eval (mix e d) ↔ P e | |
| variable {M : ZFSet.{u}} {P Q : (ℕ → ZFSet.{u}) → Prop} | |
| theorem Definable.congr (h : Definable M P) (he : ∀ e, P e ↔ Q e) : Definable M Q := by | |
| obtain ⟨p,d,hd,hp⟩ := h | |
| exact ⟨p,d,hd,fun e => (hp e).trans (he e)⟩ | |
| theorem Definable.subst (h : Definable M P) (r : ℕ → ℕ) : | |
| Definable M (fun e => P (e ∘ r)) := by | |
| obtain ⟨p,d,hd,hp⟩ := h | |
| refine ⟨p.rename (slotMap r id),d,hd,?_⟩ | |
| intro e | |
| simpa only [Formula.eval_rename_comp,mix_slotMap,Function.comp_id] using hp (e ∘ r) | |
| theorem Definable.neg (h : Definable M P) : Definable M (fun e => ¬ P e) := by | |
| obtain ⟨p,d,hd,hp⟩ := h | |
| exact ⟨.neg p,d,hd,fun e => not_congr (hp e)⟩ | |
| theorem Definable.and (hP : Definable M P) (hQ : Definable M Q) : | |
| Definable M (fun e => P e ∧ Q e) := by | |
| obtain ⟨p,d,hd,hp⟩ := hP | |
| obtain ⟨q,c,hc,hq⟩ := hQ | |
| refine ⟨.conj (p.rename (slotMap id (fun i => 2*i))) | |
| (q.rename (slotMap id (fun i => 2*i+1))),mix d c,?_,?_⟩ | |
| · intro i | |
| unfold mix | |
| split <;> first | exact hd _ | exact hc _ | |
| · intro e | |
| simp only [Formula.Eval,Formula.eval_rename_comp,mix_slotMap,Function.comp_id] | |
| have hd' : mix d c ∘ (fun i => 2*i) = d := by funext i; simp | |
| have hc' : mix d c ∘ (fun i => 2*i+1) = c := by funext i; simp | |
| rw [hd',hc',hp,hq] | |
| def bindSlots (n : ℕ) : ℕ := | |
| if n%2=0 then if n/2=0 then 0 else 2*(n/2-1)+1 else 2*(n/2)+2 | |
| @[simp] theorem bindSlots_zero : bindSlots 0 = 0 := rfl | |
| @[simp] theorem bindSlots_even_succ (n : ℕ) : bindSlots (2*(n+1)) = 2*n+1 := by | |
| simp [bindSlots] | |
| @[simp] theorem bindSlots_odd (n : ℕ) : bindSlots (2*n+1) = 2*n+2 := by | |
| simp [bindSlots,Nat.add_div] | |
| theorem bind_mix (x : ZFSet.{u}) (e d : ℕ → ZFSet.{u}) : | |
| cons x (mix e d) ∘ bindSlots = mix (cons x e) d := by | |
| apply parity_ext | |
| · intro n | |
| cases n with | |
| | zero => rfl | |
| | succ n => simp | |
| · intro n | |
| simp [show 2*n+2 = (2*n+1)+1 from by omega] | |
| theorem Definable.existsMem (h : Definable M P) (i : ℕ) : | |
| Definable M (fun e => ∃ x ∈ e i, P (cons x e)) := by | |
| obtain ⟨p,d,hd,hp⟩ := h | |
| refine ⟨.existsMem (2*i) (p.rename bindSlots),d,hd,?_⟩ | |
| intro e | |
| simp only [Formula.Eval,mix_even,Formula.eval_rename_comp,bind_mix,hp] | |
| theorem Definable.existsParam (h : Definable M P) {a : ZFSet.{u}} (ha : a ∈ M) : | |
| Definable M (fun e => ∃ x ∈ a, P (cons x e)) := by | |
| obtain ⟨p,d,hd,hp⟩ := h | |
| let r := slotMap id Nat.succ | |
| refine ⟨.existsMem 1 ((p.rename r).rename bindSlots),cons a d,?_,?_⟩ | |
| · intro i | |
| cases i with | |
| | zero => exact ha | |
| | succ i => exact hd i | |
| · intro e | |
| have hd' : cons a d ∘ Nat.succ = d := rfl | |
| simp only [r,Formula.Eval,Formula.eval_rename_comp,bind_mix,mix_slotMap,Function.comp_id,hd',hp, | |
| show mix e (cons a d) 1 = a from rfl] | |
| theorem equal_definable (C : Context M) (i j : ℕ) : Definable M (fun e => e i = e j) := | |
| ⟨.equal (2*i) (2*j),fun _ => ZFSet.omega,fun _ => C.omega_mem,fun e => by simp [Formula.Eval]⟩ | |
| theorem member_definable (C : Context M) (i j : ℕ) : Definable M (fun e => e i ∈ e j) := | |
| ⟨.member (2*i) (2*j),fun _ => ZFSet.omega,fun _ => C.omega_mem,fun e => by simp [Formula.Eval]⟩ | |
| theorem equal_param {a : ZFSet.{u}} (ha : a ∈ M) (i : ℕ) : | |
| Definable M (fun e => e i = a) := | |
| ⟨.equal (2*i) 1,fun _ => a,fun _ => ha,fun e => by simp [Formula.Eval,mix]⟩ | |
| theorem pairMem_param {a : ZFSet.{u}} (ha : a ∈ M) (i j : ℕ) : | |
| Definable M (fun e => ZFSet.pair (e i) (e j) ∈ a) := | |
| ⟨.pairMem (2*i) (2*j) 1,fun _ => a,fun _ => ha,fun e => by simp [mix]⟩ | |
| theorem Definable.sep_mem (C : Context M) (h : Definable M P) (e : ℕ → ZFSet.{u}) | |
| (he : ∀ i, e i ∈ M) {a : ZFSet.{u}} (ha : a ∈ M) : | |
| ZFSet.sep (fun x => P (cons x e)) a ∈ M := by | |
| obtain ⟨p,d,hd,hp⟩ := h | |
| let q := p.rename bindSlots | |
| have hm : ∀ i, mix e d i ∈ M := by | |
| intro i | |
| unfold mix | |
| split <;> first | exact he _ | exact hd _ | |
| have hs := BoundedSetTheory.sep_mem M C.transitive C.separation q (mix e d) hm ha | |
| have hh : ZFSet.sep (fun x => q.Eval (cons x (mix e d))) a = | |
| ZFSet.sep (fun x => P (cons x e)) a := by | |
| apply ZFSet.ext | |
| intro x | |
| simp only [ZFSet.mem_sep,q,Formula.eval_rename_comp,bind_mix,hp] | |
| exact hh ▸ hs | |
| end | |
| end TuringRigidity.BoundedDefinability | |
| end OAI | |