set/proper-superset

Usage

Description

Input

Output

Examples

True proper superset

False — equal sets

False — missing an element

Details

Errors

set/proper-superset

Proper superset test (strict set containment relation)

Usage

R:=set/proper-superset(A, B)R:=AB

Description

Determines whether set A is a proper superset of set B.

A proper superset contains all elements of another set and at least one 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:

  • T must be hashable and comparable for equality (Eq + Hash in Rust).

  • Common scalar kinds: integers, strings, symbols, booleans.

Output

Result:

- R : boolean — true if all elements of B are contained in A and A has

at least one element not present in B.

Examples

True proper superset

A:={"a", "b", "c", "d"}B:={"b", "c"}R:=set/proper-superset(A, B)

False — equal sets

A:={1, 2, 3}B:={1, 2, 3}R:=AB

False — missing an element

A:={"x", "y"}B:={"x", "y", "z"}R:=set/proper-superset(A, B)

Details

Set semantics:

  • Inputs are treated as sets (duplicates ignored).

  • Order does not affect results.

Relation logic:

- A is a proper superset of B if every element of B exists in A

and A has at least one additional distinct element.

Symbolic shorthand:

  • A ⊋ B is equivalent to set/proper_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.