def set_line(self, id, rule, *, args=None, prevs=None, th=None): """Set the item with the given id to the following data.""" id = ItemID(id) prf = self.prf.get_parent_proof(id) prf.items[id.last()] = ProofItem(id, rule, args=args, prevs=prevs, th=th) self.check_proof(compute_only=True)
def remove_line(self, id): """Remove line with the given id.""" id = ItemID(id) prf = self.prf.get_parent_proof(id) split = id.last() prf.items = prf.items[:split] + prf.items[split + 1:] for item in prf.items[split:]: item.decr_proof_item(id) self.check_proof(compute_only=True)
def add_line_before(self, id, n): """Add n lines before the given id.""" id = ItemID(id) prf = self.prf.get_parent_proof(id) split = id.last() new_items = [ProofItem(id.incr_id(i), "") for i in range(n)] prf.items = prf.items[:split] + new_items + prf.items[split:] for item in prf.items[split + n:]: item.incr_proof_item(id, n) self.check_proof(compute_only=True)