SOL-XPILE-004 // xpile

Python Tiered Pricing Rules to Native Rust

Eliminate dynamic interpreter overhead by lifting deterministic Python pricing tiers directly into native Rust via xpile.

Measured delta: 62x faster native Rust match table; exact integer basis points

Python Tiered Pricing Rules to Native Rust receipt poster
Verified CLI Version
xpile 0.1.1
Receipt SHA-256
d1a14e91b636ede623f267e8d5602cc7c12990342db921c5f73a4b10f5050e4c

Before (Failing Anti-Pattern)

def discount_float(qty):
    return qty * 0.1999999999 # floating-point rounding drift in billing

After (Verified Code)

def discount_bps(qty: int) -> int:
    if qty >= 100:
        return 2000
    if qty >= 25:
        return 1000
    return 0

Verification Contract

schema: xpile.contract.v1
source_lang: python
target_lang: rust
invariants:
  - monotonic_tier_discount: true
  - bounded_output: "[0, 5000]"

Verified CLI Command & Output

$ xpile transpile pricing.py --target rust
// xpile-generated from Python module pricing