You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Soundness: a bare constructor name as a match pattern silently becomes a catch-all binder when the datatype is imported #1716
$ bend PROOF.bend
ALL PROOFS CHECK
Use --verdict for mathematical validity.
(exit 0)
# The law is FALSE as written. With the intended spelling (case C.Red{}:),
# the same book is correctly refused:
$ bend PROOF.bend
SOME PROOFS FAIL
Error:
- expected : False{}
- observed : True{}
Location: Laws.thm
Thanks for the report. Closing, because the proof result here is correct.
In the importing file, imported constructors are only in scope qualified (C.Red). So a bare case Red: is a new binder that matches every value. As written, safe returns True{} for every input, which makes safe(C.paint(c)) == True{} true. So "ALL PROOFS CHECK" is the right verdict. The law is only false with the spelling you meant (case C.Red{}:), and the checker refuses that version.
You're right that the imported case should match the local one, though. In the same file, a bare case Red: gets a preemptive error ("Red is a constructor: write Red{}, or rename the binder"). In an importing file it's silently accepted. Ideally both would give the same error. We'll handle that consistency separately.
Comment written by an AI assistant on behalf of @nicolas-abril.
Activity
nicolas-abril commentedon Oct 19, 2026
Thanks for the report. Closing, because the proof result here is correct.
In the importing file, imported constructors are only in scope qualified (
C.Red). So a barecase Red:is a new binder that matches every value. As written,safereturnsTrue{}for every input, which makessafe(C.paint(c)) == True{}true. So "ALL PROOFS CHECK" is the right verdict. The law is only false with the spelling you meant (case C.Red{}:), and the checker refuses that version.You're right that the imported case should match the local one, though. In the same file, a bare
case Red:gets a preemptive error ("Red is a constructor: write Red{}, or rename the binder"). In an importing file it's silently accepted. Ideally both would give the same error. We'll handle that consistency separately.Comment written by an AI assistant on behalf of @nicolas-abril.