factorial : Integer -> Integer- Totality: total
Visibility: public export data Permutation : Nat -> Type A permutation on `n` elements. This can be used to reorder values
in a list or define actions on objects in a symmetric monoidal
category.
The permutation is stored in Lehmer code form as a list of factorial
digits.
Totality: total
Visibility: public export
Constructors:
Nil : Permutation 0 (::) : Fin (S n) -> Permutation n -> Permutation (S n)
toVect : Permutation n -> Vect n Nat- Totality: total
Visibility: public export toList : Permutation n -> List Nat- Totality: total
Visibility: public export permSeq : Permutation n -> Vect n (Fin n) Convert a permutation into its *permutation sequence*.
The output is a `Vect` of indices where the `i`-th value is the
image of `i`. The output is guaranteed to have unique elements.
Totality: total
Visibility: public exportfromPermSeq : Vect n (Fin n) -> Maybe (Permutation n) Maybe convert a permutation sequence into a permutation.
The input is a `Vect` of indices where the `i`-th value is the
image of `i`. The function will return `Nothing` if any of the
incides is repeated.
Totality: total
Visibility: public exportlehmerCode : Permutation n -> Integer Return the Lehmer code of the permutation as a machine integer.
Totality: total
Visibility: public exportfromLehmerCode : (x : Integer) -> {auto 0 _ : So ((x >= 0) && Delay (x < factorial (natToInteger n)))} -> Permutation n Compute the permutation associated with the given Lehmer code.
Totality: total
Visibility: public exportidentity : Permutation n The identity permutation on `n` elements.
Totality: total
Visibility: public exportinverse : Permutation n -> Permutation n Compute the inverse of the permutation.
Totality: total
Visibility: public exportcompose : Permutation n -> Permutation n -> Permutation n Compose two permutations into a new permutation.
Note that this uses function composition order, so that the right
permutation is applied first.
Totality: total
Visibility: public exporthoriz : Permutation m -> Permutation n -> Permutation (m + n) Horizontally compose two permutations into a larger permutation.
This corresponds to the action of the Cartesian product on
isomorphisms.
Totality: total
Visibility: public exportpermuteVect : Permutation n -> Vect n a -> Vect n a Permute the elements of the `Vect` using the permutation.
Totality: total
Visibility: public exportpermuteList : (xs : List a) -> Permutation (length xs) -> List a Permute the elements of the list using the permutation.
Totality: total
Visibility: public exportpermuteHVect : (p : Permutation n) -> All q ts -> All q (permuteVect p ts) Permute the elements of the `HVect` using the permutation.
Totality: total
Visibility: public exportpermuteHList : (p : Permutation (length ts)) -> All q ts -> All q (permuteList ts p) Permute the elements of the `HList` using the permutation.
Totality: total
Visibility: public exportpermSeqInv : (p : Permutation n) -> fromPermSeq (permSeq p) = Just p- Totality: total
Visibility: export fromPermSeqInv : (seq : Vect n (Fin n)) -> ({arg:13208} : IsJust (fromPermSeq seq)) -> permSeq (fromJust (fromPermSeq seq)) = seq- Totality: total
Visibility: export lehmerCodeBounded : (p : Permutation n) -> So ((lehmerCode p >= 0) && Delay (lehmerCode p < factorial (natToInteger n)))- Totality: total
Visibility: export lehmerCodeInv : (p : Permutation n) -> fromLehmerCode (lehmerCode p) = p- Totality: total
Visibility: export lehmerCodeId : lehmerCode identity = 0- Totality: total
Visibility: export fromLehmerCodeInv : (x : Integer) -> {auto {conArg:13286} : So ((x >= 0) && Delay (x < factorial (natToInteger n)))} -> lehmerCode (fromLehmerCode x) = x- Totality: total
Visibility: export compAssoc : (p : Permutation n) -> (q : Permutation n) -> (r : Permutation n) -> compose (compose p q) r = compose p (compose q r)- Totality: total
Visibility: export compIdLeft : (p : Permutation n) -> compose identity p = p- Totality: total
Visibility: export compIdRight : (p : Permutation n) -> compose identity p = p- Totality: total
Visibility: export compInvLeft : (p : Permutation n) -> compose (inverse p) p = identity- Totality: total
Visibility: export compInvRight : (p : Permutation n) -> compose p (inverse p) = identity- Totality: total
Visibility: export horizBothId : horiz identity identity = identity- Totality: total
Visibility: export horizComp : (p : Permutation m) -> (p' : Permutation m) -> (q : Permutation n) -> (q' : Permutation n) -> horiz (compose p p') (compose q q') = compose (horiz p q) (horiz p' q')- Totality: total
Visibility: export horizAssoc : (p : Permutation m) -> (q : Permutation n) -> (r : Permutation o) -> horiz (horiz p q) r = horiz p (horiz q r)- Totality: total
Visibility: export horizUnitl : (p : Permutation n) -> horiz [] p = p- Totality: total
Visibility: export horizUnitr : (p : Permutation n) -> horiz p [] = p- Totality: total
Visibility: export permuteVectId : (xs : Vect n a) -> permuteVect identity xs = xs- Totality: total
Visibility: export permuteVectComp : (p : Permutation n) -> (q : Permutation n) -> (xs : Vect n a) -> permuteVect (compose p q) xs = permuteVect p (permuteVect q xs)- Totality: total
Visibility: export permuteVectHoriz : (p : Permutation m) -> (xs : Vect m a) -> (q : Permutation n) -> (ys : Vect n a) -> permuteVect p xs ++ permuteVect q ys = permuteVect (horiz p q) (xs ++ ys)- Totality: total
Visibility: export permuteListId : (xs : List a) -> permuteList xs identity = xs- Totality: total
Visibility: export permuteListLength : (xs : List a) -> (p : Permutation (length xs)) -> length (permuteList xs p) = length xs- Totality: total
Visibility: export permuteListComp : (xs : List a) -> (p : Permutation (length xs)) -> (q : Permutation (length xs)) -> permuteList xs (compose p q) = permuteList (permuteList xs q) (rewrite__impl {_:13894} {_:13893} p)- Totality: total
Visibility: export