ASPL User Guide v 1.00
© 2025 Bassem W. Jamaleddine


16. 1
   Quotient Set by an Equivalence Relation

 

Define a relation

      q   r := relationexpression       where r is a relation

Get the quotient set relative to r

      f&/~r   a1 a2       where a1 a2 are set variables

Quotient set by an equivalence relation

●  f&/~r Get The Quotient Set Relative to r

When comparing groups, it is useful to find elements that are equivalent to each other. The notion of determining what is being equivalent without being equal is a thoughtful process when comparing groups based on their semantic internal composition describing their constituent of subgroups and elements (in particular when these constituents are labels formed of strings or words). The mechanism of getting the equivalent subgroups and elements (between groups) is performed through some algebraic processor that can be represented by three symbols: / ~ r

From an algorithmic perspective, the processor is a selection routine that can be viewed as an iterative loop, within it, elements are being selected based on some regular expression matching rules. In ASPL, users can use the equivalence relation without knowing anything about the implementation of its selective processing routines.

Let's summarize the meaning of the three symbols: / ~ r
The r is the relation.
The ~ is used as the equivalence symbol and typically it precedes the relation; hence ~r means to apply the equivalence relation r.
The / is used as the quotient symbol and typically it follows the group name as to say get the quotient as the resulting parts (or partitions) represented in the group under the equivalence relation.

In ASPL, one can combine the three symbols, then suffix them to a set operator verb to denote the equivalence relation to be applied on the action of the operator, hence grouping the elements that are considered equivalent under that relation, and the resulting group is called the quotient set.

For example, f&/~r means to get the elements intersection by applying the equivalence relation ~r.
To be more exact, f&/~r means to get the quotient set by performing the elements intersection operation while applying the equivalence relation ~r.

f&/~r means to get the quotient set by performing the elements intersection operation while applying the equivalence relation ~r.
From ASPL operation perspective, we say the f& is stroked with the ~r, aiming at the quotient set of f& relative to the equivalence relation r.

 

■ Defining an Equivalence Relation

The user can define a relation to be used in an equivalence relation by using

q qorelsymbol := relationexpression

where qorelsymbol is a word used as a symbol to identify the relation, and relationexpression is a descriptive string guiding ASPL processing routines on how to process the relation.
The relationexpression is a comma delimited expression that may include
  • frx=regex-to-match-element-names
  • drx=regex-to-match-subgroups-names
  • grx=regex-to-match-subgroups-or-element-names
  • and any one of the following: c= c~ c~~ h= h~ h~~ mtm= mtm~ mtm~~ mtm< mtm<= mtm> mtm>= ks= ks~ ks~~
It is simpler to look at an example to explain how to get a quotient set under an equivalence relation.

To define the relation to find the equivalent of all elements containing the word 'eclipse' within the subgroups containing the word 'planet', and whose attribute checksums are different, one can type:

aspl> q r := drx=.*planet.*,frx=.*eclipse.*,c~

When f& is stroked with the equivalence relation as such f&/~r, ASPL will view it internally as:
    f& / drx=.*planet.*,frx=.*eclipse.*,c~  
     | |        |              |         |  
     | |        |              |         |  
     | |        |              |         |  
     | |        |              |         +-----> have different checksums
     | |        |              +---------------> element names regular expression
     | |        +------------------------------> subgroup names regular expression
     | +---------------------------------------> stroking for the Quotient Relation
     +-----------------------------------------> gets the elements intersection

   - named subgroups to match: .*planet.*
   - named elements to match: .*eclipse.*
   - predicate condition on the set operation: c~

Regular expressions can be used as denotational semantics within equivalence relations: While regular expressions allow filtering, selection, and semantic approximation, equivalence relations allow equating with likeness and agreement.



The sample workspace DICERS contains the data for a simulation where three players are tossing dice. Let's set an equivalence relation to select the throws numbered 311 to 315, and 511 to 515, where the players have the same faces (that is the same checksums). We set the following equivalence relation represented by r

aspl> q r := drx=throw[35][1][1-5],c=

The relation is saved in the equivalence relation table, and you will use the q command to print the table.

To display the equivalence relation as being seen by ASPL, you can simply type q followed by the relation symbol.

full view

Image File

 -FG- Fig. 16.1.1   [Defining An Equivalence Relation in ASPL]
ASPL (C) 2025 Bassem Jamaleddine


We apply the equivalence relation on the set intersection to realize when player1 and player2 throws have landed on the same faces for the throws 311 to 315 and 511 to 515.
full view

Image File

 -FG- Fig. 16.1.2   [Equivalence Relation Dice Simulation p1 p2]
ASPL (C) 2025 Bassem Jamaleddine


We can reuse the equivalence relation for player2 and player3.
full view

Image File

 -FG- Fig. 16.1.3   [Equivalence Relation Dice Simulation p2 p3]
ASPL (C) 2025 Bassem Jamaleddine

 

■ Getting the Quotient Set For Event Listeners in JMX

To the end user, the UNIX filesystem consists of directories, subdirectories, and files that are represented by slash delimited strings. Such filesystem can be viewed as a convinient directory service that led computer language designers to take advantage of it. The Java is an object oriented language where packages are laid on the UNIX filesystem and parallel the UNIX directory tree structure: Java packages are structured on top of the UNIX directory structure, and Java classes are saved as files within the structure. It is trivial to save each Java class in its own file. Since ASPL grouping objects are also somehow structured based on the UNIX filesystem, we can take advantage of its quotient set processing capability to compare Java distribution packages.

We want to compare the event listener Java classes between two JMX distributions: so let's find the quotient set for the event listeners found in two JMX Jar files. In this example we show how to apply the equivalence relation drx=.*event.*/i,frx=.*listener.*/i~ on the set intersection of two JMX Jar distributions to display the quotient set for JMX event listeners. You can start ASPL by loading the sample workspace JMXJARQR that is used in this section.

aspl JMXJARQR
    start ASPL loading JMXJARQR

aspl> q evn := drx=.*event.*/i
    Define the equivalence relation evn

aspl> q evnlsn := drx=.*event.*/i,frx=.*listener.*/i
    Define the equivalence relation evnlsn

aspl> DEF FN event := f&/~evn %%1 %%2
    Define event() to get the intersection of the event between jmx1 and jmx2

aspl> DEF FN eventlistener := f&/~evnlsn %%1 %%2
    Define eventlistener() to get the intersection of event listeners between jmx1 and jmx2

aspl> FN event(jmx1,jmx2)
    Display the quotient set for the intersection of the event between jmx1 and jmx2

aspl> FN eventlistener(jmx1,jmx2)
    Display the quotient set for the intersection of event listeners between jmx1 and jmx2



The last two operations are equivalent to the following where we bypassed the function definitions:

aspl> f&/~evn jmx1 jmx2
    Display the intersection of the event between jmx1 and jmx2

aspl> f&/~evnlsn jmx1 jmx2
    Display the intersection of event listeners between jmx1 and jmx2



viewme

 -TC- Display. 16.1.1   [JMXJARQR Sample Workspace]
Terminal showing sample JMXJARQR workspace for Equivalence Relation and Quotient Set