fix(conv): check operator type-arguments in applied op-convertibility - #1094
Open
namasikanam wants to merge 1 commit into
Open
fix(conv): check operator type-arguments in applied op-convertibility#1094namasikanam wants to merge 1 commit into
namasikanam wants to merge 1 commit into
Conversation
The `Fapp(Fop(p1,_), _), Fapp(Fop(p2,_), _)` shortcut in `conv` (ecReduction.ml) treated two applications of the same operator path as convertible without comparing their type-argument lists. When the type parameter is "phantom" (present in the operator's definition but reducing out of its head arrow type), distinct instantiations were wrongly declared equal. This is unsound: `reflexivity` proves wrap<:bool> 0 = wrap<:unit> 0 for `op wrap ['a] (x:int):int = size (to_seq<:'a> predT)`, while the stdlib pins those to |bool|=2 and |unit|=1 — yielding a proof of `false` with no axioms. The fix mirrors the unapplied `Fop, Fop` case (a few lines above) and `is_alpha_eq`, both of which already check `List.all2 for_type`. The change only makes conversion stricter (on a type-arg mismatch it falls through to the general head-conversion / unfolding path), so it cannot introduce new conversions; genuinely-true phantom equations still convert via unfolding. Adds tests/conv-typeargs.ec, a regression test using `fail reflexivity`: it compiles once the bug is fixed and fails to compile if it regresses. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
strub
force-pushed
the
fix/conv-drops-type-args
branch
from
August 21, 2026 13:34
35e2441 to
73f5882
Compare
strub
approved these changes
Aug 21, 2026
strub
enabled auto-merge
August 21, 2026 13:35
strub
disabled auto-merge
August 21, 2026 14:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A soundness bug found by Claude Code. When checking equivalence of two operators, the types of arguments should also be checked. This does not make difference when the operators are not generic, but it does make difference for generic operators.