MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / match_all_theorems

Function match_all_theorems

dd.py:978–1005  ·  view source on GitHub ↗

Match all instances of all theorems (rules).

(
    g: gh.Graph, theorems: list[pr.Theorem], goal: pr.Clause
)

Source from the content-addressed store, hash-verified

976
977
978def match_all_theorems(
979 g: gh.Graph, theorems: list[pr.Theorem], goal: pr.Clause
980) -> dict[pr.Theorem, dict[pr.Theorem, dict[str, gm.Point]]]:
981 """Match all instances of all theorems (rules)."""
982 cache = cache_match(g)
983 # for BFS, collect all potential matches
984 # and then do it at the same time
985 theorem2mappings = {}
986
987 # Step 1: list all matches
988 for _, theorem in theorems.items():
989 name = theorem.name
990 if name.split('_')[-1] in [
991 'acompute',
992 'rcompute',
993 'fixl',
994 'fixc',
995 'fixb',
996 'fixt',
997 'fixp',
998 ]:
999 if goal and goal.name != name:
1000 continue
1001
1002 mappings = match_one_theorem(g, cache, theorem)
1003 if len(mappings): # pylint: disable=g-explicit-length-test
1004 theorem2mappings[theorem] = list(mappings)
1005 return theorem2mappings
1006
1007
1008def bfs_one_level(

Callers 1

bfs_one_levelFunction · 0.85

Calls 2

cache_matchFunction · 0.85
match_one_theoremFunction · 0.85

Tested by

no test coverage detected