OpenMath Content Dictionary: list2

Canonical URL:
http://www.openmath.org/cd/list2.ocd
CD Base:
http://www.openmath.org/cd
CD File:
list2.ocd
CD as XML Encoded OpenMath:
list2.omcd
Defines:
append, cons, first, in, list_selector, nil, rest, reverse, size
Date:
2004-03-30
Version:
4 (Revision 2)
Review Date:
2017-12-31
Status:
experimental

  Author: OpenMath Consortium
  SourceURL: https://github.com/OpenMath/CDs
            

Several basic list functions are given in this CD.


list_selector

Role:
application
Description:

This symbol takes a positive integer n and a list, and represents the n-th element of that list.

Example:
b = ( a , b , c ) 2
Formal Mathematical property (FMP):
n > 1 l n = rest ( l ) n - 1
Signatures:
sts


[Next: first] [Last: in] [Top]

first

Role:
application
Description:

This symbol represents a function which returns the first elements of its argument, which should be a list.

Formal Mathematical property (FMP):
a = first ( cons ( a , b ) )
Example:
Specification of the first element of the list [1,2,3]
first ( ( 1 , 2 , 3 ) )
Signatures:
sts


[Next: rest] [Previous: list_selector] [Top]

rest

Role:
application
Description:

This symbol represents a function which returns a list made up of all the elements except the first of its argument, which should be a list.

Formal Mathematical property (FMP):
b = rest ( cons ( a , b ) )
Example:
Specification of the list [1,2,3], apart from the first element
rest ( ( 1 , 2 , 3 ) )
Signatures:
sts


[Next: cons] [Previous: first] [Top]

cons

Role:
application
Description:

This symbol represents the cons list function. It takes 2 arguments: the second must be a list, where the elements have the same type as the type of the first. The function denotes a new list which has the first argument as its first element followed by the elements of the second argument.

Commented Mathematical property (CMP):
cons(first(lst),rest(lst))=lst
Formal Mathematical property (FMP):
lst . cons ( first ( lst ) , rest ( lst ) ) = lst
Signatures:
sts


[Next: nil] [Previous: rest] [Top]

nil

Role:
constant
Description:

The empty list

Signatures:
sts


[Next: append] [Previous: cons] [Top]

append

Role:
application
Description:

The operation of joining one list to another

Formal Mathematical property (FMP):
a , lst 1 , lst 2 . cons ( a , append ( lst 1 , lst 2 ) ) = append ( cons ( a , lst 1 ) , lst 2 )
Formal Mathematical property (FMP):
lst . lst = append ( nil , lst )
Signatures:
sts


[Next: reverse] [Previous: nil] [Top]

reverse

Role:
application
Description:

The reverse of a list

Formal Mathematical property (FMP):
reverse ( nil ) = nil
Formal Mathematical property (FMP):
lst , a . reverse ( cons ( a , lst ) ) = append ( reverse ( lst ) , cons ( a , nil ) )
Signatures:
sts


[Next: size] [Previous: append] [Top]

size

Role:
application
Description:

This symbol is used to denote the number of elements in a list. It is either a non-negative integer.

Example:
The size of the list (3,6,9) = 3
size ( ( 3 , 6 , 9 ) ) = 3
Signatures:
sts


[Next: in] [Previous: reverse] [Top]

in

Role:
application
Description:

This symbol has two arguments, an element and a list. It is used to denote that the element is in the given list.

Signatures:
sts


[First: list_selector] [Previous: size] [Top]