|
9 | 9 | module Data.List.NonEmpty.Properties where
|
10 | 10 |
|
11 | 11 | 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) |
13 | 14 | open import Data.Nat.Properties using (suc-injective)
|
14 | 15 | open import Data.Maybe.Properties using (just-injective)
|
15 | 16 | open import Data.Bool.Base using (Bool; true; false)
|
16 | 17 | open import Data.List.Base as List using (List; []; _∷_; _++_)
|
17 | 18 | open import Data.List.Effectful using () renaming (monad to listMonad)
|
| 19 | +open import Data.List.Properties using (length-++) |
18 | 20 | open import Data.List.NonEmpty.Effectful using () renaming (monad to list⁺Monad)
|
19 | 21 | open import Data.List.NonEmpty
|
20 | 22 | using (List⁺; _∷_; tail; head; toList; _⁺++_; _⁺++⁺_; _++⁺_; length; fromList;
|
@@ -69,6 +71,16 @@ toList->>= f (x ∷ xs) = begin
|
69 | 71 | List.concat (List.map toList (List.map f (x ∷ xs)))
|
70 | 72 | ∎
|
71 | 73 |
|
| 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 | + |
72 | 84 | ------------------------------------------------------------------------
|
73 | 85 | -- _++⁺_
|
74 | 86 |
|
|
0 commit comments