kdrag.contract
Module Attributes
kd.Proof): assert f not in contracts contracts[f] = proof |
Functions
|
Register the contract for function f: for all args, pre => post. |
|
Instantiate all contract lemmas found in |
|
Classes
|
- class kdrag.contract.Contract(f: z3.z3.FuncDeclRef, args: list[z3.z3.ExprRef], pre: z3.z3.BoolRef, post: z3.z3.BoolRef, proof: kdrag.kernel.Proof)
Bases:
object- Parameters:
f (FuncDeclRef)
args (list[ExprRef])
pre (BoolRef)
post (BoolRef)
proof (Proof)
- args: list[ExprRef]
- f: FuncDeclRef
- post: BoolRef
- pre: BoolRef
- kdrag.contract.contract(f: FuncDeclRef, args: list[ExprRef], pre, post, by=None, **kwargs) Proof
Register the contract for function f: for all args, pre => post.
>>> x = smt.Int("x") >>> foo = kd.define("foo4392", [x], x + 1) >>> c = contract(foo, [x], x > 0, foo(x) > 0, by=[foo.defn]) >>> c |= ForAll(x, Implies(x > 0, foo4392(x) > 0)) >>> c.thm.pattern(0) foo4392(Var(0)) >>> prove(foo(5) > 0) |= foo4392(5) > 0 >>> prove(foo(5) > 5) Traceback (most recent call last): ... LemmaError: ...
- Parameters:
f (FuncDeclRef)
args (list[ExprRef])
- Return type:
- kdrag.contract.contracts: dict[FuncDeclRef, Contract] = {}
kd.Proof): assert f not in contracts contracts[f] = proof