lean4-htt/tests/lean/run/grind_semiring_norm_regression.lean
Leonardo de Moura a2ceebe200
feat: semiring * propagators in grind (#11653)
This PR adds propagation rules corresponding to the `Semiring`
normalization rules introduced in #11628. The new rules apply only to
non-commutative semirings, since support for them in `grind` is limited.
The normalization rules introduced unexpected behavior in Mathlib
because they neutralize parameters such as `one_mul`: any theorem
instance associated with such a parameter is reduced to `True` by the
normalizer.
2025-12-13 14:32:34 +00:00

77 lines
2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

section Mathlib.Data.Nat.Init
namespace Nat
class AtLeastTwo (n : Nat) : Prop where
prop : 2 ≤ n
instance (n : Nat) [NeZero n] : (n + 1).AtLeastTwo :=
⟨add_le_add (one_le_iff_ne_zero.mpr (NeZero.ne n)) (Nat.le_refl 1)⟩
end Nat
end Mathlib.Data.Nat.Init
section Mathlib.Data.Nat.Cast.Defs
instance {R : Type} {n : Nat} [NatCast R] [Nat.AtLeastTwo n] :
OfNat R n where
ofNat := n.cast
end Mathlib.Data.Nat.Cast.Defs
section Mathlib.Algebra.GroupWithZero.Defs
class MulZeroClass (α : Type) extends Mul α, Zero α where
mul_zero : ∀ a : α, a * 0 = 0
end Mathlib.Algebra.GroupWithZero.Defs
section Mathlib.Algebra.Ring.Defs
class Semiring (α : Type) extends
One α, NatCast α, Add α, Mul α, MulZeroClass α
end Mathlib.Algebra.Ring.Defs
section Mathlib.Algebra.Ring.GrindInstances
instance Semiring.toGrindSemiring (α : Type) [s : Semiring α] :
Lean.Grind.Semiring α :=
{ s with
nsmul := sorry
npow := sorry
ofNat | 0 | 1 | n + 2 => inferInstance
natCast := sorry
add_zero := sorry
mul_one := sorry
zero_mul := sorry
pow_zero := sorry
pow_succ := sorry
ofNat_eq_natCast := sorry
ofNat_succ := sorry
nsmul_eq_natCast_mul := sorry
add_comm := sorry
left_distrib := sorry
right_distrib := sorry
mul_zero := sorry
add_assoc := sorry
mul_assoc := sorry
one_mul := sorry }
end Mathlib.Algebra.Ring.GrindInstances
section Mathlib.Algebra.Polynomial.Coeff
theorem coeff_mul_X_pow {R : Type} [Semiring R] (p : R) (n d : Nat) :
∀ b, b.1 + b.2 = d + n → b ≠ (d, n) → p * (if n = b.2 then 1 else 0) = 0 := by
grind only [MulZeroClass.mul_zero]
theorem coeff_mul_X_pow' {R : Type} [Semiring R] (p : R) (n d : Nat) :
∀ b, b.1 + b.2 = d + n → b ≠ (d, n) → p * (if n = b.2 then 1 else 0) = 0 := by
grind only
example [Semiring α] (a b c : α) : b = 0 → a * b * c = 0 := by
grind only
example [Semiring α] (a b c : α) : c = 1 → a = 1 → a * b * c = b := by
grind only