module documentation

A version of first order predicate logic, built on top of the typed lambda calculus.

Class AbstractVariableExpression This class represents a variable to be used as a predicate or entity
Class AllExpression Undocumented
Class AndExpression This class represents conjunctions
Class AnyType Undocumented
Class ApplicationExpression This class is used to represent two related types of logical expressions.
Class BasicType Undocumented
Class BinaryExpression No class docstring; 0/1 property, 0/2 instance variable, 2/7 methods documented
Class BooleanExpression No class docstring; 1/1 method documented
Class ComplexType Undocumented
Class ConstantExpression This class represents variables that do not take the form of a single character followed by zero or more digits.
Class EntityType Undocumented
Class EqualityExpression This class represents equality expressions like "(x = y)".
Class EventType Undocumented
Class EventVariableExpression This class represents variables that take the form of a single lowercase 'e' character followed by zero or more digits.
Class ExistsExpression Undocumented
Class Expression This is the base abstract object for all logical expressions
Class FunctionVariableExpression This class represents variables that take the form of a single uppercase character followed by zero or more digits.
Class IffExpression This class represents biconditionals
Class ImpExpression This class represents implications
Class IndividualVariableExpression This class represents variables that take the form of a single lowercase character (other than 'e') followed by zero or more digits.
Class LambdaExpression No class docstring; 0/1 property, 1/2 method documented
Class LogicParser A lambda calculus expression parser.
Class NegatedExpression No class docstring; 0/1 property, 0/1 instance variable, 3/8 methods documented
Class OrExpression This class represents disjunctions
Class QuantifiedExpression No class docstring; 0/1 property, 1/2 method documented
Class SubstituteBindingsI An interface for classes that can perform substitutions for variables.
Class Tokens Undocumented
Class TruthValueType Undocumented
Class Type Undocumented
Class Variable No class docstring; 0/1 instance variable, 1/8 method documented
Class VariableBinderExpression This an abstract class for any Expression that binds a variable in an Expression. This includes LambdaExpressions and Quantified Expressions
Exception ExpectedMoreTokensException Undocumented
Exception IllegalTypeException Undocumented
Exception InconsistentTypeHierarchyException Undocumented
Exception LogicalExpressionException Undocumented
Exception TypeException Undocumented
Exception TypeResolutionException Undocumented
Exception UnexpectedTokenException Undocumented
Function binding_ops Binding operators
Function boolean_ops Boolean operators
Function demo Undocumented
Function demo_errors Undocumented
Function demoException Undocumented
Function equality_preds Equality predicates
Function is_eventvar An event variable must be a single lowercase 'e' character followed by zero or more digits.
Function is_funcvar A function variable must be a single uppercase character followed by zero or more digits.
Function is_indvar An individual variable must be a single lowercase character other than 'e', followed by zero or more digits.
Function printtype Undocumented
Function read_logic Convert a file of First Order Formulas into a list of {Expression}s.
Function read_type Undocumented
Function skolem_function Return a skolem function over the variables in univ_scope param univ_scope
Function typecheck Ensure correct typing across a collection of Expression objects. :param expressions: a collection of expressions :param signature: dict that maps variable names to types (or string representations of types)...
Function unique_variable Return a new, unique variable.
Function VariableExpression This is a factory method that instantiates and returns a subtype of AbstractVariableExpression appropriate for the given variable.
Constant ANY_TYPE Undocumented
Constant APP Undocumented
Constant ENTITY_TYPE Undocumented
Constant EVENT_TYPE Undocumented
Constant TRUTH_TYPE Undocumented
Variable _counter Undocumented
def binding_ops(): (source)

Binding operators

def boolean_ops(): (source)

Boolean operators

def demo(): (source)

Undocumented

def demo_errors(): (source)

Undocumented

def demoException(s): (source)

Undocumented

def equality_preds(): (source)

Equality predicates

def is_eventvar(expr): (source)

An event variable must be a single lowercase 'e' character followed by zero or more digits.

Parameters
exprstr
Returns
bool True if expr is of the correct form
def is_funcvar(expr): (source)

A function variable must be a single uppercase character followed by zero or more digits.

Parameters
exprstr
Returns
bool True if expr is of the correct form
def is_indvar(expr): (source)

An individual variable must be a single lowercase character other than 'e', followed by zero or more digits.

Parameters
exprstr
Returns
bool True if expr is of the correct form
def printtype(ex): (source)

Undocumented

def read_logic(s, logic_parser=None, encoding=None): (source)

Convert a file of First Order Formulas into a list of {Expression}s.

Parameters
s:strthe contents of the file
logic_parser:LogicParserThe parser to be used to parse the logical expression
encoding:strthe encoding of the input string, if it is binary
Returns
list(Expression)a list of parsed formulas.
def read_type(type_string): (source)

Undocumented

def skolem_function(univ_scope=None): (source)

Return a skolem function over the variables in univ_scope param univ_scope

def typecheck(expressions, signature=None): (source)

Ensure correct typing across a collection of Expression objects. :param expressions: a collection of expressions :param signature: dict that maps variable names to types (or string representations of types)

def unique_variable(pattern=None, ignore=None): (source)

Return a new, unique variable.

Parameters
patternVariable that is being replaced. The new variable must be the same type.
ignoreUndocumented
terma set of Variable objects that should not be returned from this function.
Returns
VariableUndocumented
def VariableExpression(variable): (source)

This is a factory method that instantiates and returns a subtype of AbstractVariableExpression appropriate for the given variable.

ANY_TYPE = (source)

Undocumented

Value
AnyType()
APP: str = (source)

Undocumented

Value
'APP'
ENTITY_TYPE = (source)

Undocumented

Value
EntityType()
EVENT_TYPE = (source)

Undocumented

Value
EventType()
TRUTH_TYPE = (source)

Undocumented

Value
TruthValueType()
_counter = (source)

Undocumented