PhyslibSearch

Physlib.Mathematics.Fin

36 declarations

definition

Predecessor of xx relative to pivot ii

#predAboveI

For any nNn \in \mathbb{N}, given elements ii and xx in {0,1,,n+1}\{0, 1, \dots, n+1\} (represented by Fin(n+2)\text{Fin}(n+2)), this function returns an element in {0,1,,n}\{0, 1, \dots, n\} (represented by Fin(n+1)\text{Fin}(n+1)). The output is defined as xx if x<ix < i, and x1x - 1 if xix \geq i.

theorem

predAboveI(i,i)=i1\text{predAboveI}(i, i) = i - 1

#predAboveI_self

For any natural number nn and any element ii in the set {0,1,,n+1}\{0, 1, \dots, n+1\} (represented by Fin(n+2)\text{Fin}(n+2)), the function predAboveI\text{predAboveI} evaluated at ii with pivot ii is equal to i1i - 1, where the result is an element of Fin(n+1)\text{Fin}(n+1).

theorem

predAboveI(i,succAbove(i,x))=x\text{predAboveI}(i, \text{succAbove}(i, x)) = x

#predAboveI_succAbove

Let nn be a natural number. For any pivot i{0,1,,n+1}i \in \{0, 1, \dots, n+1\} and any element x{0,1,,n}x \in \{0, 1, \dots, n\}, applying the function predAboveI(i,)\text{predAboveI}(i, \cdot) to the value obtained from succAbove(i,x)\text{succAbove}(i, x) returns xx. Here, succAbove(i,x)\text{succAbove}(i, x) is defined as xx if x<ix < i and x+1x + 1 if xix \geq i, while predAboveI(i,y)\text{predAboveI}(i, y) is defined as yy if y<iy < i and y1y - 1 if yiy \geq i. The identity states: predAboveI(i,succAbove(i,x))=x\text{predAboveI}(i, \text{succAbove}(i, x)) = x

theorem

Fin.succAbovei(predAboveIi(x))=x\text{Fin.succAbove}_i(\text{predAboveI}_i(x)) = x for ixi \neq x

#succsAbove_predAboveI

For any natural number nn and any elements i,xFin(n+2)i, x \in \text{Fin}(n+2), if ixi \neq x, then Fin.succAbovei(predAboveIi(x))=x\text{Fin.succAbove}_i(\text{predAboveI}_i(x)) = x. Here, predAboveIi(x)\text{predAboveI}_i(x) is the function that returns xx if x<ix < i and x1x - 1 if xix \geq i. The function Fin.succAbovei(y)\text{Fin.succAbove}_i(y) is the standard map from Fin(n+1)\text{Fin}(n+1) to Fin(n+2)\text{Fin}(n+2) that "skips" the index ii, defined as yy if y<iy < i and y+1y + 1 if yiy \geq i.

theorem

y=predAboveIi(x)    succAbovei(y)=xy = \text{predAboveI}_i(x) \iff \text{succAbove}_i(y) = x for ixi \neq x

#predAboveI_eq_iff

Let nn be a natural number. For any elements i,xFin(n+2)i, x \in \text{Fin}(n+2) such that ixi \neq x, and any element yFin(n+1)y \in \text{Fin}(n+1), the following equivalence holds: y=predAboveIi(x)    succAbovei(y)=xy = \text{predAboveI}_i(x) \iff \text{succAbove}_i(y) = x where predAboveIi(x)\text{predAboveI}_i(x) returns xx if x<ix < i and x1x - 1 if xix \geq i, and succAbovei(y)\text{succAbove}_i(y) is the function from Fin(n+1)\text{Fin}(n+1) to Fin(n+2)\text{Fin}(n+2) that skips ii, defined as yy if y<iy < i and y+1y + 1 if yiy \geq i.

theorem

predAboveI(i,x)=x\text{predAboveI}(i, x) = x for x<ix < i

#predAboveI_lt

For any natural number nn, let ii and xx be elements of Fin(n+2)\text{Fin}(n+2). If the value of xx is strictly less than the value of ii (x<ix < i), then the predecessor of xx relative to the pivot ii, denoted predAboveI(i,x)\text{predAboveI}(i, x), is equal to xx as an element of Fin(n+1)\text{Fin}(n+1).

theorem

predAboveI(i,x)=x1\text{predAboveI}(i, x) = x - 1 for i<xi < x

#predAboveI_ge

