@@ -68,7 +68,7 @@ module {:options "-functionSyntax:4"} Maps {
6868 ghost predicate IsSubset< X, Y> (m: map < X, Y> , m': map < X, Y> )
6969 {
7070 && m. Keys <= m'. Keys
71- && forall x {:trigger EqualOnKey (m, m', x)}{:trigger x in m} :: x in m ==> EqualOnKey (m, m', x)
71+ && forall x < - m :: m[x] == m'[x]
7272 }
7373
7474 /* Union of two maps. Does not require disjoint domains; on the intersection,
@@ -97,18 +97,11 @@ module {:options "-functionSyntax:4"} Maps {
9797 forall x, x' {:trigger m[x], m[x']} :: x != x' && x in m && x' in m ==> m[x] != m[x']
9898 }
9999
100- ghost predicate {:opaque} Contains< X, Y> (big: map < X, Y> , small: map < X, Y> )
101- {
102- && small. Keys <= big. Keys
103- && forall x < - small :: small[x] == big[x]
104- }
105-
106- lemma LemmaContainsPreservesInjectivity< X, Y> (big: map < X, Y> , small: map < X, Y> )
107- requires Contains (big, small)
100+ lemma LemmaSubsetIsInjective< X, Y> (small: map < X, Y> , big: map < X, Y> )
101+ requires IsSubset (small, big)
108102 requires Injective (big)
109103 ensures Injective (small)
110104 {
111- reveal Contains ();
112105 reveal Injective ();
113106 }
114107
@@ -117,15 +110,15 @@ module {:options "-functionSyntax:4"} Maps {
117110 ensures |m. Keys| == |m. Values|
118111 {
119112 if |m| > 0 {
113+ reveal Injective ();
114+
120115 var x: X :| x in m;
121116 var y := m[x];
122117 var m' := Remove (m, x);
123- reveal Contains ();
124- assert Contains (m, m');
118+ assert IsSubset (m', m);
125119
126- reveal Injective ();
127120 assert m'. Values == m. Values - {y};
128- LemmaContainsPreservesInjectivity (m , m' );
121+ LemmaSubsetIsInjective (m' , m);
129122 LemmaInjectiveImpliesUniqueValues (m');
130123 }
131124 }
0 commit comments