set/superset
Superset test (set containment relation)
Usage
R:=set/superset(A, B)R:=A⊃B
Description
Determines whether set A is a superset of set B.
A superset contains all elements of another set, possibly more.
This function returns a boolean value indicating the result.
The implementation wraps the Rust IndexSet containment logic and
preserves Mech’s deterministic order semantics for reproducibility.
Input
Arguments:
A : set of T — candidate superset
B : set of T — subset being tested
Element type constraints:
Tmust be hashable and comparable for equality (Eq+Hashin Rust).Common scalar kinds: integers, strings, symbols, booleans.
Output
Result:
R : boolean — true if all elements of
Bare contained inA, otherwise false.
Examples
True superset
Result: R = true
False superset
Result: R = false
Equal sets still count as supersets
Result: R = true
Details
Set semantics:
Inputs are treated as sets (duplicates ignored).
Order does not affect results.
Relation logic:
- A is a superset of B if every element of B exists in A.
- This differs from a proper superset, which requires A to contain
strictly more elements than B.
Symbolic shorthand:
A ⊇ Bis equivalent toset/superset(A, B).
Performance:
Average O(|B|) time using hashing; memory O(1).
Determinism:
Results are deterministic across runs and platforms.
Errors
Incorrect number of arguments (expects two).
Unsupported element type (not hashable or comparable).
Inconsistent element kinds between A and B.