Documentation
¶
Overview ¶
Package set implements deixis-set-v1, slot-member form — the finite-set container by self-keying.
set(S) = Node(None, { e(x) ↦ Node(Some(x), ∅) | x ∈ S })
See docs/design/0005-set-keys.md. e is a lawful member encoder for the slot — x ≈ y ⟺ e(x) = e(y), canonical — and the codec law then does every job a set semantics needs, with nothing invented: membership is key membership, idempotence is inherited from the floor's duplicate-key refusal, set identity reduces to node identity, and enumeration order is spelling order (a set carries no order of its own).
Under ADR 0010 this profile explicitly uses Node[Option[T]]: the set node is unvalued, and every member is a valued node without children. There is deliberately no repair anywhere: a mis-keyed entry is refused, never re-keyed, and recognition never prefers a representative among ≈-equal members — either may sit under their shared key.
The node-member form (member(n) = n, e the deixis codec combinator) is gated on the codec axis and is not implemented here.
Index ¶
Constants ¶
const Profile = "deixis-set-v1"
Profile is the name of the profile this package implements (slot-member form).
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
Contains is membership: x ∈ S iff e(x) ∈ dom — one lookup, no enumeration.
Defined over set nodes (recognize first where provenance is unknown); on an arbitrary node it answers key membership, which coincides on the image. It never reads a member's own value.
Types ¶
type Reason ¶
type Reason string
Reason is why a node is not a set node: the refusals of the slot-member form, by their stable codes.
const ( // MisKeyed: a member Node(Some(x), ∅) under a key k ≠ e(x). MisKeyed Reason = "mis_keyed" // StructMember: a child whose own value is None — the image of a Struct child. StructMember Reason = "struct_member" // LeafNode: the set node itself is Node(Some(x), ∅) — the image of a bare Leaf. LeafNode Reason = "leaf_node" // ValuedSetNode: a set node with at least one member that carries its own value, // Node(Some(t), m) with m ≠ ∅. New in N; the childless case is LeafNode's. ValuedSetNode Reason = "valued_set_node" // MemberWithChildren: a member Node(Some(x), m) with m ≠ ∅. New in N. MemberWithChildren Reason = "member_with_children" )
func Recognize ¶
Recognize is exact-or-refusal recognition of the slot-member image: an unvalued node whose every child is a valued node without children, coherent with its key (k = e(x)). It returns ("", true) for a set node and the refusal's reason otherwise.
A node with several defects has several reasons that apply, and any of them may be returned: 0005 fixes the verdict, not an order among reasons. A key outside im(e) cannot cohere with any member, so it needs no check of its own — it reduces to mis-keying.