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