{{short description|Truncating subtraction on natural numbers, or a generalization thereof}} {{Use dmy dates|date=December 2025}} {{CS1 config|mode=cs2}} In mathematics, '''monus''' is an operator on certain commutative monoids that are not groups. A commutative monoid on which a monus operator is defined is called a '''commutative monoid with monus''', or '''CMM'''. The monus operator may be denoted with the {{nowrap|minus sign, "<math>-</math>",}} because the natural numbers are a CMM under subtraction. It is also denoted with a dotted minus {{nowrap|sign, "<math>\mathbin{\dot{-}}</math>",}} to distinguish it from the standard subtraction operator.

== Notation == {| class="wikitable" style="text-align:center; width:70%" ! glyph ! Unicode name ! Unicode code point<ref>Characters in Unicode are referenced in prose via the "U+" notation. The hexadecimal number after the "U+" is the character's Unicode code point.</ref> ! HTML character entity reference ! HTML/XML numeric character references !TeX |- | <math>\mathbin{\dot{-}}</math> | <small>DOT MINUS</small> | U+2238 | | <code>&amp;#8760;</code> | <code>\dot&nbsp;-</code> |- | − | <small>MINUS SIGN</small> | U+2212 | <code>&amp;minus;</code> | <code>&amp;#8722;</code> | <code>-</code> |}

A use of the monus symbol is seen in Dennis Ritchie's PhD Thesis from 1968.{{sfn|Brailsford|Kernighan|Ritchie|2022}}

== Definition == Let <math>(M, +, 0)</math> be a commutative monoid. Define a binary relation <math>\leq</math> on this monoid as follows: for any two elements <math>a</math> and <math>b</math>, define <math>a \leq b</math> if there exists an element <math>c</math> such that <math>a + c = b</math>. It is easy to check that <math>\leq</math> is reflexive<ref>taking <math>c</math> to be the neutral element of the monoid</ref> and that it is transitive.<ref>if <math>a \leq b</math> with witness <math>d</math> and <math>b \leq c</math> with witness <math>d'</math> then <math>d + d'</math> witnesses that <math>a \leq c</math></ref> <math>M</math> is called '''naturally ordered''' if the <math>\leq</math> relation is additionally antisymmetric and hence a partial order. Further, if for each pair of elements <math>a</math> and <math>b</math>, a unique smallest element <math>c_0</math> exists such that <math>a \leq b + c_0</math>, then {{math|''M''}} is called a '''commutative monoid with monus'''{{sfn|Amer|1984|p=129}} and the '''monus''' <math>a \mathbin{\dot{-}} b </math> of any two elements <math>a</math> and <math>b</math> can be defined as this unique smallest element <math>c_0</math> such that <math>a \leq b + c_0</math>.

An example of a commutative monoid that is not naturally ordered is <math>(\mathbb{Z}, +, 0)</math>, the commutative monoid of the integers with usual addition, as for any <math>a, b \in \mathbb{Z}</math> there exists <math>c</math> such that <math>a + c = b</math>, so <math>a \leq b</math> holds for any <math>a, b \in \mathbb{Z}</math>, so <math>\leq</math> is not antisymmetric and therefore not a partial order. There are also examples of monoids that are naturally ordered but are not semirings with monus.{{sfn|Monet|2016}}

== Other structures ==

Beyond monoids, the notion of monus can be applied to other structures. For instance, a '''naturally ordered semiring''' (sometimes called a '''dioid'''{{sfn|Pouly|2010|p=22|loc=slide 17}}) is a semiring where the commutative monoid induced by the addition operator is naturally ordered. When this monoid is a commutative monoid with monus, the semiring is called a '''semiring with monus''', or '''m-semiring'''.

== Examples == If {{math|''M''}} is an ideal in a Boolean algebra, then {{math|''M''}} is a commutative monoid with monus under <math>a + b = a \vee b </math> and <math>a \mathbin{\dot{-}} b = a \wedge \neg b </math>.{{sfn|Amer|1984|p=129}}

=== Natural numbers === The natural numbers including 0 form a commutative monoid with monus, with their ordering being the usual order of natural numbers and the monus operator being a saturating variant of standard subtraction, variously referred to as '''truncated subtraction''',{{sfn|Vereschchagin|Shen|2003}} '''limited subtraction''', '''proper subtraction''', '''doz''' (''difference or zero''),{{sfn|Warren Jr.|2013}} and '''monus'''.{{sfn|Jacobs|1996}} Truncated subtraction is usually defined as{{sfn|Vereschchagin|Shen|2003}} :<math>a \mathbin{\dot{-}} b = \begin{cases} 0 & \mbox{if } a < b \\ a - b & \mbox{if } a \ge b, \end{cases} </math> where &minus; denotes standard subtraction. For example, <math>5 - 3 = 2</math> and <math>3 - 5 = -2</math> in regular subtraction, whereas in truncated subtraction <math>3 \mathbin{\dot{-}} 5 = 0</math>. Truncated subtraction may also be defined as{{sfn|Jacobs|1996}} :<math>a \mathbin{\dot{-}} b = \max(a - b, 0).</math>

In Peano arithmetic, truncated subtraction is defined in terms of the predecessor function {{math|''P''}} (the inverse of the successor function):{{sfn|Vereschchagin|Shen|2003}} :<math> \begin{align} P(0) &= 0 \\ P(S(a)) &= a \\ a \mathbin{\dot{-}} 0 &= a \\ a \mathbin{\dot{-}} S(b) &= P(a \mathbin{\dot{-}} b). \end{align} </math>

A definition that does not need the predecessor function is: :<math> \begin{align} a \mathbin{\dot{-}} 0 &= a \\ 0 \mathbin{\dot{-}} b &= 0 \\ S(a) \mathbin{\dot{-}} S(b) &= a \mathbin{\dot{-}} b. \end{align} </math>

Truncated subtraction is useful in contexts such as primitive recursive functions, which are not defined over negative numbers.{{sfn|Vereschchagin|Shen|2003}} Truncated subtraction is also used in the definition of the multiset difference operator.

== Properties == The class of all commutative monoids with monus form a variety.{{sfn|Amer|1984|p=129}} The equational basis for the variety of all CMMs consists of the axioms for commutative monoids, as well as the following axioms:

<math>\begin{align} a + (b \mathbin{\dot{-}} a) &= b + (a \mathbin{\dot{-}} b),\\ (a \mathbin{\dot{-}} b) \mathbin{\dot{-}} c &= a \mathbin{\dot{-}} (b + c),\\ (a \mathbin{\dot{-}} a) &= 0,\\ (0 \mathbin{\dot{-}} a) &= 0.\\ \end{align}</math>

== Notes == {{reflist|2}}

== References == *{{cite journal |last=Amer |first=K. |title=Equationally complete classes of commutative monoids with monus |journal=Algebra Universalis |year=1984 |doi=10.1007/BF01182254 |volume=18 |pages=129-131 }}

*{{cite conference | last1 = Brailsford | first1 = David F. | last2 = Kernighan | first2 = Brian W. | author2-link = Brian Kernighan | last3 = Ritchie | first3 = William A. | editor1-last = Wigington | editor1-first = Curtis | editor2-last = Hardy | editor2-first = Matthew | editor3-last = Bagley | editor3-first = Steven R. | editor4-last = Simske | editor4-first = Steven J. | contribution = How did Dennis Ritchie produce his PhD thesis? A typographical mystery | contribution-url = https://www.cs.princeton.edu/~bwk/dmr/doceng22.pdf | doi = 10.1145/3558100.3563839 | pages = 2:1–2:10 | publisher = Association for Computing Machinery | title = Proceedings of the 22nd ACM Symposium on Document Engineering, DocEng 2022, San Jose, California, USA, September 20–23, 2022 | year = 2022 }}

*{{cite book |last = Jacobs |first = Bart |year = 1996 |title = Algebraic Methodology and Software Technology |chapter = Coalgebraic Specifications and Models of Deterministic Hybrid Systems |pages = 522 |editor-last = Wirsing |editor-first = Martin |editor-last2 = Nivat |editor-first2 = Maurice |publisher = Springer |isbn = 3-540-61463-X |series = Lecture Notes in Computer Science |volume = 1101 |chapter-url = https://www.cs.ru.nl/B.Jacobs/PAPERS/AMAST96.ps |chapter-format=PS }}

*{{cite web |last=Monet |first=M. |date=14 October 2016 |title=Example of a naturally ordered semiring which is not an m-semiring |website=Mathematics Stack Exchange |url=https://math.stackexchange.com/q/1968090 |accessdate=30 July 2025 }}

*{{cite web |last=Pouly |first=Marc |date=July 2010 |title=Semirings for breakfast |url=http://marcpouly.ch/pdf/internal_100712.pdf |pages=27 |website=University of Luxembourg |accessdate=30 July 2025 }}

*{{cite book |last1=Vereschchagin |first1=Nikolai K. |last2=Shen |first2=Alexander |year= 2003 |title=Computable Functions |translator=V. N. Dubrovskii |publisher=American Mathematical Society |isbn = 0-8218-2732-4 |pages = 141 }}

*{{cite book |last=Warren Jr. |first=Henry S. |date=2013 |title=Hacker's Delight |edition=2 |publisher=Addison Wesley - Pearson Education, Inc. |isbn=978-0-321-84268-8 }}

Category:Algebraic structures