Alloy provides syntax for the direct image. R(A) is written in Alloy as A.R
Images according to De Baets and Kerre
Typing
All images have the same basic type requirements, the details of which I will place in a predicate called BKType.
BKTypeXYRAy
RelationXYR
AāX
yāY
pred BKType(X,Y: set univ, R: univ->univ, A: set univ, y: univ) {
R in X->Y
A in X
y in Y
}
Furthermore, I have chosen to extract the range of each set comprehension to its own (characteristic) predicate.
Sub-direct Image
SubDIXYRA:={yāY:ā āAāRy}
Notation.
SubDIXYRA can be written SubDIRA when X and Y are clear from the context.
SubDIRA is written in symbols as Rā²(A)
fun SubDI(X,Y: set univ, R: univ->univ, A: set univ) : set univ {
{ y: Y | SubDI[X,Y,R,A,y] }
}
pred SubDI(X,Y: set univ, R: univ->univ, A: set univ, y: univ) {
BKType[X,Y,R,A,y]
some A
A in R.y
}
Super-direct Image
SupDIXYRA={yāY:ā āRyāA}
Notation.
SupDIXYRA can be written SupDIRA when X and Y are clear from the context.
SupDIRA is written in symbols as Rā³(A)
fun SupDI(X,Y: set univ, R: univ->univ, A: set univ) : set univ {
{ y: Y | SupDI[X,Y,R,A,y] }
}
pred SupDI(X,Y: set univ, R: univ->univ, A: set univ, y: univ) {
BKType[X,Y,R,A,y]
some R.y
R.y in A
}
Square Image
SqrIXYRA={yāY:ā āA=Ry}
Notation.
SqrIXYRA can be written SqrIRA when X and Y are clear from the context.
SqrIRA is written in symbols as Rā(A)
fun SqrI(X,Y: set univ, R: univ->univ, A: set univ) : set univ {
{ y: Y | SqrI[X,Y,R,A,y] }
}
pred SqrI(X,Y: set univ, R: univ->univ, A: set univ, y: univ) {
BKType[X,Y,R,A,y]
some A
A = R.y
}
Images according to Bandler and Kohout
Sub-direct Image
SubDIXYRA:={yāY:AāRy}
Notation.
SubDIXYRA can be written SubDIRA when X and Y are clear from the context.
SubDIRA is written in symbols as Rā²(A)
fun SubDI(X,Y: set univ, R: X->Y, A: set X) : set univ {
{ y: Y | A in R.y }
}
Super-direct Image
SupDIXYRA={yāY:AāRy}
Notation.
SupDIXYRA can be written SupDIRA when X and Y are clear from the context.
SupDIRA is written in symbols as Rā³(A)
fun SupDI(X,Y: set univ, R: X->Y, A: set X) : set univ {
{ y: Y | R.y in A }
}
Square Image
SqrIXYRA={yāY:A=Ry}
Notation.
SqrIXYRA can be written SqrIRA when X and Y are clear from the context.
SqrIRA is written in symbols as Rā(A)
fun SqrI(X,Y: set univ, R: X->Y, A: set X) : set univ {
{ y: Y | A = R.y }
}