Repository navigation
Expand file tree
/
Copy pathdafny.toml
More file actions
309 lines (271 loc) · 10.1 KB
/
Copy pathdafny.toml
File metadata and controls
309 lines (271 loc) · 10.1 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# SPDX-License-Identifier: MPL-2.0
#
# Dafny tactic, spec-clause, and hazard synonyms.
# Schema: see data/synonyms/README.adoc.
# Seeded 2026-06-01 alongside the Dafny corpus adapter.
#
# Coverage focus: the surface a `verify_proof` strategy has to reason
# about — declaration keywords, specification clauses (`requires` /
# `ensures` / `invariant` / `decreases` / framing), the SOUNDNESS-CRITICAL
# escape hatches (`assume`, `:axiom`, `extern`, `expect`, `:fuel 0`),
# refinement keywords, and the auto-active hint attributes Dafny accepts
# in `{:foo}` form.
# ---------------------------------------------------------------------------
# Declaration keywords
# ---------------------------------------------------------------------------
[[synonym]]
canonical = "method"
aliases = ["proc", "procedure"]
tactic_class = "decl"
notes = """
Imperative procedure. Has `requires` precondition, `ensures`
post-condition, optional `modifies` frame, and a body verified by
weakest-precondition + SMT.
"""
[[synonym]]
canonical = "lemma"
aliases = ["ghost-method", "proof-method"]
tactic_class = "decl"
notes = """
A `lemma` is a ghost method: no runtime semantics, exists purely to
discharge proof obligations. Body steps Dafny through a calc / case
analysis / nested-lemma dance to convince Z3.
"""
[[synonym]]
canonical = "function"
aliases = ["pure-function", "math-function"]
tactic_class = "decl"
notes = """
Pure mathematical function (no heap reads unless marked `function
method`). Body is an expression. Counts as ghost by default — use
`function method` for compile-to-runtime variants.
"""
[[synonym]]
canonical = "predicate"
aliases = ["bool-function"]
tactic_class = "decl"
notes = "Boolean-valued `function`. `predicate P(x) { body }` ≡ `function P(x): bool { body }`."
[[synonym]]
canonical = "ghost"
aliases = ["ghost var", "ghost method", "ghost function", "ghost predicate"]
tactic_class = "decl"
notes = "Erased at compile time; exists only for verification."
[[synonym]]
canonical = "class"
aliases = ["heap-class"]
tactic_class = "decl"
notes = "Reference type with a `Repr` ghost field convention for ownership accounting."
[[synonym]]
canonical = "trait"
aliases = ["interface"]
tactic_class = "decl"
notes = "Dafny's interface analogue. Methods + ghost predicates; refined by `class C extends T`."
[[synonym]]
canonical = "datatype"
aliases = ["adt", "algebraic-data-type", "inductive-datatype"]
tactic_class = "decl"
notes = """
Algebraic data type, optionally `codatatype` for co-inductive shapes.
Pattern-matched via `match`. Termination on a `datatype` parameter is
automatic structural decrease.
"""
[[synonym]]
canonical = "type"
aliases = ["type-synonym", "subset-type", "newtype"]
tactic_class = "decl"
notes = """
Three flavours: `type T = U` (synonym), `type T = x: U | P(x) witness w`
(subset type with witness obligation), and `newtype T = x: U | P(x)`
(distinct runtime representation).
"""
[[synonym]]
canonical = "module"
aliases = ["abstract-module", "refinement-module"]
tactic_class = "decl"
notes = "Namespaces + refinement carrier. `abstract module M` declares; `module M refines A` provides."
# ---------------------------------------------------------------------------
# Specification annotations
# ---------------------------------------------------------------------------
[[synonym]]
canonical = "requires"
aliases = ["precondition", "pre"]
tactic_class = "spec"
notes = "Pre-condition. Callers prove it; callees assume it."
[[synonym]]
canonical = "ensures"
aliases = ["postcondition", "post"]
tactic_class = "spec"
notes = "Post-condition. Callees prove it; callers assume it."
[[synonym]]
canonical = "invariant"
aliases = ["loop-invariant", "object-invariant"]
tactic_class = "spec"
notes = """
Loop invariant (in `while`) or object invariant (`Valid()` predicate
convention). The single most common reason a Dafny proof fails is a
loop invariant that's too weak.
"""
[[synonym]]
canonical = "decreases"
aliases = ["termination-measure", "variant"]
tactic_class = "spec"
notes = """
Termination measure. Lexicographic tuples allowed. `decreases *`
disables termination checking (CO-INDUCTION / CONCURRENCY only).
"""
[[synonym]]
canonical = "modifies"
aliases = ["frame-modifies", "writes"]
tactic_class = "spec"
notes = "Frame clause: heap locations the method may mutate."
[[synonym]]
canonical = "reads"
aliases = ["frame-reads"]
tactic_class = "spec"
notes = "Frame clause for `function`/`predicate`: heap locations read by the expression."
[[synonym]]
canonical = "frees"
aliases = ["frame-frees"]
tactic_class = "spec"
notes = "Frame clause for memory deallocation (rarely used; for the C/native subset)."
# ---------------------------------------------------------------------------
# HAZARDS — soundness escape hatches
# ---------------------------------------------------------------------------
[[synonym]]
canonical = "assume"
aliases = ["assume {:axiom}", "assume false"]
tactic_class = "hazard"
notes = """
SOUNDNESS ESCAPE. The verifier accepts the predicate without proof.
Equivalent in trust terms to an Agda `postulate` or a Coq `Admitted`.
`assume false` is the strongest form: every subsequent goal is
trivially discharged. ECHIDNA's SA design-search REJECTS any candidate
proof whose body contains an `assume` (unless explicitly whitelisted
as part of an interactive sketch).
"""
[[synonym]]
canonical = "expect"
aliases = ["runtime-check"]
tactic_class = "hazard"
notes = """
Runtime check, NOT statically verified. The compiler emits an
`if (!cond) abort()`. The verifier IGNORES the condition. Useful for
testing but invisible to the trusted base — flag for human review.
"""
[[synonym]]
canonical = ":axiom"
aliases = ["assert {:axiom}", "{:axiom}"]
tactic_class = "hazard"
notes = """
The `{:axiom}` attribute lets you mark an `assert` (or a function body)
as axiomatic — Dafny will not require a proof. Identical soundness
profile to `assume`.
"""
[[synonym]]
canonical = "extern"
aliases = ["{:extern}", "extern method"]
tactic_class = "hazard"
notes = """
`extern` (or `{:extern}`) marks the implementation as supplied by the
target-language runtime (e.g. C# / Java). The verifier trusts that
the foreign implementation meets the spec. Hazard tier: trusted-but-
unverified.
"""
# ---------------------------------------------------------------------------
# Tactic-ish proof helpers
# ---------------------------------------------------------------------------
[[synonym]]
canonical = "calc"
aliases = ["calculational-proof", "equational-chain"]
tactic_class = "calc"
notes = """
Calculational proof block: `calc { e1; OP e2; { hint } OP e3; ... }`.
The default `OP` is `==`. The `{ hint }` between steps is where you
inline a lemma call or `assert`.
"""
[[synonym]]
canonical = "forall-ensures"
aliases = ["forall ... ensures ...", "ghost-forall"]
tactic_class = "calc"
notes = """
`forall x | P(x) ensures Q(x) { body }` — a ghost universal-quantifier
proof. Body proves `Q(x)` for an arbitrary `x` satisfying `P`, and
Dafny lifts the conclusion to `forall x. P(x) ==> Q(x)`.
"""
[[synonym]]
canonical = "assert-by"
aliases = ["assert ... by { ... }", "subproof-assert"]
tactic_class = "calc"
notes = """
`assert P by { ... }` — local subproof. The body is verified
in-context, and `P` becomes available afterwards. Used to nudge Z3
when the global automation can't find the proof but a focused one can.
"""
# ---------------------------------------------------------------------------
# Auto-active hints (attributes)
# ---------------------------------------------------------------------------
[[synonym]]
canonical = ":opaque"
aliases = ["{:opaque}", "opaque-function"]
tactic_class = "auto_active"
notes = """
Marks a function as opaque to the verifier — the body is not unfolded
unless explicitly `reveal F();`. Cuts solver context, often turns red
to green.
"""
[[synonym]]
canonical = ":fuel"
aliases = ["{:fuel}", "{:fuel 0}", "fuel-attribute"]
tactic_class = "auto_active"
notes = """
Controls how aggressively Dafny unfolds a recursive function during
verification. `{:fuel 0}` disables unfolding entirely (HAZARD-adjacent
— effectively makes the function opaque to the goal). Higher fuel
helps with chains of recursive unfolds.
"""
[[synonym]]
canonical = ":induction"
aliases = ["{:induction}", "{:induction false}"]
tactic_class = "auto_active"
notes = """
Auto-induction hint. `{:induction}` enables; `{:induction false}`
disables. By default Dafny induct on the first inductive parameter of
a lemma; this hint redirects.
"""
[[synonym]]
canonical = ":verify"
aliases = ["{:verify}", "{:verify false}"]
tactic_class = "auto_active"
notes = """
`{:verify false}` skips verification of the marked entity. Useful
during iteration; HAZARD-tier when left in production code (the
unverified entity is implicitly trusted).
"""
# ---------------------------------------------------------------------------
# Refinement
# ---------------------------------------------------------------------------
[[synonym]]
canonical = "refines"
aliases = ["module-refines", "abstract-refines"]
tactic_class = "refinement"
notes = """
`module C refines A` — supplies bodies for `A`'s abstract declarations.
Each refining decl must prove it preserves the abstract spec.
"""
[[synonym]]
canonical = "replaces"
aliases = ["module-replaces"]
tactic_class = "refinement"
notes = """
In a refinement, `replaces X by Y` swaps one decl for another while
preserving the public contract. Newer Dafny syntax — older versions
use unqualified `refines`.
"""
[[synonym]]
canonical = "provides"
aliases = ["export-provides", "import-provides"]
tactic_class = "refinement"
notes = """
Export-set qualifier. `export E provides f` exposes `f` to importers
under export set `E`. Pairs with `reveals` (exposes body too).
"""