Match all instances of all theorems (rules).
(
g: gh.Graph, theorems: list[pr.Theorem], goal: pr.Clause
)
| 976 | |
| 977 | |
| 978 | def 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 | |
| 1008 | def bfs_one_level( |
no test coverage detected