请输入您要查询的字词:

 

单词 52UniquenessOfInductiveTypes
释义

5.2 Uniqueness of inductive types


We have defined “the” natural numbersMathworldPlanetmath to be a particular type with particular inductive generatorsPlanetmathPlanetmathPlanetmathPlanetmathPlanetmath 0 and 𝗌𝗎𝖼𝖼.However, by the general principle of inductive definitions in type theoryPlanetmathPlanetmath described in the previous sectionPlanetmathPlanetmathPlanetmathPlanetmathPlanetmathPlanetmathPlanetmathPlanetmath, there is nothing preventing us from defining another type in an identical way.That is, suppose we let be the inductive type generated by the constructors

  • 0:

  • 𝗌𝗎𝖼𝖼:.

Then will have identical-looking inductionMathworldPlanetmath and recursion principles to .When proving a statement E:𝒰 for all of these “new” natural numbers, it suffices to give the proofs ez:E(0) and es:(n:)(x:E(n))E(𝗌𝗎𝖼𝖼(n)).And the function 𝗋𝖾𝖼(E,ez,es):(n:)E(n) has the following computation rules:

  • 𝗋𝖾𝖼(E,ez,es,0)ez,

  • 𝗋𝖾𝖼(E,ez,es,𝗌𝗎𝖼𝖼(n))es(n,𝗋𝖾𝖼(E,ez,es,n)) for any n:.

But what is the relationMathworldPlanetmathPlanetmath between and ?

This is not just an academic question, since structuresMathworldPlanetmath that “look like” the natural numbers can be found in many other places.For instance, we may identify natural numbers with lists over the type with one element (this is arguably the oldest appearance, found on walls of caves), with the non-negative integers, with subsets of the rationals and the reals, and so on.And from a programming point of view, the “unary” representation of our natural numbers is very inefficient, so we might prefer sometimes to use a binary one instead.We would like to be able to identify all of these versions of “the natural numbers” with each other, in order to transfer constructions and results from one to another.