For any natural number nn and any two elements i,xFin(n+2)i, x \in \text{Fin}(n+2), if i<xi < x, then the value of the predecessor of xx relative to pivot ii is predAboveI(i,x)=x1\text{predAboveI}(i, x) = x - 1, where the result is an element of Fin(n+1)\text{Fin}(n+1).

theorem

Identity for the composition of two succAbove\text{succAbove} maps via predAboveI\text{predAboveI} reindexing

#succAbove_succAbove_predAboveI

For any natural number nn, let iFin(n+2)i \in \text{Fin}(n+2), jFin(n+1)j \in \text{Fin}(n+1), and xFin(n)x \in \text{Fin}(n). The following equality holds: i.succAbove(j.succAbove(x))=(i.succAbove(j)).succAbove((predAboveI(i.succAbove(j),i)).succAbove(x))i.\text{succAbove}(j.\text{succAbove}(x)) = (i.\text{succAbove}(j)).\text{succAbove}((\text{predAboveI}(i.\text{succAbove}(j), i)).\text{succAbove}(x)) where: - For kFin(m+1)k \in \text{Fin}(m+1), the function k.succAbove:Fin(m)Fin(m+1)k.\text{succAbove} : \text{Fin}(m) \to \text{Fin}(m+1) is the embedding that "skips" the index kk, defined by k.succAbove(y)=yk.\text{succAbove}(y) = y if y<ky < k and k.succAbove(y)=y+1k.\text{succAbove}(y) = y + 1 if yky \ge k. - The function predAboveI(p,i)\text{predAboveI}(p, i) returns the predecessor of ii relative to the pivot pp, defined as ii if i<pi < p and i1i - 1 if ipi \ge p.

definition

Equivalence Fin(n+1)Fin(1)Fin(n)\text{Fin}(n+1) \simeq \text{Fin}(1) \oplus \text{Fin}(n) extracting the ii-th component

#finExtractOne

For any natural number nn and an index iFin(n+1)i \in \text{Fin}(n+1), this definition provides an equivalence (a bijection) between the finite set Fin(n+1)={0,1,,n}\text{Fin}(n+1) = \{0, 1, \dots, n\} and the disjoint union Fin(1)Fin(n)\text{Fin}(1) \oplus \text{Fin}(n). This mapping is constructed such that the specific element ii is mapped to the unique element in the left summand Fin(1)\text{Fin}(1), while all other elements jFin(n+1)j \in \text{Fin}(n+1) where jij \neq i are mapped into the right summand Fin(n)\text{Fin}(n).

theorem

The equivalence `finExtractOne i` maps ii to `Sum.inl 0`

#finExtractOne_apply_eq

Let nn be a natural number and iFin(n+1)i \in \text{Fin}(n+1). Let fi:Fin(n+1)Fin(1)Fin(n)f_i : \text{Fin}(n+1) \simeq \text{Fin}(1) \oplus \text{Fin}(n) be the equivalence that extracts the ii-th component. Then fi(i)=inl(0)f_i(i) = \text{inl}(0), where inl(0)\text{inl}(0) is the unique element of the first summand Fin(1)\text{Fin}(1).

theorem

(finExtractOne i)1inr=i.succAbove(\text{finExtractOne } i)^{-1} \circ \text{inr} = i.\text{succAbove}

#finExtractOne_symm_inr

For any natural number nn and any index iFin(n+1)i \in \text{Fin}(n+1), the composition of the inverse of the equivalence finExtractOne(i):Fin(n+1)Fin(1)Fin(n)\text{finExtractOne}(i) : \text{Fin}(n+1) \simeq \text{Fin}(1) \oplus \text{Fin}(n) with the right-side injection inr:Fin(n)Fin(1)Fin(n)\text{inr} : \text{Fin}(n) \to \text{Fin}(1) \oplus \text{Fin}(n) is equal to the function i.succAbove:Fin(n)Fin(n+1)i.\text{succAbove} : \text{Fin}(n) \to \text{Fin}(n+1), which embeds Fin(n)\text{Fin}(n) into Fin(n+1)\text{Fin}(n+1) by skipping the index ii.

theorem

(finExtractOne i)1(inr x)=i.succAbove x(\text{finExtractOne } i)^{-1}(\text{inr } x) = i.\text{succAbove } x

#finExtractOne_symm_inr_apply

