Dafny: a cross-file contract that names a helper from its own file is lifted without the helper (unresolved, or opaque when imported)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 43/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- backend-api-design
Línea de trabajo
The report names i6lib.ts and i6.ts as reproductions, but does not identify implementation files or tests. Start by tracing how lsc check --backend=dafny i6.ts lifts imported function contracts and how Dafny output is generated. Reproduce the unresolved helper and opaque axiom cases; done means helper-dependent contracts either include transparent helper bodies or report the unsupported dependency at lift time.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version: lsc 0.6.10 (npm), Dafny 4.11.
When file B calls a verified function from file A, lsc lifts A's //@ ensures into B's .dfy as an {:axiom} signature. If that ensures calls a helper predicate defined in A, the helper doesn't come with it.
i6lib.ts verifies on its own (2 verified, 0 errors):
//@ backend dafny
export function isPos(n: number): boolean {
//@ verify
return n > 0
}
export function bump(n: number): number {
//@ verify
//@ requires n >= 0
//@ ensures isPos(\result)
return n + 1
}
i6.ts:
//@ backend dafny
import { bump } from './i6lib.ts'
export function twice(n: number): number {
//@ verify
//@ requires n >= 0
//@ ensures \result > 0
return bump(bump(n))
}
lsc check --backend=dafny i6.ts emits:
function {:axiom} bump(n: int): int
requires (n >= 0)
ensures isPos(bump(n))
i6.dfy(5,10): Error: unresolved identifier: isPos
If B also imports isPos and calls it, the helper is emitted as a bodiless axiom, function {:axiom} isPos(n: int): bool. The lifted ensures then tells B nothing. Here bump(bump(n)) can't establish the inner call's requires n >= 0:
import { bump, isPos } from './i6lib.ts'
export function twice(n: number): boolean {
//@ verify
//@ requires n >= 0
return isPos(bump(bump(n)))
}
i6x.dfy(12,12): Error: function precondition could not be proved
i6x.dfy(6,14): Related location: this proposition could not be proved
|
6 | requires (n >= 0)
Naming isPos only in B's own //@ ensures leaves it unresolved, as in the first case.
Expected: a lifted contract carries the pure helpers it mentions, with their bodies, the same way they are emitted in A's own .dfy. Or lsc reports, at lift time, that the contract depends on a helper it can't bring in.
Suggested direction: when lifting an imported function's spec, collect the pure functions it references, transitively, and emit them as transparent functions with bodies. Emitting them as axioms gives B nothing to reason with.
Workaround: write cross-file contracts without helpers, e.g. //@ ensures \result > 0 instead of isPos(\result). With that, i6.ts verifies.
- Lenguaje dominante
- TypeScript
- Estrellas
- 113
- Forks
- 13
- Merge medio
- 16 h 22 min
- PR fusionados (30 d)
- 40
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de midspiral/LemmaScript
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
midspiral/LemmaScript#308 ·
Los mantenedores suelen responder en 1 día
-
Dafny: `toUpperCase`/`toLowerCase` are modeled as ASCII-only, so false contracts about non-ASCII text verifyPosiblemente ocupada @quangng2000 la tomó hace 1 día. Abierto
midspiral/LemmaScript#312 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 1-2 días Aptitud para principiantes 56/100
midspiral/LemmaScript#311 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 48/100
midspiral/LemmaScript#310 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
midspiral/LemmaScript#309 ·
Los mantenedores suelen responder en 1 día
Todos los issues de midspiral/LemmaScript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
vercel-labs/ui#809 ·
Los mantenedores suelen responder en 1 día
-
bot:ai-assisted component:platform-js status:untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
midnightntwrk/platform-js#38 ·
-
[bug] Second false positive on high-cost plugin alert: detection only compares patch entry id, community plugin dsh-auto | [bug] 高成本插件告警第二次误报:检测只比对 patch 条目 id,社区插件 dsh-auto-review 被认成 @deepseek-ai/dsh-experimental-auto-reviewPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ranxianglei/billion-context#7068 ·
Los mantenedores suelen responder en 1 día
-
vendor: bump whisper.cpp past 6a8addd — the current pin aborts the app on a failed Metal initAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mybigday/whisper.rn#348 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
six-group/six-webcomponents#600 ·