summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Bidir.agda3
-rw-r--r--FinMap.agda14
2 files changed, 4 insertions, 13 deletions
diff --git a/Bidir.agda b/Bidir.agda
index 99a3fd0..3875394 100644
--- a/Bidir.agda
+++ b/Bidir.agda
@@ -66,9 +66,6 @@ lemma-checkInsert-wrong eq i x m x' d refl | .(just x') with eq x x'
lemma-checkInsert-wrong eq i x m x' d refl | .(just x') | yes q = contradiction q d
lemma-checkInsert-wrong eq i x m x' d refl | .(just x') | no ¬q = refl
-lemma-just≢nothing : {A Whatever : Set} {a : A} → _≡_ {_} {Maybe A} (just a) nothing → Whatever
-lemma-just≢nothing ()
-
record checkInsertEqualProof {A : Set} {n : ℕ} (eq : EqInst A) (i : Fin n) (x : A) (m : FinMapMaybe n A) (e : Maybe (FinMapMaybe n A)) : Set where
field
same : lookupM i m ≡ just x → just m ≡ e
diff --git a/FinMap.agda b/FinMap.agda
index 03a304b..81862f6 100644
--- a/FinMap.agda
+++ b/FinMap.agda
@@ -12,7 +12,7 @@ open import Function using (id ; _∘_ ; flip)
open import Relation.Nullary using (¬_ ; yes ; no)
open import Relation.Nullary.Negation using (contradiction ; contraposition)
open import Relation.Binary.Core using (_≡_ ; refl)
-open import Relation.Binary.PropositionalEquality using (cong ; sym ; _≗_)
+open import Relation.Binary.PropositionalEquality using (cong ; sym ; _≗_ ; trans)
open Relation.Binary.PropositionalEquality.≡-Reasoning using (begin_ ; _≡⟨_⟩_ ; _∎)
FinMapMaybe : ℕ → Set → Set
@@ -46,6 +46,8 @@ union m1 m2 = tabulate (λ 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-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
@@ -70,15 +72,7 @@ lemma-from-just : {A : Set} → {x y : A} → _≡_ {_} {Maybe A} (just x) (just
lemma-from-just 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 {A} i f [] a p with begin
- just a
- ≡⟨ sym p ⟩
- lookupM i (restrict f [])
- ≡⟨ refl ⟩
- lookupM i empty
- ≡⟨ lemma-lookupM-empty i ⟩
- nothing ∎
-lemma-lookupM-restrict i f [] a p | ()
+lemma-lookupM-restrict {A} i f [] a p = lemma-just≢nothing (trans (sym 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 = lemma-from-just (begin
just (f i)