def testRule4(self): n = Var('n', natT) goal = Thm([], Term.mk_equals(plus(n, zero), n)) inst = {'P': Term.mk_abs(n, goal.prop), 'x': n} pt = tactic.rule().get_proof_term(thy, ProofTerm.sorry(goal), args=('nat_induct', ({}, inst))) prf = pt.export() self.assertEqual(thy.check_proof(prf), goal)
def testRule(self): A = Var('A', boolT) B = Var('B', boolT) goal = Thm([], conj(B, A)) pt = tactic.rule().get_proof_term(thy, ProofTerm.sorry(goal), args='conjI') prf = pt.export() self.assertEqual(thy.check_proof(prf), goal)
def testRule3(self): A = Var('A', boolT) B = Var('B', boolT) goal = Thm([], disj(B, A)) prev = ProofTermAtom(0, Thm.assume(B)) pt = tactic.rule().get_proof_term(thy, ProofTerm.sorry(goal), args='disjI1', prevs=[prev]) prf = pt.export(prefix=(1,), subproof=False) self.assertEqual(prf.items[0], ProofItem(1, 'apply_theorem_for', args=('disjI1', {}, {'A': B, 'B': A}), prevs=[0]))
def testRule2(self): A = Var('A', boolT) B = Var('B', boolT) goal = Thm([], disj(B, A)) prev = ProofTermAtom(0, Thm.assume(disj(A, B))) pt = tactic.rule().get_proof_term(thy, ProofTerm.sorry(goal), args='disjE', prevs=[prev]) prf = pt.export(prefix=(1,), subproof=False) self.assertEqual(prf.items[2], ProofItem(3, 'apply_theorem', args='disjE', prevs=[0, 1, 2]))
def apply_backward_step(self, id, th_name, *, prevs=None, instsp=None): """Apply backward step using the given theorem. prevs - list of previous proved facts to use. inst - existing instantiation. """ self.apply_tactic(id, tactic.rule(), args=(th_name, instsp), prevs=prevs)
def apply(self, state, id, data, prevs): state.apply_tactic(id, tactic.rule(), args=data['theorem'], prevs=prevs)