lean4-htt/tests/elab/grind_11745_extra.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

70 lines
2.1 KiB
Text
Raw Permalink 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.

/-
Additional tests for #11745: nonstandard instances in grind and simp +arith
These extend the basic tests in grind_11745.lean
-/
-- Setup: non-canonical LE and LT instances via class extension
class Preorder (α : Type u) extends LE α
class StrictPreorder (α : Type u) extends LT α
instance instPreorderInt : Preorder Int where
instance instStrictPreorderInt : StrictPreorder Int where
instance instPreorderNat : Preorder Nat where
instance instStrictPreorderNat : StrictPreorder Nat where
-- LT instances (Int)
example (x y : Int) (h : @LT.lt Int instStrictPreorderInt.toLT x y) : x < y := by
grind -order
example (x y : Int) (h : @LT.lt Int instStrictPreorderInt.toLT x y) : x < y := by
lia -order
-- Nat LE instances
example (x y : Nat) (h : @LE.le Nat instPreorderNat.toLE x y) : x ≤ y := by
grind -order
example (x y : Nat) (h : @LE.le Nat instPreorderNat.toLE x y) : x ≤ y := by
lia -order
-- Nat LT instances
example (x y : Nat) (h : @LT.lt Nat instStrictPreorderNat.toLT x y) : x < y := by
grind -order
example (x y : Nat) (h : @LT.lt Nat instStrictPreorderNat.toLT x y) : x < y := by
lia -order
-- Mixed canonical and non-canonical instances
example (x y z : Int)
(h1 : @LE.le Int instPreorderInt.toLE x y) -- non-canonical
(h2 : y ≤ z) -- canonical
: x ≤ z := by
grind -order
example (x y z : Int)
(h1 : @LE.le Int instPreorderInt.toLE x y)
(h2 : y ≤ z)
: x ≤ z := by
lia -order
-- Equality derived from two LE constraints
example (x y : Int)
(h1 : @LE.le Int instPreorderInt.toLE x y)
(h2 : @LE.le Int instPreorderInt.toLE y x)
: x = y := by
grind -order
example (x y : Int)
(h1 : @LE.le Int instPreorderInt.toLE x y)
(h2 : @LE.le Int instPreorderInt.toLE y x)
: x = y := by
lia -order
-- simp +arith with non-canonical instances
example (c x : Int) (mx : @LE.le Int instPreorderInt.toLE x c) : x ≤ c := by
simp +arith [mx]
example (c x : Int) (mx : @LT.lt Int instStrictPreorderInt.toLT x c) : x < c := by
simp +arith [mx]
example (c x : Nat) (mx : @LE.le Nat instPreorderNat.toLE x c) : x ≤ c := by
simp +arith [mx]