For more information see: https://github.com/leanprover/lean/wiki/Refactoring-structures The new attribute [algebra] implements the [algebraic_class] described in the page above.
15 lines
266 B
Text
15 lines
266 B
Text
def f (a b : nat) := 0
|
|
def g (a b : nat) := 1
|
|
|
|
instance : is_commutative nat f :=
|
|
⟨λ a b, rfl⟩
|
|
|
|
instance : is_commutative nat g :=
|
|
⟨λ a b, rfl⟩
|
|
|
|
open tactic
|
|
|
|
run_cmd do
|
|
env ← get_env,
|
|
s ← return $ env.get_class_attribute_symbols `algebra,
|
|
trace s
|