forked from thanhnguyen-aws/plausible
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTactic.lean
More file actions
161 lines (135 loc) · 4.06 KB
/
Copy pathTactic.lean
File metadata and controls
161 lines (135 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Henrik Böving
-/
import Plausible
/-!
Demonstrate that Plausible can handle the basic types from core:
- Sum
- Sigma
- Unit
- Prod
- Bool
- Nat
- Fin
- UIntX
- BitVec
- Char
- Option
- List
- String
- Array
-/
/-- error: Found a counter-example! -/
#guard_msgs in
example (a b : Sum Nat Nat) : a = b := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a b : Σ n : Nat, Nat) : a.fst = b.snd := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a b : Unit) : a ≠ b := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (x y : Nat × Unit) : x = y := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a b : Bool) : a = b := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a b c : Nat) : a + (b - c) = (a + b) - c := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : Fin (n + 1)) : a + 1 > a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : BitVec n) : a + 1 > a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : UInt8) : a - 1 < a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : UInt16) : a - 1 < a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : UInt32) : a - 1 < a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : UInt64) : a - 1 < a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : USize) : a - 1 < a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : Char) : a ≠ a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (a : Option Char) : a ≠ a := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (xs ys : List Nat) : xs.length = ys.length → xs = ys := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (xs ys : String) : xs.length = ys.length → xs = ys := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (xs ys : Array Nat) : xs.size = ys.size → xs = ys := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
example (xs : List Int) (f : Int → Int) : xs.map f = xs := by
plausible (config := {quiet := true})
/--
info: Unable to find a counter-example
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
example (a : Sum Nat Nat) : a = a := by
plausible
/--
warning: Gave up after failing to generate values that fulfill the preconditions 100 times.
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
example (a b : Sum Nat Nat) : a ≠ a → a = b := by
plausible (config := {numInst := 100})
-- https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/slim_check.20giving.20wrong.20counterexamples.3F/near/420008365
open Nat in
/--
info: Unable to find a counter-example
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
theorem testBit_pred :
testBit (pred x) i = (decide (0 < x) &&
(Bool.xor ((List.range i).all fun j => ! testBit x j) (testBit x i))) := by
plausible
/-- error: Found a counter-example! -/
#guard_msgs in
theorem ulift_nat (f : ULift.{1} Nat) : f = ⟨0⟩ := by
plausible (config := {quiet := true})
/-- error: Found a counter-example! -/
#guard_msgs in
theorem type_u (α : Type u) (l : List α) : l = l ++ l := by
plausible (config := {quiet := true})