public class Formulae extends Object
Provides a range of different algorithms for manipulating formula. The idea is that these provide the building blocks on which different automated theorem provers can be built and experimented with. Each of the algorithms contained here attempts to perform a single task and to do it with at least moderate efficiency (though there is room for improvement there).
| Constructor and Description |
|---|
Formulae() |
| Modifier and Type | Method and Description |
|---|---|
static Formula |
and(Formula lhs,
Formula rhs) |
static Formula.Inequality |
greaterOrEqual(WyalFile.Expr lhs,
WyalFile.Expr rhs) |
static Formula |
implies(Formula lhs,
Formula rhs) |
static Formula |
invert(Formula f)
Logically invert a given formula.
|
static Formula.Inequality |
lessThan(WyalFile.Expr lhs,
WyalFile.Expr rhs) |
static Formula |
or(Formula lhs,
Formula rhs) |
static Formula |
toFormula(WyalFile.Stmt stmt,
TypeSystem types)
Take a tree of statements and expressions, and return a formula.
|
static Formula[] |
toFormulae(WyalFile.Stmt[] stmts,
TypeSystem types)
Convert an array of statements into an array of (equivalent) formulae.
|
public static Formula toFormula(WyalFile.Stmt stmt, TypeSystem types) throws wybs.lang.NameResolver.ResolutionError
Take a tree of statements and expressions, and return a formula. This is the first part of the process in discharging a given assertion. The purpose of a formula is just to provide a more "structured" form of the logical expression. The interface Formula also provides useful functions form manipulating formulae.
Observe that after this conversion the resulting formula is not necessarily in simplified form. For example, conjuncts may contain nested conjuncts or equations may be unbalanced.
stmt - The statement being converted into a formulatypes - The type system is required for the translation, as some
aspects depend upon the types of expressions involved.AmbiguousNameErrorNameNotFoundErrorwybs.lang.NameResolver.ResolutionErrorpublic static Formula[] toFormulae(WyalFile.Stmt[] stmts, TypeSystem types) throws wybs.lang.NameResolver.ResolutionError
stmts - AmbiguousNameErrorNameNotFoundErrorwybs.lang.NameResolver.ResolutionErrorpublic static Formula.Inequality lessThan(WyalFile.Expr lhs, WyalFile.Expr rhs)
public static Formula.Inequality greaterOrEqual(WyalFile.Expr lhs, WyalFile.Expr rhs)
public static Formula invert(Formula f)
!(x == 0 && y < x) becomes
x != 0 || y >= x. This method is useful (amongst other
things) for beginning a proof-by-contradiction. In such a proof, we first
invert the formula in question and then establish that this reduces to a
contradiction.f - Copyright © 2017. All rights reserved.