def apply(self, state, id, data, prevs): inst = Inst() with context.fresh_context(vars=state.get_vars(id)): for key, val in data.items(): if key.startswith("param_"): inst[key[6:]] = parser.parse_term(val) if inst: state.apply_tactic(id, tactic.rule(), args=(data['theorem'], inst), prevs=prevs) else: state.apply_tactic(id, tactic.rule(), args=data['theorem'], prevs=prevs)
def testRule3(self): self.run_test('logic_base', tactic.rule(), vars={ "A": "bool", "B": "bool" }, prevs=["B"], goal="B | A", args="disjI1")
def testRule(self): self.run_test('logic_base', tactic.rule(), vars={ "A": "bool", "B": "bool" }, goal="B & A", args="conjI", new_goals=["B", "A"])
def testRule2(self): self.run_test('logic_base', tactic.rule(), vars={ "A": "bool", "B": "bool" }, prevs=["A | B"], goal="B | A", args="disjE", new_goals=["A --> B | A", "B --> B | A"])
def testRule4(self): n = Var("n", NatType) self.run_test('nat', tactic.rule(), vars={"n": "nat"}, goal="n + 0 = n", args=("nat_induct", Inst(P=Lambda(n, Eq(n + 0, n)), x=n)), new_goals=[ "(0::nat) + 0 = 0", "!n. n + 0 = n --> Suc n + 0 = Suc n" ])
def search_thm(th_name): try: pt = tactic.rule().get_proof_term(cur_item.th, args=th_name, prevs=prevs) results.append({ "theorem": th_name, "_goal": [gap.prop for gap in pt.gaps] }) except theory.ParameterQueryException: # In this case, still suggest the result results.append({"theorem": th_name}) except (AssertionError, matcher.MatchException): pass
def testRule5(self): self.run_test('set', tactic.rule(), goal="finite (empty_set::nat set)", args="finite_empty")