lean4-htt/tests/elab/rational.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

44 lines
705 B
Text

structure Rat' where
num : Int
den : Nat
pos : den > 0
instance (n : Nat) : OfNat Rat' n where
ofNat := {
num := n
den := 1
pos := by decide
}
instance : Add Rat' where
add a b := {
num := a.num * b.den + b.num * a.den
den := a.den * b.den
pos := sorry
}
instance : NatCast Rat' where
natCast n := {
num := n
den := 1
pos := by decide
}
instance : IntCast Rat' where
intCast n := {
num := n
den := 1
pos := by decide
}
def f1 (x : Rat') (n : Nat) : Rat' :=
x + n + 1
def f2 (x : Rat') (n : Nat) : Rat' :=
1 + x + n
def f3 (x : Rat') (n : Nat) : Rat' :=
1 + n + x + 2
def f4 (x : Rat') (n : Nat) : Rat' :=
n + 1 + x + n