idp_engine.Assignments

Classes to store assignments of values to questions

class Status(value)[source]

Describes how the value of a question was obtained

class Assignment(sentence, value, status, relevant=True)[source]

Represent the assignment of a value to a question. Questions can be:

  • predicates and functions applied to arguments,

  • comparisons,

  • outermost quantified expressions

A value is a rigid term.

An assignment also has a reference to the symbol under which it should be displayed.

Parameters
  • sentence (Expression) –

  • value (Optional[Expression]) –

  • status (Optional[Status]) –

  • relevant (Optional[bool]) –

sentence

the question to be assigned a value

Type

Expression

value

a rigid term

Type

Expression, optional

status

qualifies how the value was obtained

Type

Status, optional

is_certainly_undefined

True for functions applied to arguments certainly outside of its domain

Type

bool

relevant

states whether the sentence is relevant

Type

bool, optional

symbol_decl

declaration of the symbol under which

Type

SymbolDeclaration

it should be displayed in the IC.
__init__(sentence, value, status, relevant=True)[source]
Parameters
  • sentence (idp_engine.Expression.Expression) –

  • value (Optional[idp_engine.Expression.Expression]) –

  • status (Optional[idp_engine.Assignments.Status]) –

  • relevant (Optional[bool]) –

same_as(other)[source]

returns True if self has the same sentence and truth value as other.

Parameters

other (Assignment) – an assignment

Returns

True if self has the same sentence and truth value as other.

Return type

bool

negate()[source]

returns an Assignment for the same sentence, but an opposite truth value.

Raises

AssertionError – Cannot negate a non-boolean assignment

Returns

returns an Assignment for the same sentence, but an opposite truth value.

Return type

[type]

as_set_condition()[source]

returns an equivalent set condition, or None

Returns

meaning “appSymb is (not) in enumeration”

Return type

Tuple[Optional[AppliedSymbol], Optional[bool], Optional[Enumeration]]

unset()[source]

Unsets the value of an assignment.

Returns

None

Return type

None

class Assignments(*arg, **kw)[source]

Contains a set of Assignment

__init__(*arg, **kw)[source]
copy() a shallow copy of D[source]
Parameters

shallow (bool) –

Return type

Assignments