API reference

Grammars and proofs

A grammar constrains the functions that syntax-guided synthesis may find. A proof certifies that a set of assertions is unsatisfiable.

Grammar

A Sygus Grammar. This class can be used to define a context-free grammar of terms. Its interface coincides with the definition of grammars (GrammarDef) in the SyGuS IF 2.1 standard.

Wrapper class for Grammar.

7 of the 7 mirrored methods of Grammar are generated.

Method Summary Binding Mojo
__str__ auto ✓
__hash__ rule ✓
isNull rule ✓
addRule Add rule to the set of rules corresponding to ntSymbol. auto ✓
addAnyConstant Allow ntSymbol to be an arbitrary constant. auto ✓
addAnyVariable Allow ntSymbol to be any input variable to corresponding synth-fun/synth-inv with the same sort as ntSymbol. auto ✓
addRules Add ntSymbol to the set of rules corresponding to ntSymbol. auto ✓

Grammar.__str__

Mojo declaration:

def toString(self) -> String
def write_to(self, mut writer: Some[Writer])

Upstream Python signature:

Grammar.__str__()

Mojo uses the Writable protocol here: call String(value), repr(value), or print(value).

Binding: Generated from cvc5_grammar_to_string.

Grammar.__hash__

Mojo declaration:

def __hash__[H: Hasher](self, mut hasher: H)

Upstream Python signature:

Grammar.__hash__()

Binding: Generated by a rule from cvc5_grammar_hash.

Grammar.isNull

Mojo declaration:

def isNull(self) -> Bool

Upstream Python signature:

Grammar.isNull()

Binding: Generated by a rule: a check for a NULL handle, which is how the C API represents a null object.

Grammar.addRule

Mojo declaration:

def addRule(self, ntSymbol: Term, rule: Term) raises

Upstream Python signature:

Grammar.addRule(ntSymbol: Term, rule: Term)

Add rule to the set of rules corresponding to ntSymbol.

Parameters

  • ntSymbol: The non-terminal to which the rule is added.
  • rule: The rule to add.

Binding: Generated from cvc5_grammar_add_rule.

Grammar.addAnyConstant

Mojo declaration:

def addAnyConstant(self, ntSymbol: Term) raises

Upstream Python signature:

Grammar.addAnyConstant(ntSymbol: Term)

Allow ntSymbol to be an arbitrary constant.

Parameters

  • ntSymbol: The non-terminal allowed to be constant.

Binding: Generated from cvc5_grammar_add_any_constant.

Grammar.addAnyVariable

Mojo declaration:

def addAnyVariable(self, ntSymbol: Term) raises

Upstream Python signature:

Grammar.addAnyVariable(ntSymbol: Term)

Allow ntSymbol to be any input variable to corresponding synth-fun/synth-inv with the same sort as ntSymbol.

Parameters

  • ntSymbol: The non-terminal allowed to be any input variable.

Binding: Generated from cvc5_grammar_add_any_variable.

Grammar.addRules

Mojo declaration:

def addRules(self, ntSymbol: Term, rules: List[Term]) raises

Upstream Python signature:

Grammar.addRules(ntSymbol: Term, rules)

Add ntSymbol to the set of rules corresponding to ntSymbol.

Parameters

  • ntSymbol: The non-terminal to which the rules are added.
  • rules: The rules to add.

Binding: Generated from cvc5_grammar_add_rules.

Proof

A cvc5 proof. Proofs are trees and every proof object corresponds to the root step of a proof. The branches of the root step are the premises of the step.

Wrapper class for Proof.

8 of the 8 mirrored methods of Proof are generated.

Method Summary Binding Mojo
__eq__ rule ✓
__ne__ rule ✓
__hash__ rule ✓
getRule Returns the proof rule used by the root step of the proof. auto ✓
getRewriteRule Returns the proof rewrite rule used by the root step of the proof. auto ✓
getResult Returns the conclusion of the root step of the proof. auto ✓
getChildren Returns the premises of the root step of the proof. auto ✓
getArguments Returns the arguments of the root step of the proof as a vector of terms. auto ✓

Proof.__eq__

Mojo declaration:

def __eq__(self, other: Self) -> Bool

Upstream Python signature:

Proof.__eq__(other: Proof)

Binding: Generated by a rule from cvc5_proof_is_equal.

Proof.__ne__

Mojo declaration:

def __ne__(self, other: Self) -> Bool

Upstream Python signature:

Proof.__ne__(other: Proof)

Binding: Generated by a rule from cvc5_proof_is_disequal.

Proof.__hash__

Mojo declaration:

def __hash__[H: Hasher](self, mut hasher: H)

Upstream Python signature:

Proof.__hash__()

Binding: Generated by a rule from cvc5_proof_hash.

Proof.getRule

Mojo declaration:

def getRule(self) raises -> ProofRule

Upstream Python signature:

Proof.getRule()

Returns

The proof rule used by the root step of the proof.

Binding: Generated from cvc5_proof_get_rule.

Proof.getRewriteRule

Mojo declaration:

def getRewriteRule(self) raises -> ProofRewriteRule

Upstream Python signature:

Proof.getRewriteRule()

Returns

The proof rewrite rule used by the root step of the proof. Raises an exception if getRule() does not return DSL_REWRITE or THEORY_REWRITE.

Binding: Generated from cvc5_proof_get_rewrite_rule.

Proof.getResult

Mojo declaration:

def getResult(self) raises -> Term

Upstream Python signature:

Proof.getResult()

Returns

The conclusion of the root step of the proof.

Binding: Generated from cvc5_proof_get_result.

Proof.getChildren

Mojo declaration:

def getChildren(self) raises -> List[Proof]

Upstream Python signature:

Proof.getChildren()

Returns

The premises of the root step of the proof.

Binding: Generated from cvc5_proof_get_children.

Proof.getArguments

Mojo declaration:

def getArguments(self) raises -> List[Term]

Upstream Python signature:

Proof.getArguments()

Returns

The arguments of the root step of the proof as a vector of terms. Some of those terms might be strings.

Binding: Generated from cvc5_proof_get_arguments.

cvc5_mojo v1.4.1.1 for Mojo 1.2 and cvc5 1.4.1 · Apache License 2.0 with LLVM Exceptions · Source on GitHub