Download data/lean/OAI/Computability/PerfectCompleteness/Construction/LocalReconstruction.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.93 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Construction/LocalReconstruction.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Construction/LocalReconstruction.lean
-
curl -L -o LocalReconstruction.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Construction/LocalReconstruction.lean
4.93 kB
| import OAI.Computability.PerfectCompleteness.Construction.FactoredFunctionsLemmas | |
| import OAI.Computability.PerfectCompleteness.Sampling.UniformChildSum | |
| namespace OAI | |
| namespace PerfectCompleteness.LocalReconstruction | |
| open scoped BigOperators | |
| open PointwiseSpaces RecursiveSpaces FactoredFunctions | |
| noncomputable section | |
| variable {π : Type*} [Field π] {branch : Nat β Nat} {n : Nat} | |
| abbrev Retained (A : Slots branch (n + 1) β Type*) | |
| (clean : Fin (branch n) β Prop) := | |
| (j : {j : Fin (branch n) // Β¬ clean j}) β Assignment (childFamily A j.1) | |
| def retain (A : Slots branch (n + 1) β Type*) (clean : Fin (branch n) β Prop) : | |
| Assignment A β Retained A clean := | |
| fun x j => childRestriction A j.1 x | |
| abbrev Summands (A : Slots branch (n + 1) β Type*) | |
| (clean : Fin (branch n) β Prop) := | |
| (j : {j : Fin (branch n) // Β¬ clean j}) β | |
| squareSpace (space π branch n (childFamily A j.1)) | |
| def retainedCut (A : Slots branch (n + 1) β Type*) | |
| (clean : Fin (branch n) β Prop) [DecidablePred clean] | |
| (u : Summands (π := π) A clean) : Retained A clean β π := | |
| fun x => β j, (u j).val (x j) | |
| def cutCall (A : Slots branch (n + 1) β Type*) | |
| (clean : Fin (branch n) β Prop) [DecidablePred clean] | |
| (u : Summands (π := π) A clean) : space π branch (n + 1) A := | |
| β¨β j, pullback π (childRestriction A j.1) (u j).val, by | |
| apply (space π branch (n + 1) A).sum_mem | |
| intro j _ | |
| exact child_square_le_space A j.1 (Submodule.mem_map_of_mem (u j).property)β© | |
| theorem cutCall_factors (A : Slots branch (n + 1) β Type*) | |
| (clean : Fin (branch n) β Prop) [DecidablePred clean] | |
| (u : Summands (π := π) A clean) : | |
| (cutCall A clean u).val = retainedCut A clean u β retain A clean := by | |
| funext x | |
| simp only [cutCall, retainedCut, retain, Function.comp_apply, | |
| Finset.sum_apply, PointwiseSpaces.pullback_apply] | |
| theorem cutCall_ignores_clean (A : Slots branch (n + 1) β Type*) | |
| (clean : Fin (branch n) β Prop) [DecidablePred clean] | |
| (u : Summands (π := π) A clean) : | |
| (cutCall A clean u).val β factoringSpace (retain A clean) := by | |
| rw [mem_factoringSpace_iff_exists_factor] | |
| exact β¨retainedCut A clean u, fun x => congrFun (cutCall_factors A clean u) xβ© | |
| theorem actual_sum_eq_cutCall (A : Slots branch (n + 1) β Type*) | |
| (clean : Fin (branch n) β Prop) [DecidablePred clean] | |
| (u : (j : Fin (branch n)) β squareSpace (space π branch n (childFamily A j))) | |
| (zero : β j, clean j β u j = 0) : | |
| UniformChildSum.recursiveSum A u = cutCall A clean (fun j => u j.1) := by | |
| apply Subtype.ext | |
| change (β j : Fin (branch n), pullback π (childRestriction A j) (u j).val) = _ | |
| rw [β Fintype.sum_subtype_add_sum_subtype clean | |
| (fun j => pullback π (childRestriction A j) (u j).val)] | |
| have hz : (β j : {j : Fin (branch n) // clean j}, | |
| pullback π (childRestriction A j.1) (u j.1).val) = 0 := by | |
| apply Finset.sum_eq_zero | |
| intro j _ | |
| rw [zero j.1 j.2] | |
| exact map_zero _ | |
| rw [hz, zero_add] | |
| rfl | |
| theorem actual_sum_ignores_clean (A : Slots branch (n + 1) β Type*) | |
| (clean : Fin (branch n) β Prop) [DecidablePred clean] | |
| (u : (j : Fin (branch n)) β squareSpace (space π branch n (childFamily A j))) | |
| (zero : β j, clean j β u j = 0) : | |
| (UniformChildSum.recursiveSum A u).val β factoringSpace (retain A clean) := by | |
| rw [actual_sum_eq_cutCall A clean u zero] | |
| exact cutCall_ignores_clean A clean _ | |
| inductive Recipe (π Atom : Type*) where | |
| | constant : π β Recipe π Atom | |
| | atom : Atom β Recipe π Atom | |
| | add : Recipe π Atom β Recipe π Atom β Recipe π Atom | |
| | mul : Recipe π Atom β Recipe π Atom β Recipe π Atom | |
| namespace Recipe | |
| variable {Atom X Z : Type*} | |
| def evaluate (atoms : Atom β X β π) : Recipe π Atom β X β π | |
| | .constant c => fun _ => c | |
| | .atom a => atoms a | |
| | .add f g => evaluate atoms f + evaluate atoms g | |
| | .mul f g => evaluate atoms f * evaluate atoms g | |
| theorem evaluate_factors (other : X β Z) (atoms : Atom β X β π) | |
| (known : β a, atoms a β factoringSpace other) (r : Recipe π Atom) : | |
| r.evaluate atoms β factoringSpace other := by | |
| induction r with | |
| | constant c => exact const_mem_factoringSpace other c | |
| | atom a => exact known a | |
| | add f g hf hg => exact (factoringSpace other).add_mem hf hg | |
| | mul f g hf hg => exact mul_mem_factoringSpace other hf hg | |
| theorem evaluate_pullback (other : X β Z) (atoms : Atom β Z β π) | |
| (r : Recipe π Atom) : | |
| r.evaluate (fun a => atoms a β other) = r.evaluate atoms β other := by | |
| induction r with | |
| | constant c => rfl | |
| | atom a => rfl | |
| | add f g hf hg => | |
| simp only [evaluate, hf, hg] | |
| rfl | |
| | mul f g hf hg => | |
| simp only [evaluate, hf, hg] | |
| rfl | |
| end Recipe | |
| end | |
| end PerfectCompleteness.LocalReconstruction | |
| end OAI | |