11use std:: time:: Duration ;
22
3- use egg:: { AstSize , RecExpr , Runner , SimpleScheduler } ;
3+ use egg:: { AstSize , Runner , SimpleScheduler } ;
44
55use eggshell:: eqsat:: hooks;
6- use eggshell:: rewrite_system:: rise:: { self , PrettyPrint , Rise , RiseRuleset } ;
7- use eggshell:: rewrite_system:: rise:: { BLOCKING_GOAL , MM , SPLIT_GUIDE } ;
6+ use eggshell:: rewrite_system:: rise:: { self , BLOCKING_GOAL , MM , RiseRuleset , SPLIT_GUIDE } ;
87use eggshell:: sketch;
8+ use eggshell:: utils;
99
1010fn main ( ) {
11- let mm: RecExpr < Rise > = MM . parse ( ) . unwrap ( ) ;
12- let split_guide: RecExpr < Rise > = SPLIT_GUIDE . parse ( ) . unwrap ( ) ;
11+ let mm = rise:: canon_nat ( & MM . parse ( ) . unwrap ( ) ) ;
12+ let split_guide = rise:: canon_nat ( & SPLIT_GUIDE . parse ( ) . unwrap ( ) ) ;
13+ let blocking_goal = rise:: canon_nat ( & BLOCKING_GOAL . parse ( ) . unwrap ( ) ) ;
1314
1415 let runner_1 = Runner :: default ( )
1516 . with_expr ( & mm)
1617 . with_iter_limit ( 6 )
17- . with_time_limit ( Duration :: from_secs ( 30 ) )
18+ . with_time_limit ( Duration :: from_secs ( 60 ) )
1819 . with_node_limit ( 1_000_000 )
1920 . with_scheduler ( SimpleScheduler )
2021 . with_hook ( hooks:: targe_hook ( split_guide. clone ( ) ) )
@@ -24,32 +25,43 @@ fn main() {
2425 println ! ( "{}" , runner_1. report( ) ) ;
2526
2627 let root_mm = runner_1. egraph . find ( runner_1. roots [ 0 ] ) ;
27- let split_guide_sketch = rise:: sketchify ( SPLIT_GUIDE , true ) ;
28- let ( _, sketch_extracted_split_guide) =
29- sketch:: eclass_extract ( & split_guide_sketch, AstSize , & runner_1. egraph , root_mm) . unwrap ( ) ;
30-
31- println ! ( "\n Guide Ground Truth" ) ;
32- split_guide. pp ( false ) ;
33- println ! ( "\n Sketch Extracted:" ) ;
34- sketch_extracted_split_guide. pp ( false ) ;
35-
36- assert_eq ! (
37- None ,
38- eggshell:: utils:: find_diff( & sketch_extracted_split_guide, & split_guide)
28+ let split_guide_sketch = rise:: sketchify ( & split_guide, true ) ;
29+ let sketch_extracted_split_guide = rise:: canon_nat (
30+ & sketch:: eclass_extract ( & split_guide_sketch, AstSize , & runner_1. egraph , root_mm)
31+ . unwrap ( )
32+ . 1 ,
3933 ) ;
40- assert_eq ! ( root_mm, runner_1. egraph. lookup_expr( & split_guide) . unwrap( ) ) ;
34+ assert ! ( utils:: find_diff( & sketch_extracted_split_guide, & split_guide) . is_none( ) ) ;
35+
36+ // println!("\nGuide Ground Truth");
37+ // split_guide.pp(false);
38+ // println!("\nSketch Extracted:");
39+ // sketch_extracted_split_guide.pp(false);
40+
41+ // assert_eq!(root_mm, runner_1.egraph.lookup_expr(&split_guide).unwrap());
4142
42- let blocking_goal: RecExpr < Rise > = BLOCKING_GOAL . parse ( ) . unwrap ( ) ;
4343 let runner_2 = Runner :: default ( )
4444 . with_expr ( & split_guide)
45- . with_iter_limit ( 6 )
45+ . with_iter_limit ( 8 )
46+ . with_time_limit ( Duration :: from_secs ( 60 ) )
47+ . with_node_limit ( 1_000_000 )
4648 . with_scheduler ( SimpleScheduler )
4749 . with_hook ( hooks:: targe_hook ( blocking_goal. clone ( ) ) )
50+ . with_hook ( hooks:: printer_hook)
4851 . run ( & rise:: rules ( RiseRuleset :: MM ) ) ;
4952
53+ println ! ( "{}" , runner_2. report( ) ) ;
54+
5055 let root_guide = runner_2. egraph . find ( runner_2. roots [ 0 ] ) ;
51- assert_eq ! (
52- root_guide,
53- runner_2. egraph. lookup_expr( & blocking_goal) . unwrap( )
56+ let blocking_goal_sketch = rise:: sketchify ( & blocking_goal, true ) ;
57+ let sketch_extracted_blocking_goal = rise:: canon_nat (
58+ & sketch:: eclass_extract ( & blocking_goal_sketch, AstSize , & runner_2. egraph , root_guide)
59+ . unwrap ( )
60+ . 1 ,
5461 ) ;
62+ assert ! ( utils:: find_diff( & sketch_extracted_blocking_goal, & blocking_goal) . is_none( ) ) ;
63+ // assert_eq!(
64+ // root_guide,
65+ // runner_2.egraph.lookup_expr(&blocking_goal).unwrap()
66+ // );
5567}
0 commit comments