OpenMath Content Dictionary: list1

Canonical URL:
http://www.openmath.org/cd/list1.ocd
CD File:
list1.ocd
CD as XML Encoded OpenMath:
list1.omcd
Defines:
list, map, suchthat
Date:
2001-03-12
Version:
2
Review Date:
2003-04-01
Status:
official
Uses CD:
arith1, setname1, interval1, fns1, logic1, relation1, alg1, set1

This CD is intended to be `compatible' with MathML list constructs.


map

This symbol represents a mapping function which may be used to construct lists, it takes as arguments a function from X to Y and a list over X in that order. The value that is returned is a list of values in Y. The argument list may be a set or an integer_interval.

Example:
The list of even values between 0 and 20 in ascending order, that is the values 2x in ascending order, where x ranges over the integral interval [0,10].
<OMOBJ>
  <OMA>
    <OMS cd="list1" name="map"/>
    <OMBIND>
      <OMS cd="fns1" name="lambda"/>
      <OMBVAR>
        <OMV name="x"/>
      </OMBVAR>
      <OMA>
        <OMS cd="arith1" name="times"/>
        <OMI> 2 </OMI>
	<OMV name="x"/>
      </OMA>
    </OMBIND>
    <OMA>
      <OMS cd="interval1" name="integer_interval"/>
      <OMI> 0 </OMI>
      <OMI> 10 </OMI>
    </OMA>
  </OMA>
</OMOBJ>

map (lambda [ x ] . (times ( 2 , x) ) , integer_interval ( 0 , 10 ) )

Signatures:
sts


[Next: suchthat] [Last: list] [Top]

suchthat

This symbol represents the suchthat function which may be used to construct lists, it takes two arguments. The first argument should be the set which contains the elements of the list, the second argument should be a predicate, that is a function from the set to the booleans which describes if an element is to be in the list returned.

Example:
This example shows how to construct the list of even positive integers less than 100, using the suchthat constructor.
<OMOBJ>
  <OMA>
    <OMS cd="list1" name="suchthat"/>
    <OMS cd="setname1" name="Z"/>
    <OMBIND>
      <OMS cd="fns1" name="lambda"/>
      <OMBVAR>
        <OMV name="x"/>
      </OMBVAR>
      <OMA>
        <OMS cd="logic1" name="and"/>
	<OMA>
	  <OMS cd="relation1" name="geq"/>
	  <OMV name="x"/>
	  <OMS cd="alg1" name="zero"/>
	</OMA>
	<OMA>
	  <OMS cd="relation1" name="lt"/>
	  <OMV name="x"/>
	  <OMI> 100 </OMI>
	</OMA>
        <OMA>
          <OMS cd="set1" name="in"/>
	  <OMA>
	    <OMS cd="arith1" name="divide"/>
	    <OMV name="x"/>
	    <OMI> 2 </OMI>
	  </OMA>
	  <OMS cd="setname1" name="Z"/>
        </OMA>
      </OMA>
    </OMBIND>
  </OMA>
</OMOBJ>

suchthat (Z, lambda [ x ] . (and (geq ( x, zero) , lt ( x, 100 ) , in (divide ( x, 2 ) , Z) ) ) )

Signatures:
sts


[Next: list] [Previous: map] [Top]

list

This symbol denotes the list construct which is an n-ary function. The list entries must be given explicitly.

Example:
The list 3, 6, 9.
<OMOBJ>
  <OMA>
    <OMS cd="list1" name="list"/>
    <OMI> 3 </OMI>
    <OMI> 6 </OMI>
    <OMI> 9 </OMI>
  </OMA>
</OMOBJ>

list ( 3 , 6 , 9 )

Signatures:
sts


[First: map] [Previous: suchthat] [Top]