def testAddLineBefore(self): context.set_context('logic_base', vars={'A': 'bool', 'B': 'bool'}) state = server.parse_init_state("A & B --> B & A") state.add_line_before(2, 1) self.assertEqual(len(state.prf.items), 4) self.assertEqual(state.check_proof(), parser.parse_thm("|- A & B --> B & A")) state.add_line_before(2, 3) self.assertEqual(len(state.prf.items), 7) self.assertEqual(state.check_proof(), parser.parse_thm("|- A & B --> B & A"))
def testParseThm(self): test_data = [ ("|- A", Thm([], A)), ("|- A & B", Thm([], logic.mk_conj(A, B))), ("A |- B", Thm([A], B)), ("A, B |- C", Thm([A, B], C)), ] for s, th in test_data: self.assertEqual(parser.parse_thm(thy, ctxt, s), th)
def testParseThm(self): A = Var('A', BoolType) B = Var('B', BoolType) C = Var('C', BoolType) test_data = [ ("|- A", Thm([], A)), ("|- A & B", Thm([], And(A, B))), ("A |- B", Thm([A], B)), ("A, B |- C", Thm([A, B], C)), ] context.set_context('logic', vars={ 'A': 'bool', 'B': 'bool', 'C': 'bool' }) for s, th in test_data: self.assertEqual(parser.parse_thm(s), th)
def testInitState3(self): context.set_context('logic_base', vars={'A': 'bool'}) state = server.parse_init_state("A | ~A") self.assertEqual(len(state.prf.items), 2) self.assertEqual(state.check_proof(), parser.parse_thm("|- A | ~A"))