-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathomstd11.htm
More file actions
4569 lines (3723 loc) · 166 KB
/
omstd11.htm
File metadata and controls
4569 lines (3723 loc) · 166 KB
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
<?xml version="1.0" encoding="utf-8"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://www.w3.org/1998/Math/MathML"><head><title>The OpenMath Standard</title><object id="mmlFactory" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987"/><?import
namespace="m" implementation="#mmlFactory"
?><style>
p {text-align:justify;
}
code {font-size: 125%;
font-family: monospace;
}
.figure {
border-width:1px;
border-color: black;
}
.footnote{
font-size: 75%;
font-style: italic;
}
.literal {
font-size: 75%;
background-color: #cfcfcf;
border-color: black;
border-style: solid;
border-width: 1px;
padding: 1em;
}
.del {
color: red;
}
.new {
color: green;
}
.changetoc {
border-style: solid;
border-color: black;
border-width: 1px;
margin: 2em 2em 2em 2em;
background-color: yellow;
}
</style></head><body><h1>The <i>OpenMath</i> Standard</h1><div>
Version: 1.1b</div><div>The OpenMath Esprit Consortium</div><div>Editors<br/>O. Caprotti, D. P. Carlisle, A. M. Cohen</div><div>October 22 2002</div><div><h3>Abstract</h3><p>This document proposes <i>OpenMath</i> as a standard for the communication of
semantically rich mathematical objects. This draft of the <i>OpenMath</i>
standard comprises the following: a description of <i>OpenMath</i> objects, the
grammar of <span>xml</span> and of the binary encoding of objects, a
description of Content Dictionaries and an <span>xml</span> document type
definition for validating Content Dictionaries. The non-normative
<a href="#cha_his">Chapter 1</a> of this document briefly overviews the history
of <i>OpenMath</i>.</p></div><div class="changetoc"><h3>Change-marked edition notes</h3><p>
This edition contains colour coded change markings
relative to the OpenMath 1.0 document...</p><ul><li class="new">New text is marked with css class "new" (green).</li><li class="del">Deleted text is marked with css class "del" (red).</li></ul><p>Sections with new text</p><ul><a href="#sec_omin" class="new">3.2 Further Description of OpenMath Objects</a><br/><a href="#ssec_xml" class="new">4.1.1 A Grammar for the xml Encoding</a><br/></ul></div>
<h2>Contents</h2><a href="#cha_his">1 <i>OpenMath</i> Movement</a><br/>
<a href="#sec_hist">1.1 History</a><br/>
<a href="#sec_omsoc">1.2 <i>OpenMath</i> Society</a><br/><a href="#cha_int">2 Introduction to <i>OpenMath</i></a><br/>
<a href="#sec_om-arch">2.1 <i>OpenMath</i> Architecture</a><br/>
<a href="#sec_intro-obj">2.2 <i>OpenMath</i> Objects and Encodings</a><br/>
<a href="#sec_intro-cd">2.3 Content Dictionaries</a><br/>
<a href="#sec_addnfiles">2.4 Additional Files</a><br/>
<a href="#sec_phrasebooks">2.5 Phrasebooks</a><br/><a href="#cha_obj">3 <i>OpenMath</i> Objects</a><br/>
<a href="#sec_omabs">3.1 Formal Definition of <i>OpenMath</i> Objects</a><br/>
<a href="#sec_basic">3.1.1 Basic <i>OpenMath</i> objects</a><br/>
<a href="#sec_compound">3.1.2 Compound <i>OpenMath</i> Objects</a><br/>
<a href="#sec_omin">3.2 Further Description of <i>OpenMath</i> Objects</a><br/>
<a href="#sec_summary">3.3 Summary</a><br/><a href="#cha_enco">4 <i>OpenMath</i> Encodings</a><br/>
<a href="#sec_xml">4.1 The <span>xml</span> Encoding</a><br/>
<a href="#ssec_xml">4.1.1 A Grammar for the <span>xml</span> Encoding</a><br/>
<a href="#sec_xml-desc">4.1.2 Description of the Grammar</a><br/>
<a href="#xmldoc">4.1.3 Embedding OpenMath in XML Documents</a><br/>
<a href="#sec_binary">4.2 The Binary Encoding</a><br/>
<a href="#sec_binary_grammar">4.2.1 A Grammar for the Binary Encoding</a><br/>
<a href="#sec_bin-desc">4.2.2 Description of the Grammar</a><br/>
<a href="#sec_sharing">4.2.2.1 Sharing</a><br/>
<a href="#sec_impl_note">4.2.3 Implementation Note</a><br/>
<a href="#sec_bin_example">4.2.4 Example of Binary Encoding</a><br/>
<a href="#sec_enc_summary">4.3 Summary</a><br/><a href="#cha_cd">5 Content Dictionaries</a><br/>
<a href="#sec_cd_summary">5.1 Introduction</a><br/>
<a href="#sect_func">5.2 Content Dictionaries</a><br/>
<a href="#sec_xml_cd">5.3 The XML Encoding for Content Dictionaries</a><br/>
<a href="#sec_dtd_cd">5.3.1 The DTD Specification of Content Dictionaries</a><br/>
<a href="#sect_pcdata">5.3.2 Further Requirements of an <i>OpenMath</i> Content Dictionary</a><br/>
<a href="#addfiles">5.4 Additional Information</a><br/>
<a href="#sigfiles">5.4.1 Signature Files</a><br/>
<a href="#sec_dtd_sig">5.4.1.1 The DTD Specification of Signature Files</a><br/>
<a href="#sect_sigpcdata">5.4.1.2 Further Requirements of a Signature File</a><br/>
<a href="#sect_sigex">5.4.1.3 Examples</a><br/>
<a href="#ssec_cdgroups">5.4.2 CDGroups</a><br/>
<a href="#sec_dtd_cdg">5.4.2.1 The DTD Specification of CDGroups</a><br/>
<a href="#sect_cdgpcdata">5.4.2.2 Further Requirements of a CDGroup</a><br/>
<a href="#cdapprove">5.5 Content Dictionaries Reviewing Process</a><br/><a href="#cha_comp">6 <i>OpenMath</i> Compliance</a><br/>
<a href="#sec_compl_encoding">6.1 Encoding</a><br/>
<a href="#sec_compl_cd">6.2 Content Dictionaries</a><br/>
<a href="#sec_comp_lex">6.3 Lexical Errors</a><br/><a href="#cha_conc">7 Conclusion</a><br/><a href="#app_cdfiles">A CD Files</a><br/>
<a href="#app_cdcd">A.1 The <b>meta</b> Content Dictionary</a><br/>
<a href="#arith1.ocd">A.2 The <b>arith1</b> Content Dictionary File</a><br/>
<a href="#arith1.sts">A.3 The <b>arith1</b> STS Signature File</a><br/>
<a href="#mathml.cdg">A.4 The <b>MathML</b> CDGroup</a><br/>
<a href="#errorcd">A.5 The <b>error</b> Content Dictionary</a><br/><a href="#bibliography">B Bibliography</a><br/>
<h2>List of Figures</h2><a href="#fig_om">2.1 The <i>OpenMath</i> Architecture</a><br/><a href="#fig_obj">3.1 The <i>OpenMath</i> application and binding objects for
<m:math><m:mi>sin</m:mi> <m:mo>(</m:mo><m:mi>x</m:mi> <m:mo>)</m:mo></m:math> and
<m:math><m:mi>λ</m:mi> <m:mi>x</m:mi><m:mo>.</m:mo><m:mi>x</m:mi> <m:mo>+</m:mo>
<m:mn>2</m:mn></m:math> in tree-like notation.</a><br/><a href="#fig_objdtd">4.1 DTD for the <i>OpenMath</i> <span>xml</span> encoding of objects.</a><br/><a href="#fig_xml">4.2 Grammar for the <span>xml</span> encoding of <i>OpenMath</i> objects.</a><br/><a href="#fig_bin-enc">4.3 Grammar of the binary encoding of <i>OpenMath</i> objects.</a><br/><a href="#fig_cd-dtd">5.1 DTD Specification of Content Dictionaries</a><br/><a href="#fig_omcdsig.dtd">5.2 DTD Specification of Signature Files</a><br/><a href="#fig_cdgroup.dtd">5.3 DTD Specification of CDGroups</a><br/>
<h2 name="cha_his" id="cha_his">
Chapter 1<br/><i>OpenMath</i> Movement</h2>
<p>This chapter is a historical account of <i>OpenMath</i> and should be regarded
as non-normative.</p>
<p><i>OpenMath</i> is a standard for representing mathematical objects,
allowing them to be exchanged between computer programs, stored in
databases, or published on the worldwide web. While the original
designers were mainly developers of computer algebra systems, it is
now attracting interest from other areas of scientific computation and
from many publishers of electronic documents with a significant
mathematical content. There is a strong relationship to the MathML
recommendation <a href="#MathML_98">[5]</a> from the Worldwide Web
Consortium, and a large overlap between the two developer communities.
MathML deals principally with the <i>presentation</i> of
mathematical objects, while <i>OpenMath</i> is solely concerned with their
semantic meaning or <i>content</i>. While MathML does
have some limited facilities for dealing with content, it also allows
semantic information encoded in <i>OpenMath</i> to be embedded inside a MathML
structure. Thus the two technologies may be seen as highly
complementary.</p>
<div><h3 name="sec_hist" id="sec_hist">1.1 History</h3>
<p><i>OpenMath</i> was originally developed through a series of workshops held
in Zurich (1993 and 1996), Oxford (1994), Amsterdam (1995), Copenhagen
(1995), Bath (1996), Dublin (1996), Nice (1997), Yorktown Heights
(1997), Berlin (1998), and Tallahassee (1998). The participants in
these workshops formed a global <i>OpenMath</i> community which was coordinated
by a Steering Committee and operated through electronic mailing groups
and ad-hoc working parties. This loose arrangement has been
formalised through the establishment of an <i>OpenMath</i> Society. Up until the
end of 1996 much of the work of the community was funded through a
grant from the Human Capital and Mobility program of the European
Union, the contributions of several institutions and individuals. A
document outlining the objectives and basic design of <i>OpenMath</i> was
produced (later published as
<a href="#Abbott_Leeuwen_Strotmann_98">[3]</a>). By the end of 1996
a simplified specification had been agreed on and some prototype
implementations have come about
<a href="#Dalmas_Gaetano_Watt_97">[8]</a>.</p>
<p>In 1996 a group of European participants in <i>OpenMath</i> decided to bid
for funding under the European Union's Fourth Framework Programme for
strategic research in information technology. This bid was successful
and the project started in late 1997. The principal aims of the
project are to formalise <i>OpenMath</i> as a standard and to develop it
further through industrial applications; this document is a product of
that process and draws heavily on the previous work described earlier.
<i>OpenMath</i> participants from all over the world continue to meet
regularly and cooperate on areas of mutual interest, and
recent workshops in Tallahassee (November 1998) and Eindhoven (June
1999) endorsed drafts of this document as the current <i>OpenMath</i> standard.</p>
</div>
<div><h3 name="sec_omsoc" id="sec_omsoc">1.2 <i>OpenMath</i> Society</h3>
<p>In November 1998 the <i>OpenMath</i> Society has been established to coordinate
all <i>OpenMath</i> activities. The society is based in Helsinki, Finland and is
steered by the executive committee whose members are elected by the
society. The official web page of the society is
<a href="http://www.openmath.org">http://www.openmath.org</a>.</p>
</div>
<h2 name="cha_int" id="cha_int">
Chapter 2<br/>Introduction to <i>OpenMath</i></h2>
<p>This chapter briefly introduces <i>OpenMath</i> concepts and notions that are
referred to in the rest of this document.</p>
<div><h3 name="sec_om-arch" id="sec_om-arch">2.1 <i>OpenMath</i> Architecture</h3>
<div class="figure"><a name="fig_om" id="fig_om"/>
<img src="om-arch.png" alt="om-arch.png"/>
<div>
Figure 2.1 The <i>OpenMath</i> Architecture</div></div>
<p>The architecture of <i>OpenMath</i> is described in <a href="#fig_om">Figure 2.1</a> and
summarizes the interactions among the different <i>OpenMath</i> components.
There are three layers of representation of a mathematical object
<a href="#OM_98">[10]</a>. A private layer that is the internal representation used
by an application. An abstract layer that is the representation as an
<i>OpenMath</i> object. Third is a communication layer that translates the <i>OpenMath</i>
object representation to a stream of bytes. An application dependent
program manipulates the mathematical objects using its internal
representation, it can convert them to <i>OpenMath</i> objects and communicate
them by using the byte stream representation of <i>OpenMath</i> objects.</p>
</div>
<div><h3 name="sec_intro-obj" id="sec_intro-obj">2.2 <i>OpenMath</i> Objects and Encodings</h3>
<p><i>OpenMath</i> objects are representations of mathematical entities that
can be communicated among various software applications in a
meaningful way, that is, preserving their
<span>"semantics"</span>.</p>
<p><i>OpenMath</i> objects and encodings are described in detail in <a href="#cha_obj">Chapter 3</a> and <a href="#cha_enco">Chapter 4</a>.</p>
<p>The standard endorses encodings in <span>xml</span> and binary
format. These are the encodings supported by the official <i>OpenMath</i>
libraries. However they are not the only possible encodings of <i>OpenMath</i>
objects. Users that wish to define their own encoding using some other
specific language (e.g. Lisp) may do so provided there is an
effective translation of this encoding to an official one.</p>
</div>
<div><h3 name="sec_intro-cd" id="sec_intro-cd">2.3 Content Dictionaries</h3>
<p>Content Dictionaries (CDs) are used to assign informal and formal
semantics to all symbols used in the <i>OpenMath</i> objects. They define the
symbols used to represent concepts arising in a particular area of
mathematics.</p>
<p>The Content Dictionaries are public, they represent the actual
common knowledge among <i>OpenMath</i> applications. Content Dictionaries fix
the <span>"meaning"</span> 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.</p>
</div>
<div><h3 name="sec_addnfiles" id="sec_addnfiles">2.4 Additional Files</h3>
<p>Several
additional files are related to Content Dictionaries. Signature files
contain the signatures of symbols defined in some <i>OpenMath</i> Content
Dictionary and their format is endorsed by this standard.</p>
<p>Furthermore, the standard fixes how to define as a CDGroup a specific
set of Content Dictionaries.</p>
<p>Auxiliary files that define presentation and rendering or that
are used for manipulating and processing Content Dictionaries are not
discussed by the standard.</p>
</div>
<div><h3 name="sec_phrasebooks" id="sec_phrasebooks">2.5 Phrasebooks</h3>
<p>The conversion of an <i>OpenMath</i> object to/from the internal
representation in a software application is performed by an interface
program called <i>Phrasebook</i>. 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 <i>OpenMath</i> objects built using symbols
from these Content Dictionaries to/from the internal mathematical
objects of the application.</p>
<p><i>OpenMath</i> objects do not
specify any compuational behaviour, they merely represent mathematical
expressions. Part of the <i>OpenMath</i> philosophy is to leave it to the
application to decide what it does with an object once it has received
it. <i>OpenMath</i> is not a query or programming language. Because of this,
<i>OpenMath</i> does not prescribe a way of forcing <span>"evaluation"</span> or
<span>"simplification"</span> of objects like
<m:math><m:mn>2</m:mn><m:mo>+</m:mo><m:mn>3</m:mn></m:math> or
<m:math><m:mi>sin</m:mi><m:mo>(</m:mo><m:mi>π</m:mi><m:mo>)</m:mo></m:math>. Thus,
the same object <m:math><m:mn>2</m:mn><m:mo>+</m:mo><m:mn>3</m:mn></m:math> could be
transformed to <m:math><m:mn>5</m:mn></m:math> by a computer algebra system,
or displayed as <m:math><m:mn>2</m:mn><m:mo>+</m:mo><m:mn>3</m:mn></m:math> by a
typesetting tool.</p>
</div>
<h2 name="cha_obj" id="cha_obj">
Chapter 3<br/><i>OpenMath</i> Objects</h2>
<p>In this chapter we provide a self-contained description of <i>OpenMath</i>
objects. We first do so at an informal level (<a href="#sec_omin">Section 3.2</a>) and next by means of an abstract grammar
description (<a href="#sec_omabs">Section 3.1</a>).</p>
<div><h3 name="sec_omabs" id="sec_omabs">3.1 Formal Definition of <i>OpenMath</i> Objects</h3>
<p><i>OpenMath</i> represents mathematical objects as terms or as labelled
trees that are called <i>OpenMath</i> objects or <i>OpenMath</i> expressions. The definition
of an abstract <i>OpenMath</i> object is then the following.</p>
<div><h4 name="sec_basic" id="sec_basic">3.1.1 Basic <i>OpenMath</i> objects</h4>
<p>The Basic <i>OpenMath</i> Objects form
the leaves of the <i>OpenMath</i> Object tree. A Basic <i>OpenMath</i> Object is of one of
the following.</p>
<ol class="lowerroman">
<li><p> Integer.</p><p>Integers in
the mathematical sense, with no predefined range. They are
<span>"infinite precision"</span> integers (also called
<span>"bignums"</span> in computer algebra).</p></li>
<li><p> IEEE floating point
number.</p><p>Double precision floating-point numbers
following the <span>ieee</span> 754-1985
standard <a href="#ieee754_85">[1]</a>.</p></li>
<li><p> Character string.</p><p>A Unicode Character string. This also corresponds to `characters' in
<span>xml</span>.</p></li>
<li><p> Bytearray.</p><p>A sequence of bytes.</p></li>
<li><p> Symbol.</p><p>A Symbol
encodes two fields of information, a <i>name</i> and a
<i>Content Dictionary</i>. Each is a sequence of
characters matching a regular expression, as described below.</p></li>
<li><p> Variable.</p><p>A Variable consists of a <i>name</i> which is a
sequence of characters matching a regular expression, as described
below.</p></li>
</ol>
</div>
<div><h4 name="sec_compound" id="sec_compound">3.1.2 Compound <i>OpenMath</i> Objects</h4>
<p><i>OpenMath</i> objects are built recursively as follows.
<ol class="lowerroman">
<li><p> Basic <i>OpenMath</i> objects are <i>OpenMath</i> objects.</p></li>
<li><p>
If
<m:math><m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub></m:math>, <span>…</span>,
<m:math><m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub></m:math>
<m:math><m:mo>(</m:mo><m:mi>n</m:mi><m:mo>></m:mo><m:mn>0</m:mn><m:mo>)</m:mo></m:math> are <i>OpenMath</i>
objects, then
<m:math display="block">
<m:mi mathvariant="bold">application</m:mi><m:mo>(</m:mo><m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo> <m:mi>…</m:mi><m:mo>,</m:mo> <m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub><m:mo>)</m:mo>
</m:math>
is an <i>OpenMath</i> <i>application object</i>.</p></li> <li><p> If
<m:math><m:msub><m:mi>S</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo>
<m:mi>…</m:mi><m:mo>,</m:mo> <m:msub><m:mi>S</m:mi><m:mi>n</m:mi></m:msub></m:math>
are <i>OpenMath</i> symbols, and <m:math><m:mi>A</m:mi></m:math>,
<m:math><m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub></m:math>,
<span>…</span>, <m:math><m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub></m:math>, <m:math><m:mo>(</m:mo><m:mi>n</m:mi><m:mo>></m:mo><m:mn>0</m:mn><m:mo>)</m:mo></m:math> are <i>OpenMath</i> objects, then
<m:math display="block"><m:mi mathvariant="bold">attribution</m:mi>
<m:mo>(</m:mo><m:mi>A</m:mi><m:mo>,</m:mo> <m:msub><m:mi>S</m:mi><m:mn>1</m:mn></m:msub>
<m:mspace width=".3em"/>
<m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo>
<m:mspace width=".3em"/> <m:mi>…</m:mi> <m:mspace width=".3em"/> <m:mo>,</m:mo> <m:msub><m:mi>S</m:mi><m:mi>n</m:mi></m:msub> <m:mspace width=".3em"/>
<m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub><m:mo>)</m:mo></m:math>
is an <i>OpenMath</i> <i>attribution object</i> and <m:math><m:mi>A</m:mi></m:math> is the object
<i>stripped of attributions</i>. The operation of recursively
applying stripping to the stripped object is called <i>flattening
of the attribution</i>. When the stripped object after flattening
is a variable, the attributed object is called <i>attributed
variable</i>.</p></li>
<li><p> If <m:math><m:mi>B</m:mi></m:math> and <m:math><m:mi>C</m:mi></m:math> are <i>OpenMath</i> objects, and <m:math><m:msub><m:mi>v</m:mi><m:mn>1</m:mn></m:msub></m:math>, <m:math><m:mi>…</m:mi></m:math>,
<m:math><m:msub><m:mi>v</m:mi><m:mi>n</m:mi></m:msub></m:math> <m:math><m:mo>(</m:mo><m:mi>n</m:mi> <m:mo>≥</m:mo> <m:mn>0</m:mn><m:mo>)</m:mo></m:math> are <i>OpenMath</i> variables or attributed variables, then
<m:math display="block">
<m:mi mathvariant="bold">binding</m:mi> <m:mo>(</m:mo><m:mi>B</m:mi><m:mo>,</m:mo> <m:msub><m:mi>v</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo> <m:mi>…</m:mi><m:mo>,</m:mo> <m:msub><m:mi>v</m:mi><m:mi>n</m:mi></m:msub><m:mo>,</m:mo> <m:mi>C</m:mi><m:mo>)</m:mo>
</m:math>
is an <i>OpenMath</i> <i>binding object</i>.</p></li>
<li><p> If <m:math><m:mi>S</m:mi></m:math> is an
<i>OpenMath</i> symbol and <m:math><m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub></m:math>, <span>…</span>, <m:math><m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub></m:math> <m:math><m:mo>(</m:mo><m:mi>n</m:mi> <m:mo>≥</m:mo> <m:mn>0</m:mn><m:mo>)</m:mo></m:math> are <i>OpenMath</i> objects, then
<m:math display="block"><m:mi mathvariant="bold">error</m:mi> <m:mo>(</m:mo><m:mi>S</m:mi><m:mo>,</m:mo> <m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo><m:mi>…</m:mi><m:mo>,</m:mo><m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub><m:mo>)</m:mo>
</m:math>
is an <i>OpenMath</i> <i>error object</i>.</p></li>
</ol>
</p>
</div>
</div>
<div><h3 name="sec_omin" id="sec_omin">3.2 Further Description of <i>OpenMath</i> Objects</h3>
<p>Informally, an <i>OpenMath</i> <span><i>object</i></span> can be
viewed as a tree and is also referred to as a term. The objects at
the leaves of <i>OpenMath</i> trees are called <span><i>basic
objects</i></span>. The basic objects supported by <i>OpenMath</i> are:
<dl>
<dt>Integer</dt><dd><p>Arbitrary Precision
integers.</p> </dd>
<dt>Float</dt><dd> <p><i>OpenMath</i> floats are
<span>ieee</span> 754 Double precision floating-point
numbers. Other types of floating point number may be encoded in <i>OpenMath</i>
by the use of suitable content dictionaries.</p>
</dd>
<dt>Character strings</dt><dd><p>are
sequences of characters. These characters come from the Unicode
standard <a href="#UNICODE">[13]</a>.</p>
</dd>
<dt>Bytearrays</dt><dd><p>are sequences of bytes. There is no <span>"byte"</span> in <i>OpenMath</i>
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 <i>OpenMath</i> errors to
provide information to, for example, a debugger; they could also
contain intermediate results of calculations, or `handles' into
computations or databases.</p>
</dd>
<dt>Symbols</dt><dd>
<p>
are uniquely defined by the Content Dictionary in which they occur
and by a name. In definition in <a href="#sec_omabs">Section 3.1</a> we have
left this information implicit. However, it should be kept in mind
that all symbols appearing in an <i>OpenMath</i> object are defined in a
Content Dictionary. The form of these definitions is explained in
<a href="#cha_cd">Chapter 5</a>. 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
<code>union</code> is defined as
associative-commutativeset theoretic union in a Content Dictionary
<code>set1</code> but another Content Dictionary,
<code>multiset1</code> might define a symbol
<code>union</code> as the union of multi-sets. The name
of a symbol can only contain alphanumeric characters and
underscores. More precisely, a symbol name matches the following
regular expression: <blockquote><p>
[<code>A</code>-<code>Z</code><code>a</code>-<code>z</code>]
[<code>A</code>-<code>Z</code><code>a</code>-<code>z</code><code>0</code>-<code>9</code><code>_</code>]*
</p></blockquote></p>
<p>Notice that these symbol names are case sensitive. <i>OpenMath</i>
<i>recommends</i> that symbol names should be no longer than
100 characters.</p>
</dd>
<dt>Variables</dt><dd><p>are meant to
denote parameters, variables or indeterminates (such as bound
variables of function definitions, variables in summations and
integrals, independent variables of derivatives). Plain variable
names are restricted to use a subset of the printable ASCII
characters. Formally the names must match the regular expression:
<blockquote><p> [A-Za-z0-9=+(),-./:?!#$%*;=@[]^_`{|}]+
</p></blockquote></p>
</dd>
</dl> </p>
<p>The four following constructs can be used to make compound <i>OpenMath</i>
objects.</p>
<dl>
<dt>Application</dt><dd><p>constructs an
<i>OpenMath</i> object from a sequence of one or more <i>OpenMath</i> objects. The first
argument of application is referred to as <span>"head"</span> while
the remaining objects are called <span>"arguments"</span>. An <i>OpenMath</i>
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 <i>OpenMath</i> symbol <code>sin</code> is defined
in a Content Dictionary for trigonometry, then <m:math><m:mi mathvariant="bold">application</m:mi><m:mo>(</m:mo><m:mi>sin</m:mi><m:mo>,</m:mo>
<m:mi>x</m:mi> <m:mo>)</m:mo></m:math> is the abstract <i>OpenMath</i> object
corresponding to <m:math><m:mi>sin</m:mi> <m:mo>(</m:mo><m:mi>x</m:mi>
<m:mo>)</m:mo></m:math>. More generally, an <i>OpenMath</i> 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
<m:math><m:mn>1</m:mn><m:mo>/</m:mo><m:mn>2</m:mn></m:math>, is represented by the
<i>OpenMath</i> application object <m:math><m:mi mathvariant="bold">application</m:mi><m:mo>(</m:mo><m:mi>Rational</m:mi><m:mo>,</m:mo>
<m:mn>1</m:mn><m:mo>,</m:mo> <m:mn>2</m:mn><m:mo>)</m:mo></m:math>. The symbol
<code>Rational</code> must be defined, by a Content
Dictionary, as a constructor symbol for the rational numbers.</p>
<div class="figure"><a name="fig_obj" id="fig_obj"/>
<img src="lambda.png" alt="lambda.png"/>
<div>
Figure 3.1 The <i>OpenMath</i> application and binding objects for
<m:math><m:mi>sin</m:mi> <m:mo>(</m:mo><m:mi>x</m:mi> <m:mo>)</m:mo></m:math> and
<m:math><m:mi>λ</m:mi> <m:mi>x</m:mi><m:mo>.</m:mo><m:mi>x</m:mi> <m:mo>+</m:mo>
<m:mn>2</m:mn></m:math> in tree-like notation.</div></div>
</dd>
<dt>Binding</dt><dd><p>objects are
constructed from an <i>OpenMath</i> object, and from a sequence of zero or more
variables followed by another <i>OpenMath</i> object. The first <i>OpenMath</i> object is
the <span>"binder"</span> object. Arguments 2 to
<m:math><m:mi>n</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:math> are always variables to
be bound in the <span>"body"</span> which is the
<m:math><m:msup><m:mi>n</m:mi><m:mi>th</m:mi></m:msup></m: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 <m:math><m:mi>λ</m:mi>
<m:mi>x</m:mi><m:mo>.</m:mo><m:mi>x</m:mi> <m:mo>+</m:mo><m:mn>2</m:mn></m:math>, in which
the variable <m:math><m:mi>x</m:mi></m:math> is bound by
<m:math><m:mi>λ</m:mi></m:math>, corresponds to a binding object having
as binder the <i>OpenMath</i> symbol <code>lambda</code>: <m:math display="block"><m:mi mathvariant="bold">binding</m:mi><m:mo>(</m:mo><m:mi>lambda</m:mi><m:mo>,</m:mo>
<m:mi>x</m:mi> <m:mo>,</m:mo> <m:mi mathvariant="bold">application</m:mi><m:mo>(</m:mo><m:mi>plus</m:mi><m:mo>,</m:mo>
<m:mi>x</m:mi> <m:mo>,</m:mo>
<m:mn>2</m:mn><m:mo>)</m:mo><m:mo>)</m:mo><m:mtext>.</m:mtext></m:math></p>
<p class="del">Binding of several variables as in: <m:math display="block"><m:mi mathvariant="bold">binding</m:mi>
<m:mo>(</m:mo><m:mi>B</m:mi><m:mo>,</m:mo>
<m:msub><m:mi>v</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo>
<m:mi>…</m:mi><m:mo>,</m:mo>
<m:msub><m:mi>v</m:mi><m:mi>n</m:mi></m:msub><m:mo>,</m:mo> <m:mi>C</m:mi>
<m:mo>)</m:mo></m:math> is semantically equivalent to composition of
binding of a single variable, namely
<m:math display="block">
<m:mi mathvariant="bold">binding</m:mi>
<m:mo>(</m:mo>
<m:mi>B</m:mi>
<m:mo>,</m:mo>
<m:msub><m:mi>v</m:mi><m:mn>1</m:mn></m:msub>
<m:mo>,</m:mo>
<m:mo>(</m:mo>
<m:mi mathvariant="bold">binding</m:mi>
<m:mo>(</m:mo>
<m:mi>B</m:mi>
<m:mo>,</m:mo>
<m:msub><m:mi>v</m:mi><m:mn>2</m:mn></m:msub>
<m:mo>,</m:mo>
<m:mo>(</m:mo>
<m:mi>…</m:mi>
<m:mo>,</m:mo>
<m:mi mathvariant="bold">binding</m:mi>
<m:mo>(</m:mo>
<m:mi>B</m:mi>
<m:mo>,</m:mo>
<m:msub><m:mi>v</m:mi><m:mi>n</m:mi></m:msub>
<m:mo>,</m:mo>
<m:mi>C</m:mi>
<m:mo>)</m:mo>
<m:mi>…</m:mi>
<m:mo>)</m:mo>
<m:mtext>.</m:mtext>
</m:math>
</p>
<p class="del">Note that it follows from
this that repeated occurrences of the same variable in a binding
operator are allowed. For example the object
<m:math display="block">
<m:mi mathvariant="bold">binding</m:mi>
<m:mo>(</m:mo><m:mi>lambda</m:mi><m:mo>,</m:mo> <m:mi>v</m:mi> <m:mo>,</m:mo>
<m:mi>v</m:mi> <m:mo>,</m:mo><m:mi mathvariant="bold">application</m:mi>
<m:mo>(</m:mo><m:mi>times</m:mi><m:mo>,</m:mo><m:mi>v</m:mi>
<m:mo>,</m:mo><m:mi>v</m:mi><m:mo>)</m:mo> <m:mo>)</m:mo></m:math> is semantically
equivalent to: <m:math display="block"><m:mi mathvariant="bold">binding</m:mi><m:mo>(</m:mo><m:mi>lambda</m:mi><m:mo>,</m:mo>
<m:mi>v</m:mi><m:mo>,</m:mo> <m:mi mathvariant="bold">binding</m:mi>
<m:mo>(</m:mo><m:mi>lambda</m:mi><m:mo>,</m:mo> <m:mi>v</m:mi><m:mo>,</m:mo><m:mi mathvariant="bold">application</m:mi><m:mo>(</m:mo><m:mi>times</m:mi><m:mo>,</m:mo><m:mi>v</m:mi><m:mo>,</m:mo><m:mi>v</m:mi><m:mo>)</m:mo><m:mo>)</m:mo><m:mo>)</m:mo></m:math>
so that the outermost binding is actually a constant function
(<m:math><m:mi>v</m:mi></m:math> does not occur free in the body <m:math><m:mi mathvariant="bold">application</m:mi>
<m:mo>(</m:mo><m:mi>times</m:mi><m:mo>,</m:mo><m:mi>v</m:mi>
<m:mo>,</m:mo><m:mi>v</m:mi><m:mo>)</m:mo> <m:mo>)</m:mo></m:math>).</p>
<p>Phrasebooks are allowed to use <m:math><m:mi>α</m:mi></m:math>
conversion in order to avoid clashes of variable names. Suppose an
object <m:math><m:mi>Ω</m:mi></m:math> contains an occurrence of the
object <m:math><m:mi mathvariant="bold">binding</m:mi>
<m:mo>(</m:mo><m:mi>B</m:mi> <m:mo>,</m:mo> <m:mi>v</m:mi> <m:mo>,</m:mo> <m:mi>C</m:mi>
<m:mo>)</m:mo></m:math>. This object <m:math><m:mi mathvariant="bold">binding</m:mi> <m:mo>(</m:mo><m:mi>B</m:mi> <m:mo>,</m:mo>
<m:mi>v</m:mi> <m:mo>,</m:mo> <m:mi>C</m:mi> <m:mo>)</m:mo></m:math> can be replaced
in <m:math><m:mi>Ω</m:mi></m:math> by <m:math><m:mi mathvariant="bold">binding</m:mi> <m:mo>(</m:mo><m:mi>B</m:mi> <m:mo>,</m:mo>
<m:mi>z</m:mi> <m:mo>,</m:mo> <m:mi>C'</m:mi><m:mo>)</m:mo></m:math> where
<m:math><m:mi>z</m:mi></m:math> is a variable not occurring free in
<m:math><m:mi>C</m:mi></m:math> and <m:math><m:mi>C'</m:mi></m:math> is obtained
from <m:math><m:mi>C</m:mi></m:math> by replacing each free (i.e., not bound
by any intermediate <b>binding</b> construct) occurrence
of <m:math><m:mi>v</m:mi></m:math> by <m:math><m:mi>z</m:mi></m:math>. This
operation preserves the semantics of the object
<m:math><m:mi>Ω</m:mi></m:math>. In the above example, a phrasebook is
thus allowed to transform the object to, e.g. <m:math class="del" display="block"><m:mi mathvariant="bold">binding</m:mi>
<m:mo>(</m:mo><m:mi>lambda</m:mi><m:mo>,</m:mo> <m:mi>v</m:mi> <m:mo>,</m:mo> <m:mi mathvariant="bold">binding</m:mi> <m:mo>(</m:mo><m:mi>lambda</m:mi><m:mo>,</m:mo>
<m:mi>z</m:mi> <m:mo>,</m:mo><m:mi mathvariant="bold">application</m:mi>
<m:mo>(</m:mo><m:mi>times</m:mi><m:mo>,</m:mo><m:mi>z</m:mi>
<m:mo>,</m:mo><m:mi>z</m:mi><m:mo>)</m:mo><m:mo>)</m:mo><m:mo>)</m:mo><m:mtext>.</m:mtext></m:math>
<m:math class="new" display="block"><m:mi mathvariant="bold">binding</m:mi><m:mo>(</m:mo><m:mi>lambda</m:mi><m:mo>,</m:mo>
<m:mi>z</m:mi> <m:mo>,</m:mo> <m:mi mathvariant="bold">application</m:mi><m:mo>(</m:mo><m:mi>plus</m:mi><m:mo>,</m:mo>
<m:mi>z</m:mi> <m:mo>,</m:mo>
<m:mn>2</m:mn><m:mo>)</m:mo><m:mo>)</m:mo><m:mtext>.</m:mtext></m:math>
</p>
<p class="new">Repeated occurrences of the same variable in a
binding operator are allowed. An OpenMath 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. <m:math display="block"><m:mi mathvariant="bold">binding</m:mi> <m:mo>(</m:mo><m:mi>lambda</m:mi><m:mo>,</m:mo>
<m:mi>v</m:mi> <m:mo>,</m:mo> <m:mi>v</m:mi> <m:mo>,</m:mo><m:mi mathvariant="bold">application</m:mi>
<m:mo>(</m:mo><m:mi>times</m:mi><m:mo>,</m:mo><m:mi>v</m:mi>
<m:mo>,</m:mo><m:mi>v</m:mi><m:mo>)</m:mo> <m:mo>)</m:mo></m:math> is semantically
equivalent to: <m:math display="block"><m:mi mathvariant="bold">binding</m:mi> <m:mo>(</m:mo><m:mi>lambda</m:mi> <m:mo>,</m:mo>
<m:msup><m:mi>v</m:mi><m:mo>'</m:mo></m:msup> <m:mo>,</m:mo> <m:mi>v</m:mi>
<m:mo>,</m:mo><m:mi mathvariant="bold">application</m:mi>
<m:mo>(</m:mo><m:mi>times</m:mi><m:mo>,</m:mo><m:mi>v</m:mi>
<m:mo>,</m:mo><m:mi>v</m:mi><m:mo>)</m:mo> <m:mo>)</m:mo></m:math> so that the
resulting function is actually a constant in its first argument
(<m:math><m:msup><m:mi>v</m:mi><m:mo>'</m:mo></m:msup></m:math> does not occur free
in the body <m:math><m:mi mathvariant="bold">application</m:mi>
<m:mo>(</m:mo><m:mi>times</m:mi><m:mo>,</m:mo><m:mi>v</m:mi>
<m:mo>,</m:mo><m:mi>v</m:mi><m:mo>)</m:mo> <m:mo>)</m:mo></m:math>).</p>
</dd>
<dt>Attribution</dt><dd><p>decorates an
object with a sequence of one or more pairs made up of an <i>OpenMath</i>
symbol, the <span>"attribute"</span>, and an associated <i>OpenMath</i> object,
the <span>"value of the attribute"</span>. The value of the
attribute can be an attribution object itself. As example of this,
consider the <i>OpenMath</i> objects representing groups, automorphism groups,
and group dimensions. It is then possible to attribute an <i>OpenMath</i>
object representing a group by its automorphism group, itself
attributed by its dimension.</p>
<p>Composition of attributions, as in
<m:math display="block">
<m:mi mathvariant="bold">attribution</m:mi><m:mo>(</m:mo><m:mi mathvariant="bold">attribution</m:mi><m:mo>(</m:mo><m:mi>A</m:mi><m:mo>,</m:mo>
<m:msub><m:mi>S</m:mi><m:mn>1</m:mn></m:msub> <m:mspace width=".3em"/>
<m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo><m:mi>…</m:mi><m:mo>,</m:mo><m:msub><m:mi>S</m:mi><m:mi>h</m:mi></m:msub>
<m:mspace width=".3em"/>
<m:msub><m:mi>A</m:mi><m:mi>h</m:mi></m:msub><m:mo>)</m:mo><m:mo>,</m:mo>
<m:msub><m:mi>S</m:mi><m:mrow><m:mi>h</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub>
<m:mspace width=".3em"/>
<m:msub><m:mi>A</m:mi><m:mrow><m:mi>h</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>,</m:mo>
<m:mi>…</m:mi><m:mo>,</m:mo> <m:msub><m:mi>S</m:mi><m:mi>n</m:mi></m:msub> <m:mspace width=".3em"/> <m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub><m:mo>)</m:mo></m:math> is
semantically equivalent to a single attribution, that is <m:math display="block"><m:mi mathvariant="bold">attribution</m:mi><m:mo>(</m:mo><m:mi>A</m:mi><m:mo>,</m:mo>
<m:msub><m:mi>S</m:mi><m:mn>1</m:mn></m:msub> <m:mspace width=".3em"/>
<m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo>
<m:mi>…</m:mi><m:mo>,</m:mo> <m:msub><m:mi>S</m:mi><m:mi>h</m:mi></m:msub> <m:mspace width=".3em"/> <m:msub><m:mi>A</m:mi><m:mi>h</m:mi></m:msub><m:mo>,</m:mo>
<m:msub><m:mi>S</m:mi><m:mrow><m:mi>h</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub>
<m:mspace width=".3em"/>
<m:msub><m:mi>A</m:mi><m:mrow><m:mi>h</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>,</m:mo>
<m:mi>…</m:mi><m:mo>,</m:mo> <m:msub><m:mi>S</m:mi><m:mi>n</m:mi></m:msub> <m:mspace width=".3em"/>
<m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub><m:mo>)</m:mo><m:mtext>.</m:mtext></m:math>
The operation that produces an object with a single layer of
attribution is called <code>flattening</code>.</p>
<p>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 <m:math><m:msub><m:mi>S</m:mi><m:mi>h</m:mi></m:msub> <m:mo>=</m:mo>
<m:msub><m:mi>S</m:mi><m:mi>n</m:mi></m:msub></m:math>
(<m:math><m:mi>h</m:mi> <m:mo><</m:mo> <m:mi>n</m:mi></m:math>) in the example above. Then, the
object is to be interpreted as if the value <m:math><m:msub><m:mi>A</m:mi><m:mi>n</m:mi></m:msub></m:math> overwrites the
value <m:math><m:msub><m:mi>A</m:mi><m:mi>h</m:mi></m:msub></m:math>. (<i>OpenMath</i> however does not mandate that an application
preserves the attributes or their order.)</p>
<p>Objects can be decorated in a multitude of
ways. In <a href="#OM_D131b">[6]</a>, typing of <i>OpenMath</i> objects is
expressed by using an attribution. The object <m:math><m:mi mathvariant="bold">attribution</m:mi><m:mo>(</m:mo><m:mi>A</m:mi><m:mo>,</m:mo>
<m:mi>type</m:mi> <m:mspace width=".3em"/> <m:mi>t</m:mi> <m:mo>)</m:mo></m:math>
represents the judgment stating that object <m:math><m:mi>A</m:mi></m:math>
has type <m:math><m:mi>t</m:mi></m:math>. Note that both
<m:math><m:mi>A</m:mi></m:math> and <m:math><m:mi>t</m:mi></m:math> are <i>OpenMath</i>
objects.</p>
<p>Attribution can act as either annotation, in the sense of adornment,
or as modifier. In the former case, replacement of the adorned
object by the object itself is probably not harmful (preserves the
semantics). In the latter case however, it may very well be.
Therefore, attribution in general should by default be treated as a
construct rather than as adornment. Only when the CD definitions of
the attributes make it clear that they are adornments, can the
attributed object be viewed as semantically equivalent to the
stripped object.</p>
</dd>
<dt>Error</dt><dd><p>is made up of an <i>OpenMath</i>
symbol and a sequence of zero or more <i>OpenMath</i> objects. This object has
no direct mathematical meaning. Errors occur as the result of some
treatment on an <i>OpenMath</i> object and are thus of real interest only when
some sort of communication is taking place. Errors may occur inside
other objects and also inside other errors. Error objects might
consist only of a symbol as in the object: <m:math><m:mi mathvariant="bold">error</m:mi> <m:mo>(</m:mo><m:mi>S</m:mi>
<m:mo>)</m:mo></m:math>.</p>
</dd>
</dl>
</div>
<div><h3 name="sec_summary" id="sec_summary">3.3 Summary</h3>
<ul>
<li><p><i>OpenMath</i> supports basic objects like integers, symbols,
floating-point numbers, character strings, bytearrays, and
variables.</p></li>
<li><p><i>OpenMath</i> compound objects are of four kinds: applications, bindings,
errors, and attributions.</p></li>
<li><p><i>OpenMath</i> objects have the expressive power to cover all areas of
computational mathematics.</p></li>
</ul>
<p>Observe that an <i>OpenMath</i> application object is viewed as a <span>"tree"</span> by
software applications that do not understand Content Dictionaries,
whereas a Phrasebook that understands the semantics of the symbols, as
defined in the Content Dictionaries, should interpret the object as
functional application, constructor, or binding accordingly. Thus, for
example, for some applications, the <i>OpenMath</i> object corresponding
to <m:math><m:mn>2</m:mn><m:mo>+</m:mo><m:mn>5</m:mn></m:math> may result in a command that writes <m:math><m:mn>7</m:mn></m:math>.</p>
</div>
<h2 name="cha_enco" id="cha_enco">
Chapter 4<br/><i>OpenMath</i> Encodings</h2>
<p>In this chapter, two encodings are defined that map between <i>OpenMath</i>
objects and byte streams. These byte streams constitute a low level
representation that can be easily exchanged between processes (via
almost any communication method) or stored and retrieved from files.</p>
<p>The first encoding uses ISO 646:1983 characters <a href="#iso646_83">[2]</a>
(also known as <span>ascii</span> characters) and is an <span>xml</span>
application. Although the <span>xml</span> markup of the encoding uses only <span>ascii</span>
characters, OpenMath strings may use
arbitrary Unicode/ISO 10646:1988
characters <a href="#UNICODE">[13]</a>.
It can be used, for example, to send <i>OpenMath</i> objects via
e-mail, news, cut-and-paste, etc. The texts produced by this encoding
can be part of <span>xml</span> documents.</p>
<p>The second encoding is a binary encoding that is meant to be used when
the compactness of the encoding is important (interprocess communications
over a network is an example).</p>
<p>Note that these two encodings are sufficiently different for
autodetection to be effective: an application reading the bytes can
very easily determine which encoding is used.</p>
<div><h3 name="sec_xml" id="sec_xml">4.1 The <span>xml</span> Encoding</h3>
<p>This encoding has been designed with two main goals in mind:
<ol>
<li><p>to provide an encoding that uses the most common character set
(so that it can be easily included in most documents and transport
protocols) and that is both readable and writable by a human.</p></li>
<li><p>to provide an encoding that can be included (embedded) in
<span>xml</span> documents.</p></li>
</ol>
</p>
<div><h4 name="ssec_xml" id="ssec_xml">4.1.1 A Grammar for the <span>xml</span> Encoding</h4>
<p>The <span>xml</span> encoding of an OpenMath object is defined by the <span>dtd</span> given
in <a href="#fig_objdtd">Figure 4.1</a> below, with the following additional rules
not implied by the <span>xml</span> <span>dtd</span>.</p>
<ul>
<li><p>Comments are permitted only between
elements, not within element character data.</p></li>
<li><p>Processing Instructions are only allowed before the <span>OMOBJ</span>
element.</p></li>
<li><p>The content of an <span>OMB</span> element, is a valid base64-encoded text.</p></li>
<li><p>The character data forming element content and attribute values
matches the regular expressions of <a href="#fig_xml">Figure 4.2</a>.</p></li>
</ul>
<div class="figure"><a name="fig_objdtd" id="fig_objdtd"/>
<div class="literal"><pre>
<!-- DTD for OM Objects - sb 29.10.98 -->
<!-- sb 3.2.99 -->
<!--
general list of embeddable elements
: excludes OMATP as this is only embeddable in OMATTR
: excludes OMBVAR as this is only embeddable in OMBIND
-->
<!ENTITY % omel "OMS | OMV | OMI | OMB | OMSTR
| OMF | OMA | OMBIND | OME
| OMATTR ">
<!-- things which can be variables -->
<!ENTITY % omvar "OMV | OMATTR" >
<!-- symbol -->
<!ELEMENT OMS EMPTY>
<!ATTLIST OMS name CDATA #REQUIRED
cd CDATA #REQUIRED >
<!-- variable -->
<!ELEMENT OMV EMPTY>
<!ATTLIST OMV name CDATA #REQUIRED >
<!-- integer -->
<!ELEMENT OMI (#PCDATA) >
<!-- byte array -->
<!ELEMENT OMB (#PCDATA) >
<!-- string -->
<!ELEMENT OMSTR (#PCDATA) >
<!-- floating point -->
<!ELEMENT OMF EMPTY>
<!ATTLIST OMF dec CDATA #IMPLIED
hex CDATA #IMPLIED>
<!-- apply constructor -->
<!ELEMENT OMA (%omel;)+ >
<!-- binding constructor & variable -->
<!ELEMENT OMBIND ((%omel;), OMBVAR, (%omel;)) >
<!ELEMENT OMBVAR (%omvar;)+ >
<!-- error -->
<!ELEMENT OME (OMS, (%omel;)* ) >
<!-- attribution constructor & attribute pair constructor -->
<!ELEMENT OMATTR (OMATP, (%omel;)) >
<!ELEMENT OMATP (OMS, (%omel;))+ >
<!-- OM object constructor -->
<!ELEMENT OMOBJ (%omel;) >
</pre></div>
<div>
Figure 4.1 DTD for the <i>OpenMath</i> <span>xml</span> encoding of objects.</div></div>
<p>In addition, if the <span>xml</span> document encoding the <i>OpenMath</i> object is
linearised into the <span>xml</span> concrete syntax, the following further
constraints apply, which ensure thet the encoding may be read by <i>OpenMath</i>
applications that may not include a full <span>xml</span> parser.</p>
<ul>
<li><p>The document should use <span>utf-8</span> encoding.</p></li>
<li class="del"><p>Entity and character references should not be used.</p></li>
<li><p>A <code><!DOCTYPE</code> declaration should not be used.</p></li>
<li class="new"><p>Character references should not be used. As <code><!DOCTYPE</code>
is not used, the only entity references that are allowed are the five predefined entity
references:
<code>&apos;</code> ('),
<code>&quot;</code> ("),
<code>&lt;</code> (<),
<code>&gt;</code> (>),
<code>&amp;</code> (&).
</p></li>
<li><p>The <span>xml</span> empty element form <code><|<span>…</span>/></code> should always be
used to encode elements such as <span>omf</span> which are specified in the
<span>dtd</span> as
being <span>empty</span>. It should never be used for elements that may sometimes be
empty, such as <span>omstr</span>.</p></li>
</ul>
<p>Such a linearisation of an <span>xml</span> encoded <i>OpenMath</i> Object would match the
match the character based grammar given in <a href="#fig_xml">Figure 4.2</a>.</p>
<p>The notation used in this section and in <a href="#fig_xml">Figure 4.2</a> should
be quite straightforward (+ meaning <span>"one or more"</span>, ? meaning zero or
one, and <m:math><m:mi>|</m:mi></m:math> meaning <span>"or"</span>). The start symbol of the grammar is
<span>"start"</span>, <span>"space"</span> stands for the space character, <span>"cr"</span> for the
carriage return character, <span>"nl"</span> for the line feed character and
<span>"tab"</span> for the horizontal tabulation character.</p>
<div class="figure"><a name="fig_xml" id="fig_xml"/>
<table>
<tr>
<td>
S </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td> (space<m:math><m:mi>|</m:mi></m:math>tab<m:math><m:mi>|</m:mi></m:math>cr<m:math><m:mi>|</m:mi></m:math>nl)+
</td>
</tr>
<tr>
<td>
integer </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td>
(<code>-</code> S?)? [0-9]+ (S [0-9]+)* <m:math><m:mi>|</m:mi></m:math>
(<code>-</code> S?)? <code>x</code> S? [0-9A-F]+ (S [0-9A-F]+)*
</td>
</tr>
<tr>
<td>
cdname </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td> [a-z][a-z0-9<code>_</code>]*
</td>
</tr>
<tr>
<td>
symbname </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td> [A-Za-z][A-Za-z0-9<code>_</code>]*
</td>
</tr>
<tr>
<td>
fpdec </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td>
(<code>-</code>?)([0-9]+)?(<code>.</code>[0-9]+)?(<code>e</code>([+-]?)[0-9]+)?
</td>
</tr>
<tr>
<td>
fphex </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td> [0-9ABCDEF]+
</td>
</tr>
<tr>
<td>
varname </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td> ([A-Za-z0-9+=(),-./:?!#$%*;@[]^_`{|}])+
</td>
</tr>
<tr>
<td>
base64 </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td> ([A-Za-z0-9 +/=] <m:math><m:mi>|</m:mi></m:math> S)+
</td>
</tr>
<tr>
<td>
vv
char </td><td> <m:math><m:mo>→</m:mo></m:math> </td><td> <i>XML Character Data</i>
</td>
</tr>
</table>
<table>
<tr>
<td>
symbnameatt</td><td> <m:math><m:mo>→</m:mo></m:math></td><td>
<code>name</code> S? = S? (<code>"</code> symbname <code>"</code> <code>|</code> <code>'</code> symbname <code>'</code>)
</td>
</tr>
<tr>
<td>
cdnameatt</td><td> <m:math><m:mo>→</m:mo></m:math></td><td>
<code>cd</code> S? = S? (<code>"</code> cdname <code>"</code> <code>|</code> <code>'</code> cdname <code>'</code>)
</td>
</tr>
<tr>
<td>
varnameatt</td><td> <m:math><m:mo>→</m:mo></m:math></td><td>
<code>name</code> S? = S? (<code>"</code> varname <code>"</code> <code>|</code> <code>'</code> varname <code>'</code>)