Skip to content

Commit ddcc091

Browse files
committed
Reduce equalities between record literals.
The reduction follows the current behavior for tuples.
1 parent 2d87cff commit ddcc091

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/ecReduction.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,14 @@ let reduce_logic ri env hyps f p args =
857857
then f_false
858858
else f_ands (List.map2 f_eq args1 args2)
859859

860+
| (Fop (p1, tys1), args1), (Fop (p2, tys2), args2)
861+
when EcPath.p_equal p1 p2
862+
&& EcEnv.Op.is_record_ctor env p1
863+
&& EcEnv.Op.is_record_ctor env p2
864+
&& List.for_all2 (EqTest_i.for_type env) tys1 tys2 ->
865+
866+
f_ands (List.map2 f_eq args1 args2)
867+
860868
| (_, []), (_, [])
861869
when EqTest_i.for_type env f1.f_ty EcTypes.tunit
862870
&& EqTest_i.for_type env f2.f_ty EcTypes.tunit ->

tests/reduction-record-eqyality.ec

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require import AllCore.
2+
3+
type t = { x: int; y: int }.
4+
5+
lemma L x y :
6+
x = 0 => y = 1 => {| x = x; y = y |} = {| x = 0; y = 1 |}.
7+
proof. move=> xE yE /=; split; assumption. qed.

0 commit comments

Comments
 (0)