lean4-htt/tests/lean/run/grind_cutsat_cooper.lean
Joachim Breitner 0e49576fe4
feat: guard_msgs to treat trace messages separate (#8267)
This PR makes `#guard_msgs` to treat `trace` messages separate from
`info`, `warning` and `error`. It also introduce the ability to say
`#guard_msgs (pass info`, like `(drop info)` so far, and also adds
`(check info)` as the explicit form of `(info)`, for completeness.

Fixes #8266
2025-05-09 05:44:34 +00:00

62 lines
1.6 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.

import Std.Internal.Rat
set_option grind.warning false
example (x y : Int) :
27 ≤ 11*x + 13*y →
11*x + 13*y ≤ 45 →
-10 ≤ 7*x - 9*y →
7*x - 9*y ≤ 4 → False := by
-- `omega` fails in this example
grind
example (x : Int) : 100 ≤ x → x ≤ 10000 → 20000 3*x → False := by
grind
abbrev problem₁ [∀ n, OfNat α n] [Neg α] [Mul α] [Sub α] [Add α] [LE α] (x y : α) : Prop :=
27 ≤ 11*x + 13*y ∧
11*x + 13*y ≤ 45 ∧
-10 ≤ 7*x - 9*y ∧
7*x - 9*y ≤ 4
/--
trace: [grind.cutsat.model] x := 241/154
[grind.cutsat.model] y := 1
-/
#guard_msgs (trace) in
set_option trace.grind.cutsat.model true in
example (x y : Int) : problem₁ x y → False := by
fail_if_success grind +qlia -- Rational counterexamples allowed
sorry
/-- info: true -/
#guard_msgs in
open Std.Internal in
#eval problem₁ (241/154 : Rat) (1 : Rat)
theorem ex₁ (x y : Int) :
27 ≤ 13*x + 11*y → 13*x + 11*y ≤ 30 →
-10 ≤ 9*x - 7*y → 9*x - 7*y ≤ 4 → False := by
grind
theorem ex₂ (x y : Int) :
27 ≤ 11*x + 13*y → 11*x + 13*y ≤ 45 →
-10 ≤ 7*x - 9*y → 7*x - 9*y ≤ 4 → False := by
grind
theorem ex₃ (x y : Int) :
5 ≤ x + y → x + 2*y ≤ 14 → 7 x → 4 y → y ≥ 4 → False := by
grind
theorem ex₄ (x y : Int) :
5 ≤ 2*x + y → 3*x + 2*y ≤ 14 → 7 x → 4 y → y ≥ 4 → False := by
grind
theorem ex₅ (x y : Int) : 1 ≤ x + y → 100 x + y → 100 ≤ x + y := by
grind
open Int.Linear
#print ex₁
#print ex₂
#print ex₃
#print ex₄
#print ex₅