kdrag.theories.sexp
Functions
|
Quote an expression as an s-expression. |
|
https://en.wikipedia.org/wiki/Tarski%27s_undefinability_theorem |
|
Interpret an s-expression as an expression. |
|
|
|
Parse a string as an s-expression. |
- kdrag.theories.sexp.Quote(e: ExprRef) tuple[ExprRef, Proof, Proof]
Quote an expression as an s-expression.
>>> x = smt.Int("x") >>> sexp, _ ,_ = Quote(x + 1) >>> sexp Sexp("(declare-fun F (Int) Bool) (declare-fun x () Int) (assert (F (+ x 1))) ")
- kdrag.theories.sexp.Truth(pf: Proof) tuple[ExprRef, Proof, Proof, Proof]
https://en.wikipedia.org/wiki/Tarski%27s_undefinability_theorem
>>> p = kd.prove(smt.BoolVal(True)) >>> Truth(p) (Sexp("(declare-fun F (Bool) Bool) (assert (F true)) "), |= truth(Sexp("(declare-fun F (Bool) Bool) (assert (F true)) ")), |= has_interp(Sexp("(declare-fun F (Bool) Bool) (assert (F true)) "), True), |= interp(Sexp("(declare-fun F (Bool) Bool) (assert (F true)) ")) == True)
- kdrag.theories.sexp.Unquote(sexp: ExprRef) tuple[ExprRef, Proof, Proof]
Interpret an s-expression as an expression.
>>> x = smt.Int("x") >>> q, hi1, i1 = Quote(x + 1) >>> e, hi2, i2 = Unquote(q) >>> e x + 1 >>> assert hi1.thm.eq(hi2.thm) and i1.thm.eq(i2.thm)
- kdrag.theories.sexp.of_sexp(sexp: Sexp) ExprRef
>>> of_sexp(['a', ['b', 'c']]) List(Concat(Unit(Atom("a")), Unit(List(Concat(Unit(Atom("b")), Unit(Atom("c")))))))
- Parameters:
sexp (Sexp)
- Return type:
ExprRef
- kdrag.theories.sexp.parse(s: str) ExprRef
Parse a string as an s-expression.
>>> parse("(a b (c d))") List(Unit(List(Concat(Unit(Atom("a")), Concat(Unit(Atom("b")), Unit(List(Concat(Unit(Atom("c")), Unit(Atom("d"))))))))))
- Parameters:
s (str)
- Return type:
ExprRef