def __init__(self, solver: Solver) -> None: self.solver = solver prog = syntax.the_program if utils.args.automaton: automaton = prog.the_automaton() if automaton is None: utils.print_error_and_exit( None, 'updr --automaton requires the file to ' 'declare an automaton') else: the_phase = 'the_phase' pcs: List[syntax.PhaseComponent] = [] for t in prog.transitions(): pcs.append( syntax.PhaseTransitionDecl(None, t.name, None, the_phase)) for inv in prog.safeties(): pcs.append(inv) automaton = AutomatonDecl(None, [ syntax.InitPhaseDecl(None, the_phase), syntax.PhaseDecl(None, the_phase, pcs) ]) automaton.resolve(prog.scope) self.automaton = PhaseAutomaton(automaton) self.fs: List[Frame] = [] self.push_cache: List[Dict[Phase, Set[Expr]]] = [] self.counter = 0 self.predicates: List[Expr] = [] self.state_count = 0
def __init__(self, solver: Solver) -> None: self.solver = solver prog = syntax.the_program if utils.args.automaton: automaton = prog.the_automaton() if automaton is None: utils.print_error_and_exit( None, 'updr --automaton requires the file to ' 'declare an automaton') else: the_phase = 'the_phase' pcs: List[syntax.PhaseComponent] = [] for t in prog.transitions(): pcs.append( syntax.PhaseTransitionDecl(None, t.name, None, the_phase)) for inv in prog.safeties(): pcs.append(inv) automaton = AutomatonDecl(None, [ syntax.InitPhaseDecl(None, the_phase), syntax.PhaseDecl(None, the_phase, pcs) ]) automaton.resolve(prog.scope) self.automaton = PhaseAutomaton(automaton) self.fs: List[Frame] = [] self.push_cache: List[Dict[Phase, Set[Expr]]] = [] self.counter = 0 self.predicates: List[Expr] = [] self.state_count = 0 self.inductive_invariant: Set[int] = set( ) # indices into predicates of currently inductive predicates self.human_invariant = tuple( itertools.chain(*(syntax.as_clauses(inv.expr) for inv in prog.invs() if not inv.is_safety))) # convert to CNF self.human_invariant_to_predicate: Dict[int, int] = dict( ) # dict mapping index of human_invariant to index of predicates self.human_invariant_proved: Set[int] = set( ) # indices into human_invariant that are implied by the current inductive_invariant self.human_invariant_implies: Set[int] = set( ) # indices into predicates of predicates that are implied by the human invariant self._first_frame()