xpile 0.1.615

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
18
def b_and(a: bool, b: bool) -> bool:
    # `&`/`|`/`^` over two bools returns a bool in Python (`True & False` is
    # bool, not int). Previously inferred int → a `-> bool` function was
    # REJECTED ("body produces I64"). Rust's `bool: BitAnd` matches.
    return a & b


def b_or(a: bool, b: bool) -> bool:
    return a | b


def b_xor(a: bool, b: bool) -> bool:
    return a ^ b


def mixed(a: bool, n: int) -> int:
    # A mixed bool/int bitwise op is still an int (bool coerces to i64).
    return a & n