Let nn be a natural number, iFin(n+1)i \in \text{Fin}(n+1) be an index, and xFin(n)x \in \text{Fin}(n) be an element. Let fi:Fin(n+1)Fin(1)Fin(n)f_i: \text{Fin}(n+1) \simeq \text{Fin}(1) \oplus \text{Fin}(n) be the equivalence defined by `finExtractOne`, which extracts the ii-th component to the left summand. Then the inverse of this equivalence applied to the element xx in the right summand is equal to i.succAbove(x)i.\text{succAbove}(x): fi1(inr x)=i.succAbove(x)f_i^{-1}(\text{inr } x) = i.\text{succAbove}(x) where i.succAbove:Fin(n)Fin(n+1)i.\text{succAbove} : \text{Fin}(n) \to \text{Fin}(n+1) is the function that embeds Fin(n)\text{Fin}(n) into Fin(n+1)\text{Fin}(n+1) by skipping the index ii.

theorem

(finExtractOne i)1(inl 0)=i(\text{finExtractOne } i)^{-1}(\text{inl } 0) = i

#finExtractOne_symm_inl_apply

For any natural number nn and any index iFin(n+1)i \in \text{Fin}(n+1), let fi:Fin(n+1)Fin(1)Fin(n)f_i : \text{Fin}(n+1) \simeq \text{Fin}(1) \oplus \text{Fin}(n) be the equivalence (bijection) defined by `finExtractOne`, which maps the element ii to the left summand. The inverse of this equivalence applied to the unique element 0Fin(1)0 \in \text{Fin}(1) in the left summand returns the original index ii: fi1(inl 0)=if_i^{-1}(\text{inl } 0) = i

theorem

finExtractOnei(j)=inr(predAboveIi(j))\text{finExtractOne}_i(j) = \text{inr}(\text{predAboveI}_i(j)) for iji \neq j

#finExtractOne_apply_neq

For any natural number nn and any two distinct elements i,jFin(n+2)i, j \in \text{Fin}(n+2), let fi:Fin(n+2)Fin(1)Fin(n+1)f_i : \text{Fin}(n+2) \simeq \text{Fin}(1) \oplus \text{Fin}(n+1) be the equivalence (bijection) that extracts the ii-th component. Then the image of jj under this equivalence is the inclusion into the right summand of the relative predecessor of jj with respect to ii: fi(j)=inr(predAboveIi(j))f_i(j) = \text{inr}(\text{predAboveI}_i(j)) where predAboveIi(j)\text{predAboveI}_i(j) is the function that returns jj if j<ij < i and j1j - 1 if j>ij > i.

definition

Induced map Fin(n+1)Fin(m+1)\text{Fin}(n+1) \to \text{Fin}(m+1) by removing ii and σ(i)\sigma(i)

#finExtractOnPermHom

For natural numbers nn and mm, given a fixed index iFin(n+2)i \in \text{Fin}(n+2) and a bijection (equivalence) σ:Fin(n+2)Fin(m+2)\sigma : \text{Fin}(n+2) \xrightarrow{\sim} \text{Fin}(m+2), this function defines a map from Fin(n+1)\text{Fin}(n+1) to Fin(m+1)\text{Fin}(m+1). For an input xFin(n+1)x \in \text{Fin}(n+1), the function identifies xx with the unique element jFin(n+2)j \in \text{Fin}(n+2) such that jij \neq i via the inverse of `finExtractOne`. It then applies the bijection to obtain σ(j)\sigma(j) and uses `predAboveI` to re-index σ(j)\sigma(j) into the set Fin(m+1)\text{Fin}(m+1) by skipping the value σ(i)\sigma(i). Effectively, this is the map between the remaining finite sets obtained by removing ii from the domain and σ(i)\sigma(i) from the codomain.

theorem

(fσ(i),σ1fi,σ)=id(f_{\sigma(i), \sigma^{-1}} \circ f_{i, \sigma}) = \text{id} for maps induced by removing indices ii and σ(i)\sigma(i)

#finExtractOnPermHom_inv

Let n,mn, m be natural numbers. For any index iFin(n+2)i \in \text{Fin}(n+2) and any bijection σ:Fin(n+2)Fin(m+2)\sigma : \text{Fin}(n+2) \simeq \text{Fin}(m+2), let fi,σ:Fin(n+1)Fin(m+1)f_{i, \sigma} : \text{Fin}(n+1) \to \text{Fin}(m+1) be the induced map obtained by removing ii from the domain and σ(i)\sigma(i) from the codomain. Then the composition of fi,σf_{i, \sigma} with the map induced by the inverse bijection σ1\sigma^{-1} (relative to the pivot σ(i)\sigma(i)) is the identity on Fin(n+1)\text{Fin}(n+1): (fσ(i),σ1fi,σ)=idFin(n+1)(f_{\sigma(i), \sigma^{-1}} \circ f_{i, \sigma}) = \text{id}_{\text{Fin}(n+1)} where fσ(i),σ1:Fin(m+1)Fin(n+1)f_{\sigma(i), \sigma^{-1}} : \text{Fin}(m+1) \to \text{Fin}(n+1) is the map obtained by removing σ(i)\sigma(i) from the domain of σ1\sigma^{-1} and ii from its codomain.

