From 9c2be74a5369c1bdb737a67c7c508cb50c62bd83 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Mon, 14 Jan 2013 13:13:00 +0100 Subject: define a more useful version of lemma-just\==nnothing If one had a parameter of type just x \== nothing it could be simply refuted by case splitting. So the cases where lemma-just\==nnothing was used always employed trans to combine two results. The new version takes both results instead. --- FinMap.agda | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'FinMap.agda') diff --git a/FinMap.agda b/FinMap.agda index 2b50920..8b4103b 100644 --- a/FinMap.agda +++ b/FinMap.agda @@ -46,8 +46,8 @@ union m1 m2 = fromFunc (λ f → maybe′ id (lookup f m2) (lookupM f m1)) restrict : {A : Set} {n : ℕ} → (Fin n → A) → List (Fin n) → FinMapMaybe n A restrict f is = fromAscList (zip is (map f is)) -lemma-just≢nothing : {A Whatever : Set} {a : A} → _≡_ {_} {Maybe A} (just a) nothing → Whatever -lemma-just≢nothing () +lemma-just≢nothing : {A Whatever : Set} {a : A} {ma : Maybe A} → ma ≡ just a → ma ≡ nothing → Whatever +lemma-just≢nothing refl () lemma-insert-same : {τ : Set} {n : ℕ} → (m : FinMapMaybe n τ) → (f : Fin n) → (a : τ) → lookupM f m ≡ just a → m ≡ insert f a m lemma-insert-same [] () a p @@ -72,7 +72,7 @@ just-injective : {A : Set} → {x y : A} → _≡_ {_} {Maybe A} (just x) (just just-injective refl = refl lemma-lookupM-restrict : {A : Set} {n : ℕ} → (i : Fin n) → (f : Fin n → A) → (is : List (Fin n)) → (a : A) → lookupM i (restrict f is) ≡ just a → f i ≡ a -lemma-lookupM-restrict i f [] a p = lemma-just≢nothing (trans (sym p) (lemma-lookupM-empty i)) +lemma-lookupM-restrict i f [] a p = lemma-just≢nothing p (lemma-lookupM-empty i) lemma-lookupM-restrict i f (i' ∷ is) a p with i ≟ i' lemma-lookupM-restrict i f (.i ∷ is) a p | yes refl = just-injective (begin just (f i) -- cgit v1.2.3