def testStableFingerprint(self):
   """Tests that the theorem fingerprint function is stable."""
   theorem = proof_assistant_pb2.Theorem(
       conclusion="concl", hypotheses=["hyp1", "hyp2"])
   self.assertEqual(
       theorem_fingerprint.Fingerprint(theorem), 198703484454304307)
   self.assertEqual(
       theorem_fingerprint.ToTacticArgument(theorem), "THM 198703484454304307")
Ejemplo n.º 2
0
 def test_action_generator_theorem_parameter_tactic(self):
     thm_param_tactic = deephol_pb2.Tactic(
         name='TAC', parameter_types=[deephol_pb2.Tactic.THEOREM])
     action_gen = action_generator.ActionGenerator(self.theorem_database,
                                                   [thm_param_tactic],
                                                   self.predictor,
                                                   self.options,
                                                   self.model_architecture)
     actions_scores = action_gen.step(self.node, self.test_premise_set)
     self.assertEqual(1, len(actions_scores))
     expected = 'TAC ' + theorem_fingerprint.ToTacticArgument(
         self.theorem_database.theorems[0])
     self.assertEqual(expected, actions_scores[0].string)
Ejemplo n.º 3
0
 def __init__(
         self,
         theorem_database: proof_assistant_pb2.TheoremDatabase,
         tactics: List[deephol_pb2.Tactic],
         predictor: predictions.Predictions,
         options: deephol_pb2.ActionGeneratorOptions,
         model_architecture: deephol_pb2.ProverOptions.ModelArchitecture,
         emb_store: Optional[embedding_store.TheoremEmbeddingStore] = None):
     self.theorem_database = theorem_database
     self.tactics = tactics
     self.predictor = predictor
     self.options = options
     self.model_architecture = model_architecture
     self.embedding_store = emb_store
     self.thm_names = [
         theorem_fingerprint.ToTacticArgument(thm)
         for thm in theorem_database.theorems
     ]
     self.thm_index_by_fingerprint = {
         theorem_fingerprint.Fingerprint(thm): i
         for (i, thm) in enumerate(theorem_database.theorems)
     }