Skip to content

Require closure context and universe substitution identity before conversion shortcuts - #123

Draft
heathsanchez wants to merge 3 commits into
flashfrom
research/flash-closure-identity-20261104
Draft

heathsanchez wants to merge 3 commits into
flashfrom
research/flash-closure-identity-20261104

Conversation

@heathsanchez

Copy link
Copy Markdown
Collaborator

Two distinct soundness counterexamples to an unsafe closure-equality fast path (draft)

Current published Flash src/conv.rs treats empty environments as equal even when their universe substitutions differ. It also fast-paths equality of Pi and lambda closures when bodies, domains and environments match, without comparing whether the closure evaluates the body or infers its type.

The patch restores two identities required before shortcutting conversion:

  1. For two Env::Nil instances, compare the complete structural universe substitution (ks and vs), not a hash or empty-environment tag.
  2. For Pi and Lam fast paths, require matching closure mode/context pointers; otherwise fall through to full conversion. This cannot manufacture equality from a missing semantic distinction.

Motivated by independently reported Sokonanoda issue #8 (bugs/pi-closure-context) and issue #9 (bugs/closure-level-subst). The precise source-derived guards are attributed; no originality claim for the reported failures.

Qualification builds original published Flash 78c7502bac8a5ba000057b3f083bc0595ac65750 and this branch under matched flags, requires both official Arena forged tests to change ACCEPT → REJECT and every other downloaded non-performance test to retain its exit code. Per-case artifacts and source/binary/test hashes are preserved, including failure evidence.

This is an isolated candidate from draft #120/#121/#122. Keep draft pending the before/after result and full Mathlib/performance reconciliation. No release/leaderboard claim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant