xpile 0.1.616

Polyglot transpile workbench (Python/C/C++/Rust/Ruchy/Lean ↔ Rust/Ruchy/PTX/WGSL/SPIR-V) with provable contracts at every layer.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# PMAT-1152 (oracle-reliability): Python sets lower to indexmap::IndexSet (not
# std HashSet) so iteration order is DETERMINISTIC run-to-run — HashSet's
# per-process RandomState made set-order output flap (non-deterministic Rust,
# thrashing the differential oracle). Order-independent set ops are unaffected.
def dedup_count(xs: list[int]) -> int:
    return len(set(xs))


def union_size(a: list[int], b: list[int]) -> int:
    sa = set(a)
    sb = set(b)
    return len(sa | sb)


def membership(x: int) -> bool:
    s = {1, 2, 3, 5, 8}
    return x in s