15
15
from pyk .ktool .kit import KIT
16
16
from pyk .ktool .krun import KRunOutput , _krun
17
17
from pyk .prelude .k import GENERATED_TOP_CELL
18
- from pyk .prelude .ml import mlAnd , mlTop
18
+ from pyk .prelude .ml import is_bottom , is_top , mlAnd , mlTop
19
19
from pyk .utils import shorten_hashes
20
20
21
21
from .gst_to_kore import gst_to_kore
@@ -376,6 +376,22 @@ def prove_it(id_cfg_port: Tuple[str, Tuple[KCFG, Path], int]) -> bool:
376
376
iterations += 1
377
377
curr_node = cfg .frontier [0 ]
378
378
379
+ _LOGGER .info (f'Simplifying { cfgid } : { shorten_hashes ((curr_node .id ))} ' )
380
+ _simplified = foundry .simplify (curr_node .cterm )
381
+ if is_bottom (_simplified ):
382
+ cfg .create_cover (curr_node .id , cfg .get_unique_target ().id , constraint = mlTop ())
383
+ _LOGGER .info (
384
+ f'Infeasible node marked as proven { cfgid } : { shorten_hashes ((curr_node .id , cfg .get_unique_target ().id ))} '
385
+ )
386
+ continue
387
+ if is_top (_simplified ):
388
+ raise ValueError (f'Found #Top node { cfgid } : { shorten_hashes ((curr_node .id ))} ' )
389
+ simplified = CTerm (_simplified )
390
+ if simplified != curr_node .cterm :
391
+ cfg , new_node_id = KCFG__replace_node (cfg , curr_node .id , simplified )
392
+ _LOGGER .info (f'Replaced with simplified node: { shorten_hashes ((curr_node .id , new_node_id ))} ' )
393
+ continue
394
+
379
395
_LOGGER .info (
380
396
f'Checking subsumption into target state { cfgid } : { shorten_hashes ((curr_node .id , target_node .id ))} '
381
397
)
@@ -386,13 +402,13 @@ def prove_it(id_cfg_port: Tuple[str, Tuple[KCFG, Path], int]) -> bool:
386
402
387
403
cfg .add_expanded (curr_node .id )
388
404
389
- _LOGGER .info (f'Checking terminal node { cfgid } : { shorten_hashes ((curr_node .id ))} ' )
405
+ _LOGGER .info (f'Checking terminal { cfgid } : { shorten_hashes ((curr_node .id ))} ' )
390
406
if KEVM .is_terminal (curr_node .cterm ):
391
407
_LOGGER .info (f'Terminal node { cfgid } : { shorten_hashes ((curr_node .id ))} .' )
392
408
continue
393
409
394
410
_LOGGER .info (f'Advancing proof from node { cfgid } : { shorten_hashes (curr_node .id )} ' )
395
- depth , cterm , next_cterms = foundry .execute (curr_node . cterm , depth = max_depth , terminal_rules = ['EVM.halt' ])
411
+ depth , cterm , next_cterms = foundry .execute (simplified , depth = max_depth , terminal_rules = ['EVM.halt' ])
396
412
if depth == 0 :
397
413
_LOGGER .info (f'Found stuck node { cfgid } : { shorten_hashes (curr_node .id )} ' )
398
414
continue
0 commit comments