1
$\begingroup$

Preface: So, it was suggested in 'Programmers' that I ask this over here.

I am being asked to define several of my algorithms in mathematical terms to describe my work to a customer. I trying to determine if anybody knows whether common operators for collections like sequences, lists, tuples, etc have been defined. If so, is there a good reference that I could be pointed to. Thanks. I am interested in the actual symbols used. I am wondering if the following would make sense or be appropiate to anybody.

Given two sequences (or strings):

S = (A, B, C) and T = (A, D, H)

In my mind, the intersection of these sequences would look like S ∩ T = (A) and the union of these sequences would be S ∪ T = (A, B, C, A, D, H)

$\endgroup$
8
  • 2
    $\begingroup$ It's not clear what intersection and union look like for sets of sequences: your intersection operation looks like a set intersection, but the union operation looks like a disjoint union, and probably should merely be concatenation (+). $\endgroup$ Nov 17, 2010 at 23:27
  • 2
    $\begingroup$ Next time you crosspost, please add a link! programmers.stackexchange.com/questions/19701/… $\endgroup$ Nov 18, 2010 at 1:24
  • 2
    $\begingroup$ Perhaps more suitable for MathOverflow. Sequence, list, tuples are all linearly ordered structures, a collection is usually used as an alternative name for sets which are unordered. If you are talking about linearly ordered collections then parenthesis (there are other notations also) seems OK to me, you may want to look at notations for list operations. Someone from PL theory would know better, they are pretty good with symbols :). $\endgroup$
    – Kaveh
    Nov 18, 2010 at 3:46
  • 1
    $\begingroup$ In my math education I have yet do encounter a notation for collections (or multisets). I would probably go with $[A, B, A, ...]$ because I am not aware of any conflicts and it is immediately clear to any programmer. $\endgroup$
    – Raphael
    Dec 18, 2010 at 9:35
  • 1
    $\begingroup$ But that is what collections typically are, afaik. See, e.g., download.oracle.com/javase/6/docs/api/java/util/Collection.html $\endgroup$
    – Raphael
    Dec 18, 2010 at 13:58

3 Answers 3

5
$\begingroup$

Specification languages such as Z have a vast range of data types and operations on them and, at least within that community, these are standardised. This tutorial gives a great overview. Other specification languages exist, such as B and Alloy which may also satisfy your requirements.

$\endgroup$
1
$\begingroup$

Relational algebra symbology most accurately depicts what I am trying to communicate.

http://en.wikipedia.org/wiki/Relational_algebra

$\endgroup$
1
$\begingroup$

Just define what you need and try to give it a descriptive name. The first example could be the largest common prefix (can't really tell from an example). The second just looks like a concatenation (which is usually +).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.