Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit b39feab

Browse files
committed
refactor(algebra/lie): reduce use of old_structure_cmd (#9616)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 91ee8f1 commit b39feab

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

src/algebra/lie/basic.lean

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ instance : lie_module R L (M →ₗ[R] N) :=
176176

177177
end basic_properties
178178

179-
set_option old_structure_cmd true
180179
/-- A morphism of Lie algebras is a linear map respecting the bracket operations. -/
181180
structure lie_hom (R : Type u) (L : Type v) (L' : Type w)
182181
[comm_ring R] [lie_ring L] [lie_algebra R L] [lie_ring L'] [lie_algebra R L']
@@ -190,15 +189,21 @@ notation L ` →ₗ⁅`:25 R:25 `⁆ `:0 L':0 := lie_hom R L L'
190189
namespace lie_hom
191190

192191
variables {R : Type u} {L₁ : Type v} {L₂ : Type w} {L₃ : Type w₁}
193-
variables [comm_ring R] [lie_ring L₁] [lie_ring L₂] [lie_ring L₃]
194-
variables [lie_algebra R L₁] [lie_algebra R L₂] [lie_algebra R L₃]
192+
variables [comm_ring R]
193+
variables [lie_ring L₁] [lie_algebra R L₁]
194+
variables [lie_ring L₂] [lie_algebra R L₂]
195+
variables [lie_ring L₃] [lie_algebra R L₃]
195196

196197
instance : has_coe (L₁ →ₗ⁅R⁆ L₂) (L₁ →ₗ[R] L₂) := ⟨lie_hom.to_linear_map⟩
197198

198199
/-- see Note [function coercion] -/
199-
instance : has_coe_to_fun (L₁ →ₗ⁅R⁆ L₂) := ⟨_, lie_hom.to_fun⟩
200+
instance : has_coe_to_fun (L₁ →ₗ⁅R⁆ L₂) := ⟨_, λ f, f.to_linear_map.to_fun⟩
201+
202+
/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
203+
because it is a composition of multiple projections. -/
204+
def simps.apply (h : L₁ →ₗ⁅R⁆ L₂) : L₁ → L₂ := h
200205

201-
initialize_simps_projections lie_hom (to_fun → apply)
206+
initialize_simps_projections lie_hom (to_linear_map_to_fun → apply)
202207

203208
@[simp, norm_cast] lemma coe_to_linear_map (f : L₁ →ₗ⁅R⁆ L₂) : ((f : L₁ →ₗ[R] L₂) : L₁ → L₂) = f :=
204209
rfl
@@ -247,7 +252,7 @@ lemma one_apply (x : L₁) : (1 : (L₁ →ₗ⁅R⁆ L₁)) x = x := rfl
247252
instance : inhabited (L₁ →ₗ⁅R⁆ L₂) := ⟨0
248253

249254
lemma coe_injective : @function.injective (L₁ →ₗ⁅R⁆ L₂) (L₁ → L₂) coe_fn :=
250-
by rintro ⟨f, _⟩g, _⟩ ⟨h⟩; congr
255+
by rintro ⟨f, _⟩⟩ ⟨⟨g, _⟩ ⟨h⟩; congr
251256

252257
@[ext] lemma ext {f g : L₁ →ₗ⁅R⁆ L₂} (h : ∀ x, f x = g x) : f = g :=
253258
coe_injective $ funext h
@@ -258,15 +263,11 @@ lemma ext_iff {f g : L₁ →ₗ⁅R⁆ L₂} : f = g ↔ ∀ x, f x = g x :=
258263
lemma congr_fun {f g : L₁ →ₗ⁅R⁆ L₂} (h : f = g) (x : L₁) : f x = g x := h ▸ rfl
259264

260265
@[simp] lemma mk_coe (f : L₁ →ₗ⁅R⁆ L₂) (h₁ h₂ h₃) :
261-
(⟨f, h₁, h₂, h₃⟩ : L₁ →ₗ⁅R⁆ L₂) = f :=
266+
(⟨f, h₁, h₂, h₃⟩ : L₁ →ₗ⁅R⁆ L₂) = f :=
262267
by { ext, refl, }
263268

264269
@[simp] lemma coe_mk (f : L₁ → L₂) (h₁ h₂ h₃) :
265-
((⟨f, h₁, h₂, h₃⟩ : L₁ →ₗ⁅R⁆ L₂) : L₁ → L₂) = f := rfl
266-
267-
@[norm_cast, simp] lemma coe_linear_mk (f : L₁ →ₗ[R] L₂) (h₁ h₂ h₃) :
268-
((⟨f, h₁, h₂, h₃⟩ : L₁ →ₗ⁅R⁆ L₂) : L₁ →ₗ[R] L₂) = ⟨f, h₁, h₂⟩ :=
269-
by { ext, refl, }
270+
((⟨⟨f, h₁, h₂⟩, h₃⟩ : L₁ →ₗ⁅R⁆ L₂) : L₁ → L₂) = f := rfl
270271

271272
/-- The composition of morphisms is a morphism. -/
272273
def comp (f : L₂ →ₗ⁅R⁆ L₃) (g : L₁ →ₗ⁅R⁆ L₂) : L₁ →ₗ⁅R⁆ L₃ :=
@@ -308,10 +309,12 @@ instead define an equivalence to be a morphism which is also a (plain) equivalen
308309
more convenient to define via linear equivalence to get `.to_linear_equiv` for free. -/
309310
structure lie_equiv (R : Type u) (L : Type v) (L' : Type w)
310311
[comm_ring R] [lie_ring L] [lie_algebra R L] [lie_ring L'] [lie_algebra R L']
311-
extends L →ₗ⁅R⁆ L', L ≃ₗ[R] L'
312+
extends L →ₗ⁅R⁆ L' :=
313+
(inv_fun : L' → L)
314+
(left_inv : function.left_inverse inv_fun to_lie_hom.to_fun)
315+
(right_inv : function.right_inverse inv_fun to_lie_hom.to_fun)
312316

313317
attribute [nolint doc_blame] lie_equiv.to_lie_hom
314-
attribute [nolint doc_blame] lie_equiv.to_linear_equiv
315318

316319
notation L ` ≃ₗ⁅`:50 R `⁆ ` L' := lie_equiv R L L'
317320

@@ -321,11 +324,14 @@ variables {R : Type u} {L₁ : Type v} {L₂ : Type w} {L₃ : Type w₁}
321324
variables [comm_ring R] [lie_ring L₁] [lie_ring L₂] [lie_ring L₃]
322325
variables [lie_algebra R L₁] [lie_algebra R L₂] [lie_algebra R L₃]
323326

327+
/-- Consider an equivalence of Lie algebras as a linear equivalence. -/
328+
def to_linear_equiv (f : L₁ ≃ₗ⁅R⁆ L₂) : L₁ ≃ₗ[R] L₂ := { ..f.to_lie_hom, ..f }
329+
324330
instance has_coe_to_lie_hom : has_coe (L₁ ≃ₗ⁅R⁆ L₂) (L₁ →ₗ⁅R⁆ L₂) := ⟨to_lie_hom⟩
325331
instance has_coe_to_linear_equiv : has_coe (L₁ ≃ₗ⁅R⁆ L₂) (L₁ ≃ₗ[R] L₂) := ⟨to_linear_equiv⟩
326332

327333
/-- see Note [function coercion] -/
328-
instance : has_coe_to_fun (L₁ ≃ₗ⁅R⁆ L₂) := ⟨_, to_fun⟩
334+
instance : has_coe_to_fun (L₁ ≃ₗ⁅R⁆ L₂) := ⟨_, λ e, e.to_lie_hom.to_fun⟩
329335

330336
@[simp, norm_cast] lemma coe_to_lie_equiv (e : L₁ ≃ₗ⁅R⁆ L₂) : ((e : L₁ →ₗ⁅R⁆ L₂) : L₁ → L₂) = e :=
331337
rfl
@@ -355,7 +361,7 @@ def symm (e : L₁ ≃ₗ⁅R⁆ L₂) : L₂ ≃ₗ⁅R⁆ L₁ :=
355361
..e.to_linear_equiv.symm }
356362

357363
@[simp] lemma symm_symm (e : L₁ ≃ₗ⁅R⁆ L₂) : e.symm.symm = e :=
358-
by { cases e, refl, }
364+
by { rcases e with ⟨⟨⟨⟩⟩⟩, refl, }
359365

360366
@[simp] lemma apply_symm_apply (e : L₁ ≃ₗ⁅R⁆ L₂) : ∀ x, e (e.symm x) = x :=
361367
e.to_linear_equiv.apply_symm_apply

src/algebra/lie/semisimple.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ namespace lie_algebra
3939
variables (R : Type u) (L : Type v)
4040
variables [comm_ring R] [lie_ring L] [lie_algebra R L]
4141

42-
set_option old_structure_cmd true
4342
/-- A Lie algebra is simple if it is irreducible as a Lie module over itself via the adjoint
4443
action, and it is non-Abelian. -/
4544
class is_simple extends lie_module.is_irreducible R L L : Prop :=
@@ -78,7 +77,7 @@ instance is_semisimple_of_is_simple [h : is_simple R L] : is_semisimple R L :=
7877
begin
7978
rw is_semisimple_iff_no_abelian_ideals,
8079
intros I hI,
81-
tactic.unfreeze_local_instances, obtainh₁, h₂⟩ := h,
80+
tactic.unfreeze_local_instances, obtain⟨h₁⟩, h₂⟩ := h,
8281
by_contradiction contra,
8382
rw [h₁ I contra, lie_abelian_iff_equiv_lie_abelian lie_ideal.top_equiv_self] at hI,
8483
exact h₂ hI,

src/algebra/lie/subalgebra.lean

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ section lie_subalgebra
3434

3535
variables (R : Type u) (L : Type v) [comm_ring R] [lie_ring L] [lie_algebra R L]
3636

37-
set_option old_structure_cmd true
3837
/-- A Lie subalgebra of a Lie algebra is submodule that is closed under the Lie bracket.
3938
This is a sufficient condition for the subset itself to form a Lie algebra. -/
4039
structure lie_subalgebra extends submodule R L :=
@@ -83,7 +82,7 @@ lemma lie_mem {x y : L} (hx : x ∈ L') (hy : y ∈ L') : (⁅x, y⁆ : L) ∈ L
8382
@[simp] lemma mem_carrier {x : L} : x ∈ L'.carrier ↔ x ∈ (L' : set L) := iff.rfl
8483

8584
@[simp] lemma mem_mk_iff (S : set L) (h₁ h₂ h₃ h₄) {x : L} :
86-
x ∈ (⟨S, h₁, h₂, h₃, h₄⟩ : lie_subalgebra R L) ↔ x ∈ S :=
85+
x ∈ (⟨S, h₁, h₂, h₃, h₄⟩ : lie_subalgebra R L) ↔ x ∈ S :=
8786
iff.rfl
8887

8988
@[simp] lemma mem_coe_submodule {x : L} : x ∈ (L' : submodule R L) ↔ x ∈ L' := iff.rfl
@@ -104,14 +103,14 @@ lemma ext_iff' (L₁' L₂' : lie_subalgebra R L) : L₁' = L₂' ↔ ∀ x, x
104103
⟨λ h x, by rw h, ext L₁' L₂'⟩
105104

106105
@[simp] lemma mk_coe (S : set L) (h₁ h₂ h₃ h₄) :
107-
((⟨S, h₁, h₂, h₃, h₄⟩ : lie_subalgebra R L) : set L) = S := rfl
106+
((⟨S, h₁, h₂, h₃, h₄⟩ : lie_subalgebra R L) : set L) = S := rfl
108107

109108
@[simp] lemma coe_to_submodule_mk (p : submodule R L) (h) :
110109
(({lie_mem' := h, ..p} : lie_subalgebra R L) : submodule R L) = p :=
111110
by { cases p, refl, }
112111

113112
lemma coe_injective : function.injective (coe : lie_subalgebra R L → set L) :=
114-
λ L₁' L₂' h, by cases L₁'; cases L₂'; congr'
113+
by { rintro ⟨⟨⟩⟩ ⟨⟨⟩⟩ h, congr' }
115114

116115
@[norm_cast] theorem coe_set_eq (L₁' L₂' : lie_subalgebra R L) :
117116
(L₁' : set L) = L₂' ↔ L₁' = L₂' := coe_injective.eq_iff

src/algebra/lie/submodule.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def to_lie_submodule (K : lie_subalgebra R L) : lie_submodule R K L :=
175175

176176
@[simp] lemma coe_to_lie_submodule (K : lie_subalgebra R L) :
177177
(K.to_lie_submodule : submodule R L) = K :=
178-
rfl
178+
by { rcases K with ⟨⟨⟩⟩, refl, }
179179

180180
@[simp] lemma mem_to_lie_submodule {K : lie_subalgebra R L} (x : L) :
181181
x ∈ K.to_lie_submodule ↔ x ∈ K :=

0 commit comments

Comments
 (0)