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 }
}