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] - chore: golf FiniteDimensional.isROrC_to_real #9921

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions Mathlib/Data/IsROrC/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@ This instance generates a type-class problem with a metavariable `?m` that shoul
/-- An `IsROrC` field is finite-dimensional over `ℝ`, since it is spanned by `{1, I}`. -/
-- Porting note: was @[nolint dangerous_instance]
instance isROrC_to_real : FiniteDimensional ℝ K :=
⟨⟨{1, I}, by
rw [eq_top_iff]
intro a _
rw [Finset.coe_insert, Finset.coe_singleton, Submodule.mem_span_insert]
refine' ⟨re a, im a • I, _, _⟩
· rw [Submodule.mem_span_singleton]
use im a
simp [re_add_im a, Algebra.smul_def, algebraMap_eq_ofReal]⟩⟩
⟨{1, I}, by simpa [Submodule.eq_top_iff', Submodule.mem_span_pair] using
fun x ↦ ⟨re x, im x, by simp [real_smul_eq_coe_mul]⟩⟩
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This proof relies a lot on the fact that simpa doesn't simplify the expression too much. I would prefer suffices _ by simpa [...]; exact _ or simp? [] says ...; exact

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@urkud I've changed it to use suffices, but for what it's worth, I disagree with:

This proof relies a lot on the fact that simpa doesn't simplify the expression too much.

The suffices I added was ∀ x : K, ∃ a b : ℝ, a • 1 + b • I = x (the goal after simp) which could only really be simplified further if we made IsROrC.real_smul_eq_coe_mul a simp lemma. But even if that did happen, this would be covered by the by simp [real_smul_eq_coe_mul]. Note also, making that a simp lemma would be a bit weird since it's inserting a coercion.

#align finite_dimensional.is_R_or_C_to_real FiniteDimensional.isROrC_to_real

variable (K E)
Expand Down
Loading