Skip to content

Commit 2feb737

Browse files
committed
chore(LinearAlgebra/Alternating): move currying to a new file (#24800)
The only change is removing primes from all variable names in the new files. I plan to add more operations to the new file soon, required to define operations on differential forms.
1 parent cc1acee commit 2feb737

File tree

5 files changed

+90
-76
lines changed

5 files changed

+90
-76
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,6 +3805,7 @@ import Mathlib.LinearAlgebra.AffineSpace.Pointwise
38053805
import Mathlib.LinearAlgebra.AffineSpace.Restrict
38063806
import Mathlib.LinearAlgebra.AffineSpace.Slope
38073807
import Mathlib.LinearAlgebra.Alternating.Basic
3808+
import Mathlib.LinearAlgebra.Alternating.Curry
38083809
import Mathlib.LinearAlgebra.Alternating.DomCoprod
38093810
import Mathlib.LinearAlgebra.AnnihilatingPolynomial
38103811
import Mathlib.LinearAlgebra.Basis.Basic

Mathlib/Analysis/InnerProductSpace/TwoDim.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Mathlib.Analysis.InnerProductSpace.Dual
77
import Mathlib.Analysis.InnerProductSpace.Orientation
88
import Mathlib.Data.Complex.FiniteDimensional
99
import Mathlib.Data.Complex.Orientation
10+
import Mathlib.LinearAlgebra.Alternating.Curry
1011
import Mathlib.Tactic.LinearCombination
1112

1213
/-!
@@ -92,7 +93,7 @@ irreducible_def areaForm : E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by
9293
AlternatingMap.constLinearEquivOfIsEmpty.symm
9394
let y : E [⋀^Fin 1]→ₗ[ℝ] ℝ →ₗ[ℝ] E →ₗ[ℝ] ℝ :=
9495
LinearMap.llcomp ℝ E (E [⋀^Fin 0]→ₗ[ℝ] ℝ) ℝ z ∘ₗ AlternatingMap.curryLeftLinearMap
95-
exact y ∘ₗ AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm
96+
exact y ∘ₗ AlternatingMap.curryLeftLinearMap o.volumeForm
9697

9798
local notation "ω" => o.areaForm
9899

Mathlib/LinearAlgebra/Alternating/Basic.lean

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Authors: Eric Wieser, Zhangir Azerbayev
66
import Mathlib.GroupTheory.Perm.Sign
77
import Mathlib.LinearAlgebra.LinearIndependent.Defs
88
import Mathlib.LinearAlgebra.Multilinear.Basis
9-
import Mathlib.LinearAlgebra.Multilinear.Curry
109

1110
/-!
1211
# Alternating Maps
@@ -886,90 +885,18 @@ theorem Basis.ext_alternating {f g : N₁ [⋀^ι]→ₗ[R'] N₂} (e : Basis ι
886885

887886
end Basis
888887

889-
/-! ### Currying -/
890-
891-
892-
section Currying
893-
894888
variable {R' : Type*} {M'' M₂'' N'' N₂'' : Type*} [CommSemiring R'] [AddCommMonoid M'']
895889
[AddCommMonoid M₂''] [AddCommMonoid N''] [AddCommMonoid N₂''] [Module R' M''] [Module R' M₂'']
896890
[Module R' N''] [Module R' N₂'']
897891

898-
namespace AlternatingMap
899-
900-
/-- Given an alternating map `f` in `n+1` variables, split the first variable to obtain
901-
a linear map into alternating maps in `n` variables, given by `x ↦ (m ↦ f (Matrix.vecCons x m))`.
902-
It can be thought of as a map $Hom(\bigwedge^{n+1} M, N) \to Hom(M, Hom(\bigwedge^n M, N))$.
903-
904-
This is `MultilinearMap.curryLeft` for `AlternatingMap`. See also
905-
`AlternatingMap.curryLeftLinearMap`. -/
906-
@[simps]
907-
def curryLeft {n : ℕ} (f : M'' [⋀^Fin n.succ]→ₗ[R'] N'') :
908-
M'' →ₗ[R'] M'' [⋀^Fin n]→ₗ[R'] N'' where
909-
toFun m :=
910-
{ f.toMultilinearMap.curryLeft m with
911-
toFun := fun v => f (Matrix.vecCons m v)
912-
map_eq_zero_of_eq' := fun v i j hv hij =>
913-
f.map_eq_zero_of_eq _ (by
914-
rwa [Matrix.cons_val_succ, Matrix.cons_val_succ]) ((Fin.succ_injective _).ne hij) }
915-
map_add' _ _ := ext fun _ => f.map_vecCons_add _ _ _
916-
map_smul' _ _ := ext fun _ => f.map_vecCons_smul _ _ _
917-
918-
@[simp]
919-
theorem curryLeft_zero {n : ℕ} : curryLeft (0 : M'' [⋀^Fin n.succ]→ₗ[R'] N'') = 0 :=
920-
rfl
921-
922-
@[simp]
923-
theorem curryLeft_add {n : ℕ} (f g : M'' [⋀^Fin n.succ]→ₗ[R'] N'') :
924-
curryLeft (f + g) = curryLeft f + curryLeft g :=
925-
rfl
926-
927-
@[simp]
928-
theorem curryLeft_smul {n : ℕ} (r : R') (f : M'' [⋀^Fin n.succ]→ₗ[R'] N'') :
929-
curryLeft (r • f) = r • curryLeft f :=
930-
rfl
931-
932-
/-- `AlternatingMap.curryLeft` as a `LinearMap`. This is a separate definition as dot notation
933-
does not work for this version. -/
934-
@[simps]
935-
def curryLeftLinearMap {n : ℕ} :
936-
(M'' [⋀^Fin n.succ]→ₗ[R'] N'') →ₗ[R'] M'' →ₗ[R'] M'' [⋀^Fin n]→ₗ[R'] N'' where
937-
toFun f := f.curryLeft
938-
map_add' := curryLeft_add
939-
map_smul' := curryLeft_smul
940-
941-
/-- Currying with the same element twice gives the zero map. -/
942-
@[simp]
943-
theorem curryLeft_same {n : ℕ} (f : M'' [⋀^Fin n.succ.succ]→ₗ[R'] N'') (m : M'') :
944-
(f.curryLeft m).curryLeft m = 0 :=
945-
ext fun _ => f.map_eq_zero_of_eq _ (by simp) Fin.zero_ne_one
946-
947-
@[simp]
948-
theorem curryLeft_compAlternatingMap {n : ℕ} (g : N'' →ₗ[R'] N₂'')
949-
(f : M'' [⋀^Fin n.succ]→ₗ[R'] N'') (m : M'') :
950-
(g.compAlternatingMap f).curryLeft m = g.compAlternatingMap (f.curryLeft m) :=
951-
rfl
952-
953-
@[simp]
954-
theorem curryLeft_compLinearMap {n : ℕ} (g : M₂'' →ₗ[R'] M'')
955-
(f : M'' [⋀^Fin n.succ]→ₗ[R'] N'') (m : M₂'') :
956-
(f.compLinearMap g).curryLeft m = (f.curryLeft (g m)).compLinearMap g :=
957-
ext fun v => congr_arg f <| funext <| by
958-
refine Fin.cases ?_ ?_
959-
· rfl
960-
· simp
961-
962892
/-- The space of constant maps is equivalent to the space of maps that are alternating with respect
963893
to an empty family. -/
964894
@[simps]
965-
def constLinearEquivOfIsEmpty [IsEmpty ι] : N'' ≃ₗ[R'] (M'' [⋀^ι]→ₗ[R'] N'') where
895+
def AlternatingMap.constLinearEquivOfIsEmpty [IsEmpty ι] : N'' ≃ₗ[R'] (M'' [⋀^ι]→ₗ[R'] N'') where
966896
toFun := AlternatingMap.constOfIsEmpty R' M'' ι
967897
map_add' _ _ := rfl
968898
map_smul' _ _ := rfl
969899
invFun f := f 0
970900
left_inv _ := rfl
971901
right_inv f := ext fun _ => AlternatingMap.congr_arg f <| Subsingleton.elim _ _
972902

973-
end AlternatingMap
974-
975-
end Currying
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/-
2+
Copyright (c) 2022 Eric Wieser. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Eric Wieser
5+
-/
6+
import Mathlib.LinearAlgebra.Alternating.Basic
7+
import Mathlib.LinearAlgebra.Multilinear.Curry
8+
9+
/-!
10+
# Currying alternating forms
11+
12+
In this file we define `AlternatingMap.curryLeft`
13+
which interprets an alternating map in `n + 1` variables
14+
as a linear map in the 0th variable taking values in the alternating maps in `n` variables.
15+
-/
16+
17+
variable {R : Type*} {M M₂ N N₂ : Type*} [CommSemiring R] [AddCommMonoid M]
18+
[AddCommMonoid M₂] [AddCommMonoid N] [AddCommMonoid N₂] [Module R M] [Module R M₂]
19+
[Module R N] [Module R N₂]
20+
21+
namespace AlternatingMap
22+
23+
/-- Given an alternating map `f` in `n+1` variables, split the first variable to obtain
24+
a linear map into alternating maps in `n` variables, given by `x ↦ (m ↦ f (Matrix.vecCons x m))`.
25+
It can be thought of as a map $Hom(\bigwedge^{n+1} M, N) \to Hom(M, Hom(\bigwedge^n M, N))$.
26+
27+
This is `MultilinearMap.curryLeft` for `AlternatingMap`. See also
28+
`AlternatingMap.curryLeftLinearMap`. -/
29+
@[simps]
30+
def curryLeft {n : ℕ} (f : M [⋀^Fin n.succ]→ₗ[R] N) :
31+
M →ₗ[R] M [⋀^Fin n]→ₗ[R] N where
32+
toFun m :=
33+
{ f.toMultilinearMap.curryLeft m with
34+
toFun := fun v => f (Matrix.vecCons m v)
35+
map_eq_zero_of_eq' := fun v i j hv hij =>
36+
f.map_eq_zero_of_eq _ (by
37+
rwa [Matrix.cons_val_succ, Matrix.cons_val_succ]) ((Fin.succ_injective _).ne hij) }
38+
map_add' _ _ := ext fun _ => f.map_vecCons_add _ _ _
39+
map_smul' _ _ := ext fun _ => f.map_vecCons_smul _ _ _
40+
41+
@[simp]
42+
theorem curryLeft_zero {n : ℕ} : curryLeft (0 : M [⋀^Fin n.succ]→ₗ[R] N) = 0 :=
43+
rfl
44+
45+
@[simp]
46+
theorem curryLeft_add {n : ℕ} (f g : M [⋀^Fin n.succ]→ₗ[R] N) :
47+
curryLeft (f + g) = curryLeft f + curryLeft g :=
48+
rfl
49+
50+
@[simp]
51+
theorem curryLeft_smul {n : ℕ} (r : R) (f : M [⋀^Fin n.succ]→ₗ[R] N) :
52+
curryLeft (r • f) = r • curryLeft f :=
53+
rfl
54+
55+
/-- `AlternatingMap.curryLeft` as a `LinearMap`. This is a separate definition as dot notation
56+
does not work for this version. -/
57+
@[simps]
58+
def curryLeftLinearMap {n : ℕ} :
59+
(M [⋀^Fin n.succ]→ₗ[R] N) →ₗ[R] M →ₗ[R] M [⋀^Fin n]→ₗ[R] N where
60+
toFun f := f.curryLeft
61+
map_add' := curryLeft_add
62+
map_smul' := curryLeft_smul
63+
64+
/-- Currying with the same element twice gives the zero map. -/
65+
@[simp]
66+
theorem curryLeft_same {n : ℕ} (f : M [⋀^Fin n.succ.succ]→ₗ[R] N) (m : M) :
67+
(f.curryLeft m).curryLeft m = 0 :=
68+
ext fun _ => f.map_eq_zero_of_eq _ (by simp) Fin.zero_ne_one
69+
70+
@[simp]
71+
theorem curryLeft_compAlternatingMap {n : ℕ} (g : N →ₗ[R] N₂)
72+
(f : M [⋀^Fin n.succ]→ₗ[R] N) (m : M) :
73+
(g.compAlternatingMap f).curryLeft m = g.compAlternatingMap (f.curryLeft m) :=
74+
rfl
75+
76+
@[simp]
77+
theorem curryLeft_compLinearMap {n : ℕ} (g : M₂ →ₗ[R] M) (f : M [⋀^Fin n.succ]→ₗ[R] N) (m : M₂) :
78+
(f.compLinearMap g).curryLeft m = (f.curryLeft (g m)).compLinearMap g :=
79+
ext fun v => congr_arg f <| funext <| by
80+
refine Fin.cases ?_ ?_
81+
· rfl
82+
· simp
83+
84+
end AlternatingMap
85+

Mathlib/LinearAlgebra/ExteriorAlgebra/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Zhangir Azerbayev, Adam Topaz, Eric Wieser
55
-/
66
import Mathlib.LinearAlgebra.CliffordAlgebra.Basic
7-
import Mathlib.LinearAlgebra.Alternating.Basic
7+
import Mathlib.LinearAlgebra.Alternating.Curry
88

99
/-!
1010
# Exterior Algebras

0 commit comments

Comments
 (0)