Order
Types
Functions
def new_order (_ : Unit) : {o : Order | empty o = true && adding o = false && checkout o = false && closed o = false && total_price o = 0}
def add_item (name : String | name ≠ "") (price : Int | price > 0) (1 o : Order | empty o = true || adding o = true) : {
out : Order | empty out = false
&&
adding out = true && checkout out = false && closed out = false && total_price out = total_price o + price
}
def pay (card : Int | card > 0) (1 o : Order | adding o = true) : {
out : Order | empty out = false
&&
adding out = false && checkout out = true && closed out = false && total_price out = total_price o
}
def add_gift (1 o : Order | checkout o = true && total_price o > 20) : {out : Order | checkout out = true && closed out = false && total_price out = total_price o}
def ship (address : String | address ≠ "") (1 o : Order | checkout o = true) : {out : Order | checkout out = false && closed out = true && total_price out = total_price o}
def finalize (1 o : Order | closed o = true) : {n : Int | n = total_price o && n ≥ 0}
Uninterpreted
Functions declared as def f ... = uninterpreted: only their signature is known to the verifier; they have no body.
def empty : (o : Order) → Bool
def adding : (o : Order) → Bool
def checkout : (o : Order) → Bool
def closed : (o : Order) → Bool
def total_price : (o : Order) → Int