OpenMath Content Dictionary: integer1
Canonical URL:
http://www.openmath.org/cd/integer1.ocd
CD Base:
http://www.openmath.org/cd
CD File:
integer1.ocd
CD as XML Encoded OpenMath:
integer1.omcd
Defines:
factorial , factorof , quotient , remainder
Date:
2004-03-30
Version:
3
(Revision 1)
Review Date:
2006-03-30
Status:
official
This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The copyright holder grants you permission to redistribute this
document freely as a verbatim copy. Furthermore, the copyright
holder permits you to develop any derived work from this document
provided that the following conditions are met.
a) The derived work acknowledges the fact that it is derived from
this document, and maintains a prominent reference in the
work to the original source.
b) The fact that the derived work is not the original OpenMath
document is stated prominently in the derived work. Moreover if
both this document and the derived work are Content Dictionaries
then the derived work must include a different CDName element,
chosen so that it cannot be confused with any works adopted by
the OpenMath Society. In particular, if there is a Content
Dictionary Group whose name is, for example, `math' containing
Content Dictionaries named `math1', `math2' etc., then you should
not name a derived Content Dictionary `mathN' where N is an integer.
However you are free to name it `private_mathN' or some such. This
is because the names `mathN' may be used by the OpenMath Society
for future extensions.
c) The derived work is distributed under terms that allow the
compilation of derived works, but keep paragraphs a) and b)
intact. The simplest way to do this is to distribute the derived
work under the OpenMath license, but this is not a requirement.
If you have questions about this license please contact the OpenMath
society at http://www.openmath.org .
Author: OpenMath Consortium
SourceURL: https://github.com/OpenMath/CDs
This CD holds a collection of basic integer functions.
This CD is intended to be `compatible' with the corresponding elements
in Content MathML.
Role:
application
Description:
This is the binary OpenMath operator that is used to indicate the
mathematical relationship a "is a factor of" b, where a is the
first argument and b is the second. This relationship is
true if and only if b mod a = 0.
Commented Mathematical property (CMP):
b is a factor of a iff remainder of a divided by b = 0
Formal Mathematical property (FMP):
OpenMath XML (source)
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="logic1" name="implies"/>
<OMA>
<OMS cd="integer1" name="factorof"/>
<OMV name="b"/>
<OMV name="a"/>
</OMA>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="integer1" name="remainder"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
<OMS cd="alg1" name="zero"/>
</OMA>
</OMA>
</OMOBJ>
Strict Content MathML
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply><csymbol cd="logic1">implies</csymbol>
<apply><csymbol cd="integer1">factorof</csymbol><ci>b</ci><ci>a</ci></apply>
<apply><csymbol cd="relation1">eq</csymbol>
<apply><csymbol cd="integer1">remainder</csymbol><ci>a</ci><ci>b</ci></apply>
<csymbol cd="alg1">zero</csymbol>
</apply>
</apply>
</math>
Prefix
Popcorn
integer1.factorof($b, $a) ==> integer1.remainder($a, $b) = alg1.zero
Rendered Presentation MathML
factorof
(
b
,
a
)
⇒
remainder
(
a
,
b
)
=
0
Signatures:
sts
Role:
application
Description:
The symbol to represent a unary factorial function on non-negative integers.
Commented Mathematical property (CMP):
factorial n = product [1..n]
Formal Mathematical property (FMP):
OpenMath XML (source)
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="integer1" name="factorial"/>
<OMV name="n"/>
</OMA>
<OMA>
<OMS cd="arith1" name="product"/>
<OMA>
<OMS cd="interval1" name="integer_interval"/>
<OMI> 1 </OMI>
<OMV name="n"/>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="i"/>
</OMBVAR>
<OMV name="i"/>
</OMBIND>
</OMA>
</OMA>
</OMOBJ>
Strict Content MathML
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply><csymbol cd="relation1">eq</csymbol>
<apply><csymbol cd="integer1">factorial</csymbol><ci>n</ci></apply>
<apply><csymbol cd="arith1">product</csymbol>
<apply><csymbol cd="interval1">integer_interval</csymbol><cn type="integer">1</cn><ci>n</ci></apply>
<bind><csymbol cd="fns1">lambda</csymbol><bvar><ci>i</ci></bvar><ci>i</ci></bind>
</apply>
</apply>
</math>
Prefix
Popcorn
integer1.factorial($n) = arith1.product(interval1.integer_interval(1, $n), fns1.lambda[$i -> $i])
Rendered Presentation MathML
Signatures:
sts
Role:
application
Description:
The symbol to represent the integer (binary) division operator. That is,
for integers a and b, quotient(a,b) denotes q such that a=b*q+r, with |r|
less than |b| and a*r positive.
Commented Mathematical property (CMP):
for all a,b with a,b Integers |
a = b * quotient(a,b) + remainder(a,b) and abs(remainder(a,b)) is less than abs(b) and
a*remainder(a,b) >= 0
Formal Mathematical property (FMP):
OpenMath XML (source)
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMBIND>
<OMS cd="quant1" name="forall"/>
<OMBVAR>
<OMV name="a"/>
<OMV name="b"/>
</OMBVAR>
<OMA>
<OMS cd="logic1" name="implies"/>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="set1" name="in"/>
<OMV name="a"/>
<OMS cd="setname1" name="Z"/>
</OMA>
<OMA>
<OMS cd="set1" name="in"/>
<OMV name="b"/>
<OMS cd="setname1" name="Z"/>
</OMA>
</OMA>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMV name="a"/>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMA>
<OMS cd="arith1" name="times"/>
<OMV name="b"/>
<OMA>
<OMS cd="integer1" name="quotient"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
</OMA>
<OMA>
<OMS cd="integer1" name="remainder"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="lt"/>
<OMA>
<OMS cd="arith1" name="abs"/>
<OMA>
<OMS cd="integer1" name="remainder"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
</OMA>
<OMA>
<OMS cd="arith1" name="abs"/>
<OMV name="b"/>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="geq"/>
<OMA>
<OMS cd="arith1" name="times"/>
<OMV name="a"/>
<OMA>
<OMS cd="integer1" name="remainder"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
</OMA>
<OMS cd="alg1" name="zero"/>
</OMA>
</OMA>
</OMA>
</OMBIND>
</OMOBJ>
Strict Content MathML
<math xmlns="http://www.w3.org/1998/Math/MathML">
<bind><csymbol cd="quant1">forall</csymbol>
<bvar><ci>a</ci></bvar>
<bvar><ci>b</ci></bvar>
<apply><csymbol cd="logic1">implies</csymbol>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="set1">in</csymbol><ci>a</ci><csymbol cd="setname1">Z</csymbol></apply>
<apply><csymbol cd="set1">in</csymbol><ci>b</ci><csymbol cd="setname1">Z</csymbol></apply>
</apply>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="relation1">eq</csymbol>
<ci>a</ci>
<apply><csymbol cd="arith1">plus</csymbol>
<apply><csymbol cd="arith1">times</csymbol>
<ci>b</ci>
<apply><csymbol cd="integer1">quotient</csymbol><ci>a</ci><ci>b</ci></apply>
</apply>
<apply><csymbol cd="integer1">remainder</csymbol><ci>a</ci><ci>b</ci></apply>
</apply>
</apply>
<apply><csymbol cd="relation1">lt</csymbol>
<apply><csymbol cd="arith1">abs</csymbol>
<apply><csymbol cd="integer1">remainder</csymbol><ci>a</ci><ci>b</ci></apply>
</apply>
<apply><csymbol cd="arith1">abs</csymbol><ci>b</ci></apply>
</apply>
<apply><csymbol cd="relation1">geq</csymbol>
<apply><csymbol cd="arith1">times</csymbol>
<ci>a</ci>
<apply><csymbol cd="integer1">remainder</csymbol><ci>a</ci><ci>b</ci></apply>
</apply>
<csymbol cd="alg1">zero</csymbol>
</apply>
</apply>
</apply>
</bind>
</math>
Prefix
forall
[
a
b
] .
(
implies
(
and
(
in
(
a ,
Z )
,
in
(
b ,
Z )
)
,
and
(
eq
(
a ,
plus
(
times
(
b ,
quotient
(
a ,
b )
)
,
remainder
(
a ,
b )
)
)
,
lt
(
abs
(
remainder
(
a ,
b )
)
,
abs
(
b )
)
,
geq
(
times
(
a ,
remainder
(
a ,
b )
)
,
zero )
)
)
)
Popcorn
quant1.forall[$a, $b -> set1.in($a, setname1.Z) and set1.in($b, setname1.Z) ==> $a = $b * integer1.quotient($a, $b) + integer1.remainder($a, $b) and arith1.abs(integer1.remainder($a, $b)) < arith1.abs($b) and $a * integer1.remainder($a, $b) >= alg1.zero]
Rendered Presentation MathML
∀
a
,
b
.
a
∈
Z
∧
b
∈
Z
⇒
a
=
b
quotient
(
a
,
b
)
+
remainder
(
a
,
b
)
∧
|
remainder
(
a
,
b
)
|
<
|
b
|
∧
a
remainder
(
a
,
b
)
≥
0
Signatures:
sts
Role:
application
Description:
The symbol to represent the integer remainder after (binary) division.
For integers a and b, remainder(a,b) denotes r such that a=b*q+r, with |r| less
than |b| and a*r positive.
Commented Mathematical property (CMP):
for all a,b with a,b Integers |
a = b * quotient(a,b) + remainder(a,b) and abs(remainder(a,b)) is less than abs(b) and a*remainder(a,b) >= 0
Formal Mathematical property (FMP):
OpenMath XML (source)
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMBIND>
<OMS cd="quant1" name="forall"/>
<OMBVAR>
<OMV name="a"/>
<OMV name="b"/>
</OMBVAR>
<OMA>
<OMS cd="logic1" name="implies"/>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="set1" name="in"/>
<OMV name="a"/>
<OMS cd="setname1" name="Z"/>
</OMA>
<OMA>
<OMS cd="set1" name="in"/>
<OMV name="b"/>
<OMS cd="setname1" name="Z"/>
</OMA>
</OMA>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMV name="a"/>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMA>
<OMS cd="arith1" name="times"/>
<OMV name="b"/>
<OMA>
<OMS cd="integer1" name="quotient"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
</OMA>
<OMA>
<OMS cd="integer1" name="remainder"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="lt"/>
<OMA>
<OMS cd="arith1" name="abs"/>
<OMA>
<OMS cd="integer1" name="remainder"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
</OMA>
<OMA>
<OMS cd="arith1" name="abs"/>
<OMV name="b"/>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="geq"/>
<OMA>
<OMS cd="arith1" name="times"/>
<OMV name="a"/>
<OMA>
<OMS cd="integer1" name="remainder"/>
<OMV name="a"/>
<OMV name="b"/>
</OMA>
</OMA>
<OMS cd="alg1" name="zero"/>
</OMA>
</OMA>
</OMA>
</OMBIND>
</OMOBJ>
Strict Content MathML
<math xmlns="http://www.w3.org/1998/Math/MathML">
<bind><csymbol cd="quant1">forall</csymbol>
<bvar><ci>a</ci></bvar>
<bvar><ci>b</ci></bvar>
<apply><csymbol cd="logic1">implies</csymbol>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="set1">in</csymbol><ci>a</ci><csymbol cd="setname1">Z</csymbol></apply>
<apply><csymbol cd="set1">in</csymbol><ci>b</ci><csymbol cd="setname1">Z</csymbol></apply>
</apply>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="relation1">eq</csymbol>
<ci>a</ci>
<apply><csymbol cd="arith1">plus</csymbol>
<apply><csymbol cd="arith1">times</csymbol>
<ci>b</ci>
<apply><csymbol cd="integer1">quotient</csymbol><ci>a</ci><ci>b</ci></apply>
</apply>
<apply><csymbol cd="integer1">remainder</csymbol><ci>a</ci><ci>b</ci></apply>
</apply>
</apply>
<apply><csymbol cd="relation1">lt</csymbol>
<apply><csymbol cd="arith1">abs</csymbol>
<apply><csymbol cd="integer1">remainder</csymbol><ci>a</ci><ci>b</ci></apply>
</apply>
<apply><csymbol cd="arith1">abs</csymbol><ci>b</ci></apply>
</apply>
<apply><csymbol cd="relation1">geq</csymbol>
<apply><csymbol cd="arith1">times</csymbol>
<ci>a</ci>
<apply><csymbol cd="integer1">remainder</csymbol><ci>a</ci><ci>b</ci></apply>
</apply>
<csymbol cd="alg1">zero</csymbol>
</apply>
</apply>
</apply>
</bind>
</math>
Prefix
forall
[
a
b
] .
(
implies
(
and
(
in
(
a ,
Z )
,
in
(
b ,
Z )
)
,
and
(
eq
(
a ,
plus
(
times
(
b ,
quotient
(
a ,
b )
)
,
remainder
(
a ,
b )
)
)
,
lt
(
abs
(
remainder
(
a ,
b )
)
,
abs
(
b )
)
,
geq
(
times
(
a ,
remainder
(
a ,
b )
)
,
zero )
)
)
)
Popcorn
quant1.forall[$a, $b -> set1.in($a, setname1.Z) and set1.in($b, setname1.Z) ==> $a = $b * integer1.quotient($a, $b) + integer1.remainder($a, $b) and arith1.abs(integer1.remainder($a, $b)) < arith1.abs($b) and $a * integer1.remainder($a, $b) >= alg1.zero]
Rendered Presentation MathML
∀
a
,
b
.
a
∈
Z
∧
b
∈
Z
⇒
a
=
b
quotient
(
a
,
b
)
+
remainder
(
a
,
b
)
∧
|
remainder
(
a
,
b
)
|
<
|
b
|
∧
a
remainder
(
a
,
b
)
≥
0
Signatures:
sts