/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This file has been modified. -/ import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.Normed.Module.Alternating.Uncurry.Fin import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.Analysis.Calculus.FDeriv.Pi /-! # Normed Space Wedge Covectors -/ namespace OAI.Analysis.Foundations.NormedSpaceWedgeCovectors.ContinuousAlternatingMap noncomputable section open _root_.ContinuousAlternatingMap /-! # Wedge products of continuous covectors The wedge of continuous linear functionals on a normed space is the alternating form whose value on a family of vectors is the determinant of the matrix of pairings. This file builds it by alternatizing the covector product, proves the determinant formula, and derives the multilinearity and alternation properties in each covector slot. On `ΞΉ' β†’ π•œ` the coordinate projections wedge to the standard volume form, and every continuous alternating form is a finite combination of wedges of coordinate projections. The coefficients in that expansion are continuous linear functionals of the form, so a form depending analytically on a parameter has analytic coefficients. -/ variable {π•œ E : Type*} [NontriviallyNormedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] variable {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] variable (π•œ E) in /-- The wedge of continuous linear functionals, built by alternatization. -/ def wedgeCovectors (L : ΞΉ β†’ E β†’L[π•œ] π•œ) : E [β‹€^ΞΉ]β†’L[π•œ] π•œ := ContinuousMultilinearMap.alternatization ((ContinuousMultilinearMap.mkPiAlgebra π•œ ΞΉ π•œ).compContinuousLinearMap L) /-- Evaluation of a wedge of covectors is the determinant of their pairing matrix. -/ lemma wedgeCovectors_apply_eq_det (L : ΞΉ β†’ E β†’L[π•œ] π•œ) (v : ΞΉ β†’ E) : wedgeCovectors π•œ E L v = Matrix.det (Matrix.of (fun i j ↦ L i (v j))) := by rw [wedgeCovectors, ContinuousMultilinearMap.alternatization_apply_apply, ← Matrix.det_transpose, Matrix.det_apply] refine Finset.sum_congr rfl fun Οƒ _ ↦ ?_ simp /-- For an empty index type, the wedge of covectors is the constant form `1`. -/ @[simp] lemma wedgeCovectors_of_isEmpty [IsEmpty ΞΉ] (L : ΞΉ β†’ E β†’L[π•œ] π•œ) : wedgeCovectors π•œ E L = ContinuousAlternatingMap.constOfIsEmpty π•œ E ΞΉ 1 := ContinuousAlternatingMap.ext fun _ ↦ by simp [wedgeCovectors_apply_eq_det] /-- In degree zero, the wedge of covectors is the constant form `1`. -/ lemma wedgeCovectors_zero (L : Fin 0 β†’ E β†’L[π•œ] π•œ) : wedgeCovectors π•œ E L = ContinuousAlternatingMap.constOfIsEmpty π•œ E (Fin 0) 1 := wedgeCovectors_of_isEmpty L /-- Expanding a wedge along the first covector gives an alternatizing uncurry. -/ lemma wedgeCovectors_succ (p : β„•) (L : Fin (p + 1) β†’ E β†’L[π•œ] π•œ) : wedgeCovectors π•œ E L = ContinuousAlternatingMap.alternatizeUncurryFin (ContinuousLinearMap.smulRight (L 0) (wedgeCovectors π•œ E (fun i ↦ L i.succ))) := by refine ContinuousAlternatingMap.ext fun v ↦ ?_ rw [wedgeCovectors_apply_eq_det, ContinuousAlternatingMap.alternatizeUncurryFin_apply, Matrix.det_succ_row_zero] refine Finset.sum_congr rfl fun j _ ↦ ?_ simp only [ContinuousLinearMap.smulRight_apply, Matrix.of_apply, zsmul_eq_mul, Int.cast_pow, Int.cast_neg, Int.cast_one, ContinuousAlternatingMap.smul_apply, smul_eq_mul] rw [wedgeCovectors_apply_eq_det, mul_assoc] congr 2 /-- The wedge construction is additive in each covector. -/ lemma wedgeCovectors_update_add (L : ΞΉ β†’ E β†’L[π•œ] π•œ) (i : ΞΉ) (a b : E β†’L[π•œ] π•œ) : wedgeCovectors π•œ E (Function.update L i (a + b)) = wedgeCovectors π•œ E (Function.update L i a) + wedgeCovectors π•œ E (Function.update L i b) := by refine ContinuousAlternatingMap.ext fun v ↦ ?_ simp only [ContinuousAlternatingMap.add_apply, wedgeCovectors_apply_eq_det] have h (x : E β†’L[π•œ] π•œ) : Matrix.of (fun k j ↦ (Function.update L i x) k (v j)) = (Matrix.of (fun k j ↦ L k (v j))).updateRow i (fun j ↦ x (v j)) := by ext k j; obtain rfl | h := eq_or_ne k i <;> simp [*] rw [h (a + b), h a, h b] exact Matrix.det_updateRow_add _ i _ _ /-- The wedge construction is homogeneous in each covector. -/ lemma wedgeCovectors_update_smul (L : ΞΉ β†’ E β†’L[π•œ] π•œ) (i : ΞΉ) (c : π•œ) (a : E β†’L[π•œ] π•œ) : wedgeCovectors π•œ E (Function.update L i (c β€’ a)) = c β€’ wedgeCovectors π•œ E (Function.update L i a) := by refine ContinuousAlternatingMap.ext fun v ↦ ?_ simp only [ContinuousAlternatingMap.smul_apply, wedgeCovectors_apply_eq_det] have h (x : E β†’L[π•œ] π•œ) : Matrix.of (fun k j ↦ (Function.update L i x) k (v j)) = (Matrix.of (fun k j ↦ L k (v j))).updateRow i (fun j ↦ x (v j)) := by ext k j; obtain rfl | h := eq_or_ne k i <;> simp [*] rw [h (c β€’ a), h a] simp only [_root_.smul_apply] exact Matrix.det_updateRow_smul _ i c _ /-- A wedge with two equal covectors vanishes. -/ lemma wedgeCovectors_eq_zero_of_eq (L : ΞΉ β†’ E β†’L[π•œ] π•œ) (i j : ΞΉ) (h : L i = L j) (hne : i β‰  j) : wedgeCovectors π•œ E L = 0 := ContinuousAlternatingMap.ext fun _ ↦ by rw [wedgeCovectors_apply_eq_det] exact Matrix.det_zero_of_row_eq hne (by ext; simp [h]) /-- A wedge containing the zero covector vanishes. -/ lemma wedgeCovectors_update_zero (L : ΞΉ β†’ E β†’L[π•œ] π•œ) (i : ΞΉ) : wedgeCovectors π•œ E (Function.update L i 0) = 0 := ContinuousAlternatingMap.ext fun _ ↦ by rw [wedgeCovectors_apply_eq_det] exact Matrix.det_eq_zero_of_row_eq_zero i fun _ ↦ by simp /-- The standard constant volume form on `ΞΉ β†’ π•œ`. -/ def standardVolumeForm (ΞΉ : Type*) [Fintype ΞΉ] [DecidableEq ΞΉ] : (ΞΉ β†’ π•œ) [β‹€^ΞΉ]β†’L[π•œ] π•œ := wedgeCovectors π•œ (ΞΉ β†’ π•œ) ContinuousLinearMap.proj /-- Wedges of covectors commute with pullback along a continuous linear map. -/ lemma wedgeCovectors_compContinuousLinearMap {E F : Type*} [NormedAddCommGroup E] [NormedSpace π•œ E] [NormedAddCommGroup F] [NormedSpace π•œ F] (L : ΞΉ β†’ F β†’L[π•œ] π•œ) (T : E β†’L[π•œ] F) : wedgeCovectors π•œ E (fun i ↦ (L i).comp T) = (wedgeCovectors π•œ F L).compContinuousLinearMap T := ContinuousAlternatingMap.ext fun _ ↦ by simp [wedgeCovectors_apply_eq_det] omit [Fintype ΞΉ] [DecidableEq ΞΉ] in lemma add_compContinuousLinearMap {E F : Type*} [NormedAddCommGroup E] [NormedSpace π•œ E] [NormedAddCommGroup F] [NormedSpace π•œ F] (a b : F [β‹€^ΞΉ]β†’L[π•œ] π•œ) (T : E β†’L[π•œ] F) : (a + b).compContinuousLinearMap T = a.compContinuousLinearMap T + b.compContinuousLinearMap T := map_add (ContinuousAlternatingMap.compContinuousLinearMapβ‚— T) a b omit [Fintype ΞΉ] [DecidableEq ΞΉ] in lemma smul_compContinuousLinearMap {E F : Type*} [NormedAddCommGroup E] [NormedSpace π•œ E] [NormedAddCommGroup F] [NormedSpace π•œ F] (c : π•œ) (a : F [β‹€^ΞΉ]β†’L[π•œ] π•œ) (T : E β†’L[π•œ] F) : (c β€’ a).compContinuousLinearMap T = c β€’ a.compContinuousLinearMap T := map_smul (ContinuousAlternatingMap.compContinuousLinearMapβ‚— T) c a variable {ΞΉ' : Type*} [Fintype ΞΉ'] [DecidableEq ΞΉ'] /-- The product of a tuple of coordinate covectors. -/ def covectorProduct (I : ΞΉ β†’ ΞΉ') : ContinuousMultilinearMap π•œ (fun _ : ΞΉ ↦ ΞΉ' β†’ π•œ) π•œ := (ContinuousMultilinearMap.mkPiAlgebra π•œ ΞΉ π•œ).compContinuousLinearMap (fun j ↦ ContinuousLinearMap.proj (I j)) omit [DecidableEq ΞΉ] [Fintype ΞΉ'] [DecidableEq ΞΉ'] in @[simp] lemma covectorProduct_apply (I : ΞΉ β†’ ΞΉ') (v : ΞΉ β†’ ΞΉ' β†’ π•œ) : covectorProduct I v = ∏ j, v j (I j) := by simp [covectorProduct, ContinuousMultilinearMap.compContinuousLinearMap_apply, ContinuousMultilinearMap.mkPiAlgebra_apply] /-- A multilinear form on a finite product is the sum of its coordinate monomials. -/ lemma multilinear_eq_sum_covectorProduct (A : ContinuousMultilinearMap π•œ (fun _ : ΞΉ ↦ ΞΉ' β†’ π•œ) π•œ) : A = βˆ‘ I : ΞΉ β†’ ΞΉ', A (fun j ↦ Pi.single (I j) 1) β€’ covectorProduct I := by classical apply ContinuousMultilinearMap.toMultilinearMap_injective change A.toMultilinearMap = ContinuousMultilinearMap.toMultilinearMapLinear (R' := π•œ) (βˆ‘ I : ΞΉ β†’ ΞΉ', A (fun j ↦ Pi.single (I j) 1) β€’ covectorProduct I) rw [_root_.map_sum] simp_rw [_root_.map_smul] refine Module.Basis.ext_multilinear (fun _ : ΞΉ ↦ Pi.basisFun π•œ ΞΉ') fun v ↦ ?_ simp only [_root_.sum_apply, _root_.smul_apply, smul_eq_mul] rw [Finset.sum_eq_single v] Β· simp [Pi.basisFun_apply] Β· intro I hI hne change A (fun j ↦ Pi.single (I j) 1) * covectorProduct I (fun j ↦ Pi.basisFun π•œ ΞΉ' (v j)) = 0 rw [covectorProduct_apply] obtain ⟨j, hj⟩ := Function.ne_iff.mp hne have hz : (Pi.basisFun π•œ ΞΉ' (v j)) (I j) = 0 := by simp [Pi.basisFun_apply, hj.symm] rw [Finset.prod_eq_zero (Finset.mem_univ j) hz, mul_zero] Β· simp omit [DecidableEq ΞΉ'] in /-- Alternatizing a coordinate monomial gives the wedge of its coordinate covectors. -/ lemma alternatization_covectorProduct (I : ΞΉ β†’ ΞΉ') : ContinuousMultilinearMap.alternatization (covectorProduct I) = wedgeCovectors π•œ (ΞΉ' β†’ π•œ) (fun j ↦ ContinuousLinearMap.proj (I j)) := rfl lemma alternatization_smul (c : π•œ) (M : ContinuousMultilinearMap π•œ (fun _ : ΞΉ ↦ E) π•œ) : ContinuousMultilinearMap.alternatization (c β€’ M) = c β€’ ContinuousMultilinearMap.alternatization M := by ext v simp only [ContinuousMultilinearMap.alternatization_apply_apply, _root_.smul_apply, ContinuousAlternatingMap.smul_apply, Finset.smul_sum, smul_comm c] lemma alternatization_toContinuousMultilinearMap (A : E [β‹€^ΞΉ]β†’L[π•œ] π•œ) : ContinuousMultilinearMap.alternatization A.toContinuousMultilinearMap = ((Fintype.card ΞΉ).factorial : π•œ) β€’ A := by apply ContinuousAlternatingMap.toAlternatingMap_injective rw [ContinuousMultilinearMap.alternatization_apply_toAlternatingMap] change MultilinearMap.alternatization A.toAlternatingMap.toMultilinearMap = ((Fintype.card ΞΉ).factorial : π•œ) β€’ A.toAlternatingMap simpa only [Nat.cast_smul_eq_nsmul] using AlternatingMap.coe_alternatization A.toAlternatingMap /-- A continuous alternating form on `ΞΉ' β†’ π•œ` is the finite coordinate-wedge expansion of its values on the standard coordinate vectors. -/ lemma alternating_eq_sum_wedgeCovectors [CharZero π•œ] (A : (ΞΉ' β†’ π•œ) [β‹€^ΞΉ]β†’L[π•œ] π•œ) : A = βˆ‘ I : ΞΉ β†’ ΞΉ', (((Fintype.card ΞΉ).factorial : π•œ)⁻¹ * A (fun j ↦ Pi.single (I j) 1)) β€’ wedgeCovectors π•œ (ΞΉ' β†’ π•œ) (fun j ↦ ContinuousLinearMap.proj (I j)) := by classical have hM := multilinear_eq_sum_covectorProduct A.toContinuousMultilinearMap have hAlt := congrArg ContinuousMultilinearMap.alternatization hM rw [alternatization_toContinuousMultilinearMap A] at hAlt simp only [_root_.map_sum] at hAlt simp_rw [alternatization_smul, alternatization_covectorProduct] at hAlt change ((Fintype.card ΞΉ).factorial : π•œ) β€’ A = βˆ‘ I : ΞΉ β†’ ΞΉ', A (fun j ↦ Pi.single (I j) 1) β€’ wedgeCovectors π•œ (ΞΉ' β†’ π•œ) (fun j ↦ ContinuousLinearMap.proj (I j)) at hAlt have hfac : ((Fintype.card ΞΉ).factorial : π•œ) β‰  0 := by exact_mod_cast Nat.factorial_ne_zero _ nth_rw 1 [← inv_smul_smulβ‚€ hfac A] rw [hAlt, Finset.smul_sum] simp_rw [smul_smul] /-- Evaluation at a fixed tuple is a continuous linear functional on continuous alternating forms. -/ def alternatingFormEvaluation (v : ΞΉ β†’ E) : (E [β‹€^ΞΉ]β†’L[π•œ] π•œ) β†’L[π•œ] π•œ := ContinuousAlternatingMap.apply π•œ E π•œ v /-- The coefficient of an alternating form field in its finite coordinate-wedge expansion. -/ def coordinateCoefficient (ΞΈ : (ΞΉ' β†’ π•œ) β†’ (ΞΉ' β†’ π•œ) [β‹€^ΞΉ]β†’L[π•œ] π•œ) (I : ΞΉ β†’ ΞΉ') (y : ΞΉ' β†’ π•œ) : π•œ := ((Fintype.card ΞΉ).factorial : π•œ)⁻¹ * ΞΈ y (fun j ↦ Pi.single (I j) 1) omit [DecidableEq ΞΉ] in lemma analyticOnNhd_coordinateCoefficient (ΞΈ : (ΞΉ' β†’ π•œ) β†’ (ΞΉ' β†’ π•œ) [β‹€^ΞΉ]β†’L[π•œ] π•œ) {s : Set (ΞΉ' β†’ π•œ)} (hΞΈ : AnalyticOnNhd π•œ ΞΈ s) (I : ΞΉ β†’ ΞΉ') : AnalyticOnNhd π•œ (coordinateCoefficient ΞΈ I) s := by let e : ΞΉ β†’ ΞΉ' β†’ π•œ := fun j ↦ Pi.single (I j) 1 exact ((alternatingFormEvaluation e).comp_analyticOnNhd hΞΈ).const_smul (c := ((Fintype.card ΞΉ).factorial : π•œ)⁻¹) end end OAI.Analysis.Foundations.NormedSpaceWedgeCovectors.ContinuousAlternatingMap