class documentation

class Model(object): (source)

Constructor: Model(domain, valuation)

View In Hierarchy

A first order model is a domain D of discourse and a valuation V.

A domain D is a set, and a valuation V is a map that associates expressions with values in the model. The domain of V should be a subset of D.

Construct a new Model.

Parameters
domainA set of entities representing the domain of discourse of the model.
valuationthe valuation of the model.
propIf this is set, then we are building a propositional model and don't require the domain of V to be subset of D.
Method __init__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method evaluate Read input expressions, and provide a handler for satisfy that blocks further propagation of the Undefined error. :param expr: An Expression of logic. :type g: Assignment :param g: an assignment to individual variables...
Method i An interpretation function.
Method satisfiers Generate the entities from the model's domain that satisfy an open formula.
Method satisfy Recursive interpretation function for a formula of first-order logic.
Instance Variable domain Undocumented
Instance Variable valuation Undocumented
def __init__(self, domain, valuation): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def __str__(self): (source)

Undocumented

def evaluate(self, expr, g, trace=None): (source)

Read input expressions, and provide a handler for satisfy that blocks further propagation of the Undefined error. :param expr: An Expression of logic. :type g: Assignment :param g: an assignment to individual variables. :rtype: bool or 'Undefined'

def i(self, parsed, g, trace=False): (source)

An interpretation function.

Assuming that parsed is atomic:

  • if parsed is a non-logical constant, calls the valuation V
  • else if parsed is an individual variable, calls assignment g
  • else returns Undefined.
Parameters
parsedan Expression of logic.
g:Assignmentan assignment to individual variables.
traceUndocumented
Returns
a semantic value
def satisfiers(self, parsed, varex, g, trace=None, nesting=0): (source)

Generate the entities from the model's domain that satisfy an open formula.

Parameters
parsed:Expressionan open formula
varex:VariableExpression or strthe relevant free individual variable in parsed.
g:Assignmenta variable assignment
traceUndocumented
nestingUndocumented
Returns
a set of the entities that satisfy parsed.
def satisfy(self, parsed, g, trace=None): (source)

Recursive interpretation function for a formula of first-order logic.

Raises an Undefined error when parsed is an atomic string but is not a symbol or an individual variable.

Parameters
parsedAn expression of logic.
g:Assignmentan assignment to individual variables.
traceUndocumented
Returns
Returns a truth value or Undefined if parsed is complex, and calls the interpretation function i if parsed is atomic.
domain: set = (source)

Undocumented

valuation: Valuation = (source)

Undocumented