Exemple #1
0
 def apply(self, state, id, data, prevs):
     if 'sym' in data and data['sym'] == 'true':
         sym_b = True
     else:
         sym_b = False
     state.apply_tactic(id,
                        tactic.rewrite_goal(sym=sym_b),
                        args=data['theorem'],
                        prevs=prevs)
Exemple #2
0
 def testRewrite2(self):
     self.run_test('logic_base',
                   tactic.rewrite_goal(),
                   vars={
                       "a": "'a",
                       "b": "'a"
                   },
                   goal="(if a = a then b else a) = b",
                   args="if_P",
                   failed=AssertionError)
Exemple #3
0
 def testRewrite3(self):
     self.run_test('logic_base',
                   tactic.rewrite_goal(),
                   vars={
                       'P': 'bool',
                       'a': "'a",
                       'b': "'a"
                   },
                   prevs=["P"],
                   goal="(if P then a else b) = a",
                   args="if_P")
Exemple #4
0
 def search_thm(th_name, sym):
     try:
         sym_b = True if sym == 'true' else False
         pt = tactic.rewrite_goal(sym=sym_b).get_proof_term(
             cur_item.th, args=th_name, prevs=prevs)
         results.append({
             "theorem": th_name,
             "sym": sym,
             "_goal": [gap.prop for gap in pt.gaps]
         })
     except (AssertionError, matcher.MatchException) as e:
         pass
Exemple #5
0
 def testRewrite4(self):
     self.run_test('logic_base',
                   tactic.rewrite_goal(),
                   vars={
                       'P': 'bool',
                       'Q': 'bool',
                       'a': "'a",
                       'b': "'a"
                   },
                   prevs=["Q"],
                   goal="(if P then a else b) = a",
                   args="if_P",
                   failed=AssertionError)
Exemple #6
0
 def testRewrite(self):
     self.run_test('nat',
                   tactic.rewrite_goal(),
                   vars={"n": "nat"},
                   goal="0 + n = n",
                   args="nat_plus_def_1")