Skip to content

fix: an imported predicate goes by the name it was written with - #15

Merged
YoanSallami merged 2 commits into
feat/v2-assertionsfrom
fix/imported-predicate-names
Oct 4, 2026
Merged

YoanSallami merged 2 commits into
feat/v2-assertionsfrom
fix/imported-predicate-names

Conversation

@YoanSallami

Copy link
Copy Markdown
Contributor

Follows #14, which was merged before its fixtures were pushed.

Problem

An import gives the predicates it brings in a prefixed name (Numbers of lib/numbers.l becomes Numbers_Numbers). That name is the compiler's, and it reached the user:

Invalid assertion 'Small.arity': 'Numbers_Numbers' has 1 column (x) but is applied to 2 arguments
✓ Numbers_Numbers.positive holds

Fix

  • The parser records, for the main program, the name each imported predicate was written with (predicate_names): the name the main file imports it under (its alias, if any), or its own name in its file.
  • check, assertions and the errors of compile, search, plan and counterexamples name predicates that way.
  • compile, search, plan and counterexamples take the written name too, so what a report prints is what a command accepts.
  • A written name that is already taken (by the main file, or by two imported files) keeps its prefix, so names stay unambiguous.
  • The generated SQL is unchanged.

Tests

.l fixtures:

  • tests/verifier_tests/fixtures/114_assertions_imported_predicate_wrong_arity.l (with lib/numbers.l)
  • tests/programs/assertions/80_statement_is_quoted_as_written.l (new # Expect: statement line)
  • tests/programs/assertions/81_error_names_an_imported_predicate_as_written.l
  • tests/programs/assertions/82_alias_is_the_written_name.l
  • 56_imported_predicate.l and 71_assertion_inside_an_imported_file.l now expect the written names.

Plus unit tests for the name mapping and two Python tests (alias, and a name already taken). The parser's reference comparison ignores predicate_names, as it does imported_predicates.

cargo test --lib: 831 passed. cargo test --no-default-features --tests: all pass (verifier 100/100). pytest tests/cli: 550 passed, 33 skipped.

🤖 Generated with Claude Code

Yoan and others added 2 commits October 4, 2026 09:42
A self-checking program states the statement an assertion is reported
with (a new '# Expect: statement' line), and a verifier fixture applies an
imported predicate to the wrong number of arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An import gives the predicates it brings in a prefixed name (Numbers of
lib/numbers.l becomes Numbers_Numbers), and that name reached the user: in
errors ('Numbers_Numbers' has 1 column...) and in assertion reports
(Numbers_Numbers.positive). Errors, warnings and reports now name a
predicate as it was written — the name the main file imports it under, or
its own in its file — and compile, search, plan and counterexamples take
that name. A written name that is already taken keeps its prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YoanSallami
YoanSallami merged commit e5e3747 into feat/v2-assertions Oct 4, 2026
31 of 32 checks passed
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