lean4-htt/tests/lean/run/grind_9321.lean
Leonardo de Moura 253c10c398
fix: normalize Nat.cast and Int.cast of numerals in grind (#9901)
This PR ensures that `Nat.cast` and `Int.cast` of numerals are
normalized by `grind`.
It also adds a `simp` flag for controlling how bitvector literals are
represented. By default, the bitvector simprocs use `BitVec.ofNat`. This
representation is problematic for the `grind ring` and `grind cutsat`
modules. The new flag allows the use of `OfNat.ofNat` and `Neg.neg` to
represent literals, consistent with how they are represented for other
commutative rings.

Closes #9321
2025-08-14 02:04:55 +00:00

15 lines
676 B
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.

example (z : Int) : z + (Int.cast (R := Int) (-2)) = z - 2 := by grind
attribute [local instance] Lean.Grind.Semiring.natCast Lean.Grind.Ring.intCast
example {α : Type} [Lean.Grind.Field α] {z : α} : z / ↑(0 : Nat) = 0 := by grind
example {α : Type} [Lean.Grind.Field α] {z : α} : z / ↑(-0 : Int) = 0 := by grind
example {α : Type} [Lean.Grind.Field α] {z : α} : z + ↑(1 : Nat) = z + 1 := by grind
example {α : Type} [Lean.Grind.Field α] {z : α} : z + ↑(1 : Int) = z + 1 := by grind
example (a : Fin 2) : a + ↑(1 : Nat) = a + 1 := by grind
example {α : Type} [Lean.Grind.Ring α] {z : α} : z + (Int.cast (R := α) (-2) : α) = z - 2 := by grind