Download data/lean/OAI/Combinatorics/ContingencyTables/Sampling/AllBalancedWidths.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.49 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/AllBalancedWidths.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/AllBalancedWidths.lean
-
curl -L -o AllBalancedWidths.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/AllBalancedWidths.lean
4.49 kB
| import OAI.Combinatorics.ContingencyTables.Sampling.SmallBalancedMarginal | |
| import OAI.Combinatorics.ContingencyTables.Transport.EqualityReindex | |
| namespace OAI | |
| /-! # The actual balanced finite family allows every small-cell capacity | |
| The proved zero/one boundary cases complete the finite balanced | |
| elimination theorem. The physical equality-softened tree marginal can | |
| therefore eliminate the original small cells directly. | |
| -/ | |
| namespace ContingencyTables.BalancedBox | |
| open scoped BigOperators Classical | |
| open IntegerMarginal | |
| variable {I : Type*} [Fintype I] [DecidableEq I] | |
| theorem marginal_removal_slice_all (F : ((IβBool) β β) β β) | |
| (m : I β β) (R M : β) | |
| (hpos : PositiveSlice F (profile m M M) (R+M)) | |
| (hsig : RemovalSlice F (profile m M M) (R+M)) : | |
| RemovalSlice (marginal F M) m R := by | |
| rcases M with _|M | |
| Β· exact marginal_zero_removal_slice F m R (by simpa only [add_zero] using hsig) | |
| rcases M with _|M | |
| Β· exact marginal_one_removal_slice F m R hpos hsig | |
| Β· exact marginal_removal_slice F m R _ (by omega) hpos hsig | |
| end ContingencyTables.BalancedBox | |
| namespace ContingencyTables.BalancedFamily | |
| open scoped BigOperators Classical | |
| open IntegerMarginal BalancedBox | |
| variable {I : Type*} [Fintype I] [DecidableEq I] | |
| /-- Every original small-cell width, including zero and one, may be | |
| eliminated on its precise box-valid total slice. -/ | |
| theorem eliminate_slices_all (Ms : List β) (m : I β β) (R : β) | |
| (F : (Coordinates I Ms β β) β β) | |
| (hpos : PositiveSlice F (bounds m Ms) (R+Ms.sum)) | |
| (hsig : RemovalSlice F (bounds m Ms) (R+Ms.sum)) : | |
| PositiveSlice (eliminate Ms F) m R β§ RemovalSlice (eliminate Ms F) m R := by | |
| induction Ms with | |
| | nil => simpa only [List.sum_nil,add_zero,eliminate,bounds] using And.intro hpos hsig | |
| | cons M Ms ih => | |
| have htotal : R+(M::Ms).sum=(R+Ms.sum)+M := by simp only [List.sum_cons]; omega | |
| rw [htotal] at hpos hsig | |
| exact ih (marginal F M) | |
| (marginal_positive_slice F (bounds m Ms) (R+Ms.sum) M hpos) | |
| (marginal_removal_slice_all F (bounds m Ms) (R+Ms.sum) M hpos hsig) | |
| end ContingencyTables.BalancedFamily | |
| namespace ContingencyTables.EqualityReindex | |
| open scoped BigOperators Classical | |
| open EqualitySoftening BalancedFamily BalancedBox | |
| variable {S D G : Type*} [Fintype S] [DecidableEq S] [Fintype D] [Fintype G] | |
| omit [DecidableEq S] in | |
| lemma softenedWeight_reindex (Ms : List β) (e : Coordinates S Ms β D) | |
| (line : D β G) (root : G β Bool) (rate offset slope : G β β) | |
| (urate ell uslope cap : D β β) (L : β) (z : Coordinates S Ms β β) : | |
| softenedWeight (line β e) root rate offset slope (urate β e) (ell β e) | |
| (uslope β e) (cap β e) L z= | |
| softenedWeight line root rate offset slope urate ell uslope cap L (z β e.symm) := by | |
| unfold softenedWeight | |
| exact productWeight_reindex e line (lineFactor root rate offset slope L) | |
| (unaryFactor urate ell uslope cap) z | |
| /-- The literal physical positive factor family can retain one tree | |
| pair while summing all other original pairs, at every capacity. -/ | |
| theorem physical_softened_slices_all (Ms : List β) (m : S β β) (R : β) | |
| (e : Coordinates S Ms β D) (line : D β G) (root : G β Bool) | |
| (rate offset slope : G β β) (urate ell uslope cap : D β β) (L : β) | |
| (hrate : β g,0 β€ rate g) (hu : β d,0 β€ urate d) (hL : 0 β€ L) : | |
| PositiveSlice (eliminate Ms (fun z => | |
| softenedWeight line root rate offset slope urate ell uslope cap L (z β e.symm))) m R β§ | |
| RemovalSlice (eliminate Ms (fun z => | |
| softenedWeight line root rate offset slope urate ell uslope cap L (z β e.symm))) m R := by | |
| have heq : (fun z => softenedWeight line root rate offset slope urate ell uslope cap L | |
| (z β e.symm))=softenedWeight (line β e) root rate offset slope | |
| (urate β e) (ell β e) (uslope β e) (cap β e) L := by | |
| funext z | |
| exact (softenedWeight_reindex Ms e line root rate offset slope urate ell uslope cap L z).symm | |
| rw [heq] | |
| apply eliminate_slices_all Ms m R | |
| Β· intro z _ _ | |
| exact softenedWeight_positive (line β e) root rate offset slope | |
| (urate β e) (ell β e) (uslope β e) (cap β e) L z | |
| Β· intro z _ _ | |
| convert softenedWeight_removal (line β e) root rate offset slope | |
| (urate β e) (ell β e) (uslope β e) (cap β e) L hrate (fun i => hu (e i)) hL z using 1 | |
| congr 2 <;> exact Subsingleton.elim _ _ | |
| end ContingencyTables.EqualityReindex | |
| end OAI | |