# Sophi

**A declarative language for mathematically verified value transformations.**

Sophi is not a smart contract language. It has no runtime, no blockchain execution, and no custody of funds. Instead, you describe what a fair exchange looks like — and Sophi proves it is mathematically valid.

## Install

`\
pip install sophi
`\

## Write your first swap

`\
Resource BTC
Resource USDT

State before:
    alice.BTC  = 0.5
    bob.USDT   = 50000

State after:
    alice.USDT = 50000
    bob.BTC    = 0.5

Rule conservation:
    before.alice.BTC + before.bob.USDT == after.alice.USDT + after.bob.BTC

Proof swap:
    verify(conservation)
`\

Save as trade.sph and run:

`\
sophi compile trade.sph
`\

## The four primitives

Resource — anything with value. BTC, USDT, ETH, or any asset you define.

State — who holds what, before and after the transformation.

Rule — a mathematical condition that must be true for the transformation to be valid.

Proof — the verification that all rules pass.

## Non-custodial by construction

Your funds never leave your control. Sophi has no concept of custody. It is mathematically impossible to write a custodial program in Sophi.

## License

Business Source License 1.1 — converts to Apache 2.0 after 4 years.