definition

Induced equivalence Fin(n+1)Fin(m+1)\text{Fin}(n+1) \simeq \text{Fin}(m+1) by removing ii and σ(i)\sigma(i)

#finExtractOnePerm

For natural numbers n,mNn, m \in \mathbb{N}, given an index iFin(n+2)i \in \text{Fin}(n+2) and a bijection (equivalence) σ:Fin(n+2)Fin(m+2)\sigma : \text{Fin}(n+2) \xrightarrow{\sim} \text{Fin}(m+2), this function defines the induced bijection between the reduced sets Fin(n+1)\text{Fin}(n+1) and Fin(m+1)\text{Fin}(m+1). It is constructed by removing the element ii from the domain and its image σ(i)\sigma(i) from the codomain. For any xFin(n+1)x \in \text{Fin}(n+1), the map identifies xx with the unique jFin(n+2)j \in \text{Fin}(n+2) such that jij \neq i (using the re-indexing map that skips ii), applies σ\sigma to obtain σ(j)\sigma(j), and then re-indexes σ(j)\sigma(j) into Fin(m+1)\text{Fin}(m+1) by skipping the value σ(i)\sigma(i).

theorem

ei.succAbove=(e(i)).succAbovefinExtractOnePermi(e)e \circ i.\text{succAbove} = (e(i)).\text{succAbove} \circ \text{finExtractOnePerm}_i(e)

#finExtractOnePerm_equiv

For natural numbers nn and mm, let e:Fin(n+2)Fin(m+2)e : \text{Fin}(n+2) \simeq \text{Fin}(m+2) be a bijection and let iFin(n+2)i \in \text{Fin}(n+2) be a fixed index. Then the following identity holds: ei.succAbove=(e(i)).succAbovefinExtractOnePermi(e)e \circ i.\text{succAbove} = (e(i)).\text{succAbove} \circ \text{finExtractOnePerm}_i(e) where i.succAbove:Fin(n+1)Fin(n+2)i.\text{succAbove} : \text{Fin}(n+1) \to \text{Fin}(n+2) is the map that embeds Fin(n+1)\text{Fin}(n+1) into Fin(n+2)\text{Fin}(n+2) by skipping the index ii, and finExtractOnePermi(e):Fin(n+1)Fin(m+1)\text{finExtractOnePerm}_i(e) : \text{Fin}(n+1) \simeq \text{Fin}(m+1) is the induced bijection obtained by removing ii from the domain and e(i)e(i) from the codomain of ee.

theorem

Explicit formula for the value of the induced permutation finExtractOnePermi(σ)(x)\text{finExtractOnePerm}_i(\sigma)(x)

#finExtractOnePerm_apply

For any natural number nn, let σ:Fin(n+2)Fin(n+2)\sigma : \text{Fin}(n+2) \simeq \text{Fin}(n+2) be a bijection and let iFin(n+2)i \in \text{Fin}(n+2) be a fixed index. The value of the induced bijection finExtractOnePermi(σ):Fin(n+1)Fin(n+1)\text{finExtractOnePerm}_i(\sigma) : \text{Fin}(n+1) \simeq \text{Fin}(n+1) (obtained by removing ii from the domain and σ(i)\sigma(i) from the codomain) at any xFin(n+1)x \in \text{Fin}(n+1) is given by the formula: finExtractOnePermi(σ)(x)=predAboveσ(i)(σ(i.succAbove(x)))\text{finExtractOnePerm}_i(\sigma)(x) = \text{predAbove}_{\sigma(i)}(\sigma(i.\text{succAbove}(x))) where: - i.succAbove:Fin(n+1)Fin(n+2)i.\text{succAbove} : \text{Fin}(n+1) \to \text{Fin}(n+2) is the map that embeds Fin(n+1)\text{Fin}(n+1) into Fin(n+2)\text{Fin}(n+2) by skipping the index ii. - predAboveσ(i):Fin(n+2)Fin(n+1)\text{predAbove}_{\sigma(i)} : \text{Fin}(n+2) \to \text{Fin}(n+1) is the function that maps yFin(n+2)y \in \text{Fin}(n+2) to yy if y<σ(i)y < \sigma(i) and to y1y-1 if y>σ(i)y > \sigma(i).

