1- {-# OPTIONS --erasure #-}
21
32-- | Proofs on 'Map'.
43module Data.Map.Prop where
@@ -14,13 +13,14 @@ open import Haskell.Data.Maybe using
1413
1514import Data.Map.Maybe as Maybe
1615import Haskell.Prelude as List using (map)
16+ open import Data.Set using (Set )
1717import Data.Set as Set
1818
1919{-----------------------------------------------------------------------------
2020 Proofs
2121 involving 1 value type
2222------------------------------------------------------------------------------}
23- module _ {k a : Set } {{_ : Ord k}} where
23+ module _ {k a : Type } {{_ : Ord k}} where
2424
2525 --
2626 prop-member-null
@@ -210,7 +210,7 @@ module _ {k a : Set} {{_ : Ord k}} where
210210 Proofs
211211 involving keysSet
212212------------------------------------------------------------------------------}
213- module _ {k a : Set } {{_ : Ord k}} where
213+ module _ {k a : Type } {{_ : Ord k}} where
214214
215215 --
216216 prop-member-keysSet
@@ -325,12 +325,11 @@ module _ {k a : Set} {{_ : Ord k}} where
325325 ≡ Set.member key (Set.union (keysSet ma) (keysSet mb))
326326 lem1 key
327327 rewrite prop-member-keysSet {key} {union ma mb}
328- rewrite prop-lookup-union key ma mb
329- rewrite Set.prop-member-union {k} key (keysSet ma) (keysSet mb)
330- rewrite prop-member-keysSet {key} {ma}
331- rewrite prop-member-keysSet {key} {mb}
332- with lookup key ma
333- with lookup key mb
328+ | prop-lookup-union key ma mb
329+ | Set.prop-member-union {k} key (keysSet ma) (keysSet mb)
330+ | prop-member-keysSet {key} {ma}
331+ | prop-member-keysSet {key} {mb}
332+ with lookup key ma | lookup key mb
334333 ... | Nothing | Nothing = refl
335334 ... | Just a | Nothing = refl
336335 ... | Nothing | Just b = refl
@@ -355,11 +354,11 @@ module _ {k a : Set} {{_ : Ord k}} where
355354 Proofs
356355 involving withoutKeys and restrictKeys
357356------------------------------------------------------------------------------}
358- module _ {k a : Set } {{_ : Ord k}} where
357+ module _ {k a : Type } {{_ : Ord k}} where
359358
360359 --
361360 prop-lookup-withoutKeys
362- : ∀ (key : k) (m : Map k a) (ks : Set.ℙ k)
361+ : ∀ (key : k) (m : Map k a) (ks : Set k)
363362 → lookup key (withoutKeys m ks)
364363 ≡ Maybe.filt (not (Set.member key ks)) (lookup key m)
365364 --
@@ -377,7 +376,7 @@ module _ {k a : Set} {{_ : Ord k}} where
377376
378377 --
379378 prop-lookup-restrictKeys
380- : ∀ (key : k) (m : Map k a) (ks : Set.ℙ k)
379+ : ∀ (key : k) (m : Map k a) (ks : Set k)
381380 → lookup key (restrictKeys m ks)
382381 ≡ Maybe.filt (Set.member key ks) (lookup key m)
383382 --
@@ -441,7 +440,7 @@ module _ {k a : Set} {{_ : Ord k}} where
441440
442441 --
443442 prop-restrictKeys-union
444- : ∀ (ma mb : Map k a) (ks : Set.ℙ k)
443+ : ∀ (ma mb : Map k a) (ks : Set k)
445444 → restrictKeys (union ma mb) ks
446445 ≡ union (restrictKeys ma ks) (restrictKeys mb ks)
447446 --
@@ -499,7 +498,7 @@ module _ {k a : Set} {{_ : Ord k}} where
499498
500499 --
501500 prop-withoutKeys-union
502- : ∀ (ma mb : Map k a) (ks : Set.ℙ k)
501+ : ∀ (ma mb : Map k a) (ks : Set k)
503502 → withoutKeys (union ma mb) ks
504503 ≡ union (withoutKeys ma ks) (withoutKeys mb ks)
505504 --
@@ -531,7 +530,7 @@ module _ {k a : Set} {{_ : Ord k}} where
531530
532531 --
533532 prop-withoutKeys-difference
534- : ∀ (m : Map k a) (ka kb : Set.ℙ k)
533+ : ∀ (m : Map k a) (ka kb : Set k)
535534 → withoutKeys m (Set.difference ka kb)
536535 ≡ union (withoutKeys m ka) (restrictKeys m kb)
537536 --
@@ -582,7 +581,7 @@ module _ {k a : Set} {{_ : Ord k}} where
582581
583582 --
584583 prop-withoutKeys-withoutKeys
585- : ∀ (m : Map k a) (ka kb : Set.ℙ k)
584+ : ∀ (m : Map k a) (ka kb : Set k)
586585 → withoutKeys (withoutKeys m ka) kb
587586 ≡ withoutKeys m (Set.union ka kb)
588587 --
@@ -625,7 +624,7 @@ module _ {k a : Set} {{_ : Ord k}} where
625624
626625 --
627626 @0 prop-withoutKeys-intersection
628- : ∀ (m : Map k a) (ka kb : Set.ℙ k)
627+ : ∀ (m : Map k a) (ka kb : Set k)
629628 → withoutKeys m (Set.intersection ka kb)
630629 ≡ union (withoutKeys m ka) (withoutKeys m kb)
631630 --
@@ -686,8 +685,8 @@ module _ {k a : Set} {{_ : Ord k}} where
686685 ≡ lookup key ma
687686 eq-key key
688687 rewrite prop-lookup-union key ma (restrictKeys mb (keysSet ma))
689- rewrite prop-lookup-restrictKeys key mb (keysSet ma)
690- rewrite prop-member-keysSet {k} {a} {key} {ma}
688+ | prop-lookup-restrictKeys key mb (keysSet ma)
689+ | prop-member-keysSet {k} {a} {key} {ma}
691690 with lookup key ma
692691 ... | Nothing = refl
693692 ... | Just a
0 commit comments