mirror of
https://github.com/Smaug123/agdaproofs
synced 2025-10-12 23:28:39 +00:00
Progress towards UFDs (#88)
This commit is contained in:
22
Lists/Length.agda
Normal file
22
Lists/Length.agda
Normal file
@@ -0,0 +1,22 @@
|
||||
{-# OPTIONS --safe --warning=error --without-K #-}
|
||||
|
||||
open import LogicalFormulae
|
||||
open import Functions
|
||||
open import Numbers.Naturals.Semiring -- for length
|
||||
open import Numbers.Naturals.Order
|
||||
open import Semirings.Definition
|
||||
open import Lists.Definition
|
||||
open import Lists.Fold.Fold
|
||||
|
||||
module Lists.Length where
|
||||
|
||||
length : {a : _} {A : Set a} (l : List A) → ℕ
|
||||
length [] = zero
|
||||
length (x :: l) = succ (length l)
|
||||
|
||||
length' : {a : _} {A : Set a} → (l : List A) → ℕ
|
||||
length' = fold (λ _ → succ) 0
|
||||
|
||||
length=length' : {a : _} {A : Set a} (l : List A) → length l ≡ length' l
|
||||
length=length' [] = refl
|
||||
length=length' (x :: l) = applyEquality succ (length=length' l)
|
Reference in New Issue
Block a user