theorem

Explicit formula for the value of the inverse induced permutation finExtractOnePermi(σ)1(x)\text{finExtractOnePerm}_i(\sigma)^{-1}(x)

#finExtractOnePerm_symm_apply

For any natural number nn, let σ:Fin(n+2)Fin(n+2)\sigma : \text{Fin}(n+2) \simeq \text{Fin}(n+2) be a bijection and iFin(n+2)i \in \text{Fin}(n+2) be a fixed index. Let τ=finExtractOnePermi(σ):Fin(n+1)Fin(n+1)\tau = \text{finExtractOnePerm}_i(\sigma) : \text{Fin}(n+1) \simeq \text{Fin}(n+1) be the induced bijection obtained by removing the element ii from the domain and its image σ(i)\sigma(i) from the codomain. For any xFin(n+1)x \in \text{Fin}(n+1), the value of the inverse bijection τ1(x)\tau^{-1}(x) is given by: τ1(x)=predAbovei(σ1(σ(i).succAbove(x)))\tau^{-1}(x) = \text{predAbove}_{i}(\sigma^{-1}(\sigma(i).\text{succAbove}(x))) where: - σ(i).succAbove:Fin(n+1)Fin(n+2)\sigma(i).\text{succAbove} : \text{Fin}(n+1) \to \text{Fin}(n+2) is the map that embeds Fin(n+1)\text{Fin}(n+1) into Fin(n+2)\text{Fin}(n+2) by skipping the index σ(i)\sigma(i). - predAbovei:Fin(n+2)Fin(n+1)\text{predAbove}_{i} : \text{Fin}(n+2) \to \text{Fin}(n+1) is the function that maps yFin(n+2)y \in \text{Fin}(n+2) to yy if y<iy < i and to y1y-1 if y>iy > i. - σ1\sigma^{-1} is the inverse bijection of σ\sigma.

definition

Equivalence Fin(n+2)(Fin(1)Fin(1))Fin(n)\text{Fin}(n+2) \simeq (\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n) extracting indices ii and jj

#finExtractTwo

For any natural number nn, given indices iFin(n+2)i \in \text{Fin}(n+2) and jFin(n+1)j \in \text{Fin}(n+1), this definition provides an equivalence (a bijection) between the finite set Fin(n+2)={0,1,,n+1}\text{Fin}(n+2) = \{0, 1, \dots, n+1\} and the iterated disjoint union (Fin(1)Fin(1))Fin(n)(\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n). The mapping is constructed such that: 1. The element ii is mapped to the first summand Fin(1)\text{Fin}(1). 2. The element i.succAbove(j)i.\text{succAbove}(j) (the jj-th element of Fin(n+2)\text{Fin}(n+2) when ii is excluded) is mapped to the second summand Fin(1)\text{Fin}(1). 3. The remaining nn elements of Fin(n+2)\text{Fin}(n+2) are mapped bijectively to the summand Fin(n)\text{Fin}(n).

theorem

`finExtractTwo i j i = Sum.inl (Sum.inl 0)`

#finExtractTwo_apply_fst

For any natural number nn, an index iFin(n+2)i \in \text{Fin}(n+2), and an index jFin(n+1)j \in \text{Fin}(n+1), let fi,j:Fin(n+2)(Fin(1)Fin(1))Fin(n)f_{i,j} : \text{Fin}(n+2) \simeq (\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n) be the equivalence defined by `finExtractTwo i j` (which maps ii and the jj-th element of the remaining set to the two Fin(1)\text{Fin}(1) summands). Then the image of ii under this equivalence is inl(inl(0))\text{inl}(\text{inl}(0)), representing the unique element in the first Fin(1)\text{Fin}(1) summand.

theorem

(finExtractTwo i,j)1inr=i.succAbovej.succAbove(\text{finExtractTwo } i, j)^{-1} \circ \text{inr} = i.\text{succAbove} \circ j.\text{succAbove}

#finExtractTwo_symm_inr