Of course, if two versions of the natural numbers satisfy identical induction principles, then they have identical induced structure.For instance, recall the example of the function 𝖽𝗈𝗎𝖻𝗅𝖾 defined in §1.9 (http://planetmath.org/19thenaturalnumbers). A similar functionfor our new natural numbers is readily defined by duplication and adding primes:

𝖽𝗈𝗎𝖻𝗅𝖾:𝗋𝖾𝖼(, 0,λn.λm.𝗌𝗎𝖼𝖼(𝗌𝗎𝖼𝖼(m))).

Simple as this may seem, it has the obvious drawback of leading to aproliferation of duplicates. Not only functions have to beduplicated, but also all lemmas and their proofs. For example,an easy result such as (n:)𝖽𝗈𝗎𝖻𝗅𝖾(𝗌𝗎𝖼𝖼(n))=𝗌𝗎𝖼𝖼(𝗌𝗎𝖼𝖼(𝖽𝗈𝗎𝖻𝗅𝖾(n))), as wellas its proof by induction, also has to be “primed”.

In traditional mathematics, one just proclaims that and are obviously “the same”, and can be substituted for each other whenever the need arises.This is usually unproblematic, but it sweeps a fair amount under the rug, widening the gap between informal mathematics and its precise description.In homotopy type theory, we can do better.

First observe that we have the following definable maps:

  • f:𝗋𝖾𝖼(, 0,λn.𝗌𝗎𝖼𝖼):,

  • g:𝗋𝖾𝖼(, 0,λn.,𝗌𝗎𝖼𝖼):.

Since the compositionMathworldPlanetmath of g and f satisfies the same recurrences as the identity function on , Theorem 5.1.1 (http://planetmath.org/51introductiontoinductivetypes#Thmprethm1) gives that (n:)g(f(n))=n, and the “primed” version of the same theorem gives (n:)f(g(n))=n.Thus, f and g are quasi-inverses, so that .We can now transfer functions on directly to functions on (and vice versa) along this equivalence, e.g.

𝖽𝗈𝗎𝖻𝗅𝖾:λn.f(𝖽𝗈𝗎𝖻𝗅𝖾(g(n))).

It is an easy exercise to show that this version of 𝖽𝗈𝗎𝖻𝗅𝖾 is equal to the earlier one.

Of course, there is nothing surprising about this; such an isomorphismMathworldPlanetmathPlanetmathPlanetmathPlanetmathPlanetmathPlanetmathPlanetmath is exactly how a mathematician will envision “identifying” with .However, the mechanism of “transfer” across an isomorphism depends on the thing being transferred; it is not always as simple as pre- and post-composing a single function with f and g.Consider, for instance, a simple lemma such as

n:𝖽𝗈𝗎𝖻𝗅𝖾(𝗌𝗎𝖼𝖼(n))=𝗌𝗎𝖼𝖼(𝗌𝗎𝖼𝖼(𝖽𝗈𝗎𝖻𝗅𝖾(n))).

Inserting the correct fs and gs is only a little easier than re-proving it by induction on n: directly.

Here is where the univalence axiom steps in: since , we also have =𝒰, i.e.  and areequal as types.Now the induction principle for identityPlanetmathPlanetmathPlanetmathPlanetmath guarantees that any construction or proof relating to can automatically be transferred to in the same way.We simply consider the type of the function or theorem as a type-indexed family of types P:𝒰𝒰, with the given object being an element of P(), and transport along the path =.This involves considerably less overhead.

For simplicity, we have described this method in the case of two types and with identical-looking definitions.However, a more common situation in practice is when the definitions are not literally identical, but nevertheless one induction principle implies the other.Consider, for instance, the type of lists from a one-element type, 𝖫𝗂𝗌𝗍(𝟏), which is generated by

  • an element 𝗇𝗂𝗅:𝖫𝗂𝗌𝗍(𝟏), and

  • a function 𝖼𝗈𝗇𝗌:𝟏×𝖫𝗂𝗌𝗍(𝟏)𝖫𝗂𝗌𝗍(𝟏).

This is not identical to the definition of , and it does not give rise to an identical induction principle.The induction principle of 𝖫𝗂𝗌𝗍(𝟏) says that for any E:𝖫𝗂𝗌𝗍(𝟏)𝒰 together with recurrence data e𝗇𝗂𝗅:E(𝗇𝗂𝗅) and e𝖼𝗈𝗇𝗌:(u:𝟏)(:𝖫𝗂𝗌𝗍(𝟏))E()E(𝖼𝗈𝗇𝗌(u,)), there exists f:(:𝖫𝗂𝗌𝗍(𝟏))E() such that f(𝗇𝗂𝗅)e𝗇𝗂𝗅 and f(𝖼𝗈𝗇𝗌(u,))e𝖼𝗈𝗇𝗌(u,,f()).(We will see how to derive the induction principle of an inductive definition in §5.6 (http://planetmath.org/56thegeneralsyntaxofinductivedefinitions).)

Now suppose we define 0′′:𝗇𝗂𝗅:𝖫𝗂𝗌𝗍(𝟏), and 𝗌𝗎𝖼𝖼′′:𝖫𝗂𝗌𝗍(𝟏)𝖫𝗂𝗌𝗍(𝟏) by 𝗌𝗎𝖼𝖼′′():𝖼𝗈𝗇𝗌(,).Then for any E:𝖫𝗂𝗌𝗍(𝟏)𝒰 together with e0:E(0′′) and es:(:𝖫𝗂𝗌𝗍(𝟏))E()E(𝗌𝗎𝖼𝖼′′()), we can define

e𝗇𝗂𝗅:e0
e𝖼𝗈𝗇𝗌(,,x):es(,x).

(In the definition of e𝖼𝗈𝗇𝗌 we use the induction principle of 𝟏 to assume that u is .)Now we can apply the induction principle of 𝖫𝗂𝗌𝗍(𝟏), obtaining f:(:𝖫𝗂𝗌𝗍(𝟏))E() such that

f(0′′)f(𝗇𝗂𝗅)e𝗇𝗂𝗅e0
f(𝗌𝗎𝖼𝖼′′())f(𝖼𝗈𝗇𝗌(,))e𝖼𝗈𝗇𝗌(,,f())es(,f()).

Thus, 𝖫𝗂𝗌𝗍(𝟏) satisfies the same induction principle as , and hence (by the same arguments above) is equal to it.

Finally, these conclusionsMathworldPlanetmath are not confined to the natural numbers: they apply to any inductive type.If we have an inductively defined type W, say, and some other type W which satisfies the same induction principle as W, then it follows that WW, and hence W=W.We use the derived recursion principles for W and W to construct maps WW and WW, respectively, and then the induction principles for each to prove that both composites are equal to identities.For instance, in http://planetmath.org/node/87533Chapter 1 we saw that the coproductMathworldPlanetmath A+B could also have been defined as (x:𝟐)𝗋𝖾𝖼𝟐(𝒰,A,B,x).The latter type satisfies the same induction principle as the former; hence they are canonically equivalentMathworldPlanetmathPlanetmathPlanetmath.

This is, of course, very similar to the familiar fact in category theoryMathworldPlanetmathPlanetmathPlanetmathPlanetmath that if two objects have the same universal propertyMathworldPlanetmath, then they are equivalent.In §5.4 (http://planetmath.org/54inductivetypesareinitialalgebras) we will see that inductive types actually do have a universal property, so that this is a manifestation of that general principle.

随便看

 

数学辞典收录了18232条数学词条,基本涵盖了常用数学知识及数学英语单词词组的翻译及用法,是数学学习的有利工具。

 

Copyright © 2000-2023 Newdu.com.com All Rights Reserved
更新时间:2025/5/4 15:12:42