neurolang.solver module

class neurolang.solver.BooleanOperationsSolver(*args, **kwargs)

Bases: PatternWalker

Attributes:
patterns

Property holding an iterator of triplets (pattern, guard, action).

Methods

match(expression)

Find the action for a given expression by going through the patterns.

pattern_match(pattern, expression)

Return True if pattern matches expression.

type

pattern_match_expression

pattern_match_expression_parameters

pattern_match_expression_tuple

pattern_match_tuple

rewrite_boolean_and

rewrite_boolean_and_l

rewrite_boolean_and_r

rewrite_boolean_inversion

rewrite_boolean_or

rewrite_boolean_or_l

rewrite_boolean_or_r

walk

rewrite_boolean_and(expression)
rewrite_boolean_and_l(expression)
rewrite_boolean_and_r(expression)
rewrite_boolean_inversion(expression)
rewrite_boolean_or(expression)
rewrite_boolean_or_l(expression)
rewrite_boolean_or_r(expression)
type = typing.Any
class neurolang.solver.BooleanRewriteSolver(*args, **kwargs)

Bases: PatternWalker

Attributes:
patterns

Property holding an iterator of triplets (pattern, guard, action).

Methods

match(expression)

Find the action for a given expression by going through the patterns.

partial_binary_evaluation(expression)

Partially evaluate a binary AND or OR operator with non-constant arguments by giving priority to the evaluation of the first argument.

pattern_match(pattern, expression)

Return True if pattern matches expression.

type

bring_constants_up_left

cast_binary

cast_unary

conjunction_composition_dual

conjunction_definition_dual

conjunction_distribution

dual_operator

neg_disj_to_conj

pattern_match_expression

pattern_match_expression_parameters

pattern_match_expression_tuple

pattern_match_tuple

simplify_double_inversion

walk

bring_constants_up_left(expression)
cast_binary(expression)
cast_unary(expression)
conjunction_composition_dual(expression)
conjunction_definition_dual(expression)
conjunction_distribution(expression)
dual_operator(expression)
neg_disj_to_conj(expression)
partial_binary_evaluation(expression)

Partially evaluate a binary AND or OR operator with non-constant arguments by giving priority to the evaluation of the first argument.

Parameters:
expressionFunctionApplication

A OR or AND binary operator application.

Returns:
FunctionApplication

Same expression passed as parameter where the first argument was walked on and the second argument was potentially walked on if the walk on the first argument did not modify its expression.

simplify_double_inversion(expression)
type = typing.Any
class neurolang.solver.FirstOrderLogicSolver(symbol_table=None)

Bases: BooleanRewriteSolver, BooleanOperationsSolver, NumericOperationsSolver, NumericOperationsSolver, GenericSolver

WIP non-recursive first order logic query solver. For now predicates work only on constants on the symbols table

Attributes:
included_constants
included_functions
patterns

Property holding an iterator of triplets (pattern, guard, action).

plural_type_name

Methods

match(expression)

Find the action for a given expression by going through the patterns.

partial_binary_evaluation(expression)

Partially evaluate a binary AND or OR operator with non-constant arguments by giving priority to the evaluation of the first argument.

pattern_match(pattern, expression)

Return True if pattern matches expression.

quantifier_head_symbols_and_adom(head)

Returns an ordered dictionary with the symbols of the quantifier head as keys and the active domain for each symbol as value.

add_included_constants_and_functions_to_symbol_table

bring_constants_up_left

cast_binary

cast_unary

conjunction_composition_dual

conjunction_definition_dual

conjunction_distribution

dual_operator

eval_lambda

evaluate_function

evaluate_function_infer_type

evaluate_projection

existential_predicate

neg_disj_to_conj

new_set

pattern_match_expression

pattern_match_expression_parameters

pattern_match_expression_tuple

pattern_match_tuple

pop_scope

process_expression

process_iterable_argument

push_scope

query_resolution

rewrite_boolean_and

rewrite_boolean_and_l

rewrite_boolean_and_r

rewrite_boolean_inversion

rewrite_boolean_or

rewrite_boolean_or_l

rewrite_boolean_or_r

set_symbol_table

simplify_double_inversion

statement

symbol_from_table

universal_predicate

walk

existential_predicate(expression)
static new_set(iterable)
quantifier_head_symbols_and_adom(head)

Returns an ordered dictionary with the symbols of the quantifier head as keys and the active domain for each symbol as value.

query_resolution(expression)
type = ~UndeterminedType
universal_predicate(expression)
class neurolang.solver.GenericSolver(symbol_table=None)

Bases: ExpressionBasicEvaluator, TypedSymbolTableEvaluator

Attributes:
included_constants
included_functions
patterns

Property holding an iterator of triplets (pattern, guard, action).

plural_type_name

Methods

match(expression)

Find the action for a given expression by going through the patterns.

pattern_match(pattern, expression)

Return True if pattern matches expression.

type

add_included_constants_and_functions_to_symbol_table

eval_lambda

evaluate_function

evaluate_function_infer_type

evaluate_projection

pattern_match_expression

pattern_match_expression_parameters

pattern_match_expression_tuple

pattern_match_tuple

pop_scope

process_expression

process_iterable_argument

push_scope

set_symbol_table

statement

symbol_from_table

walk

property plural_type_name
set_symbol_table(symbol_table)
type = typing.Any
exception neurolang.solver.NeuroLangPredicateException

Bases: NeuroLangException

class neurolang.solver.NumericOperationsSolver(*args, **kwargs)

Bases: PatternWalker

Attributes:
patterns

Property holding an iterator of triplets (pattern, guard, action).

Methods

match(expression)

Find the action for a given expression by going through the patterns.

pattern_match(pattern, expression)

Return True if pattern matches expression.

cast_binary

cast_unary

pattern_match_expression

pattern_match_expression_parameters

pattern_match_expression_tuple

pattern_match_tuple

walk

cast_binary(expression)
cast_unary(expression)
type = ~T