For any natural number nn, let iFin(n+2)i \in \text{Fin}(n+2) and jFin(n+1)j \in \text{Fin}(n+1). Let e:Fin(n+2)(Fin(1)Fin(1))Fin(n)e : \text{Fin}(n+2) \simeq (\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n) be the equivalence (bijection) defined by `finExtractTwo i j`, which extracts the index ii and the index i.succAbove(j)i.\text{succAbove}(j). The composition of the inverse equivalence e1e^{-1} with the inclusion of the third summand inr:Fin(n)(Fin(1)Fin(1))Fin(n)\text{inr} : \text{Fin}(n) \to (\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n) is given by the composition of two skip-index functions: e1inr=i.succAbovej.succAbovee^{-1} \circ \text{inr} = i.\text{succAbove} \circ j.\text{succAbove} where k.succAbove:Fin(m)Fin(m+1)k.\text{succAbove} : \text{Fin}(m) \to \text{Fin}(m+1) is the function that embeds Fin(m)\text{Fin}(m) into Fin(m+1)\text{Fin}(m+1) by skipping the index kk.

theorem

(finExtractTwo i,j)1(inr x)=i.succAbove(j.succAbove x)(\text{finExtractTwo } i, j)^{-1}(\text{inr } x) = i.\text{succAbove}(j.\text{succAbove } x)

#finExtractTwo_symm_inr_apply

For any natural number nn, index iFin(n+2)i \in \text{Fin}(n+2), index jFin(n+1)j \in \text{Fin}(n+1), and element xFin(n)x \in \text{Fin}(n), let e:Fin(n+2)(Fin(1)Fin(1))Fin(n)e: \text{Fin}(n+2) \simeq (\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n) be the equivalence (bijection) defined by `finExtractTwo i j`, which extracts the indices ii and i.succAbove(j)i.\text{succAbove}(j). The inverse equivalence e1e^{-1} maps an element xx from the third summand Fin(n)\text{Fin}(n) back to Fin(n+2)\text{Fin}(n+2) according to the formula: e1(inr x)=i.succAbove(j.succAbove(x))e^{-1}(\text{inr } x) = i.\text{succAbove}(j.\text{succAbove}(x)) where k.succAbove:Fin(m)Fin(m+1)k.\text{succAbove} : \text{Fin}(m) \to \text{Fin}(m+1) is the function that embeds Fin(m)\text{Fin}(m) into Fin(m+1)\text{Fin}(m+1) by skipping the index kk, and inr\text{inr} denotes the inclusion into the right summand of the disjoint union.

theorem

(finExtractTwo i,j)1(inl(inr 0))=i.succAbove j(\text{finExtractTwo } i, j)^{-1}(\text{inl}(\text{inr } 0)) = i.\text{succAbove } j

#finExtractTwo_symm_inl_inr_apply

For any natural number nn, index iFin(n+2)i \in \text{Fin}(n+2), and index jFin(n+1)j \in \text{Fin}(n+1), let e:Fin(n+2)(Fin(1)Fin(1))Fin(n)e: \text{Fin}(n+2) \simeq (\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n) be the equivalence (bijection) defined by `finExtractTwo i j`, which extracts the indices ii and i.succAbove(j)i.\text{succAbove}(j). Then the inverse equivalence e1e^{-1} maps the unique element in the second Fin(1)\text{Fin}(1) summand to i.succAbove(j)i.\text{succAbove}(j). Specifically, e1(inl(inr 0))=i.succAbove(j)e^{-1}(\text{inl}(\text{inr } 0)) = i.\text{succAbove}(j) where inl(inr 0)\text{inl}(\text{inr } 0) represents the unique element of the second summand in the disjoint union and i.succAbove:Fin(n+1)Fin(n+2)i.\text{succAbove} : \text{Fin}(n+1) \to \text{Fin}(n+2) is the function that embeds Fin(n+1)\text{Fin}(n+1) into Fin(n+2)\text{Fin}(n+2) by skipping the index ii.

theorem

The inverse of `finExtractTwo i j` maps the first summand to ii

#finExtractTwo_symm_inl_inl_apply

For any natural number nn, index iFin(n+2)i \in \text{Fin}(n+2), and index jFin(n+1)j \in \text{Fin}(n+1), let e:Fin(n+2)(Fin(1)Fin(1))Fin(n)e: \text{Fin}(n+2) \simeq (\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n) be the equivalence (bijection) defined by `finExtractTwo i j`. Then the inverse equivalence e1e^{-1} maps the element in the first Fin(1)\text{Fin}(1) summand to ii. Specifically, e1(inl(inl(0)))=ie^{-1}(\text{inl}(\text{inl}(0))) = i, where inl(inl(0))\text{inl}(\text{inl}(0)) represents the unique element of the first summand of the disjoint union.

theorem

