|
4 | 4 | from pyk.kast.inner import KApply, KInner, KRewrite, KVariable
|
5 | 5 | from pyk.kast.manip import (
|
6 | 6 | abstract_term_safely,
|
7 |
| - bool_to_ml_pred, |
8 | 7 | bottom_up,
|
9 |
| - flatten_label, |
10 |
| - free_vars, |
11 | 8 | is_anon_var,
|
12 |
| - ml_pred_to_bool, |
13 |
| - remove_generated_cells, |
14 | 9 | split_config_and_constraints,
|
15 | 10 | split_config_from,
|
16 | 11 | substitute,
|
17 |
| - undo_aliases, |
18 | 12 | )
|
19 | 13 | from pyk.kast.outer import KDefinition, KFlatModule, KImport
|
20 | 14 | from pyk.kcfg import KCFG
|
21 | 15 | from pyk.ktool import KPrint
|
22 |
| -from pyk.prelude.kbool import FALSE |
23 |
| -from pyk.prelude.ml import mlAnd |
24 | 16 |
|
25 | 17 |
|
26 | 18 | def KDefinition__expand_macros(defn: KDefinition, term: KInner) -> KInner: # noqa: N802
|
@@ -102,35 +94,3 @@ def abstract_cell_vars(cterm: KInner, keep_vars: Collection[KVariable] = ()) ->
|
102 | 94 | if type(subst[s]) is KVariable and not is_anon_var(subst[s]) and subst[s] not in keep_vars:
|
103 | 95 | subst[s] = abstract_term_safely(KVariable('_'), base_name=s)
|
104 | 96 | return substitute(config, subst)
|
105 |
| - |
106 |
| - |
107 |
| -def sanitize_config(defn: KDefinition, init_term: KInner) -> KInner: |
108 |
| - def _var_name(vname: str) -> str: |
109 |
| - new_vname = vname |
110 |
| - while new_vname.startswith('_') or new_vname.startswith('?'): |
111 |
| - new_vname = new_vname[1:] |
112 |
| - return new_vname |
113 |
| - |
114 |
| - free_vars_subst = {vname: KVariable(_var_name(vname)) for vname in free_vars(init_term)} |
115 |
| - |
116 |
| - # TODO: This is somewhat hacky. We shouldn't have to touch the config this much. |
117 |
| - # Likely, the frontend should just be giving us initial states with these already in place. |
118 |
| - def _remove_cell_map_definedness(_kast: KInner) -> KInner: |
119 |
| - if type(_kast) is KApply: |
120 |
| - if _kast.label.name.endswith('CellMap:in_keys'): |
121 |
| - return FALSE |
122 |
| - elif _kast.label.name.endswith('CellMapItem'): |
123 |
| - return _kast.args[1] |
124 |
| - return _kast |
125 |
| - |
126 |
| - new_term = substitute(init_term, free_vars_subst) |
127 |
| - new_term = remove_generated_cells(new_term) |
128 |
| - new_term = bottom_up(_remove_cell_map_definedness, new_term) |
129 |
| - |
130 |
| - if not (type(new_term) is KApply and new_term.label.name in ['#Top', '#Bottom']): |
131 |
| - config, constraint = split_config_and_constraints(new_term) |
132 |
| - constraints = [bool_to_ml_pred(ml_pred_to_bool(c, unsafe=True)) for c in flatten_label('#And', constraint)] |
133 |
| - new_term = mlAnd([config] + constraints) |
134 |
| - new_term = undo_aliases(defn, new_term) |
135 |
| - |
136 |
| - return new_term |
0 commit comments