Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(algebra/algebra/basic,data/matrix/basic): resolve a TODO about alg_hom.map_smul_of_tower #12684

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/algebra/algebra/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,10 @@ by { ext, refl }
of_linear_map linear_map.id map_one map_mul = alg_hom.id R A :=
ext $ λ _, rfl

lemma map_smul_of_tower {R'} [has_scalar R' A] [has_scalar R' B]
[linear_map.compatible_smul A B R' R] (r : R') (x : A) : φ (r • x) = r • φ x :=
φ.to_linear_map.map_smul_of_tower r x

lemma map_list_prod (s : list A) :
φ s.prod = (s.map φ).prod :=
φ.to_ring_hom.map_list_prod s
Expand Down
14 changes: 14 additions & 0 deletions src/data/matrix/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ lemma map_smul [has_scalar R α] [has_scalar R β] (f : α → β) (r : R)
(hf : ∀ a, f (r • a) = r • f a) (M : matrix m n α) : (r • M).map f = r • (M.map f) :=
ext $ λ _ _, hf _

/-- The scalar action via `has_mul.to_has_scalar` is transformed by the same map as the elements
of the matrix, when `f` preserves multiplication. -/
lemma map_smul' [has_mul α] [has_mul β] (f : α → β) (r : α) (A : matrix n n α)
(hf : ∀ a₁ a₂, f (a₁ * a₂) = f a₁ * f a₂) :
(r • A).map f = f r • A.map f :=
ext $ λ _ _, hf _ _

/-- The scalar action via `has_mul.to_has_opposite_scalar` is transformed by the same map as the
elements of the matrix, when `f` preserves multiplication. -/
lemma map_op_smul' [has_mul α] [has_mul β] (f : α → β) (r : α) (A : matrix n n α)
(hf : ∀ a₁ a₂, f (a₁ * a₂) = f a₁ * f a₂) :
(mul_opposite.op r • A).map f = mul_opposite.op (f r) • A.map f :=
ext $ λ _ _, hf _ _

lemma _root_.is_smul_regular.matrix [has_scalar R S] {k : R} (hk : is_smul_regular S k) :
is_smul_regular (matrix m n S) k :=
is_smul_regular.pi $ λ _, is_smul_regular.pi $ λ _, hk
Expand Down
7 changes: 2 additions & 5 deletions src/linear_algebra/matrix/adjugate.lean
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,8 @@ begin
let A' := mv_polynomial_X n n ℤ,
suffices : adjugate (adjugate A') = det A' ^ (fintype.card n - 2) • A',
{ rw [←mv_polynomial_X_map_matrix_aeval ℤ A, ←alg_hom.map_adjugate, ←alg_hom.map_adjugate, this,
←alg_hom.map_det, ← alg_hom.map_pow],
-- TODO: missing an `alg_hom.map_smul_of_tower` here.
ext i j,
dsimp [-mv_polynomial_X],
rw [←alg_hom.map_mul] },
←alg_hom.map_det, ← alg_hom.map_pow, alg_hom.map_matrix_apply, alg_hom.map_matrix_apply,
matrix.map_smul' _ _ _ (_root_.map_mul _)] },
have h_card' : fintype.card n - 2 + 1 = fintype.card n - 1,
{ simp [h_card] },

Expand Down