math / data /lean /OAI /Combinatorics /ContingencyTables /Machines /FiniteEncodedBind.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
1.88 kB
import OAI.Combinatorics.ContingencyTables.Transport.FiniteObservableTransport
import OAI.Combinatorics.ContingencyTables.Machines.FiniteWordDependent
namespace OAI
/-! # Composing exact laws through a noninjective state encoding -/
namespace ContingencyTables.FiniteObservableTransport
open CommonBasesFPRAS FairBits
open scoped Classical
noncomputable section
theorem encoded_bind {A B U V C Z W : Type*}
[Fintype A] [Fintype B] [Fintype U] [Fintype V]
(f : A β†’ C) (g : B β†’ Z) (e : Z β†’ C) (F : C β†’ U β†’ W) (G : Z β†’ V β†’ W)
(hinit : SameLaw f (fun b => e (g b))) (hstep : βˆ€ z,SameLaw (F (e z)) (G z)) :
SameLaw (fun p : AΓ—U => F (f p.1) p.2) (fun p : BΓ—V => G (g p.1) p.2) := by
intro phi
rw [uniformAverage_prod,uniformAverage_prod]
have hi := hinit (fun c => uniformAverage (fun u : U => phi (F c u)))
refine hi.trans ?_
apply congrArg uniformAverage
funext b
exact hstep (g b) phi
theorem flat_encoded_bind {C Z W : Type*} (a b c d : β„•)
(f : (Fin a β†’ Bool) β†’ C) (g : (Fin c β†’ Bool) β†’ Z) (e : Z β†’ C)
(F : C β†’ (Fin b β†’ Bool) β†’ W) (G : Z β†’ (Fin d β†’ Bool) β†’ W)
(hinit : SameLaw f (fun bits => e (g bits))) (hstep : βˆ€ z,SameLaw (F (e z)) (G z)) :
SameLaw (fun bits : Fin (a+b) β†’ Bool =>
F (f (splitWordEquiv a b bits).1) (splitWordEquiv a b bits).2)
(fun bits : Fin (c+d) β†’ Bool =>
G (g (splitWordEquiv c d bits).1) (splitWordEquiv c d bits).2) := by
have h := encoded_bind f g e F G hinit hstep
intro phi
have hl := uniformAverage_equiv (splitWordEquiv a b)
(fun p : (Fin a β†’ Bool)Γ—(Fin b β†’ Bool) => phi (F (f p.1) p.2))
have hr := uniformAverage_equiv (splitWordEquiv c d)
(fun p : (Fin c β†’ Bool)Γ—(Fin d β†’ Bool) => phi (G (g p.1) p.2))
exact hl.trans ((h phi).trans hr.symm)
end
end ContingencyTables.FiniteObservableTransport
end OAI