Idris2Doc : Control.WellFounded

Control.WellFounded

Defines well-founded induction and recursion.

Induction is way to consume elements of recursive types where each step of
the computation has access to the previous steps.
Normally, induction is structural: the previous steps are the children of
the current element.
Well-founded induction generalises this as follows: each step has access to
any value that is less than the current element, based on a relation.

Well-founded induction is implemented in terms of accessibility: an element
is accessible (with respect to a given relation) if every element less than
it is also accessible. This can only terminate at minimum elements.

This corresponds to the idea that for a computation to terminate, there
must be a finite path to an element from which there is no way to recurse.

Many instances of well-founded induction are actually induction over
natural numbers that are derived from the elements being inducted over. For
this purpose, the `Sized` interface and related functions are provided.

Definitions

dataAccessible : (a->a->Type) ->a->Type
  A value is accessible if everything smaller than it is also accessible.

Totality: total
Visibility: public export
Constructor: 
Access : ((y : a) ->relyx->Accessiblerely) ->Accessiblerelx
interfaceWellFounded : (a : Type) -> (a->a->Type) ->Type
  A relation is well-founded if every element is accessible.

Parameters: a, rel
Methods:
wellFounded : (x : a) ->Accessiblerelx

Implementation: 
WellFoundedNatLT
wellFounded : WellFoundedarel=> (x : a) ->Accessiblerelx
Totality: total
Visibility: public export
accRec : ((x : a) -> ((y : a) ->relyx->b) ->b) -> (z : a) -> (0_ : Accessiblerelz) ->b
  Simply-typed recursion based on accessibility.

The recursive step for an element has access to all elements smaller than
it. The recursion will therefore halt when it reaches a minimum element.

This may sometimes improve type-inference, compared to `accInd`.

Totality: total
Visibility: export
accInd : {0P : a->Type} -> ((x : a) -> ((y : a) ->relyx->Py) ->Px) -> (z : a) -> (0_ : Accessiblerelz) ->Pz
  Depedently-typed induction based on accessibility.

The recursive step for an element has access to all elements smaller than
it. The recursion will therefore halt when it reaches a minimum element.

Totality: total
Visibility: export
accIndProp : {0P : a->Type} -> (step : ((x : a) -> ((y : a) ->relyx->Py) ->Px)) -> {0RP : (x : a) ->Px->Type} -> ((x : a) -> (f : ((y : a) ->relyx->Py)) -> ((y : a) -> (isRel : relyx) ->RPy (fyisRel)) ->RPx (stepxf)) -> (z : a) -> (0acc : Accessiblerelz) ->RPz (accIndstepzacc)
  Depedently-typed induction for creating extrinsic proofs on results of `accInd`.

Totality: total
Visibility: export
wfRec : {auto0_ : WellFoundedarel} -> ((x : a) -> ((y : a) ->relyx->b) ->b) ->a->b
  Simply-typed recursion based on well-founded-ness.

This is `accRec` applied to accessibility derived from a `WellFounded`
instance.

Totality: total
Visibility: export
wfInd : {auto0_ : WellFoundedarel} -> {0P : a->Type} -> ((x : a) -> ((y : a) ->relyx->Py) ->Px) -> (myz : a) ->Pmyz
  Depedently-typed induction based on well-founded-ness.

This is `accInd` applied to accessibility derived from a `WellFounded`
instance.

Totality: total
Visibility: export
wfIndProp : {auto0{conArg:1388} : WellFoundedarel} -> {0P : a->Type} -> (step : ((x : a) -> ((y : a) ->relyx->Py) ->Px)) -> {0RP : (x : a) ->Px->Type} -> ((x : a) -> (f : ((y : a) ->relyx->Py)) -> ((y : a) -> (isRel : relyx) ->RPy (fyisRel)) ->RPx (stepxf)) -> (myz : a) ->RPmyz (wfIndstepmyz)
  Depedently-typed induction for creating extrinsic proofs on results of `wfInd`.

Totality: total
Visibility: export
interfaceSized : Type->Type
  Types that have a concept of size. The size must be a natural number.

Parameters: a
Constructor: 
MkSized

Methods:
size : a->Nat

Implementations:
SizedNat
Sized (Lista)
(Sizeda, Sizedb) =>Sized (a, b)
size : Sizeda=>a->Nat
Totality: total
Visibility: public export
Smaller : Sizeda=>a->a->Type
  A relation based on the size of the values.

Totality: total
Visibility: public export
SizeAccessible : Sizeda=>a->Type
  Values that are accessible based on their size.

Totality: total
Visibility: public export
sizeAccessible : {auto{conArg:1594} : Sizeda} -> (x : a) ->SizeAccessiblex
  Any value of a sized type is accessible, since naturals are well-founded.

Totality: total
Visibility: export
sizeInd : {auto{conArg:1659} : Sizeda} -> {0P : a->Type} -> ((x : a) -> ((y : a) ->Smalleryx->Py) ->Px) -> (z : a) ->Pz
  Depedently-typed induction based on the size of values.

This is `accInd` applied to accessibility derived from size.

Totality: total
Visibility: export
sizeRec : {auto{conArg:1720} : Sizeda} -> ((x : a) -> ((y : a) ->Smalleryx->b) ->b) ->a->b
  Simply-typed recursion based on the size of values.

This is `recInd` applied to accessibility derived from size.

Totality: total
Visibility: export