cfahlgren1/math / lean /OAI /Computability /MaxCut /Games /AffineWitness.lean
cfahlgren1's picture
download
raw
25.3 kB
import Mathlib
import OAI.Computability.MaxCut.Games.RowErasure
namespace OAI
noncomputable section
namespace MaxCutGames.Inverse.AffineWitness
section
abbrev F2 := ZMod 2
variable {D C R : Type*}
[AddCommGroup D] [Module F2 D]
[AddCommGroup C] [Module F2 C]
[AddCommGroup R] [Module F2 R]
theorem add_self_binary (c : C) : c + c = 0 := by
have h : (1 : F2) + 1 = 0 := by decide
calc
c + c = (1 : F2) • c + (1 : F2) • c := by simp
_ = ((1 : F2) + 1) • c := (add_smul _ _ _).symm
_ = 0 := by rw [h, zero_smul]
/-- A simultaneous row fiber and column slice, based at `M₀`. Agreement on
`Z` is exactly agreement with all column specifications spanning `Z`. -/
def InSlice (A : C →ₗ[F2] R) (Z : Submodule F2 D)
(M₀ M : D →ₗ[F2] C) : Prop :=
A.comp M = A.comp M₀ ∧ ∀ w ∈ Z, M w = M₀ w
/-- Changing the representative also changes the affine intercept. -/
theorem translate_target (A : C →ₗ[F2] R) (Z : Submodule F2 D)
(M₀ M : D →ₗ[F2] C) (hM : InSlice A Z M₀ M)
(z w : D) (hw : w ∈ Z) (u : C) :
M (z + w) + (u + M₀ w) = M z + u := by
rw [map_add, hM.2 w hw]
calc
(M z + M₀ w) + (u + M₀ w) = (M z + u) + (M₀ w + M₀ w) := by
ac_rfl
_ = M z + u := by rw [add_self_binary, add_zero]
theorem no_affine_representative (e : D →ₗ[F2] F2) (Z : Submodule F2 D)
(z : D) (h : ¬ ∃ w ∈ Z, e (z + w) = 1) :
e z = 0 ∧ ∀ w ∈ Z, e w = 0 := by
have scalar_cases : ∀ a : F2, a = 0 ∨ a = 1 := by decide
have hz : e z = 0 := by
rcases scalar_cases (e z) with hz | hz
· exact hz
· exact False.elim (h ⟨0, Z.zero_mem, by simpa using hz⟩)
refine ⟨hz, ?_⟩
intro w hw
rcases scalar_cases (e w) with hw0 | hw1
· exact hw0
· exact False.elim (h ⟨w, hw, by rw [map_add, hz, zero_add, hw1]⟩)
/-- Rank-one translation in the row kernel. -/
def shift (e : D →ₗ[F2] F2) (h : C) (M : D →ₗ[F2] C) : D →ₗ[F2] C :=
M + e.smulRight h
@[simp] theorem shift_apply (e : D →ₗ[F2] F2) (h : C)
(M : D →ₗ[F2] C) (x : D) : shift e h M x = M x + e x • h := rfl
@[simp] theorem shift_zero (e : D →ₗ[F2] F2) (M : D →ₗ[F2] C) :
shift e 0 M = M := by
ext x
simp
theorem shift_add (e : D →ₗ[F2] F2) (h k : C) (M : D →ₗ[F2] C) :
shift e (h + k) M = shift e h (shift e k M) := by
ext x
simp only [shift_apply, smul_add]
ac_rfl
theorem shift_preserves_slice (e : D →ₗ[F2] F2) (A : C →ₗ[F2] R)
(Z : Submodule F2 D) (M₀ M : D →ₗ[F2] C)
(heZ : ∀ w ∈ Z, e w = 0) (h : A.ker) (hM : InSlice A Z M₀ M) :
InSlice A Z M₀ (shift e h M) := by
constructor
· ext x
have hx := LinearMap.congr_fun hM.1 x
have hh : A (h : C) = 0 := h.property
simpa only [LinearMap.comp_apply, shift_apply, map_add, map_smul,
hh, smul_zero, add_zero] using hx
· intro w hw
simp only [shift_apply, heZ w hw, zero_smul, add_zero]
exact hM.2 w hw
theorem shift_preserves_target (e : D →ₗ[F2] F2) (z : D) (hz : e z = 0)
(u h : C) (M : D →ₗ[F2] C) :
shift e h M z + u = M z + u := by
simp only [shift_apply, hz, zero_smul, add_zero]
/-- Normalization preserves every affine target value on the complete slice. -/
theorem normalize (e : D →ₗ[F2] F2) (A : C →ₗ[F2] R)
(Z : Submodule F2 D) (M₀ : D →ₗ[F2] C) (z : D) (u : C)
(h : ∃ w ∈ Z, e (z + w) = 1) :
∃ z' : D, ∃ u' : C, e z' = 1 ∧
∀ M, InSlice A Z M₀ M → M z' + u' = M z + u := by
obtain ⟨w, hw, he⟩ := h
exact ⟨z + w, u + M₀ w, he, fun M hM => translate_target A Z M₀ M hM z w hw u⟩
end
/-! Conversion between explicitly listed affine column specifications and the
span-based slice used in first-bit normalization. -/
variable {D C R ι : Type*}
[AddCommGroup D] [Module F2 D]
[AddCommGroup C] [Module F2 C]
[AddCommGroup R] [Module F2 R]
theorem columns_iff_span (q : ι → D) (t : ι → C)
(M₀ M : D →ₗ[F2] C) (hM₀ : ∀ i, M₀ (q i) = t i) :
(∀ i, M (q i) = t i) ↔
∀ w ∈ Submodule.span F2 (Set.range q), M w = M₀ w := by
constructor
· intro hM w hw
apply LinearMap.eqOn_span (s := Set.range q) (x := w) ?_ hw
rintro _ ⟨i, rfl⟩
exact (hM i).trans (hM₀ i).symm
· intro hM i
exact (hM (q i) (Submodule.subset_span ⟨i, rfl⟩)).trans (hM₀ i)
/-- A nonempty explicit affine row/column system is precisely the based slice.
The right-hand sides `S₀` and `t` are retained without homogenization. -/
theorem explicit_slice_iff (A : C →ₗ[F2] R) (S₀ : D →ₗ[F2] R)
(q : ι → D) (t : ι → C) (M₀ M : D →ₗ[F2] C)
(hrow : A.comp M₀ = S₀) (hcol : ∀ i, M₀ (q i) = t i) :
(A.comp M = S₀ ∧ ∀ i, M (q i) = t i) ↔
InSlice A (Submodule.span F2 (Set.range q)) M₀ M := by
unfold InSlice
rw [hrow, columns_iff_span q t M₀ M hcol]
/-- The affine target value after normalization is unchanged at every matrix
satisfying the original, explicitly listed row and column equations. -/
theorem translate_explicit_target (A : C →ₗ[F2] R) (S₀ : D →ₗ[F2] R)
(q : ι → D) (t : ι → C) (M₀ M : D →ₗ[F2] C)
(hrow₀ : A.comp M₀ = S₀) (hcol₀ : ∀ i, M₀ (q i) = t i)
(hrow : A.comp M = S₀) (hcol : ∀ i, M (q i) = t i)
(z w : D) (hw : w ∈ Submodule.span F2 (Set.range q)) (u : C) :
M (z + w) + (u + M₀ w) = M z + u :=
translate_target A _ M₀ M
((explicit_slice_iff A S₀ q t M₀ M hrow₀ hcol₀).mp ⟨hrow, hcol⟩) z w hw u
end MaxCutGames.Inverse.AffineWitness
/-!
# Agreement counting for a folded action
A function that changes by an injectively encoded group element under a group
action can agree with an invariant target on at most one point per orbit. The
proof injects the product of the acting group and the agreement set into the
underlying finite space. Freeness of the action is not an additional premise:
the folding law and injectivity of the encoding force the needed freeness.
Only elementary group and finite-cardinality infrastructure is used here.
-/
namespace MaxCutGames.Inverse
variable {H X Y : Type*} [AddGroup H] [AddGroup Y]
/-- Translates of distinct agreement witnesses are distinct. The encoding need
not be given as a homomorphism: only its injectivity and the displayed folding
identity are needed for this conclusion. -/
theorem folded_action_injective
(shift : H → X → X)
(shift_zero : ∀ x, shift 0 x = x)
(shift_add : ∀ h k x, shift (h + k) x = shift h (shift k x))
(embed : H → Y) (embed_injective : Function.Injective embed)
(F target : X → Y)
(folded : ∀ h x, F (shift h x) = F x + embed h)
(target_invariant : ∀ h x, target (shift h x) = target x) :
Function.Injective
(fun a : H × {x : X // F x = target x} => shift a.1 a.2.val) := by
intro a b hab
have htarget : target a.2.val = target b.2.val := by
calc
target a.2.val = target (shift a.1 a.2.val) :=
(target_invariant a.1 a.2.val).symm
_ = target (shift b.1 b.2.val) := congrArg target hab
_ = target b.2.val := target_invariant b.1 b.2.val
have hfold : F a.2.val + embed a.1 = F b.2.val + embed b.1 := by
calc
F a.2.val + embed a.1 = F (shift a.1 a.2.val) :=
(folded a.1 a.2.val).symm
_ = F (shift b.1 b.2.val) := congrArg F hab
_ = F b.2.val + embed b.1 := folded b.1 b.2.val
rw [a.2.property, b.2.property, htarget] at hfold
have hh : a.1 = b.1 := embed_injective (add_left_cancel hfold)
have hx : a.2.val = b.2.val := by
have hshift : shift a.1 a.2.val = shift a.1 b.2.val := by
simpa only [hh] using hab
have hinverse := congrArg (shift (-a.1)) hshift
simpa only [← shift_add, neg_add_cancel, shift_zero] using hinverse
exact Prod.ext hh (Subtype.ext hx)
/-- The agreement set of a folded function with an invariant target occupies
at most the reciprocal of the size of the acting group, in denominator-free
finite-cardinality form. -/
theorem folded_action_card_mul_agreement_le
[Fintype H] [Fintype X] [DecidableEq Y]
(shift : H → X → X)
(shift_zero : ∀ x, shift 0 x = x)
(shift_add : ∀ h k x, shift (h + k) x = shift h (shift k x))
(embed : H → Y) (embed_injective : Function.Injective embed)
(F target : X → Y)
(folded : ∀ h x, F (shift h x) = F x + embed h)
(target_invariant : ∀ h x, target (shift h x) = target x) :
Fintype.card H * Fintype.card {x : X // F x = target x} ≤
Fintype.card X := by
simpa only [Fintype.card_prod] using
Fintype.card_le_of_injective
(fun a : H × {x : X // F x = target x} => shift a.1 a.2.val)
(folded_action_injective shift shift_zero shift_add embed embed_injective
F target folded target_invariant)
end MaxCutGames.Inverse
/-!
The finite orbit count completing the first-bit witness normalization in v2.
The assumption in `normalize_of_good_count` is precisely that agreement is
strictly greater than the reciprocal of the row-kernel cardinality, expressed
without division. It is a quantitative goodness hypothesis, not an inverse
theorem or a nonlinear rank premise.
-/
namespace MaxCutGames.Inverse.AffineWitness
variable {D C R : Type*}
[AddCommGroup D] [Module F2 D]
[AddCommGroup C] [Module F2 C]
[AddCommGroup R] [Module F2 R]
/-- The actual simultaneous row/column slice, including its affine offsets. -/
abbrev Slice (A : C →ₗ[F2] R) (Z : Submodule F2 D) (M₀ : D →ₗ[F2] C) :=
{M : D →ₗ[F2] C // InSlice A Z M₀ M}
def sliceShift (e : D →ₗ[F2] F2) (A : C →ₗ[F2] R)
(Z : Submodule F2 D) (M₀ : D →ₗ[F2] C)
(heZ : ∀ w ∈ Z, e w = 0) (h : A.ker) (M : Slice A Z M₀) :
Slice A Z M₀ :=
⟨shift e h M, shift_preserves_slice e A Z M₀ M heZ h M.property⟩
theorem sliceShift_zero (e : D →ₗ[F2] F2) (A : C →ₗ[F2] R)
(Z : Submodule F2 D) (M₀ : D →ₗ[F2] C)
(heZ : ∀ w ∈ Z, e w = 0) (M : Slice A Z M₀) :
sliceShift e A Z M₀ heZ 0 M = M := by
apply Subtype.ext
exact shift_zero e M.val
theorem sliceShift_add (e : D →ₗ[F2] F2) (A : C →ₗ[F2] R)
(Z : Submodule F2 D) (M₀ : D →ₗ[F2] C)
(heZ : ∀ w ∈ Z, e w = 0) (h k : A.ker) (M : Slice A Z M₀) :
sliceShift e A Z M₀ heZ (h + k) M =
sliceShift e A Z M₀ heZ h (sliceShift e A Z M₀ heZ k M) := by
apply Subtype.ext
exact shift_add e (h : C) (k : C) M.val
/-- If the affine coset misses first bit one, folding limits agreement to one
point per row-kernel orbit. No rank-level inequality is used. -/
theorem agreement_count_le [Finite D] [Finite C]
(e : D →ₗ[F2] F2) (A : C →ₗ[F2] R)
(Z : Submodule F2 D) (M₀ : D →ₗ[F2] C) (z : D) (u : C)
(F : (D →ₗ[F2] C) → C)
(hfold : ∀ (h : A.ker) M, F (shift e h M) = F M + h)
(hno : ¬ ∃ w ∈ Z, e (z + w) = 1) :
Nat.card A.ker * Nat.card {M : Slice A Z M₀ // F M = M.val z + u} ≤
Nat.card (Slice A Z M₀) := by
classical
let : Fintype D := Fintype.ofFinite D
let : Fintype C := Fintype.ofFinite C
let : Fintype (D →ₗ[F2] C) := Fintype.ofInjective DFunLike.coe DFunLike.coe_injective
obtain ⟨hz, heZ⟩ := no_affine_representative e Z z hno
have hcount := folded_action_card_mul_agreement_le
(sliceShift e A Z M₀ heZ)
(sliceShift_zero e A Z M₀ heZ)
(sliceShift_add e A Z M₀ heZ)
(fun h : A.ker => (h : C)) Subtype.val_injective
(fun M : Slice A Z M₀ => F M)
(fun M : Slice A Z M₀ => M.val z + u)
(fun h M => hfold h M)
(fun h M => shift_preserves_target e z hz u h M)
simpa only [Nat.card_eq_fintype_card] using hcount
/-- A good affine witness has a first-bit-one representative with an adjusted
intercept, agreeing with the original target on every matrix of its slice. -/
theorem normalize_of_good_count [Finite D] [Finite C]
(e : D →ₗ[F2] F2) (A : C →ₗ[F2] R)
(Z : Submodule F2 D) (M₀ : D →ₗ[F2] C) (z : D) (u : C)
(F : (D →ₗ[F2] C) → C)
(hfold : ∀ (h : A.ker) M, F (shift e h M) = F M + h)
(hgood : Nat.card (Slice A Z M₀) <
Nat.card A.ker * Nat.card {M : Slice A Z M₀ // F M = M.val z + u}) :
∃ z' : D, ∃ u' : C, e z' = 1 ∧
∀ M, InSlice A Z M₀ M → M z' + u' = M z + u := by
apply normalize e A Z M₀ z u
by_contra hno
exact (not_lt_of_ge (agreement_count_le e A Z M₀ z u F hfold hno)) hgood
end MaxCutGames.Inverse.AffineWitness
/-!
The size bound for the actual simultaneous row/column slices in v2, Section 4.
Starting at any point of a nonempty slice, maps from the quotient by its column
span into the common row kernel give distinct points of that same affine slice.
Rank-nullity gives the dimension lower bound even when equations are dependent.
This argument uses only finite-dimensional linear algebra.
-/
namespace MaxCutGames.Inverse.Shortcode
section
open scoped BigOperators Matrix
namespace Slice
variable {ell m : ℕ}
/-- The simultaneous row functionals, allowing dependent and zero rows. -/
def rowMap (S : Slice ell m) : Vector ell →ₗ[F2] Vector S.rows :=
Matrix.mulVecLin S.rowCoefficient
/-- Column specifications fix the matrix on this entire subspace. -/
def columnSpan (S : Slice ell m) : Submodule F2 (Vector m) :=
Submodule.span F2 (Set.range S.columnCoefficient)
/-- Free directions of a row/column slice, intrinsically as quotient maps. -/
abbrev Directions (S : Slice ell m) :=
(Vector m ⧸ S.columnSpan) →ₗ[F2] S.rowMap.ker
def directionMap (S : Slice ell m) (N : S.Directions) :
Vector m →ₗ[F2] Vector ell :=
S.rowMap.ker.subtype.comp (N.comp S.columnSpan.mkQ)
def directionMatrix (S : Slice ell m) (N : S.Directions) : Mat ell m :=
LinearMap.toMatrix' (S.directionMap N)
theorem directionMatrix_injective (S : Slice ell m) :
Function.Injective S.directionMatrix := by
intro N P h
have hmap : S.directionMap N = S.directionMap P :=
LinearMap.toMatrix'.injective h
apply LinearMap.ext
intro x
obtain ⟨v, rfl⟩ := S.columnSpan.mkQ_surjective x
apply Subtype.ext
exact congrArg (fun f : Vector m →ₗ[F2] Vector ell => f v) hmap
theorem directionMatrix_row (S : Slice ell m) (N : S.Directions)
(i : Fin S.rows) (j : Fin m) :
(∑ a, S.rowCoefficient i a * S.directionMatrix N a j) = 0 := by
have h := (N (S.columnSpan.mkQ (Pi.single j 1))).property
have hi := congrFun h i
change (∑ a, S.rowCoefficient i a *
(N (S.columnSpan.mkQ (Pi.single j 1)) : Vector ell) a) = 0 at hi
exact hi
theorem directionMatrix_column (S : Slice ell m) (N : S.Directions)
(i : Fin S.columns) :
evaluate (S.directionMatrix N) (S.columnCoefficient i) = 0 := by
have hq : S.columnSpan.mkQ (S.columnCoefficient i) = 0 := by
apply (Submodule.Quotient.mk_eq_zero S.columnSpan).mpr
exact Submodule.subset_span ⟨i, rfl⟩
change (S.directionMatrix N) *ᵥ (S.columnCoefficient i) = 0
rw [directionMatrix, LinearMap.toMatrix'_mulVec]
simp [directionMap, hq]
theorem contains_add_direction (S : Slice ell m) (M : Mat ell m)
(hM : S.Contains M) (N : S.Directions) :
S.Contains (M + S.directionMatrix N) := by
constructor
· intro i j
simp only [Matrix.add_apply, mul_add, Finset.sum_add_distrib]
rw [hM.1 i j, S.directionMatrix_row N i j, add_zero]
· intro i
have hd := S.directionMatrix_column N i
change evaluate (M + S.directionMatrix N) (S.columnCoefficient i) = _
have he : evaluate (M + S.directionMatrix N) (S.columnCoefficient i) =
evaluate M (S.columnCoefficient i) +
evaluate (S.directionMatrix N) (S.columnCoefficient i) := by
ext a
simp [evaluate, add_mul, Finset.sum_add_distrib]
rw [he, hM.2 i, hd, add_zero]
def directionEmbedding (S : Slice ell m) (M : Mat ell m) (hM : S.Contains M) :
S.Directions ↪ S.points where
toFun N := ⟨M + S.directionMatrix N, by
simp only [points, Finset.mem_filter, Finset.mem_univ, true_and]
exact S.contains_add_direction M hM N⟩
inj' := by
intro N P h
apply S.directionMatrix_injective
exact add_left_cancel (congrArg Subtype.val h)
theorem columnSpan_finrank_le (S : Slice ell m) :
Module.finrank F2 S.columnSpan ≤ S.columns := by
have h := finrank_range_le_card (R := F2) (M := Vector m) S.columnCoefficient
change Module.finrank F2 (Submodule.span F2 (Set.range S.columnCoefficient)) ≤
Fintype.card (Fin S.columns) at h
rw [Fintype.card_fin] at h
exact h
theorem quotient_finrank_ge (S : Slice ell m) :
m - S.columns ≤ Module.finrank F2 (Vector m ⧸ S.columnSpan) := by
have h := S.columnSpan.finrank_quotient_add_finrank
have hspan := S.columnSpan_finrank_le
have hm : Module.finrank F2 (Vector m) = m := by simp [Vector]
rw [hm] at h
omega
theorem rowKernel_finrank_ge (S : Slice ell m) :
ell - S.rows ≤ Module.finrank F2 S.rowMap.ker := by
have h := S.rowMap.finrank_range_add_finrank_ker
have hrange : Module.finrank F2 S.rowMap.range ≤ S.rows := by
exact S.rowMap.range.finrank_le.trans_eq (by simp [Vector])
have hell : Module.finrank F2 (Vector ell) = ell := by simp [Vector]
rw [hell] at h
omega
theorem card_directions (S : Slice ell m) :
Nat.card S.Directions =
2 ^ (Module.finrank F2 (Vector m ⧸ S.columnSpan) *
Module.finrank F2 S.rowMap.ker) := by
rw [Module.natCard_eq_pow_finrank (K := F2), Module.finrank_linearMap]
simp [F2]
/-- A nonempty affine slice is at least as large as its free-direction space. -/
theorem card_directions_le (S : Slice ell m) (hne : S.points.Nonempty) :
Nat.card S.Directions ≤ S.points.card := by
obtain ⟨M, hM⟩ := hne
have hcontains : S.Contains M := by simpa only [points, Finset.mem_filter,
Finset.mem_univ, true_and] using hM
simpa only [Nat.card_eq_finsetCard] using
Nat.card_le_card_of_injective (S.directionEmbedding M hcontains)
(S.directionEmbedding M hcontains).injective
/-- The actual v2 bound, with truncation making it valid also in small dimensions.
There is no independence hypothesis on the listed equations. -/
theorem pow_dimension_le_card (S : Slice ell m) (r : ℕ)
(hrows : S.rows ≤ r) (hcolumns : S.columns ≤ r)
(hne : S.points.Nonempty) :
2 ^ ((ell - r) * (m - r)) ≤ S.points.card := by
have hrow : ell - r ≤ Module.finrank F2 S.rowMap.ker :=
(Nat.sub_le_sub_left hrows ell).trans S.rowKernel_finrank_ge
have hcol : m - r ≤ Module.finrank F2 (Vector m ⧸ S.columnSpan) :=
(Nat.sub_le_sub_left hcolumns m).trans S.quotient_finrank_ge
have hmul := Nat.mul_le_mul hcol hrow
rw [Nat.mul_comm (m - r) (ell - r)] at hmul
have hp := Nat.pow_le_pow_right (by decide : 1 ≤ 2) hmul
rw [← S.card_directions] at hp
exact hp.trans (S.card_directions_le hne)
end Slice
end
/-! Exact connection between the v2 finite-array shortcode slices and the
linear-map slices used by affine witness normalization. -/
open scoped BigOperators Classical Matrix
namespace Slice
variable {ell m : ℕ}
theorem evaluate_eq_toLin (M : Mat ell m) (z : Vector m) :
evaluate M z = Matrix.toLin' M z := rfl
theorem row_equations_iff (S : Slice ell m) (M : Mat ell m) :
(∀ i j, (∑ a, S.rowCoefficient i a * M a j) = S.rowValue i j) ↔
S.rowMap.comp (Matrix.toLin' M) = Matrix.toLin' S.rowValue := by
let A : Matrix (Fin S.rows) (Fin ell) F2 := S.rowCoefficient
let B : Matrix (Fin S.rows) (Fin m) F2 := S.rowValue
change (∀ i j, (∑ a, A i a * M a j) = B i j) ↔
(Matrix.toLin' A).comp (Matrix.toLin' M) = Matrix.toLin' B
constructor
· intro h
have hm : A * M = B := by
ext i j
exact h i j
rw [← Matrix.toLin'_mul, hm]
· intro h
have hm : A * M = B := by
apply Matrix.toLin'.injective
rw [Matrix.toLin'_mul]
exact h
intro i j
exact congrFun (congrFun hm i) j
/-- This is an equivalence of the actual equations, not merely a cardinality
comparison or a homogeneous approximation of the affine slice. -/
theorem contains_iff_inSlice (S : Slice ell m) (M₀ : Mat ell m)
(hM₀ : S.Contains M₀) (M : Mat ell m) :
S.Contains M ↔
AffineWitness.InSlice S.rowMap S.columnSpan
(Matrix.toLin' M₀) (Matrix.toLin' M) := by
have hrow₀ := (S.row_equations_iff M₀).mp hM₀.1
have hcol₀ : ∀ i, Matrix.toLin' M₀ (S.columnCoefficient i) =
S.columnValue i := hM₀.2
have heq := AffineWitness.explicit_slice_iff S.rowMap
(Matrix.toLin' S.rowValue) S.columnCoefficient S.columnValue
(Matrix.toLin' M₀) (Matrix.toLin' M) hrow₀ hcol₀
constructor
· intro hM
exact heq.mp ⟨(S.row_equations_iff M).mp hM.1, hM.2⟩
· intro hM
have h := heq.mpr hM
exact ⟨(S.row_equations_iff M).mpr h.1, h.2⟩
/-- Exact finite sample-space equivalence between the matrix representation
and the linear-map representation of a nonempty affine slice. -/
def linearSliceEquiv (S : Slice ell m) (M₀ : Mat ell m)
(hM₀ : S.Contains M₀) :
S.points ≃ AffineWitness.Slice S.rowMap S.columnSpan (Matrix.toLin' M₀) where
toFun M := ⟨Matrix.toLin' M.val,
(S.contains_iff_inSlice M₀ hM₀ M.val).mp (by
simpa only [points, Finset.mem_filter, Finset.mem_univ, true_and] using M.property)⟩
invFun N := ⟨LinearMap.toMatrix' N.val, by
simp only [points, Finset.mem_filter, Finset.mem_univ, true_and]
apply (S.contains_iff_inSlice M₀ hM₀ _).mpr
simpa only [Matrix.toLin'_toMatrix'] using N.property⟩
left_inv M := by
apply Subtype.ext
exact LinearMap.toMatrix'_toLin' M.val
right_inv N := by
apply Subtype.ext
exact Matrix.toLin'_toMatrix' N.val
/-- Pointwise preservation on the genuine slice preserves its exact uniform
affine agreement, including the empty-slice convention. -/
theorem affineAgreement_eq_of_target_eq (S : Slice ell m)
(f : Mat ell m → Vector ell) (z z' : Vector m) (u u' : Vector ell)
(htarget : ∀ M, S.Contains M → evaluate M z' + u' = evaluate M z + u) :
S.affineAgreement f z' u' = S.affineAgreement f z u := by
unfold affineAgreement
apply Finset.expect_congr rfl
intro M hM
have hcontains : S.Contains M := by
simpa only [points, Finset.mem_filter, Finset.mem_univ, true_and] using hM
rw [htarget M hcontains]
theorem affineAgreement_eq_of_linear_target_eq (S : Slice ell m)
(M₀ : Mat ell m) (hM₀ : S.Contains M₀)
(f : Mat ell m → Vector ell) (z z' : Vector m) (u u' : Vector ell)
(htarget : ∀ M, AffineWitness.InSlice S.rowMap S.columnSpan
(Matrix.toLin' M₀) M → M z' + u' = M z + u) :
S.affineAgreement f z' u' = S.affineAgreement f z u := by
apply S.affineAgreement_eq_of_target_eq f z z' u u'
intro M hM
exact htarget (Matrix.toLin' M) ((S.contains_iff_inSlice M₀ hM₀ M).mp hM)
/-- Changing the representative inside the column span and correcting the
intercept leaves the shortcode agreement exactly unchanged. -/
theorem affineAgreement_translate (S : Slice ell m)
(M₀ : Mat ell m) (hM₀ : S.Contains M₀)
(f : Mat ell m → Vector ell) (z w : Vector m) (hw : w ∈ S.columnSpan)
(u : Vector ell) :
S.affineAgreement f (z + w) (u + evaluate M₀ w) =
S.affineAgreement f z u := by
apply S.affineAgreement_eq_of_linear_target_eq M₀ hM₀ f z (z + w) u _
intro M hM
exact AffineWitness.translate_target S.rowMap S.columnSpan (Matrix.toLin' M₀)
M hM z w hw u
end Slice
end MaxCutGames.Inverse.Shortcode
/-! The probability form of first-bit witness normalization. -/
namespace MaxCutGames.Inverse.AffineWitness
variable {D C R : Type*}
[AddCommGroup D] [Module F2 D]
[AddCommGroup C] [Module F2 C]
[AddCommGroup R] [Module F2 R]
/-- An agreement lower bound above the inverse row-kernel size produces a
first-bit-one representative while preserving the entire affine target. -/
theorem normalize_of_density [Finite D] [Finite C]
(e : D →ₗ[F2] F2) (A : C →ₗ[F2] R)
(Z : Submodule F2 D) (M₀ : D →ₗ[F2] C) (z : D) (u : C)
(F : (D →ₗ[F2] C) → C)
(hfold : ∀ (h : A.ker) M, F (shift e h M) = F M + h)
(η : ℝ)
(hgood : η ≤
(Nat.card {M : Slice A Z M₀ // F M = M.val z + u} : ℝ) /
(Nat.card (Slice A Z M₀) : ℝ))
(hsize : 1 < η * (Nat.card A.ker : ℝ)) :
∃ z' : D, ∃ u' : C, e z' = 1 ∧
∀ M, InSlice A Z M₀ M → M z' + u' = M z + u := by
classical
let : Fintype D := Fintype.ofFinite D
let : Fintype C := Fintype.ofFinite C
let : Fintype (D →ₗ[F2] C) := Fintype.ofInjective DFunLike.coe DFunLike.coe_injective
let : Nonempty (Slice A Z M₀) := ⟨⟨M₀, rfl, fun _ _ => rfl⟩⟩
have hpos : (0 : ℝ) < (Nat.card (Slice A Z M₀) : ℝ) := by
exact_mod_cast Nat.card_pos (α := Slice A Z M₀)
have hmass := (le_div_iff₀ hpos).mp hgood
have hmul := mul_le_mul_of_nonneg_right hmass
(Nat.cast_nonneg (α := ℝ) (Nat.card A.ker))
have hstrict := mul_lt_mul_of_pos_right hsize hpos
apply normalize_of_good_count e A Z M₀ z u F hfold
have hreal : (Nat.card (Slice A Z M₀) : ℝ) <
(Nat.card A.ker : ℝ) *
(Nat.card {M : Slice A Z M₀ // F M = M.val z + u} : ℝ) := by
nlinarith only [hmul, hstrict]
exact_mod_cast hreal
end MaxCutGames.Inverse.AffineWitness
end
end OAI

Xet Storage Details

Size:
25.3 kB
·
Xet hash:
cdd38347080f270a755de165a704164910f1f07d0181e786b085be147cddb296

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.