-
Notifications
You must be signed in to change notification settings - Fork 5
/
omstd20.xml
7482 lines (6711 loc) · 289 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
<!DOCTYPE book SYSTEM "omstd20.dtd">
<book xml:space="preserve">
<title>The &OM; Standard</title>
<bookinfo>
<releaseinfo>2.0r2</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>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>
<editor revisionflag="added"><firstname>T.</firstname><surname>Wiesing (revision 2)</surname></editor>
<date>July 2019</date>
<copyright>
<year>2000–2019</year>
<holder>The OpenMath Society</holder>
</copyright>
<abstract>
<para>This document describes <phrase revisionflag="changed">version 2 revision 2</phrase> of
&OM;: a standard for
the representation and communication of mathematical objects.
This revision clarifies the first &OM; 2.0
<citation>OM_2.0r0</citation>.
&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>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>This document includes an overview of the
&OM; architecture, an abstract description of <xref linkend="omobj"/>s 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. Further background
on &OM; and guidelines for its use in applications may be found in the
accompanying Primer <citation>OM_primer</citation>.</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 <xref linkend="omobj"/>.
Note that these two layers may, in some cases, be the same.
The third is a communication layer that translates the <xref linkend="omobj"/> representation into
a stream of bytes. An application dependent program manipulates the
mathematical objects using its internal representation, it can convert
them to <xref linkend="omobj"/>s and communicate them by using the byte stream
representation of <xref linkend="omobj"/>s.</para>
<para>
This standard does not describe the mechanisms by which software systems may offer,
or make use of, computational services. The currently-suggested mechanism is the
Symbolic Computation Software Composability Protocol (SCSCP)
<citation>SCSCP13</citation>.
</para>
</section>
<section id="sec_intro-obj">
<title>&OM; Objects and Encodings</title>
<para><xref linkend="omobj"/>s 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><xref linkend="omobj"/>s and encodings are described in detail in <xref
linkend="cha_obj"/> and <xref linkend="cha_enco"/>.</para>
<para>The standard endorses two encodings
in &exml; (an innate one described here, and one in Strict Content
MathML)<phrase revisionflag="deleted">and</phrase><phrase revisionflag="added">,</phrase> a binary format <phrase revisionflag="added">and a JSON encoding</phrase>.
At the time of writing, these are the encodings
supported by most existing &OM; tools and applications,
however they are not the only possible encodings of &OM;
objects. Users who wish to define their own encoding,
are free to do so provided that there is
a well-defined correspondence
between the new encoding and the abstract model defined in <xref
linkend="cha_obj"/>.
</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 <xref linkend="omobj"/>s. 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 Dictionaries 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 <xref linkend="omobj"/> to/from the internal
representation in a software application is performed by an interface
program called a <term id="phrasebook">Phrasebook</term>. 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 <xref linkend="phrasebook"/> of
the application is able to translate <xref linkend="omobj"/>s built using symbols
from these Content Dictionaries to/from the internal mathematical
objects of the application.
</para>
<para><xref linkend="omobj"/>s 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. For such a query/programming language, the OpenMath Society recommends
the Symbolic Computation Software Composability Protocol (SCSCP)
<citation>SCSCP13</citation>.
</para>
</section>
</chapter>
<chapter id="cha_obj">
<title>&OM; Objects</title>
<para>
In this chapter we provide a self-contained description of <xref linkend="omobj"/>s. 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
<term id='omobj'>&OM; object</term>s or &OM; expressions. The definition of an abstract
<xref linkend="omobj"/> 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 <term id="symname">symbol
name</term>, a <term id="cdname">Content Dictionary name</term>, and (optionally) a
<term id="cdbase">Content Dictionary base URI</term>, 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 <term id="cdbase">cdbase</term> 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 <xref linkend="role"/> which is a restriction on where
the symbol may appear in an <xref linkend="omobj"/>. The possible roles are described in <xref
linkend="sec_roles"/>.
</para>
</listitem>
<listitem>
<para>
<phrase>(vi)</phrase> Variable.
</para>
<para>A Variable must have a <term id="varname">name</term> 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 <xref linkend="omobj"/>. A <term id="derivedobj">derived &OM; object</term> is built as follows:
<itemizedlist>
<listitem>
<para><phrase>(i)</phrase> If <math><mi>A</mi></math> is <emphasis>not</emphasis> an
<xref linkend="omobj"/>, then <math><mi
mathvariant="bold">foreign</mi><mfenced><mi>A</mi></mfenced></math> is an &OM; <term
id="foreignobj">foreign object</term>. An &OM; foreign object may optionally have an
<term id="encoding">encoding</term> field which describes how its contents should be
interpreted.</para>
</listitem>
</itemizedlist>
</para>
</section>
<section id="sec_compound">
<title>&OM; Objects</title>
<para><xref linkend="omobj"/>s are built recursively as follows.
<itemizedlist>
<listitem><para><phrase>(i)</phrase> Basic &OM; objects are <xref linkend="omobj"/>s.
(Note that <xref linkend="derivedobj"/>s are
<emphasis>not</emphasis> <xref linkend="omobj"/>s, but are used to construct &OM;
objects as described below.)</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 <xref linkend="omobj"/>s, 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 <term id="applobj">&OM; application object</term>. We call
<math><msub><mi>A</mi><mn>1</mn></msub></math> the <term id="function">function</term>
and <math><msub><mi>A</mi><mn>2</mn></msub></math> to
<math><msub><mi>A</mi><mn>1</mn></msub></math> the <term
id="argument">argument</term>s.</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
<math><mi>A</mi></math> is an <xref linkend="omobj"/>, 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 <xref linkend="omobj"/>s or
<xref linkend="derivedobj"/>s, then
<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; <term
id="attrobj">attribution object</term>. We call
<math><mi>A</mi></math> the <term id="attobj">attributed object</term>, the
<math><msub><mi>S</mi><mi>i</mi></msub></math> the <term id="key">keys</term>, and the
<math><msub><mi>A</mi><mi>i</mi></msub></math> the <term id="attval">attribute
value</term>s.
</para>
<para>
If the <xref linkend="attobj"/> is a variable, the original attribution is called an
<term id="attvar">attributed variable</term>.
</para>
</listitem>
<listitem>
<para>
<phrase>(iv)</phrase> If <math><mi>B</mi></math> and
<math><mi>C</mi></math> are <xref linkend="omobj"/>s, 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 <xref linkend="attvar"/>s, 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; <term id="bindingobj">binding object</term>.
<math><mi>B</mi></math> is called the <term id="binder">binder</term>,
<math><msub><mi>v</mi><mn>1</mn></msub></math>,
<math><mi>…</mi></math>,
<math><msub><mi>v</mi><mi>n</mi></msub></math>
are called <term id="varbindings">variable binding</term>s,
and <math><mi>C</mi></math> is called the
<term id="body">body</term> of the binding object above.
To distinguish the two different ways how variable objects are used, any variable object
that is not a variable binding is called a <term id="varreference">variable reference</term>.
</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 <xref linkend="omobj"/>s
or <xref linkend="derivedobj"/>s, 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; <term id="errorobj">error object</term>.</para>
</listitem>
</itemizedlist>
<xref linkend="omobj"/>s that are constructed via rules (ii)
to (v) are jointly called <term id="compoundobj">compound &OM; object</term>s.
</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 <xref linkend="omobj"/> if it
is the first child of an <xref linkend="applobj"/>, <xref linkend="bindingobj"/> or <xref
linkend="errorobj"/>, or an even-indexed child of an &OM; <xref linkend="attrobj"/>
(i.e. the <xref linkend="key"/> in a <emphasis>(key, value)</emphasis> pair). The <term
id="role">role</term> of an &OM; symbol is a restriction on how it may be used to
construct a <xref linkend="compoundobj"/> and, in the case of the key in an <xref linkend="attrobj"/>, a
clarification of how that attribution should be interpreted. The possible roles are:
<orderedlist numeration="lowerroman">
<listitem>
<para><term id="binderrole">binder</term> The symbol may
appear as the first child of an &OM; binding object.
</para>
</listitem>
<listitem>
<para><term id="attributionrole">attribution</term>
The symbol may
be used as key in an &OM; <xref linkend="attrobj"/>, 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>
<term id="semantic-attribution-role">semantic-attribution</term> This is the same as
<xref linkend="attributionrole"/> except that it modifies the meaning of the
attributed &OM; object and thus cannot be ignored by an application, without
changing the meaning.
</para>
</listitem>
<listitem>
<para>
<term id="errorrole">error</term> The symbol may appear as the first child of an
&OM; <xref linkend="errorobj"/>.
</para>
</listitem>
<listitem>
<para>
<term id="applicationrole">application</term> The symbol may appear as the first
child of an &OM; <xref linkend="applobj"/>.
</para>
</listitem>
<listitem>
<para>
<term id="constantrole">constant</term> The symbol cannot be used to construct an
<xref linkend="compoundobj"/>.
</para>
</listitem>
</orderedlist>
A symbol cannot have more than one role and cannot be used to construct a <xref
linkend="compoundobj"/> 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 <xref linkend="applobj"/>. However it does not
prevent the use of that symbol as an <xref linkend="argument"/> in an <xref
linkend="applobj"/>.
</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 <xref linkend="constantrole"/>.
</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>
Although foreign objects can come with a standarized encoding
field, their interpretation is an issue beyond the &OM;
standard. In particular, a foreign object is primarily data
that has been encoded in some format, and there is no
promise that foreign objects encountered within one encoding
of &OM; can be faithfully represented in another.
</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 <xref
linkend="derivedobj"/>.
</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; <xref linkend="errorobj"/>s, 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 <xref linkend="compoundobj"/> out of
basic or <xref linkend="derivedobj"/>s.
</para>
<variablelist>
<varlistentry>
<term>Application</term>
<listitem>
<para>
constructs an &OM; object from a sequence of one or more &OM; objects. The first
child of an application is referred to as its
<quote>head</quote> while the remaining objects are called its
<quote>arguments</quote>. An &OM; <xref linkend="applobj"/> can be used to convey
the mathematical notion of application of a <xref linkend="function"/> to a set of
<xref linkend="argument"/>. For instance, suppose that the &OM; symbol
<math><mi>sin</mi></math> is defined in a suitable 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; <xref linkend="applobj"/> 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; <xref linkend="applobj"/> <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 of the form
<math>
<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>
<mtext>.</mtext>
</math>
The <term id="scope">scope</term> of a variable binding
<math><msub><mi>v</mi><mi>i</mi></msub></math>
(<math><mn>1</mn><mo>≤</mo><mi>i</mi><mo>≤</mo><mi>n</mi></math>)
is constituted by the <xref linkend="body"/>
<math><mi>C</mi></math> together with the attribute values of subsequent variable
bindings <math><msub><mi>v</mi><mi>j</mi></msub></math> with
<math><mi>i</mi><mo><</mo><mi>j</mi><mo>≤</mo><mi>n</mi></math>.
A variable reference <math><mi>R</mi></math> is <quote>bound</quote> by the variable
binding <math><mi>B</mi></math>, if <math><mi>B</mi></math> is the
closest variable binding for the same name that has
<math><mi>R</mi></math> in its scope. A variable reference that is not bound by any
variable binding is called a <quote>free variable</quote>. Note that the binder itself
is not part of the scope of any of its bound variables. In particular, no
variable references in <math><mi>B</mi></math> can be bound by any of the variable bindings <math><msub><mi>v</mi><mi>i</mi></msub></math>.
Binding objects are allowed to have no bound variables, but the binder object and the
body should be present.
</para>
<para> 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><xref linkend="phrasebook"/>s are allowed to use <term id="alphaconversion"><math><mi>α</mi></math>-conversion</term>
(also called <term id="alpharenaming">alphabetic
renaming</term>)
in order to avoid clashes of variable names: the variable in a variable binding
can be replaced by a
<term id="newvar">new variable</term>, i.e. one that does not occur anywhere in
the scope of the binding, if all variable references it binds are replaced accordingly:
Suppose <math><mi>Ω</mi></math> contains an occurrence of the
object
<math>
<mi mathvariant="bold">binding</mi>
<mo>(</mo>
<mi>B</mi>
<mo>,</mo>
<mover>
<mi>v</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>x</mi>
<mo>,</mo>
<mover>
<mi>w</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>C</mi>
<mo>)</mo>
</math>
where
<math>
<mover>
<mi>v</mi>
<mo>→</mo>
</mover>
</math>
and
<math>
<mover>
<mi>w</mi>
<mo>→</mo>
</mover>
</math>
are (possibly empty)
sequences of bound, possibly attributed variables and <math><mi>x</mi></math> is a
variable.
This object
<math>
<mi mathvariant="bold">binding</mi>
<mo>(</mo>
<mi>B</mi>
<mo>,</mo>
<mover>
<mi>v</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>x</mi>
<mo>,</mo>
<mover>
<mi>w</mi>
<mo>→</mo>
</mover>
<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>
<mover>
<mi>v</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>y</mi>
<mo>,</mo>
<mover>
<mi>w'</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>C'</mi>
<mo>)</mo>
</math>
where <math><mi>y</mi></math> is a <xref linkend="newvar"/>, i.e. one that does not occur anywhere in <math><mover><mi>w</mi><mo>→</mo></mover>
</math> or <math><mi>C</mi></math>
and
<math>
<mover>
<mi>w'</mi>
<mo>→</mo>
</mover>
</math>
and
<math><mi>C'</mi></math>
are obtained from
<math>
<mover>
<mi>w</mi>
<mo>→</mo>
</mover>
</math>
and
<math><mi>C</mi></math>,
by replacing each free occurrence
of <math><mi>x</mi></math> by <math><mi>y</mi></math>.
If instead of
<math><mi>x</mi></math> in <math><mi>Ω</mi></math>, we have an attributed
variable
<math>
<mi mathvariant="bold">attribution</mi>
<mo>(</mo>
<mi>x</mi>
<mo>,</mo>
<mover>
<mi>a</mi>
<mo>→</mo>
</mover>
<mo>)</mo>
</math>, then instead of <math><mi>y</mi></math> we
must have
<math>
<mi mathvariant="bold">attribution</mi>
<mo>(</mo>
<mi>y</mi>
<mo>,</mo>
<mover>
<mi>a</mi>
<mo>→</mo>
</mover>
<mo>)</mo>
</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>
Note that repeated variable bindings of the same
variable in a binding object are allowed, but make little sense semantically and are
therefore discouraged: the first binding binds only references in the subsequent
bindings up to and including the next binding for the same name.
Therefore, an &OM; application may choose to <math><mi>α</mi></math>-convert all
but the last binding to <xref linkend="newvar"/>s. Concretely, the following replacement is carried
out until there are no more bound variable duplications:
<math display="block">
<mrow>
<mi mathvariant="bold">binding</mi>
<mo>(</mo>
<mi>B</mi>
<mo>,</mo>
<mover>
<mi>u</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>x</mi>
<mo>,</mo>
<mover>
<mi>v</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>y</mi>
<mo>,</mo>
<mover>
<mi>w</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>C</mi>
<mo>)</mo>
</mrow>
<mo>⟶</mo>
<mrow>
<mi mathvariant="bold">binding</mi>
<mo>(</mo>
<mi>B</mi>
<mo>,</mo>
<mover>
<mi>u</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>x'</mi>
<mo>,</mo>
<mover>
<mi>v'</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>y'</mi>
<mo>,</mo>
<mover>
<mi>w</mi>
<mo>→</mo>
</mover>
<mo>,</mo>
<mi>C</mi>
<mo>)</mo>
</mrow>
</math>
where <math><mi>x</mi></math> and <math><mi>y</mi></math> are (possibly attributed)
variables with the same head <math><mi>z</mi></math>, the heads of bound (attributed)
variables in <math><mover><mi>u</mi><mo>→</mo></mover></math> are all different
from <math><mi>z</mi></math>, and <math><mi>x'</mi></math>,
<math><mi>y'</mi></math>, and
<math><mover><mi>v'</mi><mo>→</mo></mover></math> are obtained from
<math><mi>x</mi></math>, <math><mi>y</mi></math>, and
<math><mover><mi>v</mi><mo>→</mo></mover></math>
by replacing <math><mi>z</mi></math> with a variable
<math><mi>z'</mi></math> that does not occur in <math><mi>x</mi></math>,
<math><mi>y</mi></math>, <math><mover><mi>u</mi><mo>→</mo></mover></math>,
<math><mover><mi>v</mi><mo>→</mo></mover></math>,
<math><mover><mi>w</mi><mo>→</mo></mover></math>, and <math><mi>C</mi></math>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Attribution</term>
<listitem>
<para>
decorates an object (called the <quote>syntactic
head</quote> of the attribution) 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 &OM; <xref linkend="attrobj"/> 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; <xref linkend="foreignobj"/>, 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 <term id="flattening">flattening</term>. The
<quote>head</quote> of an attribution is the syntactic head of the fully (recursively)
flattened version.
</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 <xref linkend="attributionrole"/>, then replacement of the attributed
object by the object itself is not harmful and preserves the semantics. When the key
has role <xref linkend="semantic-attribution-role"/> 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.