Download data/lean/OAI/Combinatorics/ContingencyTables/Dense/DenseBooleanStep.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.16 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ContingencyTables/Dense/DenseBooleanStep.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/ContingencyTables/Dense/DenseBooleanStep.lean
-
curl -L -o DenseBooleanStep.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ContingencyTables/Dense/DenseBooleanStep.lean
3.16 kB
| import OAI.Combinatorics.ContingencyTables.Dense.DenseFiniteTransition | |
| import OAI.Combinatorics.ContingencyTables.Machines.FiniteFairBits | |
| namespace OAI | |
| /-! # A fixed Boolean word realizes each exact dense transition -/ | |
| namespace ContingencyTables.GridBoundary | |
| open scoped BigOperators Classical | |
| open ResidualMixture FirstSuccess FairBits | |
| noncomputable section | |
| variable {I J : Type*} [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] | |
| variable {q : β} | |
| def denseStepBits (d : β) : β := Nat.clog 2 (8 * d) + 8 * d ^ 5 | |
| def denseBitStep (R : Option I β β) (P : Option J β β) (d : β) | |
| (e : I Γ J β Fin q) (a : Grid (I := Fin q) (4 * d ^ 8)) | |
| (bits : Fin (denseStepBits d) β Bool) : Grid (I := Fin q) (4 * d ^ 8) := | |
| let z := pairWordEquiv (Nat.clog 2 (8 * d)) (8 * d ^ 5) bits | |
| match axisCodeStep a z.1 with | |
| | none => a | |
| | some b => if z.2.val < 2 ^ (8 * d ^ 5 - (denseExponent R P d e b - denseExponent R P d e a)) | |
| then b else a | |
| def denseBitStepLaw (R : Option I β β) (P : Option J β β) (d : β) | |
| (e : I Γ J β Fin q) (a : Grid (I := Fin q) (4 * d ^ 8)) : | |
| RationalLaw (Grid (I := Fin q) (4 * d ^ 8)) := | |
| mapLaw (uniformLaw (Ξ± := Fin (denseStepBits d) β Bool)) (denseBitStep R P d e a) | |
| omit [DecidableEq I] [DecidableEq J] in | |
| theorem denseBitStepLaw_eq_finite (R : Option I β β) (P : Option J β β) (d : β) | |
| (e : I Γ J β Fin q) (a : Grid (I := Fin q) (4 * d ^ 8)) : | |
| denseBitStepLaw R P d e a = finiteDenseStepLaw R P d e a := by | |
| let E := pairWordEquiv (Nat.clog 2 (8 * d)) (8 * d ^ 5) | |
| let f := finiteAcceptStep a | |
| (fun z : Fin (2 ^ Nat.clog 2 (8 * d)) => axisCodeStep a z) | |
| (fun b => FairBits.acceptDyadic | |
| (denseExponent R P d e b - denseExponent R P d e a) (8 * d ^ 5)) | |
| have hf : denseBitStep R P d e a = fun bits => f (E bits) := by | |
| funext bits | |
| dsimp [denseBitStep, f, E, finiteAcceptStep] | |
| simp only [FairBits.acceptDyadic] | |
| cases axisCodeStep a ((pairWordEquiv (Nat.clog 2 (8 * d)) (8 * d ^ 5)) bits).1 with | |
| | none => rfl | |
| | some b => dsimp only; split_ifs <;> rfl | |
| unfold denseBitStepLaw | |
| rw [hf] | |
| change mapLaw (uniformLaw (Ξ± := Fin (Nat.clog 2 (8 * d) + 8 * d ^ 5) β Bool)) | |
| (fun bits => f (E bits)) = _ | |
| rw [β map_equiv E, uniform_equiv] | |
| rw [β uniform_product] | |
| rfl | |
| /-- The declared q_bin+8d^5 independent unbiased bits implement exactly | |
| the transition law whose mixing bound was proved. -/ | |
| theorem denseBitStepLaw_eq (R : Option I β β) (P : Option J β β) | |
| (d : β) (hd : 14 β€ d) (hR : β i, d ^ 12 β€ R i) (hP : β j, d ^ 12 β€ P j) | |
| (hRmax : β i, R (some i) β€ R none) (hPmax : β j, P (some j) β€ P none) | |
| (hdimR : Fintype.card (Option I) β€ d) (hdimP : Fintype.card (Option J) β€ d) | |
| (hfree : Fintype.card (I Γ J) β€ d) (htotal : β i, R i = β j, P j) | |
| (e : I Γ J β Fin q) (a : Grid (I := Fin q) (4 * d ^ 8)) : | |
| denseBitStepLaw R P d e a = rationalTransitionLaw R P d hd hfree e a := by | |
| rw [denseBitStepLaw_eq_finite] | |
| exact finiteDenseStepLaw_eq R P d hd hR hP hRmax hPmax hdimR hdimP hfree htotal e a | |
| end | |
| end ContingencyTables.GridBoundary | |
| end OAI | |