Spaces:
Running
Running
| import LipschitzTransformerFormal.RestrictedStoneWeierstrass | |
| open scoped Topology | |
| namespace LipschitzTransformerFormal | |
| open Set | |
| /-- | |
| The separate query/context Lipschitz assumptions in Theorem 8 imply the | |
| single product-budget inequality needed by Lemma 9. | |
| -/ | |
| theorem separatelyLipschitz_productBudget | |
| {U V : Type*} [MetricSpace U] [MetricSpace V] | |
| {C : β} (C_nonneg : 0 β€ C) | |
| (target : C(U Γ V, β)) | |
| (query_lipschitz : | |
| β u x y, |target (u, x) - target (u, y)| β€ dist x y) | |
| (context_lipschitz : | |
| β u v x, |target (u, x) - target (v, x)| β€ C * dist u v) | |
| (p q : U Γ V) : | |
| |target p - target q| β€ productBudget C p q := by | |
| calc | |
| |target p - target q| = | |
| |(target p - target (p.1, q.2)) + | |
| (target (p.1, q.2) - target q)| := by | |
| congr 1 | |
| ring | |
| _ β€ |target p - target (p.1, q.2)| + | |
| |target (p.1, q.2) - target q| := abs_add_le _ _ | |
| _ β€ dist p.2 q.2 + C * dist p.1 q.1 := | |
| add_le_add | |
| (query_lipschitz p.1 p.2 q.2) | |
| (context_lipschitz p.1 q.1 q.2) | |
| _ = productBudget C p q := rfl | |
| /-- | |
| The sign-safe interpolation coefficient used in Lemma 12. The paper writes | |
| the coefficient as belonging to `[0,1]`; when `a < b` the correct invariant is | |
| its absolute value being below one. | |
| -/ | |
| theorem interpolationCoefficient_abs_lt_one | |
| {a b fp fq : β} (gap : |a - b| < fp - fq) : | |
| |(a - b) / (fp - fq)| < 1 := by | |
| have denominator_pos : 0 < fp - fq := | |
| lt_of_le_of_lt (abs_nonneg (a - b)) gap | |
| rw [abs_div, abs_of_pos denominator_pos] | |
| exact (div_lt_one denominator_pos).2 gap | |
| /-- | |
| Affine rescaling realizes either ordering of two requested values. This | |
| closes the negative-coefficient edge case in the printed proof of Lemma 12. | |
| -/ | |
| theorem affineRescale_interpolates | |
| {a b fp fq : β} (denominator_ne : fp - fq β 0) : | |
| let Ξ± := (a - b) / (fp - fq) | |
| let Ξ² := b - Ξ± * fq | |
| Ξ² + Ξ± * fp = a β§ Ξ² + Ξ± * fq = b := by | |
| dsimp | |
| constructor | |
| Β· field_simp | |
| ring | |
| Β· ring | |
| /-- | |
| The exact universal-quantifier deduction in Theorem 8 after the paper's | |
| architecture lemmas have established nonemptiness, lattice closure, and | |
| strict two-point interpolation for `G_C`. | |
| This theorem ranges over arbitrary compact metric context/query spaces and | |
| arbitrary separately Lipschitz targets. It contains no finite sample, chosen | |
| basis, or target fit. | |
| -/ | |
| theorem transformerUniversalApproximation | |
| {U V : Type*} [MetricSpace U] [MetricSpace V] | |
| [CompactSpace U] [CompactSpace V] [Nontrivial (U Γ V)] | |
| {C : β} (C_pos : 0 < C) | |
| (G : Set C(U Γ V, β)) (nG : G.Nonempty) | |
| (inf_mem : β f β G, β g β G, f β g β G) | |
| (sup_mem : β f β G, β g β G, f β g β G) | |
| (strict_interpolate : | |
| β p q : U Γ V, p β q β β a b : β, | |
| |a - b| < productBudget C p q β | |
| β g β G, g p = a β§ g q = b) | |
| (target : C(U Γ V, β)) | |
| (query_lipschitz : | |
| β u x y, |target (u, x) - target (u, y)| β€ dist x y) | |
| (context_lipschitz : | |
| β u v x, |target (u, x) - target (v, x)| β€ C * dist u v) | |
| {Ξ΅ : β} (Ξ΅_pos : 0 < Ξ΅) : | |
| β g β G, dist g target < Ξ΅ := | |
| restrictedStoneWeierstrassProduct C_pos G nG inf_mem sup_mem | |
| strict_interpolate target | |
| (separatelyLipschitz_productBudget C_pos.le target | |
| query_lipschitz context_lipschitz) | |
| Ξ΅_pos | |
| /-- | |
| Murari et al., Theorem 3.1, reduced to its two exact architecture obligations: | |
| the scalar gradient-descent ResNet family is a lattice and strictly | |
| interpolates admissible two-point data. The compact-domain density conclusion | |
| is then kernel checked rather than imported as a citation. | |
| -/ | |
| theorem scalarResNetDensity | |
| {X : Type*} [MetricSpace X] [CompactSpace X] [Nontrivial X] | |
| (R : Set C(X, β)) (nR : R.Nonempty) | |
| (inf_mem : β f β R, β g β R, f β g β R) | |
| (sup_mem : β f β R, β g β R, f β g β R) | |
| (strict_interpolate : | |
| β x y : X, x β y β β a b : β, |a - b| < dist x y β | |
| β g β R, g x = a β§ g y = b) | |
| (target : C(X, β)) | |
| (target_lipschitz : β x y, |target x - target y| β€ dist x y) | |
| {Ξ΅ : β} (Ξ΅_pos : 0 < Ξ΅) : | |
| β g β R, dist g target < Ξ΅ := | |
| restrictedStoneWeierstrass dist | |
| (fun _ _ h => dist_pos.mpr h) R nR inf_mem sup_mem strict_interpolate | |
| target target_lipschitz Ξ΅_pos | |
| #print axioms separatelyLipschitz_productBudget | |
| #print axioms interpolationCoefficient_abs_lt_one | |
| #print axioms affineRescale_interpolates | |
| #print axioms transformerUniversalApproximation | |
| #print axioms scalarResNetDensity | |
| end LipschitzTransformerFormal | |