vcgen: spec not applicable when a program argument is a projection `(mk e).env` that reduces to the spec's argument
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- devtools
Research direction
Start from the standalone reproducer in the issue: prog_spec runs sym only [] => vcgen [prog, callee_spec] <;> finish and fails with 'No spec applicable' when the argument is (mk e).env. Find where vcgen matches program arguments against a spec's stated arguments, and check why (mk e).env is not reduced to e there, even though it is rfl-equal. Done when prog_spec compiles without restating callee_spec at the projection form.
Written by the indexing model from the issue text.
Description
This issue was written by Claude (an AI assistant) on behalf of @nomeata.
Found while moving con-leche's cached-to-pure simulation proofs (a few thousand lines) to vcgen + grind (sym … => vcgen … <;> finish). Each case has a workaround in con-leche; the reproducer below is standalone.
vcgen instantiates a callee spec against the program's arguments up to
reducible unfolding only: an argument (mk e).env — the field of a
structure built by a plain def — is not matched against a spec stated
at e when e is already fixed by another argument, although
(mk e).env reduces to e by rfl.
Expected: vcgen [callee_spec] handles callee (mk e) (mk e).env.
Observed (v4.35.0 and nightly-2026-10-15): "No spec applicable to program callee (mk e) (mk e).env …
Candidates were [SpecProof.global callee_spec]" (con-leche's instance of
it reports "No spec found for program …").
(con-leche: certifyNatEqs (sharedOpsC mode fe) fe.env … in checkDeclC
at fe := mkFEnv env, against certifyNatEqsS_spec stated at env.)
Workaround: restate the callee spec at the argument form the program
has (certifyNatOpEqsS_spec, ConLeche/Verify/Cached/BridgeC.lean).
import Std.WP
import Std.Tactic.Do
open Std.WP
open scoped Lean.Order
set_option experimental.vcgen true
abbrev M := StateT Nat (Except String)
structure Box where
env : Nat
def mk (e : Nat) : Box := ⟨e⟩
def callee (b : Box) (e : Nat) : M Nat := pure (b.env + e)
theorem callee_spec (e : Nat) :
⦃fun _ => True⦄ callee (mk e) e ⦃fun v _ => v = e + e; ⊤⦄ := by
sym only [mk] => vcgen [callee] <;> finish
def prog (e : Nat) : M Nat := callee (mk e) (mk e).env
-- fails: No spec applicable to program callee (mk e) (mk e).env
theorem prog_spec (e : Nat) :
⦃fun _ => True⦄ prog e ⦃fun v _ => v = e + e; ⊤⦄ := by
sym only [] => vcgen [prog, callee_spec] <;> finish
- Dominant language
- Lean
- Stars
- 9.6k
- Forks
- 1.1k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 279
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from leanprover/lean4
-
`IO.appPath` fails when `/proc` belongs to another PID namespacePossibly taken @treiher claimed this 1 day ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#15692 · 3 reactions ·
Maintainers usually reply within 1 day
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
leanprover/lean4#15683 ·
Maintainers usually reply within 1 day
-
`Child.pid` leaks the `Child` and its pipe file descriptors (owned argument treated as borrowed)Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
leanprover/lean4#15681 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
leanprover/lean4#15677 ·
Maintainers usually reply within 1 day
-
`Child.takeStdin` loses `setsid`, so `Child.kill` only signals the child, not its process groupOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#15674 ·
Maintainers usually reply within 1 day
All issues in leanprover/lean4
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
home-assistant/installer#322 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datatug/datatug-apps#427 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
Edit tool converts CRLF files to LFPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
huggingface/tau#774 ·
Maintainers usually reply within 1 day
-
codegen: separate escaped supplementary-plane identifiers from following keywords when minifyingOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swc-project/swc-next#1023 ·
Maintainers usually reply within 1 day