Download data/lean/OAI/Computability/PerfectCompleteness/Foundations/CutTerminalSplit.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.76 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Foundations/CutTerminalSplit.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Foundations/CutTerminalSplit.lean
-
curl -L -o CutTerminalSplit.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Foundations/CutTerminalSplit.lean
5.76 kB
| import Mathlib.Logic.Equiv.Prod | |
| import OAI.Computability.PerfectCompleteness.Construction.HiddenBucketBias | |
| import OAI.Computability.PerfectCompleteness.Foundations.TerminalCalls | |
| import OAI.Computability.PerfectCompleteness.Sampling.CutSamplerRefinement | |
| import OAI.Computability.UniqueGames.Foundations.SamplingLemmas | |
| namespace OAI | |
| section | |
| namespace PerfectCompleteness.CutTerminalSplit | |
| open PointwiseSpaces RecursiveSpaces DescendantSpaces RecursiveSampler TerminalCalls | |
| open UniqueGamesTheorem.Foundations.Games | |
| open scoped Classical | |
| noncomputable section | |
| universe u w | |
| variable {branch : Nat β Nat} {n m : Nat} | |
| theorem refinedSpace_eq_terminal (π : Type w) [Field π] | |
| (repeats : Nat β Nat) (p : Path branch n m) : | |
| β (A : Slots branch n β Type u) (terminal : TerminalIndex repeats p), | |
| CutSamplerRefinement.RefinedSpace π repeats p A (drawIndex repeats p terminal) = | |
| CutSamplerRefinement.RefinedSpace π repeats (.refl m) (p.family A) () := by | |
| induction p with | |
| | refl n => | |
| intro A terminal | |
| cases terminal | |
| rfl | |
| | step i p ih => | |
| intro A terminal | |
| exact ih (childFamily A i) terminal.2 | |
| variable (π : Type w) [Field π] (repeats : Nat β Nat) | |
| (p : Path branch n (m + 1)) (A : Slots branch n β Type u) | |
| abbrev TerminalFactor := | |
| (i : Fin (branch m)) β squareSpace (space π branch m (childFamily (p.family A) i)) | |
| abbrev TerminalTape := TerminalIndex repeats p β TerminalFactor π p A | |
| abbrev ExteriorIndex := {j : DrawIndex repeats p // Β¬ IsTerminal repeats p j} | |
| abbrev ExteriorTape := | |
| (j : ExteriorIndex repeats p) β CutSamplerRefinement.RefinedSpace π repeats p A j.val | |
| def terminalFactorEquiv (terminal : TerminalIndex repeats p) : | |
| CutSamplerRefinement.RefinedSpace π repeats p A (drawIndex repeats p terminal) β | |
| TerminalFactor π p A := | |
| Equiv.cast (refinedSpace_eq_terminal π repeats p A terminal) | |
| def terminalTapeEquiv : | |
| ((j : {j : DrawIndex repeats p // IsTerminal repeats p j}) β | |
| CutSamplerRefinement.RefinedSpace π repeats p A j.val) β | |
| TerminalTape π repeats p A := | |
| ((Equiv.piCongrLeft | |
| (fun j : {j : DrawIndex repeats p // IsTerminal repeats p j} => | |
| CutSamplerRefinement.RefinedSpace π repeats p A j.val) | |
| (terminalSubtypeEquiv repeats p)).symm).trans | |
| (Equiv.piCongrRight (terminalFactorEquiv π repeats p A)) | |
| def splitTape : | |
| CutSamplerRefinement.Tape π repeats p A β | |
| TerminalTape π repeats p A Γ ExteriorTape π repeats p A := | |
| (Equiv.piEquivPiSubtypeProd (IsTerminal repeats p) | |
| (CutSamplerRefinement.RefinedSpace π repeats p A)).trans | |
| (Equiv.prodCongr (terminalTapeEquiv π repeats p A) (Equiv.refl _)) | |
| @[simp] theorem splitTape_terminal_apply | |
| (x : CutSamplerRefinement.Tape π repeats p A) (terminal : TerminalIndex repeats p) : | |
| (splitTape π repeats p A x).1 terminal = | |
| terminalFactorEquiv π repeats p A terminal (x (drawIndex repeats p terminal)) := rfl | |
| @[simp] theorem splitTape_exterior_apply | |
| (x : CutSamplerRefinement.Tape π repeats p A) (j : ExteriorIndex repeats p) : | |
| (splitTape π repeats p A x).2 j = x j.val := rfl | |
| variable [Finite π] [β s, Finite (A s)] | |
| instance childSquareFintype (i : Fin (branch m)) : | |
| Fintype (squareSpace (space π branch m (childFamily (p.family A) i))) := | |
| Fintype.ofFinite _ | |
| def terminalLaw : FiniteDistribution (TerminalTape π repeats p A) := | |
| FiniteProduct.law (fun _ : TerminalIndex repeats p => | |
| FiniteProduct.law (fun i : Fin (branch m) => | |
| FiniteDistribution.uniform | |
| (squareSpace (space π branch m (childFamily (p.family A) i))))) | |
| def exteriorLaw : FiniteDistribution (ExteriorTape π repeats p A) := | |
| FiniteProduct.law (fun j : ExteriorIndex repeats p => | |
| FiniteDistribution.uniform (CutSamplerRefinement.RefinedSpace π repeats p A j.val)) | |
| theorem terminalLaw_uniform : | |
| terminalLaw π repeats p A = FiniteDistribution.uniform (TerminalTape π repeats p A) := by | |
| simp only [terminalLaw, UniformLinearImage.law_uniform] | |
| theorem exteriorLaw_uniform : | |
| exteriorLaw π repeats p A = FiniteDistribution.uniform (ExteriorTape π repeats p A) := | |
| UniformLinearImage.law_uniform | |
| theorem split_tapeLaw : | |
| (CutSamplerRefinement.tapeLaw π repeats p A).pushforward (splitTape π repeats p A) = | |
| (terminalLaw π repeats p A).product (exteriorLaw π repeats p A) := by | |
| unfold CutSamplerRefinement.tapeLaw | |
| rw [UniformLinearImage.law_uniform, FiniteDistribution.pushforward_equiv, | |
| terminalLaw_uniform, exteriorLaw_uniform] | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro x | |
| change 1 / (Fintype.card (CutSamplerRefinement.Tape π repeats p A) : β) = | |
| (1 / (Fintype.card (TerminalTape π repeats p A) : β)) * | |
| (1 / (Fintype.card (ExteriorTape π repeats p A) : β)) | |
| rw [Fintype.card_congr (splitTape π repeats p A), Fintype.card_prod] | |
| simp only [Nat.cast_mul, one_div, mul_inv] | |
| theorem terminal_marginal : | |
| (CutSamplerRefinement.tapeLaw π repeats p A).pushforward | |
| (fun x => (splitTape π repeats p A x).1) = terminalLaw π repeats p A := by | |
| rw [β FiniteDistribution.pushforward_comp (CutSamplerRefinement.tapeLaw π repeats p A) | |
| (splitTape π repeats p A) Prod.fst, split_tapeLaw] | |
| exact HiddenBucketBias.product_fst | |
| (terminalLaw π repeats p A) (exteriorLaw π repeats p A) | |
| theorem terminal_marginal_uniform : | |
| (CutSamplerRefinement.tapeLaw π repeats p A).pushforward | |
| (fun x => (splitTape π repeats p A x).1) = | |
| FiniteDistribution.uniform (TerminalTape π repeats p A) := by | |
| rw [terminal_marginal, terminalLaw_uniform] | |
| end | |
| end PerfectCompleteness.CutTerminalSplit | |
| end | |
| end OAI | |