OpenMath Content Dictionary: rounding1
Canonical URL:
http://www.openmath.org/cd/rounding1.ocd
CD Base:
http://www.openmath.org/cd
CD File:
rounding1.ocd
CD as XML Encoded OpenMath:
rounding1.omcd
Defines:
ceiling , floor , round , trunc
Date:
2004-03-30
Version:
3
(Revision 2)
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
A CD of basic rounding concepts
Written by James Davenport, inspired by the need from bigfloat.ocd.
Finished 1999-10-24.
Role:
application
Description:
The round up (to +infinity) operation.
Commented Mathematical property (CMP):
for all x | ceiling(x)-1 < x <= ceiling x
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="x"/>
</OMBVAR>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="lt"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMA>
<OMS cd="rounding1" name="ceiling"/>
<OMV name="x"/>
</OMA>
<OMS cd="alg1" name="one"/>
</OMA>
<OMV name="x"/>
</OMA>
<OMA>
<OMS cd="relation1" name="leq"/>
<OMV name="x"/>
<OMA>
<OMS cd="rounding1" name="ceiling"/>
<OMV name="x"/>
</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>x</ci></bvar>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="relation1">lt</csymbol>
<apply><csymbol cd="arith1">minus</csymbol>
<apply><csymbol cd="rounding1">ceiling</csymbol><ci>x</ci></apply>
<csymbol cd="alg1">one</csymbol>
</apply>
<ci>x</ci>
</apply>
<apply><csymbol cd="relation1">leq</csymbol>
<ci>x</ci>
<apply><csymbol cd="rounding1">ceiling</csymbol><ci>x</ci></apply>
</apply>
</apply>
</bind>
</math>
Prefix
Popcorn
quant1.forall[$x -> rounding1.ceiling($x) - alg1.one < $x and $x <= rounding1.ceiling($x)]
Rendered Presentation MathML
∀
x
.
(
ceiling
(
x
)
-
1
)
<
x
∧
x
≤
ceiling
(
x
)
Signatures:
sts
Role:
application
Description:
The round down (to -infinity) operation.
Commented Mathematical property (CMP):
for all x | floor(x) <= x < floor(x)+1
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="x"/>
</OMBVAR>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="lt"/>
<OMV name="x"/>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMA>
<OMS cd="rounding1" name="floor"/>
<OMV name="x"/>
</OMA>
<OMS cd="alg1" name="one"/>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="leq"/>
<OMA>
<OMS cd="rounding1" name="floor"/>
<OMV name="x"/>
</OMA>
<OMV name="x"/>
</OMA>
</OMA>
</OMBIND>
</OMOBJ>
Strict Content MathML
<math xmlns="http://www.w3.org/1998/Math/MathML">
<bind><csymbol cd="quant1">forall</csymbol>
<bvar><ci>x</ci></bvar>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="relation1">lt</csymbol>
<ci>x</ci>
<apply><csymbol cd="arith1">plus</csymbol>
<apply><csymbol cd="rounding1">floor</csymbol><ci>x</ci></apply>
<csymbol cd="alg1">one</csymbol>
</apply>
</apply>
<apply><csymbol cd="relation1">leq</csymbol>
<apply><csymbol cd="rounding1">floor</csymbol><ci>x</ci></apply>
<ci>x</ci>
</apply>
</apply>
</bind>
</math>
Prefix
Popcorn
quant1.forall[$x -> $x < rounding1.floor($x) + alg1.one and rounding1.floor($x) <= $x]
Rendered Presentation MathML
∀
x
.
x
<
(
floor
(
x
)
+
1
)
∧
floor
(
x
)
≤
x
Signatures:
sts
Role:
application
Description:
The round to zero operation.
Commented Mathematical property (CMP):
for all x | trunc(x) <= x < trunc(x)+1 (x>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="x"/>
</OMBVAR>
<OMA>
<OMS cd="logic1" name="implies"/>
<OMA>
<OMS cd="relation1" name="geq"/>
<OMV name="x"/>
<OMS cd="alg1" name="zero"/>
</OMA>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="lt"/>
<OMV name="x"/>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMA>
<OMS cd="rounding1" name="trunc"/>
<OMV name="x"/>
</OMA>
<OMS cd="alg1" name="one"/>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="leq"/>
<OMA>
<OMS cd="rounding1" name="trunc"/>
<OMV name="x"/>
</OMA>
<OMV name="x"/>
</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>x</ci></bvar>
<apply><csymbol cd="logic1">implies</csymbol>
<apply><csymbol cd="relation1">geq</csymbol><ci>x</ci><csymbol cd="alg1">zero</csymbol></apply>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="relation1">lt</csymbol>
<ci>x</ci>
<apply><csymbol cd="arith1">plus</csymbol>
<apply><csymbol cd="rounding1">trunc</csymbol><ci>x</ci></apply>
<csymbol cd="alg1">one</csymbol>
</apply>
</apply>
<apply><csymbol cd="relation1">leq</csymbol>
<apply><csymbol cd="rounding1">trunc</csymbol><ci>x</ci></apply>
<ci>x</ci>
</apply>
</apply>
</apply>
</bind>
</math>
Prefix
Popcorn
quant1.forall[$x -> $x >= alg1.zero ==> $x < rounding1.trunc($x) + alg1.one and rounding1.trunc($x) <= $x]
Rendered Presentation MathML
∀
x
.
x
≥
0
⇒
x
<
(
trunc
(
x
)
+
1
)
∧
trunc
(
x
)
≤
x
Commented Mathematical property (CMP):
for all x | trunc(x) >= x > trunc(x)-1 (x<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="x"/>
</OMBVAR>
<OMA>
<OMS cd="logic1" name="implies"/>
<OMA>
<OMS cd="relation1" name="leq"/>
<OMV name="x"/>
<OMS cd="alg1" name="zero"/>
</OMA>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="gt"/>
<OMV name="x"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMA>
<OMS cd="rounding1" name="trunc"/>
<OMV name="x"/>
</OMA>
<OMS cd="alg1" name="one"/>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="geq"/>
<OMA>
<OMS cd="rounding1" name="trunc"/>
<OMV name="x"/>
</OMA>
<OMV name="x"/>
</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>x</ci></bvar>
<apply><csymbol cd="logic1">implies</csymbol>
<apply><csymbol cd="relation1">leq</csymbol><ci>x</ci><csymbol cd="alg1">zero</csymbol></apply>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="relation1">gt</csymbol>
<ci>x</ci>
<apply><csymbol cd="arith1">minus</csymbol>
<apply><csymbol cd="rounding1">trunc</csymbol><ci>x</ci></apply>
<csymbol cd="alg1">one</csymbol>
</apply>
</apply>
<apply><csymbol cd="relation1">geq</csymbol>
<apply><csymbol cd="rounding1">trunc</csymbol><ci>x</ci></apply>
<ci>x</ci>
</apply>
</apply>
</apply>
</bind>
</math>
Prefix
Popcorn
quant1.forall[$x -> $x <= alg1.zero ==> $x > rounding1.trunc($x) - alg1.one and rounding1.trunc($x) >= $x]
Rendered Presentation MathML
∀
x
.
x
≤
0
⇒
x
>
(
trunc
(
x
)
-
1
)
∧
trunc
(
x
)
≥
x
Signatures:
sts
Role:
application
Description:
The round to nearest operation.
Commented Mathematical property (CMP):
for all x | x <= round(x)+1/2 and x >= round(x)-1/2
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="x"/>
</OMBVAR>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="leq"/>
<OMV name="x"/>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMA>
<OMS cd="rounding1" name="round"/>
<OMV name="x"/>
</OMA>
<OMA>
<OMS cd="arith1" name="divide"/>
<OMS cd="alg1" name="one"/>
<OMI> 2 </OMI>
</OMA>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="geq"/>
<OMV name="x"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMA>
<OMS cd="rounding1" name="round"/>
<OMV name="x"/>
</OMA>
<OMA>
<OMS cd="arith1" name="divide"/>
<OMS cd="alg1" name="one"/>
<OMI> 2 </OMI>
</OMA>
</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>x</ci></bvar>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="relation1">leq</csymbol>
<ci>x</ci>
<apply><csymbol cd="arith1">plus</csymbol>
<apply><csymbol cd="rounding1">round</csymbol><ci>x</ci></apply>
<apply><csymbol cd="arith1">divide</csymbol>
<csymbol cd="alg1">one</csymbol>
<cn type="integer">2</cn>
</apply>
</apply>
</apply>
<apply><csymbol cd="relation1">geq</csymbol>
<ci>x</ci>
<apply><csymbol cd="arith1">minus</csymbol>
<apply><csymbol cd="rounding1">round</csymbol><ci>x</ci></apply>
<apply><csymbol cd="arith1">divide</csymbol>
<csymbol cd="alg1">one</csymbol>
<cn type="integer">2</cn>
</apply>
</apply>
</apply>
</apply>
</bind>
</math>
Prefix
Popcorn
quant1.forall[$x -> $x <= rounding1.round($x) + alg1.one / 2 and $x >= rounding1.round($x) - alg1.one / 2]
Rendered Presentation MathML
∀
x
.
x
≤
round
(
x
)
+
1
2
∧
x
≥
round
(
x
)
-
1
2
Commented Mathematical property (CMP):
for all x | Also round to even in event of a tie
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="x"/>
</OMBVAR>
<OMA>
<OMS cd="logic1" name="implies"/>
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="logic1" name="not"/>
<OMA>
<OMS cd="set1" name="in"/>
<OMV name="x"/>
<OMS cd="setname1" name="Z"/>
</OMA>
</OMA>
<OMA>
<OMS cd="set1" name="in"/>
<OMA>
<OMS cd="arith1" name="times"/>
<OMV name="x"/>
<OMI> 2 </OMI>
</OMA>
<OMS cd="setname1" name="Z"/>
</OMA>
</OMA>
<OMA>
<OMS cd="set1" name="in"/>
<OMA>
<OMS cd="arith1" name="divide"/>
<OMA>
<OMS cd="rounding1" name="round"/>
<OMV name="x"/>
</OMA>
<OMI> 2 </OMI>
</OMA>
<OMS cd="setname1" name="Z"/>
</OMA>
</OMA>
</OMBIND>
</OMOBJ>
Strict Content MathML
<math xmlns="http://www.w3.org/1998/Math/MathML">
<bind><csymbol cd="quant1">forall</csymbol>
<bvar><ci>x</ci></bvar>
<apply><csymbol cd="logic1">implies</csymbol>
<apply><csymbol cd="logic1">and</csymbol>
<apply><csymbol cd="logic1">not</csymbol>
<apply><csymbol cd="set1">in</csymbol><ci>x</ci><csymbol cd="setname1">Z</csymbol></apply>
</apply>
<apply><csymbol cd="set1">in</csymbol>
<apply><csymbol cd="arith1">times</csymbol><ci>x</ci><cn type="integer">2</cn></apply>
<csymbol cd="setname1">Z</csymbol>
</apply>
</apply>
<apply><csymbol cd="set1">in</csymbol>
<apply><csymbol cd="arith1">divide</csymbol>
<apply><csymbol cd="rounding1">round</csymbol><ci>x</ci></apply>
<cn type="integer">2</cn>
</apply>
<csymbol cd="setname1">Z</csymbol>
</apply>
</apply>
</bind>
</math>
Prefix
Popcorn
quant1.forall[$x -> not(set1.in($x, setname1.Z)) and set1.in($x * 2, setname1.Z) ==> set1.in(rounding1.round($x) / 2, setname1.Z)]
Rendered Presentation MathML
∀
x
.
¬
(
x
∈
Z
)
∧
x
2
∈
Z
⇒
round
(
x
)
2
∈
Z
Signatures:
sts