lean4-htt/tests/lean/run/grind_9427.lean
Leonardo de Moura 7d2a7dba81
fix: improve evalInt? (#9479)
This PR improves the `evalInt?` function, which is used to evaluate
configuration parameters from the `ToInt` type class. This PR also adds
a new `evalNat?` function for handling the `IsCharP` type class, and
introduces a configuration option:
```
grind (exp := <num>)
```
This option controls the maximum exponent size considered during
expression evaluation. Previously, `evalInt?` used `whnf`, which could
run out of stack space when reducing terms such as `2^1024`.

closes #9427
2025-07-23 01:51:04 +00:00

38 lines
982 B
Text

example {n} (x y : BitVec n) : x * y = y * x := by
grind
example {n} (x y z w : BitVec n) : w = z → x * y - z*w = 0 → z*z = y * x := by
grind
example (x y : BitVec 64) : x * y = y * x := by
grind
example (x y : BitVec 128) : x * y = y * x := by
grind
example (x y : BitVec 128) : x * y = y * x + 2^64 * 2^64 * x := by
grind
example (x y : BitVec 256) : x * y = y * x := by
grind
example (x y : BitVec 1024) : x * y = y * x := by
grind
example (x y : BitVec 1024) : x * y = y * x := by
grind -cutsat
example (x y : BitVec 100000) : x * y = y * x := by
grind -cutsat
example (x y z : BitVec 100000) : x * y - z*z = 0 → z*z = y * x := by
grind -cutsat
/--
trace: [grind.issues] exponent 1024 exceeds threshold for exponentiation `(exp := 16)`
[grind.issues] exponent 1024 exceeds threshold for exponentiation `(exp := 16)`
-/
#guard_msgs in
set_option trace.grind.issues true in
example (x y : BitVec 1024) : x * y = y * x := by
grind (exp := 16)