Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(data/polynomial): Resolve a has_scalar instance diamond (#8392)
Without this change, the following fails to close the diamond between `units.distrib_mul_action` and`polynomial.distrib_mul_action`: ```lean example (R α : Type*) (β : α → Type*) [monoid R] [semiring α] [distrib_mul_action R α] : (units.distrib_mul_action : distrib_mul_action (units R) (polynomial α)) = polynomial.distrib_mul_action := rfl ``` This was because both used `polynomial.smul`, which was: * `@[irreducible]`, which means that typeclass search is unable to unfold it to see there is no diamond * Defined using a pattern match, which means that even if it were not reducible, it does not unfold as needed. This adds a new test file with this diamond and some other diamonds to verify they are defeq. Unfortunately this means `simps` now aggressively unfolds `•` on polynomials into `finsupp`s, so we need to tell `simps` precisely what lemma we actually want. This only happens in one place though. [Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/units.2Ehas_scalar.20and.20polynomial.2Ehas_scalar.20diamond/near/246800881) Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>
- Loading branch information
1 parent
ced1f12
commit 6efc3e9
Showing
3 changed files
with
50 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/- | ||
Copyright (c) 2021 Eric Wieser. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Eric Wieser | ||
-/ | ||
|
||
import algebra.module.pi | ||
import data.polynomial.basic | ||
import group_theory.group_action.prod | ||
import group_theory.group_action.units | ||
|
||
/-! # Tests that instances do not form diamonds -/ | ||
|
||
/-! ## Scalar action instances -/ | ||
section has_scalar | ||
|
||
section units | ||
|
||
example (α : Type*) [monoid α] : | ||
(units.mul_action : mul_action (units α) (α × α)) = prod.mul_action := rfl | ||
|
||
example (R α : Type*) (β : α → Type*) [monoid R] [Π i, mul_action R (β i)] : | ||
(units.mul_action : mul_action (units R) (Π i, β i)) = pi.mul_action _ := rfl | ||
|
||
example (R α : Type*) (β : α → Type*) [monoid R] [semiring α] [distrib_mul_action R α] : | ||
(units.distrib_mul_action : distrib_mul_action (units R) (polynomial α)) = | ||
polynomial.distrib_mul_action := | ||
rfl | ||
|
||
/-! | ||
TODO: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/units.2Emul_action'.20diamond/near/246402813 | ||
```lean | ||
example {α : Type*} [comm_monoid α] : | ||
(units.mul_action' : mul_action (units α) (units α)) = monoid.to_mul_action _ := | ||
rfl -- fails | ||
``` | ||
-/ | ||
|
||
end units | ||
|
||
end has_scalar |