예제 #1
0
 def testParseProof2(self):
     data = {
         'vars': {},
         'proof': [
             {'id': 0, 'rule': 'variable', 'args': "a, 'a", 'prevs': [], 'th': ''}
         ]
     }
     state = ProofState.parse_proof(thy, data)
     self.assertEqual(len(state.prf.items), 1)
예제 #2
0
 def testParseProof(self):
     data = {
         'vars': {'A': 'bool', 'B': 'bool'},
         'proof': [
             {'id': 0, 'rule': 'assume', 'args': 'A & B', 'prevs': [], 'th': ''},
             {'id': 1, 'rule': 'sorry', 'args': '', 'prevs': [], 'th': 'A & B |- B & A'},
             {'id': 2, 'rule': 'implies_intr', 'args': 'A & B', 'prevs': [1], 'th': ''}
         ]
     }
     state = ProofState.parse_proof(thy, data)
     self.assertEqual(len(state.vars), 2)
     self.assertEqual(len(state.prf.items), 3)
예제 #3
0
파일: __init__.py 프로젝트: zhouwenfan/temp
def init_saved_proof():
    """Load saved proof."""
    data = json.loads(request.get_data().decode("utf-8"))
    if data:
        try:
            thy = basic.load_theory(data['theory_name'],
                                    limit=('thm', data['thm_name']),
                                    user=user_info['username'])
            cell = ProofState.parse_proof(thy, data)
            cells[data['id']] = cell
            return jsonify(cell.json_data())
        except Exception as e:
            error = {"failed": e.__class__.__name__, "message": str(e)}
        return jsonify(error)
    return jsonify({})