OAI/Combinatorics/ContingencyTables/Transport/FactorialSignatures.lean
48 declarations, 0 contain sorry, 0 declared as axioms
Factorial congruence for the two binary lifts
The integer-to-binary signature transfer in paper 200-02,
Lemma lem:binary-signatures. Coordinates with zero remaining copies
are allowed; a single remaining copy gives an invalid repeated removal.
The copy matrix is proved to be dominated by the integer form compressed
to group means. The difference is the nonnegative within-group variance.
- theorem
OAI.ContingencyTables.FactorialSignatures.onePositive_of_dominated_compressionline 23Source documentation
Domination by a compressed one-positive form preserves the signature. This is the precise group-mean argument, including forms with no positive direction.
theorem onePositive_of_dominated_compression {V W : Type*} [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] (B : BilinForm ℝ V) (C : BilinForm ℝ W) (L : W →ₗ[ℝ] V) (hsymm : ∀ x y, C x y = C y x) (hsig : OnePositiveDirection B) (hdom : ∀ v, C v v ≤ B (L v) (L v)) : OnePositiveDirection C := by … - abbrev
OAI.ContingencyTables.FactorialSignatures.Copiesline 38 - def
OAI.ContingencyTables.FactorialSignatures.groupAverageline 40 - def
OAI.ContingencyTables.FactorialSignatures.groupIndicatorline 47 - def
OAI.ContingencyTables.FactorialSignatures.groupOuterline 49 - def
OAI.ContingencyTables.FactorialSignatures.withinCoefficientline 52 - def
OAI.ContingencyTables.FactorialSignatures.normalizedMatrixline 55 - def
OAI.ContingencyTables.FactorialSignatures.scaledPullbackline 59 - def
OAI.ContingencyTables.FactorialSignatures.copyMatrixline 64Source documentation
Exact normalized copy matrix, including the within-group diagonal correction.
noncomputable def copyMatrix (n : G → ℕ) (H : Matrix G G ℝ) (c : ℝ) : Matrix (Copies n) (Copies n) ℝ := … - lemma
OAI.ContingencyTables.FactorialSignatures.grouped_formline 70 - lemma
OAI.ContingencyTables.FactorialSignatures.groupOuter_formline 83 - lemma
OAI.ContingencyTables.FactorialSignatures.normalized_formline 90 - lemma
OAI.ContingencyTables.FactorialSignatures.diagonal_formline 112 - theorem
OAI.ContingencyTables.FactorialSignatures.copyMatrix_formline 123Source documentation
The factorial copy form equals the integer form on group averages minus the sum of within-group variances with their actual coefficients.
theorem copyMatrix_form (n : G → ℕ) (H : Matrix G G ℝ) (c : ℝ) (x : Copies n → ℝ) : (copyMatrix n H c).toBilin' x x = c * H.toBilin' (groupAverage n x) (groupAverage n x) - ∑ u, withinCoefficient n H c u * ((∑ i : Fin (n u), x ⟨u, i⟩ ^ 2) - (∑ i : Fin (n u), x ⟨u, i⟩) ^ 2 / n u) := by …Mentions: OAI.ContingencyTables.FactorialSignatures.Copies, OAI.ContingencyTables.FactorialSignatures.copyMatrix, OAI.ContingencyTables.FactorialSignatures.groupAverage, OAI.ContingencyTables.FactorialSignatures.withinCoefficient
- lemma
OAI.ContingencyTables.FactorialSignatures.within_variance_nonnegativeline 140 - theorem
OAI.ContingencyTables.FactorialSignatures.copyMatrix_onePositiveline 152Source documentation
Raw integer signatures imply signatures of the actual copy matrix. Zero groups are harmless and single-copy groups require no division argument.
theorem copyMatrix_onePositive (n : G → ℕ) (H : Matrix G G ℝ) (c : ℝ) (hc : 0 < c) (hH : ∀ u v, H u v = H v u) (hsig : OnePositiveDirection H.toBilin') (hdiag : ∀ u, 0 ≤ H u u) : OnePositiveDirection (copyMatrix n H c).toBilin' := by …Mentions: OAI.ContingencyTables.OnePositiveDirection, OAI.ContingencyTables.FactorialSignatures.copyMatrix
- lemma
OAI.ContingencyTables.FactorialSignatures.normalization_identityline 188 - theorem
OAI.ContingencyTables.FactorialSignatures.copyMatrix_applyline 206Source documentation
The normalization has exactly the zero diagonal and the factorial removal denominator, including single-copy and empty groups.
theorem copyMatrix_apply (n : G → ℕ) (H : Matrix G G ℝ) (c : ℝ) (hzero : ∀ u, n u < 2 → H u u = 0) (i j : Copies n) : copyMatrix n H c i j = if i = j then 0 else c * H i.1 j.1 / ((n i.1 : ℝ) * (if i.1 = j.1 then ((n i.1 - 1 : ℕ) : ℝ) else n j.1)) := by …Mentions: OAI.ContingencyTables.FactorialSignatures.Copies, OAI.ContingencyTables.FactorialSignatures.copyMatrix
- def
OAI.ContingencyTables.FactorialSignatures.factorialProductline 226 - def
OAI.ContingencyTables.FactorialSignatures.removeOneline 228 - def
OAI.ContingencyTables.FactorialSignatures.removeTwoline 230 - lemma
OAI.ContingencyTables.FactorialSignatures.factorialProduct_positiveline 233 - lemma
OAI.ContingencyTables.FactorialSignatures.factorialProduct_removeOneline 239Source documentation
Removing one labeled copy cancels precisely its coordinate count.
lemma factorialProduct_removeOne (n : G → ℕ) (u : G) (hu : 0 < n u) : factorialProduct (removeOne n u) = factorialProduct n / n u := by …Mentions: OAI.ContingencyTables.FactorialSignatures.factorialProduct, OAI.ContingencyTables.FactorialSignatures.removeOne
- theorem
OAI.ContingencyTables.FactorialSignatures.factorialProduct_removeTwoline 263Source documentation
Two factorial reductions yield the exact cross-group or repeated-group multiplicity denominator.
theorem factorialProduct_removeTwo (n : G → ℕ) (u v : G) (hu : 0 < n u) (hv : 0 < n v - if v = u then 1 else 0) : factorialProduct (removeTwo n u v) = factorialProduct n / ((n u : ℝ) * (if u = v then ((n u - 1 : ℕ) : ℝ) else n v)) := by …Mentions: OAI.ContingencyTables.FactorialSignatures.factorialProduct, OAI.ContingencyTables.FactorialSignatures.removeTwo
- lemma
OAI.ContingencyTables.FactorialSignatures.distinct_copy_countsline 276Source documentation
Distinct labeled copies give valid one-per-coordinate or repeated-coordinate removals.
lemma distinct_copy_counts (n : G → ℕ) (i j : Copies n) (hij : i ≠ j) : 0 < n i.1 ∧ 0 < n j.1 - if j.1 = i.1 then 1 else 0 := by … - def
OAI.ContingencyTables.FactorialSignatures.factorialMatrixline 295 - theorem
OAI.ContingencyTables.FactorialSignatures.factorialMatrix_eqline 300Source documentation
Exact factorial congruence with the normalized integer matrix.
theorem factorialMatrix_eq (n : G → ℕ) (H : Matrix G G ℝ) (D : ℝ) (hzero : ∀ u, n u < 2 → H u u = 0) : factorialMatrix n H D = copyMatrix n H (factorialProduct n / D) := by …Mentions: OAI.ContingencyTables.FactorialSignatures.factorialMatrix, OAI.ContingencyTables.FactorialSignatures.copyMatrix, OAI.ContingencyTables.FactorialSignatures.factorialProduct
- theorem
OAI.ContingencyTables.FactorialSignatures.factorialMatrix_onePositiveline 314Source documentation
The literal factorial weights have the binary signature implied by their integer two-removal or remaining-capacity addition matrix.
theorem factorialMatrix_onePositive (n : G → ℕ) (H : Matrix G G ℝ) (D : ℝ) (hD : 0 < D) (hH : ∀ u v, H u v = H v u) (hsig : OnePositiveDirection H.toBilin') (hdiag : ∀ u, 0 ≤ H u u) (hzero : ∀ u, n u < 2 → H u u = 0) : OnePositiveDirection (factorialMatrix n H D).toBilin' := by …Mentions: OAI.ContingencyTables.OnePositiveDirection, OAI.ContingencyTables.FactorialSignatures.factorialMatrix
- def
OAI.ContingencyTables.FactorialSignatures.ValidPairline 322 - lemma
OAI.ContingencyTables.FactorialSignatures.validPair_symmline 326 - lemma
OAI.ContingencyTables.FactorialSignatures.removeTwo_commline 333 - def
OAI.ContingencyTables.FactorialSignatures.integerRemovalMatrixline 338 - def
OAI.ContingencyTables.FactorialSignatures.removalLiftMatrixline 341 - theorem
OAI.ContingencyTables.FactorialSignatures.removalLift_onePositiveline 347Source documentation
The actual omission matrix of the first factorial lift, with all integer invalid-removal entries set to zero.
theorem removalLift_onePositive (h : (G → ℕ) → ℝ) (n : G → ℕ) (D : ℝ) (hD : 0 < D) (hh : ∀ r, 0 ≤ h r) (hsig : OnePositiveDirection (integerRemovalMatrix h n).toBilin') : OnePositiveDirection (removalLiftMatrix h n D).toBilin' := by …Mentions: OAI.ContingencyTables.OnePositiveDirection, OAI.ContingencyTables.FactorialSignatures.integerRemovalMatrix, OAI.ContingencyTables.FactorialSignatures.removalLiftMatrix
- def
OAI.ContingencyTables.FactorialSignatures.addTwoline 369 - def
OAI.ContingencyTables.FactorialSignatures.integerAdditionMatrixline 372 - def
OAI.ContingencyTables.FactorialSignatures.additionLiftMatrixline 375 - theorem
OAI.ContingencyTables.FactorialSignatures.additionLift_onePositiveline 381Source documentation
The actual addition matrix of the complementary factorial lift uses remaining-capacity factorials, and hence exactly the same congruence.
theorem additionLift_onePositive (h : (G → ℕ) → ℝ) (r n : G → ℕ) (D : ℝ) (hD : 0 < D) (hh : ∀ a, 0 ≤ h a) (hsig : OnePositiveDirection (integerAdditionMatrix h r n).toBilin') : OnePositiveDirection (additionLiftMatrix h r n D).toBilin' := by …Mentions: OAI.ContingencyTables.OnePositiveDirection, OAI.ContingencyTables.FactorialSignatures.integerAdditionMatrix, OAI.ContingencyTables.FactorialSignatures.additionLiftMatrix
- def
OAI.ContingencyTables.FactorialSignatures.cellFactorline 405 - def
OAI.ContingencyTables.FactorialSignatures.complementCellFactorline 408 - lemma
OAI.ContingencyTables.FactorialSignatures.cellFactor_positiveline 412 - lemma
OAI.ContingencyTables.FactorialSignatures.balanced_cell_factorsline 418Source documentation
On transversals, the two cell multipliers agree exactly.
lemma balanced_cell_factors (b x y : ℕ) (h : x + y = b) : complementCellFactor b x y = cellFactor b x y := by …Mentions: OAI.ContingencyTables.FactorialSignatures.complementCellFactor, OAI.ContingencyTables.FactorialSignatures.cellFactor
- lemma
OAI.ContingencyTables.FactorialSignatures.empty_cell_factorsline 427Source documentation
The empty-pair cell contributes
(x+1)(y+1)to the lift ratio.lemma empty_cell_factors (b x y : ℕ) (h : x + y + 1 = b) : complementCellFactor b x y = ((x : ℝ) + 1) * ((y : ℝ) + 1) * cellFactor b x y := by …Mentions: OAI.ContingencyTables.FactorialSignatures.complementCellFactor, OAI.ContingencyTables.FactorialSignatures.cellFactor
- lemma
OAI.ContingencyTables.FactorialSignatures.full_cell_factorsline 437Source documentation
The full-pair cell contributes the reciprocal product
1/(xy).lemma full_cell_factors (b x y : ℕ) (hx : x ≤ b) (hy : y ≤ b) (h : x + y = b + 1) : complementCellFactor b x y * ((x : ℝ) * y) = cellFactor b x y := by …Mentions: OAI.ContingencyTables.FactorialSignatures.complementCellFactor, OAI.ContingencyTables.FactorialSignatures.cellFactor
- lemma
OAI.ContingencyTables.FactorialSignatures.quotient_square_boundsline 454 - lemma
OAI.ContingencyTables.FactorialSignatures.defect_product_identityline 467Source documentation
The product ratio when one cell contains the hole, one contains the full pair, and all remaining cells are balanced.
lemma defect_product_identity (F T : G → ℝ) (a b : G) (hab : a ≠ b) (A B : ℝ) (ha : T a = A * F a) (hb : T b = F b / B) (hrest : ∀ u, u ≠ a → u ≠ b → T u = F u) : (∏ u, T u) = (A / B) * ∏ u, F u := by … - theorem
OAI.ContingencyTables.FactorialSignatures.defect_lift_comparisonline 487Source documentation
The exact
q = W²comparison between the two factorial lifts on a single-hole/single-full defect, after their common positive base weight.theorem defect_lift_comparison (b x y : G → ℕ) (a d : G) (had : a ≠ d) (W : ℕ) (hW : 0 < W) (hbW : ∀ u, b u < W) (hx : ∀ u, x u ≤ b u) (hy : ∀ u, y u ≤ b u) (ha : x a + y a + 1 = b a) (hd : x d + y d = b d + 1) (hrest : ∀ u, u ≠ a → u ≠ d → x u + y u = b u) (h : ℝ) (hh : 0 ≤ h) : (1 / (W : ℝ) ^ 2) * (h * ∏ u, cellFactor (b u) (x u) (y u)) ≤ h * ∏ u, complementCellFactor (b u) (x u) (y u) ∧ (h * ∏ u, complementCellFactor (b u) (x u) (y u)) ≤ (W : ℝ) ^ 2 * (h * ∏ u, cellFactor (b u) (x u) (y u)) := by …Mentions: OAI.ContingencyTables.FactorialSignatures.cellFactor, OAI.ContingencyTables.FactorialSignatures.complementCellFactor
- theorem
OAI.ContingencyTables.FactorialSignatures.balanced_lift_agreementline 545Source documentation
Agreement of the actual full factorial multipliers on every balanced profile.
theorem balanced_lift_agreement (b x y : G → ℕ) (hbalanced : ∀ u, x u + y u = b u) (h : ℝ) : h * (∏ u, complementCellFactor (b u) (x u) (y u)) = h * ∏ u, cellFactor (b u) (x u) (y u) := by …Mentions: OAI.ContingencyTables.FactorialSignatures.complementCellFactor, OAI.ContingencyTables.FactorialSignatures.cellFactor