Skip to content

Commit e11eb7a

Browse files
Gustavo2622strub
authored andcommitted
PR: Fix for proc rewrite in prhl
1 parent 5a36b1b commit e11eb7a

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/phl/ecPhlRewrite.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ let process_rewrite
121121
(fun () -> tc_error !!tc "cannot find a pattern to rewrite")
122122
(List.find_map try1 pts) in
123123

124-
(m, data), expr_of_form mhr e
124+
(m, data), expr_of_form (fst m) e
125125
in
126126

127127
let (m, (pt, mode, cpos)), tc = t_change side pos change tc in

tests/procrewrite.ec

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,28 @@ theory ProcRewriteWhile.
8282
by rcondf ^while; auto.
8383
qed.
8484
end ProcRewriteWhile.
85+
86+
(* -------------------------------------------------------------------- *)
87+
theory ProcRewritePrhl.
88+
module M = {
89+
proc f(a : int, b : int) : int = {
90+
var c : int <- a * (a + b);
91+
return c;
92+
}
93+
94+
proc g(a: int, b:int) : int = {
95+
var c : int <- (a * a) + (a * b);
96+
return c;
97+
}
98+
}.
99+
100+
lemma L a0 b0 : equiv[M.f ~ M.g : ={arg} /\ arg{1} = (a0, b0) ==> ={res} /\ res{1} = (b0 + a0) * a0].
101+
proof.
102+
proc.
103+
proc rewrite {1} 1 addzC.
104+
proc rewrite {2} 1 addzC.
105+
proc rewrite {1} 1 mulzC.
106+
auto=> />.
107+
ring.
108+
qed.
109+
end ProcRewritePrhl.

0 commit comments

Comments
 (0)