Download data/lean/OAI/Algorithms/SubexponentialSAT/Annihilation.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 12.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/Annihilation.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/Annihilation.lean
-
curl -L -o Annihilation.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/Annihilation.lean
12.3 kB
| import OAI.Algorithms.SubexponentialSAT.LeanCompat | |
| import OAI.Algorithms.SubexponentialSAT.Types | |
| import OAI.Algorithms.SubexponentialSAT.RowInterpolation | |
| import OAI.Algorithms.SubexponentialSAT.MatrixSupport | |
| import OAI.Algorithms.SubexponentialSAT.SubspaceDimension | |
| namespace OAI.Algorithms | |
| /-! | |
| # Annihilation of the incidence-specific row paths | |
| Section 5.3 is a finite linear-algebra statement once the row evaluations and | |
| matrix support property are known. This file proves that statement for actual | |
| matrices and vectors, and specializes it to the universal type block. It does | |
| not assume the annihilation conclusion as a hypothesis. | |
| -/ | |
| namespace SubexponentialSAT.Annihilation | |
| open scoped BigOperators | |
| open Matrix | |
| variable {V K : Type*} [Fintype V] [DecidableEq V] [Ring K] | |
| /-- Extend a row indexed by a subset by zero on its complement. -/ | |
| noncomputable def extendRow (J : Set V) (m : J β K) : V β K := by | |
| classical | |
| exact fun y => if hy : y β J then m β¨y, hyβ© else 0 | |
| omit [Fintype V] [DecidableEq V] in | |
| @[simp] theorem extendRow_mem (J : Set V) (m : J β K) (y : J) : | |
| extendRow J m y = m y := by | |
| classical | |
| simp [extendRow, y.property] | |
| omit [Fintype V] [DecidableEq V] in | |
| @[simp] theorem extendRow_not_mem (J : Set V) (m : J β K) | |
| (y : V) (hy : y β J) : extendRow J m y = 0 := by | |
| classical | |
| simp [extendRow, hy] | |
| omit [DecidableEq V] in | |
| /-- Zero extension preserves the sum pairing with a restricted vector. -/ | |
| theorem extendRow_dotProduct (J : Set V) [Fintype J] (m : J β K) (r : V β K) : | |
| extendRow J m β¬α΅₯ r = m β¬α΅₯ (fun y : J => r y) := by | |
| classical | |
| change (β y : V, extendRow J m y * r y) = β y : J, m y * r y | |
| calc | |
| (β y : V, extendRow J m y * r y) = | |
| β y β J.toFinset, extendRow J m y * r y := by | |
| symm | |
| apply Finset.sum_subset (Finset.subset_univ _) | |
| intro y _ hy | |
| have hyJ : y β J := by simpa using hy | |
| simp [extendRow, hyJ] | |
| _ = β y : J, extendRow J m y * r y := | |
| Finset.sum_subtype J.toFinset (fun _ => Set.mem_toFinset) _ | |
| _ = β y : J, m y * r y := by | |
| apply Finset.sum_congr rfl | |
| intro y _ | |
| simp | |
| omit [Fintype V] [DecidableEq V] in | |
| /-- A row supported on `Y` stays supported on `Y` after zero extension. -/ | |
| theorem extendRow_eq_zero_outside (J : Set V) (Y : Finset V) (m : J β K) | |
| (hm : β y : J, (y : V) β Y β m y = 0) | |
| (y : V) (hy : y β Y) : extendRow J m y = 0 := by | |
| classical | |
| by_cases hj : y β J | |
| Β· simp [extendRow, hj, hm β¨y, hjβ© hy] | |
| Β· simp [extendRow, hj] | |
| /-- If the selected coordinate is off the active side, all terms vanish. | |
| Only correction values on the active side and inside `Y` need to be specified. -/ | |
| theorem annihilates_of_head_outside (S : Set V) (Y : Finset V) | |
| (u : V) (c r : V β K) | |
| (hu : u β S) | |
| (hr : β y, y β S β r y = 0) | |
| (hc : β y, y β Y β c y = 0) | |
| (hcS : β y, y β S β y β Y β c y = 0) : | |
| (Pi.single u 1 + c) β¬α΅₯ r = 0 := by | |
| rw [add_dotProduct, single_dotProduct, one_mul, hr u hu, zero_add] | |
| apply Finset.sum_eq_zero | |
| intro y _ | |
| by_cases hyS : y β S | |
| Β· by_cases hyY : y β Y | |
| Β· rw [hcS y hyS hyY, zero_mul] | |
| Β· rw [hc y hyY, zero_mul] | |
| Β· rw [hr y hyS, mul_zero] | |
| /-- On the active side, the correction agrees with a negative matrix row. | |
| The support hypothesis supplies all omitted correction coordinates. -/ | |
| theorem annihilates_of_head_inside (S J : Set V) (Y : Finset V) | |
| [Fintype J] (M : Matrix J J K) (u : J) (c r : V β K) | |
| (hr : β y, y β S β r y = 0) | |
| (hc : β y, y β Y β c y = 0) | |
| (hm : β y : J, (y : V) β Y β M u y = 0) | |
| (hcS : β y, y β S β y β Y β c y = -extendRow J (M u) y) | |
| (hfix : M *α΅₯ (fun y : J => r y) = fun y : J => r y) : | |
| (Pi.single (u : V) 1 + c) β¬α΅₯ r = 0 := by | |
| classical | |
| have hpair : c β¬α΅₯ r = (-extendRow J (M u)) β¬α΅₯ r := by | |
| apply Finset.sum_congr rfl | |
| intro y _ | |
| by_cases hyS : y β S | |
| Β· by_cases hyY : y β Y | |
| Β· rw [hcS y hyS hyY] | |
| rfl | |
| Β· simp only [hc y hyY, Pi.neg_apply, | |
| extendRow_eq_zero_outside J Y (M u) hm y hyY, neg_zero, zero_mul] | |
| Β· rw [hr y hyS] | |
| simp | |
| rw [add_dotProduct, single_dotProduct, one_mul, hpair, neg_dotProduct, | |
| extendRow_dotProduct] | |
| have huFix := congrFun hfix u | |
| change r u + -(M *α΅₯ (fun y : J => r y)) u = 0 | |
| rw [huFix, add_neg_cancel] | |
| section TypeBlock | |
| open _root_.OAI.Algorithms.SubexponentialSAT.Types | |
| variable {Q Ξ : β} | |
| /-- The two head cases of Section 5.3 for the actual universal type indices. | |
| The matrix support implication and interpolated correction values remain | |
| explicit hypotheses; the conclusion is the required row annihilation. -/ | |
| theorem typeBlock_annihilation | |
| (t : Fin Q) (i : Fin Ξ) (u : UniversalType Q Ξ) | |
| (Y : Finset (UniversalType Q Ξ)) | |
| (M : Matrix (Joint t (u.slot i t) i) (Joint t (u.slot i t) i) K) | |
| (c r : UniversalType Q Ξ β K) | |
| (hr : β y, y.head t β u.slot i t β r y = 0) | |
| (hc : β y, y β Y β c y = 0) | |
| (hm : β (hu : u.head t = u.slot i t) (y : Joint t (u.slot i t) i), | |
| M β¨u, hu, rflβ© y β 0 β (y : UniversalType Q Ξ) β Y) | |
| (hcEval : β y, y β Y β y.head t = u.slot i t β | |
| c y = if hu : u.head t = u.slot i t then | |
| -extendRow (joint t (u.slot i t) i) (M β¨u, hu, rflβ©) y else 0) | |
| (hfix : M *α΅₯ (fun y : Joint t (u.slot i t) i => r y) = | |
| fun y : Joint t (u.slot i t) i => r y) : | |
| (Pi.single u 1 + c) β¬α΅₯ r = 0 := by | |
| classical | |
| by_cases hu : u.head t = u.slot i t | |
| Β· apply annihilates_of_head_inside | |
| (side t (u.slot i t)) (joint t (u.slot i t) i) Y M β¨u, hu, rflβ© c r | |
| hr hc ?_ ?_ hfix | |
| Β· intro y hy | |
| by_contra hne | |
| exact hy (hm hu y hne) | |
| Β· intro y hyS hyY | |
| simpa only [dite_eq_left hu] using hcEval y hyY hyS | |
| Β· apply annihilates_of_head_outside (side t (u.slot i t)) Y u c r | |
| hu hr hc | |
| intro y hyS hyY | |
| simpa only [dite_eq_right hu] using hcEval y hyY hyS | |
| end TypeBlock | |
| section ScalarExtension | |
| variable {L J : Type*} [Ring L] [Fintype J] | |
| /-- A fixed-vector equation survives a coefficient ring homomorphism. No | |
| injectivity or extra equations on the original vector are needed. -/ | |
| theorem map_fixedVector (Ο : K β+* L) (M : Matrix J J K) (r : J β K) | |
| (hfix : M *α΅₯ r = r) : M.map Ο *α΅₯ (Ο β r) = Ο β r := by | |
| funext j | |
| calc | |
| (M.map Ο *α΅₯ (Ο β r)) j = Ο ((M *α΅₯ r) j) := | |
| (Ο.map_mulVec M r j).symm | |
| _ = Ο (r j) := congrArg Ο (congrFun hfix j) | |
| end ScalarExtension | |
| section UniversalPolynomial | |
| open _root_.OAI.Algorithms.SubexponentialSAT.Types | |
| variable {F E : Type*} [Field F] [Field E] {Q Ξ : β} | |
| /-- The prescribed values of the correction polynomials from Section 5.3. | |
| The matrix is the actual projector construction, over the base field `F`. | |
| The homomorphism permits the interpolation polynomial to live over `E`. -/ | |
| noncomputable def universalPrescription (Ο : F β+* E) | |
| (u : UniversalType Q Ξ) (i : Fin Ξ) (R : β) (coeff : β β F) | |
| (y : UniversalType Q Ξ) (t : Fin Q) : E := by | |
| classical | |
| exact if hu : u.head t = u.slot i t then | |
| -extendRow (joint t (u.slot i t) i) | |
| (fun z => Ο (MatrixSupport.jointMatrix i t (u.slot i t) R coeff | |
| β¨u, hu, rflβ© z)) y | |
| else 0 | |
| /-- The actual incidence row polynomial on the universal type block. -/ | |
| noncomputable def universalRow (Ο : F β+* E) | |
| (u : UniversalType Q Ξ) (i : Fin Ξ) (R : β) (coeff : β β F) | |
| (nodes : Fin Q β E) (hinj : Function.Injective nodes) | |
| (hne : β t, nodes t β 0) : UniversalType Q Ξ β Polynomial E := | |
| RowInterpolation.universalRowPath u i R nodes hinj hne | |
| (universalPrescription Ο u i R coeff) | |
| /-- The row starts at the coordinate-selection row, including its diagonal. -/ | |
| theorem universalRow_origin (Ο : F β+* E) | |
| (u : UniversalType Q Ξ) (i : Fin Ξ) (R : β) (coeff : β β F) | |
| (nodes : Fin Q β E) (hinj : Function.Injective nodes) | |
| (hne : β t, nodes t β 0) : | |
| (fun y => (universalRow Ο u i R coeff nodes hinj hne y).eval 0) = | |
| Pi.single u (1 : E) := | |
| RowInterpolation.universalRowPath_eval_zero u i R nodes hinj hne _ | |
| /-- At most R interpolation constraints are imposed on each correction. -/ | |
| theorem universalRow_degree (Ο : F β+* E) | |
| (u : UniversalType Q Ξ) (i : Fin Ξ) (R : β) (coeff : β β F) | |
| (nodes : Fin Q β E) (hinj : Function.Injective nodes) | |
| (hne : β t, nodes t β 0) (y : UniversalType Q Ξ) : | |
| (universalRow Ο u i R coeff nodes hinj hne y).natDegree β€ R := | |
| RowInterpolation.universalRowPath_natDegree_le u i R nodes hinj hne _ y | |
| /-- Concrete row annihilation from support and the selected slot's fixed-vector | |
| equation. The matrix support theorem discharges the Y-sparsity obligation. -/ | |
| theorem universalRow_annihilates_of_fixed (Ο : F β+* E) | |
| (u : UniversalType Q Ξ) (i : Fin Ξ) (R : β) (coeff : β β F) | |
| (nodes : Fin Q β E) (hinj : Function.Injective nodes) | |
| (hne : β t, nodes t β 0) (t : Fin Q) (r : UniversalType Q Ξ β F) | |
| (hr : β y, y.head t β u.slot i t β r y = 0) | |
| (hfix : MatrixSupport.jointMatrix i t (u.slot i t) R coeff *α΅₯ | |
| (fun y : Joint t (u.slot i t) i => r y) = | |
| fun y : Joint t (u.slot i t) i => r y) : | |
| (fun y => (universalRow Ο u i R coeff nodes hinj hne y).eval (nodes t)) | |
| β¬α΅₯ (fun y => Ο (r y)) = 0 := by | |
| classical | |
| unfold universalRow RowInterpolation.universalRowPath | |
| rw [RowInterpolation.eval_rowPath] | |
| apply typeBlock_annihilation t i u | |
| (RowInterpolation.correctionColumns (u.slot i) R) | |
| ((MatrixSupport.jointMatrix i t (u.slot i t) R coeff).map Ο) | |
| Β· intro y hy | |
| simp only [hr y hy, map_zero] | |
| Β· intro y hy | |
| rw [RowInterpolation.universalCorrection_of_not_mem _ _ _ _ _ _ _ hy] | |
| simp | |
| Β· intro hu y hneM | |
| apply (RowInterpolation.mem_correctionColumns (u.slot i) R y.val).mpr | |
| have hbase : MatrixSupport.jointMatrix i t (u.slot i t) R coeff | |
| β¨u, hu, rflβ© y β 0 := by | |
| intro hz | |
| apply hneM | |
| simp only [Matrix.map_apply, hz, map_zero] | |
| exact MatrixSupport.jointMatrix_support i t (u.slot i t) R coeff | |
| β¨u, hu, rflβ© y hbase | |
| Β· intro y hy hyt | |
| rw [RowInterpolation.universalCorrection_eval_node _ _ _ _ _ _ y | |
| ((RowInterpolation.mem_correctionColumns (u.slot i) R y).mp hy) t hyt] | |
| rfl | |
| Β· exact map_fixedVector Ο _ _ hfix | |
| /-- The full base-field subspace, imposing every slot's fixed-vector equation. -/ | |
| noncomputable def universalSpace (R : β) (coeff : β β F) | |
| (t : Fin Q) (g : Bool) : Submodule F (UniversalType Q Ξ β F) := | |
| SubspaceDimension.universalFixedSpace t g | |
| (fun i => (MatrixSupport.jointMatrix i t g R coeff).mulVecLin) | |
| /-- Membership exposes the concrete support and matrix equations. -/ | |
| theorem mem_universalSpace (R : β) (coeff : β β F) | |
| (t : Fin Q) (g : Bool) (r : UniversalType Q Ξ β F) : | |
| r β universalSpace R coeff t g β | |
| (β y, y.head t β g β r y = 0) β§ | |
| β i : Fin Ξ, MatrixSupport.jointMatrix i t g R coeff *α΅₯ | |
| (fun y : Joint t g i => r y.val) = fun y : Joint t g i => r y.val := by | |
| rw [universalSpace, SubspaceDimension.universalFixedSpace_mem_iff] | |
| constructor | |
| Β· rintro β¨hs, hfβ© | |
| exact β¨fun y hy => hs y hy, fun i => (hf i).symmβ© | |
| Β· rintro β¨hs, hfβ© | |
| exact β¨fun y hy => hs y hy, fun i => (hf i).symmβ© | |
| /-- Section 5.3, instantiated to the actual matrix, actual interpolated row, | |
| and actual base-field fixed subspace. No annihilation or support hypothesis | |
| remains: only membership in that independently defined subspace is required. -/ | |
| theorem universalRow_annihilates (Ο : F β+* E) | |
| (u : UniversalType Q Ξ) (i : Fin Ξ) (R : β) (coeff : β β F) | |
| (nodes : Fin Q β E) (hinj : Function.Injective nodes) | |
| (hne : β t, nodes t β 0) (t : Fin Q) (r : UniversalType Q Ξ β F) | |
| (hr : r β universalSpace R coeff t (u.slot i t)) : | |
| (fun y => (universalRow Ο u i R coeff nodes hinj hne y).eval (nodes t)) | |
| β¬α΅₯ (fun y => Ο (r y)) = 0 := by | |
| have h := (mem_universalSpace R coeff t (u.slot i t) r).mp hr | |
| exact universalRow_annihilates_of_fixed Ο u i R coeff nodes hinj hne t r h.1 (h.2 i) | |
| end UniversalPolynomial | |
| end SubexponentialSAT.Annihilation | |
| end OAI.Algorithms | |