diff --git a/CHANGELOG.md b/CHANGELOG.md index a55dcb0f79..78dea52440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1547,6 +1547,8 @@ Other minor changes combine-surjective : ∀ i → ∃₂ λ j k → combine j k ≡ i combine-monoˡ-< : i < j → combine i k < combine j l + ℕ-ℕ≡toℕ‿ℕ- : n ℕ-ℕ i ≡ toℕ (n ℕ- i) + lower₁-injective : lower₁ i n≢i ≡ lower₁ j n≢j → i ≡ j pinch-injective : suc i ≢ j → suc i ≢ k → pinch i j ≡ pinch i k → j ≡ k diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index ce93b67b01..06c4581337 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -11,6 +11,7 @@ module Data.Fin.Base where +open import Data.Bool.Base using (Bool; true; false; T; not) open import Data.Empty using (⊥-elim) open import Data.Nat.Base as ℕ using (ℕ; zero; suc; z≤n; s≤s; z; uncurry) open import Data.Sum.Base using ([_,_]′) @@ -396,7 +396,7 @@ toList-cast {n = suc _} eq (x ∷ xs) = cast-is-id : .(eq : m ≡ m) (xs : Vec A m) → cast eq xs ≡ xs cast-is-id eq [] = refl -cast-is-id eq (x ∷ xs) = cong (x ∷_) (cast-is-id (ℕₚ.suc-injective eq) xs) +cast-is-id eq (x ∷ xs) = cong (x ∷_) (cast-is-id (suc-injective eq) xs) subst-is-cast : (eq : m ≡ n) (xs : Vec A m) → subst (Vec A) eq xs ≡ cast eq xs subst-is-cast refl xs = sym (cast-is-id refl xs) @@ -405,7 +405,7 @@ cast-trans : .(eq₁ : m ≡ n) (eq₂ : n ≡ o) (xs : Vec A m) → cast eq₂ (cast eq₁ xs) ≡ cast (trans eq₁ eq₂) xs cast-trans {m = zero} {n = zero} {o = zero} eq₁ eq₂ [] = refl cast-trans {m = suc _} {n = suc _} {o = suc _} eq₁ eq₂ (x ∷ xs) = - cong (x ∷_) (cast-trans (ℕₚ.suc-injective eq₁) (ℕₚ.suc-injective eq₂) xs) + cong (x ∷_) (cast-trans (suc-injective eq₁) (suc-injective eq₂) xs) ------------------------------------------------------------------------ -- map @@ -422,7 +422,7 @@ map-cast : (f : A → B) .(eq : m ≡ n) (xs : Vec A m) → map f (cast eq xs) ≡ cast eq (map f xs) map-cast {n = zero} f eq [] = refl map-cast {n = suc _} f eq (x ∷ xs) - = cong (f x ∷_) (map-cast f (ℕₚ.suc-injective eq) xs) + = cong (f x ∷_) (map-cast f (suc-injective eq) xs) map-++ : ∀ (f : A → B) (xs : Vec A m) (ys : Vec A n) → map f (xs ++ ys) ≡ map f xs ++ map f ys @@ -518,19 +518,19 @@ lookup-cast : .(eq : m ≡ n) (xs : Vec A m) (i : Fin m) → lookup (cast eq xs) (Fin.cast eq i) ≡ lookup xs i lookup-cast {n = suc _} eq (x ∷ _) zero = refl lookup-cast {n = suc _} eq (_ ∷ xs) (suc i) = - lookup-cast (ℕₚ.suc-injective eq) xs i + lookup-cast (suc-injective eq) xs i lookup-cast₁ : .(eq : m ≡ n) (xs : Vec A m) (i : Fin n) → lookup (cast eq xs) i ≡ lookup xs (Fin.cast (sym eq) i) lookup-cast₁ eq (x ∷ _) zero = refl lookup-cast₁ eq (_ ∷ xs) (suc i) = - lookup-cast₁ (ℕₚ.suc-injective eq) xs i + lookup-cast₁ (suc-injective eq) xs i lookup-cast₂ : .(eq : m ≡ n) (xs : Vec A n) (i : Fin m) → lookup xs (Fin.cast eq i) ≡ lookup (cast (sym eq) xs) i -lookup-cast₂ {n = suc _} eq (x ∷ _) zero = refl -lookup-cast₂ {n = suc _} eq (_ ∷ xs) (suc i) = - lookup-cast₂ (ℕₚ.suc-injective eq) xs i +lookup-cast₂ eq (x ∷ _) zero = refl +lookup-cast₂ eq (_ ∷ xs) (suc i) = + lookup-cast₂ (suc-injective eq) xs i lookup-concat : ∀ (xss : Vec (Vec A m) n) i j → lookup (concat xss) (Fin.combine i j) ≡ lookup (lookup xss i) j diff --git a/src/Data/Vec/Recursive.agda b/src/Data/Vec/Recursive.agda index 2178fdf54d..b30089d33c 100644 --- a/src/Data/Vec/Recursive.agda +++ b/src/Data/Vec/Recursive.agda @@ -19,7 +19,7 @@ module Data.Vec.Recursive where open import Level using (Level; lift) open import Function.Bundles using (mk↔′) open import Function.Properties.Inverse using (↔-isEquivalence; ↔-refl; ↔-sym; ↔-trans) -open import Data.Nat.Base as Nat using (ℕ; zero; suc) +open import Data.Nat.Base as Nat using (ℕ; zero; suc; NonZero; pred) open import Data.Nat.Properties using (+-comm; *-comm) open import Data.Empty.Polymorphic open import Data.Fin.Base as Fin using (Fin; zero; suc) diff --git a/src/Data/Vec/Relation/Binary/Pointwise/Extensional.agda b/src/Data/Vec/Relation/Binary/Pointwise/Extensional.agda index 4d8330590d..8fc0a267db 100644 --- a/src/Data/Vec/Relation/Binary/Pointwise/Extensional.agda +++ b/src/Data/Vec/Relation/Binary/Pointwise/Extensional.agda @@ -9,7 +9,6 @@ module Data.Vec.Relation.Binary.Pointwise.Extensional where open import Data.Fin.Base using (zero; suc) -open import Data.Nat.Base using (zero; suc) open import Data.Vec.Base as Vec hiding ([_]; head; tail; map) open import Data.Vec.Relation.Binary.Pointwise.Inductive as Inductive using ([]; _∷_) @@ -73,8 +72,8 @@ module _ {_∼_ : REL A B ℓ} where extensional⇒inductive : ∀ {n} {xs : Vec A n} {ys : Vec B n} → Pointwise _∼_ xs ys → IPointwise _∼_ xs ys - extensional⇒inductive {zero} {[]} {[]} xs∼ys = [] - extensional⇒inductive {suc n} {x ∷ xs} {y ∷ ys} xs∼ys = + extensional⇒inductive {xs = []} {[]} xs∼ys = [] + extensional⇒inductive {xs = x ∷ xs} {y ∷ ys} xs∼ys = (head xs∼ys) ∷ extensional⇒inductive (tail xs∼ys) inductive⇒extensional : ∀ {n} {xs : Vec A n} {ys : Vec B n} → diff --git a/src/Data/Vec/Relation/Unary/All.agda b/src/Data/Vec/Relation/Unary/All.agda index c263276074..b16340ef6b 100644 --- a/src/Data/Vec/Relation/Unary/All.agda +++ b/src/Data/Vec/Relation/Unary/All.agda @@ -8,8 +8,7 @@ module Data.Vec.Relation.Unary.All where -open import Data.Nat.Base using (ℕ; zero; suc) -open import Data.Fin.Base using (Fin; zero; suc) +open import Data.Nat.Base using (ℕ; zero; suc; NonZero) open import Data.Product as Prod using (_×_; _,_; uncurry; <_,_>) open import Data.Sum.Base as Sum using (inj₁; inj₂) open import Data.Vec.Base as Vec using (Vec; []; _∷_) diff --git a/src/Data/Vec/Relation/Unary/All/Properties.agda b/src/Data/Vec/Relation/Unary/All/Properties.agda index ea6a2f521e..b25a860c68 100644 --- a/src/Data/Vec/Relation/Unary/All/Properties.agda +++ b/src/Data/Vec/Relation/Unary/All/Properties.agda @@ -37,7 +37,7 @@ private ------------------------------------------------------------------------ -- lookup -lookup⁺ : All P xs → (i : Fin n) → P (Vec.lookup xs i) +lookup⁺ : All P xs → ∀ i → P (Vec.lookup xs i) lookup⁺ (px ∷ _) zero = px lookup⁺ (_ ∷ pxs) (suc i) = lookup⁺ pxs i @@ -140,8 +140,8 @@ module _ {P : A → Set p} where tabulate⁻ : ∀ {n} {f : Fin n → A} → All P (tabulate f) → (∀ i → P (f i)) - tabulate⁻ {suc n} (px ∷ _) zero = px - tabulate⁻ {suc n} (_ ∷ pf) (suc i) = tabulate⁻ pf i + tabulate⁻ (px ∷ _) zero = px + tabulate⁻ (_ ∷ pf) (suc i) = tabulate⁻ pf i ------------------------------------------------------------------------ -- take and drop diff --git a/src/Data/Vec/Relation/Unary/Any.agda b/src/Data/Vec/Relation/Unary/Any.agda index 5a65a74dd6..a54991976f 100644 --- a/src/Data/Vec/Relation/Unary/Any.agda +++ b/src/Data/Vec/Relation/Unary/Any.agda @@ -9,8 +9,8 @@ module Data.Vec.Relation.Unary.Any {a} {A : Set a} where open import Data.Empty -open import Data.Fin.Base -open import Data.Nat.Base using (ℕ; zero; suc) +open import Data.Fin.Base using (Fin; zero; suc) +open import Data.Nat.Base using (ℕ; zero; suc; NonZero) open import Data.Sum.Base using (_⊎_; inj₁; inj₂; [_,_]′) open import Data.Vec.Base as Vec using (Vec; []; [_]; _∷_) open import Data.Product as Prod using (∃; _,_) diff --git a/src/Data/Vec/Relation/Unary/Any/Properties.agda b/src/Data/Vec/Relation/Unary/Any/Properties.agda index a300c44d55..9faa49d464 100644 --- a/src/Data/Vec/Relation/Unary/Any/Properties.agda +++ b/src/Data/Vec/Relation/Unary/Any/Properties.agda @@ -363,8 +363,8 @@ module _ {P : Pred A p} where tabulate⁻ : ∀ {n} {f : Fin n → A} → Any P (tabulate f) → ∃ λ i → P (f i) - tabulate⁻ {suc n} (here p) = zero , p - tabulate⁻ {suc n} (there p) = Prod.map suc id (tabulate⁻ p) + tabulate⁻ (here p) = zero , p + tabulate⁻ (there p) = Prod.map suc id (tabulate⁻ p) ------------------------------------------------------------------------ -- mapWith∈ diff --git a/src/Data/Vec/Relation/Unary/Linked/Properties.agda b/src/Data/Vec/Relation/Unary/Linked/Properties.agda index 20806dc5f5..3935a263c4 100644 --- a/src/Data/Vec/Relation/Unary/Linked/Properties.agda +++ b/src/Data/Vec/Relation/Unary/Linked/Properties.agda @@ -14,10 +14,9 @@ open import Data.Vec.Relation.Unary.All as All using (All; []; _∷_) import Data.Vec.Relation.Unary.All.Properties as Allₚ open import Data.Vec.Relation.Unary.Linked as Linked using (Linked; []; [-]; _∷_) -open import Data.Fin.Base using (Fin; zero; suc; _<_) -open import Data.Fin.Properties using (suc-injective) -open import Data.Nat.Base using (ℕ; zero; suc) -open import Data.Nat.Properties using (<-pred) -- ≤-refl; ≤-pred; ≤-step) +open import Data.Fin.Base using (zero; suc; _<_) +open import Data.Nat.Base using (ℕ; zero; suc; NonZero) +open import Data.Nat.Properties using (<-pred) open import Level using (Level) open import Function.Base using (_∘_; flip; _on_) open import Relation.Binary using (Rel; Transitive; DecSetoid) @@ -44,7 +43,7 @@ module _ (trans : Transitive R) where Linked⇒All Rvx [-] = Rvx ∷ [] Linked⇒All Rvx (Rxy ∷ Rxs) = Rvx ∷ Linked⇒All (trans Rvx Rxy) Rxs - lookup⁺ : ∀ {i j : Fin n} {xs} → + lookup⁺ : ∀ {i j} {xs : Vec _ n} → Linked R xs → i < j → R (lookup xs i) (lookup xs j) lookup⁺ {i = zero} {j = suc j} (rx ∷ rxs) i