Download data/lean/OAI/Computability/PerfectCompleteness/Construction/OriginalHiddenChild.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 10.7 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Construction/OriginalHiddenChild.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Construction/OriginalHiddenChild.lean
-
curl -L -o OriginalHiddenChild.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Construction/OriginalHiddenChild.lean
10.7 kB
Lean 4 Β· 17
declarations fullstatements
| import OAI.Computability.PerfectCompleteness.Construction.OriginalChildBlocks | |
| import OAI.Computability.PerfectCompleteness.Construction.SourceQuestionOrderLemmas | |
| import OAI.Computability.PerfectCompleteness.Foundations.GeometricPathLemmas | |
| import OAI.Computability.PerfectCompleteness.Reduction.CompletionSoundness | |
| namespace OAI | |
| section | |
| namespace PerfectCompleteness.OriginalHiddenChild | |
| open RecursiveSpaces DescendantSpaces TreeSourceSpaces HierarchicalArrays | |
| open UniqueGamesTheorem.Foundations.Games | |
| open scoped BigOperators Classical | |
| noncomputable section | |
| private theorem sigmaLaw_pushforward {E Ξ : Type*} {F : E β Type*} | |
| [Fintype E] [β e, Fintype (F e)] [Fintype Ξ] | |
| (ΞΌ : FiniteDistribution E) (Ξ½ : β e, FiniteDistribution (F e)) | |
| (f : β e, F e β Ξ) : | |
| (CompletionSoundness.sigmaLaw ΞΌ Ξ½).pushforward (fun x => f x.1 x.2) = | |
| ΞΌ.mixture (fun e => (Ξ½ e).pushforward (f e)) := by | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro z | |
| simp only [FiniteDistribution.pushforward, CompletionSoundness.sigmaLaw, | |
| FiniteDistribution.mixture, Fintype.sum_sigma, Finset.mul_sum, mul_ite, mul_zero] | |
| private theorem product_mixture {E F Ξ : Type*} | |
| [Fintype E] [Fintype F] [Fintype Ξ] | |
| (ΞΌ : FiniteDistribution E) (Ξ½ : FiniteDistribution F) | |
| (R : E Γ F β FiniteDistribution Ξ) : | |
| (ΞΌ.product Ξ½).mixture R = ΞΌ.mixture (fun e => Ξ½.mixture (fun f => R (e, f))) := by | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro z | |
| simp only [FiniteDistribution.mixture, FiniteDistribution.product, | |
| Fintype.sum_prod_type, Finset.mul_sum, mul_assoc] | |
| variable {branch : Nat β Nat} {n t : Nat} | |
| abbrev Blocks (calls : Nat) (rows : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) := | |
| (child : Fin (branch n)) β ChildBlockCardinality.Raw calls rows (childSlots slots child) | |
| abbrev Tape (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) := | |
| Ξ£ leaf : Slots branch (n + 1), OriginalChildBlocks.SourceTape calls rows repeats | |
| leaf.1 (GeometricPath.leafPath leaf.2) slots | |
| def sourceLaw (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (hbranch : β k < n + 1, 0 < branch k) : | |
| FiniteDistribution (Tape calls rows repeats slots) := | |
| CompletionSoundness.sigmaLaw (GeometricPath.law (n + 1) hbranch) | |
| (fun leaf => OriginalChildBlocks.sourceLaw calls rows repeats leaf.1 | |
| (GeometricPath.leafPath leaf.2) slots) | |
| def rawMap (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (Ο : Tape calls rows repeats slots) : Blocks calls rows slots := | |
| OriginalChildBlocks.rawMap calls rows repeats Ο.1.1 | |
| (GeometricPath.leafPath Ο.1.2) slots Ο.2 | |
| def continuationLaw (hbranch : β k < n + 1, 0 < branch k) : | |
| FiniteDistribution (Slots branch n) := | |
| GeometricPath.law n (fun k hk => hbranch k (Nat.lt_trans hk (Nat.lt_succ_self n))) | |
| def averagedSpecial (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (hbranch : β k < n + 1, 0 < branch k) (child : Fin (branch n)) : | |
| FiniteDistribution (ChildBlockCardinality.Raw calls rows (childSlots slots child)) := | |
| (continuationLaw hbranch).mixture (fun leaf => | |
| OriginalChildBlocks.specialLaw calls rows repeats (GeometricPath.leafPath leaf) slots child) | |
| def blockMixture (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (hbranch : β k < n + 1, 0 < branch k) : FiniteDistribution (Blocks calls rows slots) := by | |
| letI : Nonempty (Fin (branch n)) := β¨β¨0, hbranch n (Nat.lt_succ_self n)β©β© | |
| exact ChildBlockMixture.mixture (averagedSpecial calls rows repeats slots hbranch) | |
| private theorem special_as_continued (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (chosen : Fin (branch n)) (leaf : Slots branch n) : | |
| ChildBlockMixture.special | |
| (OriginalChildBlocks.specialLaw calls rows repeats (GeometricPath.leafPath leaf) slots) | |
| chosen = | |
| ChildBlockContinuation.continuedSpecial | |
| (fun child leaf => OriginalChildBlocks.specialLaw calls rows repeats | |
| (GeometricPath.leafPath leaf) slots child) chosen leaf := by | |
| let : Nonempty (Fin (branch n)) := β¨chosenβ© | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro x | |
| rw [ChildBlockMixture.special_weight, ChildBlockContinuation.continuedSpecial_weight] | |
| theorem rawMap_law (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (hbranch : β k < n + 1, 0 < branch k) : | |
| (sourceLaw calls rows repeats slots hbranch).pushforward (rawMap calls rows repeats slots) = | |
| blockMixture calls rows repeats slots hbranch := by | |
| let : Nonempty (Fin (branch n)) := β¨β¨0, hbranch n (Nat.lt_succ_self n)β©β© | |
| refine (sigmaLaw_pushforward | |
| (E := Fin (branch n) Γ Slots branch n) (Ξ := Blocks calls rows slots) | |
| (GeometricPath.law (n + 1) hbranch) | |
| (fun leaf => OriginalChildBlocks.sourceLaw calls rows repeats leaf.1 | |
| (GeometricPath.leafPath leaf.2) slots) | |
| (fun leaf tape => OriginalChildBlocks.rawMap calls rows repeats leaf.1 | |
| (GeometricPath.leafPath leaf.2) slots tape)).trans ?_ | |
| simp_rw [OriginalChildBlocks.rawMap_law] | |
| rw [GeometricPath.law_step] | |
| refine (product_mixture (FiniteDistribution.uniform (Fin (branch n))) | |
| (continuationLaw hbranch) | |
| (fun tag : Fin (branch n) Γ Slots branch n => | |
| ChildBlockMixture.special | |
| (OriginalChildBlocks.specialLaw calls rows repeats (GeometricPath.leafPath tag.2) slots) | |
| tag.1)).trans ?_ | |
| simp_rw [special_as_continued] | |
| exact ChildBlockContinuation.uniform_average | |
| (fun _ : Fin (branch n) => continuationLaw hbranch) | |
| (fun child leaf => OriginalChildBlocks.specialLaw calls rows repeats | |
| (GeometricPath.leafPath leaf) slots child) | |
| theorem rawMap_eq_mixture [Nonempty (Fin (branch n))] | |
| (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (hbranch : β k < n + 1, 0 < branch k) : | |
| (sourceLaw calls rows repeats slots hbranch).pushforward (rawMap calls rows repeats slots) = | |
| ChildBlockMixture.mixture (averagedSpecial calls rows repeats slots hbranch) := | |
| rawMap_law calls rows repeats slots hbranch | |
| def observed (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (Ο : Tape calls rows repeats slots) : CutChildGrouping.Assembled (C := Fin calls) slots rows := | |
| OriginalChildBlocks.observed calls rows repeats Ο.1.1 | |
| (GeometricPath.leafPath Ο.1.2) slots Ο.2 | |
| theorem assemble_rawMap (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (Ο : Tape calls rows repeats slots) : | |
| CutChildGrouping.assemble slots rows (rawMap calls rows repeats slots Ο) = | |
| observed calls rows repeats slots Ο := | |
| OriginalChildBlocks.assemble_rawMap calls rows repeats Ο.1.1 | |
| (GeometricPath.leafPath Ο.1.2) slots Ο.2 | |
| theorem observed_law (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (hbranch : β k < n + 1, 0 < branch k) : | |
| (sourceLaw calls rows repeats slots hbranch).pushforward (observed calls rows repeats slots) = | |
| (blockMixture calls rows repeats slots hbranch).pushforward | |
| (CutChildGrouping.assemble slots rows) := by | |
| rw [β rawMap_law calls rows repeats slots hbranch, FiniteDistribution.pushforward_comp] | |
| congr 1 | |
| funext Ο | |
| exact (assemble_rawMap calls rows repeats slots Ο).symm | |
| theorem raw_observed_variation {Ξ : Type*} [Fintype Ξ] | |
| (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (hbranch : β k < n + 1, 0 < branch k) (observe : Blocks calls rows slots β Ξ) : | |
| ((sourceLaw calls rows repeats slots hbranch).pushforward | |
| (fun Ο => observe (rawMap calls rows repeats slots Ο))).totalVariation | |
| ((ChildBlockMixture.reference (Ξ© := fun child : Fin (branch n) => | |
| ChildBlockCardinality.Raw calls rows (childSlots slots child))).pushforward observe) β€ | |
| Real.sqrt ((ChildBlockCardinality.bound branch n t calls rows : β) ^ 2 / | |
| branch n) / 2 := by | |
| let : Nonempty (Fin (branch n)) := β¨β¨0, hbranch n (Nat.lt_succ_self n)β©β© | |
| have hpush : (sourceLaw calls rows repeats slots hbranch).pushforward | |
| (fun Ο => observe (rawMap calls rows repeats slots Ο)) = | |
| (blockMixture calls rows repeats slots hbranch).pushforward observe := by | |
| rw [β rawMap_law calls rows repeats slots hbranch] | |
| exact (FiniteDistribution.pushforward_comp _ _ _).symm | |
| rw [hpush] | |
| simpa only [blockMixture, Fintype.card_fin] using | |
| (ChildBlockMixture.actual_observed_variation calls rows (fun child => childSlots slots child) | |
| (averagedSpecial calls rows repeats slots hbranch) observe) | |
| theorem observed_variation {Ξ : Type*} [Fintype Ξ] | |
| (calls : Nat) (rows repeats : Nat β Nat) | |
| (slots : Slots branch (n + 1) β Fin t β MixedSupport.Slot) | |
| (hbranch : β k < n + 1, 0 < branch k) | |
| (observe : CutChildGrouping.Assembled (C := Fin calls) slots rows β Ξ) : | |
| ((sourceLaw calls rows repeats slots hbranch).pushforward | |
| (fun Ο => observe (observed calls rows repeats slots Ο))).totalVariation | |
| ((FiniteDistribution.uniform (CutChildGrouping.Assembled (C := Fin calls) slots rows)).pushforward | |
| observe) β€ | |
| Real.sqrt ((ChildBlockCardinality.bound branch n t calls rows : β) ^ 2 / | |
| branch n) / 2 := by | |
| have hclean : (ChildBlockMixture.reference (Ξ© := fun child : Fin (branch n) => | |
| ChildBlockCardinality.Raw calls rows (childSlots slots child))).pushforward | |
| (fun x => observe (CutChildGrouping.assemble slots rows x)) = | |
| (FiniteDistribution.uniform (CutChildGrouping.Assembled (C := Fin calls) slots rows)).pushforward | |
| observe := by | |
| rw [β FiniteDistribution.pushforward_comp] | |
| have h := CutChildGrouping.assemble_law (C := Fin calls) slots rows | |
| change (ChildBlockMixture.reference (Ξ© := fun child : Fin (branch n) => | |
| ChildBlockCardinality.Raw calls rows (childSlots slots child))).pushforward | |
| (CutChildGrouping.assemble slots rows) = _ at h | |
| rw [h] | |
| have h := raw_observed_variation calls rows repeats slots hbranch | |
| (fun x => observe (CutChildGrouping.assemble slots rows x)) | |
| simpa only [assemble_rawMap, hclean] using h | |
| end | |
| end PerfectCompleteness.OriginalHiddenChild | |
| end | |
| end OAI | |
Outline
- theorem
sigmaLaw_pushforward18 - theorem
product_mixture29 - abbrev
Blocks41 - abbrev
Tape45 - def
sourceLaw50 - def
rawMap58 - def
continuationLaw64 - def
averagedSpecial68 - def
blockMixture75 - theorem
special_as_continued81 - theorem
rawMap_law95 - theorem
rawMap_eq_mixture122 - def
observed130 - theorem
assemble_rawMap136 - theorem
observed_law144 - theorem
raw_observed_variation155 - theorem
observed_variation176