Idris2Doc : Data.Vect.Properties.Foldr

Data.Vect.Properties.Foldr


foldr is the unique solution to the equation:

  h f e [] = e
  h f e (x :: xs) = x `h` (foldr f e xs)

(This fact is called 'the universal property of foldr'.)

Since the prelude defines foldr tail-recursively, this fact isn't immediate
and we need some lemmata to prove it.

Definitions

sumR : Numa=>Foldablef=>fa->a
  Sum implemented with foldr

Visibility: public export
recordVectHomomorphismProperty : {0A : Type} -> {0B : Type} -> (A->B->B) ->B-> (VectnA->B) ->Type
  A function H : forall n. Vect n A -> B preserving the structure of vectors over A

Totality: total
Visibility: public export
Constructor: 
ShowVectHomomorphismProperty : {0A : Type} -> {0B : Type} -> {0F : A->B->B} -> {0E : B} -> {0H : VectnA->B} ->H [] =E-> ((x : A) -> (xs : VectnA) ->H (x::xs) =Fx (Hxs)) ->VectHomomorphismPropertyFE (\0{n:4651}=>H)

Projections:
.cons : {0A : Type} -> {0B : Type} -> {0F : A->B->B} -> {0E : B} -> {0H : VectnA->B} ->VectHomomorphismPropertyFE (\0{n:4819}=>H) -> (x : A) -> (xs : VectnA) ->H (x::xs) =Fx (Hxs)
.nil : {0A : Type} -> {0B : Type} -> {0F : A->B->B} -> {0E : B} -> {0H : VectnA->B} ->VectHomomorphismPropertyFE (\0{n:4693}=>H) ->H [] =E
.nil : {0A : Type} -> {0B : Type} -> {0F : A->B->B} -> {0E : B} -> {0H : VectnA->B} ->VectHomomorphismPropertyFE (\0{n:4693}=>H) ->H [] =E
Visibility: public export
nil : {0A : Type} -> {0B : Type} -> {0F : A->B->B} -> {0E : B} -> {0H : VectnA->B} ->VectHomomorphismPropertyFE (\0{n:4757}=>H) ->H [] =E
Visibility: public export
.cons : {0A : Type} -> {0B : Type} -> {0F : A->B->B} -> {0E : B} -> {0H : VectnA->B} ->VectHomomorphismPropertyFE (\0{n:4819}=>H) -> (x : A) -> (xs : VectnA) ->H (x::xs) =Fx (Hxs)
Visibility: public export
Fixity Declarations:
infixr operator, level 5
infixr operator, level 5
cons : {0A : Type} -> {0B : Type} -> {0F : A->B->B} -> {0E : B} -> {0H : VectnA->B} ->VectHomomorphismPropertyFE (\0{n:4898}=>H) -> (x : A) -> (xs : VectnA) ->H (x::xs) =Fx (Hxs)
Visibility: public export
Fixity Declarations:
infixr operator, level 5
infixr operator, level 5
nilConsInitiality : (f : (a->b->b)) -> (e : b) -> (h1 : (Vectna->b)) -> (h2 : (Vectna->b)) ->VectHomomorphismPropertyfe (\0{n:4978}=>h1) ->VectHomomorphismPropertyfe (\0{n:4990}=>h2) -> (xs : Vectna) ->h1xs=h2xs
  There is an extensionally unique function preserving the vector structure

Visibility: export
foldrVectHomomorphism : VectHomomorphismPropertyfe (\0{n:5386}=>foldrfe)
  Our tail-recursive foldr preserves the vector structure

Visibility: export
foldrUniqueness : (h : (Vectna->b)) ->VectHomomorphismPropertyfe (\0{n:5586}=>h) -> (xs : Vectna) ->hxs=foldrfexs
  foldr is the unique function preserving the vector structure

Visibility: export
sumIsGTEtoParts : (xs : VectnNat) ->Elemxxs->GTE (sumRxs) x
  Each summand is `LTE` the sum

Visibility: export
sumMonotone : (xs : VectnNat) -> (ys : VectnNat) -> ((i : Finn) ->LTE (indexixs) (indexiys)) ->LTE (sumRxs) (sumRys)
  `sumR : Vect n Nat -> Nat` is monotone

Visibility: export