Domain Types, Contracts, and Logic

This page treats Vitte logic as an executable mechanism: each rule is linked to a concrete consequence in the program flow. Vitte logic is maximal when types encode states and procedures encode authorized transitions.

form Payment {
  amount: int
}

pick PaymentState {
  case Accepted
  case Rejected(code: int)
}

Why this step is solid. Payment defines the input structure, PaymentState defines the output space. The domain is limited to signatures.

What happens at runtime. No direct execution here, but any future procedure will treat these two forms as a compile-time contract.

proc decide(p: Payment) -> PaymentState {
  if p.amount > 0 { give Accepted }
  give Rejected(400)
}

Why this step is solid. Explicit domain transition. The positive amount maps to Accepted, otherwise Rejected(400). This function is pure and total on Payment.

What happens at runtime. decide(Payment(50))=Accepted, decide(Payment(0))=Rejected(400).

proc code(s: PaymentState) -> int {
  match s {
    case Accepted { give 200 }
    case Rejected(c) { give c }
    otherwise { give 500 }
  }
}

Why this step is solid. Projection of business state to technical code. The variant already carries the necessary information, so the conversion remains local.

What happens at runtime. code(Accepted)=200, code(Rejected(422))=422.

This types -> transition -> projection diagram is a central Vitte pattern to limit integration errors.