Closed joneugster closed 5 months ago
I played a bit with it and came up with this:
import Mathlib
example : Module ℚ ℝ := by
apply Module.ofCore
constructor
case H.toSMul =>
exact SMul.mk fun a r => ↑a * r
repeat sorry
Not sure if this is any better.
Apparently mathlib3 also knew refine_struct
which seems to be on the way into mathlib4 (Zulip).
That might work as a solution.
instance semigroup [∀ i, semigroup $ f i] : semigroup (Π i : I, f i) :=
begin
refine_struct { .. },
exact λ x y , x * y, -- 1st field
sorry -- 2nd field
end
I'll see if it's possible that this would work:
import Mathlib
example : Module ℚ ℝ := by
refine_struct
exact fun a r => ↑a * r
repeat sorry
With a4d1130 the syntax is currently
refine { ?..! }
But long-term we would probably think about how to do that in-game in the nicest way possible as that syntax is a bit cryptic for beginners.
We settled on using either refine' { smul := fun a r => ↑a * r, .. }
or using the (preample := refine' { smul := fun a r => ↑a * r, .. })
option of Statement
which hides some preprocessing steps from the player.
One way to construct algebraic structures (in Tactic-mode) could be the following:
We should figure way/notation to make that first step easier.