agent-formal-verify 0.4.12 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +150 -0
- package/README.md +5 -3
- package/package.json +2 -1
- package/skills/formal-verify/SKILL.md +17 -19
- package/skills/formal-verify/examples/kani-template/src/lib.rs +5 -6
- package/skills/formal-verify/examples/lean-template/Model/BoundedQueue.statements +10 -45
- package/skills/formal-verify/examples/tla-template/BoundedQueue.matrix +16 -13
- package/skills/formal-verify/examples/tla-template/BoundedQueue.mutations +92 -14
- package/skills/formal-verify/examples/tla-template/BoundedQueue.tla +169 -28
- package/skills/formal-verify/references/evidence.md +1 -1
- package/skills/formal-verify/references/helpers.md +33 -3
- package/skills/formal-verify/references/lean-brief.md +2 -2
- package/skills/formal-verify/references/rust-brief.md +58 -6
- package/skills/formal-verify/references/setup.md +23 -7
- package/skills/formal-verify/references/tla-brief.md +3 -3
- package/skills/formal-verify/scripts/baseline.py +290 -261
- package/skills/formal-verify/scripts/kani-check.sh +3 -1
- package/skills/formal-verify/scripts/kani.py +127 -59
- package/skills/formal-verify/scripts/kani_reader.py +592 -0
- package/skills/formal-verify/scripts/lean-analysis.lean +387 -0
- package/skills/formal-verify/scripts/lean-check.sh +6 -243
- package/skills/formal-verify/scripts/lean.py +484 -0
- package/skills/formal-verify/scripts/lean_mutations.py +195 -0
- package/skills/formal-verify/scripts/lean_records.py +25 -0
- package/skills/formal-verify/scripts/mutate.py +81 -195
- package/skills/formal-verify/scripts/processes.py +266 -0
- package/skills/formal-verify/scripts/python-tools.sh +15 -0
- package/skills/formal-verify/scripts/runner.py +56 -0
- package/skills/formal-verify/scripts/rust_source.py +74 -0
- package/skills/formal-verify/scripts/setup.sh +18 -19
- package/skills/formal-verify/scripts/storage.py +207 -0
- package/skills/formal-verify/scripts/surface.py +27 -0
- package/skills/formal-verify/scripts/sync.py +401 -0
- package/skills/formal-verify/scripts/tlc-matrix.sh +3 -1
- package/skills/formal-verify/scripts/tlc.py +501 -117
- package/skills/formal-verify/scripts/tlc_report.py +516 -0
- package/skills/formal-verify/scripts/tlc_trace.py +167 -0
- package/skills/setup/SKILL.md +1 -1
- package/skills/formal-verify/scripts/lean-mutations.lean +0 -95
- package/skills/formal-verify/scripts/lean-statements.py +0 -161
- package/skills/formal-verify/scripts/lean-tools.sh +0 -24
- package/skills/formal-verify/scripts/tlc-tools.sh +0 -47
- package/skills/formal-verify/scripts/tlc-trace.py +0 -64
|
@@ -2,25 +2,103 @@
|
|
|
2
2
|
# plausible bug and names the one property that must fail on it. The text
|
|
3
3
|
# after `- ` must occur exactly once in the spec; `+ ` lines replace it. An
|
|
4
4
|
# optional `only <label-substring>` line limits the matrix runs. Every property
|
|
5
|
-
# the matrix checks needs a mutation.
|
|
5
|
+
# the matrix checks needs a mutation. The only lines here keep each mutation to
|
|
6
|
+
# the smallest runs that show its bug, which bounds the run time; without them
|
|
7
|
+
# a mutation runs on every run that checks its property.
|
|
6
8
|
|
|
7
9
|
mutation claim one item past the window
|
|
8
10
|
detects InWindow
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
only window=1
|
|
12
|
+
- next < consumed + Window
|
|
13
|
+
+ next <= consumed + Window
|
|
14
|
+
|
|
15
|
+
mutation the window never fills
|
|
16
|
+
detects reach:WindowFull
|
|
17
|
+
- next < consumed + Window
|
|
18
|
+
+ next < consumed + Window - 1
|
|
19
|
+
|
|
20
|
+
mutation a woken worker claims without rereading the window, as if a while were an if
|
|
21
|
+
detects InWindow
|
|
22
|
+
only window=1
|
|
23
|
+
- ELSE IF next < consumed + Window
|
|
24
|
+
+ ELSE IF wpc[w] = "wait" \/ next < consumed + Window
|
|
11
25
|
|
|
12
26
|
mutation claim after the last item
|
|
13
27
|
detects TypeOK
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
only window=1
|
|
29
|
+
- IF closed \/ next = Items
|
|
30
|
+
+ IF closed
|
|
16
31
|
|
|
17
|
-
mutation
|
|
18
|
-
detects
|
|
19
|
-
only
|
|
20
|
-
-
|
|
21
|
-
+
|
|
32
|
+
mutation publish into the slot claimed last
|
|
33
|
+
detects Owned
|
|
34
|
+
only workers=2
|
|
35
|
+
- /\ slot' = [slot EXCEPT ![item[w]] =
|
|
36
|
+
+ /\ slot' = [slot EXCEPT ![next - 1] =
|
|
22
37
|
|
|
23
|
-
mutation the
|
|
24
|
-
detects
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
mutation deliver the claim count
|
|
39
|
+
detects InOrder
|
|
40
|
+
only workers=2
|
|
41
|
+
- /\ out' = Append(out, consumed)
|
|
42
|
+
+ /\ out' = Append(out, next - 1)
|
|
43
|
+
|
|
44
|
+
mutation report an error before the items ahead of it
|
|
45
|
+
detects ErrorInOrder
|
|
46
|
+
only fail=1
|
|
47
|
+
- ELSE IF slot[consumed] = "failed"
|
|
48
|
+
+ ELSE IF \E i \in Indices : slot[i] = "failed"
|
|
49
|
+
|
|
50
|
+
mutation close returns before the workers exit
|
|
51
|
+
detects NoLeak
|
|
52
|
+
only window=1
|
|
53
|
+
- cpc = "join"
|
|
54
|
+
- /\ Exited
|
|
55
|
+
+ cpc = "join"
|
|
56
|
+
+ /\ TRUE
|
|
57
|
+
|
|
58
|
+
mutation close returns without freeing the untaken items
|
|
59
|
+
detects NoLeak
|
|
60
|
+
only window=1
|
|
61
|
+
- /\ slot' = [i \in Indices |-> IF slot[i] \in {"ready", "failed"} THEN "freed" ELSE slot[i]]
|
|
62
|
+
+ /\ UNCHANGED slot
|
|
63
|
+
|
|
64
|
+
mutation next() skips the item whose build failed
|
|
65
|
+
detects NoDeliveryAfterError
|
|
66
|
+
only fail=1
|
|
67
|
+
- THEN /\ cpc' = "error"
|
|
68
|
+
- /\ UNCHANGED <<consumed, slot, out, parked>>
|
|
69
|
+
+ THEN /\ slot' = [slot EXCEPT ![consumed] = "taken"]
|
|
70
|
+
+ /\ consumed' = consumed + 1
|
|
71
|
+
+ /\ cpc' = "idle"
|
|
72
|
+
+ /\ UNCHANGED <<out, parked>>
|
|
73
|
+
|
|
74
|
+
mutation publish without waking the waiters
|
|
75
|
+
detects NextReturns
|
|
76
|
+
only window=1
|
|
77
|
+
- /\ slot' = [slot EXCEPT ![item[w]] = IF item[w] \in FailAt THEN "failed" ELSE "ready"]
|
|
78
|
+
- /\ parked' = {}
|
|
79
|
+
+ /\ slot' = [slot EXCEPT ![item[w]] = IF item[w] \in FailAt THEN "failed" ELSE "ready"]
|
|
80
|
+
+ /\ parked' = parked
|
|
81
|
+
|
|
82
|
+
mutation take an item without waking the waiters
|
|
83
|
+
detects NextReturns
|
|
84
|
+
only window=1
|
|
85
|
+
- /\ consumed' = consumed + 1
|
|
86
|
+
- /\ parked' = {}
|
|
87
|
+
+ /\ consumed' = consumed + 1
|
|
88
|
+
+ /\ parked' = parked
|
|
89
|
+
|
|
90
|
+
mutation close without waking the waiters
|
|
91
|
+
detects CloseReturns
|
|
92
|
+
only window=1
|
|
93
|
+
- /\ closed' = TRUE
|
|
94
|
+
- /\ parked' = {}
|
|
95
|
+
+ /\ closed' = TRUE
|
|
96
|
+
+ /\ parked' = parked
|
|
97
|
+
|
|
98
|
+
mutation next() returns before it takes the ready item
|
|
99
|
+
detects AllConsumed
|
|
100
|
+
only window=1
|
|
101
|
+
- THEN /\ slot' = [slot EXCEPT ![consumed] = "taken"]
|
|
102
|
+
- /\ out' = Append(out, consumed)
|
|
103
|
+
- /\ consumed' = consumed + 1
|
|
104
|
+
+ THEN /\ UNCHANGED <<slot, out, consumed>>
|
|
@@ -2,43 +2,184 @@
|
|
|
2
2
|
(* Copyright (c) 2026 Michael Denyer
|
|
3
3
|
SPDX-License-Identifier: GPL-3.0-only
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
An ordered bounded queue. Each worker thread claims the next item number
|
|
6
|
+
under the mutex, builds the item without it, and publishes the item under
|
|
7
|
+
the mutex. At most Window claimed items may wait for the consumer. The one
|
|
8
|
+
consumer calls next(), which returns the items in claim order, then the
|
|
9
|
+
end, or the error of the first item whose build failed. It may stop
|
|
10
|
+
calling, call next() again after the end or an error, and call close()
|
|
11
|
+
whenever no call is in progress. close() wakes every waiter, waits for
|
|
12
|
+
every worker to exit, and frees the items the consumer never took.
|
|
13
|
+
Building an item in FailAt fails.
|
|
14
|
+
|
|
15
|
+
Each critical section under the mutex is one atomic step, so no two
|
|
16
|
+
threads hold the mutex at once and the spec needs no lock variable.
|
|
17
|
+
Building is the unlocked phase between a claim and its publish. A thread that must wait
|
|
18
|
+
parks on the one condition variable, which publishing, taking an item and
|
|
19
|
+
closing broadcast. A parked thread leaves only on a broadcast or a spurious
|
|
20
|
+
wakeup, then retakes the mutex and rereads the state, so a lost wakeup
|
|
21
|
+
shows as a liveness violation rather than a TLC deadlock.
|
|
22
|
+
|
|
23
|
+
Assumptions: one condition variable serves every wait; spurious wakeups
|
|
24
|
+
and the consumer's choice of call have no fairness; every other step is
|
|
25
|
+
weakly fair.
|
|
26
|
+
|
|
27
|
+
The window arithmetic is the one ../lean-template/Model/BoundedQueue.lean
|
|
28
|
+
proves for every size; this spec checks the threads around it for the
|
|
29
|
+
instances in BoundedQueue.matrix. BoundedQueue.mutations lists the bugs
|
|
30
|
+
its properties must detect.
|
|
31
|
+
|
|
32
|
+
To adapt it, replace this header with the source files and line ranges
|
|
33
|
+
the model follows, the functions and shared variables it covers, the
|
|
34
|
+
commit they were read at as `Source read at <commit>`, and each
|
|
35
|
+
assumption. Keep the top-level formula named Spec, which tlc-matrix.sh
|
|
15
36
|
checks. *)
|
|
16
|
-
EXTENDS Naturals
|
|
37
|
+
EXTENDS Naturals, Sequences
|
|
38
|
+
|
|
39
|
+
CONSTANTS Workers, Window, Items, FailAt
|
|
40
|
+
|
|
41
|
+
VARIABLES next, consumed, slot, out, wpc, item, cpc, parked, closed
|
|
42
|
+
\* The variables each worker and the consumer own, and the queue state under the mutex.
|
|
43
|
+
worker == <<wpc, item>>
|
|
44
|
+
consumer == <<cpc, out>>
|
|
45
|
+
queue == <<next, consumed, slot, closed>>
|
|
46
|
+
vars == <<queue, parked, worker, consumer>>
|
|
47
|
+
|
|
48
|
+
Consumer == "consumer"
|
|
49
|
+
Indices == 0..(Items - 1)
|
|
17
50
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
51
|
+
Init == /\ next = 0
|
|
52
|
+
/\ consumed = 0
|
|
53
|
+
/\ slot = [i \in Indices |-> "free"]
|
|
54
|
+
/\ out = <<>>
|
|
55
|
+
/\ wpc = [w \in Workers |-> "claim"]
|
|
56
|
+
/\ item = [w \in Workers |-> 0]
|
|
57
|
+
/\ cpc = "idle"
|
|
58
|
+
/\ parked = {}
|
|
59
|
+
/\ closed = FALSE
|
|
21
60
|
|
|
22
|
-
|
|
61
|
+
\* A worker takes the mutex to claim the next item. It waits while the window
|
|
62
|
+
\* is full, and exits once the queue is closed or every item is claimed.
|
|
63
|
+
Claim(w) ==
|
|
64
|
+
/\ wpc[w] \in {"claim", "wait"}
|
|
65
|
+
/\ w \notin parked
|
|
66
|
+
/\ IF closed \/ next = Items
|
|
67
|
+
THEN /\ wpc' = [wpc EXCEPT ![w] = "exit"]
|
|
68
|
+
/\ UNCHANGED <<next, slot, item, parked>>
|
|
69
|
+
ELSE IF next < consumed + Window
|
|
70
|
+
THEN /\ slot' = [slot EXCEPT ![next] = "building"]
|
|
71
|
+
/\ item' = [item EXCEPT ![w] = next]
|
|
72
|
+
/\ next' = next + 1
|
|
73
|
+
/\ wpc' = [wpc EXCEPT ![w] = "publish"]
|
|
74
|
+
/\ UNCHANGED parked
|
|
75
|
+
ELSE /\ parked' = parked \cup {w}
|
|
76
|
+
/\ wpc' = [wpc EXCEPT ![w] = "wait"]
|
|
77
|
+
/\ UNCHANGED <<next, slot, item>>
|
|
78
|
+
/\ UNCHANGED <<consumed, closed, consumer>>
|
|
23
79
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
80
|
+
\* After building its item, a worker takes the mutex to publish it and wakes every waiter.
|
|
81
|
+
Publish(w) ==
|
|
82
|
+
/\ wpc[w] = "publish"
|
|
83
|
+
/\ slot' = [slot EXCEPT ![item[w]] = IF item[w] \in FailAt THEN "failed" ELSE "ready"]
|
|
84
|
+
/\ parked' = {}
|
|
85
|
+
/\ wpc' = [wpc EXCEPT ![w] = "claim"]
|
|
86
|
+
/\ UNCHANGED <<next, consumed, closed, item, consumer>>
|
|
28
87
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
88
|
+
\* A parked thread wakes without a broadcast.
|
|
89
|
+
Spurious(t) ==
|
|
90
|
+
/\ t \in parked
|
|
91
|
+
/\ parked' = parked \ {t}
|
|
92
|
+
/\ UNCHANGED <<queue, worker, consumer>>
|
|
32
93
|
|
|
33
|
-
\*
|
|
34
|
-
|
|
94
|
+
\* When no call is in progress, the consumer may call next() or close(), or stop calling.
|
|
95
|
+
Call(c) ==
|
|
96
|
+
/\ cpc \in {"idle", "end", "error"}
|
|
97
|
+
/\ cpc' = c
|
|
98
|
+
/\ UNCHANGED <<queue, parked, worker, out>>
|
|
35
99
|
|
|
36
|
-
|
|
100
|
+
\* next() takes the mutex and returns the next item, the end or the error, or
|
|
101
|
+
\* waits until the next item is published.
|
|
102
|
+
TakeNext ==
|
|
103
|
+
/\ cpc \in {"next", "wait"}
|
|
104
|
+
/\ Consumer \notin parked
|
|
105
|
+
/\ IF consumed = Items
|
|
106
|
+
THEN /\ cpc' = "end"
|
|
107
|
+
/\ UNCHANGED <<consumed, slot, out, parked>>
|
|
108
|
+
ELSE IF slot[consumed] = "ready"
|
|
109
|
+
THEN /\ slot' = [slot EXCEPT ![consumed] = "taken"]
|
|
110
|
+
/\ out' = Append(out, consumed)
|
|
111
|
+
/\ consumed' = consumed + 1
|
|
112
|
+
/\ parked' = {}
|
|
113
|
+
/\ cpc' = "idle"
|
|
114
|
+
ELSE IF slot[consumed] = "failed"
|
|
115
|
+
THEN /\ cpc' = "error"
|
|
116
|
+
/\ UNCHANGED <<consumed, slot, out, parked>>
|
|
117
|
+
ELSE /\ parked' = parked \cup {Consumer}
|
|
118
|
+
/\ cpc' = "wait"
|
|
119
|
+
/\ UNCHANGED <<consumed, slot, out>>
|
|
120
|
+
/\ UNCHANGED <<next, closed, worker>>
|
|
37
121
|
|
|
38
|
-
|
|
122
|
+
\* close() marks the queue closed and wakes every waiter under the mutex, then
|
|
123
|
+
\* joins the workers and frees the items that were published but never taken.
|
|
124
|
+
Close ==
|
|
125
|
+
/\ cpc = "close"
|
|
126
|
+
/\ closed' = TRUE
|
|
127
|
+
/\ parked' = {}
|
|
128
|
+
/\ cpc' = "join"
|
|
129
|
+
/\ UNCHANGED <<next, consumed, slot, worker, out>>
|
|
39
130
|
|
|
40
|
-
|
|
131
|
+
Exited == \A w \in Workers : wpc[w] = "exit"
|
|
132
|
+
|
|
133
|
+
Join ==
|
|
134
|
+
/\ cpc = "join"
|
|
135
|
+
/\ Exited
|
|
136
|
+
/\ slot' = [i \in Indices |-> IF slot[i] \in {"ready", "failed"} THEN "freed" ELSE slot[i]]
|
|
137
|
+
/\ cpc' = "closed"
|
|
138
|
+
/\ UNCHANGED <<next, consumed, closed, parked, worker, out>>
|
|
139
|
+
|
|
140
|
+
\* Stutter once closed, so that the end of a run is not reported as a deadlock.
|
|
141
|
+
Done == cpc = "closed" /\ UNCHANGED vars
|
|
142
|
+
|
|
143
|
+
Next == \/ \E w \in Workers : Claim(w) \/ Publish(w)
|
|
144
|
+
\/ \E t \in parked : Spurious(t)
|
|
145
|
+
\/ \E c \in {"next", "close"} : Call(c)
|
|
146
|
+
\/ TakeNext \/ Close \/ Join \/ Done
|
|
147
|
+
|
|
148
|
+
Spec == /\ Init /\ [][Next]_vars
|
|
149
|
+
/\ \A w \in Workers : WF_vars(Claim(w)) /\ WF_vars(Publish(w))
|
|
150
|
+
/\ WF_vars(TakeNext) /\ WF_vars(Close) /\ WF_vars(Join)
|
|
151
|
+
|
|
152
|
+
TypeOK == /\ next \in 0..Items /\ consumed \in 0..Items
|
|
153
|
+
/\ slot \in [Indices -> {"free", "building", "ready", "failed", "taken", "freed"}]
|
|
154
|
+
/\ wpc \in [Workers -> {"claim", "wait", "publish", "exit"}]
|
|
155
|
+
/\ item \in [Workers -> 0..Items]
|
|
156
|
+
/\ cpc \in {"idle", "next", "wait", "end", "error", "close", "join", "closed"}
|
|
157
|
+
/\ parked \subseteq Workers \cup {Consumer}
|
|
158
|
+
/\ closed \in BOOLEAN
|
|
41
159
|
InWindow == consumed <= next /\ next <= consumed + Window
|
|
160
|
+
\* Each item is unclaimed, held by exactly one worker while it is built, published, taken by the
|
|
161
|
+
\* consumer, or freed by close().
|
|
162
|
+
Owned == /\ \A i \in Indices : (slot[i] = "free") = (i >= next)
|
|
163
|
+
/\ \A i \in Indices : (slot[i] = "taken") = (i < consumed)
|
|
164
|
+
/\ \A i \in Indices : (slot[i] = "building") = (\E w \in Workers : wpc[w] = "publish" /\ item[w] = i)
|
|
165
|
+
/\ \A v, w \in Workers : v # w /\ wpc[v] = "publish" /\ wpc[w] = "publish" => item[v] # item[w]
|
|
166
|
+
InOrder == out = [k \in 1..consumed |-> k - 1]
|
|
167
|
+
\* next() reports an error only for the next item, after every item ahead of it.
|
|
168
|
+
ErrorInOrder == cpc = "error" => slot[consumed] = "failed"
|
|
169
|
+
\* next() delivers no item after the first one whose build failed.
|
|
170
|
+
NoDeliveryAfterError == \A k \in 1..Len(out) : \A i \in FailAt : out[k] < i
|
|
171
|
+
\* Once close() returns, every worker has exited and every item is unclaimed, taken or freed.
|
|
172
|
+
NoLeak == cpc = "closed" => /\ Exited
|
|
173
|
+
/\ \A i \in Indices : slot[i] \in {"free", "taken", "freed"}
|
|
174
|
+
|
|
175
|
+
\* Each wait in next() returns, close() returns, and a consumer that keeps calling next() reaches the end or the error.
|
|
176
|
+
NextReturns == cpc = "wait" ~> cpc # "wait"
|
|
177
|
+
CloseReturns == cpc = "close" ~> cpc = "closed"
|
|
178
|
+
AllConsumed == []<>(cpc = "next") => <>(cpc \in {"end", "error"})
|
|
179
|
+
|
|
180
|
+
\* States that the properties depend on, for the matrix's reach checks.
|
|
42
181
|
WindowFull == next = consumed + Window
|
|
43
|
-
|
|
182
|
+
WorkerParked == parked \cap Workers # {}
|
|
183
|
+
ConsumerParked == Consumer \in parked
|
|
184
|
+
Failed == cpc = "error"
|
|
44
185
|
====
|
|
@@ -12,7 +12,7 @@ Include the matching meaning from this table where each kind of evidence first a
|
|
|
12
12
|
| A bounded search passes | Every input up to the stated bound was tried. |
|
|
13
13
|
| Mutations detected | Deliberate bugs were planted in copies of the model, and the checks caught each one. For Lean, this shows that existing proofs fail, not that the mutated statements are false. |
|
|
14
14
|
| Past fix detected | The checks fail on the behaviour before a recorded bug fix. For Lean, report proof sensitivity separately from whether a checked counterexample establishes that the property rules out that bug. |
|
|
15
|
-
| Specification unchanged | The baseline comparison preserved each recorded run's inputs and checks, reach check's selected inputs, property and fairness definition, statement record, qualified Kani harness name and function-owned assumption, cover and stub. It does not cover a Kani harness's assertions, input construction,
|
|
15
|
+
| Specification unchanged | The baseline comparison preserved each recorded run's inputs and checks, reach check's selected inputs, property and fairness definition, action subscript such as `vars`, statement record, qualified Kani harness name with its `should_panic` and `unwind` attributes and the `cfg` attributes that can switch it off on each route the record reads, and function-owned assumption, cover and stub. It does not cover a Kani harness's assertions, input construction, the conditions around its assertions, calls to assumption helpers or the `cfg` attributes on a route that its record value lists under `unread(...)`; `git diff` does. |
|
|
16
16
|
| UNAVAILABLE | The tool could not run. This target was not checked; give the printed remedy. |
|
|
17
17
|
| reproduced | A deterministic test or race-detector run fails on the production code. |
|
|
18
18
|
| reachable at shipped settings | The shipped constants and callers permit the counter-example, but no production reproduction has confirmed it yet. |
|
|
@@ -3,8 +3,38 @@
|
|
|
3
3
|
Detailed behaviour of the verification scripts under `scripts/`. Run each helper from the target repository using `bash` or `python3` with `<skill-dir>` resolved to the installed `formal-verify` skill directory.
|
|
4
4
|
|
|
5
5
|
- **Setup helper ([`scripts/setup.sh`](../scripts/setup.sh))**: verifies the pinned TLC JAR (`tla`), checks the pinned Kani driver and bundled Rust toolchain (`rust`), and is the only helper that installs a Lean toolchain (`lean`).
|
|
6
|
-
- **Matrix runner ([`scripts/tlc-matrix.sh`](../scripts/tlc-matrix.sh))**: runs TLC with a matrix of constants and prints one `PASS` or `FAIL` per run with its state count, then a `SUMMARY` line with the totals. A failing run prints its error trace reduced by [`scripts/
|
|
6
|
+
- **Matrix runner ([`scripts/tlc-matrix.sh`](../scripts/tlc-matrix.sh))**: runs TLC with a matrix of constants and prints one `PASS` or `FAIL` per run with its state count, then a `SUMMARY` line with the totals. Stops each run after sixty minutes, or after the limit in `TLC_TIMEOUT` as [setup](setup.md) describes, and forwards periodic elapsed-time and `Progress(...)` updates to `stderr` during long runs. A failing run prints its error trace reduced by [`scripts/tlc_trace.py`](../scripts/tlc_trace.py) to the variables each step changed. Set `TLC_HTML_REPORT=<path>` to also write a self-contained offline HTML report through [`scripts/tlc_report.py`](../scripts/tlc_report.py) with the run table, an interactive native SVG state chain, a variable diff panel, and copyable Mermaid `stateDiagram-v2` source for each failing and `reach` witness trace. The runner checks the path after Java and TLC and before the first run, and a path where it cannot write the report prints an `UNAVAILABLE TLC_HTML_REPORT=...` line with the remedy and exits 3. It replaces the report in one step, and a written report leaves `stdout` and the exit status as they are without one. If the write fails after the runs, the runner prints the same line and exits 1 when a run failed and 3 otherwise. `tlc.py ready` and `mutate.py` ignore the variable. Copy [`examples/tla-template/`](../examples/tla-template/BoundedQueue.tla) to start a spec and its matrix.
|
|
7
7
|
- **Lean checker ([`scripts/lean-check.sh`](../scripts/lean-check.sh))**: builds every `.lean` file in the pinned Lake project and audits every declaration of every built module. It fails on a build error, a `sorry`, a declaration that rests on an axiom beyond `propext`, `Classical.choice` and `Quot.sound`, or a `.lean` file that no Lake library owns. It checks each `<Property>.witness` theorem against its property's hypotheses, and fails on a witness that states something else, as the [Lean brief](lean-brief.md) describes. It then replays every built module, and every project module it imports, through the Lean kernel with the pin's `leanchecker`, which rejects a declaration that a command added without a kernel check. A pin without `leanchecker`, such as Lean 4.20.0, passes with the replay reported as unavailable. Use `--freeze` before the file names to record statement types and definition bodies in each model's `.statements` file before proving it. Freezing permits `sorry` and reports `FROZEN`, not a proof `PASS`. Later checks enforce those records and permit proof changes and added declarations. Given file names after the project, it checks only those files. Copy [`examples/lean-template/Model/BoundedQueue.lean`](../examples/lean-template/Model/BoundedQueue.lean) to start a model.
|
|
8
8
|
- **Rust checker ([`scripts/kani-check.sh`](../scripts/kani-check.sh))**: runs the pinned Kani on the crate's proof harnesses. It reports each harness's unwind bound and check count, requires a satisfied cover witness in each passing harness, rejects failed checks, and prints concrete playback tests when available. It stops each harness after five minutes, or after the limit in `KANI_HARNESS_TIMEOUT` as [setup](setup.md) describes, and fails a harness that reaches the limit with a message that names the setting. Each harness check, here or in the mutation runner, can take up to that limit, so run the command in the background or with a command timeout longer than the total. When discovery fails because code Kani compiles uses a feature newer than Kani's bundled toolchain (error E0658), the failure names that toolchain, and the [Rust brief](rust-brief.md) says what to rewrite or report. Copy [`examples/kani-template/`](../examples/kani-template/src/lib.rs) for a bounded-queue example.
|
|
9
|
-
- **Mutation runner ([`scripts/mutate.py`](../scripts/mutate.py))**: takes a model's `<Name>.mutations` file and applies each listed bug to a temporary copy of the model. It prints `DETECTED` or `MISSED` per mutation with what failed, `UNCOVERED` for a TLA+ property or a Kani harness in the adjacent Rust file that no mutation targets or for a public theorem in a Lean model's `.statements` file whose proof no mutation makes fail, and a `SUMMARY` line. Lean names are fully qualified. A Lean `DETECTED` line means the existing proof fails; it does not establish that the statement is false or its hypotheses can hold. A Lean mutation that changes the statement of a theorem, example or `#guard`, such as renaming a definition that the statement names, reaches no verdict. So does a Kani mutation whose harness reaches the Rust checker's time limit. A mutation with no verdict stops the run with a `FAIL` line. A Lean model needs its `.statements` file before its mutations run. All three templates include a mutations file.
|
|
10
|
-
- **
|
|
9
|
+
- **Mutation runner ([`scripts/mutate.py`](../scripts/mutate.py))**: takes a model's `<Name>.mutations` file and applies each listed bug to a temporary copy of the model. It prints `DETECTED` or `MISSED` per mutation with what failed, `UNCOVERED` for a TLA+ property or a Kani harness in the adjacent Rust file that no mutation targets or for a public theorem in a Lean model's `.statements` file whose proof no mutation makes fail, and a `SUMMARY` line. Lean names are fully qualified. A Lean `DETECTED` line means the existing proof fails; it does not establish that the statement is false or its hypotheses can hold. A Lean mutation that changes the statement of a theorem, example or `#guard`, such as renaming a definition that the statement names, reaches no verdict, and so does a mutation that edits the text of a theorem whose proof then fails. The runner matches a failing example or `#guard` to one occurrence in the original model, so a failure in an example or `#guard` that the mutation adds, or in one that it cannot match to a single original occurrence, also reaches no verdict. So does a TLA+ mutation whose check reaches the TLC time limit, or a Kani mutation whose harness reaches the Rust checker's time limit. A mutation with no verdict stops the run with a `FAIL` line. A Lean model needs its `.statements` file before its mutations run. All three templates include a mutations file.
|
|
10
|
+
- **Sync helper ([`scripts/sync.py`](../scripts/sync.py))**: takes an existing model's files, the source files its header names as `--source` and the functions and shared variables it covers as `--name`, and lists what changed since the model was last synced. [Step 1 of the skill](../SKILL.md#1-pick-the-targets) says what to do with its `SYNC none`, `READ` and `MISSING` lines.
|
|
11
|
+
- Output:
|
|
12
|
+
- `SYNC <commit> <reason>` gives the sync commit: the header's `Source read at` commit when `HEAD`'s history contains it, and otherwise the last commit of the model files that qualifies, with the reason the header's commit was not used. For a model file that is also given as `--source`, such as a production file with its Kani harness, a commit qualifies only when it changed the code of the file's `#[cfg(kani)]` items and none of its other code.
|
|
13
|
+
- `SYNC none: <reason>; compare the model with the code in full` means that no commit it read qualifies. The reason says whether it stopped at the last 100 commits of the model files, and names each rename and merge that it could not follow.
|
|
14
|
+
- Each `PATH <path>` line is a path the covered code has had since the sync commit: each source file through every rename since then, each file where `git grep` finds a covered name as a whole word now, and each file where a commit since then added or removed a covered name as a whole word.
|
|
15
|
+
- `MISSING <name>: <commits>` names a covered name found in none of the files searched, with the commits since the sync that added or removed it, or `no commit since the sync removed it`. A name that Rust files mention only in comments and strings also gets one. So does a name found only in data files, such as `.json`, `.yml` or `.toml` files, or in other files with no extension, such as a `Makefile`. Those files stay in the `PATH` lines.
|
|
16
|
+
- `READ <command>` is the `git log -p` command over every `PATH`, which includes commits made at an intermediate path and code that moved to another file.
|
|
17
|
+
- `FAIL <reason>` exits 1: outside a git repository, for a `--source` path that no commit has, and when `git grep` fails.
|
|
18
|
+
- Cannot see:
|
|
19
|
+
- Documents, such as `.md`, `.txt` and `.tex` files and `README` or `CHANGELOG` with no extension, TLA+ and Lean model files, and each of the model's files that is not also given as `--source` are not searched, unless a source path has the same extension. They get no `PATH` line, and the `READ` command does not show their changes, such as a changelog entry.
|
|
20
|
+
- In languages other than Rust, such as C, JavaScript or Python, a mention of a covered name in a comment or a string counts as finding it, so the name gets no `MISSING` line even when only a comment still mentions it.
|
|
21
|
+
- **Baseline helper ([`scripts/baseline.py`](../scripts/baseline.py))**: records what each model specifies and later names each part that changed. [Steps 2](../SKILL.md#2-prepare-the-tools) and [3](../SKILL.md#3-model-one-target-per-agent) of the skill say when to run `record` and `compare`, list the changes that `compare` reports and say what to do with them.
|
|
22
|
+
- Output of `record <record-file> <model files>`:
|
|
23
|
+
- `RECORDED <file> <digest>` for each file, with an indented `previous <digest>` line under it when the file's entry had another digest.
|
|
24
|
+
- An indented `not checked against Kani: <reason>` line: Kani is missing or the harness file's Cargo package does not compile, so the entry holds what the file's text shows alone.
|
|
25
|
+
- Output of `compare <record-file>`, which exits 1 when a recorded file changed. Each indented line under `CHANGED` counts as a change, except the `not checked against Kani at record, ...` line and the lines under it:
|
|
26
|
+
- `UNCHANGED <file>`, `CHANGED <file>` or `NOT CHECKED <file>` for each recorded file, then `SUMMARY <n> unchanged, <m> changed`, which ends with `, <k> not checked` when a file printed `NOT CHECKED`.
|
|
27
|
+
- An indented `removed <item>`, or `changed <item>` with its `old:` and `new:` values. A Kani harness's value is the `cfg` guards that can switch it off, followed by its `kani::should_panic` and `kani::unwind(<n>)` attributes and the `unread(...)` note that "Cannot see" describes. When more than one route that the record reads leads to the file, the value holds each route as its crate root's path relative to the harness file's directory and its guards, such as `routes(lib.rs: unguarded; main.rs: cfg(feature = "slow"))`, so adding, removing or guarding any route, or moving a guard from one route to another, changes the harness.
|
|
28
|
+
- An indented `added <item>`, which only a new Kani assumption or stub prints.
|
|
29
|
+
- In a TLA+ module where a local `INSTANCE` introduces substitutions, or that has an indented definition outside a `LET` or a column-0 definition inside one, the helper compares the complete text of each local module it loaded, with comments removed, so a change to a definition that no property uses also needs review. So does a column-0 definition whose header the helper cannot read, such as an infix operator, which it records with the operators it references, whether or not a property references it.
|
|
30
|
+
- An indented `file is missing`: the recorded file no longer exists.
|
|
31
|
+
- An indented `not compiled harness <name>`: Kani compiles a stored harness on no route, such as when `Cargo.toml` drops a default feature that a route's `cfg` needs.
|
|
32
|
+
- An indented `not checked against Kani at record, ...`: `record` could not check the file against Kani, so `compare` cannot tell a harness that stopped compiling from one that never compiled, such as one behind a feature that is not a default. When Kani runs at `compare`, an indented `not compiled now harness <name>` follows for each recorded harness that Kani does not compile. When Kani could not run at `compare` either, the next line gives the reason. When nothing else changed, the file prints `NOT CHECKED` instead of `CHANGED`. When `move` merges such an entry with one that `record` checked against Kani, the merged entry keeps the checked entry's harnesses, so `compare` still prints `not compiled harness <name>` for them and needs Kani. A `NOT CHECKED` file does not count as a change, so `compare` exits 0 when no file printed `CHANGED`. Report its harnesses as not checked against Kani, and name each harness on a `not compiled now` line under it.
|
|
33
|
+
- An indented `FAIL <reason>`: the helper could not read the file or ask Kani, which `compare` needs for a harness file that `record` checked against Kani, or Kani compiles a harness from the file under a name that no route the record reads gives. The reason names the problem.
|
|
34
|
+
- `FAIL baseline: <reason>` exits 1, and a `usage:` line exits 2. `record` fails this way for a file it cannot read, such as a harness file that no route the record reads reaches or a Kani form the record cannot read, where `compare` prints an indented `FAIL` under `CHANGED`. Both fail this way for an unsupported or malformed record file.
|
|
35
|
+
- Cannot see:
|
|
36
|
+
- In TLA+, the actions that `Spec` names under `[][...]_vars`, `WF_` or `SF_`. It does follow the subscript of those forms and of `<<A>>_vars`, such as `vars`, in every definition it follows, and it follows an operator that `Spec` names outside those forms, such as a fairness definition, into its actions.
|
|
37
|
+
- In Kani, a harness's assertions, input construction, the conditions around its assertions and calls to assumption helpers; read `git diff` for those.
|
|
38
|
+
- A route that the record cannot read: a `mod` declaration or `include!` inside a macro like `cfg_if!`, including a `mod $name;` that a macro builds, or inside a block such as a function body, a `#[path]` or `include!` whose path it cannot read, or a file on the way that fails to parse. It cannot tell where such a route leads, so `record` prints `route not read: <reason>`, which names the file and, except for a file that fails to parse, the line, for each one in the harness file's crates. It adds each to every harness's value as `unread(<file>: <route>; ...)`, with the file relative to the harness file's directory. Adding or removing such a route prints `CHANGED`. It does not record the route's guards, and Kani's check fails only when the route gives the harness another module path, so a guard changed on it can print no `CHANGED` line; read `git diff` for it. When no route that it reads reaches the file, `record` fails and names each of them.
|
|
39
|
+
- A Kani harness file outside any Cargo package is read from its text alone, so neither `record` nor `compare` asks Kani which harnesses it compiles.
|
|
40
|
+
- `baseline.py move <record-file> <old file> <new file>` moves a model's record entry to the file the model moved to, reading the record alone, so a later `compare` checks the new file against what the old one specified, including the harnesses that Kani compiled. For a Kani harness moved into a module of its production file, add `--module <old module> <new module>`, each relative to its file, with `crate` for the file's root, such as `--module crate proofs` for harnesses that sat at the old crate's root, even when the production file is `src/queue.rs`. When the new file already has an entry, the two are merged, and an item in both fails the move. It prints `MOVED <old> -> <new>`. Accept a move when `compare` prints `UNCHANGED`, or `NOT CHECKED` for an entry that `record` could not check against Kani, and `git diff` shows the old file's harness lines in the new module with only their indentation changed, plus the `use crate as <name>;` line and the `#[cfg(kani)] mod proofs` lines around them. When the production file's crate has a route that the record cannot read, `compare` prints a `changed harness` line for each moved harness whose `new:` value only adds an `unread(...)` note to its `old:` value; accept those too, then record the new file again. Any other change, such as an edited assertion, needs the evidence its row cites.
|
|
@@ -42,13 +42,13 @@ bash <skill-dir>/scripts/lean-check.sh <absolute-project-path> Model/<Name>.lean
|
|
|
42
42
|
python3 <skill-dir>/scripts/mutate.py <absolute-project-path>/Model/<Name>.mutations
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
The checker enforces the `.statements` file beside each checked source. Changing a theorem type, a definition type or body (including an opaque definition), or deleting a frozen declaration fails with its name. Adding lemmas and definitions and changing proofs is allowed. Re-freeze only after the production code changes, after a production test contradicts the transcription, after reviewing a toolchain bump, or after the main thread accepts a specification correction under step 3 of the skill. Older records that lack opaque body hashes also require reviewing those definitions and explicitly re-freezing before they can pass. Record the evidence, the old and new guarantees, and the reason for re-freezing in the report. Records are specific to the pinned Lean toolchain. Fingerprints use structural expressions, including the module identity of private references. If two private declarations share a name in one model, give them distinct names before freezing. A project-wide check also rejects records whose source files were deleted. Named-file checks remain limited to those files. A model without a record retains the usual proof and axiom checks, so keep the records under version control. Deleting a record removes that protection.
|
|
45
|
+
The checker enforces the `.statements` file beside each checked source. Changing a theorem type, a definition type or body (including an opaque, recursive or `partial` definition), or deleting a frozen declaration fails with its name. Adding lemmas and definitions and changing the proofs of theorems is allowed. A proof written inside a definition is part of its body. The record leaves out what Lean generates only when a proof uses it, such as `f.eq_1` and `f.induct`. Re-freeze only after the production code changes, after a production test contradicts the transcription, after reviewing a toolchain bump, or after the main thread accepts a specification correction under step 3 of the skill. Older records that lack opaque body hashes also require reviewing those definitions and explicitly re-freezing before they can pass. So do older records that list a generated lemma such as `f.eq_1`, which now reads as deleted, or a recursive definition, whose value now reads as changed. Record the evidence, the old and new guarantees, and the reason for re-freezing in the report. Records are specific to the pinned Lean toolchain. Fingerprints use structural expressions, including the module identity of private references. If two private declarations share a name in one model, give them distinct names before freezing. A project-wide check also rejects records whose source files were deleted. Named-file checks remain limited to those files. A model without a record retains the usual proof and axiom checks, so keep the records under version control. Deleting a record removes that protection.
|
|
46
46
|
|
|
47
47
|
The file name limits the Lean checker to your model, so another agent's unfinished file does not fail your check.
|
|
48
48
|
|
|
49
49
|
List plausible bugs in the mutations file, such as `<` instead of `≤`, a missing `+ 1` or a swapped argument. The mutation runner checks each on a copy of the file and names the theorems and `#guard` lines that fail. Expect both the bounded search's `#guard` and the theorem. It rejects a mutation that stops a definition compiling or changes the statement of a theorem, example or `#guard`, such as renaming a definition that a statement names. Revise the properties behind each MISSED line.
|
|
50
50
|
|
|
51
|
-
The mutation runner
|
|
51
|
+
The mutation runner checks the original file against its frozen declarations with the Lean checker before running any mutants. It uses Lean's elaborated names and source ranges to report each frozen public theorem whose proof no mutation makes fail. Structure and class projections and instance declarations are not property targets. Names remain fully qualified, including nested namespaces. A failing `#guard` or example does not cover a named theorem. The runner matches a failing guard or example to one original occurrence and compares their elaborated statements. When an edit overlaps a check, preserve the check’s text so the runner can identify a unique occurrence on both sides of the edit. A failure in a new or ambiguous check gives the mutation no verdict. Add a mutation that breaks the proof by changing the model outside the theorem, or propose a specification correction with evidence for the main thread to accept before re-freezing. A helper lemma that shows here should be `private`; a property marked `private` to hide it is a change the main thread reverts. Lean mutations take no `detects` line. For each fix commit in your row, add a mutation that restores the behaviour the code had before the fix, with the commit's short hash in its label.
|
|
52
52
|
|
|
53
53
|
A broken proof does not establish that the mutated statement is false. Even a theorem with contradictory hypotheses can have a proof that breaks when the implementation changes. Check that each theorem's hypotheses can hold together, using concrete inputs and Lean-checked witnesses where practical, and report where this was not checked. Keep proof sensitivity, hypothesis satisfiability and a checked counterexample as separate evidence. Do not claim non-vacuity or that a historical bug is ruled out from a DETECTED line alone.
|
|
54
54
|
|
|
@@ -2,16 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Use Kani for a Rust function whose inputs and loops can be bounded. Call the real
|
|
4
4
|
function from one `#[kani::proof]` harness per property. Do not transcribe its
|
|
5
|
-
implementation. Edit an existing harness in place
|
|
5
|
+
implementation. Edit an existing harness in place unless it moves, as "Moving
|
|
6
|
+
a harness" says, and start a new one from
|
|
6
7
|
[the bounded queue template](../examples/kani-template/src/lib.rs).
|
|
7
8
|
|
|
8
9
|
## Files
|
|
9
10
|
|
|
10
11
|
Work in the target repository. `<skill-dir>` means the absolute path to this
|
|
11
12
|
plugin's `skills/formal-verify` directory, not a directory in the target crate.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
Write the harnesses in a `#[cfg(kani)] mod proofs` at the end of the production
|
|
14
|
+
file that defines the function, with the header comment directly above it, as
|
|
15
|
+
the template does. Write `<Name>.mutations` beside that file, where `<Name>` is
|
|
16
|
+
the file's stem, such as `lib`. The mutation runner applies a mutation only to
|
|
17
|
+
the file beside the mutations file and checks the harnesses of that file's
|
|
18
|
+
crate, so a harness in another crate cannot detect a mutation of the production
|
|
19
|
+
code. `#[cfg(kani)]` leaves the module out of every other build, and the main
|
|
20
|
+
thread declares `cfg(kani)` in the crate's `Cargo.toml`; if a check warns about
|
|
21
|
+
an unexpected `cfg` condition named `kani`, report it and leave `Cargo.toml`
|
|
22
|
+
alone. Own only that module and the mutations file, and change no other line of
|
|
23
|
+
the production file unless the user has authorized a production fix. Move a
|
|
24
|
+
harness that an earlier run wrote in a crate of its own into its production
|
|
25
|
+
file, as "Moving a harness" says, unless it copies a production function or
|
|
26
|
+
calls functions from more than one file. Edit such a harness and its mutations
|
|
27
|
+
file where they are.
|
|
15
28
|
|
|
16
29
|
Cite the production source paths and line numbers that each property models in
|
|
17
30
|
the harness header, the functions it calls, and the commit they were read at as
|
|
@@ -31,6 +44,42 @@ main thread under step 3 of the skill. Add a mutation, with `detects`
|
|
|
31
44
|
naming the harness, for each branch or step the update adds. Update the header
|
|
32
45
|
to the code you read.
|
|
33
46
|
|
|
47
|
+
## Moving a harness
|
|
48
|
+
|
|
49
|
+
A harness that an earlier run wrote in a crate of its own can mutate only that
|
|
50
|
+
crate's files, so none of its mutations reach the production code. Move it into
|
|
51
|
+
the production file that defines the functions it calls:
|
|
52
|
+
|
|
53
|
+
1. Move its helpers and harnesses into the `#[cfg(kani)] mod proofs` at the
|
|
54
|
+
end of the production file, creating the module if the file has none, and
|
|
55
|
+
its header comment to directly above that module. Add `use crate as prod;`
|
|
56
|
+
at the top of the module, with the name the old harness gave the
|
|
57
|
+
production crate, so each `use`, stub, assumption and cover that names
|
|
58
|
+
`prod::` keeps its text. Change nothing else in this step: the moved lines
|
|
59
|
+
differ only in indentation. The main thread compares the moved
|
|
60
|
+
harnesses with its record of the old ones and reads any other difference as
|
|
61
|
+
a change that needs the evidence your row cites.
|
|
62
|
+
2. Move its `.mutations` file beside the production file as `<Name>.mutations`,
|
|
63
|
+
or append its mutations to the one already there. Rename each `detects` to
|
|
64
|
+
the harness's new qualified name as Kani prints it, such as
|
|
65
|
+
`proofs::claim_keeps_invariant` for `claim_keeps_invariant`, or
|
|
66
|
+
`queue::proofs::claim_keeps_invariant` in `src/queue.rs`. Replace each mutation that edits the harness
|
|
67
|
+
with one that edits the production function, and replay the row's fix
|
|
68
|
+
commits there.
|
|
69
|
+
3. Leave the old harness file and the rest of its crate in place, so the
|
|
70
|
+
workspace still builds, and name the file and the crate in your report. The
|
|
71
|
+
main thread deletes them.
|
|
72
|
+
4. Run the checker on the production crate and the mutation runner on the new
|
|
73
|
+
mutations file. Then make any update your row asks for, as "Existing model"
|
|
74
|
+
says.
|
|
75
|
+
|
|
76
|
+
Keep the old layout for a harness that names its own crate's items through
|
|
77
|
+
`crate::`, and report it. Stop and restore the old layout when the checker's
|
|
78
|
+
discovery fails in production code or a dependency, as the Check section
|
|
79
|
+
describes, and report it. Report the old module path and the new one, each
|
|
80
|
+
relative to its file, such as the crate root and `proofs`, even when the
|
|
81
|
+
production file is `src/queue.rs`.
|
|
82
|
+
|
|
34
83
|
## Model
|
|
35
84
|
|
|
36
85
|
Use `kani::any()` for inputs and `kani::assume` for caller constraints. Record
|
|
@@ -40,6 +89,9 @@ Put `#[kani::unwind(N)]` on every harness, above its real loop bounds. The check
|
|
|
40
89
|
requires this explicit bound and passes it to Kani. A failed unwinding assertion
|
|
41
90
|
means the bound is too low and fails the check. Discovery and verification both
|
|
42
91
|
enable `-Z stubbing`, so documented `#[kani::stub]` attributes work in either step.
|
|
92
|
+
The checker rejects a harness marked `#[kani::should_panic]` when it would verify
|
|
93
|
+
that harness, before it verifies any. Assert the condition that leads to the panic
|
|
94
|
+
instead.
|
|
43
95
|
|
|
44
96
|
Kani stops a harness at `KANI_HARNESS_TIMEOUT`, five minutes by default. Symbolic
|
|
45
97
|
inputs that reach an error constructor that builds a message with `format!`, or
|
|
@@ -69,7 +121,7 @@ python3 <skill-dir>/scripts/mutate.py /absolute/path/to/crate/src/Name.mutations
|
|
|
69
121
|
|
|
70
122
|
Append fully qualified harness names to check only those properties. The helper
|
|
71
123
|
prints one verdict per harness with the unwind bound and number of checks. It
|
|
72
|
-
requires a complete Kani 0.68.0 bundle and Python 3. It checks and invokes the
|
|
124
|
+
requires a complete Kani 0.68.0 bundle and Python 3.9 or later. It checks and invokes the
|
|
73
125
|
bundle's driver directly, without invoking the auto-installing Cargo wrapper.
|
|
74
126
|
A registered Cargo installer is not required after setup. Relative `KANI_HOME`
|
|
75
127
|
paths resolve against the caller's directory before any temporary work begins.
|
|
@@ -85,7 +137,7 @@ production crate, and report the target as not checked by Kani. A harness in a
|
|
|
85
137
|
separate crate that copies the function checks the copy, not the production
|
|
86
138
|
code, so report it as a model and name the copied source and commit.
|
|
87
139
|
|
|
88
|
-
Put `<Name>.mutations` beside the
|
|
140
|
+
Put `<Name>.mutations` beside the production file `<Name>.rs`. Use
|
|
89
141
|
`detects <fully-qualified-harness>` for each mutation. The mutation runner uses
|
|
90
142
|
the bundled Cargo to find the crate's workspace and local dependencies, copies
|
|
91
143
|
them to temporary storage with their relative paths intact, and checks the
|