Skip to content

Commit

Permalink
Merge pull request #49 from matt-seb-ho/evaluate-sorting-fix
Browse files Browse the repository at this point in the history
Jointly sort theorems and positions in `evaluate.py`
  • Loading branch information
Kaiyu Yang authored Apr 14, 2024
2 parents 4d6b89b + ddf5137 commit 285665c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions prover/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ def _get_theorems_from_files(
repo = LeanGitRepo(t["url"], t["commit"])
theorems.append(Theorem(repo, t["file_path"], t["full_name"]))
positions.append(Pos(*t["start"]))
theorems = sorted(
theorems,
key=lambda t: hashlib.md5(
(str(t.file_path) + ":" + t.full_name).encode()
).hexdigest(),
)
# jointly sort theorems and positions
theorems_and_positions = list(zip(theorems, positions))
theorems_and_positions.sort(key=lambda x: hashlib.md5(f"{x[0].file_path}:{x[0].full_name}".encode()).hexdigest())
theorems, positions = zip(*theorems_and_positions)
theorems, positions = list(theorems), list(positions)
if num_theorems is not None:
theorems = theorems[:num_theorems]
positions = positions[:num_theorems]
Expand Down

0 comments on commit 285665c

Please sign in to comment.