agent_logic.core.predicates

Classes

Predicate(**data)

Represents a predicate in first-order logic.

Term(**data)

Represents a term in predicate logic (constants, variables, functions).

class agent_logic.core.predicates.Predicate(**data)[source]

Bases: BaseModel

Represents a predicate in first-order logic.

Parameters:
  • name (str)

  • terms (List[Term])

depth()[source]
Return type:

int

evaluate(context)[source]

Evaluates the predicate given a context mapping variables to truth values.

Return type:

bool

Parameters:

context (Dict[str, bool])

classmethod from_dict(data)[source]
Return type:

Predicate

Parameters:

data (Dict)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
terms: List[Term]
to_dict()[source]
Return type:

Dict

variables()[source]

Returns a list of variable names used in the predicate.

Return type:

List[str]

class agent_logic.core.predicates.Term(**data)[source]

Bases: BaseModel

Represents a term in predicate logic (constants, variables, functions).

Parameters:

value (str | List[Term])

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

value: Union[str, List['Term']]