Download data/lean/OAI/Computability/PerfectCompleteness/Sampling/MetadataFreeLaw.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Sampling/MetadataFreeLaw.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Sampling/MetadataFreeLaw.lean
-
curl -L -o MetadataFreeLaw.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Sampling/MetadataFreeLaw.lean
8.6 kB
| import OAI.Computability.PerfectCompleteness.Machines.MetadataFreeTapeLemmas | |
| import OAI.Computability.PerfectCompleteness.Sampling.SamplerCardinalityLemmas | |
| namespace OAI | |
| section | |
| namespace PerfectCompleteness.MetadataFreeLaw | |
| open RecursiveSpaces DescendantSpaces TreeSourceSpaces | |
| open MetadataFreeSampler MetadataFreeTape | |
| open UniqueGamesTheorem.Foundations.Games | |
| open scoped BigOperators Classical | |
| noncomputable section | |
| variable {branch : Nat β Nat} {n d t v m : Nat} | |
| theorem tape_weight_eq (clauses : Fin m β SourceClause.NormalizedClause v) | |
| (rows repeats : Nat β Nat) (p : Path branch n d) : | |
| β (q : PreliminarySampler.Questions branch n t m) | |
| (Ο : WholeArraySampler.Tape rows repeats p (sourceSlots clauses q)), | |
| (WholeArraySampler.tapeLaw rows repeats p (sourceSlots clauses q)).weight Ο = | |
| (WholeArraySampler.tapeLaw rows repeats p (dummyTreeSlots (sourceSigns clauses q))).weight | |
| (tapeEquiv clauses rows repeats p q Ο) := by | |
| induction p with | |
| | refl n => | |
| intro q Ο | |
| rfl | |
| | @step n d i p ih => | |
| intro q Ο | |
| change (β k : WholeArraySampler.StepIndex i, | |
| (WholeArraySampler.componentLaw rows repeats i p (sourceSlots clauses q) k).weight (Ο k)) = | |
| β k : WholeArraySampler.StepIndex i, | |
| (WholeArraySampler.componentLaw rows repeats i p | |
| (dummyTreeSlots (sourceSigns clauses q)) k).weight | |
| (tapeEquiv clauses rows repeats (.step i p) q Ο k) | |
| apply Finset.prod_congr rfl | |
| intro k _ | |
| rcases k with u | (u | j) | |
| Β· rfl | |
| Β· cases u | |
| exact ih (fun leaf k => q (i, leaf) k) (Ο (.inr (.inl ()))) | |
| Β· rfl | |
| theorem tapeLaw_transport (clauses : Fin m β SourceClause.NormalizedClause v) | |
| (rows repeats : Nat β Nat) (p : Path branch n d) | |
| (q : PreliminarySampler.Questions branch n t m) : | |
| (WholeArraySampler.tapeLaw rows repeats p (sourceSlots clauses q)).transport | |
| (tapeEquiv clauses rows repeats p q) = | |
| WholeArraySampler.tapeLaw rows repeats p (dummyTreeSlots (sourceSigns clauses q)) := by | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro Ο | |
| change (WholeArraySampler.tapeLaw rows repeats p (sourceSlots clauses q)).weight | |
| ((tapeEquiv clauses rows repeats p q).symm Ο) = _ | |
| simpa only [Equiv.apply_symm_apply] using | |
| tape_weight_eq clauses rows repeats p q ((tapeEquiv clauses rows repeats p q).symm Ο) | |
| abbrev SignedOutcome (signs : SignTuple branch n t) (rows repeats : Nat β Nat) := | |
| Ξ£ leaf : Slots branch n, | |
| WholeArraySampler.Tape rows repeats (GeometricPath.leafPath leaf) (dummyTreeSlots signs) Γ | |
| PreliminarySampler.Choice rows leaf | |
| def signedLaw (signs : SignTuple branch n t) (rows repeats : Nat β Nat) | |
| (hn : 0 < n) (hbranch : β k < n, 0 < branch k) | |
| (hrows : β k, 0 < rows (k + 1)) : FiniteDistribution (SignedOutcome signs rows repeats) := | |
| CompletionSoundness.sigmaLaw (GeometricPath.law n hbranch) fun leaf => | |
| (WholeArraySampler.tapeLaw rows repeats (GeometricPath.leafPath leaf) (dummyTreeSlots signs)).product | |
| (PreliminarySampler.choiceLaw leaf hn hrows) | |
| def signedRationalLaw (signs : SignTuple branch n t) (rows repeats : Nat β Nat) | |
| (hn : 0 < n) (hbranch : β k < n, 0 < branch k) (hrows : β k, 0 < rows (k + 1)) : | |
| RationalFiniteLaw.RationalLaw (signedLaw signs rows repeats hn hbranch hrows) := | |
| RationalFiniteLaw.sigma (SamplerRationality.pathLaw hbranch) fun leaf => | |
| RationalFiniteLaw.product | |
| (SamplerRationality.wholeArrayTapeLaw rows repeats (GeometricPath.leafPath leaf) | |
| (dummyTreeSlots signs)) | |
| (SamplerRationality.choiceLaw leaf hn hrows) | |
| theorem signedLaw_positive (signs : SignTuple branch n t) (rows repeats : Nat β Nat) | |
| (hn : 0 < n) (hbranch : β k < n, 0 < branch k) (hrows : β k, 0 < rows (k + 1)) | |
| (e : SignedOutcome signs rows repeats) : | |
| 0 < (signedLaw signs rows repeats hn hbranch hrows).weight e := | |
| RationalFiniteLaw.real_positive (signedRationalLaw signs rows repeats hn hbranch hrows) e | |
| def encodeOutcome (clauses : Fin m β SourceClause.NormalizedClause v) (rows repeats : Nat β Nat) | |
| (e : PreliminarySampler.Raw clauses branch n t rows repeats) : | |
| SignedOutcome (sourceSigns clauses e.1.1) rows repeats := | |
| β¨e.1.2, tapeEquiv clauses rows repeats (GeometricPath.leafPath e.1.2) e.1.1 e.2.1, e.2.2β© | |
| theorem raw_weight_eq [NeZero m] (clauses : Fin m β SourceClause.NormalizedClause v) | |
| (rows repeats : Nat β Nat) (hn : 0 < n) | |
| (hbranch : β k < n, 0 < branch k) (hrows : β k, 0 < rows (k + 1)) | |
| (e : PreliminarySampler.Raw clauses branch n t rows repeats) : | |
| (PreliminarySampler.law clauses rows repeats hn hbranch hrows).weight e = | |
| (1 / (Fintype.card (PreliminarySampler.Questions branch n t m) : β)) * | |
| (signedLaw (sourceSigns clauses e.1.1) rows repeats hn hbranch hrows).weight | |
| (encodeOutcome clauses rows repeats e) := by | |
| change ((1 / (Fintype.card (PreliminarySampler.Questions branch n t m) : β)) * | |
| (GeometricPath.law n hbranch).weight e.1.2) * | |
| ((WholeArraySampler.tapeLaw rows repeats (GeometricPath.leafPath e.1.2) | |
| (sourceSlots clauses e.1.1)).weight e.2.1 * | |
| (PreliminarySampler.choiceLaw e.1.2 hn hrows).weight e.2.2) = | |
| (1 / (Fintype.card (PreliminarySampler.Questions branch n t m) : β)) * | |
| ((GeometricPath.law n hbranch).weight e.1.2 * | |
| ((WholeArraySampler.tapeLaw rows repeats (GeometricPath.leafPath e.1.2) | |
| (dummyTreeSlots (sourceSigns clauses e.1.1))).weight | |
| (tapeEquiv clauses rows repeats (GeometricPath.leafPath e.1.2) e.1.1 e.2.1) * | |
| (PreliminarySampler.choiceLaw e.1.2 hn hrows).weight e.2.2)) | |
| rw [tape_weight_eq clauses rows repeats (GeometricPath.leafPath e.1.2) e.1.1 e.2.1] | |
| exact mul_assoc _ _ _ | |
| theorem raw_weight_rational [NeZero m] (clauses : Fin m β SourceClause.NormalizedClause v) | |
| (rows repeats : Nat β Nat) (hn : 0 < n) | |
| (hbranch : β k < n, 0 < branch k) (hrows : β k, 0 < rows (k + 1)) | |
| (e : PreliminarySampler.Raw clauses branch n t rows repeats) : | |
| (PreliminarySampler.law clauses rows repeats hn hbranch hrows).weight e = | |
| (1 / (Fintype.card (PreliminarySampler.Questions branch n t m) : β)) * | |
| ((signedRationalLaw (sourceSigns clauses e.1.1) rows repeats hn hbranch hrows).weights | |
| (encodeOutcome clauses rows repeats e) : β) := by | |
| rw [raw_weight_eq, (signedRationalLaw (sourceSigns clauses e.1.1) | |
| rows repeats hn hbranch hrows).cast_weight] | |
| def rawEquiv (clauses : Fin m β SourceClause.NormalizedClause v) (rows repeats : Nat β Nat) : | |
| PreliminarySampler.Raw clauses branch n t rows repeats β | |
| (Ξ£ q : PreliminarySampler.Questions branch n t m, | |
| SignedOutcome (sourceSigns clauses q) rows repeats) where | |
| toFun e := β¨e.1.1, encodeOutcome clauses rows repeats eβ© | |
| invFun y := β¨(y.1, y.2.1), | |
| (tapeEquiv clauses rows repeats (GeometricPath.leafPath y.2.1) y.1).symm y.2.2.1, | |
| y.2.2.2β© | |
| left_inv := by | |
| rintro β¨β¨q, leafβ©, Ο, choiceβ© | |
| simp only [encodeOutcome] | |
| exact congrArg | |
| (fun tape : WholeArraySampler.Tape rows repeats (GeometricPath.leafPath leaf) | |
| (sourceSlots clauses q) => | |
| (β¨(q, leaf), tape, choiceβ© : PreliminarySampler.Raw clauses branch n t rows repeats)) | |
| ((tapeEquiv clauses rows repeats (GeometricPath.leafPath leaf) q).symm_apply_apply Ο) | |
| right_inv := by | |
| rintro β¨q, leaf, Ο, choiceβ© | |
| simp only [encodeOutcome, Equiv.apply_symm_apply] | |
| theorem rawLaw_transport [NeZero m] (clauses : Fin m β SourceClause.NormalizedClause v) | |
| (rows repeats : Nat β Nat) (hn : 0 < n) | |
| (hbranch : β k < n, 0 < branch k) (hrows : β k, 0 < rows (k + 1)) : | |
| (PreliminarySampler.law (t := t) clauses rows repeats hn hbranch hrows).transport | |
| (rawEquiv clauses rows repeats) = | |
| CompletionSoundness.sigmaLaw PreliminarySampler.questionsLaw | |
| (fun q => signedLaw (sourceSigns clauses q) rows repeats hn hbranch hrows) := by | |
| apply FiniteDistribution.eq_of_weight_eq | |
| rintro β¨q, leaf, Ο, choiceβ© | |
| change (PreliminarySampler.law clauses rows repeats hn hbranch hrows).weight | |
| β¨(q, leaf), (tapeEquiv clauses rows repeats (GeometricPath.leafPath leaf) q).symm Ο, | |
| choiceβ© = | |
| (1 / (Fintype.card (PreliminarySampler.Questions branch n t m) : β)) * | |
| (signedLaw (sourceSigns clauses q) rows repeats hn hbranch hrows).weight β¨leaf, Ο, choiceβ© | |
| rw [raw_weight_eq] | |
| simp only [encodeOutcome, Equiv.apply_symm_apply] | |
| end | |
| end PerfectCompleteness.MetadataFreeLaw | |
| end | |
| end OAI | |