finExtractTwo(i,j)(i.succAbove j)=inl(inr 0)\text{finExtractTwo}(i, j)(i.\text{succAbove } j) = \text{inl}(\text{inr } 0)

#finExtractTwo_apply_snd

For any natural number nn, index iFin(n+2)i \in \text{Fin}(n+2), and index jFin(n+1)j \in \text{Fin}(n+1), let e:Fin(n+2)(Fin(1)Fin(1))Fin(n)e: \text{Fin}(n+2) \simeq (\text{Fin}(1) \oplus \text{Fin}(1)) \oplus \text{Fin}(n) be the equivalence defined by `finExtractTwo i j`. Then applying ee to the element i.succAbove(j)i.\text{succAbove}(j) yields inl(inr 0)\text{inl}(\text{inr } 0), which represents the unique element of the second Fin(1)\text{Fin}(1) summand in the disjoint union.

theorem

The equivalence constructed from inverse functions f1f_1 and f2f_2 evaluates to f1f_1

#finMapToEquiv_apply

Let n,mn, m be natural numbers. Suppose f1:Fin(n)Fin(m)f_1 : \text{Fin}(n) \to \text{Fin}(m) and f2:Fin(m)Fin(n)f_2 : \text{Fin}(m) \to \text{Fin}(n) are functions such that f1f_1 and f2f_2 are inverses of each other (i.e., f1(f2(y))=yf_1(f_2(y)) = y for all yFin(m)y \in \text{Fin}(m) and f2(f1(x))=xf_2(f_1(x)) = x for all xFin(n)x \in \text{Fin}(n)). Let ee be the equivalence between Fin(n)\text{Fin}(n) and Fin(m)\text{Fin}(m) constructed from these maps. Then for any xFin(n)x \in \text{Fin}(n), the value of e(x)e(x) is equal to f1(x)f_1(x).

theorem

The inverse of the equivalence induced by inverse functions f1f_1 and f2f_2 is f2f_2

#finMapToEquiv_symm_apply

Let n,mn, m be natural numbers. Suppose f1:Fin(n)Fin(m)f_1: \text{Fin}(n) \to \text{Fin}(m) and f2:Fin(m)Fin(n)f_2: \text{Fin}(m) \to \text{Fin}(n) are functions such that f1(f2(x))=xf_1(f_2(x)) = x for all xFin(m)x \in \text{Fin}(m) and f2(f1(x))=xf_2(f_1(x)) = x for all xFin(n)x \in \text{Fin}(n). Let ee be the equivalence (bijection) between Fin(n)\text{Fin}(n) and Fin(m)\text{Fin}(m) constructed from these functions. Then, for any xFin(m)x \in \text{Fin}(m), the inverse of the equivalence applied to xx is equal to f2(x)f_2(x). (Here, Fin(k)\text{Fin}(k) denotes the set of natural numbers {0,1,,k1}\{0, 1, \dots, k-1\}).

theorem

The inverse of `finMapToEquiv f1 f2` equals `finMapToEquiv f2 f1`

#finMapToEquiv_symm_eq

Let n,mNn, m \in \mathbb{N}. Suppose we have functions f1:Fin(n)Fin(m)f_1: \text{Fin}(n) \to \text{Fin}(m) and f2:Fin(m)Fin(n)f_2: \text{Fin}(m) \to \text{Fin}(n) such that f1f_1 and f2f_2 are inverses of each other, i.e., f1(f2(x))=xf_1(f_2(x)) = x for all xFin(m)x \in \text{Fin}(m) and f2(f1(x))=xf_2(f_1(x)) = x for all xFin(n)x \in \text{Fin}(n). Then the inverse (symmetry) of the equivalence finMapToEquiv(f1,f2,h,h)\text{finMapToEquiv}(f_1, f_2, h, h') constructed from these functions is equal to the equivalence finMapToEquiv(f2,f1,h,h)\text{finMapToEquiv}(f_2, f_1, h', h) constructed by swapping the roles of f1f_1 and f2f_2.

definition

Extension of an equivalence e:Fin(n)Fin(m)e: \text{Fin}(n) \simeq \text{Fin}(m) to Fin(n+1)Fin(m+1)\text{Fin}(n+1) \simeq \text{Fin}(m+1)

#equivCons

