Skip to content

builtin: add :ne, inequality over two evaluated constants - #92

Open
brian-slashguard wants to merge 1 commit into
google:mainfrom
slashguard:upstream-ne
Open

builtin: add :ne, inequality over two evaluated constants#92
brian-slashguard wants to merge 1 commit into
google:mainfrom
slashguard:upstream-ne

Conversation

@brian-slashguard

Copy link
Copy Markdown

Mangle has :lt/:le/:gt/:ge but no not-equals, so every inequality must be written as negation over a domain the program derives first.

This adds :ne at the same four registration points :lt uses: symbol declaration, arg modes, the decision case, and the relation type.

The relation type is the non-obvious one — without it the predicate parses and reaches evaluation, then fails type inference with cannot find assignment that works for premise :ne(A,B), which reads like a broken implementation rather than a missing registration.

Verified: differs(A,B) :- colour(A), colour(B), :ne(A,B). over three colours yields the six ordered pairs of distinct values. go build ./... is clean.

Happy to adjust naming or the type bound if you'd prefer something narrower than AnyBound.

Mangle has :lt/:le/:gt/:ge but no not-equals, so every inequality must be written as
negation over a domain the program derives first. That is a recurring authoring and
review cost for a common construct.

Adds :ne at the four registration points :lt uses — symbol, arg modes, decision case,
and relation type. The relation type is the non-obvious one: without it the predicate
parses and reaches evaluation, then fails type inference with 'cannot find assignment
that works for premise :ne(A,B)', which reads like a broken implementation.

Verified: differs(A,B) :- colour(A), colour(B), :ne(A,B) over three colours yields the
six ordered pairs of distinct values.
@google-cla

google-cla Bot commented Aug 2, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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