con-leche / con-ron accept a wrong `all` list on recursors and inductive types

Open
#27 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active

Research direction

Start by reading the recursor and inductive declaration validation paths in con-leche and con-ron, then run the supplied Lean and Python repro scripts to generate the malformed exports. Check how each checker validates stored recursors and InductiveVal.all against the generated declarations. Done means both malformed files are rejected by con-leche and con-ron.

Written by the indexing model from the issue text.

Description

con-leche and con-ron accept exports where the all field of a recursor or of an inductive type is wrong. Every other kernel that lake check --paranoid runs rejects them.

I know the close of #15 said unused fields like a definition's all stay unread. I'm filing this anyway because the stored recursors are now compared with the generated ones (task #431), but their all field is not, and InductiveVal.all can even name a non-type (a constructor). Feel free to close if this is the same call.

Repro
-- Mut.lean
mutual
inductive A : Type
  | base : A
  | wrap : B → A
inductive B : Type
  | mk : A → B
end
-- Foo.lean
universe u
inductive Foo (α : Sort u) : Sort (max 1 u) where
  | mk : α → Foo α
lean Mut.lean -o Mut.olean && LEAN_PATH=$(lean --print-libdir):. leanexport Mut -- A B > mut.ndjson
lean Foo.lean -o Foo.olean && LEAN_PATH=$(lean --print-libdir):. leanexport Foo -- Foo > foo.ndjson
python3 recall.py mut.ndjson > rec-all.ndjson
python3 indall.py foo.ndjson > ind-all.ndjson
con-leche rec-all.ndjson; con-leche ind-all.ndjson

recall.py:

import json, sys
# first recursor of the mutual block A/B (B.rec): drop B from its `all` ([A, B] -> [A])
L = open(sys.argv[1]).read().splitlines()
for i, l in enumerate(L):
    o = json.loads(l)
    if "inductive" in o:
        r = o["inductive"]["recs"][0]
        r["all"] = r["all"][:1]
        L[i] = json.dumps(o)
print("\n".join(L))

indall.py:

import json, sys
# InductiveVal.all of Foo gets an extra name (Foo.mk, which is not a type)
L = open(sys.argv[1]).read().splitlines()
for i, l in enumerate(L):
    o = json.loads(l)
    if "inductive" in o:
        t = o["inductive"]["types"][0]
        t["all"] = t["all"] + [o["inductive"]["ctors"][0]["name"]]
        L[i] = json.dumps(o)
print("\n".join(L))
Result
file leanchecker paranoid lean4lean nanoda con-leche con-ron
rec-all (nightly) reject reject reject reject accept accept
ind-all (nightly) reject reject reject reject accept accept
  • leanchecker: Invalid recursor B.rec / 'Foo.mk', listed in the all field of 'Foo', is not a stored inductive type
  • con-leche: accepted 1 declarations (--verified)

Same on v4.36.0 (there nanoda crashes instead of rejecting). con-ron 62cd8ab (current master) also accepts.

Impact

No contradiction found. con-* rebuild the block from the types and constructors, so the wrong list has no effect inside con-*. It is just a disagreement between the kernels on the same file; --paranoid still rejects because of the others.

Versions: bundled checkers of Lean v4.36.0 and nightly-2026-11-26.

Dominant language
Lean
Stars
212
Forks
19
Avg merge
2d 8h
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from leanprover/con-leche

All issues in leanprover/con-leche

Similar issues

More Security issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.