math / data /lean /OAI /Computability /MaxCut /Encoding /ActualInputRows.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
4.6 kB
import Mathlib
import OAI.Computability.MaxCut.Encoding.BinaryRowTransport
namespace OAI
/-! Local extraction of the genuine linear row maps from complete supplied inputs. -/
namespace MaxCutGames.Soundness.ActualInputRows
open MaxCutGames.Integration.BinaryLinear
open MaxCutGames.Reduction
open ConditionalIncidences PartnerMapCoordinates RawPartnerTarget BinaryRowTransport
noncomputable section
attribute [local instance] Classical.propDecidable
variable {k : Nat} {Q Id Name : Type}
def restrictedFirst (rhs : Id β†’ Bool)
(qa : ZeroInformation.FirstInput (Fin k) Q Id) (x : ActualHomogeneous.E k) : Q β†’ F2 :=
let p := (PartnerLinear.sourceLinearEquiv (fun j => rhs (qa.question j))).symm x
fun q => ofBit (qa.row p.homogeneous
(fun j => ConcreteExtraction.tripleCoordinates (p.coordinates j)) q)
def firstMap (rhs : Id β†’ Bool) (qa : ZeroInformation.FirstInput (Fin k) Q Id) :
ActualHomogeneous.E k β†’β‚—[F2] (Q β†’ F2) :=
if h : βˆƒ Z : ActualHomogeneous.E k β†’β‚—[F2] (Q β†’ F2),
βˆ€ x, Z x = restrictedFirst rhs qa x then Classical.choose h else 0
theorem firstMap_eq (rhs : Id β†’ Bool) (qa : ZeroInformation.FirstInput (Fin k) Q Id)
(Z : ActualHomogeneous.E k β†’β‚—[F2] (Q β†’ F2))
(hZ : βˆ€ x, restrictedFirst rhs qa x = Z x) : firstMap rhs qa = Z := by
have h : βˆƒ W : ActualHomogeneous.E k β†’β‚—[F2] (Q β†’ F2),
βˆ€ x, W x = restrictedFirst rhs qa x := ⟨Z, fun x => (hZ x).symm⟩
unfold firstMap
rw [dite_eq_left h]
exact LinearMap.ext (fun x => (Classical.choose_spec h x).trans (hZ x))
def restrictedSecond (J : Finset (Fin k))
(qb : ZeroInformation.SecondInput (Fin k) Q Id Name) (v : RawPoint J) : Q β†’ F2 :=
let y := (pointEquiv (fun _ : Fin k => false) J).symm v
fun q => ofBit (qb.row y.homogeneous
(fun j => ConcreteExtraction.tripleCoordinates (y.full j)) y.single q)
def secondMap (J : Finset (Fin k))
(qb : ZeroInformation.SecondInput (Fin k) Q Id Name) : RawPoint J β†’β‚—[F2] (Q β†’ F2) :=
if h : βˆƒ Y : RawPoint J β†’β‚—[F2] (Q β†’ F2),
βˆ€ v, Y v = restrictedSecond J qb v then Classical.choose h else 0
theorem secondMap_eq (J : Finset (Fin k))
(qb : ZeroInformation.SecondInput (Fin k) Q Id Name) (Y : RawPoint J β†’β‚—[F2] (Q β†’ F2))
(hY : βˆ€ v, restrictedSecond J qb v = Y v) : secondMap J qb = Y := by
have h : βˆƒ W : RawPoint J β†’β‚—[F2] (Q β†’ F2),
βˆ€ v, W v = restrictedSecond J qb v := ⟨Y, fun v => (hY v).symm⟩
unfold secondMap
rw [dite_eq_left h]
exact LinearMap.ext (fun v => (Classical.choose_spec h v).trans (hY v))
/-- The first player's extraction on the actual sampled input equals `Y Ο€`.
There is no assumption that an arbitrary input row is linear. -/
theorem firstMap_actual [Fintype Q] [DecidableEq Q]
(J : Finset (Fin k)) (rhs : Id β†’ Bool) (occ : Fin k β†’ Id)
(slot : Fin k β†’ PartnerProjection.Slot) (Y : RawPoint J β†’β‚—[F2] (Q β†’ F2)) :
firstMap rhs (actualFirst J (rowCoefficients J (gammaOfRawMap J Y))
(fun j => (occ j, ConcreteExtraction.slotIndex (slot j)))) =
Y.comp (rawProjection (fun j => rhs (occ j)) J slot) := by
apply firstMap_eq
intro x
let p := (PartnerLinear.sourceLinearEquiv (fun j => rhs (occ j))).symm x
have h := actual_pullbackRow (fun j => rhs (occ j)) J (gammaOfRawMap J Y) slot p
rw [← rawMap_on_partner (fun j => rhs (occ j)) J Y] at h
funext q
have he := congrArg ofBit (congrFun h q).symm
simp only [rowBits, ofBit_toBit, restrictedFirst, actualFirst,
ZeroInformation.firstInput, rawProjection, p, LinearMap.comp_apply,
LinearEquiv.coe_toLinearMap] at he ⊒
convert he using 1
congr 5
/-- The second player's extraction equals the genuine supplied raw target map. -/
theorem secondMap_actual [Fintype Q] [DecidableEq Q]
(J : Finset (Fin k)) (names : Id β†’ Fin 3 β†’ Name) (draw : Draw (Fin k) Id)
(Y : RawPoint J β†’β‚—[F2] (Q β†’ F2)) :
secondMap J (actualSecond J names (rowCoefficients J (gammaOfRawMap J Y)) draw) = Y := by
apply secondMap_eq
intro v
let y := (pointEquiv (fun _ : Fin k => false) J).symm v
have h := actual_partnerRow (fun _ : Fin k => false) J (gammaOfRawMap J Y) y
rw [← rawMap_on_partner (fun _ : Fin k => false) J Y] at h
have hy : pointEquiv (fun _ : Fin k => false) J y = v :=
(pointEquiv (fun _ : Fin k => false) J).apply_symm_apply v
rw [hy] at h
funext q
have he := congrArg ofBit (congrFun h q).symm
simpa only [rowBits, ofBit_toBit, restrictedSecond, actualSecond,
ZeroInformation.secondInput, y] using he
end
end MaxCutGames.Soundness.ActualInputRows
end OAI