import Mathlib.Testing.SlimCheck.Functions
info:
error:
Found problems!
x := 0
y := 0
issue: 0 β 0 does not hold
(0 shrinks)
# guard_msgsError: βοΈ Docstring on `# guard_msgs` does not match generated message:
info:
---
error:
===================
Found problems!
x := 0
y := 0
issue: 0 β 0 does not hold
(0 shrinks)
------------------- ( whitespace := lax ) in
#eval Error:
===================
Found problems!
x := 0
y := 0
issue: 0 β 0 does not hold
(0 shrinks)
------------------- SlimCheck.Testable.check : (p : Prop) β
optParam SlimCheck.Configuration
{ numInst := 100, maxSize := 100, numRetries := 10, traceDiscarded := false, traceSuccesses := false,
traceShrink := false, traceShrinkCandidates := false, randomSeed := none, quiet := false } β
(p' : autoParam (SlimCheck.Decorations.DecorationsOf p) _autoβ) β
[inst : SlimCheck.Testable p'] β Lean.CoreM PUnit.{1}
SlimCheck.Testable.check Error:
===================
Found problems!
x := 0
y := 0
issue: 0 β 0 does not hold
(0 shrinks)
------------------- (β ( x y : Nat ), x + y β y + x ) Error:
===================
Found problems!
x := 0
y := 0
issue: 0 β 0 does not hold
(0 shrinks)
-------------------
instance SlimCheck.Testable.existsTestable : {Ξ± : Sort u_1} β
{var : String} β
(p : Prop) β
{Ξ² : Ξ± β Prop} β
[inst : Testable (NamedBinder var (β (x : Ξ±), NamedBinder var (Ξ² x β p)))] β
Testable (NamedBinder var (NamedBinder var (β x, Ξ² x) β p))
SlimCheck.Testable.existsTestable ( p : Prop ) { Ξ² : Ξ± β Prop }
[ Testable ( NamedBinder : String β Prop β Prop
NamedBinder var (β x , NamedBinder : String β Prop β Prop
NamedBinder var $ Ξ² x β p ))] :
Testable ( NamedBinder : String β Prop β Prop
NamedBinder var ( NamedBinder : String β Prop β Prop
NamedBinder var (β x , Ξ² x ) β p )) where
run := Ξ» cfg min => do
let x : TestResult (NamedBinder var (β (x : Ξ±), NamedBinder var (Ξ² x β p)))
x β Testable.runProp : (p : Prop) β [inst : Testable p] β Configuration β Bool β Gen (TestResult p)
Testable.runProp ( NamedBinder : String β Prop β Prop
NamedBinder var (β x , NamedBinder : String β Prop β Prop
NamedBinder var $ Ξ² x β p )) cfg min
pure : {f : Type β Type} β [self : Pure f] β {Ξ± : Type} β Ξ± β f Ξ±
pure $ SlimCheck.TestResult.iff : {p q : Prop} β (q β p) β TestResult p β TestResult q
SlimCheck.TestResult.iff exists_imp : β {Ξ± : Sort u_1} {p : Ξ± β Prop} {b : Prop}, (β x, p x) β b β β (x : Ξ±), p x β b
exists_imp x : TestResult (NamedBinder var (β (x : Ξ±), NamedBinder var (Ξ² x β p)))
x
#eval SlimCheck.Testable.check : (p : Prop) β
optParam SlimCheck.Configuration
{ numInst := 100, maxSize := 100, numRetries := 10, traceDiscarded := false, traceSuccesses := false,
traceShrink := false, traceShrinkCandidates := false, randomSeed := none, quiet := false } β
(p' : autoParam (SlimCheck.Decorations.DecorationsOf p) _autoβ) β
[inst : SlimCheck.Testable p'] β Lean.CoreM PUnit.{1}
SlimCheck.Testable.check (β ( x y : Nat ), x + y = y + x )
lemma ex1 : β (v : β Γ β), v.1 + v.2 = v.2 + v.1
ex1 : β ( v : Nat Γ Nat ), v . 1 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ±
1 + v . 2 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ²
2 = v . 2 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ²
2 + v . 1 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ±
1 := by
exact fun v => Nat.add_comm : β (n m : β), n + m = m + n
Nat.add_comm v . 1 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ±
1 v . 2 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ²
2
lemma ex2 : β (v : β Γ β), v.1 + v.2 β v.2 + v.1 β false = true
ex2 : β ( v : Nat Γ Nat ), v . 1 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ±
1 + v . 2 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ²
2 β v . 2 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ²
2 + v . 1 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ±
1 β false := by
intro h h : β Γ β
h. 1 + h. 2 β h. 2 + h. 1 β false = true
simp? Try this: simp only [ne_eq, Bool.false_eq_true, imp_false, Decidable.not_not] h : β Γ β
h. 1 + h. 2 = h. 2 + h. 1
exact?
#eval SlimCheck.Testable.check : (p : Prop) β
optParam SlimCheck.Configuration
{ numInst := 100, maxSize := 100, numRetries := 10, traceDiscarded := false, traceSuccesses := false,
traceShrink := false, traceShrinkCandidates := false, randomSeed := none, quiet := false } β
(p' : autoParam (SlimCheck.Decorations.DecorationsOf p) _autoβ) β
[inst : SlimCheck.Testable p'] β Lean.CoreM PUnit.{1}
SlimCheck.Testable.check (β ( v : Nat Γ Nat ), v . 1 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ±
1 + v . 2 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ²
2 β v . 2 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ²
2 + v . 1 : {Ξ± Ξ² : Type} β Ξ± Γ Ξ² β Ξ±
1 β false )
-- set_option trace.Meta.synthInstance true in
-- #eval SlimCheck.Testable.check (β (v : Nat Γ Nat), v.1 + v.2 β v.2 + v.1 β false)
lemma ex'' : β (x y : β), x + y = y + x
ex'' : β ( x y : Nat ), x + y = y + x := by
exact Nat.add_comm : β (n m : β), n + m = m + n
Nat.add_comm
example : (β x y, x + y β y + x) β false = true
example : (β ( x y : Nat ), x + y β y + x ) β false := by
intro h : β x y, x + y β y + x
h h : β x y, x + y β y + x
false = true
obtain β¨x, y, hβ© : β y, x + y β y + x
β¨x β¨x, y, hβ© : β y, x + y β y + x
, y β¨x, y, hβ© : β y, x + y β y + x
, h β¨x, y, hβ© : β y, x + y β y + x
β© := h : β x y, x + y β y + x
h x, y : β h : x + y β y + x
intro.intro false = true
have h' : x + y = y + x := ex'' : β (x y : β), x + y = y + x
ex'' x y x, y : β h : x + y β y + x h' : x + y = y + x
intro.intro false = true
contradiction