Address code review: Int/Nat subtyping, CLI validation, mismatch docs#34
Merged
Conversation
…docs Add verifier tests for Int→Nat subtyping enforcement (3 tests): - test_int_to_nat_negative_caught: returning -1 as Nat fails verification - test_int_to_nat_positive_ok: non-negative Int passes as Nat - test_int_to_nat_conditional: conditional with all-positive paths passes Add CLI argument validation (3 tests + fix): - Malformed integer args after -- now produce clean error instead of Python traceback (e.g. "vera run f.vera -- abc" → "Invalid integer") - JSON mode returns structured error diagnostic - Added _is_int_str() helper, try/except around int() parsing in main() Document spec/parser @t notation mismatch in vera/README.md: - 30 spec blocks use @t in data/effect declarations; parser expects bare T - Explains the design distinction (value-level vs type-level bindings) - Notes reconciliation is tracked in scripts/check_spec_examples.py Add implementation note to spec/02-types.md explaining that Int <: Nat is permitted by the type checker with the verifier enforcing >= 0 via Z3. Update test counts: 508 → 514 tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Housekeeping PR addressing substantive points from a code review before starting C6.
1. Int/Nat bidirectional subtyping (+3 verifier tests, +spec note)
The type checker permits
Int <: Nat(rule 3b inis_subtype()) but this was:spec/02-types.mdlisted the complete subtyping relation without mentioning Int→NatFix: Added 3 verifier tests (negative caught, positive passes, conditional paths) and an implementation note in the spec's subtyping section.
2. CLI argument validation (+3 CLI tests, +bug fix)
vera run file.vera -- abccaused a raw PythonValueErrortraceback instead of a clean error message. Theint(a)parsing inmain()had no error handling.Fix: Added try/except with clean error message (
Invalid integer argument(s): abc), JSON mode support, and 3 subprocess tests.3. Spec/parser mismatch documentation
The 30 MISMATCH items in
check_spec_examples.py(spec uses@Tin data/effect declarations, parser expects bareT) were tracked in the script but not documented anywhere user-facing.Fix: Added a paragraph to
vera/README.mdCurrent Limitations explaining the design distinction (value-level vs type-level binding notation) and that reconciliation is tracked.4. Test count updates
508 → 514 tests across all documentation files.
Test plan