Spaces:
Running
Running
File size: 4,620 Bytes
81674f5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 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
|