diff options
author | Helmut Grohne <helmut@subdivi.de> | 2013-01-14 13:13:00 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2013-01-14 13:13:00 +0100 |
commit | 9c2be74a5369c1bdb737a67c7c508cb50c62bd83 (patch) | |
tree | 4b2972936dc6377e2df28b6da3b3485a50296813 /FinMap.agda | |
parent | a01871259837d6e36c580338f6d29ea0b154ed04 (diff) | |
download | bidiragda-9c2be74a5369c1bdb737a67c7c508cb50c62bd83.tar.gz |
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.
Diffstat (limited to 'FinMap.agda')
-rw-r--r-- | FinMap.agda | 6 |
1 files changed, 3 insertions, 3 deletions
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) |