Skip to content

Commit ad38846

Browse files
committed
[add]: some lemmata for ⁺++⁺ of Data.List.NonEmpty
1 parent b38deef commit ad38846

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Data/List/NonEmpty/Properties.agda

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
module Data.List.NonEmpty.Properties where
1010

1111
open import Effect.Monad using (RawMonad)
12-
open import Data.Nat.Base using (suc; _+_)
12+
open import Data.Nat.Base using (suc; _+_; _≤_)
13+
open import Data.Nat.Properties using (m≤m+n)
1314
open import Data.Nat.Properties using (suc-injective)
1415
open import Data.Maybe.Properties using (just-injective)
1516
open import Data.Bool.Base using (Bool; true; false)
1617
open import Data.List.Base as List using (List; []; _∷_; _++_)
1718
open import Data.List.Effectful using () renaming (monad to listMonad)
19+
open import Data.List.Properties using (length-++)
1820
open import Data.List.NonEmpty.Effectful using () renaming (monad to list⁺Monad)
1921
open import Data.List.NonEmpty
2022
using (List⁺; _∷_; tail; head; toList; _⁺++_; _⁺++⁺_; _++⁺_; length; fromList;
@@ -69,6 +71,16 @@ toList->>= f (x ∷ xs) = begin
6971
List.concat (List.map toList (List.map f (x ∷ xs)))
7072
7173

74+
------------------------------------------------------------------------
75+
-- _⁺++⁺_
76+
length-⁺++⁺ : (xs ys : List⁺ A)
77+
length (xs ⁺++⁺ ys) ≡ length xs + length ys
78+
length-⁺++⁺ (x ∷ xs) (y ∷ ys) = length-++ (x ∷ xs)
79+
80+
length-⁺++⁺-≤ : (xs ys : List⁺ A)
81+
length xs ≤ length (xs ⁺++⁺ ys)
82+
length-⁺++⁺-≤ xs ys rewrite length-⁺++⁺ xs ys = m≤m+n (length xs) (length ys)
83+
7284
------------------------------------------------------------------------
7385
-- _++⁺_
7486

0 commit comments

Comments
 (0)