CINXE.COM
Editing rational number in nLab
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Editing rational number in nLab </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="robots" content="noindex,nofollow" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link href="/stylesheets/instiki.css?1676280126" media="all" rel="stylesheet" type="text/css" /> <link href="/stylesheets/mathematics.css?1660229990" media="all" rel="stylesheet" type="text/css" /> <link href="/stylesheets/syntax.css?1660229990" media="all" rel="stylesheet" type="text/css" /> <link href="/stylesheets/nlab.css?1676280126" media="all" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/dreampulse/computer-modern-web-font@master/fonts.css"/> <style type="text/css"> h1#pageName, div.info, .newWikiWord a, a.existingWikiWord, .newWikiWord a:hover, [actiontype="toggle"]:hover, #TextileHelp h3 { color: #226622; } a:visited.existingWikiWord { color: #164416; } </style> <style type="text/css"><!--/*--><![CDATA[/*><!--*/ .toc ul {margin: 0; padding: 0;} .toc ul ul {margin: 0; padding: 0 0 0 10px;} .toc li > p {margin: 0} .toc ul li {list-style-type: none; position: relative;} .toc div {border-top:1px dotted #ccc;} .rightHandSide h2 {font-size: 1.5em;color:#008B26} table.plaintable { border-collapse:collapse; margin-left:30px; border:0; } .plaintable td {border:1px solid #000; padding: 3px;} .plaintable th {padding: 3px;} .plaintable caption { font-weight: bold; font-size:1.1em; text-align:center; margin-left:30px; } /* Query boxes for questioning and answering mechanism */ div.query{ background: #f6fff3; border: solid #ce9; border-width: 2px 1px; padding: 0 1em; margin: 0 1em; max-height: 20em; overflow: auto; } /* Standout boxes for putting important text */ div.standout{ background: #fff1f1; border: solid black; border-width: 2px 1px; padding: 0 1em; margin: 0 1em; overflow: auto; } /* Icon for links to n-category arXiv documents (commented out for now i.e. disabled) a[href*="http://arxiv.org/"] { background-image: url(../files/arXiv_icon.gif); background-repeat: no-repeat; background-position: right bottom; padding-right: 22px; } */ /* Icon for links to n-category cafe posts (disabled) a[href*="http://golem.ph.utexas.edu/category"] { background-image: url(../files/n-cafe_5.gif); background-repeat: no-repeat; background-position: right bottom; padding-right: 25px; } */ /* Icon for links to pdf files (disabled) a[href$=".pdf"] { background-image: url(../files/pdficon_small.gif); background-repeat: no-repeat; background-position: right bottom; padding-right: 25px; } */ /* Icon for links to pages, etc. -inside- pdf files (disabled) a[href*=".pdf#"] { background-image: url(../files/pdf_entry.gif); background-repeat: no-repeat; background-position: right bottom; padding-right: 25px; } */ a.existingWikiWord { color: #226622; } a.existingWikiWord:visited { color: #226622; } a.existingWikiWord[title] { border: 0px; color: #aa0505; text-decoration: none; } a.existingWikiWord[title]:visited { border: 0px; color: #551111; text-decoration: none; } a[href^="http://"] { border: 0px; color: #003399; } a[href^="http://"]:visited { border: 0px; color: #330066; } a[href^="https://"] { border: 0px; color: #003399; } a[href^="https://"]:visited { border: 0px; color: #330066; } div.dropDown .hide { display: none; } div.dropDown:hover .hide { display:block; } div.clickDown .hide { display: none; } div.clickDown:focus { outline:none; } div.clickDown:focus .hide, div.clickDown:hover .hide { display: block; } div.clickDown .clickToReveal, div.clickDown:focus .clickToHide { display:block; } div.clickDown:focus .clickToReveal, div.clickDown .clickToHide { display:none; } div.clickDown .clickToReveal:after { content: "A(Hover to reveal, click to "hold")"; font-size: 60%; } div.clickDown .clickToHide:after { content: "A(Click to hide)"; font-size: 60%; } div.clickDown .clickToHide, div.clickDown .clickToReveal { white-space: pre-wrap; } .un_theorem, .num_theorem, .un_lemma, .num_lemma, .un_prop, .num_prop, .un_cor, .num_cor, .un_defn, .num_defn, .un_example, .num_example, .un_note, .num_note, .un_remark, .num_remark { margin-left: 1em; } span.theorem_label { margin-left: -1em; } .proof span.theorem_label { margin-left: 0em; } :target { background-color: #BBBBBB; border-radius: 5pt; } /*]]>*/--></style> <script src="/javascripts/prototype.js?1660229990" type="text/javascript"></script> <script src="/javascripts/effects.js?1660229990" type="text/javascript"></script> <script src="/javascripts/dragdrop.js?1660229990" type="text/javascript"></script> <script src="/javascripts/controls.js?1660229990" type="text/javascript"></script> <script src="/javascripts/application.js?1660229990" type="text/javascript"></script> <script src="/javascripts/page_helper.js?1660229990" type="text/javascript"></script> <script src="/javascripts/thm_numbering.js?1660229990" type="text/javascript"></script> <script type="text/x-mathjax-config"> <!--//--><![CDATA[//><!-- MathJax.Ajax.config.path["Contrib"] = "/MathJax"; MathJax.Hub.Config({ MathML: { useMathMLspacing: true }, "HTML-CSS": { scale: 90, extensions: ["handle-floats.js"] } }); MathJax.Hub.Queue( function () { var fos = document.getElementsByTagName('foreignObject'); for (var i = 0; i < fos.length; i++) { MathJax.Hub.Typeset(fos[i]); } }); //--><!]]> </script> <script type="text/javascript"> <!--//--><![CDATA[//><!-- window.addEventListener("DOMContentLoaded", function () { var div = document.createElement('div'); var math = document.createElementNS('http://www.w3.org/1998/Math/MathML', 'math'); document.body.appendChild(div); div.appendChild(math); // Test for MathML support comparable to WebKit version https://trac.webkit.org/changeset/203640 or higher. div.setAttribute('style', 'font-style: italic'); var mathml_unsupported = !(window.getComputedStyle(div.firstChild).getPropertyValue('font-style') === 'normal'); div.parentNode.removeChild(div); if (mathml_unsupported) { // MathML does not seem to be supported... var s = document.createElement('script'); s.src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=MML_HTMLorMML-full"; document.querySelector('head').appendChild(s); } else { document.head.insertAdjacentHTML("beforeend", '<style>svg[viewBox] {max-width: 100%}</style>'); } }); //--><!]]> </script> <link href="https://ncatlab.org/nlab/atom_with_headlines" rel="alternate" title="Atom with headlines" type="application/atom+xml" /> <link href="https://ncatlab.org/nlab/atom_with_content" rel="alternate" title="Atom with full content" type="application/atom+xml" /> <script type="text/javascript"> document.observe("dom:loaded", function() { generateThmNumbers(); }); </script> </head> <body> <div id="Container"> <div id="Content"> <h1 id="pageName"> <span style="float: left; margin: 0.5em 0.25em -0.25em 0"> <svg xmlns="http://www.w3.org/2000/svg" width="1.872em" height="1.8em" viewBox="0 0 190 181"> <path fill="#226622" d="M72.8 145c-1.6 17.3-15.7 10-23.6 20.2-5.6 7.3 4.8 15 11.4 15 11.5-.2 19-13.4 26.4-20.3 3.3-3 8.2-4 11.2-7.2a14 14 0 0 0 2.9-11.1c-1.4-9.6-12.4-18.6-16.9-27.2-5-9.6-10.7-27.4-24.1-27.7-17.4-.3-.4 26 4.7 30.7 2.4 2.3 5.4 4.1 7.3 6.9 1.6 2.3 2.1 5.8-1 7.2-5.9 2.6-12.4-6.3-15.5-10-8.8-10.6-15.5-23-26.2-31.8-5.2-4.3-11.8-8-18-3.7-7.3 4.9-4.2 12.9.2 18.5a81 81 0 0 0 30.7 23c3.3 1.5 12.8 5.6 10 10.7-2.5 5.2-11.7 3-15.6 1.1-8.4-3.8-24.3-21.3-34.4-13.7-3.5 2.6-2.3 7.6-1.2 11.1 2.8 9 12.2 17.2 20.9 20.5 17.3 6.7 34.3-8 50.8-12.1z"/> <path fill="#a41e32" d="M145.9 121.3c-.2-7.5 0-19.6-4.5-26-5.4-7.5-12.9-1-14.1 5.8-1.4 7.8 2.7 14.1 4.8 21.3 3.4 12 5.8 29-.8 40.1-3.6-6.7-5.2-13-7-20.4-2.1-8.2-12.8-13.2-15.1-1.9-2 9.7 9 21.2 12 30.1 1.2 4 2 8.8 6.4 10.3 6.9 2.3 13.3-4.7 17.7-8.8 12.2-11.5 36.6-20.7 43.4-36.4 6.7-15.7-13.7-14-21.3-7.2-9.1 8-11.9 20.5-23.6 25.1 7.5-23.7 31.8-37.6 38.4-61.4 2-7.3-.8-29.6-13-19.8-14.5 11.6-6.6 37.6-23.3 49.2z"/> <path fill="#193c78" d="M86.3 47.5c0-13-10.2-27.6-5.8-40.4 2.8-8.4 14.1-10.1 17-1 3.8 11.6-.3 26.3-1.8 38 11.7-.7 10.5-16 14.8-24.3 2.1-4.2 5.7-9.1 11-6.7 6 2.7 7.4 9.2 6.6 15.1-2.2 14-12.2 18.8-22.4 27-3.4 2.7-8 6.6-5.9 11.6 2 4.4 7 4.5 10.7 2.8 7.4-3.3 13.4-16.5 21.7-16 14.6.7 12 21.9.9 26.2-5 1.9-10.2 2.3-15.2 3.9-5.8 1.8-9.4 8.7-15.7 8.9-6.1.1-9-6.9-14.3-9-14.4-6-33.3-2-44.7-14.7-3.7-4.2-9.6-12-4.9-17.4 9.3-10.7 28 7.2 35.7 12 2 1.1 11 6.9 11.4 1.1.4-5.2-10-8.2-13.5-10-11.1-5.2-30-15.3-35-27.3-2.5-6 2.8-13.8 9.4-13.6 6.9.2 13.4 7 17.5 12C70.9 34 75 43.8 86.3 47.4z"/> </svg> </span> <span class="webName">nLab</span> Editing rational number </h1> <div id="MarkupHelp"> <h3 style="font-size: 1.1em; font-style: normal; text-align: center">Syntax tips</h3> <ol style="margin-left: 0em; padding-left: 0em"> <li style="font-size: 0.8em">The basic syntax is <a href="https://www.markdownguide.org/cheat-sheet/">extended Markdown</a>. </li> <li style="font-size: 0.8em">Links to other nLab pages should be made by surrounding the name of the page in double square brackets: [[ name of page ]]. To link to an nLab page but show a different link text, do the following: [[ name of page | link text to show ]].</li> <li style="font-size: 0.8em">LaTeX can be used inside single dollar signs (inline) or double dollar signs or \[ and \], as usual. </li> <li style="font-size: 0.8em">To create a table of contents, add \tableofcontents on its own line.</li> <li style="font-size: 0.8em">For a theorem or proof, use \begin{theorem} \end{theorem} as you would in LaTeX. Labelling and referencing is exactly as in LaTeX, with use of \label and \ref. The full list of supported environments can be found in the <a href="/nlab/show/HowTo#DefinitionTheoremProofEnvironments">HowTo</a>. </li> <li style="font-size: 0.8em">Tikz can be used for figures almost exactly as in LaTeX. Similarly, tikz-cd and xymatrix can be used for commutative diagrams. See the <a href="/nlab/show/HowTo#diagrams">HowTo</a>.</li> <li style="font-size: 0.8em">As an alternative to the Markdown syntax for sections (headings), one can use the usual LaTeX syntax \section, \subsection, etc.</li> <li style="font-size: 0.8em">For further help, see the <a href="/nlab/show/HowTo">HowTo</a>, or you are very welcome to ask at the <a href="https://nforum.ncatlab.org/">nForum</a>.</li> </ol> </div> <form accept-charset="utf-8" action="/nlab/save/rational+number" id="editForm" method="post"> <div style="display: none;"> <input name="see_if_human" id="see_if_human" style="tabindex: -1; autocomplete: off"/> </div> <div> <textarea name="content" id="content" style="height: 45em; width: 70%;"> +-- {: .rightHandSide} +-- {: .toc .clickDown tabindex="0"} ###Context### #### Arithmetic +--{: .hide} [[!include arithmetic geometry - contents]] =-- #### Algebra +--{: .hide} [[!include higher algebra - contents]] =-- =-- =-- # Rational numbers * table of contents {: toc} ## Definition A _rational number_ is a [[fraction]] of two [[integer]] [[numbers]]. ### As a field The [[field]] of **rational numbers**, $\mathbb{Q}$, is the [[field of fractions]] of the [[commutative ring]] of [[integers]], $\mathbb{Z}$, hence the field consisting of formal [[fractions]] ("[[ratios]]") of [[integers]]. ### As a commutative ring Let $(\mathbb{N}^+,1:\mathbb{N}^+,s:\mathbb{N}^+\to \mathbb{N}^+)$ be the set of positive integers. The positive integers are embedded into every [[commutative ring]] $R$: there is an injection $inj:\mathbb{N}^+\to\R$ such that $inj(1) = 1$ and $inj(s(n)) = inj(n) + 1$ for all $n:\mathbb{N}^+$. Suppose $R$ has an injection $inv:\mathbb{N}^+\to\R$ such that $inj(n) \cdot inv(n) = 1$ and $\inv(n) \cdot \inj(n) = 1$ for all $n:\mathbb{N}^+$. Then $R$ is called a __[[commutative algebra|$\mathbb{Q}$-algebra]]__, and the commutative ring of __rational numbers__ $\mathbb{Q}$ is the [[initial object|initial]] commutative $\mathbb{Q}$-algebra. It can then be proven from the ring axioms and the properties of the integers that every rational number apart from zero and has a multiplicative inverse, making $\mathbb{Q}$ a field. ### As an sequential colimit in CRing Let $\mathbb{Z}[1/n!]$ be the [[localization of a commutative ring|localization]] of the [[integers]] $\mathbb{Z}$ [[localisation of a commutative ring away from an element|away from]] the [[factorial]] $n!$, and for each $i \in \mathbb{N}$, there is a unique commutative [[ring homomorphism]] $h_{i}:\mathbb{Z}[1/i!]\to\mathbb{Z}[1/(i + 1)!]$ defined by the [[universal property]] of localisation of $\mathbb{Z}[1/i!]$ away from $i + 1$. Then the commutative ring of __rational numbers__ $\mathbb{Q}$ is the [[sequential colimit]] of the [[diagram]] $$\mathbb{Z}[1/0!] \overset{h_0}\to \mathbb{Z}[1/1!] \overset{h_1}\to \mathbb{Z}[1/2!] \overset{h_2}\to \ldots$$ ### As an abelian group Let $(\mathbb{N}^+,1:\mathbb{N}^+,s:\mathbb{N}^+\to \mathbb{N}^+)$ be the set of positive integers and let $(\mathbb{Z},0,+,-,1)$ be the [[free abelian group]] on the set ${1}$. Let $A$ be an [[abelian group]] containing $\mathbb{Z}$ as an abelian subgroup. The positive integers are embedded into the [[function algebra|function abelian group]] $A \to A$, with $id_A:A \to A$ being the [[identity function]] on $A$; i.e. there is an injection $inj:\mathbb{N}^+\to (A \to A)$ such that $inj(1) = id_A$ and $inj(s(n)) = inj(n) + id_A$ for all $n:\mathbb{N}^+$. Suppose $A$ has an injection $inv:\mathbb{N}^+\to (A \to A)$ such that for all $n:\mathbb{N}^+$, $inj(n) \circ inv(n) = id_A$ and $inv(n) \circ inj(n) = id_A$. Then the abelian group of __rational numbers__ $\mathbb{Q}$ is the [[initial object|initial]] such abelian group. ### As an initial object in a category Let $\mathbb{Z}$ be the [[integers]] and let $$\mathbb{Z}_{#0} \coloneqq \{a \in \mathbb{Z} \vert a \lt 0 \vee 0 \lt a \}$$ be the set of integers apart from zero. For lack of a better name, let us define a *set with rational numbers* to be a set $A$ with a function $\iota \in \mathbb{Z} \times \mathbb{Z}_{#0} \to A$ with domain the Cartesian product $\mathbb{Z} \times \mathbb{Z}_{#0}$ and codomain $A$, such that $$\forall a \in \mathbb{Z}. \forall b \in \mathbb{Z}_{#0}. \forall c \in \mathbb{Z}. \forall d \in \mathbb{Z}_{#0}. (a \cdot d = c \cdot b) \implies (\iota(a, b) = \iota(c, d))$$ A *homomorphism of sets with rational numbers* between two sets with rational numbers $A$ and $B$ is a function $f \in B^A$ such that $$\forall a \in \mathbb{Z}. \forall b \in \mathbb{Z}_{#0}. f(\iota_A(a, b)) = \iota_B(a, b)$$ The *category of sets with rational numbers* is the category $SwRN$ whose objects $Ob(SwRN)$ are sets with rational numbers and whose morphisms $Mor(A,B)$ for sets with rational numbers $A \in Ob(SwDF)$, $B \in Ob(SwRN)$ are homomorphisms of sets with rational numbers. The set of **rational numbers**, denoted $\mathbb{Q}$, is defined as the initial object in the category of sets with rational numbers. ### In dependent type theory In [[dependent type theory]], there are multiple different definitions of the type of rational numbers. #### As a dependent sum type Let $\mathbb{Z}$ be the [[integers]], let $$\mathbb{Z}_{\neq 0} \coloneqq \sum_{a:\mathbb{Z}} \max(a,-a) \gt 0$$ be the non-zero integers, and let $\gcd:\mathbb{Z} \times \mathbb{Z} \to \mathbb{Z}$ be the [[greatest common divisor]] on the integers. Then the rational numbers is defined as the type of pairs of integers and non-zero integers such that the greatest common divisor is equal to one: $$\mathbb{Q} \coloneqq \sum_{x:\mathbb{Z}} \sum_{y:\mathbb{Z}_{\neq 0}} \gcd(x, \pi_1(y)) =_\mathbb{Z} 1$$ We define the function $(-)/(-) : \mathbb{Z} \times \mathbb{Z}_{\neq 0} \rightarrow \mathbb{Q}$ for all integers $a:\mathbb{Z}$ and non-zero integers $b:\mathbb{Z}_{\neq 0}$ by $$a/b \coloneqq (a \div \gcd(a, \pi_1(b)), \pi_1(b) \div \gcd(a, \pi_1(b)), p(a, b))$$ where $p(a, b)$ is the witness that the greatest common divisor of $a \div \gcd(a, \pi_1(b))$ and $\pi_1(b) \div \gcd(a, \pi_1(b))$ is equal to 1, and $a \div b$ is [[integer]] [[division]], since integers are an [[Euclidean domain]] and thus have a division and remainder operation. #### As a higher inductive type In [[homotopy type theory]], the type of **rational numbers**, denoted $\mathbb{Q}$, is defined ([UBP13, §11.1](#UBP13)) as the [[higher inductive type]] generated by: * A function $(-)/(-) : \mathbb{Z} \times \mathbb{Z}_{\neq 0} \rightarrow \mathbb{Q}$, where $$\mathbb{Z}_{\neq 0} \coloneqq \sum_{a:\mathbb{Z}} \max(a,-a) \gt 0$$ * A dependent product of functions between identities representing that equivalent fractions are equal: $$equivfrac : \prod_{a:\mathbb{Z}} \prod_{b:\mathbb{Z}_{\neq 0}} \prod_{c:\mathbb{Z}} \prod_{d:\mathbb{Z}_{\neq 0}} (a \cdot \pi_1(d) = c \cdot \pi_1(b)) \to (a/b = c/d)\,,$$ * A set-truncator $$\tau_0: \prod_{a:\mathbb{Q}} \prod_{b:\mathbb{Q}} isProp(a=b)$$ ## Properties Let $i$ be the inclusion of the non-zero integers into the integers. ### Commutative ring structure on the rational numbers ### +--{: .num_defn} ###### Definition The rational number **zero** $0 \in \mathbb{Q}$ is defined as $$0 \coloneqq 0/1$$ =-- +--{: .num_defn} ###### Definition The binary operation **addition** $(-)+(-):\mathbb{Q} \times \mathbb{Q} \to \mathbb{Q}$ is defined as $$a/b + c/d \coloneqq (a \cdot i(d) + c \cdot i(b))/(b \cdot d)$$ for $a \ in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$, $c \in \mathbb{Z}$, $d \in \mathbb{Z}_{#0}$. =-- +--{: .num_prop} ###### Proposition For any $q \in \mathbb{Q}$ and $r \in \mathbb{Q}$, $q + r = r + q$. =-- +--{: .proof} ###### Proof TODO =-- +--{: .num_defn} ###### Definition The unary operation **negation** $-(-):\mathbb{Q} \to \mathbb{Q}$ is defined as $$-(a/b) \coloneqq (-a)/b$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$ =-- +--{: .num_defn} ###### Definition The binary operation **subtraction** $(-)-(-):\mathbb{Q} \times \mathbb{Q} \to \mathbb{Q}$ is defined as $$a/b - c/d \coloneqq (a \cdot i(d) - c \cdot i(b))/(b \cdot d)$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$, $c \in \mathbb{Z}$, $d \in \mathbb{Z}_{#0}$ =-- +--{: .num_defn} ###### Definition The rational number **one** $1 \in \mathbb{Q}$ is defined as $$1 \coloneqq 1/1$$ =-- +--{: .num_defn} ###### Definition The binary operation **multiplication** $(-)\cdot(-):\mathbb{Q} \times \mathbb{Q} \to \mathbb{Q}$ is defined as $$a/b \cdot c/d \coloneqq (a \cdot c)/(b \cdot d)$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$, $c \in \mathbb{Z}$, $d \in \mathbb{Z}_{#0}$ =-- +--{: .num_defn} ###### Definition The right $\mathbb{N}$-action **exponentiation** $(-)^{(-)}:\mathbb{Q} \times \mathbb{N} \to \mathbb{Q}$ is defined as $$(a/b)^n \coloneqq (a^n)/(b^n)$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$, $n \in \mathbb{N}$. =-- This makes the rational numbers into a commutative ring. ### Order structure on the rational numbers ### +--{: .num_defn} ###### Definition The [[predicate]] *is positive*, denoted as $isPositive(a/b)$, is defined as $$isPositive(a/b) \coloneqq (a \gt 0) \wedge (i(b) \gt 0) \vee (a \lt 0) \wedge (i(b) \lt 0)$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$. =-- +--{: .num_defn} ###### Definition The [[predicate]] *is negative*, denoted as $isNegative(a/b)$, is defined as $$isNegative(a/b) \coloneqq (a \gt 0) \wedge (i(b) \lt 0) \vee (a \lt 0) \wedge (i(b) \gt 0)$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$. =-- +--{: .num_defn} ###### Definition The [[predicate]] *is zero*, denoted as $isZero(a/b)$, is defined as $$isZero(a/b) \coloneqq a = 0$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$. =-- +--{: .num_defn} ###### Definition The [[predicate]] *is non-positive*, denoted as $isNonPositive(a/b)$ is defined as $$isNonPositive(a/b) \coloneqq \neg isPositive(a/b)$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$. =-- +--{: .num_defn} ###### Definition The [[predicate]] *is non-negative*, denoted as $isNonNegative(a/b)$, is defined as $$isNonNegative(a/b) \coloneqq \neg isNegative(a/b) $$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$. =-- +--{: .num_defn} ###### Definition The [[predicate]] *is non-zero*, denoted as $isNonZero(a/b)$, is defined as $$isNonZero(a/b) \coloneqq isPositive(a/b) \vee isNegative(a/b)$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$. =-- +--{: .num_defn} ###### Definition The [[relation]] *is less than*, denoted as $p \lt q$, is defined as $p \lt q \coloneqq isPositive(q - p)$ for $p:\mathbb{Q}$, $q:\mathbb{Q}$. =-- +--{: .num_defn} ###### Definition The dependent type *is greater than*, denoted as $p \gt q$, is defined as $p \lt q \coloneqq isNegative(q - p)$ for $p:\mathbb{Q}$, $q:\mathbb{Q}$. =-- +--{: .num_defn} ###### Definition The dependent type *is apart from*, denoted as $p \# q$, is defined as $p \lt q \coloneqq isNonZero(q - p)$ for $p:\mathbb{Q}$, $q:\mathbb{Q}$. =-- +--{: .num_defn} ###### Definition The dependent type *is less than or equal to*, denoted as $p \leq q$, is defined as $p \lt q \coloneqq isNonNegative(q - p)$ for $p:\mathbb{Q}$, $q:\mathbb{Q}$. =-- +--{: .num_defn} ###### Definition The dependent type *is greater than or equal to*, denoted as $p \leq q$, is defined as $p \lt q \coloneqq isNonPositive(q - p)$ for $p:\mathbb{Q}$, $q:\mathbb{Q}$. =-- ### Pseudolattice structure on the rational numbers ### +--{: .num_defn} ###### Definition The **ramp function** $ramp:\mathbb{Q} \to \mathbb{Q}$ is defined as $$ramp(a/b) \coloneqq (ramp(a) \cdot ramp(i(b)) + ramp(-a) \cdot ramp(i(-b)))/(b \cdot b)$$ for $a \in \mathbb{Z}$, $b \in \mathbb{Z}_{#0}$, $ramp:\mathbb{Z} \to \mathbb{Z}$. =-- +--{: .num_defn} ###### Definition The **minimum** $min:\mathbb{Q} \times \mathbb{Q} \to \mathbb{Q}$ is defined as $$\min(p,q) \coloneqq p - ramp(p - q)$$ for $p:\mathbb{Q}$, $q:\mathbb{Q}$. =-- +--{: .num_defn} ###### Definition The **maximum** $max:\mathbb{Q} \times \mathbb{Q} \to \mathbb{Q}$ is defined as $$\max(p, q) \coloneqq p + ramp(q - p)$$ for $p:\mathbb{Q}$, $q:\mathbb{Q}$. =-- +--{: .num_defn} ###### Definition The **absolute value** $\vert(-)\vert:\mathbb{Q} \to \mathbb{Q}$ is defined as $$\vert p \vert \coloneqq \max(p, -p)$$ for $p:\mathbb{Q}$. =-- +--{: .num_defn} ###### Definition The **metric** $\rho:\mathbb{Q} \times \mathbb{Q} \to \mathbb{Q}$ is defined as $$\rho(p, q) \coloneqq \max(p, q) - \min(p, q)$$ for $p:\mathbb{Q}$, $q:\mathbb{Q}$. =-- ### Uniform structure on the rational numbers ### We define the ternary relation $x \sim_\epsilon y \coloneqq \rho(x, y) \lt \epsilon$ for $x \in \mathbb{Q}$, $y \in \mathbb{Q}$, and $\epsilon \in \mathbb{Q}_+$, called "$x$ and $y$ are within a distance of $\epsilon$". One could show that the rational numbers are a [[uniform space]] with respect to the [[uniformity]] [[ternary relation]] $x \sim_\epsilon y$. 1. For every $x \in \mathbb{Q}$ and $\epsilon \in \mathbb{Q}_+$, $x \sim_\epsilon x$ 2. For every $x \in \mathbb{Q}$, $y \in \mathbb{Q}$, $z \in \mathbb{Q}$ and $\delta \in \mathbb{Q}_+$, $\epsilon \in \mathbb{Q}_+$, $x \sim_\delta y$ and $y \sim_\epsilon z$ implies that $x \sim_{\delta + \epsilon} z$. 3. For every $x \in \mathbb{Q}$, $y \in \mathbb{Q}$ and $\epsilon \in \mathbb{Q}_+$, $x \sim_\epsilon y$ implies that $y \sim_\epsilon x$. 4. For every $x \in \mathbb{Q}$, $y \in \mathbb{Q}$, $x \sim_1 y$ if and only if $\rho(x, y) \lt 1$. 5. For every $x \in \mathbb{Q}$, $y \in \mathbb{Q}$ and $\delta \in \mathbb{Q}_+$, $\epsilon \in \mathbb{Q}_+$, $x \sim_{\min(\delta, \epsilon)} y$ implies that $x \sim_{\delta} y$ and $x \sim_{\epsilon} y$. 6. For every $x \in \mathbb{Q}$, $y \in \mathbb{Q}$ and $\delta \in \mathbb{Q}_+$, $\epsilon \in \mathbb{Q}_+$, $\delta \leq \epsilon$ and $x \sim_{\delta} y$ implies that $x \sim_{\epsilon} y$. ### Algebraic closure The [[algebraic closure]] $\overline{\mathbb{Q}}$ of the rational numbers is called the [[field]] of _[[algebraic numbers]]_. The [[absolute Galois group]] $Gal(\overline{\mathbb{Q}}\vert \mathbb{Q})$ has some curious properties, see [there](absolute+Galois+group#OfTheRationalNumbers). ### Topologies There are several interesting [[topological space|topologies]] on $\mathbb{Q}$ that make $\mathbb{Q}$ into a [[topological group]] under addition, allowing us to define interesting fields by taking the [[complete space|completion]] with respect to this topology: 1. The _[[discrete topology]]_ is the most obvious, which is already complete. 2. The _absolute-value topology_ is defined by the [[metric space|metric]] $d(x,y) \coloneqq {|x - y|}$; the completion is the field of [[real numbers]]. The rational numbers are thus a [[Hausdorff space]]. (This topology is [[totally disconnected space|totally disconnected]] ([this exmpl.](totally+disconnected+space#RationalNumbersAreTotallyDisconnected))) 3. Fixing a [[prime number]] $p$, the _$p$-adic topology_ is defined by the [[ultrametric]] $d(x,y) \coloneqq 1/n$ where $n$ is the highest exponent on $p$ in the [[prime factorization]] of ${|x - y|}$; the completion is the field of $p$-[[adic number|adic numbers]]. According to [[Ostrowski's theorem]] this are the only possibilities. Interestingly, (2) cannot be interpreted as a [[locale|localic]] group, although the completion $\mathbb{R}$ can. (Probably the same holds for (3); I need to check.) ### Analysis One could analytically define the concepts of [[limit of a function]] and [[continuous function]] with respect to the absolute-value topology, and prove that the limit of a function satisfy the [[algebraic limit theorem]]. Since the [[reciprocal function]] on the rational numbers is well defined for non-zero rational numbers $\mathbb{Q}_{\neq 0}$, given a continuous function $f:I \to \mathbb{Q}$ for open interval $I \subseteq \mathbb{Q}$ the [[difference quotient]] function exists and thus the [[derivative]] is well-defined for continuous functions. One could thus define [[smooth functions]] on the rational numbers, and because the rational numbers are a Hausdorff space, [[analytic functions]] on the rational numbers, despite the fact that the rational numbers are a totally disconnected space. For example, * A rational metric space is a type $X$ with a function $d_X:X \times X \to \mathbb{Q}_{\geq 0}$ such that * for all $x \in X$ and $y \in X$, $d_X(x, y) = d_X(y, x)$ * for all $x \in X$, $y \in X$, and $z \in X$, $d_X(x, z) \leq d_X(x, y) + d_X(y, z)$ * for all $x \in X$, $x = y \iff d_X(x, y) = 0$ One could show that any [[open interval]], [[half-open interval]], and [[closed interval]] in the rational numbers is a rational metric space, with its metric inherited from the Euclidean metric on the rational numbers $d_\mathbb{Q}(x, y) = {|a - b|}$. Thus one could do analysis with [[partial functions]] in the [[rational numbers]], such as the [[reciprocal function]] $x \mapsto \frac{1}{x}$ and the [[rational functions]] on the rational numbers. Then, given a rational metric space $(X, d_X)$: * if it exists, the (Weierstrass) [[limit of a function]] $f:X \to \mathbb{Q}$ from $X$ to the rational numbers approaching an element $a \in X$ is a rational number $L \in \mathbb{Q}$ with a function on the positive rational numbers $M:\mathbb{Q}_+ \to \mathbb{Q}_+$ such that for all positive rational numbers $\epsilon \in \mathbb{Q}_+$ and for all elements $b \in X$, $0 \lt d_X(a, b) \lt M(\epsilon)$ implies ${|f(b) - L|} \lt \epsilon$ * similarly, if it exists, the (Bourbaki) [[limit of a function]] $f:X \to \mathbb{Q}$ from $X$ to the rational numbers approaching an element $a \in X$ is a rational number $L \in \mathbb{Q}$ with a function on the positive rational numbers $M:\mathbb{Q}_+ \to \mathbb{Q}_+$ such that for all positive rational numbers $\epsilon \in \mathbb{Q}_+$ and for all elements $b \in X$, $d_X(a, b) \lt M(\epsilon)$ implies ${|f(b) - L|} \lt \epsilon$ * a [[pointwise continuous function]] from $X$ to the rational numbers is a function $f:X \to \mathbb{Q}$ with a function from $X$ to the set of endofunctions on the positive rational numbers $M:X \to \mathbb{Q}_+ \to \mathbb{Q}_+$ such that for all positive rational numbers $\epsilon \in \mathbb{Q}_+$ and for all rational numbers $a \in X$ and $b \in X$, $\delta_X(a, b) \lt M(a, \epsilon)$ implies that ${|f(a) - f(b)|} \lt \epsilon$. * a [[uniformly continuous function]] from $X$ to the rational numbers is a function $f:X \to \mathbb{Q}$ with a function on the positive rational numbers $M:\mathbb{Q}_+ \to \mathbb{Q}_+$ such that for all positive rational numbers $\epsilon \in \mathbb{Q}_+$ and for all elements numbers $a \in X$ and $b \in X$, $\delta_X(a, b) \lt M(\epsilon)$ implies that ${|f(a) - f(b)|} \lt \epsilon$. Now, given an [[injection]] $i:X \hookrightarrow \mathbb{Q}$, so that $X$ is a [[subset]] of the rational numbers, * a [[pointwise differentiable function]] from $X$ to the rational numbers is a function $f:X \to \mathbb{Q}$ with a [[derivative]] function $f':X \to \mathbb{Q}$ on the rational numbers and a function from $X$ to the set of endofunctions on the positive rational numbers $M:X \to \mathbb{Q}_+ \to \mathbb{Q}_+$ such that for all positive rational numbers $\epsilon \in \mathrm{Q}_+$ and for all elements $a \in X$ and $b \in X$, ${|f(a) - f(b)|} \lt M(a, \epsilon)$ implies that $${|f(b) - f(a) - f'(a)(i(b) - i(a)))|} \lt \epsilon {|f(a) - f(b)|}$$ * a [[uniformly differentiable function]] from $X$ to the rational numbers is a function $f:X \to \mathbb{Q}$ with a [[derivative]] function $f':X \to \mathbb{Q}$ on the rational numbers and a function on the positive rational numbers $M:\mathbb{Q}_+ \to \mathbb{Q}_+$ such that for all positive rational numbers $\epsilon \in \mathrm{Q}_+$ and for all elements $a \in X$ and $b \in X$, ${|f(a) - f(b)|} \lt M(\epsilon)$ implies that $${|f(b) - f(a) - f'(a)(i(b) - i(a)))|} \lt \epsilon {|f(a) - f(b)|}$$ * a [[smooth function]] in rational numbers is a function $f:\mathbb{Q} \to \mathbb{Q}$ with a [[sequence]] of functions $D^{(-)}f:\mathbb{N} \to (\mathbb{Q} \to \mathbb{Q})$ and a sequence of functions $M^{(-)}f:\mathbb{N} \to (\mathbb{Q}_+ \to \mathbb{Q}_+)$ in the positive rational numbers, such that * for every element $x \in X$, $(D^{0}f)(x) = f(x)$ * for every natural number $n \in \mathbb{N}$, for every positive rational number $\epsilon \in \mathbb{Q}_+$, for every rational number $h \in \mathbb{Q}$ such that $0 \lt | h | \lt M^{n}f(\epsilon)$, and for every rational number $x \in \mathbb{Q}$, $$\left|f(x + h) - \sum_{i=0}^n \frac{h^i (D^{i}f)(x)}{i!}\right| \lt \epsilon |h^n|$$ Alternatively, we could use [[infinitesimals]]. Let $\mathbb{Q}[\epsilon]/(\epsilon^2 = 0)$ be the dual rational numbers, and let $\mathbb{Q}[[\epsilon]]$ be the commutative ring of [[formal power series]] on the rational numbers. The former is equivalent to the product $\mathbb{Q} \times \mathbb{Q}$ and the latter is equivalent to the [[function set]] $\mathbb{Q}^\mathbb{N}$. Both of these are commutative [[rational algebras]] with ring homomorphism $h:\mathbb{Q} \to \mathbb{Q}[\epsilon]/(\epsilon^2 = 0)$ and $k:\mathbb{Q} \to \mathbb{Q}[[\epsilon]]$. * A function $f:X \to \mathbb{Q}$ is **differentiable** if it has a function $\mathrm{lift}_f:\mathbb{Q}[\epsilon]/(\epsilon^2 = 0) \to \mathbb{Q}[\epsilon]/(\epsilon^2 = 0)$ such that $\mathrm{lift}_f(h(i(a))) = h(i(a))$ and a function $f':X \to \mathbb{Q}$ such that for all elements $a \in X$, $$\mathrm{lift}_f(h(i(a)) + \epsilon) = h(i(a)) + h(f'(a)) \epsilon$$ * A function $f:X \to \mathbb{Q}$ is **smooth** if it has a function $\mathrm{lift}_f:\mathbb{Q}[[\epsilon]] \to \mathbb{Q}[[\epsilon]]$ such that $\mathrm{lift}_f(h(i(a))) = h(i(a))$ and a sequence of functions $\frac{d^{-} f}{d x^{-}}:\mathbb{N} \times X \to \mathbb{Q}$ with $\frac{d^0 f}{d x^0}\left(a\right) = a$ for all $a \in X$, such that for all natural numbers $n \in \mathbb{N}$ $$\mathrm{lift}_f(h(j(a)) + \epsilon) = \sum_{i = 0}^{\infty} \frac{1}{i!} h\left(\frac{d^i f}{d x^i}\left(a\right)\right) \epsilon^i$$ ## Related concepts * [[natural number]] * [[integer]] * **rational number** * a finite [[field extension]] of $\mathbb{Q}$ is called a _[[number field]]_ * [[dyadic rational number]] * [[decimal rational number]] * [[Q/Z]] * [[algebraic number]] * [[Gaussian number]] * [[irrational number]] * [[quadratic irrational number]] * [[real number]] * [[p-adic number]] * [[rational numbers object]] * [[rational interval coalgebra]] * [[rational root theorem]] ## References * [[Leo Corry]], *A Brief History of Numbers*, Oxford University Press (2015) &lbrack;[ISBN:9780198702597](https://global.oup.com/academic/product/a-brief-history-of-numbers-9780198702597)&rbrack; See also: * Wikipedia, *[Rational number](https://en.wikipedia.org/wiki/Rational_number)* Discussion in [[univalent foundations of mathematics]] ([[homotopy type theory]] with the [[univalence axiom]]): * {#UBP13} [[Univalent Foundations Project]], §11.1 of: *[[HoTT book|Homotopy Type Theory – Univalent Foundations of Mathematics]]* (2013) and specifically in [[Agda]]: * [[UniMath project]], *[agda-unimath/elementary-number-theory.rational-numbers](https://unimath.github.io/agda-unimath/elementary-number-theory.rational-numbers.html)* [[!redirects rational number]] [[!redirects rational numbers]] [[!redirects field of rational numbers]] [[!redirects rationals]]</textarea> <p> <input id="alter_title" name="alter_title" onchange="toggleVisibility();" type="checkbox" value="1" /> <label for="alter_title">Change page name.</label><br/> <span id="title_change" style="display:none"><label for="new_name">New name:</label> <input id="new_name" name="new_name" onblur="addRedirect();" type="text" value="rational number" /></span> </p> <div> <p style="font-size: 0.8em; width: 70%;"> For non-trivial edits, please briefly describe your changes below. Your comments will be added to the <a href="https://nforum.ncatlab.org/discussion/12522/#Item_7">nForum discussion thread</a> for this page, which can also be used for further discussion related to this page. For trivial edits, such as correcting typos, please leave the box below empty; feel free to ask for advice at the nForum if you are unsure. </p> </div> <div> <textarea name="announcement" id="announcement" style="height: 10em; width: 70%"></textarea> </div> <div id="editFormButtons"> <input type="submit" value="Submit" accesskey="s"/> as <input id="author" name="author" onblur="this.value == '' ? this.value = 'Anonymous' : true" onfocus="this.value == 'Anonymous' ? this.value = '' : true;" type="text" value="Anonymous" /> | <span> <a href="/nlab/cancel_edit/rational+number" accesskey="c">Cancel</a> <span class="unlock">(unlocks page)</span> </span> </div> </div> </form> <script type="text/javascript"> <!--//--><![CDATA[//><!-- function toggleVisibility() { var span = document.getElementById('title_change'); if (span.style.display =='inline') { span.style.display ='none'; document.getElementById('new_name').value = "rational number"; var content = document.getElementById('content').value document.getElementById('content').value = content.replace(/\[\[!redirects rational\ number\]\]\n/, '') } else span.style.display ='inline' } function addRedirect(){ var e = document.getElementById('new_name').value; if ( e != "rational number" && e != '') { var content = document.getElementById('content'); content.value = '[[!redirects rational number]]\n' + content.value } } document.forms["editForm"].elements["content"].focus(); //--><!]]> </script> </div> <!-- Content --> </div> <!-- Container --> </body> </html>