OAI/Combinatorics/ContingencyTables/Transport/BoxCompletion.lean
10 declarations, 0 contain sorry, 0 declared as axioms
Enumerating tables through their free entries
- abbrev
OAI.ContingencyTables.BoxCompletion.Boxline 12 - def
OAI.ContingencyTables.BoxCompletion.freeValuesline 14 - def
OAI.ContingencyTables.BoxCompletion.decodeline 17 - def
OAI.ContingencyTables.BoxCompletion.encodeline 24 - lemma
OAI.ContingencyTables.BoxCompletion.freeValues_encodeline 29 - lemma
OAI.ContingencyTables.BoxCompletion.decode_encodeline 35 - theorem
OAI.ContingencyTables.BoxCompletion.decode_eq_someline 50Source documentation
Each feasible table occurs at exactly one enumerated free vector.
theorem decode_eq_some {m n N : ℕ} (R : Option (Fin m) → ℕ) (P : Option (Fin n) → ℕ) (htotal : ∑ i,R i=∑ j,P j) (hN : (∑ i,R i)≤N) (z : Box m n N) (X : Table R P) : decode R P htotal N z=some X ↔ z=encode R P hN X := by …Mentions: OAI.ContingencyTables.BoxCompletion.Box, OAI.ContingencyTables.Table, OAI.ContingencyTables.BoxCompletion.decode, OAI.ContingencyTables.BoxCompletion.encode
- lemma
OAI.ContingencyTables.BoxCompletion.decode_elim_sumline 70 - theorem
OAI.ContingencyTables.BoxCompletion.sum_decodeline 76Source documentation
Summing over candidate completions counts each feasible table once, and gives zero weight to every rejected completion.
theorem sum_decode {m n N : ℕ} (R : Option (Fin m) → ℕ) (P : Option (Fin n) → ℕ) (htotal : ∑ i,R i=∑ j,P j) (hN : (∑ i,R i)≤N) (w : Table R P → ℕ) : (∑ z : Box m n N,(decode R P htotal N z).elim 0 w)=∑ X,w X := by …Mentions: OAI.ContingencyTables.Table, OAI.ContingencyTables.BoxCompletion.Box, OAI.ContingencyTables.BoxCompletion.decode
- theorem
OAI.ContingencyTables.BoxCompletion.acceptCompletion_eqline 89Source documentation
The existing executable acceptance test returns the same optional table as the finite enumeration used in the counting proof.
theorem acceptCompletion_eq {m n N : ℕ} (R : Option (Fin m) → ℕ) (P : Option (Fin n) → ℕ) (htotal : ∑ i,R i=∑ j,P j) (z : Box m n N) : acceptCompletion ((marginCode R,marginCode P), matrixCode (fun i j => freeValues z (i,j)))= (decode R P htotal N z).map tableOutput := by …Mentions: OAI.ContingencyTables.BoxCompletion.Box, OAI.ContingencyTables.BoxCompletion.freeValues, OAI.ContingencyTables.BoxCompletion.decode