Download data/lean/OAI/Algorithms/SubexponentialSAT/CosetInvariance.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.96 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/CosetInvariance.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/CosetInvariance.lean
-
curl -L -o CosetInvariance.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/CosetInvariance.lean
7.96 kB
| import OAI.Algorithms.SubexponentialSAT.LeanCompat | |
| namespace OAI.Algorithms | |
| /-! | |
| # Coset invariance of residue lifts | |
| Section 4.3 of the candidate exposition chooses a fixed section of reduction | |
| and applies it to the residue of a lifted row evaluation. The coordinate | |
| lifts themselves need not preserve addition. This file isolates that fact: | |
| only their residues must agree with the specified linear row. | |
| -/ | |
| namespace SubexponentialSAT.CosetInvariance | |
| section Linear | |
| variable {R M N : Type*} [Ring R] [AddCommGroup M] [Module R M] | |
| [AddCommGroup N] [Module R N] | |
| /-- A row which annihilates a submodule is constant on each of its cosets. -/ | |
| theorem linear_map_eq_of_sub_mem (L : M ββ[R] N) (K : Submodule R M) | |
| (hK : K β€ LinearMap.ker L) {x y : M} (hxy : y - x β K) : | |
| L y = L x := by | |
| have hzero : L (y - x) = 0 := hK hxy | |
| simpa only [map_sub, sub_eq_zero] using hzero | |
| theorem linear_map_add_eq_of_mem (L : M ββ[R] N) (K : Submodule R M) | |
| (hK : K β€ LinearMap.ker L) (x : M) {r : M} (hr : r β K) : | |
| L (x + r) = L x := by | |
| have hzero : L r = 0 := hK hr | |
| simp only [map_add, hzero, add_zero] | |
| /-- Applying any fixed function preserves this exact coset invariance. -/ | |
| theorem compose_eq_of_sub_mem {A : Type*} (L : M ββ[R] N) | |
| (K : Submodule R M) (hK : K β€ LinearMap.ker L) (s : N β A) | |
| {x y : M} (hxy : y - x β K) : | |
| s (L y) = s (L x) := | |
| congrArg s (linear_map_eq_of_sub_mem L K hK hxy) | |
| /-- The common value is genuinely a function on the quotient by the subspace. -/ | |
| def onQuotient {A : Type*} (L : M ββ[R] N) (K : Submodule R M) | |
| (hK : K β€ LinearMap.ker L) (s : N β A) : (M β§Έ K) β A := | |
| fun q => s (K.liftQ L hK q) | |
| @[simp] | |
| theorem onQuotient_mk {A : Type*} (L : M ββ[R] N) (K : Submodule R M) | |
| (hK : K β€ LinearMap.ker L) (s : N β A) (x : M) : | |
| onQuotient L K hK s (Submodule.Quotient.mk x) = s (L x) := rfl | |
| end Linear | |
| section Residue | |
| variable {A E : Type*} [CommRing A] [CommRing E] | |
| /-- An arbitrary fixed right inverse of a residue homomorphism. | |
| No additive or multiplicative property is required of the lift. -/ | |
| structure ResidueSection (Ο : A β+* E) where | |
| lift : E β A | |
| residue_lift : β y, Ο (lift y) = y | |
| namespace ResidueSection | |
| variable {Ο : A β+* E} (s : ResidueSection Ο) | |
| /-- The error between a value and the chosen lift of its residue. -/ | |
| def defect (a : A) : A := a - s.lift (Ο a) | |
| @[simp] | |
| theorem residue_defect (a : A) : Ο (s.defect a) = 0 := by | |
| simp only [defect, map_sub, s.residue_lift, sub_self] | |
| theorem defect_mem_kernel (a : A) : s.defect a β RingHom.ker Ο := | |
| s.residue_defect a | |
| /-- If the residue kernel is generated by p, every lift error is p-divisible. -/ | |
| theorem defect_dvd (p : A) (hker : RingHom.ker Ο = Ideal.span ({p} : Set A)) | |
| (a : A) : p β£ s.defect a := by | |
| rw [β Ideal.mem_span_singleton, β hker] | |
| exact s.defect_mem_kernel a | |
| /-- The same interface using the elementwise kernel description. -/ | |
| theorem defect_exists_mul (p : A) | |
| (hker : β z : A, Ο z = 0 β β q : A, z = p * q) (a : A) : | |
| β q : A, s.defect a = p * q := | |
| hker _ (s.residue_defect a) | |
| /-- The failure of a section to preserve addition is a residue-kernel element. -/ | |
| theorem carry_mem_kernel (x y : E) : | |
| s.lift (x + y) - s.lift x - s.lift y β RingHom.ker Ο := by | |
| change Ο (s.lift (x + y) - s.lift x - s.lift y) = 0 | |
| simp only [map_sub, s.residue_lift, add_sub_cancel_left, sub_self] | |
| theorem carry_dvd (p : A) (hker : RingHom.ker Ο = Ideal.span ({p} : Set A)) | |
| (x y : E) : p β£ s.lift (x + y) - s.lift x - s.lift y := by | |
| rw [β Ideal.mem_span_singleton, β hker] | |
| exact s.carry_mem_kernel x y | |
| end ResidueSection | |
| variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] [Module R E] | |
| /-- A lifted evaluation may be nonlinear because of representative carries. | |
| Its only requirement is that reduction gives the specified linear row. -/ | |
| structure LiftedRow (Ο : A β+* E) (L : M ββ[R] E) where | |
| value : M β A | |
| residue_value : β x, Ο (value x) = L x | |
| namespace LiftedRow | |
| variable {Ο : A β+* E} {L : M ββ[R] E} | |
| (row : LiftedRow Ο L) (s : ResidueSection Ο) | |
| /-- The beta value in Section 4.3, defined using the lifted evaluation. -/ | |
| def beta (x : M) : A := s.lift (Ο (row.value x)) | |
| theorem beta_eq_lift_row (x : M) : row.beta s x = s.lift (L x) := by | |
| rw [beta, row.residue_value] | |
| @[simp] | |
| theorem residue_beta (x : M) : Ο (row.beta s x) = L x := by | |
| rw [beta, s.residue_lift, row.residue_value] | |
| /-- Beta is exactly equal, not just congruent, at two inputs in one coset. -/ | |
| theorem beta_invariant (K : Submodule R M) (hK : K β€ LinearMap.ker L) | |
| {x y : M} (hxy : y - x β K) : | |
| row.beta s y = row.beta s x := by | |
| rw [row.beta_eq_lift_row, row.beta_eq_lift_row] | |
| exact compose_eq_of_sub_mem L K hK s.lift hxy | |
| theorem beta_add_invariant (K : Submodule R M) (hK : K β€ LinearMap.ker L) | |
| (x : M) {r : M} (hr : r β K) : | |
| row.beta s (x + r) = row.beta s x := by | |
| rw [row.beta_eq_lift_row, row.beta_eq_lift_row, | |
| linear_map_add_eq_of_mem L K hK x hr] | |
| theorem beta_factors_through_quotient (K : Submodule R M) | |
| (hK : K β€ LinearMap.ker L) (x : M) : | |
| row.beta s x = onQuotient L K hK s.lift (Submodule.Quotient.mk x) := by | |
| exact row.beta_eq_lift_row s x | |
| /-- The lifted row can change inside a coset, but only by a kernel element. -/ | |
| theorem value_sub_mem_kernel (K : Submodule R M) (hK : K β€ LinearMap.ker L) | |
| {x y : M} (hxy : y - x β K) : | |
| row.value y - row.value x β RingHom.ker Ο := by | |
| change Ο (row.value y - row.value x) = 0 | |
| rw [map_sub, row.residue_value, row.residue_value, | |
| linear_map_eq_of_sub_mem L K hK hxy, sub_self] | |
| theorem value_sub_dvd (K : Submodule R M) (hK : K β€ LinearMap.ker L) | |
| (p : A) (hker : RingHom.ker Ο = Ideal.span ({p} : Set A)) | |
| {x y : M} (hxy : y - x β K) : | |
| p β£ row.value y - row.value x := by | |
| rw [β Ideal.mem_span_singleton, β hker] | |
| exact row.value_sub_mem_kernel K hK hxy | |
| theorem value_sub_beta_mem_kernel (x : M) : | |
| row.value x - row.beta s x β RingHom.ker Ο := | |
| s.defect_mem_kernel (row.value x) | |
| /-- This is the p-divisible coefficient of U after input substitution. -/ | |
| theorem value_sub_beta_dvd (p : A) | |
| (hker : RingHom.ker Ο = Ideal.span ({p} : Set A)) (x : M) : | |
| p β£ row.value x - row.beta s x := | |
| s.defect_dvd p hker (row.value x) | |
| end LiftedRow | |
| end Residue | |
| section FiniteRows | |
| variable {R A E ΞΉ : Type*} [CommRing R] [CommRing A] [CommRing E] | |
| [Algebra R E] [Fintype ΞΉ] | |
| /-- A finite coefficient row over an extension ring, linear over the base ring. -/ | |
| def finiteRow (c : ΞΉ β E) : (ΞΉ β R) ββ[R] E where | |
| toFun x := β i, c i * algebraMap R E (x i) | |
| map_add' x y := by | |
| simp only [Pi.add_apply, map_add, mul_add, Finset.sum_add_distrib] | |
| map_smul' r x := by | |
| simp only [Pi.smul_apply, smul_eq_mul, map_mul, Algebra.smul_def, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| exact mul_left_comm _ _ _ | |
| @[simp] | |
| theorem finiteRow_apply (c : ΞΉ β E) (x : ΞΉ β R) : | |
| finiteRow c x = β i, c i * algebraMap R E (x i) := rfl | |
| /-- Actual coordinate lifts give the lifted-row interface. No law about sums of | |
| representatives is assumed: all representative carries are permitted. -/ | |
| def liftedFiniteRow (Ο : A β+* E) (coordinateLift : R β A) | |
| (hLift : β r, Ο (coordinateLift r) = algebraMap R E r) (c : ΞΉ β A) : | |
| LiftedRow (R := R) Ο (finiteRow (R := R) (fun i => Ο (c i))) where | |
| value x := β i, c i * coordinateLift (x i) | |
| residue_value x := by | |
| simp only [map_sum, map_mul, hLift, finiteRow_apply] | |
| @[simp] | |
| theorem liftedFiniteRow_value (Ο : A β+* E) (coordinateLift : R β A) | |
| (hLift : β r, Ο (coordinateLift r) = algebraMap R E r) | |
| (c : ΞΉ β A) (x : ΞΉ β R) : | |
| (liftedFiniteRow Ο coordinateLift hLift c).value x = | |
| β i, c i * coordinateLift (x i) := rfl | |
| end FiniteRows | |
| end SubexponentialSAT.CosetInvariance | |
| end OAI.Algorithms | |