You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 32fc557
Browse filesBrowse the repository at this point in the historyBrowse files
remove spec def: compile-time callability is inferred. A top-level val body is the only compile-time body; error[spec-handle] becomes error[comptime-handle]; spec tests move to top-level val bodies (neg cval_*), spec_gone checks the parse error
Generic parameters translate cleanly to `void*` in standard C output.
270
270
271
271
### 3. Formal Contracts & Proof Hints
272
-
srs supports formal specification primitives (`requires`, `ensures`, `invariant`, `decreases`, `proof by induction`, `proof using`) and `spec def` constructs. These facilitate transpilation to Lean 4 for interactive theorem proving.
272
+
srs supports formal specification primitives (`requires`, `ensures`, `invariant`, `decreases`, `proof by induction`, `proof using`). A contract names ordinary defs. These facilitate transpilation to Lean 4 for interactive theorem proving.
273
273
274
274
```scala
275
-
spec defsize(xs: List):I64
275
+
defsize(xs: List):I64
276
276
ensures result >=0
277
277
proof by induction xs
278
278
= xs match
279
279
caseNil=>0
280
280
caseCons(_, t) =>1+ size(t)
281
281
```
282
282
283
-
**Tests:**[`tests/s2/prog/contracts.srs`](./tests/s2/prog/contracts.srs) (contracts parse, check, and erase in C), [`tests/s2/neg/spec_impure.srs`](./tests/s2/neg/spec_impure.srs) (a spec def calls impure code, rejected).
283
+
**Tests:**[`tests/s2/prog/contracts.srs`](./tests/s2/prog/contracts.srs) (contracts parse, check, and erase in C), [`tests/s2/neg/cval_impure.srs`](./tests/s2/neg/cval_impure.srs) (a compile-time body calls impure code, rejected).
val rc: Parse.R[Coll.List[Ast.Clause]] = if Parse.isNl(ts) && Parse.isIndent(Parse.next(ts)) then Parse.clauses(Parse.next(Parse.next(ts)), Coll.Nil) else Parse.Ok(Coll.Nil, ts)
0 commit comments