set/proper-subset

Usage

Description

Input

Output

Examples

True proper subset

False — equal sets

False — not contained

Details

Errors

set/proper-subset

Proper subset test (strict set containment relation)

Usage

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

Description

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

A proper subset has all its elements contained within another set and lacks at least one element that B has.

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 subset

  • B : set of T — superset 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 A are contained in B and B has

at least one element not present in A.

Examples

True proper subset

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

False — equal sets

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

False — not contained

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

Details

Set semantics:

  • Inputs are treated as sets (duplicates ignored).

  • Order does not affect results.

Relation logic:

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

and B has at least one additional distinct element.

Symbolic shorthand:

  • A ⊊ B is equivalent to set/proper_subset(A, B).

Performance:

  • Average O(|A|) 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.