prodigy.pgcl.pgcl_checks

has_variable(expr, params)[source]

Evaluates whether the given expression contains a variable. Symbols in the params set are not considered variables.

Parameters:
  • expr (VarExpr | BoolLitExpr | NatLitExpr | RealLitExpr | UnopExpr | BinopExpr | CategoricalExpr | SubstExpr | TickExpr | FunctionCallExpr | InferExpr | SampleExpr)

  • params (Set[str] | None)

Return type:

bool

check_is_modulus_condition(expression)[source]
Parameters:

expression (VarExpr | BoolLitExpr | NatLitExpr | RealLitExpr | UnopExpr | BinopExpr | CategoricalExpr | SubstExpr | TickExpr | FunctionCallExpr | InferExpr | SampleExpr)

Return type:

bool

check_is_constant_constraint(expression, params)[source]
Parameters:
  • expression (VarExpr | BoolLitExpr | NatLitExpr | RealLitExpr | UnopExpr | BinopExpr | CategoricalExpr | SubstExpr | TickExpr | FunctionCallExpr | InferExpr | SampleExpr)

  • params (Set[str] | None)

Return type:

bool

find_nested_inference(program)[source]

Returns the first use of nested inference in program (a dist declaration, an infer or a sample expression, also inside functions) as pGCL text, or None if there is none. The analysis has no semantics for them yet.

Parameters:

program (Program)

Return type:

str | None