Chapter 06 — Several Variable Differential Calculus
Proofs omitted. Hover over highlighted terms to see their Lean types.
Reading sections
6.1 — Linear Transformations
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Definition 6.1 (Row vectors): for a natural number n, an n-dimensional row vector over ℝ is represented as a 1 × n matrix; vector addition, scalar multiplication, the zero vector, and additive inverses are the inherited pointwise operations.
abbrev RowVector (n : ℕ) : Type := Matrix (Fin 1) (Fin n) ℝ
Lemma 6.1: ℝ^n is a vector space over ℝ; for all x y z : Fin n → ℝ and c d : ℝ, vector addition is commutative and associative, 0 is an additive identity, -x is an additive inverse, scalar multiplication is associative, distributes over vector and scalar addition, and 1 acts as the identity scalar.
lemma rowVector_real_vector_space_identities (n : ℕ) :
∀ x y z : Fin n → ℝ, ∀ c d : ℝ,
x + y = y + x ∧
(x + y) + z = x + (y + z) ∧
x + 0 = x ∧
0 + x = x ∧
x + (-x) = 0 ∧
(-x) + x = 0 ∧
(c * d) • x = c • (d • x) ∧
c • (x + y) = c • x + c • y ∧
(c + d) • x = c • x + d • x ∧
(1 : ℝ) • x = x
An n-dimensional column vector over ℝ, represented as an n × 1 matrix.
abbrev ColumnVector (n : ℕ) : Type := Matrix (Fin n) (Fin 1) ℝ
Definition 6.2 (Transpose): for n : ℕ and a row vector x = (x₁, …, xₙ) : RowVector n, its transpose xᵀ is the n × 1 column vector with the same coordinates. Equivalently, an n-dimensional column vector is a vector of the form xᵀ for some row vector x.
def rowVectorTranspose {n : ℕ} (x : RowVector n) : ColumnVector n := Matrix.transpose x
Every n-dimensional column vector is the transpose of a row vector.
lemma columnVector_exists_as_transpose (n : ℕ) (y : ColumnVector n) :
∃ x : RowVector n, rowVectorTranspose x = y
Definition 6.3 (Standard basis vectors of ℝ^n): for j : Fin n, the standard basis row vector e_j has entries (e_j)_i = 1 if i = j and (e_j)_i = 0 otherwise.
def standardBasisRowVector (n : ℕ) (j : Fin n) : RowVector n :=
fun _ i => if i = j then 1 else 0
Every row vector in ℝ^n is the sum of its coordinates times the standard basis row vectors.
theorem rowVector_eq_sum_standardBasisRowVector (n : ℕ) (x : RowVector n) :
x = ∑ j : Fin n, (x 0 j) • standardBasisRowVector n j
The transpose of a row vector is the corresponding linear combination of the transposed standard basis vectors.
theorem rowVectorTranspose_eq_sum_standardBasisTranspose (n : ℕ) (x : RowVector n) :
rowVectorTranspose x =
∑ j : Fin n, (x 0 j) • rowVectorTranspose (standardBasisRowVector n j)
Definition 6.4 (Linear transformation): a function T : ℝ^n → ℝ^m is linear iff for all x y : ℝ^n and c : ℝ, (i) T (x + y) = T x + T y and (ii) T (c • x) = c • T x.
def IsLinearTransformation {n m : ℕ} (T : (Fin n → ℝ) → (Fin m → ℝ)) : Prop :=
(∀ x y : Fin n → ℝ, T (x + y) = T x + T y) ∧
∀ (c : ℝ) (x : Fin n → ℝ), T (c • x) = c • T x
Definition 6.5 (Matrices): for positive natural numbers m, n, an m × n matrix over a set S is a family A = (a i j) of elements of S indexed by i : Fin m and j : Fin n. A 1 × n matrix is an n-dimensional row vector, and an n × 1 matrix is an n-dimensional column vector.
abbrev MatrixOver (S : Type*) (m n : ℕ+) := Matrix (Fin m) (Fin n) S
Definition 6.6 (Matrix product): for m n p : ℕ, if A is an m × n matrix and B is an n × p matrix (over ℝ), then matrixProduct A B is the m × p matrix with entries (matrixProduct A B) i k = ∑ j : Fin n, A i j * B j k. In particular, when p = 1, this gives matrix-column-vector multiplication (A xᵀ) i = ∑ j : Fin n, A i j * xᵀ j 0.
abbrev matrixProduct {m n p : ℕ}
(A : Matrix (Fin m) (Fin n) ℝ) (B : Matrix (Fin n) (Fin p) ℝ) :
Matrix (Fin m) (Fin p) ℝ :=
A * B
Lemma 6.2: if T : ℝ^n → ℝ^m is a linear transformation, then there exists a unique matrix A : ℝ^{m × n} such that T x = A x for every x : ℝ^n.
theorem linearTransformation_existsUnique_matrixRepresentation {n m : ℕ}
(T : (Fin n → ℝ) → (Fin m → ℝ)) (hT : IsLinearTransformation T) :
∃! A : Matrix (Fin m) (Fin n) ℝ, ∀ x : Fin n → ℝ, T x = Matrix.mulVec A x
Lemma 6.3: for matrices A and B over the same field, if L_M denotes left-multiplication by M on compatible column vectors, then L_A ∘ L_B = L_{AB} as linear maps 𝔽^p → 𝔽^m.
theorem leftMultiplication_comp_eq_leftMultiplication_mul {𝔽 : Type*} [Field 𝔽]
{m n p : ℕ} (A : Matrix (Fin m) (Fin n) 𝔽) (B : Matrix (Fin n) (Fin p) 𝔽) :
(Matrix.mulVecLin A).comp (Matrix.mulVecLin B) = Matrix.mulVecLin (A * B)
Proposition 6.1: the map T₁ : ℝ^3 → ℝ^3 defined by T₁ x = 5x is a linear transformation.
theorem t1_isLinearTransformation :
IsLinearTransformation (fun x : Fin 3 → ℝ => (5 : ℝ) • x)
Proposition 6.2: let T₂ : ℝ² → ℝ² be the map that rotates each vector about the origin by angle π/2 counterclockwise, i.e. T₂(x₁, x₂) = (-x₂, x₁). Then T₂ is a linear transformation.
theorem t2_rotatePiOverTwo_isLinearTransformation :
IsLinearTransformation (fun x : Fin 2 → ℝ => ![-x 1, x 0])
Proposition 6.3: define T₃ : ℝ³ → ℝ² by T₃(x, y, z) = (x, y). Then T₃ is a linear transformation, i.e. for all u v : ℝ³ and c : ℝ, T₃ (u + v) = T₃ u + T₃ v and T₃ (c • u) = c • T₃ u.
theorem t3_dropThirdCoordinate_isLinearTransformation :
IsLinearTransformation (fun x : Fin 3 → ℝ => ![x 0, x 1])
Proposition 6.4: define T₄ : ℝ² → ℝ³ by T₄(x, y) = (x, y, 0). Then T₄ is a linear transformation, i.e. for all u v : ℝ² and c : ℝ, T₄ (u + v) = T₄ u + T₄ v and T₄ (c • u) = c • T₄ u.
theorem t4_embedInThreeSpace_isLinearTransformation :
IsLinearTransformation (fun x : Fin 2 → ℝ => ![x 0, x 1, 0])
Proposition 6.5: for each n : ℕ, the map I_n : ℝ^n → ℝ^n defined by I_n x = x for all x is a linear transformation.
theorem identityMap_isLinearTransformation (n : ℕ) :
IsLinearTransformation (fun x : Fin n → ℝ => x)
Proposition 6.6: if T : ℝ^n → ℝ^m and S : ℝ^p → ℝ^n are linear transformations, then their composition TS, defined by (TS) x = T (S x) for all x : ℝ^p, is also a linear transformation.
theorem composition_isLinearTransformation {p n m : ℕ}
(T : (Fin n → ℝ) → (Fin m → ℝ)) (S : (Fin p → ℝ) → (Fin n → ℝ))
(hT : IsLinearTransformation T) (hS : IsLinearTransformation S) :
IsLinearTransformation (fun x : Fin p → ℝ => T (S x))
Proposition 6.7: if T : ℝ^n → ℝ^m is a linear transformation, then there exists a constant M > 0 such that ‖T x‖ ≤ M * ‖x‖ for all x : ℝ^n. Consequently, T is continuous on ℝ^n.
theorem linearTransformation_exists_pos_bound_and_continuous {n m : ℕ}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
∃ M > 0,
(∀ x : EuclideanSpace ℝ (Fin n), ‖T x‖ ≤ M * ‖x‖) ∧
Continuous (fun x : EuclideanSpace ℝ (Fin n) => T x)
Helper for Lemma 6.1: additive-group identities for vectors Fin n → ℝ.
lemma helperForLemma_6_1_additiveGroupIdentities (n : ℕ) :
∀ x y z : Fin n → ℝ,
x + y = y + x ∧
(x + y) + z = x + (y + z) ∧
x + 0 = x ∧
0 + x = x ∧
x + (-x) = 0 ∧
(-x) + x = 0
Helper for Lemma 6.1: scalar associativity and scalar unit on Fin n → ℝ.
lemma helperForLemma_6_1_scalarAssociativityUnit (n : ℕ) :
∀ x : Fin n → ℝ, ∀ c d : ℝ,
(c * d) • x = c • (d • x) ∧
(1 : ℝ) • x = x
Helper for Lemma 6.1: scalar distributivity identities on Fin n → ℝ.
lemma helperForLemma_6_1_scalarDistributivity (n : ℕ) :
∀ x y : Fin n → ℝ, ∀ c d : ℝ,
c • (x + y) = c • x + c • y ∧
(c + d) • x = c • x + d • x
Helper for Lemma 6.2: convert IsLinearTransformation to a mathlib LinearMap.
def helperForLemma_6_2_linearMapFromIsLinearTransformation {n m : ℕ}
(T : (Fin n → ℝ) → (Fin m → ℝ)) (hT : IsLinearTransformation T) :
(Fin n → ℝ) →ₗ[ℝ] (Fin m → ℝ) :=
{
toFun := T
map_add' := hT.1
map_smul' := hT.2
}
Helper for Lemma 6.2: the matrix from LinearMap.toMatrix' represents T.
lemma helperForLemma_6_2_matrixCandidateRepresentsT {n m : ℕ}
(T : (Fin n → ℝ) → (Fin m → ℝ)) (hT : IsLinearTransformation T) :
∀ x : Fin n → ℝ,
T x =
Matrix.mulVec
(LinearMap.toMatrix'
(helperForLemma_6_2_linearMapFromIsLinearTransformation T hT)) x
Helper for Lemma 6.2: a representing matrix yields the corresponding Matrix.toLin' equality.
lemma helperForLemma_6_2_toLin_eq_of_representsT {n m : ℕ}
(T : (Fin n → ℝ) → (Fin m → ℝ)) (hT : IsLinearTransformation T)
(B : Matrix (Fin m) (Fin n) ℝ)
(hB : ∀ x : Fin n → ℝ, T x = Matrix.mulVec B x) :
Matrix.toLin' B =
helperForLemma_6_2_linearMapFromIsLinearTransformation T hT
Helper for Lemma 6.2: matrix representation of T is unique.
lemma helperForLemma_6_2_representation_unique {n m : ℕ}
(T : (Fin n → ℝ) → (Fin m → ℝ)) (hT : IsLinearTransformation T)
(B : Matrix (Fin m) (Fin n) ℝ)
(hB : ∀ x : Fin n → ℝ, T x = Matrix.mulVec B x) :
B =
LinearMap.toMatrix'
(helperForLemma_6_2_linearMapFromIsLinearTransformation T hT)
Helper for Proposition 6.1: scaling by a fixed scalar preserves addition on Fin n → ℝ.
lemma helperForProposition_6_1_fixedScalar_add (n : ℕ) (a : ℝ)
(x y : Fin n → ℝ) :
a • (x + y) = a • x + a • y
Helper for Proposition 6.1: scaling by a fixed scalar commutes with an external scalar multiplication on Fin n → ℝ.
lemma helperForProposition_6_1_fixedScalar_smul (n : ℕ) (a c : ℝ)
(x : Fin n → ℝ) :
a • (c • x) = c • (a • x)
Helper for Proposition 6.1: for any dimension n and scalar a, the map x ↦ a • x is linear.
lemma helperForProposition_6_1_fixedScalar_isLinear (n : ℕ) (a : ℝ) :
IsLinearTransformation (fun x : Fin n → ℝ => a • x)
Helper for Proposition 6.2: the rotation map x ↦ (-x₂, x₁) preserves vector addition on ℝ².
lemma helperForProposition_6_2_rotate_add (x y : Fin 2 → ℝ) :
(fun z : Fin 2 → ℝ => ![-z 1, z 0]) (x + y) =
(fun z : Fin 2 → ℝ => ![-z 1, z 0]) x +
(fun z : Fin 2 → ℝ => ![-z 1, z 0]) y
Helper for Proposition 6.2: the rotation map x ↦ (-x₂, x₁) commutes with scalar multiplication on ℝ².
lemma helperForProposition_6_2_rotate_smul (c : ℝ) (x : Fin 2 → ℝ) :
(fun z : Fin 2 → ℝ => ![-z 1, z 0]) (c • x) =
c • (fun z : Fin 2 → ℝ => ![-z 1, z 0]) x
Helper for Proposition 6.3: dropping the third coordinate preserves vector addition on ℝ³.
lemma helperForProposition_6_3_dropThird_add (x y : Fin 3 → ℝ) :
(fun z : Fin 3 → ℝ => ![z 0, z 1]) (x + y) =
(fun z : Fin 3 → ℝ => ![z 0, z 1]) x +
(fun z : Fin 3 → ℝ => ![z 0, z 1]) y
Helper for Proposition 6.3: dropping the third coordinate commutes with scalar multiplication on ℝ³.
lemma helperForProposition_6_3_dropThird_smul (c : ℝ) (x : Fin 3 → ℝ) :
(fun z : Fin 3 → ℝ => ![z 0, z 1]) (c • x) =
c • (fun z : Fin 3 → ℝ => ![z 0, z 1]) x
Helper for Proposition 6.4: the embedding map x ↦ (x₁, x₂, 0) preserves vector addition on ℝ².
lemma helperForProposition_6_4_embed_add (x y : Fin 2 → ℝ) :
(fun z : Fin 2 → ℝ => ![z 0, z 1, 0]) (x + y) =
(fun z : Fin 2 → ℝ => ![z 0, z 1, 0]) x +
(fun z : Fin 2 → ℝ => ![z 0, z 1, 0]) y
Helper for Proposition 6.4: the embedding map x ↦ (x₁, x₂, 0) commutes with scalar multiplication on ℝ².
lemma helperForProposition_6_4_embed_smul (c : ℝ) (x : Fin 2 → ℝ) :
(fun z : Fin 2 → ℝ => ![z 0, z 1, 0]) (c • x) =
c • (fun z : Fin 2 → ℝ => ![z 0, z 1, 0]) x
Helper for Proposition 6.4: the embedding map x ↦ (x₁, x₂, 0) is linear.
lemma helperForProposition_6_4_embed_isLinear :
IsLinearTransformation (fun x : Fin 2 → ℝ => ![x 0, x 1, 0])
Helper for Proposition 6.5: the identity map on Fin n → ℝ preserves addition.
lemma helperForProposition_6_5_identity_add (n : ℕ) (x y : Fin n → ℝ) :
(fun z : Fin n → ℝ => z) (x + y) =
(fun z : Fin n → ℝ => z) x + (fun z : Fin n → ℝ => z) y
Helper for Proposition 6.5: the identity map on Fin n → ℝ commutes with scalar multiplication.
lemma helperForProposition_6_5_identity_smul (n : ℕ) (c : ℝ) (x : Fin n → ℝ) :
(fun z : Fin n → ℝ => z) (c • x) =
c • (fun z : Fin n → ℝ => z) x
Helper for Proposition 6.5: for each n, the identity map on Fin n → ℝ is linear.
lemma helperForProposition_6_5_identity_isLinear (n : ℕ) :
IsLinearTransformation (fun x : Fin n → ℝ => x)
Helper for Proposition 6.7: the operator norm of T bounds ‖T x‖ by ‖LinearMap.toContinuousLinearMap T‖ * ‖x‖.
lemma helperForProposition_6_7_bound_by_opNorm {n m : ℕ}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(x : EuclideanSpace ℝ (Fin n)) :
‖T x‖ ≤ ‖LinearMap.toContinuousLinearMap T‖ * ‖x‖
Helper for Proposition 6.7: replacing the operator norm by ‖LinearMap.toContinuousLinearMap T‖ + 1 preserves the bound.
lemma helperForProposition_6_7_bound_by_opNormPlusOne {n m : ℕ}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(x : EuclideanSpace ℝ (Fin n)) :
‖T x‖ ≤ (‖LinearMap.toContinuousLinearMap T‖ + 1) * ‖x‖
Helper for Proposition 6.7: the constant ‖LinearMap.toContinuousLinearMap T‖ + 1 is strictly positive.
lemma helperForProposition_6_7_positive_constant {n m : ℕ}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
0 < ‖LinearMap.toContinuousLinearMap T‖ + 1
Helper for Proposition 6.7: every linear map between these finite-dimensional Euclidean spaces is continuous.
lemma helperForProposition_6_7_continuous_apply {n m : ℕ}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
Continuous (fun x : EuclideanSpace ℝ (Fin n) => T x)6.2 — Derivatives in Several Variable Calculus
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Definition 6.7 (Derivative in one variable): let E ⊆ ℝ, f : E → ℝ, and x₀ ∈ E. A real number L is the derivative of f at x₀ iff (f x - f x₀) / (x - x₀) tends to L as x → x₀ with x ∈ E \ {x₀}.
def HasDerivativeInOneVariableAt
(E : Set ℝ) (f : E → ℝ) (x₀ : E) (L : ℝ) : Prop :=
Filter.Tendsto
(fun x : E => (f x - f x₀) / ((x : ℝ) - (x₀ : ℝ)))
(nhdsWithin x₀ {x : E | (x : ℝ) ≠ (x₀ : ℝ)})
(nhds L)
Lemma 6.4: let E ⊆ ℝ, f : E → ℝ, x₀ ∈ E a limit point of E, and L ∈ ℝ. Then (f x - f x₀) / (x - x₀) → L as x → x₀ in E \ {x₀} iff |f x - (f x₀ + L (x - x₀))| / |x - x₀| → 0 on the same punctured domain.
lemma hasDerivativeInOneVariableAt_iff_tendsto_normErrorRatio_zero
(E : Set ℝ) (f : E → ℝ) (x₀ : E) (L : ℝ)
(hlimit : (x₀ : ℝ) ∈ closure (E \ {(x₀ : ℝ)})) :
HasDerivativeInOneVariableAt E f x₀ L ↔
Filter.Tendsto
(fun x : E =>
|f x - (f x₀ + L * ((x : ℝ) - (x₀ : ℝ)))| /
|(x : ℝ) - (x₀ : ℝ)|)
(nhdsWithin x₀ {x : E | (x : ℝ) ≠ (x₀ : ℝ)})
(nhds (0 : ℝ))
Definition 6.8 (Differentiability): let E ⊆ ℝ^n, f : E → ℝ^m, and x₀ ∈ E be a limit point of E. For a linear map L : ℝ^n → ℝ^m, f is differentiable at x₀ with derivative L when ‖f x - (f x₀ + L (x - x₀))‖ / ‖x - x₀‖ → 0 as x → x₀ with x ∈ E \ {x₀}, using the Euclidean norm.
def HasDerivativeInSeveralVariablesAt
(n m : ℕ)
(E : Set (EuclideanSpace ℝ (Fin n)))
(f : E → EuclideanSpace ℝ (Fin m))
(x₀ : E)
(L : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) : Prop :=
((x₀ : EuclideanSpace ℝ (Fin n)) ∈ closure (E \ {(x₀ : EuclideanSpace ℝ (Fin n))})) ∧
Filter.Tendsto
(fun x : E =>
‖f x - (f x₀ + L ((x : EuclideanSpace ℝ (Fin n)) - (x₀ : EuclideanSpace ℝ (Fin n))))‖ /
‖(x : EuclideanSpace ℝ (Fin n)) - (x₀ : EuclideanSpace ℝ (Fin n))‖)
(nhdsWithin x₀ {x : E | x ≠ x₀})
(nhds (0 : ℝ))
Proposition 6.8: if f : ℝ² → ℝ² is given by f(x, y) = (x^2, y^2), then f is differentiable at x₀ = (1, 2) with derivative L(x, y) = (2x, 4y).
theorem hasDerivativeInSeveralVariablesAt_coordinateSquare_at_one_two
(x₀ : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))})
(hx₀₀ : (x₀ : EuclideanSpace ℝ (Fin 2)) 0 = (1 : ℝ))
(hx₀₁ : (x₀ : EuclideanSpace ℝ (Fin 2)) 1 = (2 : ℝ))
(f : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))} →
EuclideanSpace ℝ (Fin 2))
(hf₀ : ∀ p : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))},
(f p) 0 = ((p : EuclideanSpace ℝ (Fin 2)) 0) ^ (2 : ℕ))
(hf₁ : ∀ p : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))},
(f p) 1 = ((p : EuclideanSpace ℝ (Fin 2)) 1) ^ (2 : ℕ))
(L : EuclideanSpace ℝ (Fin 2) →ₗ[ℝ] EuclideanSpace ℝ (Fin 2))
(hL₀ : ∀ v : EuclideanSpace ℝ (Fin 2), (L v) 0 = (2 : ℝ) * v 0)
(hL₁ : ∀ v : EuclideanSpace ℝ (Fin 2), (L v) 1 = (4 : ℝ) * v 1) :
HasDerivativeInSeveralVariablesAt
2 2
(Set.univ : Set (EuclideanSpace ℝ (Fin 2)))
f
x₀
L
Lemma 6.5 (Uniqueness of derivatives): if x₀ is an interior point of E ⊆ ℝⁿ and both L₁ and L₂ satisfy the derivative error-ratio limit for f : E → ℝᵐ at x₀, then the linear transformations coincide: L₁ = L₂.
theorem derivativeInSeveralVariables_unique
(n m : ℕ)
(E : Set (EuclideanSpace ℝ (Fin n)))
(f : E → EuclideanSpace ℝ (Fin m))
(x₀ : E)
(hinterior : (x₀ : EuclideanSpace ℝ (Fin n)) ∈ interior E)
(L₁ L₂ : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hL₁ : HasDerivativeInSeveralVariablesAt n m E f x₀ L₁)
(hL₂ : HasDerivativeInSeveralVariablesAt n m E f x₀ L₂) :
L₁ = L₂
Helper for Lemma 6.4: pointwise algebraic identity relating the linearization error ratio and the absolute difference quotient error.
lemma helperForLemma_6_4_pointwise_absErrorRatio_eq_absQuotientSub
(E : Set ℝ) (f : E → ℝ) (x₀ : E) (L : ℝ)
(x : E) (hx : (x : ℝ) ≠ (x₀ : ℝ)) :
Helper for Lemma 6.4: on the punctured nhdsWithin filter, points are eventually different from the basepoint.
lemma helperForLemma_6_4_eventually_ne_basepoint_on_puncturedFilter
(E : Set ℝ) (x₀ : E) :
∀ᶠ x : E in nhdsWithin (X := E) x₀ {x : E | (x : ℝ) ≠ (x₀ : ℝ)},
(x : ℝ) ≠ (x₀ : ℝ)
Helper for Lemma 6.4: eventual equality between the target error ratio and the absolute form |quotient - L| on the punctured filter.
lemma helperForLemma_6_4_eventuallyEq_errorRatio_absSubForm
(E : Set ℝ) (f : E → ℝ) (x₀ : E) (L : ℝ) :
(fun x : E =>
|f x - (f x₀ + L * ((x : ℝ) - (x₀ : ℝ)))| /
|(x : ℝ) - (x₀ : ℝ)|)
=ᶠ[nhdsWithin x₀ {x : E | (x : ℝ) ≠ (x₀ : ℝ)}]
(fun x : E => |((f x - f x₀) / ((x : ℝ) - (x₀ : ℝ))) - L|)
Helper for Proposition 6.8: the basepoint lies in the closure of the punctured universe.
lemma helperForProposition_6_8_memClosure_univ_diff_singleton
(x₀ : EuclideanSpace ℝ (Fin 2)) :
x₀ ∈ closure ((Set.univ : Set (EuclideanSpace ℝ (Fin 2))) \ {x₀})
Helper for Proposition 6.8: the map f agrees with the coordinate-square formula.
lemma helperForProposition_6_8_f_eq_coordinateSquare_onSubtypeUniv
(f : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))} →
EuclideanSpace ℝ (Fin 2))
(hf₀ : ∀ p : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))},
(f p) 0 = ((p : EuclideanSpace ℝ (Fin 2)) 0) ^ (2 : ℕ))
(hf₁ : ∀ p : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))},
(f p) 1 = ((p : EuclideanSpace ℝ (Fin 2)) 1) ^ (2 : ℕ))
(p : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))}) :
f p = (EuclideanSpace.equiv (Fin 2) ℝ).symm
(fun i : Fin 2 => ((p : EuclideanSpace ℝ (Fin 2)) i) ^ (2 : ℕ))
Helper for Proposition 6.8: the coordinate-square ambient map has derivative L at x₀.
lemma helperForProposition_6_8_hasFDerivAt_coordinateSquare_at_x0
(x₀ : EuclideanSpace ℝ (Fin 2))
(hx₀₀ : x₀ 0 = (1 : ℝ))
(hx₀₁ : x₀ 1 = (2 : ℝ))
(L : EuclideanSpace ℝ (Fin 2) →ₗ[ℝ] EuclideanSpace ℝ (Fin 2))
(hL₀ : ∀ v : EuclideanSpace ℝ (Fin 2), (L v) 0 = (2 : ℝ) * v 0)
(hL₁ : ∀ v : EuclideanSpace ℝ (Fin 2), (L v) 1 = (4 : ℝ) * v 1) :
HasFDerivAt
(fun x : EuclideanSpace ℝ (Fin 2) =>
(EuclideanSpace.equiv (Fin 2) ℝ).symm (fun i : Fin 2 => (x i) ^ (2 : ℕ)))
(LinearMap.toContinuousLinearMap L)
x₀
Helper for Proposition 6.8: the linearization error ratio tends to 0 on punctured neighborhoods in the ambient space.
lemma helperForProposition_6_8_tendsto_errorRatio_on_puncturedAmbient
(x₀ : EuclideanSpace ℝ (Fin 2))
(L : EuclideanSpace ℝ (Fin 2) →ₗ[ℝ] EuclideanSpace ℝ (Fin 2))
(hFDeriv : HasFDerivAt
(fun x : EuclideanSpace ℝ (Fin 2) =>
(EuclideanSpace.equiv (Fin 2) ℝ).symm (fun i : Fin 2 => (x i) ^ (2 : ℕ)))
(LinearMap.toContinuousLinearMap L)
x₀) :
Filter.Tendsto
(fun x : EuclideanSpace ℝ (Fin 2) =>
‖(EuclideanSpace.equiv (Fin 2) ℝ).symm (fun i : Fin 2 => (x i) ^ (2 : ℕ)) -
((EuclideanSpace.equiv (Fin 2) ℝ).symm (fun i : Fin 2 => (x₀ i) ^ (2 : ℕ)) +
L (x - x₀))‖ /
‖x - x₀‖)
(nhdsWithin x₀ {x : EuclideanSpace ℝ (Fin 2) | x ≠ x₀})
(nhds (0 : ℝ))
Helper for Proposition 6.8: punctured neighborhood filters on Subtype univ agree with the ambient punctured filter via coercion.
lemma helperForProposition_6_8_nhdsWithin_puncturedSubtypeUniv_eq_comap
(x₀ : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))}) :
nhdsWithin x₀ {x : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))} | x ≠ x₀} =
Filter.comap (fun x : {x : EuclideanSpace ℝ (Fin 2) // x ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 2)))} =>
(x : EuclideanSpace ℝ (Fin 2)))
(nhdsWithin (x₀ : EuclideanSpace ℝ (Fin 2))
{x : EuclideanSpace ℝ (Fin 2) | x ≠ (x₀ : EuclideanSpace ℝ (Fin 2))})6.3 — Partial and Directional Derivatives — Part 1
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
The one-sided directional difference quotient of f on E at x₀ in direction v.
open scoped Topology
noncomputable def oneSidedDirectionalDifferenceQuotientWithin
{n m : ℕ}
(E : Set (EuclideanSpace ℝ (Fin n)))
(f : E → EuclideanSpace ℝ (Fin m))
(x₀ : E)
(v : EuclideanSpace ℝ (Fin n)) :
ℝ → EuclideanSpace ℝ (Fin m) :=
letI : DecidablePred (fun x : EuclideanSpace ℝ (Fin n) => x ∈ E) :=
Classical.decPred _
fun t =>
if ht : ((x₀ : EuclideanSpace ℝ (Fin n)) + t • v) ∈ E then
t⁻¹ • (f ⟨(x₀ : EuclideanSpace ℝ (Fin n)) + t • v, ht⟩ - f x₀)
else
0
Definition 6.9: f is one-sided directionally differentiable at the interior point x₀ in the direction v if the limit of the difference quotient along t → 0 with t > 0 and x₀ + t v ∈ E exists.
open scoped Topology
def oneSidedDirectionallyDifferentiableWithinAt
{n m : ℕ}
(E : Set (EuclideanSpace ℝ (Fin n)))
(f : E → EuclideanSpace ℝ (Fin m))
(x₀ : E)
(v : EuclideanSpace ℝ (Fin n)) : Prop :=
((x₀ : EuclideanSpace ℝ (Fin n)) ∈ interior E) ∧
∃ L : EuclideanSpace ℝ (Fin m),
Filter.Tendsto (oneSidedDirectionalDifferenceQuotientWithin E f x₀ v)
(nhdsWithin (0 : ℝ)
{t : ℝ | 0 < t ∧ ((x₀ : EuclideanSpace ℝ (Fin n)) + t • v) ∈ E})
(𝓝 L)
The one-sided directional derivative Dᵥ f(x₀) as the limit value, assuming the directional derivative exists in the sense of one-sided directional differentiability.
open scoped Topology
noncomputable def oneSidedDirectionalDerivWithin
{n m : ℕ}
(E : Set (EuclideanSpace ℝ (Fin n)))
(f : E → EuclideanSpace ℝ (Fin m))
(x₀ : E)
(v : EuclideanSpace ℝ (Fin n))
(h : oneSidedDirectionallyDifferentiableWithinAt E f x₀ v) :
EuclideanSpace ℝ (Fin m) :=
Classical.choose h.2
Helper for Lemma 6.6: if x₀ is an interior point of E, then t = 0 belongs to the directional-constraint set {t | x₀ + t • v ∈ E}.
open scoped Topology
lemma helperForLemma_6_6_zero_mem_directionConstraint
{n : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{x₀ v : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E) :
(0 : ℝ) ∈ {t : ℝ | x₀ + t • v ∈ E}
Helper for Lemma 6.6: a nhdsWithin limit at 0 over a set containing 0 fixes the function value at 0.
open scoped Topology
lemma helperForLemma_6_6_tendsto_nhdsWithin_zero_forces_value
{m : ℕ}
{s : Set ℝ}
{g : ℝ → EuclideanSpace ℝ (Fin m)}
{L : EuclideanSpace ℝ (Fin m)}
(hs : (0 : ℝ) ∈ s)
(hlim : Filter.Tendsto g (nhdsWithin (0 : ℝ) s) (𝓝 L)) :
g 0 = L
Helper for Lemma 6.6: the directional difference quotient in the theorem statement has value 0 at t = 0.
open scoped Topology
lemma helperForLemma_6_6_differenceQuotient_valueAtZero
{n m : ℕ}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)} :
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀)) 0 = 0
Helper for Lemma 6.6: any limit claim in the theorem's unpunctured nhdsWithin filter forces the claimed limit value to be 0.
open scoped Topology
lemma helperForLemma_6_6_unpunctured_limit_forces_zero
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hlim : Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) :
f' v = 0
Helper for Lemma 6.6: if f' v ≠ 0, then the theorem's unpunctured directional-limit statement cannot hold.
open scoped Topology
lemma helperForLemma_6_6_no_unpunctured_limit_of_ne_zero
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hv : f' v ≠ 0) :
¬ Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: the identity map has derivative id within univ at every point.
open scoped Topology
lemma helperForLemma_6_6_id_hasFDerivWithinAt_univ
{n : ℕ}
(x₀ : EuclideanSpace ℝ (Fin n)) :
HasFDerivWithinAt
(fun x : EuclideanSpace ℝ (Fin n) => x)
(ContinuousLinearMap.id ℝ (EuclideanSpace ℝ (Fin n)))
(Set.univ : Set (EuclideanSpace ℝ (Fin n)))
x₀
Helper for Lemma 6.6: for nonzero t, the identity-map directional quotient simplifies to the direction vector v.
open scoped Topology
lemma helperForLemma_6_6_identity_differenceQuotient_of_ne_zero
{n : ℕ}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{t : ℝ}
(ht : t ≠ 0) :
t⁻¹ • ((fun x : EuclideanSpace ℝ (Fin n) => x) (x₀ + t • v) -
(fun x : EuclideanSpace ℝ (Fin n) => x) x₀) = v
Helper for Lemma 6.6: the identity map has the expected punctured directional limit t → 0, t ≠ 0, namely v.
open scoped Topology
lemma helperForLemma_6_6_identity_punctured_directional_limit
{n : ℕ}
{x₀ v : EuclideanSpace ℝ (Fin n)} :
Filter.Tendsto
(fun t : ℝ =>
t⁻¹ • ((fun x : EuclideanSpace ℝ (Fin n) => x) (x₀ + t • v) -
(fun x : EuclideanSpace ℝ (Fin n) => x) x₀))
(𝓝[≠] (0 : ℝ))
(𝓝 v)
Helper for Lemma 6.6: for nonzero direction v, the theorem's unpunctured directional-limit conclusion fails for the identity map on ℝⁿ.
open scoped Topology
lemma helperForLemma_6_6_unpunctured_identity_limit_impossible
{n : ℕ}
{x₀ v : EuclideanSpace ℝ (Fin n)}
(hv : v ≠ 0) :
¬ Filter.Tendsto
(fun t : ℝ =>
t⁻¹ • ((fun x : EuclideanSpace ℝ (Fin n) => x) (x₀ + t • v) -
(fun x : EuclideanSpace ℝ (Fin n) => x) x₀))
(nhdsWithin (0 : ℝ)
{t : ℝ | x₀ + t • v ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin n)))})
(𝓝 ((ContinuousLinearMap.id ℝ (EuclideanSpace ℝ (Fin n))) v))
Helper for Lemma 6.6: for any nonzero direction, the identity map on univ provides concrete derivative data together with failure of the unpunctured directional-limit conclusion.
open scoped Topology
lemma helperForLemma_6_6_identity_counterexample_data
{n : ℕ}
{x₀ v : EuclideanSpace ℝ (Fin n)}
(hv : v ≠ 0) :
∃ hfd : HasFDerivWithinAt
(fun x : EuclideanSpace ℝ (Fin n) => x)
(ContinuousLinearMap.id ℝ (EuclideanSpace ℝ (Fin n)))
(Set.univ : Set (EuclideanSpace ℝ (Fin n)))
x₀,
¬ Filter.Tendsto
(fun t : ℝ =>
t⁻¹ • ((fun x : EuclideanSpace ℝ (Fin n) => x) (x₀ + t • v) -
(fun x : EuclideanSpace ℝ (Fin n) => x) x₀))
(nhdsWithin (0 : ℝ)
{t : ℝ | x₀ + t • v ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin n)))})
(𝓝 ((ContinuousLinearMap.id ℝ (EuclideanSpace ℝ (Fin n))) v))
Helper for Lemma 6.6: in dimension 1, the standard basis direction e₀ is nonzero.
open scoped Topology
lemma helperForLemma_6_6_standardBasisVector_finOne_ne_zero :
((EuclideanSpace.single ⟨0, by decide⟩ (1 : ℝ)) : EuclideanSpace ℝ (Fin 1)) ≠ 0
Helper for Lemma 6.6: there is a concrete dimension-1 counterexample witness to the unpunctured directional-limit claim (identity map on univ and direction e₀).
open scoped Topology
lemma helperForLemma_6_6_unpunctured_identity_counterexample_finOne :
∃ x₀ v : EuclideanSpace ℝ (Fin 1),
¬ Filter.Tendsto
(fun t : ℝ =>
t⁻¹ • ((fun x : EuclideanSpace ℝ (Fin 1) => x) (x₀ + t • v) -
(fun x : EuclideanSpace ℝ (Fin 1) => x) x₀))
(nhdsWithin (0 : ℝ)
{t : ℝ | x₀ + t • v ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 1)))})
(𝓝 ((ContinuousLinearMap.id ℝ (EuclideanSpace ℝ (Fin 1))) v))
Helper for Lemma 6.6: in dimension 1, the identity map at the concrete direction e₀ has the expected punctured directional limit, while the unpunctured target-limit claim still fails.
open scoped Topology
lemma helperForLemma_6_6_finOne_identity_punctured_limit_and_unpunctured_failure :
∃ x₀ v : EuclideanSpace ℝ (Fin 1),
Filter.Tendsto
(fun t : ℝ =>
t⁻¹ • ((fun x : EuclideanSpace ℝ (Fin 1) => x) (x₀ + t • v) -
(fun x : EuclideanSpace ℝ (Fin 1) => x) x₀))
(𝓝[≠] (0 : ℝ))
(𝓝 v) ∧
¬ Filter.Tendsto
(fun t : ℝ =>
t⁻¹ • ((fun x : EuclideanSpace ℝ (Fin 1) => x) (x₀ + t • v) -
(fun x : EuclideanSpace ℝ (Fin 1) => x) x₀))
(nhdsWithin (0 : ℝ)
{t : ℝ | x₀ + t • v ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin 1)))})
(𝓝 v)
Helper for Lemma 6.6: for the identity map on univ, any unpunctured directional limit at 0 forces the direction vector to be 0.
open scoped Topology
lemma helperForLemma_6_6_identity_unpunctured_limit_forces_direction_zero
{n : ℕ}
{x₀ v : EuclideanSpace ℝ (Fin n)}
(hlim : Filter.Tendsto
(fun t : ℝ =>
t⁻¹ • ((fun x : EuclideanSpace ℝ (Fin n) => x) (x₀ + t • v) -
(fun x : EuclideanSpace ℝ (Fin n) => x) x₀))
(nhdsWithin (0 : ℝ)
{t : ℝ | x₀ + t • v ∈ (Set.univ : Set (EuclideanSpace ℝ (Fin n)))})
(𝓝 ((ContinuousLinearMap.id ℝ (EuclideanSpace ℝ (Fin n))) v))) :
v = 0
Helper for Lemma 6.6: interior-point differentiability within E upgrades to ambient Fréchet differentiability at the same base point.
open scoped Topology
lemma helperForLemma_6_6_hasFDerivAt_of_hasFDerivWithinAt_interior
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hfd : HasFDerivWithinAt f f' E x₀) :
HasFDerivAt f f' x₀
Helper for Lemma 6.6: an ambient Fréchet derivative yields the punctured directional difference-quotient limit along 𝓝[≠] 0.
open scoped Topology
lemma helperForLemma_6_6_tendsto_directionalQuotient_on_punctured_nhds
{n m : ℕ}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfdAt : HasFDerivAt f f' x₀) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(𝓝[≠] (0 : ℝ))
(𝓝 (f' v))
Helper for Lemma 6.6: a punctured-neighborhood directional limit remains valid after restricting the source filter to points with x₀ + t • v ∈ E.
open scoped Topology
lemma helperForLemma_6_6_mono_to_constrainted_punctured_filter
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hpunctured : Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(𝓝[≠] (0 : ℝ))
(𝓝 (f' v))) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: the punctured directional-quotient formulation is derivable from a within-domain Fréchet derivative at an interior point.
open scoped Topology
lemma helperForLemma_6_6_punctured_directional_limit_of_hasFDerivWithinAt
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hfd : HasFDerivWithinAt f f' E x₀) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: differentiability at an interior point yields the punctured directional-difference-quotient limit to f' v, i.e. the mathematically correct directional limit statement with t ≠ 0 explicitly enforced in the source filter.
open scoped Topology
lemma helperForLemma_6_6_hasDirectionalDerivWithinAt_eq_fderiv_punctured
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hfd : HasFDerivWithinAt f f' E x₀) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: corrected directional-derivative statement using the punctured source filter (t ≠ 0), matching the mathematically valid formulation.
open scoped Topology
lemma helperForLemma_6_6_hasDirectionalDerivWithinAt_eq_fderiv_corrected
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hfd : HasFDerivWithinAt f f' E x₀) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: if the theorem's unpunctured directional-limit claim holds for given data, then the directional value f' v is forced to be zero.
open scoped Topology
lemma helperForLemma_6_6_target_claim_forces_zero
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hclaim : Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) :
f' v = 0
Helper for Lemma 6.6: at an interior point, any unpunctured directional-limit claim with nonzero directional value is contradictory; this obstruction does not use differentiability.
open scoped Topology
lemma helperForLemma_6_6_nonzero_directionalValue_precludes_unpunctured_target
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hv0 : f' v ≠ 0) :
¬ Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: at an interior point, the unpunctured directional-constraint set is obtained by inserting 0 into the punctured constraint set.
open scoped Topology
lemma helperForLemma_6_6_directionConstraint_eq_insert_zero_punctured
{n : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{x₀ v : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E) :
{t : ℝ | x₀ + t • v ∈ E} =
insert (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E}
Helper for Lemma 6.6: if the punctured directional quotient tends to f' v and that value is 0, then the corresponding unpunctured directional limit follows.
open scoped Topology
lemma helperForLemma_6_6_unpunctured_limit_of_punctured_limit_and_zero_directional_value
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hpunctured : Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v)))
(hv0 : f' v = 0) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: once the punctured directional quotient converges to f' v, the unpunctured directional-limit claim is equivalent to the vanishing condition f' v = 0.
open scoped Topology
lemma helperForLemma_6_6_unpunctured_limit_iff_zero_of_punctured_limit
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ interior E)
(hpunctured : Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v))) :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
f' v = 0
Helper for Lemma 6.6: there exists explicit differentiable data (identity map on univ in dimension 1) for which the theorem's unpunctured directional-limit conclusion fails.
open scoped Topology
lemma helperForLemma_6_6_explicit_unpunctured_counterexample_data :
∃ (E : Set (EuclideanSpace ℝ (Fin 1)))
(f : EuclideanSpace ℝ (Fin 1) → EuclideanSpace ℝ (Fin 1))
(x₀ v : EuclideanSpace ℝ (Fin 1))
(f' : EuclideanSpace ℝ (Fin 1) →L[ℝ] EuclideanSpace ℝ (Fin 1)),
x₀ ∈ interior E ∧
HasFDerivWithinAt f f' E x₀ ∧
¬ Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: there is explicit differentiable data (identity map on univ in dimension 1) where the unpunctured directional-limit conclusion fails and the claimed limit value f' v is nonzero.
open scoped Topology
lemma helperForLemma_6_6_explicit_unpunctured_counterexample_data_with_nonzero_value :
∃ (E : Set (EuclideanSpace ℝ (Fin 1)))
(f : EuclideanSpace ℝ (Fin 1) → EuclideanSpace ℝ (Fin 1))
(x₀ v : EuclideanSpace ℝ (Fin 1))
(f' : EuclideanSpace ℝ (Fin 1) →L[ℝ] EuclideanSpace ℝ (Fin 1)),
x₀ ∈ interior E ∧
HasFDerivWithinAt f f' E x₀ ∧
f' v ≠ 0 ∧
¬ Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: the unpunctured directional-limit conclusion cannot hold as a universal theorem; the explicit dimension-1 identity-map data is a counterexample.
open scoped Topology
lemma helperForLemma_6_6_unpunctured_universal_claim_false :
¬ (∀ {n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)},
HasFDerivWithinAt f f' E x₀ →
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v)))
Helper for Lemma 6.6: even after restricting to nonzero directional values f' v ≠ 0, the unpunctured directional-limit conclusion is still not universally valid.
open scoped Topology
lemma helperForLemma_6_6_unpunctured_nonzero_directional_universal_claim_false :
¬ (∀ {n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)},
HasFDerivWithinAt f f' E x₀ →
f' v ≠ 0 →
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v)))
Helper for Lemma 6.6: for fixed differentiable data, the theorem's unpunctured directional-limit claim is equivalent to the directional value f' v being zero.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_iff_directionalValue_eq_zero
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀) :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
f' v = 0
Helper for Lemma 6.6: if the directional value f' v is nonzero, then the theorem's unpunctured directional-limit claim is impossible for that fixed differentiable data.
open scoped Topology
lemma helperForLemma_6_6_not_target_tendsto_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0) :
¬ Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: for fixed differentiable data at an interior point, failure of the unpunctured directional-limit target is equivalent to the directional value being nonzero.
open scoped Topology
lemma helperForLemma_6_6_not_target_tendsto_iff_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀) :
(¬ Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
f' v ≠ 0
Helper for Lemma 6.6: if the theorem's unpunctured directional-limit conclusion held for every direction (for fixed data at an interior point), then the derivative map would be the zero linear map.
open scoped Topology
lemma helperForLemma_6_6_all_unpunctured_targets_force_zero_fderiv
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hall : ∀ w : EuclideanSpace ℝ (Fin n),
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • w) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • w ∈ E})
(𝓝 (f' w))) :
f' = 0
Helper for Lemma 6.6: for fixed differentiable data, any proof of the theorem's unpunctured directional-limit target contradicts a nonzero directional value f' v.
open scoped Topology
lemma helperForLemma_6_6_target_proof_contradicts_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0)
(htarget : Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) :
False
Helper for Lemma 6.6: if the theorem's target claim is equivalent to the vanishing directional value f' v = 0, then any nonzero directional value excludes that target claim.
open scoped Topology
lemma helperForLemma_6_6_not_target_of_targetIff_directionalValue_eq_zero
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(htargetIffZero :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
f' v = 0)
(hv0 : f' v ≠ 0) :
¬ Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: if the theorem's target claim is equivalent to f' v = 0, then under f' v ≠ 0 that target claim is equivalent to False.
open scoped Topology
lemma helperForLemma_6_6_targetIffFalse_of_targetIffZero_and_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(htargetIffZero :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
f' v = 0)
(hv0 : f' v ≠ 0) :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
False
Helper for Lemma 6.6: for fixed differentiable data at an interior point, if f' v ≠ 0, then the theorem's unpunctured target statement is equivalent to False.
open scoped Topology
lemma helperForLemma_6_6_targetIffFalse_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0) :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
False6.3 — Partial and Directional Derivatives — Part 2
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Lemma 6.6: Let E ⊆ ℝⁿ, f : E → ℝᵐ (represented by an ambient map with within-domain derivative), and x₀ ∈ interior E. If f is differentiable at x₀ within E with derivative f', then the directional derivative at x₀ in direction v exists as t → 0 along nonzero points with x₀ + t v ∈ E, and equals f' v.
open scoped Topology
theorem hasDirectionalDerivWithinAt_eq_fderiv
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v))
The j-th standard basis vector in ℝⁿ, viewed as an element of EuclideanSpace.
open scoped Topology
noncomputable def standardBasisVectorEuclidean (n : ℕ) (j : Fin n) : EuclideanSpace ℝ (Fin n) :=
EuclideanSpace.single j 1
The difference quotient used to define the partial derivative of f with respect to the j-th coordinate at x₀.
open scoped Topology
noncomputable def partialDifferenceQuotientWithin
{n m : ℕ}
(f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(x₀ : EuclideanSpace ℝ (Fin n))
(j : Fin n) :
ℝ → EuclideanSpace ℝ (Fin m) :=
fun t =>
t⁻¹ • (f (x₀ + t • standardBasisVectorEuclidean n j) - f x₀)
The within-E partial derivative notion (equation 6.u77): for E ⊆ ℝⁿ, ambient extension f : ℝⁿ → ℝᵐ of the book map E → ℝᵐ, interior x₀ ∈ E, and coordinate j, HasPartialDerivWithinAt E f x₀ j L records that the constrained difference quotient along e_j converges to L as t → 0 through nonzero values with x₀ + t e_j ∈ E.
open scoped Topology
def HasPartialDerivWithinAt
{n m : ℕ}
(E : Set (EuclideanSpace ℝ (Fin n)))
(f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(x₀ : EuclideanSpace ℝ (Fin n))
(j : Fin n)
(L : EuclideanSpace ℝ (Fin m)) : Prop :=
x₀ ∈ interior E ∧
Filter.Tendsto
(partialDifferenceQuotientWithin f x₀ j)
(nhdsWithin (0 : ℝ)
{t : ℝ |
t ≠ 0 ∧ x₀ + t • standardBasisVectorEuclidean n j ∈ E})
(𝓝 L)
Definition 6.10: f is continuously differentiable on E if E consists of interior points and for each coordinate direction j, there is a map gⱼ : ℝⁿ → ℝᵐ that is continuous on E and satisfies gⱼ x = ∂f/∂xⱼ (x) for every x ∈ E in the within-E sense (using equation 6.u77); the companion declarations below encode equations 6.u78–6.u80.
open scoped Topology
def ContinuouslyDifferentiableWithinOn
{n m : ℕ}
(E : Set (EuclideanSpace ℝ (Fin n)))
(f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)) : Prop :=
E ⊆ interior E ∧
∀ j : Fin n,
∃ g : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m),
(∀ x, x ∈ E → HasPartialDerivWithinAt E f x j (g x)) ∧ ContinuousOn g E
Definition 6.11: Let E ⊆ ℝⁿ, f : ℝⁿ → ℝᵐ (an ambient extension of a map on E), and x₀ ∈ E such that for every coordinate j the partial derivative of f at x₀ within E exists. The derivative (Jacobian) matrix Df(x₀) is the m × n matrix whose (i,j)-entry is ∂fᵢ/∂xⱼ (x₀).
open scoped Topology
noncomputable def derivativeMatrixWithinAt
{n m : ℕ}
(E : Set (EuclideanSpace ℝ (Fin n)))
(f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(x₀ : EuclideanSpace ℝ (Fin n))
(hpartial : x₀ ∈ E ∧ ∀ j : Fin n,
∃ L : EuclideanSpace ℝ (Fin m), HasPartialDerivWithinAt E f x₀ j L) :
Matrix (Fin m) (Fin n) ℝ :=
fun i j => (Classical.choose (hpartial.2 j)) i
For vector-valued maps, the partial derivative in one coordinate direction is determined by the partial derivatives of the component functions fun x => (f x) k (equation 6.u78).
open scoped Topology
theorem hasPartialDerivWithinAt_componentwise
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
{j : Fin n}
{L : EuclideanSpace ℝ (Fin m)}
:
HasPartialDerivWithinAt E f x₀ j L ↔
x₀ ∈ interior E ∧
∀ k : Fin m,
Filter.Tendsto
(fun t : ℝ =>
t⁻¹ *
(((fun x : EuclideanSpace ℝ (Fin n) => (f x) k)
(x₀ + t • standardBasisVectorEuclidean n j)) -
((fun x : EuclideanSpace ℝ (Fin n) => (f x) k) x₀)))
(nhdsWithin (0 : ℝ)
{t : ℝ |
t ≠ 0 ∧ x₀ + t • standardBasisVectorEuclidean n j ∈ E})
(𝓝 (L k))
If f has Fréchet derivative f' at x₀ within E, then its j-th partial derivative at x₀ exists and equals f' e_j.
open scoped Topology
theorem hasFDerivWithinAt_hasPartialDerivWithinAt
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(j : Fin n) :
HasPartialDerivWithinAt E f x₀ j
(f' (standardBasisVectorEuclidean n j))
If f has ambient Fréchet derivative f' at x₀, then at an interior point of E its j-th partial derivative within E exists and equals f' e_j (equation 6.u79).
open scoped Topology
theorem hasFDerivAt_hasPartialDerivWithinAt
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivAt f f' x₀)
(j : Fin n) :
HasPartialDerivWithinAt E f x₀ j
(f' (standardBasisVectorEuclidean n j))
A linear derivative map sends a direction v = ∑ⱼ vⱼ eⱼ to ∑ⱼ vⱼ (f' eⱼ), matching the directional derivative expansion by partial derivatives.
open scoped Topology
theorem fderiv_apply_eq_sum_standardBasis
{n m : ℕ}
(f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m))
(v : EuclideanSpace ℝ (Fin n)) :
f' v = ∑ j : Fin n, v j • f' (standardBasisVectorEuclidean n j)
If f has Fréchet derivative within E at x₀, and if L j are the corresponding partial derivatives at x₀, then the directional derivative in any direction v equals ∑ⱼ vⱼ • L j (equation 6.u80).
open scoped Topology
theorem hasFDerivWithinAt_directionalDeriv_eq_sum_partial
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(L : Fin n → EuclideanSpace ℝ (Fin m))
(hpartial : ∀ j : Fin n, HasPartialDerivWithinAt E f x₀ j (L j))
(v : EuclideanSpace ℝ (Fin n)) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (∑ j : Fin n, v j • L j))
Proposition 6.9: Let E ⊆ ℝⁿ, f : ℝⁿ → ℝᵐ, and x₀ ∈ E. Assume f is differentiable at x₀ within E with derivative f', and let Df be the Jacobian matrix representing f' (so f' = Matrix.mulVecLin Df). Then for every direction v, the directional derivative exists and (Dᵥ f(x₀))ᵀ = Df * vᵀ, i.e. the directional derivative limit is Matrix.mulVec Df v. Equivalently, Dᵥ f(x₀) = f' v = ∑ⱼ vⱼ • (f' eⱼ).
open scoped Topology
theorem directionalDerivWithinAt_eq_jacobian_mulVec_and_sum
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hx₀ : x₀ ∈ E)
(hfd : HasFDerivWithinAt f f' E x₀)
(Df : Matrix (Fin m) (Fin n) ℝ)
(hDf :
∀ w : EuclideanSpace ℝ (Fin n),
f' w =
(EuclideanSpace.equiv (Fin m) ℝ).symm
(Matrix.mulVec Df ((EuclideanSpace.equiv (Fin n) ℝ) w)))
(v : EuclideanSpace ℝ (Fin n)) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 ((EuclideanSpace.equiv (Fin m) ℝ).symm
(Matrix.mulVec Df ((EuclideanSpace.equiv (Fin n) ℝ) v)))) ∧
(EuclideanSpace.equiv (Fin m) ℝ).symm
(Matrix.mulVec Df ((EuclideanSpace.equiv (Fin n) ℝ) v)) = f' v ∧
f' v = ∑ j : Fin n, v j • f' (standardBasisVectorEuclidean n j)
Helper for Lemma 6.6: when the directional value f' v is zero, the theorem's unpunctured directional-limit target follows from the established equivalence with f' v = 0.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_of_zero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v = 0) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: for fixed differentiable data at an interior point, if f' v ≠ 0 then any proof of the theorem's unpunctured directional-limit target yields False.
open scoped Topology
lemma helperForLemma_6_6_false_of_target_tendsto_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0)
(htarget : Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) :
False
Helper for Lemma 6.6: any implication that turns differentiability data into the theorem's unpunctured directional-limit target forces the directional value f' v to be zero.
open scoped Topology
lemma helperForLemma_6_6_target_implication_forces_directionalValue_zero
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(himp :
HasFDerivWithinAt f f' E x₀ →
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) :
HasFDerivWithinAt f f' E x₀ →
f' v = 0
Helper for Lemma 6.6: with fixed differentiability data, a nonzero directional value makes any implication to the theorem's unpunctured target claim contradictory.
open scoped Topology
lemma helperForLemma_6_6_false_of_target_implication_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0)
(himp :
HasFDerivWithinAt f f' E x₀ →
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) :
False
Helper for Lemma 6.6: once differentiability data is fixed, a nonzero directional value precludes any implication from that data to the theorem's unpunctured target claim.
open scoped Topology
lemma helperForLemma_6_6_no_target_implication_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0) :
¬ (HasFDerivWithinAt f f' E x₀ →
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v)))
Helper for Lemma 6.6: for fixed differentiable data at an interior point, if f' v ≠ 0 then the theorem's unpunctured directional-limit target is equivalent to False.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_iff_false_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0) :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔ False
Helper for Lemma 6.6: for fixed differentiable data at an interior point, the theorem's unpunctured directional-limit target is equivalent to the conjunction of the punctured directional limit and the vanishing directional value f' v = 0.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_iff_zero_and_punctured
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀) :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
(f' v = 0 ∧
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v)))
Helper for Lemma 6.6: if the theorem's unpunctured target claim is equivalent to f' v = 0 together with the punctured directional-limit claim, then any nonzero directional value f' v excludes the unpunctured target claim.
open scoped Topology
lemma helperForLemma_6_6_not_target_of_targetIff_zero_and_punctured_and_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(htargetIffZeroAndPunctured :
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
(f' v = 0 ∧
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v))))
(hv0 : f' v ≠ 0) :
¬ Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))
Helper for Lemma 6.6: for fixed differentiability data at an interior point, combining a nonzero directional value f' v ≠ 0 with the theorem's unpunctured target claim yields a contradiction.
open scoped Topology
lemma helperForLemma_6_6_false_of_nonzero_directionalValue_and_targetClaim
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0)
(htarget : Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) :
False
Helper for Lemma 6.6: for fixed differentiable data at an interior point, if f' v ≠ 0 then the theorem's unpunctured directional-limit target proposition is empty.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_isEmpty_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0) :
IsEmpty
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v)))
Helper for Lemma 6.6: for fixed differentiable data at an interior point, if f' v ≠ 0 then the theorem's unpunctured directional-limit target proposition has no inhabitants.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_not_nonempty_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0) :
¬ Nonempty
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v)))
Helper for Lemma 6.6: if the theorem's unpunctured directional-limit target proposition is inhabited for fixed interior-point data, then the directional value f' v must be zero.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_nonempty_forces_zero
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hnonempty : Nonempty
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v)))) :
f' v = 0
Helper for Lemma 6.6: for fixed differentiable data at an interior point, inhabitation of the theorem's unpunctured directional-limit target proposition is equivalent to f' v = 0.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_nonempty_iff_directionalValue_eq_zero
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀) :
Nonempty
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
f' v = 0
Helper for Lemma 6.6: for fixed differentiable data at an interior point, the theorem's unpunctured directional-limit target proposition is empty exactly when the directional value f' v is nonzero.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_isEmpty_iff_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀) :
IsEmpty
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
f' v ≠ 0
Helper for Lemma 6.6: for fixed differentiable data at an interior point, if f' v ≠ 0 then inhabitation of the theorem's unpunctured directional-limit target proposition is equivalent to False.
open scoped Topology
lemma helperForLemma_6_6_target_tendsto_nonempty_iff_false_of_nonzero_directionalValue
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0) :
Nonempty
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v))) ↔
False
Helper for Lemma 6.6: in the nonzero directional-value branch, differentiability still gives the punctured directional limit, while the theorem's unpunctured target proposition is empty.
open scoped Topology
lemma helperForLemma_6_6_nonzero_branch_punctured_limit_and_empty_target
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀ : x₀ ∈ interior E)
{v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(hfd : HasFDerivWithinAt f f' E x₀)
(hv0 : f' v ≠ 0) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ E})
(𝓝 (f' v)) ∧
IsEmpty
(Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | x₀ + t • v ∈ E})
(𝓝 (f' v)))6.3 — Partial and Directional Derivatives — Part 3
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Theorem 6.1: Let E ⊆ ℝⁿ, let f : ℝⁿ → ℝᵐ be an ambient extension of a map on E, let F ⊆ E, and let x₀ be an interior point of F (equivalently, there is r > 0 with Metric.ball x₀ r ⊆ F). Assume that for each j ∈ {1, …, n} there is a partial-derivative field g j on F such that HasPartialDerivWithinAt E f x j (g j x) for every x ∈ F, and g j is continuous at x₀ when restricted to F. Then f is differentiable at x₀ within E, and its derivative is the linear map v ↦ ∑ j, v j • g j x₀.
open scoped Topology
theorem hasFDerivAt_of_continuous_partialDerivWithinAt
{n m : ℕ}
{E F : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hFE : F ⊆ E)
(hx₀ : x₀ ∈ interior F)
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(hpartial : ∀ j : Fin n, ∀ x, x ∈ F → HasPartialDerivWithinAt E f x j (g j x))
(hcont : ∀ j : Fin n, ContinuousWithinAt (g j) F x₀) :
∃ f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt f f' E x₀ ∧
∀ v : EuclideanSpace ℝ (Fin n),
f' v = ∑ j : Fin n, v j • g j x₀
Helper for Theorem 6.1: the coordinate-sum linear-map candidate evaluates to the expected finite sum ∑ j, v j • g j x₀.
open scoped Topology
lemma helperForTheorem_6_1_candidateFDeriv_apply
{n m : ℕ}
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(x₀ : EuclideanSpace ℝ (Fin n))
(v : EuclideanSpace ℝ (Fin n)) :
let f'fun : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ) :=
∑ j : Fin n,
ContinuousLinearMap.smulRight (ContinuousLinearMap.proj j)
((EuclideanSpace.equiv (Fin m) ℝ) (g j x₀))
let f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m) :=
((EuclideanSpace.equiv (Fin m) ℝ).symm : (Fin m → ℝ) →L[ℝ] EuclideanSpace ℝ (Fin m)).comp
(f'fun.comp ((EuclideanSpace.equiv (Fin n) ℝ) :
EuclideanSpace ℝ (Fin n) →L[ℝ] (Fin n → ℝ)))
f' v =
∑ j : Fin n, v j • g j x₀
Helper for Theorem 6.1: from interiority of x₀ in F and F ⊆ E, there is a positive radius ball around x₀ contained in both F and E.
open scoped Topology
lemma helperForTheorem_6_1_ball_subset_F_and_E
{n : ℕ}
{E F : Set (EuclideanSpace ℝ (Fin n))}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hFE : F ⊆ E)
(hx₀ : x₀ ∈ interior F) :
∃ r > 0, Metric.ball x₀ r ⊆ F ∧ Metric.ball x₀ r ⊆ E
Helper for Theorem 6.1: continuity of a fixed partial-derivative field within F gives an ε-δ estimate at x₀ for that coordinate field.
open scoped Topology
lemma helperForTheorem_6_1_partial_closeness_single
{n m : ℕ}
{F : Set (EuclideanSpace ℝ (Fin n))}
{x₀ : EuclideanSpace ℝ (Fin n)}
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(hcont : ∀ j : Fin n, ContinuousWithinAt (g j) F x₀)
{j : Fin n}
{ε : ℝ}
(hε : 0 < ε) :
∃ δ > 0,
∀ x, x ∈ F → dist x x₀ < δ → ‖g j x - g j x₀‖ < ε
Helper for Theorem 6.1: each within-E partial derivative hypothesis at a point x ∈ F upgrades to a one-variable derivative statement along the coordinate line through x in direction e_j, at parameter value 0.
open scoped Topology
lemma helperForTheorem_6_1_partial_to_lineDerivWithinAt_zero
{n m : ℕ}
{E F : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(hpartial : ∀ j : Fin n, ∀ x, x ∈ F → HasPartialDerivWithinAt E f x j (g j x))
{j : Fin n}
{x : EuclideanSpace ℝ (Fin n)}
(hx : x ∈ F) :
HasDerivWithinAt
(fun t : ℝ => f (x + t • standardBasisVectorEuclidean n j))
(g j x)
{t : ℝ | x + t • standardBasisVectorEuclidean n j ∈ E}
0
Helper for Theorem 6.1: continuity of all coordinate partial-derivative fields at x₀ within F gives a single radius on which all coordinates are simultaneously ε-close, and the same ball lies in both F and E.
open scoped Topology
lemma helperForTheorem_6_1_uniform_partial_closeness_on_ball
{n m : ℕ}
{E F : Set (EuclideanSpace ℝ (Fin n))}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hFE : F ⊆ E)
(hx₀ : x₀ ∈ interior F)
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(hcont : ∀ j : Fin n, ContinuousWithinAt (g j) F x₀)
{ε : ℝ}
(hε : 0 < ε) :
∃ r > 0,
Metric.ball x₀ r ⊆ F ∧
Metric.ball x₀ r ⊆ E ∧
∀ j : Fin n, ∀ x, x ∈ Metric.ball x₀ r → ‖g j x - g j x₀‖ ≤ ε
Helper for Theorem 6.1: every vector in ℝⁿ is the sum of its coordinate components along the standard basis vectors.
open scoped Topology
lemma helperForTheorem_6_1_sum_standardBasisVectorEuclidean_eq
{n : ℕ}
(h : EuclideanSpace ℝ (Fin n)) :
(∑ j : Fin n, h j • standardBasisVectorEuclidean n j) = h
Helper for Theorem 6.1: finite telescoping over successive differences on ℕ indices.
open scoped Topology
lemma helperForTheorem_6_1_sum_range_succ_sub_eq
{α : Type*} [AddCommGroup α]
(u : ℕ → α)
(n : ℕ) :
Finset.sum (Finset.range n) (fun i => (u (i + 1) - u i)) = u n - u 0
Helper for Theorem 6.1: there is a global constant controlling the sum of coordinate norms by the ambient Euclidean norm.
open scoped Topology
lemma helperForTheorem_6_1_sum_norm_coordinates_le_constant_mul_norm
{n : ℕ} :
∃ C > 0,
∀ h : EuclideanSpace ℝ (Fin n),
(∑ j : Fin n, ‖h j‖) ≤ C * ‖h‖
Helper for Theorem 6.1: if η = ε / (2 * C) and coordinate norms satisfy ∑ j, ‖h j‖ ≤ C * ‖h‖, then η * (∑ j, ‖h j‖) ≤ ε * ‖h‖.
open scoped Topology
lemma helperForTheorem_6_1_eta_coordinate_sum_le_eps_norm
{n : ℕ}
{C ε : ℝ}
(hCpos : 0 < C)
(hεpos : 0 < ε)
(hcoordBound :
∀ h : EuclideanSpace ℝ (Fin n),
(∑ j : Fin n, ‖h j‖) ≤ C * ‖h‖)
(h : EuclideanSpace ℝ (Fin n)) :
let η : ℝ := ε / (2 * C)
η * (∑ j : Fin n, ‖h j‖) ≤ ε * ‖h‖
Helper for Theorem 6.1: Nat-indexed coordinate-prefix path based at x₀ with increment vector h.
open scoped Topology
noncomputable def helperForTheorem_6_1_coordinatePrefix_nat
{n : ℕ}
(x₀ h : EuclideanSpace ℝ (Fin n))
(k : ℕ) :
EuclideanSpace ℝ (Fin n) :=
x₀ + ∑ j : Fin n, (if (j : ℕ) < k then h j else 0) • standardBasisVectorEuclidean n j
Helper for Theorem 6.1: the Nat-indexed coordinate-prefix path starts at x₀.
open scoped Topology
lemma helperForTheorem_6_1_coordinatePrefix_nat_zero
{n : ℕ}
(x₀ h : EuclideanSpace ℝ (Fin n)) :
helperForTheorem_6_1_coordinatePrefix_nat x₀ h 0 = x₀
Helper for Theorem 6.1: one successor step in the Nat-indexed coordinate-prefix path adds the next coordinate increment.
open scoped Topology
lemma helperForTheorem_6_1_coordinatePrefix_nat_succ
{n : ℕ}
(x₀ h : EuclideanSpace ℝ (Fin n))
{k : ℕ}
(hk : k < n) :
helperForTheorem_6_1_coordinatePrefix_nat x₀ h (k + 1)
= helperForTheorem_6_1_coordinatePrefix_nat x₀ h k
+ h ⟨k, hk⟩ • standardBasisVectorEuclidean n ⟨k, hk⟩
Helper for Theorem 6.1: the final Nat-indexed coordinate-prefix node is x₀ + h.
open scoped Topology
lemma helperForTheorem_6_1_coordinatePrefix_nat_at_top
{n : ℕ}
(x₀ h : EuclideanSpace ℝ (Fin n)) :
helperForTheorem_6_1_coordinatePrefix_nat x₀ h n = x₀ + h
Helper for Theorem 6.1: one coordinate-segment increment has remainder controlled by the uniform bound on the corresponding partial field along that segment.
open scoped Topology
lemma helperForTheorem_6_1_coordinate_segment_error_package
{n m : ℕ}
{E F : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ p : EuclideanSpace ℝ (Fin n)}
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
{j : Fin n}
{hj η r : ℝ}
(hpartialLine :
∀ x, x ∈ F →
HasDerivWithinAt
(fun t : ℝ => f (x + t • standardBasisVectorEuclidean n j))
(g j x)
{t : ℝ | x + t • standardBasisVectorEuclidean n j ∈ E}
0)
(hballF : Metric.ball x₀ r ⊆ F)
(hclose : ∀ x, x ∈ Metric.ball x₀ r → ‖g j x - g j x₀‖ ≤ η)
(hsegE : ∀ t : ℝ, t ∈ segment ℝ (0 : ℝ) hj →
p + t • standardBasisVectorEuclidean n j ∈ E)
(hsegBall : ∀ t : ℝ, t ∈ segment ℝ (0 : ℝ) hj →
p + t • standardBasisVectorEuclidean n j ∈ Metric.ball x₀ r) :
‖(f (p + hj • standardBasisVectorEuclidean n j) - f p) - hj • g j x₀‖ ≤ η * ‖hj‖
Helper for Theorem 6.1: a local linear remainder bound implies HasFDerivWithinAt.
open scoped Topology
lemma helperForTheorem_6_1_hasFDerivWithinAt_of_linear_remainder_bound
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m))
(hbound :
∀ ε > 0, ∃ δ > 0,
∀ x, x ∈ E → dist x x₀ < δ →
‖f x - f x₀ - f' (x - x₀)‖ ≤ ε * ‖x - x₀‖) :
HasFDerivWithinAt f f' E x₀6.3 — Partial and Directional Derivatives — Part 4
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Theorem 6.2: Let F ⊆ ℝⁿ and f : ℝⁿ → ℝᵐ, and let x₀ ∈ interior F. Assume there is a neighborhood U of x₀ with U ⊆ F such that for each coordinate j : Fin n, the partial derivative of f with respect to xⱼ exists at every x ∈ U within F and is represented by g j x, and the map g j is continuous at x₀ within U. Then for every direction v, the directional difference quotient of f at x₀ along v (equation 6.u93) converges to ∑ⱼ vⱼ • gⱼ(x₀) (equation 6.u94). In the scalar-valued case m = 1, the 0-th coordinate form is Dᵥ f(x₀) = v • ∇f(x₀) in dot-product form (equation 6.u95).
open scoped Topology
theorem directionalDerivWithinAt_eq_sum_partialDeriv_of_continuousAt
{n m : ℕ}
{F U : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀F : x₀ ∈ interior F)
(hx₀U : x₀ ∈ interior U)
(hUF : U ⊆ F)
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(hpartial : ∀ j : Fin n, ∀ x, x ∈ U → HasPartialDerivWithinAt F f x j (g j x))
(hcont : ∀ j : Fin n, ContinuousWithinAt (g j) U x₀)
(v : EuclideanSpace ℝ (Fin n)) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ F})
(𝓝 (∑ j : Fin n, v j • g j x₀)) ∧
(m = 1 →
∀ i : Fin m,
Filter.Tendsto
(fun t : ℝ => (t⁻¹ • (f (x₀ + t • v) - f x₀)) i)
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ F})
(𝓝 (dotProduct v (fun j : Fin n => (g j x₀) i))))
Helper for Theorem 6.2: specialize Theorem 6.1 to E = F and F = U to package the within-F Fréchet derivative at x₀ together with its coordinate-sum evaluation formula.
open scoped Topology
lemma helperForTheorem_6_2_fderiv_data_from_6_1
{n m : ℕ}
{F U : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ : EuclideanSpace ℝ (Fin n)}
(hx₀U : x₀ ∈ interior U)
(hUF : U ⊆ F)
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(hpartial : ∀ j : Fin n, ∀ x, x ∈ U → HasPartialDerivWithinAt F f x j (g j x))
(hcont : ∀ j : Fin n, ContinuousWithinAt (g j) U x₀) :
∃ f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt f f' F x₀ ∧
∀ w : EuclideanSpace ℝ (Fin n),
f' w = ∑ j : Fin n, w j • g j x₀
Helper for Theorem 6.2: a within-F Fréchet derivative and its coordinate-sum evaluation formula imply the punctured directional limit with target ∑ j, v j • g j x₀.
open scoped Topology
lemma helperForTheorem_6_2_directional_limit_to_sum
{n m : ℕ}
{F : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
{x₀ v : EuclideanSpace ℝ (Fin n)}
{f' : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin m)}
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(hx₀F : x₀ ∈ interior F)
(hfd : HasFDerivWithinAt f f' F x₀)
(hf' : ∀ w : EuclideanSpace ℝ (Fin n), f' w = ∑ j : Fin n, w j • g j x₀) :
Filter.Tendsto
(fun t : ℝ => t⁻¹ • (f (x₀ + t • v) - f x₀))
(nhdsWithin (0 : ℝ) {t : ℝ | t ≠ 0 ∧ x₀ + t • v ∈ F})
(𝓝 (∑ j : Fin n, v j • g j x₀))
Helper for Theorem 6.2: project a vector-valued limit in Euclidean space to any coordinate.
open scoped Topology
lemma helperForTheorem_6_2_component_limit_from_vector_limit
{m : ℕ}
{L : Filter ℝ}
{φ : ℝ → EuclideanSpace ℝ (Fin m)}
{y : EuclideanSpace ℝ (Fin m)}
(hφ : Filter.Tendsto φ L (𝓝 y))
(i : Fin m) :
Filter.Tendsto (fun t : ℝ => (φ t) i) L (𝓝 (y i))
Helper for Theorem 6.2: the i-th coordinate of ∑ j, v j • g j x₀ is the dot-product dotProduct v (fun j => (g j x₀) i).
open scoped Topology
lemma helperForTheorem_6_2_sum_component_eq_dotProduct
{n m : ℕ}
(g : Fin n → EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m))
(x₀ : EuclideanSpace ℝ (Fin n))
(v : EuclideanSpace ℝ (Fin n))
(i : Fin m) :
((∑ j : Fin n, v j • g j x₀) i)
= dotProduct v (fun j : Fin n => (g j x₀) i)6.4 — The Several Variable Calculus Chain Rule — Part 1
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Theorem 6.3 (Several variable calculus chain rule): let E ⊆ ℝⁿ and F ⊆ ℝᵐ, f : E → F, and g : F → ℝᵖ. If x₀ is an interior point of E and f is differentiable at x₀, and if f x₀ is an interior point of F and g is differentiable at f x₀, then g ∘ f is differentiable at x₀ and (g ∘ f)'(x₀) = g'(f(x₀)) ∘ f'(x₀).
theorem severalVariableCalculus_chainRule
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(h_map : Set.MapsTo f E F)
(hx0 : x0 ∈ interior E)
(hf : DifferentiableAt ℝ f x0)
(hfx0 : f x0 ∈ interior F)
(hg : DifferentiableAt ℝ g (f x0)) :
DifferentiableAt ℝ (g ∘ f) x0 ∧
fderiv ℝ (g ∘ f) x0 = (fderiv ℝ g (f x0)).comp (fderiv ℝ f x0)
Helper for Theorem 6.4: a matrix identity follows from the corresponding within-derivative composition identity.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_fderivWithin_comp
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hcomp :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: the matrix identity in the chain-rule statement is equivalent to the corresponding equality of selected within-derivatives.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_iff_fderivWithin_comp
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ} :
(LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap) ↔
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: composing the selected within-derivatives of g and f gives a within-derivative of g ∘ f.
theorem helperForTheorem_6_4_matrixForm_chainRule_hasFDerivWithinAt_comp_of_selectedWithinDerivatives
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0)) :
HasFDerivWithinAt (g ∘ f)
((fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) E x0
Helper for Theorem 6.4: on a UniqueDiffWithinAt set, any two within-derivative witnesses for the same map at the same point are equal.
theorem helperForTheorem_6_4_matrixForm_chainRule_eq_of_two_hasFDerivWithinAt_of_uniqueDiff
{n p : ℕ}
{E : Set (Fin n → ℝ)}
{h : (Fin n → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
{L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ)}
(hL1 : HasFDerivWithinAt h L1 E x0)
(hL2 : HasFDerivWithinAt h L2 E x0)
(hUnique : UniqueDiffWithinAt ℝ E x0) :
L1 = L2
Helper for Theorem 6.4: UniqueDiffWithinAt provides a canonicity principle for within-derivative witnesses at a fixed point.
theorem helperForTheorem_6_4_matrixForm_chainRule_hasFDerivWithinAt_canonicity_of_uniqueDiff
{n p : ℕ}
{E : Set (Fin n → ℝ)}
{h : (Fin n → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hUnique : UniqueDiffWithinAt ℝ E x0) :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt h L1 E x0 →
HasFDerivWithinAt h L2 E x0 →
L1 = L2
Helper for Theorem 6.4: to prove the selected within-derivative composition identity, it is enough to have the two derivative witnesses and a canonicity principle identifying any two such witnesses.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_comp_of_twoHasFDerivWithinAt_witnesses_and_canonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hDerivSelected :
HasFDerivWithinAt (g ∘ f) (fderivWithin ℝ (g ∘ f) E x0) E x0)
(hDerivComp :
HasFDerivWithinAt (g ∘ f)
((fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) E x0)
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: under UniqueDiffWithinAt, the selected within-derivative of g ∘ f agrees with the composition of selected within-derivatives.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_comp_of_uniqueDiff_from_selectedWithinDerivatives
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: under UniqueDiffWithinAt, the within-derivative matrix of a composition is the product of within-derivative matrices.
theorem helperForTheorem_6_4_matrixForm_chainRule_of_uniqueDiff
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: under UniqueDiffWithinAt, both the within-set chain-rule differentiability and the matrix identity hold.
theorem helperForTheorem_6_4_matrixForm_chainRule_conclusion_of_uniqueDiff
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
DifferentiableWithinAt ℝ (g ∘ f) E x0 ∧
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: the within-set differentiability conclusion for the composition g ∘ f does not require UniqueDiffWithinAt.
theorem helperForTheorem_6_4_matrixForm_chainRule_differentiableWithin
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0)) :
DifferentiableWithinAt ℝ (g ∘ f) E x0
Helper for Theorem 6.4: under UniqueDiffWithinAt, the matrix identity in Theorem 6.4 is obtained from the corresponding conjunction helper.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_uniqueDiff
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: with the exact hypotheses of matrixForm_chainRule, the matrix identity follows in the UniqueDiffWithinAt branch.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_uniqueDiff_mainHypotheses
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hx0 : x0 ∈ E)
(hf : DifferentiableWithinAt ℝ f E x0)
(hfx0 : f x0 ∈ F)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: if f has zero within-derivative at x0, then the matrix identity for the chain rule holds.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_comp_of_hasFDerivWithinAt_zero
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hZeroDerivF : HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0) :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: if either UniqueDiffWithinAt holds at x0 or f has zero within-derivative at x0, then the selected within-derivative of g ∘ f is the composition of selected within-derivatives.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_comp_of_uniqueDiff_or_hasFDerivWithinAt_zero
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUniqueOrZero :
UniqueDiffWithinAt ℝ E x0 ∨
HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0) :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: if f has zero within-derivative at x0, then the matrix identity for the chain rule holds.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_hasFDerivWithinAt_zero
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hZeroDerivF : HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: if g has zero within-derivative at f x0, then the selected within-derivative of g ∘ f equals the composition of selected within-derivatives.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_comp_of_hasFDerivWithinAt_zero_right
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hZeroDerivG :
HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: if g has zero within-derivative at f x0, then the matrix identity for the chain rule holds.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_hasFDerivWithinAt_zero_right
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hZeroDerivG :
HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: for g ∘ f, both the selected within-derivative and the composition of selected within-derivatives are valid within-derivatives.
theorem helperForTheorem_6_4_matrixForm_chainRule_twoHasFDerivWithinAt_witnesses
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0)) :
HasFDerivWithinAt (g ∘ f) (fderivWithin ℝ (g ∘ f) E x0) E x0 ∧
HasFDerivWithinAt (g ∘ f)
((fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) E x0
Helper for Theorem 6.4: if zero is not a within-derivative and h is within-differentiable at x0, then fderivWithin is the derivative selected by Classical.choose from that differentiability witness.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_eq_choose_of_not_hasFDerivWithinAt_zero
{n p : ℕ}
{E : Set (Fin n → ℝ)}
{h : (Fin n → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hh : DifferentiableWithinAt ℝ h E x0)
(hNotZeroDerivH :
¬ HasFDerivWithinAt h (0 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ)) E x0) :
fderivWithin ℝ h E x0 = Classical.choose hh
Helper for Theorem 6.4: when zero is not a valid within-derivative for f and g, the composition of selected within-derivatives is itself a within-derivative of g ∘ f.
theorem helperForTheorem_6_4_matrixForm_chainRule_hasFDerivWithinAt_comp_of_selectedWithinDerivatives_of_eq_choose
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hfEqChoose : fderivWithin ℝ f E x0 = Classical.choose hf)
(hgEqChoose : fderivWithin ℝ g F (f x0) = Classical.choose hg) :
HasFDerivWithinAt (g ∘ f)
((fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) E x0
Helper for Theorem 6.4: when zero is not a valid within-derivative for f and g, the composition of selected within-derivatives is itself a within-derivative of g ∘ f.
theorem helperForTheorem_6_4_matrixForm_chainRule_hasFDerivWithinAt_comp_of_selectedWithinDerivatives_of_not_hasFDerivWithinAt_zero
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0)
(hNotZeroDerivG :
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
HasFDerivWithinAt (g ∘ f)
((fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) E x0
Helper for Theorem 6.4: when zero is not a within-derivative for both f and g, the selected within-derivative of g ∘ f and the composition of the selected within-derivatives are both valid within-derivative witnesses.
theorem helperForTheorem_6_4_matrixForm_chainRule_twoHasFDerivWithinAt_witnesses_of_not_hasFDerivWithinAt_zero
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0)
(hNotZeroDerivG :
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
HasFDerivWithinAt (g ∘ f) (fderivWithin ℝ (g ∘ f) E x0) E x0 ∧
HasFDerivWithinAt (g ∘ f)
((fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) E x0
Helper for Theorem 6.4: when zero is not a within-derivative for both f and g, the selected within-derivative of g ∘ f is a valid within-derivative witness.
theorem helperForTheorem_6_4_matrixForm_chainRule_hasFDerivWithinAt_selectedWitness_of_not_hasFDerivWithinAt_zero
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0)
(hNotZeroDerivG :
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
HasFDerivWithinAt (g ∘ f) (fderivWithin ℝ (g ∘ f) E x0) E x0
Helper for Theorem 6.4: when zero is not a within-derivative for both f and g, the composition of selected within-derivatives is a valid within-derivative witness for g ∘ f.
theorem helperForTheorem_6_4_matrixForm_chainRule_hasFDerivWithinAt_compWitness_of_not_hasFDerivWithinAt_zero
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0)
(hNotZeroDerivG :
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
HasFDerivWithinAt (g ∘ f)
((fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) E x0
Helper for Theorem 6.4: if f is differentiable within E at x0 and f does not admit zero as a within-derivative there, then the selected within-derivative fderivWithin is nonzero.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_ne_zero_of_not_hasFDerivWithinAt_zero
{n m : ℕ}
{E : Set (Fin n → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{x0 : Fin n → ℝ}
(hf : DifferentiableWithinAt ℝ f E x0)
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0) :
fderivWithin ℝ f E x0 ≠ (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ))
Helper for Theorem 6.4: in the non-UniqueDiffWithinAt branch, once the selected within-derivative composition identity is available, the matrix identity follows immediately.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_from_fderivWithin_comp
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hcomp :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: if g ∘ f admits zero as a within-derivative and the composition of selected within-derivatives is also zero, then the matrix identity follows immediately.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_hasFDerivWithinAt_zero_and_comp_eq_zero
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hZeroDerivComp :
HasFDerivWithinAt (g ∘ f) (0 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ)) E x0)
(hCompZero :
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0) =
(0 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ))) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: if zero is excluded as a within-derivative for f and g, then any canonicity principle for within-derivative witnesses of g ∘ f identifies the selected within-derivative with the composed one.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_comp_of_not_hasFDerivWithinAt_zero_and_canonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0)
(hNotZeroDerivG :
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0))
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: assuming canonicity for within-derivative witnesses of g ∘ f, the selected within-derivative composition identity follows by splitting on the two zero-derivative fallback branches.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_comp_of_canonicity_by_zeroFallbackSplit
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: in the non-UniqueDiffWithinAt branch with zero within-derivatives excluded for f and g, the matrix identity follows from the same canonicity principle used to identify derivative witnesses.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_of_not_hasFDerivWithinAt_zero_and_canonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0)
(hNotZeroDerivG :
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0))
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: once canonicity for within-derivative witnesses of g ∘ f is available, the matrix identity follows by splitting on whether f or g admit the zero within-derivative at the relevant basepoints.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_of_canonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: once the two zero-derivative fallback branches are excluded, proving the non-UniqueDiffWithinAt matrix identity reduces to a canonicity statement for within-derivative witnesses of g ∘ f.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_nonzeroFallbacks_reducedToCanonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0)
(hNotZeroDerivG :
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
(∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) →
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: once the two zero-derivative fallback branches are excluded, any supplied canonicity principle for within-derivative witnesses of g ∘ f yields the non-UniqueDiffWithinAt matrix identity directly.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_nonzeroFallbacks_of_canonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotZeroDerivF :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0)
(hNotZeroDerivG :
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0))
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: a witness-form matrix identity for g ∘ f upgrades to the selected-fderivWithin matrix identity once within-derivative witnesses are canonical at x0.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_witnessForm_and_canonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hDiffComp : DifferentiableWithinAt ℝ (g ∘ f) E x0)
(hWitness :
∃ L : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L E x0 ∧
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
L.toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap)
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap6.4 — The Several Variable Calculus Chain Rule — Part 2
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Theorem 6.4: (Matrix form of the chain rule) let E ⊆ ℝⁿ and F ⊆ ℝᵐ, f : E → ℝᵐ, and g : F → ℝᵖ. Assume x₀ ∈ E, f x₀ ∈ F, f is differentiable within E at x₀, g is differentiable within F at f x₀, and f maps E into F. Assume also UniqueDiffWithinAt ℝ E x₀ so the selected within-derivative is canonical. Then g ∘ f is differentiable within E at x₀, and its within-derivative matrix satisfies D(g ∘ f)(x₀) = Dg(f(x₀)) Df(x₀).
theorem matrixForm_chainRule
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hx0 : x0 ∈ E)
(hf : DifferentiableWithinAt ℝ f E x0)
(hfx0 : f x0 ∈ F)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
DifferentiableWithinAt ℝ (g ∘ f) E x0 ∧
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: in the non-UniqueDiffWithinAt branch, if one assumes canonicity of within-derivative witnesses for g ∘ f at x0, then the matrix identity follows.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_of_assumedCanonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: in the non-UniqueDiffWithinAt branch, an assumed canonicity principle for within-derivative witnesses yields the full conclusion pair (within-set differentiability and matrix identity).
theorem helperForTheorem_6_4_matrixForm_chainRule_conclusion_of_not_uniqueDiff_of_assumedCanonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
DifferentiableWithinAt ℝ (g ∘ f) E x0 ∧
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: adding explicit pointwise canonicity for within-derivative witnesses of g ∘ f yields the full matrix-form chain-rule conclusion.
theorem helperForTheorem_6_4_matrixForm_chainRule_with_pointCanonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hPointCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
DifferentiableWithinAt ℝ (g ∘ f) E x0 ∧
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: if either f or g admits zero as a within-derivative at the relevant basepoint, the matrix identity follows from the corresponding zero-derivative fallback branch.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_hasFDerivWithinAt_zero_f_or_g
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hZeroDerivFG :
HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0 ∨
HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: in the non-UniqueDiffWithinAt branch, proving the matrix identity reduces to the residual case where neither zero-derivative fallback applies for f or g.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_by_zeroFallbackSplit
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hResidual :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0 →
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0) →
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: proving the non-UniqueDiffWithinAt matrix identity can be reduced to supplying a canonicity generator for the residual branch where both zero-derivative fallbacks are excluded.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_of_residualCanonicityGenerator
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hResidualCanonicity :
¬ HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0 →
¬ HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0) →
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: in the non-UniqueDiffWithinAt branch, proving the matrix identity is reduced to providing pointwise canonicity of within-derivative witnesses for g ∘ f at x0.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_reducedToPointCanonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0)) :
(∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) →
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: pointwise canonicity of within-derivative witnesses for g ∘ f at x0 yields equality between the selected within-derivative and the composed selected within-derivatives.
theorem helperForTheorem_6_4_matrixForm_chainRule_fderivWithin_comp_of_pointCanonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hPointCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (g ∘ f) E x0 =
(fderivWithin ℝ g F (f x0)).comp (fderivWithin ℝ f E x0)
Helper for Theorem 6.4: pointwise canonicity of within-derivative witnesses for g ∘ f at x0 yields the matrix identity directly.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_pointCanonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hPointCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: if either f has zero within-derivative at x0 or g has zero within-derivative at f x0, then the matrix identity follows from the corresponding zero-derivative branch.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_zeroDerivativeFallback
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hZeroDeriv :
HasFDerivWithinAt f (0 : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ)) E x0 ∨
HasFDerivWithinAt g (0 : (Fin m → ℝ) →L[ℝ] (Fin p → ℝ)) F (f x0)) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: remaining matrix-identity branch under ¬ UniqueDiffWithinAt ℝ E x0; this is the unresolved structural blocker.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff_of_pointCanonicity
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hPointCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: remaining matrix-identity branch under ¬ UniqueDiffWithinAt ℝ E x0, assuming a supplied pointwise canonicity principle for within-derivative witnesses of g ∘ f.
theorem helperForTheorem_6_4_matrixForm_chainRule_matrixIdentity_of_not_uniqueDiff
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hx0 : x0 ∈ E)
(hf : DifferentiableWithinAt ℝ f E x0)
(hfx0 : f x0 ∈ F)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hNotUnique : ¬ UniqueDiffWithinAt ℝ E x0)
(hPointCanonicity :
∀ L1 L2 : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L1 E x0 →
HasFDerivWithinAt (g ∘ f) L2 E x0 →
L1 = L2) :
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: with the exact hypotheses of matrixForm_chainRule and an added UniqueDiffWithinAt hypothesis, the full conclusion follows.
theorem helperForTheorem_6_4_matrixForm_chainRule_conclusion_with_uniqueDiff_mainHypotheses
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
DifferentiableWithinAt ℝ (g ∘ f) E x0 ∧
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: a repaired variant of the theorem statement that adds UniqueDiffWithinAt to ensure canonicity of within-derivatives.
theorem helperForTheorem_6_4_matrixForm_chainRule_with_uniqueDiff
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
DifferentiableWithinAt ℝ (g ∘ f) E x0 ∧
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ (g ∘ f) E x0).toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap
Helper for Theorem 6.4: a witness-form chain-rule conclusion that avoids non-canonical selection of fderivWithin for g ∘ f.
theorem helperForTheorem_6_4_matrixForm_chainRule_witnessForm
{n m p : ℕ}
{E : Set (Fin n → ℝ)}
{F : Set (Fin m → ℝ)}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{g : (Fin m → ℝ) → (Fin p → ℝ)}
{x0 : Fin n → ℝ}
(hMaps : Set.MapsTo f E F)
(hf : DifferentiableWithinAt ℝ f E x0)
(hg : DifferentiableWithinAt ℝ g F (f x0)) :
DifferentiableWithinAt ℝ (g ∘ f) E x0 ∧
∃ L : (Fin n → ℝ) →L[ℝ] (Fin p → ℝ),
HasFDerivWithinAt (g ∘ f) L E x0 ∧
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin p))
L.toLinearMap =
LinearMap.toMatrix (Pi.basisFun ℝ (Fin m)) (Pi.basisFun ℝ (Fin p))
(fderivWithin ℝ g F (f x0)).toLinearMap *
LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin m))
(fderivWithin ℝ f E x0).toLinearMap6.4 — The Several Variable Calculus Chain Rule — Part 3
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Proposition 6.10 (Product rule for gradients): if f, g : ℝⁿ → ℝ are differentiable at x, then fg is differentiable at x and ∇(fg)(x) = g(x) • ∇f(x) + f(x) • ∇g(x). If f and g are differentiable on all of ℝⁿ, then fg is differentiable on ℝⁿ and this identity holds for every point.
theorem gradient_product_rule
{n : ℕ}
{f g : EuclideanSpace ℝ (Fin n) → ℝ}
:
(∀ x : EuclideanSpace ℝ (Fin n),
DifferentiableAt ℝ f x → DifferentiableAt ℝ g x →
DifferentiableAt ℝ (fun y => f y * g y) x ∧
gradient (fun y => f y * g y) x =
g x • gradient f x + f x • gradient g x) ∧
((Differentiable ℝ f ∧ Differentiable ℝ g) →
Differentiable ℝ (fun y => f y * g y) ∧
∀ y : EuclideanSpace ℝ (Fin n),
gradient (fun z => f z * g z) y =
g y • gradient f y + f y • gradient g y)
Proposition 6.11 (Derivative of a linear map composed with a differentiable map): let E ⊆ ℝᵏ, let f : E → ℝⁿ be differentiable at x₀ ∈ E, and let T : ℝⁿ → ℝᵐ be linear. Defining (Tf)(x) = T (f x), the map Tf is differentiable at x₀, and D(Tf)(x₀) = T ∘ Df(x₀). In Lean's fderivWithin setting, this selected-derivative identity needs UniqueDiffWithinAt at (E, x0).
theorem derivative_linearMap_comp_differentiableMap
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hx0 : x0 ∈ E)
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
DifferentiableWithinAt ℝ (fun x => T (f x)) E x0 ∧
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Proposition 6.12 (Chain rule along a differentiable curve): let f : ℝⁿ → ℝᵐ be differentiable and let xⱼ : ℝ → ℝ be differentiable for j = 1, …, n. Define γ(t) = (x₁(t), …, xₙ(t)). Then f ∘ γ is differentiable, and for every t, d/dt f(γ(t)) = Df(γ(t)) γ'(t) = ∑ⱼ xⱼ'(t) ∂f/∂xⱼ (γ(t)).
theorem chainRule_along_differentiableCurve
{n m : ℕ}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{x : Fin n → ℝ → ℝ}
(hf : Differentiable ℝ f)
(hx : ∀ j : Fin n, Differentiable ℝ (x j)) :
let γ : ℝ → (Fin n → ℝ) := fun t j => x j t
Differentiable ℝ (fun t => f (γ t)) ∧
∀ t : ℝ,
deriv (fun s => f (γ s)) t = (fderiv ℝ f (γ t)) (deriv γ t) ∧
(fderiv ℝ f (γ t)) (deriv γ t) =
∑ j : Fin n, (deriv (x j) t) •
(fderiv ℝ f (γ t)) (Pi.single j (1 : ℝ))
Helper for Proposition 6.10: pointwise gradient identity for the product of two differentiable scalar functions on ℝⁿ.
lemma helperForProposition_6_10_gradientProduct_pointwiseIdentity
{n : ℕ}
{f g : EuclideanSpace ℝ (Fin n) → ℝ}
{x : EuclideanSpace ℝ (Fin n)}
(hf : DifferentiableAt ℝ f x)
(hg : DifferentiableAt ℝ g x) :
gradient (fun y => f y * g y) x =
g x • gradient f x + f x • gradient g x
Helper for Proposition 6.10: packages the pointwise differentiability and gradient product identity at a fixed point.
lemma helperForProposition_6_10_gradientProduct_pointwiseRule
{n : ℕ}
{f g : EuclideanSpace ℝ (Fin n) → ℝ}
{x : EuclideanSpace ℝ (Fin n)} :
DifferentiableAt ℝ f x → DifferentiableAt ℝ g x →
DifferentiableAt ℝ (fun y => f y * g y) x ∧
gradient (fun y => f y * g y) x =
g x • gradient f x + f x • gradient g x
Helper for Proposition 6.10: global differentiability of the product and the gradient product rule at every point.
lemma helperForProposition_6_10_gradientProduct_globalRule
{n : ℕ}
{f g : EuclideanSpace ℝ (Fin n) → ℝ} :
(Differentiable ℝ f ∧ Differentiable ℝ g) →
Differentiable ℝ (fun y => f y * g y) ∧
∀ y : EuclideanSpace ℝ (Fin n),
gradient (fun z => f z * g z) y =
g y • gradient f y + f y • gradient g y
Helper for Proposition 6.11: the chain-rule witness for composing a within-differentiable map with a linear map.
theorem helperForProposition_6_11_hasFDerivWithinAt_linearMap_comp
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
HasFDerivWithinAt (fun x => T (f x))
((LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)) E x0
Helper for Proposition 6.11: the composition with a linear map is within-differentiable at the base point.
theorem helperForProposition_6_11_differentiableWithinAt_linearMap_comp
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
DifferentiableWithinAt ℝ (fun x => T (f x)) E x0
Helper for Proposition 6.11: witness-form chain-rule statement for fun x => T (f x) within E at x0.
theorem helperForProposition_6_11_witnessForm_linearMap_comp
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
∃ L : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L E x0 ∧
L = (LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: UniqueDiffWithinAt gives pointwise canonicity of within-derivative witnesses for fun x => T (f x) at x0.
theorem helperForProposition_6_11_pointCanonicity_linearMap_comp_of_uniqueDiffWithinAt
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2
Helper for Proposition 6.11: under UniqueDiffWithinAt, the selected within derivative of fun x => T (f x) is (LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0).
theorem helperForProposition_6_11_fderivWithin_linearMap_comp_of_uniqueDiffWithinAt
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: with UniqueDiffWithinAt at x0, the composition with a linear map is within-differentiable and its selected within derivative is the composition of selected within derivatives.
theorem helperForProposition_6_11_pairResult_of_uniqueDiffWithinAt
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
DifferentiableWithinAt ℝ (fun x => T (f x)) E x0 ∧
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: a dependency-closed provable variant of the main result under UniqueDiffWithinAt at x0.
theorem helperForProposition_6_11_withUniqueDiff
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hUnique : UniqueDiffWithinAt ℝ E x0) :
DifferentiableWithinAt ℝ (fun x => T (f x)) E x0 ∧
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: if within-derivative witnesses for fun x => T (f x) are canonical at x0, then the selected within derivative is exactly (LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0).
theorem helperForProposition_6_11_fderivWithin_linearMap_comp_of_pointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hCanonicity :
∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: a zero within-derivative witness for f at x0 induces a zero within-derivative witness for fun x => T (f x).
theorem helperForProposition_6_11_hasFDerivWithinAt_zero_linearMap_comp_of_hasFDerivWithinAt_zero
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hZeroF :
HasFDerivWithinAt f
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin n)) E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
HasFDerivWithinAt (fun x => T (f x))
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m)) E x0
Helper for Proposition 6.11: if f has zero within-derivative witness at x0, then the selected within derivative of f at (E, x0) is zero.
theorem helperForProposition_6_11_fderivWithin_eq_zero_of_hasFDerivWithinAt_zero
{k n : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hZeroF :
HasFDerivWithinAt f
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin n)) E x0) :
fderivWithin ℝ f E x0 = 0
Helper for Proposition 6.11: if f has zero within-derivative witness at x0, then the selected within derivative of fun x => T (f x) at (E, x0) is zero.
theorem helperForProposition_6_11_fderivWithin_linearMap_comp_eq_zero_of_hasFDerivWithinAt_zero
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hZeroF :
HasFDerivWithinAt f
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin n)) E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
fderivWithin ℝ (fun x => T (f x)) E x0 = 0
Helper for Proposition 6.11: if f has zero within-derivative witness at x0, then the selected within derivative of fun x => T (f x) matches (LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0).
theorem helperForProposition_6_11_fderivWithin_linearMap_comp_of_hasFDerivWithinAt_zero
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hZeroF :
HasFDerivWithinAt f
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin n)) E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: in the non-UniqueDiffWithinAt branch, if either f has zero within-derivative witness at x0 or within-derivative witnesses for fun x => T (f x) are pointwise canonical, then the selected within derivative identity follows.
theorem helperForProposition_6_11_fderivWithin_linearMap_comp_of_not_uniqueDiff_of_zeroOrPointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hZeroOrCanonicity :
HasFDerivWithinAt f
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin n)) E x0 ∨
(∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2)) :
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: in the non-UniqueDiffWithinAt branch, the zero-derivative or point-canonicity alternatives imply the full conclusion pair.
theorem helperForProposition_6_11_pairResult_of_not_uniqueDiff_of_zeroOrPointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hZeroOrCanonicity :
HasFDerivWithinAt f
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin n)) E x0 ∨
(∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2)) :
DifferentiableWithinAt ℝ (fun x => T (f x)) E x0 ∧
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: negating the zero-derivative-or-point- canonicity alternative yields both residual negations.
theorem helperForProposition_6_11_not_zeroAndNotCanonicity_of_not_zeroOrPointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hNotZeroOrCanonicity :
¬ (HasFDerivWithinAt f
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin n)) E x0 ∨
(∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2))) :
(¬ HasFDerivWithinAt f
(0 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin n)) E x0) ∧
(¬ ∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2)
Helper for Proposition 6.11: in the residual branch, once pointwise canonicity of within-derivative witnesses for fun x => T (f x) is supplied, the selected within-derivative identity follows immediately.
theorem helperForProposition_6_11_fderivWithin_linearMap_comp_residual_of_pointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hCanonicity :
∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: both the selected within derivative and the chain-rule candidate provide valid within-derivative witnesses for fun x => T (f x) at (E, x0).
theorem helperForProposition_6_11_selectedAndChainRuleCandidate_hasFDerivWithinAt_linearMap_comp
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m)) :
HasFDerivWithinAt (fun x => T (f x))
(fderivWithin ℝ (fun x => T (f x)) E x0) E x0 ∧
HasFDerivWithinAt (fun x => T (f x))
((LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)) E x0
Helper for Proposition 6.11: failure of pointwise canonicity for within-derivative witnesses of fun x => T (f x) at (E, x0) yields two valid witnesses that are distinct.
theorem helperForProposition_6_11_existsUnequalWitnesses_of_notPointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hNotCanonicity :
¬ ∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
∃ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 ∧
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 ∧
L1 ≠ L2
Helper for Proposition 6.11: failure of pointwise canonicity yields a within-derivative witness distinct from the selected fderivWithin witness for fun x => T (f x) at (E, x0).
theorem helperForProposition_6_11_existsWitnessNeSelected_of_notPointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hNotCanonicity :
¬ ∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
∃ L : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L E x0 ∧
L ≠ fderivWithin ℝ (fun x => T (f x)) E x0
Helper for Proposition 6.11: in the residual non-canonical branch, one can collect the selected within-derivative witness, the chain-rule-candidate witness, and a pair of distinct within-derivative witnesses.
theorem helperForProposition_6_11_residualWitnessData_noncanonical_branch
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hNotCanonicity :
¬ ∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
HasFDerivWithinAt (fun x => T (f x))
(fderivWithin ℝ (fun x => T (f x)) E x0) E x0 ∧
HasFDerivWithinAt (fun x => T (f x))
((LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)) E x0 ∧
∃ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 ∧
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 ∧
L1 ≠ L2
Helper for Proposition 6.11: failure of pointwise canonicity yields a within-derivative witness distinct from the chain-rule candidate (LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0) for fun x => T (f x) at (E, x0).
theorem helperForProposition_6_11_existsWitnessNeChainRuleCandidate_of_notPointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hNotCanonicity :
¬ ∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
∃ L : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L E x0 ∧
L ≠ (LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: pointwise canonicity of within-derivative witnesses is incompatible with the existence of two distinct valid witnesses at (E, x0).
theorem helperForProposition_6_11_false_of_pointCanonicity_and_unequalWitnesses
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hCanonicity :
∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2)
(hUnequalWitnesses :
∃ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 ∧
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 ∧
L1 ≠ L2) :
False
Helper for Proposition 6.11: once canonicity is available for within- derivative witnesses of fun x => T (f x) at (E, x0), the selected within derivative equals the chain-rule candidate witness.
theorem helperForProposition_6_11_selectedEq_chainRuleCandidate_of_pointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hSelected :
HasFDerivWithinAt (fun x => T (f x))
(fderivWithin ℝ (fun x => T (f x)) E x0) E x0)
(hCandidate :
HasFDerivWithinAt (fun x => T (f x))
((LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)) E x0)
(hCanonicity :
∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: a residual non-canonicity hypothesis is incompatible with any asserted pointwise canonicity of within-derivative witnesses for fun x => T (f x) at (E, x0).
theorem helperForProposition_6_11_false_of_notPointCanonicity_and_pointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hNotCanonicity :
¬ ∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2)
(hCanonicity :
∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
False
Helper for Proposition 6.11: if the selected within derivative and the chain-rule candidate are both valid witnesses, then any supplied pointwise canonicity identifies them.
theorem helperForProposition_6_11_fderivWithin_linearMap_comp_of_selectedCandidate_and_pointCanonicity
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hSelectedAndCandidate :
HasFDerivWithinAt (fun x => T (f x))
(fderivWithin ℝ (fun x => T (f x)) E x0) E x0 ∧
HasFDerivWithinAt (fun x => T (f x))
((LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)) E x0)
(hCanonicity :
∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.11: in the non-UniqueDiffWithinAt workflow, once pointwise canonicity is supplied for fun x => T (f x) at (E, x0), the within-derivative identity follows.
theorem helperForProposition_6_11_fderivWithin_linearMap_comp_residual_noncanonical_branch
{k n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin k))}
{f : EuclideanSpace ℝ (Fin k) → EuclideanSpace ℝ (Fin n)}
{x0 : EuclideanSpace ℝ (Fin k)}
(hf : DifferentiableWithinAt ℝ f E x0)
(T : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin m))
(hCanonicity :
∀ L1 L2 : EuclideanSpace ℝ (Fin k) →L[ℝ] EuclideanSpace ℝ (Fin m),
HasFDerivWithinAt (fun x => T (f x)) L1 E x0 →
HasFDerivWithinAt (fun x => T (f x)) L2 E x0 →
L1 = L2) :
fderivWithin ℝ (fun x => T (f x)) E x0 =
(LinearMap.toContinuousLinearMap T).comp (fderivWithin ℝ f E x0)
Helper for Proposition 6.12: the coordinate map γ(t) = (x₁(t), …, xₙ(t)) is differentiable when each coordinate is.
lemma helperForProposition_6_12_gammaDifferentiable
{n : ℕ}
{x : Fin n → ℝ → ℝ}
(hx : ∀ j : Fin n, Differentiable ℝ (x j)) :
Differentiable ℝ (fun t : ℝ => fun j : Fin n => x j t)
Helper for Proposition 6.12: the derivative of γ is the tuple of coordinate derivatives.
lemma helperForProposition_6_12_derivGamma_apply
{n : ℕ}
{x : Fin n → ℝ → ℝ}
(hx : ∀ j : Fin n, Differentiable ℝ (x j)) :
∀ t : ℝ,
deriv (fun s : ℝ => fun j : Fin n => x j s) t =
fun j : Fin n => deriv (x j) t
Helper for Proposition 6.12: a continuous linear map on ℝⁿ applied to a vector equals the sum of its actions on coordinate basis vectors.
lemma helperForProposition_6_12_clmApply_eq_sumPiSingle
{n m : ℕ}
(L : (Fin n → ℝ) →L[ℝ] (Fin m → ℝ))
(v : Fin n → ℝ) :
L v =
∑ j : Fin n, (v j) • L (Pi.single j (1 : ℝ))
Helper for Proposition 6.12: chain-rule vector form for t ↦ f (γ(t)).
lemma helperForProposition_6_12_chainRule_vectorForm
{n m : ℕ}
{f : (Fin n → ℝ) → (Fin m → ℝ)}
{x : Fin n → ℝ → ℝ}
(hf : Differentiable ℝ f)
(hx : ∀ j : Fin n, Differentiable ℝ (x j)) :
∀ t : ℝ,
deriv (fun s => f ((fun u j => x j u) s)) t =
(fderiv ℝ f ((fun u j => x j u) t))
(deriv (fun s => fun j => x j s) t)6.5 — Double Derivatives and Clairaut's Theorem
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Definition 6.12 (Twice continuous differentiability): let E ⊆ ℝⁿ be open and f : ℝⁿ → ℝᵐ. The map f is twice continuously differentiable (class C²) on E when it is continuously differentiable on E and each first-order partial derivative map is continuously differentiable on E. We encode this with the openness hypothesis together with ContDiffOn ℝ 2 f E.
def IsTwiceContinuouslyDifferentiableOn
{n m : ℕ}
(E : Set (Fin n → ℝ))
(f : (Fin n → ℝ) → (Fin m → ℝ)) : Prop :=
IsOpen E ∧ ContDiffOn ℝ 2 f E
Theorem 6.5: (Clairaut's theorem) let E ⊆ ℝⁿ be open and let f : ℝⁿ → ℝᵐ be of class C² on E. Then for every x₀ ∈ E and all indices i, j, the mixed second partial derivatives exist and commute. Componentwise, for each ℓ, ∂²f_ℓ/(∂xⱼ ∂xᵢ) (x₀) = ∂²f_ℓ/(∂xᵢ ∂xⱼ) (x₀); equivalently, the corresponding vector-valued mixed derivatives are equal.
theorem clairaut_mixed_partials_within
{n m : ℕ}
{E : Set (EuclideanSpace ℝ (Fin n))}
{f : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin m)}
(hE : IsOpen E)
(hf : ContDiffOn ℝ 2 f E) :
∀ ⦃x₀ : EuclideanSpace ℝ (Fin n)⦄, x₀ ∈ E →
∀ i j : Fin n,
DifferentiableWithinAt ℝ
(fun x => fderivWithin ℝ f E x (EuclideanSpace.single i (1 : ℝ))) E x₀ ∧
DifferentiableWithinAt ℝ
(fun x => fderivWithin ℝ f E x (EuclideanSpace.single j (1 : ℝ))) E x₀ ∧
(∀ ℓ : Fin m,
(fderivWithin ℝ (fun x => fderivWithin ℝ f E x (EuclideanSpace.single i (1 : ℝ))) E x₀
(EuclideanSpace.single j (1 : ℝ))) ℓ
=
(fderivWithin ℝ (fun x => fderivWithin ℝ f E x (EuclideanSpace.single j (1 : ℝ))) E x₀
(EuclideanSpace.single i (1 : ℝ))) ℓ) ∧
fderivWithin ℝ (fun x => fderivWithin ℝ f E x (EuclideanSpace.single i (1 : ℝ))) E x₀
(EuclideanSpace.single j (1 : ℝ))
=
fderivWithin ℝ (fun x => fderivWithin ℝ f E x (EuclideanSpace.single j (1 : ℝ))) E x₀
(EuclideanSpace.single i (1 : ℝ))6.6 — The Contraction Mapping Theorem — Part 1
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
A self-map f : X → X is a contraction if it is 1-Lipschitz.
def IsContraction {X : Type*} [MetricSpace X] (f : X → X) : Prop :=
∀ x y : X, dist (f x) (f y) ≤ dist x y
A self-map f : X → X is a strict contraction if it has a contraction constant c with 0 < c < 1.
def IsStrictContraction {X : Type*} [MetricSpace X] (f : X → X) : Prop :=
∃ c : ℝ, 0 < c ∧ c < 1 ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y
A real number c is a contraction constant of f if 0 < c < 1 and dist (f x) (f y) ≤ c * dist x y for all x,y.
def IsContractionConstant {X : Type*} [MetricSpace X] (f : X → X) (c : ℝ) : Prop :=
0 < c ∧ c < 1 ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y
Definition 6.13 (Contraction and strict contraction): (i) f is a contraction iff dist (f x) (f y) ≤ dist x y for all x,y. (ii) f is a strict contraction iff there exists c with 0 < c < 1 such that dist (f x) (f y) ≤ c * dist x y for all x,y; such a c is a contraction constant.
theorem definition_6_13
{X : Type*} [MetricSpace X] (f : X → X) :
(IsContraction f ↔ ∀ x y : X, dist (f x) (f y) ≤ dist x y) ∧
(IsStrictContraction f ↔ ∃ c : ℝ, IsContractionConstant f c)
Proposition 6.13(1): if f : [a,b] → [a,b] is continuous on [a,b], differentiable on (a,b), and |f'| ≤ 1 on (a,b), then |f(x) - f(y)| ≤ |x - y| for all x,y ∈ [a,b]; in particular, the induced self-map of [a,b] is a non-expanding contraction.
theorem deriv_bound_one_on_interval_implies_nonexpanding
{a b : ℝ} (f : ℝ → ℝ)
(hmaps : Set.MapsTo f (Set.Icc a b) (Set.Icc a b))
(hcont : ContinuousOn f (Set.Icc a b))
(hdiff : DifferentiableOn ℝ f (Set.Ioo a b))
(hderiv : ∀ x ∈ Set.Ioo a b, |deriv f x| ≤ (1 : ℝ)) :
(∀ x ∈ Set.Icc a b, ∀ y ∈ Set.Icc a b, |f x - f y| ≤ |x - y|) ∧
IsContraction (Set.MapsTo.restrict f (Set.Icc a b) (Set.Icc a b) hmaps)
Proposition 6.14: Let f : [a,b] → ℝ be differentiable and assume |f x - f y| ≤ |x - y| for all x,y ∈ [a,b]. Then the derivative of f within [a,b] satisfies |f'(x)| ≤ 1 for all x ∈ [a,b].
theorem contraction_on_interval_implies_deriv_bound_one
{a b : ℝ} (f : ℝ → ℝ)
(hdiff : DifferentiableOn ℝ f (Set.Icc a b))
(hcontract : ∀ x ∈ Set.Icc a b, ∀ y ∈ Set.Icc a b, |f x - f y| ≤ |x - y|) :
∀ x ∈ Set.Icc a b, |derivWithin f (Set.Icc a b) x| ≤ (1 : ℝ)
Proposition 6.15: If f : X → X on a metric space satisfies dist (f x) (f y) ≤ c * dist x y for some c ∈ [0,1) and all x,y, then f is Lipschitz and therefore continuous on X.
theorem contraction_has_lipschitz_and_continuous
{X : Type*} [MetricSpace X] (f : X → X)
(hcontract : ∃ c : ℝ, 0 ≤ c ∧ c < 1 ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y) :
(∃ K : NNReal, LipschitzWith K f) ∧ Continuous f
Definition 6.14 (Fixed point): Let X be a set and let f : X → X be a map. An element x ∈ X is a fixed point of f if f x = x.
def IsFixedPoint {X : Type*} (f : X → X) (x : X) : Prop :=
f x = x
Theorem 6.7 (Contraction mapping theorem): Let (X,d) be a metric space and f : X → X satisfy dist (f x) (f y) ≤ c * dist x y for some c ∈ [0,1) and all x,y. Then f has at most one fixed point. If, in addition, X is nonempty and complete, then f has exactly one fixed point.
theorem contraction_mapping_theorem_6_7
{X : Type*} [MetricSpace X] (f : X → X)
(hstrict : ∃ c : ℝ, 0 ≤ c ∧ c < 1 ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y) :
(∀ x y : X, IsFixedPoint f x → IsFixedPoint f y → x = y) ∧
(Nonempty X → CompleteSpace X → ∃! x : X, IsFixedPoint f x)
Proposition 6.16: Let (X,d) be a complete metric space, and let f,g : X → X be strict contractions with contraction constants c,c' ∈ (0,1), respectively. If x₀ and y₀ are fixed points of f and g, and there exists ε > 0 such that dist (f x) (g x) ≤ ε for all x, then dist x₀ y₀ ≤ ε / (1 - min c c').
theorem fixed_point_distance_le_of_uniformly_close_strict_contractions
{X : Type*} [MetricSpace X] [CompleteSpace X]
(f g : X → X) (c c' : ℝ) (x0 y0 : X) (ε : ℝ)
(hf : IsContractionConstant f c)
(hg : IsContractionConstant g c')
(hx0 : IsFixedPoint f x0)
(hy0 : IsFixedPoint g y0)
(hε : 0 < ε)
(hclose : ∀ x : X, dist (f x) (g x) ≤ ε) :
dist x0 y0 ≤ ε / (1 - min c c')
Theorem 6.6 (Banach fixed-point theorem): If X is a nonempty complete metric space and f : X → X is a contraction with constant c satisfying 0 < c < 1, then f has a unique fixed point x*; moreover, for every initial point x₀, the iterates x_{n+1} = f(x_n) converge to x*.
theorem banach_fixed_point_theorem
{X : Type*} [MetricSpace X] [CompleteSpace X] [Nonempty X]
(f : X → X)
(hcontract : ∃ c : ℝ, 0 < c ∧ c < 1 ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y) :
∃ xstar : X,
IsFixedPoint f xstar ∧
(∀ y : X, IsFixedPoint f y → y = xstar) ∧
∀ x0 : X,
Filter.Tendsto (fun n : ℕ => Nat.iterate f n x0) Filter.atTop (nhds xstar)
Helper for Proposition 6.15: from a contraction witness with 0 ≤ c < 1, extract the nonnegativity and distance bound needed for Lipschitz control.
lemma helperForProposition_6_15_unpack_nonneg_bound
{X : Type*} [MetricSpace X] (f : X → X)
(hcontract : ∃ c : ℝ, 0 ≤ c ∧ c < 1 ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y) :
∃ c : ℝ, 0 ≤ c ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y
Helper for Proposition 6.15: convert a real-valued contraction estimate with c ≥ 0 into an NNReal-valued LipschitzWith bound.
lemma helperForProposition_6_15_lipschitzWith_of_real_contraction_bound
{X : Type*} [MetricSpace X] (f : X → X)
(hbound : ∃ c : ℝ, 0 ≤ c ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y) :
∃ K : NNReal, LipschitzWith K f
Helper for Proposition 6.15: any map with an NNReal Lipschitz bound is continuous.
lemma helperForProposition_6_15_continuous_of_exists_lipschitzWith
{X : Type*} [MetricSpace X] (f : X → X)
(hlip : ∃ K : NNReal, LipschitzWith K f) :
Continuous f
Helper for Theorem 6.7: convert a real-valued contraction bound with 0 ≤ c < 1 into ContractingWith with an NNReal constant.
lemma helperForTheorem_6_7_contractingWith_of_nonneg_constant
{X : Type*} [MetricSpace X] (f : X → X)
(hstrict : ∃ c : ℝ, 0 ≤ c ∧ c < 1 ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y) :
∃ K : NNReal, ContractingWith K f
Helper for Theorem 6.7: fixed points of a ContractingWith map are unique.
lemma helperForTheorem_6_7_fixedPoint_eq_of_contractingWith
{X : Type*} [MetricSpace X] {f : X → X} {K : NNReal}
(hfK : ContractingWith K f) {x y : X}
(hx : IsFixedPoint f x) (hy : IsFixedPoint f y) :
x = y
Helper for Theorem 6.7: in a nonempty complete metric space, a ContractingWith map has a unique fixed point.
lemma helperForTheorem_6_7_existsUnique_fixedPoint_of_contractingWith
{X : Type*} [MetricSpace X] [Nonempty X] [CompleteSpace X]
{f : X → X} {K : NNReal} (hfK : ContractingWith K f) :
∃! x : X, IsFixedPoint f x
Helper for Proposition 6.16: the f-centered triangle inequality and contraction bound imply dist x0 y0 ≤ ε + c * dist x0 y0.
lemma helperForProposition_6_16_dist_le_eps_add_c_mul_dist
{X : Type*} [MetricSpace X]
(f g : X → X) (c : ℝ) (x0 y0 : X) (ε : ℝ)
(hf : IsContractionConstant f c)
(hx0 : IsFixedPoint f x0)
(hy0 : IsFixedPoint g y0)
(hclose : ∀ x : X, dist (f x) (g x) ≤ ε) :
dist x0 y0 ≤ ε + c * dist x0 y0
Helper for Proposition 6.16: the g-centered triangle inequality and contraction bound imply dist x0 y0 ≤ ε + c' * dist x0 y0.
lemma helperForProposition_6_16_dist_le_eps_add_cprime_mul_dist
{X : Type*} [MetricSpace X]
(f g : X → X) (c' : ℝ) (x0 y0 : X) (ε : ℝ)
(hg : IsContractionConstant g c')
(hx0 : IsFixedPoint f x0)
(hy0 : IsFixedPoint g y0)
(hclose : ∀ x : X, dist (f x) (g x) ≤ ε) :
dist x0 y0 ≤ ε + c' * dist x0 y0
Helper for Proposition 6.16: from d ≤ ε + a*d with a < 1, one gets d ≤ ε / (1 - a).
lemma helperForProposition_6_16_le_div_one_sub_of_le_add_mul
(d ε a : ℝ) (ha1 : a < 1) (hd : d ≤ ε + a * d) :
d ≤ ε / (1 - a)
Helper for Proposition 6.16: combine the c- and c'-division bounds into the denominator 1 - min c c' by a case split on c ≤ c'.
lemma helperForProposition_6_16_min_case_finish
(d ε c c' : ℝ)
(h1 : d ≤ ε / (1 - c))
(h2 : d ≤ ε / (1 - c')) :
d ≤ ε / (1 - min c c')
Helper for Theorem 6.6: turn the real-valued contraction hypothesis into ContractingWith with an NNReal constant.
lemma helperForTheorem_6_6_contractingWith_of_real_constant
{X : Type*} [MetricSpace X] (f : X → X)
(hcontract : ∃ c : ℝ, 0 < c ∧ c < 1 ∧ ∀ x y : X, dist (f x) (f y) ≤ c * dist x y) :
∃ K : NNReal, ContractingWith K f
Helper for Theorem 6.6: the local fixed-point predicate agrees with mathlib's IsFixedPt.
lemma helperForTheorem_6_6_isFixedPoint_iff_isFixedPt
{X : Type*} (f : X → X) (x : X) :
IsFixedPoint f x ↔ Function.IsFixedPt f x
Helper for Theorem 6.6: uniqueness stated using ContractingWith.fixedPoint.
lemma helperForTheorem_6_6_unique_at_mathlib_fixedPoint
{X : Type*} [MetricSpace X] [CompleteSpace X] [Nonempty X]
{f : X → X} {K : NNReal} (hfK : ContractingWith K f) :
∀ y : X, IsFixedPoint f y → y = ContractingWith.fixedPoint f hfK
Helper for Theorem 6.6: iterates Nat.iterate f n x₀ converge to the ContractingWith.fixedPoint.
lemma helperForTheorem_6_6_tendsto_nat_iterate_fixedPoint
{X : Type*} [MetricSpace X] [CompleteSpace X] [Nonempty X]
{f : X → X} {K : NNReal} (hfK : ContractingWith K f) :
∀ x0 : X,
Filter.Tendsto (fun n : ℕ => Nat.iterate f n x0) Filter.atTop
(nhds (ContractingWith.fixedPoint f hfK))6.6 — The Contraction Mapping Theorem — Part 2
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
The origin belongs to the open ball centered at the origin with positive radius.
lemma origin_mem_ball_origin_of_pos {n : ℕ} {r : ℝ} (hr : 0 < r) :
(0 : EuclideanSpace ℝ (Fin n)) ∈ Metric.ball (0 : EuclideanSpace ℝ (Fin n)) r
Lemma 6.7: Let r > 0 and let g : B(0,r) → ℝ^n satisfy g(0) = 0 and ‖g(x) - g(y)‖ ≤ (1/2) ‖x - y‖ for all x,y ∈ B(0,r). If f(x) = x + g(x) on B(0,r), then f is injective and B(0,r/2) ⊆ f(B(0,r)).
theorem contraction_perturbation_injective_and_ball_half_subset_range
{n : ℕ} {r : ℝ}
(hr : 0 < r)
(g : Metric.ball (0 : EuclideanSpace ℝ (Fin n)) r → EuclideanSpace ℝ (Fin n))
(hzero : g ⟨0, origin_mem_ball_origin_of_pos hr⟩ = 0)
(hcontract :
∀ x y : Metric.ball (0 : EuclideanSpace ℝ (Fin n)) r,
‖g x - g y‖ ≤ (1 / 2 : ℝ) * ‖(x : EuclideanSpace ℝ (Fin n)) - (y : EuclideanSpace ℝ (Fin n))‖) :
Function.Injective
(fun x : Metric.ball (0 : EuclideanSpace ℝ (Fin n)) r =>
(x : EuclideanSpace ℝ (Fin n)) + g x) ∧
Metric.ball (0 : EuclideanSpace ℝ (Fin n)) (r / 2) ⊆
Set.range
(fun x : Metric.ball (0 : EuclideanSpace ℝ (Fin n)) r =>
(x : EuclideanSpace ℝ (Fin n)) + g x)6.6 — The Contraction Mapping Theorem — Part 3
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Proposition 6.13(2): if f : [a,b] → [a,b] is differentiable, f' is continuous on [a,b], and |f'(x)| < 1 for all x ∈ [a,b], then there exists c ∈ (0,1) such that |f(x) - f(y)| ≤ c * |x - y| for all x,y ∈ [a,b]. In particular, the induced self-map of [a,b] is a strict contraction for the metric d(x,y) = |x - y|.
theorem deriv_strict_bound_on_interval_implies_strict_contraction
{a b : ℝ} (f : ℝ → ℝ)
(_hmaps : Set.MapsTo f (Set.Icc a b) (Set.Icc a b))
(hdiff : DifferentiableOn ℝ f (Set.Icc a b))
(hcontDeriv : ContinuousOn (derivWithin f (Set.Icc a b)) (Set.Icc a b))
(hderiv_lt_one : ∀ x ∈ Set.Icc a b, |derivWithin f (Set.Icc a b) x| < (1 : ℝ)) :
∃ c : ℝ, 0 < c ∧ c < 1 ∧
∀ x ∈ Set.Icc a b, ∀ y ∈ Set.Icc a b, |f x - f y| ≤ c * |x - y|
Helper for Proposition 6.13(2): continuity of derivWithin and the pointwise bound |derivWithin| < 1 on Icc a b imply a uniform constant c0 < 1 with ‖derivWithin f (Icc a b) x‖ ≤ c0 on Icc a b.
lemma helperForProposition_6_13_2_uniformDerivWithinNormUpperBound
{a b : ℝ} (f : ℝ → ℝ)
(hcontDeriv : ContinuousOn (derivWithin f (Set.Icc a b)) (Set.Icc a b))
(hderiv_lt_one : ∀ x ∈ Set.Icc a b, |derivWithin f (Set.Icc a b) x| < (1 : ℝ)) :
∃ c0 : ℝ, c0 < 1 ∧
∀ x ∈ Set.Icc a b, ‖derivWithin f (Set.Icc a b) x‖ ≤ c0
Helper for Proposition 6.13(2): from a strict upper bound c0 < 1 on ‖derivWithin f (Icc a b) x‖, build a positive contraction constant c ∈ (0,1).
lemma helperForProposition_6_13_2_positiveContractionConstant
{a b : ℝ} (f : ℝ → ℝ) {c0 : ℝ}
(hc0_lt_one : c0 < 1)
(hbound : ∀ x ∈ Set.Icc a b, ‖derivWithin f (Set.Icc a b) x‖ ≤ c0) :
∃ c : ℝ, 0 < c ∧ c < 1 ∧
∀ x ∈ Set.Icc a b, ‖derivWithin f (Set.Icc a b) x‖ ≤ c
Helper for Proposition 6.13(2): a uniform bound on ‖derivWithin f (Icc a b) x‖ implies the Lipschitz estimate |f x - f y| ≤ c * |x - y| on Icc a b.
lemma helperForProposition_6_13_2_absDifferenceBoundFromDerivWithinBound
{a b : ℝ} (f : ℝ → ℝ)
(hdiff : DifferentiableOn ℝ f (Set.Icc a b))
{c : ℝ}
(hderiv_le : ∀ z ∈ Set.Icc a b, ‖derivWithin f (Set.Icc a b) z‖ ≤ c) :
∀ x ∈ Set.Icc a b, ∀ y ∈ Set.Icc a b, |f x - f y| ≤ c * |x - y|6.7 — The Inverse Function Theorem in Several Variable Calculus
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Lemma 6.8: if T : ℝ^n → ℝ^n is a bijective linear transformation, then its inverse map is also linear.
lemma linear_inverse_of_bijective_linear_map
{n : ℕ}
(T : (Fin n → ℝ) →ₗ[ℝ] (Fin n → ℝ))
(hT : Function.Bijective T) :
∃ Tinv : (Fin n → ℝ) →ₗ[ℝ] (Fin n → ℝ),
(∀ x, Tinv (T x) = x) ∧ ∀ y, T (Tinv y) = y
Theorem 6.9 (Inverse function theorem in one variable): let f : ℝ → ℝ be injective and differentiable on an open interval I, let x₀ ∈ I and set y₀ = f x₀. Assume deriv f x₀ ≠ 0, and suppose g is the inverse of f on an open interval J containing y₀ (so g (f x) = x for x ∈ I and f (g y) = y for y ∈ J). Then g is differentiable at y₀ and deriv g y₀ = 1 / deriv f x₀.
theorem inverse_function_theorem_one_variable_6_9
(f g : ℝ → ℝ) (I J : Set ℝ) (x0 : ℝ)
(hinj : Set.InjOn f I)
(hI_open : IsOpen I)
(hI_interval : Convex ℝ I)
(hx0 : x0 ∈ I)
(hdiff : DifferentiableOn ℝ f I)
(hderiv_ne : deriv f x0 ≠ 0)
(hJ_open : IsOpen J)
(hJ_interval : Convex ℝ J)
(hy0 : f x0 ∈ J)
(hMapsInv : Set.MapsTo g J I)
(hleft : ∀ ⦃x⦄, x ∈ I → f x ∈ J → g (f x) = x)
(hright : Set.RightInvOn g f J) :
DifferentiableAt ℝ g (f x0) ∧ deriv g (f x0) = 1 / deriv f x0
Definition 6.15 (Local invertibility): a function f : ℝ → ℝ is locally invertible near x₀ if there exist open intervals (a, b) and (c, d) with x₀ ∈ (a, b) and f x₀ ∈ (c, d) such that the restriction f|(a,b) : (a,b) → (c,d) is a bijection.
def LocallyInvertibleNear (f : ℝ → ℝ) (x0 : ℝ) : Prop :=
∃ a b c d : ℝ,
a < x0 ∧ x0 < b ∧ c < f x0 ∧ f x0 < d ∧
Set.BijOn f (Set.Ioo a b) (Set.Ioo c d)
Theorem 6.10 (Inverse Function Theorem): let E ⊆ ℝ^n be open and let f : E → ℝ^n be continuously differentiable on E. If x₀ ∈ E and f'(x₀) is invertible (encoded by fderiv ℝ f x₀ = f₀ for a linear equivalence f₀), then there exist open sets U ⊆ E and V ⊆ ℝ^n with x₀ ∈ U and f x₀ ∈ V such that f restricts to a bijection U → V with inverse g : V → U. Moreover, g is differentiable at y₀ = f x₀ and fderiv ℝ g y₀ = (f'(x₀))⁻¹.
theorem inverse_function_theorem_several_variables_6_10
{n : ℕ}
{E : Set (Fin n → ℝ)}
{f : (Fin n → ℝ) → (Fin n → ℝ)}
{x0 : Fin n → ℝ}
(hE_open : IsOpen E)
(hcont : ContDiffOn ℝ 1 f E)
(hx0 : x0 ∈ E)
(f0 : (Fin n → ℝ) ≃L[ℝ] (Fin n → ℝ))
(hderiv : fderiv ℝ f x0 = (f0 : (Fin n → ℝ) →L[ℝ] (Fin n → ℝ))) :
∃ U V : Set (Fin n → ℝ),
IsOpen U ∧ IsOpen V ∧ x0 ∈ U ∧ U ⊆ E ∧ f x0 ∈ V ∧
Set.BijOn f U V ∧
∃ g : (Fin n → ℝ) → (Fin n → ℝ),
Set.MapsTo g V U ∧ Set.LeftInvOn g f U ∧ Set.RightInvOn g f V ∧
DifferentiableAt ℝ g (f x0) ∧
fderiv ℝ g (f x0) =
((f0.symm : (Fin n → ℝ) ≃L[ℝ] (Fin n → ℝ)) :
(Fin n → ℝ) →L[ℝ] (Fin n → ℝ))
Helper for Theorem 6.9: obtain HasDerivAt f (deriv f x0) x0 from differentiability of f on an open set containing x0.
lemma helperForTheorem_6_9_hasDerivAt_f_at_x0
(f : ℝ → ℝ) (I : Set ℝ) (x0 : ℝ)
(hI_open : IsOpen I)
(hx0 : x0 ∈ I)
(hdiff : DifferentiableOn ℝ f I) :
HasDerivAt f (deriv f x0) x0
Helper for Theorem 6.9: f (g y) = y holds in a neighborhood of f x0 because it holds on the open interval J containing f x0.
lemma helperForTheorem_6_9_eventually_right_inverse_near_y0
(f g : ℝ → ℝ) (J : Set ℝ) (x0 : ℝ)
(hJ_open : IsOpen J)
(hy0 : f x0 ∈ J)
(hright : Set.RightInvOn g f J) :
∀ᶠ y in nhds (f x0), f (g y) = y
Helper for Theorem 6.9: choose a closed interval around x0 contained in I, and mapped by f into J.
lemma helperForTheorem_6_9_localIntervalWithinIAndPreimageJ
(f : ℝ → ℝ) (I J : Set ℝ) (x0 : ℝ)
(hI_open : IsOpen I)
(hx0 : x0 ∈ I)
(hJ_open : IsOpen J)
(hy0 : f x0 ∈ J)
(hdiff : DifferentiableOn ℝ f I) :
∃ p q : ℝ,
p < x0 ∧ x0 < q ∧
Set.Icc p q ⊆ I ∧ Set.MapsTo f (Set.Icc p q) J
Helper for Theorem 6.9: on the local closed interval, injective continuous f is either strictly increasing or strictly decreasing.
lemma helperForTheorem_6_9_strictOrderOnLocalInterval
(f : ℝ → ℝ) (I : Set ℝ) (p q : ℝ)
(hpq : p ≤ q)
(hinj : Set.InjOn f I)
(hIcc_subset_I : Set.Icc p q ⊆ I)
(hdiff : DifferentiableOn ℝ f I) :
StrictMonoOn f (Set.Icc p q) ∨ StrictAntiOn f (Set.Icc p q)
Helper for Theorem 6.9: the local image f '' Icc p q is a neighborhood of f x0.
lemma helperForTheorem_6_9_localImageNeighborhoodAt_y0
(f : ℝ → ℝ) (p q x0 : ℝ)
(hpx0 : p < x0)
(hx0q : x0 < q)
(hcontIcc : ContinuousOn f (Set.Icc p q))
(horder : StrictMonoOn f (Set.Icc p q) ∨ StrictAntiOn f (Set.Icc p q)) :
f '' Set.Icc p q ∈ nhds (f x0)
Helper for Theorem 6.9: order behavior of g on the local image, together with the neighborhood property of g '' (f '' Icc p q).
lemma helperForTheorem_6_9_orderBehaviorOf_g_on_localImage
(f g : ℝ → ℝ) (I J : Set ℝ) (x0 p q : ℝ)
(hpx0 : p < x0)
(hx0q : x0 < q)
(hIcc_subset_I : Set.Icc p q ⊆ I)
(hMaps_f : Set.MapsTo f (Set.Icc p q) J)
(hleft : ∀ ⦃x⦄, x ∈ I → f x ∈ J → g (f x) = x)
(hright : Set.RightInvOn g f J)
(horder : StrictMonoOn f (Set.Icc p q) ∨ StrictAntiOn f (Set.Icc p q)) :
(MonotoneOn g (f '' Set.Icc p q) ∨ AntitoneOn g (f '' Set.Icc p q)) ∧
g '' (f '' Set.Icc p q) ∈ nhds x0
Helper for Theorem 6.9: continuity of the inverse branch g at f x0.
lemma helperForTheorem_6_9_continuousAt_g_at_y0
(f g : ℝ → ℝ) (I J : Set ℝ) (x0 : ℝ)
(hinj : Set.InjOn f I)
(hI_open : IsOpen I)
(hI_interval : Convex ℝ I)
(hx0 : x0 ∈ I)
(hdiff : DifferentiableOn ℝ f I)
(hJ_open : IsOpen J)
(hy0 : f x0 ∈ J)
(hMapsInv : Set.MapsTo g J I)
(hleft : ∀ ⦃x⦄, x ∈ I → f x ∈ J → g (f x) = x)
(hright : Set.RightInvOn g f J) :
ContinuousAt g (f x0)
Helper for Theorem 6.9: derivative of the inverse branch at y0 = f x0.
lemma helperForTheorem_6_9_hasDerivAt_g_at_y0
(f g : ℝ → ℝ) (I J : Set ℝ) (x0 : ℝ)
(hinj : Set.InjOn f I)
(hI_open : IsOpen I)
(hI_interval : Convex ℝ I)
(hx0 : x0 ∈ I)
(hdiff : DifferentiableOn ℝ f I)
(hderiv_ne : deriv f x0 ≠ 0)
(hJ_open : IsOpen J)
(hy0 : f x0 ∈ J)
(hMapsInv : Set.MapsTo g J I)
(hleft : ∀ ⦃x⦄, x ∈ I → f x ∈ J → g (f x) = x)
(hright : Set.RightInvOn g f J) :
HasDerivAt g (deriv f x0)⁻¹ (f x0)6.8 — The Implicit Function Theorem
Lean authors: Zichen Wang, Wanli Ma, Yi Yuan, Zaiwen Wen.
Compatibility reconstruction of the pre-4.30 implicit-function data, preserving the (x, f x) target-coordinate order used by this chapter.
namespace IsContDiffImplicitAt
def implicitFunctionData
{𝕜 : Type*} [RCLike 𝕜]
{E F G : Type*}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F]
[NormedAddCommGroup G] [NormedSpace 𝕜 G] [CompleteSpace G]
{n : WithTop ℕ∞} {f : E × F → G} {f' : E × F →L[𝕜] G} {a : E × F}
(h : IsContDiffImplicitAt n f f' a) :
ImplicitFunctionData 𝕜 (E × F) E G
Definition 6.16 (Graph of a function): for f : ℝ^n → ℝ, the graph of f is the subset {(x, f x) : x ∈ ℝ^n} of ℝ^(n+1).
def graphOfFunction {n : ℕ} (f : (Fin n → ℝ) → ℝ) : Set (Fin (n + 1) → ℝ) :=
Set.range (fun x => Fin.snoc x (f x))
Definition 6.17 (Vertical line test): a subset S ⊆ ℝ² is the graph of some function f : ℝ → ℝ if and only if for every x : ℝ there exists a unique y : ℝ such that (x, y) ∈ S.
theorem verticalLineTest (S : Set (ℝ × ℝ)) :
(∃ f : ℝ → ℝ, S = Set.range (fun x => (x, f x))) ↔
∀ x : ℝ, ∃! y : ℝ, (x, y) ∈ S
Definition 6.18 (Hypersurface defined by an equation): for g : ℝ^n → ℝ, the hypersurface (level set) defined by g is Z(g) = {x ∈ ℝ^n | g x = 0}.
def hypersurfaceDefinedBy (n : ℕ) (g : (Fin n → ℝ) → ℝ) : Set (Fin n → ℝ) :=
{x | g x = 0}
Definition 6.19 (Critical point): for a differentiable function f : ℝ^n → ℝ, a point x₀ is a critical point of f when ∇ f(x₀) = 0. In finite-dimensional coordinates, this is expressed as differentiability at x₀ and vanishing Fréchet derivative there.
def IsCriticalPoint {n : ℕ} (f : (Fin n → ℝ) → ℝ) (x₀ : Fin n → ℝ) : Prop :=
DifferentiableAt ℝ f x₀ ∧ fderiv ℝ f x₀ = 0
The coordinate-direction derivative of a scalar function on ℝ^n within a set.
noncomputable def partialDerivWithin {n : ℕ} (f : (Fin n → ℝ) → ℝ) (s : Set (Fin n → ℝ))
(x : Fin n → ℝ) (i : Fin n) : ℝ :=
(fderivWithin ℝ f s x) (Pi.single i 1)
Theorem 6.11 (Implicit function theorem): in ambient coordinates (x', x_{n+1}) ∈ ℝ^(n+1) (corresponding to the book's ℝ^n after reindexing), if E ⊆ ℝ^(n+1) is open, f is continuously differentiable on E, f (y', yLast) = 0, and ∂f/∂x_{n+1} (y', yLast) ≠ 0, then there are open sets U, V with (y', yLast) ∈ V, y' ∈ U, and a C^1 function g whose graph over U cuts out the zero set of f in V; moreover this g is unique on U and satisfies the usual derivative quotient formula in each x'-direction.
theorem implicitFunctionTheorem
(n : ℕ)
(E : Set (Fin (n + 1) → ℝ))
(f : (Fin (n + 1) → ℝ) → ℝ)
(y' : Fin n → ℝ)
(yLast : ℝ)
(hEopen : IsOpen E)
(hf : ContDiffOn ℝ 1 f E)
(hy : Fin.snoc y' yLast ∈ E)
(hyZero : f (Fin.snoc y' yLast) = 0)
(hpartial : partialDerivWithin f E (Fin.snoc y' yLast) (Fin.last n) ≠ 0) :
∃ U : Set (Fin n → ℝ),
IsOpen U ∧ y' ∈ U ∧
∃ V : Set (Fin (n + 1) → ℝ),
IsOpen V ∧ Fin.snoc y' yLast ∈ V ∧ V ⊆ E ∧
let A : ((Fin n → ℝ) → ℝ) → Prop := fun g =>
g y' = yLast ∧
{x | x ∈ V ∧ f x = 0} = (fun x' => Fin.snoc x' (g x')) '' U;
let B : ((Fin n → ℝ) → ℝ) → Prop := fun g =>
ContDiffOn ℝ 1 g U ∧
∀ x' ∈ U, ∀ j : Fin n,
partialDerivWithin g U x' j =
-(
partialDerivWithin f E (Fin.snoc x' (g x')) (Fin.castSucc j) /
partialDerivWithin f E (Fin.snoc x' (g x')) (Fin.last n)
);
∃ g : (Fin n → ℝ) → ℝ,
A g ∧ B g ∧
∀ g2 : (Fin n → ℝ) → ℝ,
A g2 → ∀ x' ∈ U, g2 x' = g x'
Proposition 6.17 (Implicit differentiation for an implicit constraint): in ambient coordinates with m free variables and one dependent coordinate (book's n = m + 1), if f : ℝ^(m+1) → ℝ and g : ℝ^m → ℝ are differentiable on open sets U and V, a ∈ U satisfies f a = 0 and nonvanishing last partial derivative at a, and f (x, g x) = 0 for all x ∈ V with (x, g x) ∈ U, then for each coordinate j and each x ∈ V one has ∂ⱼ f(x, g x) + ∂ₘ₊₁ f(x, g x) * ∂ⱼ g(x) = 0; equivalently, ∂ⱼ g(x) = -(∂ⱼ f(x, g x)) / (∂ₘ₊₁ f(x, g x)) whenever ∂ₘ₊₁ f(x, g x) ≠ 0.
theorem implicitDifferentiationForImplicitConstraint
(m : ℕ)
(U : Set (Fin (m + 1) → ℝ))
(f : (Fin (m + 1) → ℝ) → ℝ)
(V : Set (Fin m → ℝ))
(g : (Fin m → ℝ) → ℝ)
(hf : DifferentiableOn ℝ f U)
(hVopen : IsOpen V)
(hg : DifferentiableOn ℝ g V)
(hgraph : ∀ x ∈ V, Fin.snoc x (g x) ∈ U)
(hconstraint : ∀ x ∈ V, f (Fin.snoc x (g x)) = 0) :
(∀ j : Fin m, ∀ x ∈ V,
partialDerivWithin f U (Fin.snoc x (g x)) (Fin.castSucc j) +
partialDerivWithin f U (Fin.snoc x (g x)) (Fin.last m) *
partialDerivWithin g V x j =
0) ∧
∀ j : Fin m, ∀ x ∈ V,
partialDerivWithin f U (Fin.snoc x (g x)) (Fin.last m) ≠ 0 →
partialDerivWithin g V x j =
-(partialDerivWithin f U (Fin.snoc x (g x)) (Fin.castSucc j)) /
partialDerivWithin f U (Fin.snoc x (g x)) (Fin.last m)
Definition 6.20 (Regular level set as a local graph): with ambient coordinates ℝ^(m+1) (so the book's ambient dimension parameter is n = m + 1), let f : ℝ^(m+1) → ℝ be continuously differentiable and let x₀ satisfy f x₀ = 0. If some coordinate partial derivative of f at x₀ is nonzero, then locally near x₀ the zero level set {x | f x = 0} is the graph of a differentiable function g : ℝ^m → ℝ, matching the book's ℝ^(n-1) parameter space.
theorem regularLevelSetAsLocalGraph
(m : ℕ)
(f : (Fin (m + 1) → ℝ) → ℝ)
(x₀ : Fin (m + 1) → ℝ)
(hf : ContDiff ℝ 1 f)
(hx₀ : f x₀ = 0) :
(∃ j : Fin (m + 1), partialDerivWithin f Set.univ x₀ j ≠ 0) →
∃ j : Fin (m + 1),
partialDerivWithin f Set.univ x₀ j ≠ 0 ∧
∃ U : Set (Fin m → ℝ),
IsOpen U ∧
∃ W : Set (Fin (m + 1) → ℝ),
IsOpen W ∧ x₀ ∈ W ∧
∃ g : (Fin m → ℝ) → ℝ,
DifferentiableOn ℝ g U ∧
{x | x ∈ W ∧ f x = 0} = (fun x' => j.insertNth (g x') x') '' U
Helper for Theorem 6.11: a continuous linear map ℝ →L[ℝ] ℝ is bijective if it is nonzero at 1.
lemma helperForTheorem_6_11_realLinearMap_bijective_of_map_one_ne_zero
(L : ℝ →L[ℝ] ℝ) (hL : L 1 ≠ 0) : Function.Bijective L
Helper for Theorem 6.11: convert the nonvanishing within-partial at the base point to the ambient Fréchet derivative coordinate being nonzero.
lemma helperForTheorem_6_11_lastPartial_ne_zero_fderiv
{n : ℕ}
{E : Set (Fin (n + 1) → ℝ)}
{f : (Fin (n + 1) → ℝ) → ℝ}
{y' : Fin n → ℝ}
{yLast : ℝ}
(hEopen : IsOpen E)
(hf : ContDiffOn ℝ 1 f E)
(hy : Fin.snoc y' yLast ∈ E)
(hpartial : partialDerivWithin f E (Fin.snoc y' yLast) (Fin.last n) ≠ 0) :
(fderiv ℝ f (Fin.snoc y' yLast)) (Pi.single (Fin.last n) 1) ≠ 0
Helper for Theorem 6.11: graph equality determines the implicit function uniquely on U.
lemma helperForTheorem_6_11_uniqueness_from_graph_equality
{n : ℕ}
{f : (Fin (n + 1) → ℝ) → ℝ}
{U : Set (Fin n → ℝ)}
{V : Set (Fin (n + 1) → ℝ)}
{g g2 : (Fin n → ℝ) → ℝ}
(hA : {x | x ∈ V ∧ f x = 0} = (fun x' => Fin.snoc x' (g x')) '' U)
(hA2 : {x | x ∈ V ∧ f x = 0} = (fun x' => Fin.snoc x' (g2 x')) '' U) :
∀ x' ∈ U, g2 x' = g x'
Helper for Proposition 6.17: turn the pointwise constraint on V into an eventual equality with the constant zero function within V.
lemma helperForProposition_6_17_constraintEventuallyEqZero
{m : ℕ}
{V : Set (Fin m → ℝ)}
{f : (Fin (m + 1) → ℝ) → ℝ}
{g : (Fin m → ℝ) → ℝ}
{x : Fin m → ℝ}
(hconstraint : ∀ z ∈ V, f (Fin.snoc z (g z)) = 0) :
(fun z : Fin m → ℝ => f (Fin.snoc z (g z))) =ᶠ[nhdsWithin x V] (fun _ => (0 : ℝ))
Helper for Proposition 6.17: the derivative of the map z ↦ (z, g z) within V.
noncomputable def helperForProposition_6_17_DGx
{m : ℕ}
(g : (Fin m → ℝ) → ℝ)
(V : Set (Fin m → ℝ))
(x : Fin m → ℝ) :
(Fin m → ℝ) →L[ℝ] (Fin (m + 1) → ℝ) :=
ContinuousLinearMap.pi (fun i : Fin (m + 1) =>
Fin.lastCases (fderivWithin ℝ g V x) (fun k : Fin m => ContinuousLinearMap.proj k) i)
Helper for Proposition 6.17: chain-rule derivative for the constrained composition z ↦ f (z, g z) within V.
lemma helperForProposition_6_17_compositionHasFDerivWithinAt
{m : ℕ}
{U : Set (Fin (m + 1) → ℝ)}
{V : Set (Fin m → ℝ)}
{f : (Fin (m + 1) → ℝ) → ℝ}
{g : (Fin m → ℝ) → ℝ}
{x : Fin m → ℝ}
(hx : x ∈ V)
(hf : DifferentiableOn ℝ f U)
(hg : DifferentiableOn ℝ g V)
(hgraph : ∀ z ∈ V, Fin.snoc z (g z) ∈ U) :
HasFDerivWithinAt (fun z : Fin m → ℝ => f (Fin.snoc z (g z)))
((fderivWithin ℝ f U (Fin.snoc x (g x))).comp (helperForProposition_6_17_DGx g V x)) V x
Helper for Proposition 6.17: evaluate DGx on the jth basis vector.
lemma helperForProposition_6_17_DGxApplyBasis
{m : ℕ}
{V : Set (Fin m → ℝ)}
{g : (Fin m → ℝ) → ℝ}
{x : Fin m → ℝ}
(j : Fin m) :
helperForProposition_6_17_DGx g V x (Pi.single j (1 : ℝ)) =
Fin.snoc (Pi.single j (1 : ℝ)) (partialDerivWithin g V x j)
Helper for Proposition 6.17: decompose Fin.snoc of a basis direction into the castSucc and last coordinate basis vectors.
lemma helperForProposition_6_17_snocBasisDecomposition
{m : ℕ}
{V : Set (Fin m → ℝ)}
{g : (Fin m → ℝ) → ℝ}
{x : Fin m → ℝ}
(j : Fin m) :
Fin.snoc (Pi.single j (1 : ℝ)) (partialDerivWithin g V x j) =
((Pi.single (Fin.castSucc j) (1 : ℝ) : Fin (m + 1) → ℝ)) +
(partialDerivWithin g V x j) •
(Pi.single (Fin.last m) (1 : ℝ) : Fin (m + 1) → ℝ)
Helper for Proposition 6.17: linear identity obtained by differentiating the constraint f (x, g x) = 0 within V.
lemma helperForProposition_6_17_linearIdentity
{m : ℕ}
{U : Set (Fin (m + 1) → ℝ)}
{V : Set (Fin m → ℝ)}
{f : (Fin (m + 1) → ℝ) → ℝ}
{g : (Fin m → ℝ) → ℝ}
(hVopen : IsOpen V)
(hf : DifferentiableOn ℝ f U)
(hg : DifferentiableOn ℝ g V)
(hgraph : ∀ z ∈ V, Fin.snoc z (g z) ∈ U)
(hconstraint : ∀ z ∈ V, f (Fin.snoc z (g z)) = 0)
(j : Fin m)
(x : Fin m → ℝ)
(hx : x ∈ V) :
partialDerivWithin f U (Fin.snoc x (g x)) (Fin.castSucc j) +
partialDerivWithin f U (Fin.snoc x (g x)) (Fin.last m) * partialDerivWithin g V x j =
0
Helper for Proposition 6.17: solve A + B*C = 0 for C when B ≠ 0.
lemma helperForProposition_6_17_solveForPartialG
(A B C : ℝ)
(hLinear : A + B * C = 0)
(hB : B ≠ 0) :
C = -A / B