File size: 4,490 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | 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
|