Given an equivalence e:Fin(n)Fin(m)e : \text{Fin}(n) \simeq \text{Fin}(m) between the sets of natural numbers {0,,n1}\{0, \dots, n-1\} and {0,,m1}\{0, \dots, m-1\}, this definition constructs an induced equivalence e:Fin(n+1)Fin(m+1)e' : \text{Fin}(n+1) \simeq \text{Fin}(m+1). The mapping ee' is defined such that e(0)=0e'(0) = 0, and for any i{0,,n1}i \in \{0, \dots, n-1\}, e(i+1)=e(i)+1e'(i+1) = e(i) + 1. Its inverse is defined analogously using the inverse of ee.

theorem

equivCons(e)(0)=0\text{equivCons}(e)(0) = 0

#equivCons_zero

Let nn and mm be natural numbers and let e:Fin(n)Fin(m)e : \text{Fin}(n) \simeq \text{Fin}(m) be an equivalence between the sets {0,,n1}\{0, \dots, n-1\} and {0,,m1}\{0, \dots, m-1\}. Let equivCons(e):Fin(n+1)Fin(m+1)\text{equivCons}(e) : \text{Fin}(n+1) \simeq \text{Fin}(m+1) be the extended equivalence. Then the image of 00 under equivCons(e)\text{equivCons}(e) is 00.

theorem

`equivCons` commutes with composition of equivalences

#equivCons_trans

For any natural numbers n,m,kn, m, k and any equivalences e:Fin(n)Fin(m)e : \text{Fin}(n) \simeq \text{Fin}(m) and f:Fin(m)Fin(k)f : \text{Fin}(m) \simeq \text{Fin}(k), the extension of their composition to Fin(n+1)Fin(k+1)\text{Fin}(n+1) \simeq \text{Fin}(k+1) via `equivCons` is equal to the composition of their individual extensions. That is, equivCons(fe)=equivCons(f)equivCons(e)\text{equivCons}(f \circ e) = \text{equivCons}(f) \circ \text{equivCons}(e).

theorem

The extension of a cast equivalence via `equivCons` is the cast equivalence of the successors

#equivCons_castOrderIso

For any natural numbers nn and mm such that n=mn = m, let e:Fin(n)Fin(m)e : \text{Fin}(n) \simeq \text{Fin}(m) be the canonical order-preserving equivalence (cast) between the sets of natural numbers Fin(n)={0,,n1}\text{Fin}(n) = \{0, \dots, n-1\} and Fin(m)={0,,m1}\text{Fin}(m) = \{0, \dots, m-1\}. Then the extension of this equivalence to the successor sets, equivCons(e):Fin(n+1)Fin(m+1)\text{equivCons}(e) : \text{Fin}(n+1) \simeq \text{Fin}(m+1)—defined by mapping 00 to 00 and i+1i+1 to e(i)+1e(i)+1—is equal to the canonical order-preserving equivalence between Fin(n+1)\text{Fin}(n+1) and Fin(m+1)\text{Fin}(m+1).

theorem

(equivCons e)1(i+1)=e1(i)+1(\text{equivCons } e)^{-1}(i+1) = e^{-1}(i) + 1

#equivCons_symm_succ

Let nn and mm be natural numbers and let e:Fin nFin me : \text{Fin } n \simeq \text{Fin } m be an equivalence between the sets of natural numbers {0,,n1}\{0, \dots, n-1\} and {0,,m1}\{0, \dots, m-1\}. Let E:Fin(n+1)Fin(m+1)E : \text{Fin}(n+1) \simeq \text{Fin}(m+1) be the induced equivalence (defined as `equivCons e`) such that E(0)=0E(0) = 0 and E(j+1)=e(j)+1E(j+1) = e(j) + 1 for all j<nj < n. Then for any i<mi < m, the inverse of this extended equivalence satisfies E1(i+1)=e1(i)+1E^{-1}(i+1) = e^{-1}(i) + 1.

theorem

e(i+1)=e(i)+1e'(i+1) = e(i) + 1 for the extended equivalence ee' induced by ee

#equivCons_succ

Let n,mNn, m \in \mathbb{N} and let e:Fin(n)Fin(m)e: \text{Fin}(n) \simeq \text{Fin}(m) be an equivalence between the sets {0,,n1}\{0, \dots, n-1\} and {0,,m1}\{0, \dots, m-1\}. Let e:Fin(n+1)Fin(m+1)e': \text{Fin}(n+1) \simeq \text{Fin}(m+1) be the extended equivalence constructed by `Fin.equivCons`, which maps 00 to 00 and increments the image of all other elements by 11. For any natural number ii such that i+1<n+1i+1 < n+1, the value of ee' at i+1i+1 is given by e(i+1)=e(i)+1e'(i+1) = e(i) + 1.