Expose structural predicate identity with PredicateKey (functor + arity) #33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Spindle represents predicate arguments structurally, but does not expose a reusable public identity for a predicate independently of a concrete literal.
Consumers currently have several imperfect choices:
Literal::name(), conflating predicates with different arities;LiteralId, which intentionally ignores predicate arguments and arity;For example, these should not have the same predicate identity:
This matters for vocabulary introspection, rule indexing, listener discovery, diagnostics, and tools that need to distinguish a predicate from a ground proposition.
Spindle already uses name and arity together internally in places such as the grounding fact index. Making that concept explicit would provide one canonical implementation for
downstream consumers.
Proposal
Introduce a public structural predicate key:
Provide constructors and accessors along these lines:
Body literals should expose the same identity where applicable:
PredicateKey should represent only predicate identity:
Those properties belong to literal occurrences and matching semantics, not predicate identity.
Optional follow-up: observed literal shapes
A separate LiteralShape abstraction may be useful for introspection:
This could support diagnostics such as primitive argument-type drift. It should not be required for the initial PredicateKey work.
It may also be preferable to normalize integer, decimal, and float to a common Number kind in compatibility-oriented views because Spindle supports cross-type numeric equality.
LiteralShape would describe observed primitive term kinds only. It would not introduce semantic sorts such as TaskId or AgentId; predicate signatures and nominal types would require
a separate design.
Benefits
Suggested scope
Initial implementation:
Possible later work:
Open questions