Skip to content
Snippets Groups Projects
Commit 400e4593 authored by Patrick Baudin's avatar Patrick Baudin
Browse files

[WP] improves the simplifier dedicated to eq_sequence

parent 386b0858
No related branches found
No related tags found
No related merge requests found
......@@ -369,14 +369,23 @@ let rewrite_eq a b =
match F.repr a , F.repr b with
| L.Fun(nil,[]) , _ when nil == f_nil -> rewrite_is_nil ~nil:a b
| _ , L.Fun(nil,[]) when nil == f_nil -> rewrite_is_nil ~nil:b a
| L.Fun(repeat_a, [x;n]), L.Fun(repeat_b, [y;m])
when repeat_a == f_repeat &&
repeat_b == f_repeat &&
F.decide (F.e_eq x y) ->
(* ( s *^ n == s *^ m <==> (s *^ n == [] && y *^ m == []) || (n == m) *)
let nil_a = v_nil (F.typeof a) in
let nil_b = v_nil (F.typeof b) in
F.p_or (F.p_equal n m)
(F.p_and (F.p_equal a nil_b) (F.p_equal nil_a b))
| L.Fun(repeat_a, [x;n]), L.Fun(repeat_b, [y;m])
when repeat_a == f_repeat &&
repeat_b == f_repeat &&
F.decide (
let nil_a = v_nil (F.typeof a) in
let nil_b = v_nil (F.typeof b) in
F.e_or [ F.e_and [ F.e_eq x y; F.e_eq n m];
F.e_and [F.e_eq a nil_b; F.e_eq nil_a b]]
F.e_or [ F.e_and [F.e_eq x y; F.e_eq n m];
F.e_and [F.e_eq a nil_b; F.e_eq nil_a b] ]
) ->
(* x *^ n == [] && y *^ m == []) || (x == y && n == m) ==> x *^ n == y *^ m *)
F.p_true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment