lsc check accepts added requires/ensures lines in .dfy, so a proof file can make obligations vacuous
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- tooling
Direzione di ricerca
Start with additionsOnly in tools/src/dafny-commands.ts, which currently rejects only deleted lines when .dfy is compared with .dfy.gen. Reproduce the two cases from the issue: an added requires in a generated header, and an added assume or {:axiom} declaration, both passing lsc check. Done means these additions are rejected or explicitly configured, while legitimate appended lemmas still pass. The issue leaves the exact rule open, so agree on it with maintainers first.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This was generated by AI during triage.
Summary
lsc check treats any line that appears in foo.dfy but not in foo.dfy.gen as an allowed proof addition. additionsOnly in tools/src/dafny-commands.ts (checked on main at 566df0d) rejects only deleted lines. An added requires, assume, or {:axiom} passes the check. Each of these weakens what is proved while lsc check still reports success.
Reproduction
Observed with lemmascript 0.6.8 and Dafny 4.11.0. The code involved is unchanged on main.
-
Write a function with a guard in its contract and run
lsc gen, so thatcounter.dfyandcounter.dfy.genboth contain:function increment(c: Counter): Counter requires inRange(c) && belowMaximum(c) -
Remove
belowMaximum(context)from the TypeScript//@ requires(or from the guard in the body) and runlsc genagain.counter.dfy.genis regenerated without the clause.counter.dfyis left as it was. -
Run
lsc check. It reports all obligations verified. The diff from.dfy.gento.dfyshows the stalerequires ... && belowMaximum(c)line as an addition, so the check accepts it and Dafny verifies the old, stronger-precondition model instead of the current source.
The same check accepts lines added inside a generated header. Adding two lines to a generated contract lemma:
lemma increment_ensures(context: Context)
requires inRange(context)
requires belowMaximum(context)
requires false // added
ensures false // added
ensures inRange(increment(context))
and running lsc check --backend=dafny quantityCounter.ts regenerates .dfy.gen, passes the diff check, and prints Dafny program verifier finished with 11 verified, 0 errors, including the proof of ensures false. It also accepts new declarations that use assume or {:axiom}, which a proof addition can then rely on. Putting {:axiom} on an existing generated line does count as a modification and is rejected.
Expected
Proof additions should not be able to change what the generated declarations claim. Possible rules:
- Reject added lines that fall inside a generated declaration's header (
requires,ensures,decreases,reads, attributes). Allow new declarations and lemma bodies. - Reject
assumeand{:axiom}in proof additions unless explicitly allowed by configuration. - Optionally, have
lsc checkwarn when.dfypredates the latest.dfy.genand the regen merge was not run.
Context
We work around this in a downstream runner by requiring the generated text to appear byte-for-byte in the proof file, allowing only appended declarations and lemma calls, and refusing assume and attributes. We would prefer to rely on lsc check for this. Related, closed: #280 (regen merge conflicts), #192 (a translation that verified the wrong model).
- Lingua principale
- TypeScript
- Stelle
- 113
- Fork
- 13
- Merge medio
- 16h 22m
- PR unite (30g)
- 40
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di midspiral/LemmaScript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
midspiral/LemmaScript#308 ·
I maintainer di solito rispondono entro 1 giorno
-
Dafny: `toUpperCase`/`toLowerCase` are modeled as ASCII-only, so false contracts about non-ASCII text verifyForse già presa @quangng2000 l’ha presa 1 giorno fa. Aperta
midspiral/LemmaScript#312 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 1-2 giorni Idoneità per principianti 56/100
midspiral/LemmaScript#311 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 48/100
midspiral/LemmaScript#310 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
midspiral/LemmaScript#309 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di midspiral/LemmaScript
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 83/100
gofish-graphics/gofish-graphics#1384 ·
I maintainer di solito rispondono entro 1 giorno
-
adapter bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
Olanetsoft/agent-lookout#353 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
vicharanashala/vibe#1542 ·
I maintainer di solito rispondono entro 1 giorno
-
bug chore P2 size:XS
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
josephfung/curia#2666 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
devarshishimpi/codra#178 ·
I maintainer di solito rispondono entro 1 giorno