forked from OpenMath/OMSTD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
omstd20.xml
6420 lines (5595 loc) · 250 KB
/
omstd20.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- @version CVS $Id: omstd20.xml,v 1.146 2004/07/13 16:17:08 openmath Exp $ -->
<!DOCTYPE book
SYSTEM "docbook/docbookx.dtd"
[
<!--
docbook customisations:
add MathML
allow sidebar in figures (used for change log)
add author attribute to sidebar
add xml:space (to correct for IE bug, dropping spaces)
-->
<!-- allow style attribute everywhere -->
<!--
<!ENTITY % local.common.attrib "style CDATA #IMPLIED">
-->
<!ENTITY % local.para.char.mix "|xs:schema|comment|string|grammar|CD|CDSignatures|CDGroup">
<!ENTITY % inlineobj.char.class "math">
<!ATTLIST book xml:space (default|preserve) #IMPLIED >
<!--
MathML DTD (somewhat simplified)
-->
<!ELEMENT math (mrow|mn|mi|mo|msub|msup|mtext|mspace|mfrac|mfenced)+>
<!--
IE Bug doesn't allow this, so switch to mml namespace via stylesheet
xmlns CDATA #FIXED "http://www.w3.org/1998/Math/MathML"
-->
<!ATTLIST math
id ID #IMPLIED
display CDATA #IMPLIED
class CDATA #IMPLIED
revisionflag CDATA #IMPLIED
>
<!ELEMENT mfenced (mrow|mn|mi|mo|msub|msup|mtext|mspace|mfrac|mfenced)+>
<!ELEMENT mrow (mrow|mn|mi|mo|msub|msup|mtext|mspace|mfrac|mfenced)+>
<!ELEMENT mn (#PCDATA)>
<!ELEMENT mi (#PCDATA)>
<!ATTLIST mi
mathcolor CDATA #IMPLIED
mathvariant (bold) #IMPLIED>
<!ELEMENT mo (#PCDATA)>
<!ATTLIST mo
fence CDATA #IMPLIED
separator CDATA #IMPLIED>
<!ELEMENT msup ((mn|mi|mo|mrow),(mn|mi|mo|mrow))>
<!ELEMENT msub ((mn|mi|mo|mrow),(mn|mi|mo|mrow))>
<!ELEMENT mfrac ((mn|mi|mo|mrow),(mn|mi|mo|mrow))>
<!ELEMENT mtext (#PCDATA)>
<!ELEMENT mspace EMPTY>
<!ATTLIST mspace width CDATA #IMPLIED
linebreak CDATA #IMPLIED>
<!ELEMENT comment (#PCDATA|token)*>
<!ELEMENT string (#PCDATA|token)*>
<!ELEMENT xs:any ANY>
<!ATTLIST xs:any
processContents CDATA #IMPLIED
namespace CDATA #IMPLIED
>
<!ELEMENT xs:enumeration ANY>
<!ATTLIST xs:enumeration
value CDATA #IMPLIED
>
<!ELEMENT xs:attributeGroup ANY>
<!ATTLIST xs:attributeGroup
ref CDATA #IMPLIED
name CDATA #IMPLIED
>
<!ELEMENT xs:schema ANY>
<!ATTLIST xs:schema
elementFormDefault CDATA #IMPLIED
targetNamespace CDATA #IMPLIED
xmlns CDATA #IMPLIED
xmlns:xs CDATA #IMPLIED
xmlns:om CDATA #IMPLIED
>
<!ELEMENT xs:choice ANY>
<!ATTLIST xs:choice
maxOccurs CDATA #IMPLIED
minOccurs CDATA #IMPLIED
>
<!ELEMENT xs:sequence ANY>
<!ATTLIST xs:sequence
maxOccurs CDATA #IMPLIED
minOccurs CDATA #IMPLIED
>
<!ELEMENT xs:group ANY>
<!ATTLIST xs:group
ref CDATA #IMPLIED
name CDATA #IMPLIED
maxOccurs CDATA #IMPLIED
minOccurs CDATA #IMPLIED
>
<!ELEMENT xs:complexType ANY>
<!ATTLIST xs:complexType
mixed CDATA #IMPLIED
>
<!ELEMENT xs:import ANY>
<!ATTLIST xs:import
namespace CDATA #IMPLIED
schemaLocation CDATA #IMPLIED
>
<!ELEMENT xs:pattern ANY>
<!ATTLIST xs:pattern
value CDATA #IMPLIED
>
<!ELEMENT xs:simpleType ANY>
<!ELEMENT xs:simpleContent ANY>
<!ELEMENT xs:restriction ANY>
<!ATTLIST xs:restriction
base CDATA #IMPLIED
>
<!ELEMENT xs:extension ANY>
<!ATTLIST xs:extension
base CDATA #IMPLIED
>
<!ELEMENT xs:element ANY>
<!ATTLIST xs:element
ref CDATA #IMPLIED
name CDATA #IMPLIED
>
<!ELEMENT xs:attribute ANY>
<!ATTLIST xs:attribute
ref CDATA #IMPLIED
type CDATA #IMPLIED
use CDATA #IMPLIED
name CDATA #IMPLIED
>
<!ELEMENT grammar ANY>
<!ATTLIST grammar
datatypeLibrary CDATA #IMPLIED
name CDATA #IMPLIED
xmlns CDATA #IMPLIED
ns CDATA #IMPLIED>
<!ELEMENT define ANY>
<!ATTLIST define
name CDATA #IMPLIED
>
<!ELEMENT choice ANY>
<!ELEMENT ref EMPTY>
<!ATTLIST ref
name CDATA #IMPLIED
>
<!ELEMENT anyName ANY>
<!ELEMENT zeroOrMore ANY>
<!ELEMENT oneOrMore ANY>
<!ELEMENT nsName ANY>
<!ELEMENT value ANY>
<!ELEMENT start ANY>
<!ELEMENT except ANY>
<!ELEMENT text ANY>
<!ELEMENT param ANY>
<!ATTLIST param
name CDATA #IMPLIED
>
<!ELEMENT data ANY>
<!ATTLIST data
type CDATA #IMPLIED
>
<!ELEMENT element ANY>
<!ATTLIST element
name CDATA #IMPLIED
>
<!ELEMENT attribute ANY>
<!ATTLIST attribute
name CDATA #IMPLIED
>
<!ENTITY % group.module "IGNORE">
<!ELEMENT group ANY>
<!ENTITY % optional.module "IGNORE">
<!ELEMENT optional ANY>
<!ATTLIST optional
name CDATA #IMPLIED>
<!--
Abbreviations used in this document
-->
<!ENTITY OM "<emphasis>OpenMath</emphasis>">
<!ENTITY exml "<acronym>xml</acronym>">
<!ENTITY digits "0-9">
<!ENTITY exadigits "0-9A-F">
<!ENTITY lcalpha "a-z">
<!ENTITY ucalpha "A-Z">
<!ENTITY sign "[+-]"><!-- dpc: Correct regxp for + or - -->
<!ENTITY zsp "">
<!ENTITY longrightarrow "<mo>→</mo>"><!--dpc: short, actually -->
<!ENTITY varnamechar "+=(),-./:?!#$%*;@[]^_`{|}"><!-- dpc: remove `TeX error? -->
<!ENTITY omrnc SYSTEM "openmath2rnc.xml">
<!ENTITY cdrnc SYSTEM "omcd2rnc.xml">
<!ENTITY sigrnc SYSTEM "omcdsig2rnc.xml">
<!ENTITY cdgrouprnc SYSTEM "omcdgroup2rnc.xml">
<!ENTITY mathmlcdg SYSTEM "mathml.cdg">
<!ENTITY omxsd SYSTEM "openmath2.xsd">
<!ENTITY omdtd SYSTEM "openmath2dtd.xml">
<!ENTITY omrng SYSTEM "openmath2.rng">
<!ENTITY cdrng SYSTEM "omcd2.rng">
<!ENTITY sigrng SYSTEM "omcdsig2.rng">
<!ENTITY % openmath2 SYSTEM "openmath2.dtd">
%openmath2;
<!ENTITY % omdtd "">
<!ENTITY % omcd2 SYSTEM "omcd2.dtd">
%omcd2;
<!ENTITY % omcdsig2 SYSTEM "omcdsig2.dtd">
%omcdsig2;
<!--
Can't include this as name clashes with CD dtd (as DTD not namespace
aware) so include subset of the DTD inline below.
<!ENTITY % omcdgroup2 SYSTEM "omcdgroup2.dtd">
%omcdgroup2;
-->
<!ELEMENT CDGroupName (#PCDATA)>
<!ELEMENT CDGroupVersion (#PCDATA)>
<!ELEMENT CDGroupRevision (#PCDATA)>
<!ELEMENT CDGroupURL (#PCDATA)>
<!ELEMENT CDGroupDescription (#PCDATA)>
<!ELEMENT CDGroupMember (CDComment?,CDName,CDVersion?,CDURL?)>
<!ELEMENT CDGroup (CDGroupName,CDGroupVersion,CDGroupRevision?,
CDGroupURL,CDGroupDescription,
(CDGroupMember|CDComment)*)>
<!ATTLIST CDGroup
xmlns CDATA #FIXED 'http://www.openmath.org/OpenMathCDG'>
<!ENTITY metacd SYSTEM "meta.ocd">
<!ENTITY arith1cd SYSTEM "arith1.ocd">
<!ENTITY arith1sts SYSTEM "arith1.sts">
<!ENTITY errorcd SYSTEM "error.ocd">
]>
<book xml:space="preserve">
<title>The &OM; Standard</title>
<bookinfo>
<releaseinfo>2.0r1</releaseinfo>
<author><firstname>The &OM; Society</firstname></author>
<editor><firstname>S.</firstname><surname>Buswell</surname></editor>
<editor><firstname>O.</firstname><surname>Caprotti</surname></editor>
<editor><firstname>D.</firstname><othername>P.</othername><surname>Carlisle</surname></editor>
<editor><firstname>M.</firstname><othername>C.</othername><surname>Dewar</surname></editor>
<editor><firstname>M.</firstname><surname role="finaledit">Gaëtano</surname></editor>
<editor><firstname>M.</firstname><surname>Kohlhase</surname></editor>
<editor><firstname>J.</firstname><othername>H.</othername><surname>Davenport (revision 1)</surname></editor>
<editor><firstname>P.</firstname><othername>D.F.</othername><surname>Ion (revision 1)</surname></editor>
<date>June 2017</date>
<copyright>
<year>2000–2017</year>
<holder>The OpenMath Society</holder>
</copyright>
<abstract>
<para revisionflag="changed">This document describes version 2 revision 1 of
&OM;: a standard for
the representation and communication of mathematical objects.
<phrase role="finaledit">This revision clarifies the first &OM; 2.0
<citation>OM_2.0r0</citation>.</phrase>
&OM;
allows the <emphasis>meaning</emphasis> of an object to be encoded
rather than just a visual representation. It is designed to allow the
free exchange of mathematical objects between software systems and human
beings. On the worldwide web it is designed to allow mathematical
expressions embedded in web pages to be manipulated and used in computations in
a meaningful and correct way. It is designed to be machine-generatable
and machine-readable, rather than written by hand.
</para>
<para revisionflag="changed">The &OM; Standard is the official reference for
the &OM; language and has been approved by the &OM; Society. It is not
intended as an introductory document or a user's guide, for the latest
available material of this nature, and the latest version of the standard,
please consult the &OM; web-site at
<ulink url="http://www.openmath.org">http://www.openmath.org</ulink>.</para>
<para revisionflag="changed">This document includes an overview of the
&OM; architecture, an abstract description of &OM; objects and two
mechanisms for producing concrete encodings of such objects. The first,
in &exml; (either innate or Strict Content MathML), is designed primarily
for use on the web, in documents, and
for applications which want to mix &OM; as a content representation with
MathML as a presentation format. The second, a binary format, is
designed for applications which wish to exchange very large objects, or
a lot of data as efficiently as possible. This document also includes a
description of Content Dictionaries - the mechanism by which the meaning
of a symbol in the &OM; language is encoded, as well as an XML encoding
for them. Finally it includes guidelines for the development of
&OM;-compliant applications. <phrase role="finaledit">Further background
on &OM; and guidelines for its use in applications may be found in the
accompanying Primer <citation>OM_primer</citation>.</phrase></para>
</abstract>
</bookinfo>
<toc/>
<lot><title>List of Figures</title></lot>
<chapter id="cha_int">
<title>Introduction to &OM;</title>
<para>This chapter briefly introduces &OM; concepts and notions that are
referred to in the rest of this document.</para>
<section id="sec_om-arch">
<title>&OM; Architecture</title>
<figure id="fig_om">
<title>The &OM; Architecture</title>
<graphic fileref="om-arch" depth="500" width="700"/>
</figure>
<para>The architecture of &OM; is described in <xref
linkend="fig_om"/> and summarizes the interactions among the different
&OM; components. There are three layers of representation of a
mathematical object. The first is a private layer that
is the internal representation used by an application. The second is
an abstract layer that is the representation as an &OM; object.
<phrase>Note that these
two layers may, in some cases, be the same.</phrase>
The third is a
communication layer that translates the &OM; object representation into
a stream of bytes. An application dependent program manipulates the
mathematical objects using its internal representation, it can convert
them to &OM; objects and communicate them by using the byte stream
representation of &OM; objects.</para>
</section>
<section id="sec_intro-obj">
<title>&OM; Objects and Encodings</title>
<para>&OM; objects are representations of mathematical entities that
can be communicated among various software applications in a
meaningful way, that is, preserving their
<quote>semantics</quote>.</para>
<para>&OM; objects and encodings are described in detail in <xref
linkend="cha_obj"/> and <xref linkend="cha_enco"/>.</para>
<para revisionflag="changed">The standard endorses two encodings
in &exml; (an innate one described here, and one in Strict Content
MathML) and a binary format.
<phrase>At the time of writing, these are the encodings
supported by most existing &OM; tools and applications,</phrase>
however they are not the only possible encodings of &OM;
objects. Users who wish to define their own encoding<phrase>,
are free to</phrase>
do so provided that there is
<phrase>a well-defined correspondence
between the new encoding and the abstract model defined in <xref
linkend="cha_obj"/>. </phrase>
</para>
</section>
<section id="sec_intro-cd">
<title>Content Dictionaries</title>
<para>Content Dictionaries (CDs) are used to assign informal and formal
semantics to all symbols used in the &OM; objects. They define the
symbols used to represent concepts arising in a particular area of
mathematics.</para>
<para>The Content Dictionaries are public, they represent the actual
common knowledge among &OM; applications. Content Dictionaries fix
the <quote>meaning</quote> of objects independently of the
application. The application receiving the object may then recognize
whether or not, according to the semantics of the symbols defined in
the Content Dictionaries, the object can be transformed to the
corresponding internal representation used by the application.</para>
</section>
<section id="sec_addnfiles">
<title>Additional Files</title>
<para>Several
additional files are related to Content Dictionaries. Signature
<phrase>Dictionaries</phrase>
contain the signatures of symbols defined in some &OM; Content
Dictionary and their format is endorsed by this standard.</para>
<para>Furthermore, the standard fixes how to define a specific
set of Content Dictionaries as a CDGroup.</para>
<para>Auxiliary files that define presentation and rendering or that
are used for manipulating and processing Content Dictionaries are not
discussed by the standard.</para>
</section>
<section id="sec_phrasebooks">
<title>Phrasebooks</title>
<para>The conversion of an &OM; object to/from the internal
representation in a software application is performed by an interface
program called a <emphasis>Phrasebook</emphasis>. The translation is
governed by the Content Dictionaries and the specifics of the
application. It is envisioned that a software application dealing with
a specific area of mathematics declares which Content Dictionaries it
understands. As a consequence, it is expected that the Phrasebook of
the application is able to translate &OM; objects built using symbols
from these Content Dictionaries to/from the internal mathematical
objects of the application.
</para>
<para>&OM; objects do not
specify any computational behaviour, they merely represent mathematical
expressions. Part of the &OM; philosophy is to leave it to the
application to decide what it does with an object once it has received
it. &OM; is not a query or programming language. Because of this,
&OM; does not prescribe a way of forcing <quote>evaluation</quote> or
<quote>simplification</quote> of objects like
<math><mn>2</mn><mo>+</mo><mn>3</mn></math> or
<math><mi>sin</mi><mo>(</mo><mi>π</mi><mo>)</mo></math>. Thus,
the same object <math><mn>2</mn><mo>+</mo><mn>3</mn></math> could be
transformed to <math><mn>5</mn></math> by a computer algebra system,
or displayed as <math><mn>2</mn><mo>+</mo><mn>3</mn></math> by a
typesetting tool.</para>
</section>
</chapter>
<chapter id="cha_obj">
<title>&OM; Objects</title>
<para>In this chapter we provide a self-contained description of &OM;
objects. We first do so by means of an abstract grammar
description (<xref linkend="sec_omabs"/>)
and then give a more informal description (<xref
linkend="sec_omin"/>).</para>
<section id="sec_omabs">
<title>Formal Definition of &OM; Objects</title>
<para>&OM; represents mathematical objects as terms or as labelled
trees that are called &OM; objects or &OM; expressions. The definition
of an abstract &OM; object is then the following.</para>
<section id="sec_basic">
<title>Basic &OM; objects</title> <para>The Basic &OM; Objects form
the leaves of the &OM; Object tree. A Basic &OM; Object is of one of
the following.</para>
<itemizedlist>
<listitem><para><phrase>(i)</phrase> Integer.</para> <para>Integers in
the mathematical sense, with no predefined range. They are
<quote>infinite precision</quote> integers (also called
<quote>bignums</quote> in computer algebra).</para>
</listitem>
<listitem><para><phrase>(ii)</phrase> <acronym>ieee</acronym> floating point
number.</para> <para>Double precision floating-point numbers
following the <acronym>ieee</acronym> 754-1985
standard <citation>ieee754_85</citation>.</para>
</listitem>
<listitem><para><phrase>(iii)</phrase> Character string.</para>
<para>A Unicode Character string. This also corresponds to
<quote>characters</quote> in
&exml;.</para>
</listitem>
<listitem><para><phrase>(iv)</phrase> Bytearray.</para>
<para>A sequence of bytes.</para>
</listitem>
<listitem><para><phrase>(v)</phrase> Symbol.</para>
<para>A Symbol encodes three fields of
information, a <emphasis>symbol name</emphasis>, a <emphasis>Content
Dictionary name</emphasis>, and (optionally) a <emphasis>Content
Dictionary base URI</emphasis>, The name of a symbol is a sequence
of characters matching the regular expression described in <xref
linkend="sec_names"/>. The Content Dictionary is the location of
the definition of the symbol, consisting of a name (a sequence of
characters matching the regular expression described in <xref
linkend="sec_names"/>) and, optionally, a unique prefix called a
<emphasis>cdbase</emphasis> which is used to disambiguate multiple
Content Dictionaries of the same name. There are other properties
of the symbol that are not explicit in these fields but whose
values may be obtained by inspecting the Content Dictionary
specified. These include the symbol definition, formal properties
and examples and, optionally, a <emphasis>Role</emphasis> which is
a restriction on where the symbol may appear in an &OM; object. The
possible roles are described in <xref linkend="sec_roles"/>.
</para>
</listitem>
<listitem><para><phrase>(vi)</phrase> Variable.</para>
<para>A Variable <phrase>must have</phrase> a
<emphasis>name</emphasis> which is a sequence of characters matching a
regular expression, as described in <xref linkend="sec_names"/>.
</para>
</listitem>
</itemizedlist>
</section>
<section id="sec_derived">
<title>Derived &OM; Objects</title>
<para>Derived &OM; objects are currently used as a way by which non-&OM;
data is embedded inside an &OM; object.
A derived &OM; object is built as follows:
<itemizedlist>
<listitem><para><phrase>(i)</phrase> If <math><mi>A</mi></math> is
<emphasis>not</emphasis> an &OM; object, then <math><mi
mathvariant="bold">foreign</mi><mfenced><mi>A</mi></mfenced></math> is an &OM;
<emphasis>foreign object</emphasis>. An &OM; foreign object may optionally
have an <emphasis>encoding</emphasis> field which describes how its contents
should be interpreted.</para>
</listitem>
</itemizedlist>
</para>
</section>
<section id="sec_compound">
<title>&OM; Objects</title>
<para>&OM; objects are built recursively as follows.
<itemizedlist>
<listitem><para><phrase>(i)</phrase> Basic &OM; objects are &OM; objects.
(<phrase>Note that derived &OM; objects are
<emphasis>not</emphasis> &OM; objects, but are used to construct &OM;
objects as described below.)</phrase></para>
</listitem>
<listitem>
<para>
<phrase>(ii)</phrase> If
<math><msub><mi>A</mi><mn>1</mn></msub></math>,
<phrase>…</phrase>,
<math><msub><mi>A</mi><mi>n</mi></msub></math>
<math><mo>(</mo><mi>n</mi><mo>></mo><mn>0</mn><mo>)</mo></math>
are &OM; objects, then
<math display="block">
<mi mathvariant="bold">application</mi><mo>(</mo><msub><mi>A</mi><mn>1</mn></msub><mo>,</mo> <mi>…</mi><mo>,</mo> <msub><mi>A</mi><mi>n</mi></msub><mo>)</mo>
</math>
is an &OM; <emphasis>application object</emphasis>.</para>
</listitem> <listitem><para><phrase>(iii)</phrase> If
<math><msub><mi>S</mi><mn>1</mn></msub><mo>,</mo>
<mi>…</mi><mo>,</mo> <msub><mi>S</mi><mi>n</mi></msub></math>
are &OM; symbols, and
<phrase>
<math><mi>A</mi></math> is an &OM; object, and
<math><msub><mi>A</mi><mn>1</mn></msub></math>,
<phrase>…</phrase>, <math><msub><mi>A</mi><mi>n</mi></msub></math> <math><mo>(</mo><mi>n</mi><mo>></mo><mn>0</mn><mo>)</mo></math> are &OM; objects or &OM; derived objects, then
</phrase>
<math display="block"><mi mathvariant="bold">attribution</mi>
<mo>(</mo><mi>A</mi><mo>,</mo> <msub><mi>S</mi><mn>1</mn></msub>
<mspace width=".3em"/> <msub><mi>A</mi><mn>1</mn></msub><mo>,</mo>
<mspace width=".3em"/> <mi>…</mi> <mspace width=".3em"/>
<mo>,</mo> <msub><mi>S</mi><mi>n</mi></msub> <mspace width=".3em"/>
<msub><mi>A</mi><mi>n</mi></msub><mo>)</mo></math> is an &OM;
<emphasis>attribution object</emphasis>.
</para>
<para>
<math><mi>A</mi></math>
is the object <emphasis>stripped of attributions</emphasis>. <phrase
>
<math><msub><mi>S</mi><mn>1</mn></msub><mo>,</mo>
<mi>…</mi><mo>,</mo> <msub><mi>S</mi><mi>n</mi></msub></math>
are referred to as <emphasis>keys</emphasis> and
<math><msub><mi>A</mi><mn>1</mn></msub></math>,
<phrase>…</phrase>,
<math><msub><mi>A</mi><mi>n</mi></msub></math> as their associated
<emphasis>values</emphasis></phrase>.
<phrase >If, after recursively
applying stripping to remove attributions, the resulting
un-attributed object is a
variable, the original attributed object is called an <emphasis>attributed
variable</emphasis>.</phrase>
</para>
</listitem>
<listitem><para><phrase>(iv)</phrase> If <math><mi>B</mi></math> and
<math><mi>C</mi></math> are &OM; objects, and
<math><msub><mi>v</mi><mn>1</mn></msub></math>,
<math><mi>…</mi></math>,
<math><msub><mi>v</mi><mi>n</mi></msub></math>
<math><mo>(</mo><mi>n</mi> <mo>≥</mo>
<mn>0</mn><mo>)</mo></math> are &OM; variables or attributed
variables, then
<math display="block">
<mi mathvariant="bold">binding</mi> <mo>(</mo><mi>B</mi><mo>,</mo> <msub><mi>v</mi><mn>1</mn></msub><mo>,</mo> <mi>…</mi><mo>,</mo> <msub><mi>v</mi><mi>n</mi></msub><mo>,</mo> <mi>C</mi><mo>)</mo>
</math>
is an &OM; <emphasis>binding object</emphasis>.</para>
</listitem>
<listitem><para><phrase>(v)</phrase> If <math><mi>S</mi></math> is an
&OM; symbol and <math><msub><mi>A</mi><mn>1</mn></msub></math>,
<phrase>…</phrase>,
<math><msub><mi>A</mi><mi>n</mi></msub></math>
<math><mo>(</mo><mi>n</mi> <mo>≥</mo>
<mn>0</mn><mo>)</mo></math> are &OM; objects
<phrase> or &OM; derived objects</phrase>, then <math
display="block"><mi mathvariant="bold">error</mi>
<mo>(</mo><mi>S</mi><mo>,</mo>
<msub><mi>A</mi><mn>1</mn></msub><mo>,</mo><mi>…</mi><mo>,</mo><msub><mi>A</mi><mi>n</mi></msub><mo>)</mo>
</math>
is an &OM; <emphasis>error object</emphasis>.</para>
</listitem>
</itemizedlist>
<phrase>&OM; objects that are contstructed via rules (ii)
to (v) are jointly called <phrase role="sl">compound &OM; objects</phrase></phrase>
</para>
</section>
<section id="sec_roles">
<title>&OM; Symbol Roles</title>
<para>
We say that an &OM; symbol is used to <emphasis>construct</emphasis>
an &OM; object if it is the first child of an &OM; application,
binding or error object, or an even-indexed child of an &OM;
attribution object (i.e. the <emphasis>key</emphasis> in a
<emphasis>(key, value)</emphasis> pair).
The <emphasis>role</emphasis> of an &OM; symbol is a restriction
on how it may be used to construct a compound &OM; object and, in the
case of the key in an attribution object, a clarification of how that
attribution should be interpreted. <phrase role="finaledit">The </phrase>possible roles are:
<orderedlist numeration="lowerroman">
<listitem><para><emphasis>binder</emphasis> The symbol may
appear as the first child of an &OM; binding object.
</para></listitem>
<listitem><para> <emphasis>attribution</emphasis> The symbol may
be used as key in an &OM; attribution object, i.e. as the first
element of a (key, value) pair, or in an equivalent context (for example
to refer to the value of an attribution). This form of attribution
may be ignored by an application, so should be used for information
which does not change the meaning of the attributed &OM; object.
</para></listitem>
<listitem><para> <emphasis>semantic-attribution</emphasis> This is the
same as <emphasis>attribution</emphasis> except that it modifies the
meaning of the attributed &OM; object and thus cannot be ignored by an
application<phrase role="finaledit">, without changing the meaning</phrase>. </para></listitem>
<listitem><para> <emphasis>error</emphasis> The symbol <phrase role="finaledit">may</phrase> appear
as the first child of an &OM; error object. </para></listitem>
<listitem><para> <emphasis>application</emphasis> The symbol <phrase role="finaledit">may</phrase> appear
as the first child of an &OM; application object. </para></listitem>
<listitem><para> <emphasis>constant</emphasis> The symbol cannot be
used to construct an &OM; compound object.
</para></listitem>
</orderedlist>
A symbol cannot have more than one role and
cannot be used to construct a compound &OM; object in a way
which requires a different role (using the definition of construct given
earlier in this section).
This means that one cannot use a symbol which binds some variables to
construct, say, an application object. However it does not prevent
the use of that symbol as an <emphasis>argument</emphasis> in an
application object (where by argument we mean a child with index
greater than 1).
</para>
<para>
If no role is indicated then the symbol can be used anywhere. Note
that this is not the same as saying that the symbol's role is
<emphasis>constant</emphasis>.
</para>
</section>
</section>
<section id="sec_omin">
<title>Further Description of &OM; Objects</title>
<para>Informally, an &OM; <phrase role="sl">object</phrase> can be
viewed as a tree and is also referred to as a term. The objects at
the leaves of &OM; trees are called <phrase role="sl">basic
objects</phrase>. The basic objects supported by &OM; are:
<variablelist>
<varlistentry><term>Integer</term><listitem><para>Arbitrary Precision
integers.</para> </listitem></varlistentry>
<varlistentry><term>Float</term><listitem> <para>&OM; floats are
<acronym>ieee</acronym> 754 Double precision floating-point
numbers. Other types of floating point number may be encoded in &OM;
by the use of suitable content dictionaries.</para>
</listitem>
</varlistentry>
<varlistentry><term>Character strings</term><listitem><para>are
sequences of characters. These characters come from the Unicode
standard <citation>UNICODE</citation>.</para>
</listitem></varlistentry>
<varlistentry><term>Bytearrays</term><listitem><para>are sequences of
bytes. There is no <quote>byte</quote> in &OM; as an object of its
own. However, a single byte can of course be represented by a
bytearray of length 1. The difference between strings and bytearrays
is the following: a character string is a sequence of bytes with a
fixed interpretation (as characters, Unicode texts may require several
bytes to code one character), whereas a bytearray is an uninterpreted
sequence of bytes with no intrinsic meaning. Bytearrays could be used
inside &OM; errors to provide information to, for example, a debugger;
they could also contain intermediate results of calculations, or
<quote>handles</quote> into computations or databases.</para>
</listitem>
</varlistentry>
<varlistentry><term>Symbols</term><listitem>
<para>
are uniquely defined by the Content Dictionary in which they occur
and by a name.
The form of these definitions is explained in
<xref linkend="cha_cd"/>. Each symbol has no more than one
definition in a Content Dictionary. Many Content Dictionaries may
define differently a symbol with the same name (e.g. the symbol
<systemitem>union</systemitem> is defined as
associative-commutative set theoretic union in a Content Dictionary
<systemitem>set1</systemitem> but another Content Dictionary,
<systemitem>multiset1</systemitem> might define a symbol
<systemitem>union</systemitem> as the union of multi-sets).
</para>
</listitem>
</varlistentry>
<varlistentry><term>Variables</term><listitem><para>are meant to
denote parameters, variables or indeterminates (such as bound
variables of function definitions, variables in summations and
integrals, independent variables of derivatives).
</para>
</listitem>
</varlistentry>
</variablelist> </para>
<para>Derived &OM; objects are constructed from
non-&OM; data. They differ from bytearrays in that they can have any
structure. Currently there is only one way of making a derived &OM;
object.</para>
<variablelist>
<varlistentry><term>Foreign</term><listitem><para>is used to import a
non-&OM; object into an &OM; attribution. Examples of its use could
be to annotate a formula with a visual or aural rendering, an
animation, etc. They may also appear in &OM; error objects, for
example to allow an application to report an error in processing such
an object.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>The four following constructs can be used to make compound
&OM; objects <phrase> out of basic or derived &OM;
objects</phrase>.</para>
<variablelist>
<varlistentry><term>Application</term><listitem><para>constructs an
&OM; object from a sequence of one or more &OM; objects. The first
<phrase role="finaledit">child</phrase>
of an application is referred to as its <quote>head</quote> while
the remaining objects are called its <quote>arguments</quote>. An &OM;
application object can be used to convey the mathematical notion of
application of a function to a set of arguments. For instance,
suppose that the &OM; symbol <math><mi>sin</mi></math> is defined in
a <phrase>suitable</phrase> Content Dictionary,
then <math><mi
mathvariant="bold">application</mi><mo>(</mo><mi>sin</mi><mo>,</mo>
<mi>x</mi> <mo>)</mo></math> is the abstract &OM; object
corresponding to <math><mi>sin</mi> <mo>(</mo><mi>x</mi>
<mo>)</mo></math>. More generally, an &OM; application object can
be used as a constructor to convey a mathematical object built from
other objects such as a polynomial constructed from a set of
monomials. Constructors build inhabitants of some symbolic type,
for instance the type of rational numbers or the type of
polynomials. The rational number, usually denoted as
<math><mn>1</mn><mo>/</mo><mn>2</mn></math>, is represented by the
&OM; application object <math><mi
mathvariant="bold">application</mi><mo>(</mo><mi>Rational</mi><mo>,</mo>
<mn>1</mn><mo>,</mo> <mn>2</mn><mo>)</mo></math>. The symbol
<math><mi>Rational</mi></math> must be defined, by a Content
Dictionary, as a constructor symbol for the rational numbers.</para>
<figure id="fig_obj">
<title>The &OM; application and binding objects for
<math><mi>sin</mi> <mo>(</mo><mi>x</mi> <mo>)</mo></math> and
<math><mi>λ</mi> <mi>x</mi><mo>.</mo><mi>x</mi> <mo>+</mo>
<mn>2</mn></math> in tree-like notation.</title> <graphic fileref="lambda"
width="600" depth="190"/>
</figure>
</listitem>
</varlistentry>
<varlistentry><term>Binding</term><listitem><para>objects are
constructed from an &OM; object, and from a sequence of zero or more
variables followed by another &OM; object. The first &OM; object is
the <quote>binder</quote> object. Arguments 2 to
<math><mi>n</mi><mo>-</mo><mn>1</mn></math> are always variables to
be bound in the <quote>body</quote> which is the
<math><msup><mi>n</mi><mi>th</mi></msup></math> argument object. It
is allowed to have no bound variables, but the binder object and the
body should be present. Binding can be used to express functions or
logical statements. The function <math><mi>λ</mi>
<mi>x</mi><mo>.</mo><mi>x</mi> <mo>+</mo><mn>2</mn></math>, in which
the variable <math><mi>x</mi></math> is bound by
<math><mi>λ</mi></math>, corresponds to a binding object having
as binder the &OM; symbol <math><mi>lambda</mi></math>: <math
display="block"><mi
mathvariant="bold">binding</mi><mo>(</mo><mi>lambda</mi><mo>,</mo>
<mi>x</mi> <mo>,</mo> <mi
mathvariant="bold">application</mi><mo>(</mo><mi>plus</mi><mo>,</mo>
<mi>x</mi> <mo>,</mo>
<mn>2</mn><mo>)</mo><mo>)</mo><mtext>.</mtext></math></para>
<para>Phrasebooks are allowed to use <math><mi>α</mi></math>
conversion in order to avoid clashes of variable names. Suppose an
object <math><mi>Ω</mi></math> contains an occurrence of the
object <math><mi mathvariant="bold">binding</mi>
<mo>(</mo><mi>B</mi> <mo>,</mo> <mi>v</mi> <mo>,</mo> <mi>C</mi>
<mo>)</mo></math>. This object <math><mi
mathvariant="bold">binding</mi> <mo>(</mo><mi>B</mi> <mo>,</mo>
<mi>v</mi> <mo>,</mo> <mi>C</mi> <mo>)</mo></math> can be replaced
in <math><mi>Ω</mi></math> by <math><mi
mathvariant="bold">binding</mi> <mo>(</mo><mi>B</mi> <mo>,</mo>
<mi>z</mi> <mo>,</mo> <mi>C'</mi><mo>)</mo></math> where
<math><mi>z</mi></math> is a variable not occurring free in
<math><mi>C</mi></math> and <math><mi>C'</mi></math> is obtained
from <math><mi>C</mi></math> by replacing each free (i.e., not bound
by any intermediate <varname>binding</varname> construct) occurrence
of <math><mi>v</mi></math> by <math><mi>z</mi></math>. This
operation preserves the semantics of the object
<math><mi>Ω</mi></math>. In the above example, a phrasebook is
thus allowed to transform the object to, e.g.
<math display="block"><mi
mathvariant="bold">binding</mi><mo>(</mo><mi>lambda</mi><mo>,</mo>
<mi>z</mi> <mo>,</mo> <mi
mathvariant="bold">application</mi><mo>(</mo><mi>plus</mi><mo>,</mo>
<mi>z</mi> <mo>,</mo>
<mn>2</mn><mo>)</mo><mo>)</mo><mtext>.</mtext></math>
</para>
<para>Repeated occurrences of the same variable in a binding operator
are allowed. An &OM; application should treat a binding with
multiple occurrences of the same variable as equivalent to the
binding in which all but the last occurrence of each variable is
replaced by a new variable which does not occur free in the body of
the binding. <math display="block"><mi
mathvariant="bold">binding</mi> <mo>(</mo><mi>lambda</mi><mo>,</mo>
<mi>v</mi> <mo>,</mo> <mi>v</mi> <mo>,</mo><mi
mathvariant="bold">application</mi>
<mo>(</mo><mi>times</mi><mo>,</mo><mi>v</mi>
<mo>,</mo><mi>v</mi><mo>)</mo> <mo>)</mo></math> is semantically
equivalent to: <math display="block"><mi
mathvariant="bold">binding</mi> <mo>(</mo><mi>lambda</mi> <mo>,</mo>
<msup><mi>v</mi><mo>'</mo></msup> <mo>,</mo> <mi>v</mi>
<mo>,</mo><mi mathvariant="bold">application</mi>
<mo>(</mo><mi>times</mi><mo>,</mo><mi>v</mi>
<mo>,</mo><mi>v</mi><mo>)</mo> <mo>)</mo></math> so that the
resulting function is actually a constant in its first argument
(<math><msup><mi>v</mi><mo>'</mo></msup></math> does not occur free
in the body <math><mi mathvariant="bold">application</mi>
<mo>(</mo><mi>times</mi><mo>,</mo><mi>v</mi>
<mo>,</mo><mi>v</mi><mo>)</mo> <mo>)</mo></math>).</para>
</listitem>
</varlistentry>
<varlistentry><term>Attribution</term><listitem><para>decorates an
object with a sequence of one or more pairs made up of an &OM;
symbol, the <quote>attribute</quote>, and an associated object,
the <quote>value of the
attribute</quote>. The value of the attribute can be an <phrase
>&OM;</phrase> attribution object itself. As an
example of this, consider the &OM; objects representing groups,
automorphism groups, and group dimensions. It is then possible to
attribute an &OM; object representing a group by its automorphism
group, itself attributed by its dimension.</para>
<para>
&OM; objects can be attributed with &OM; foreign objects, which are
containers for non-&OM; structures. For example a mathematical
expression could be attributed with its spoken or visual rendering.
</para>
<para>Composition of attributions, as in
<math display="block">
<mi mathvariant="bold">attribution</mi><mo>(</mo><mi
mathvariant="bold">attribution</mi><mo>(</mo><mi>A</mi><mo>,</mo>
<msub><mi>S</mi><mn>1</mn></msub> <mspace width=".3em"/>
<msub><mi>A</mi><mn>1</mn></msub><mo>,</mo><mi>…</mi><mo>,</mo><msub><mi>S</mi><mi>h</mi></msub>
<mspace width=".3em"/>
<msub><mi>A</mi><mi>h</mi></msub><mo>)</mo><mo>,</mo>
<msub><mi>S</mi><mrow><mi>h</mi><mo>+</mo><mn>1</mn></mrow></msub>
<mspace width=".3em"/>
<msub><mi>A</mi><mrow><mi>h</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>,</mo>
<mi>…</mi><mo>,</mo> <msub><mi>S</mi><mi>n</mi></msub> <mspace
width=".3em"/> <msub><mi>A</mi><mi>n</mi></msub><mo>)</mo></math> is
semantically equivalent to a single attribution, that is <math
display="block"><mi
mathvariant="bold">attribution</mi><mo>(</mo><mi>A</mi><mo>,</mo>
<msub><mi>S</mi><mn>1</mn></msub> <mspace width=".3em"/>
<msub><mi>A</mi><mn>1</mn></msub><mo>,</mo>
<mi>…</mi><mo>,</mo> <msub><mi>S</mi><mi>h</mi></msub> <mspace
width=".3em"/> <msub><mi>A</mi><mi>h</mi></msub><mo>,</mo>
<msub><mi>S</mi><mrow><mi>h</mi><mo>+</mo><mn>1</mn></mrow></msub>
<mspace width=".3em"/>
<msub><mi>A</mi><mrow><mi>h</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>,</mo>
<mi>…</mi><mo>,</mo> <msub><mi>S</mi><mi>n</mi></msub> <mspace
width=".3em"/>
<msub><mi>A</mi><mi>n</mi></msub><mo>)</mo><mtext>.</mtext></math>
The operation that produces an object with a single layer of
attribution is called <emphasis>flattening</emphasis>.</para>
<para>Multiple attributes with the same name are allowed. While the
order of the given attributes does not imply any notion of priority,
potentially it could be significant. For instance, consider the case
in which <math><msub><mi>S</mi><mi>h</mi></msub> <mo>=</mo>
<msub><mi>S</mi><mi>n</mi></msub></math> (<math><mi>h</mi>
<mo><</mo> <mi>n</mi></math>) in the example above. Then, the
object is to be interpreted as if the value
<math><msub><mi>A</mi><mi>n</mi></msub></math> overwrites the value
<math><msub><mi>A</mi><mi>h</mi></msub></math>. (&OM; however does
not mandate that an application preserves the attributes or their
order.)</para>
<para>Attribution acts as either adornment
annotation or as semantical annotation. When the key has role
<emphasis>attribution</emphasis>, then replacement of the
attributed object by the object itself is not harmful and preserves
the semantics. When the key has role
<emphasis>semantic-attribution</emphasis> then the attributed
object is modified by the attribution and cannot be viewed as
semantically equivalent to the stripped object. If the attribute
lacks the role specification then attribution is acting as adornment
annotation.
</para>
<para>Objects can be decorated in a multitude of ways.
<phrase>An example of the use of an adornment attribution
would be to indicate the colour in which an &OM; object should be
displayed, for example <math><mi
mathvariant="bold">attribution</mi><mo>(</mo><mi>A</mi><mo>,</mo>
<mi>colour</mi> <mspace width=".3em"/> <mi>red</mi> <mo>)</mo></math>.
Note that both <math><mi>A</mi></math> and <math><mi>red</mi></math> are
<phrase role="finaledit">arbitary</phrase> &OM;
objects <phrase role="finaledit">whereas <math><mi>color</mi></math> is
a symbol</phrase>.
An example of the use of a semantic attribution would be to indicate the
type of an object. For example</phrase>
the object <math><mi
mathvariant="bold">attribution</mi><mo>(</mo><mi>A</mi><mo>,</mo>