Blame view
BRIC/cspFiles/function_aux.csp
1.04 KB
eeb5cac08
![]() |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
-------------------------------------------------------------------- -------------------------------------------------------------------- -- Function auxiliary operations -------------------------------------------------------------------- -------------------------------------------------------------------- -- Function is a set {(x1, y1),...,(xn, yn)} -- Transforms a singleton set into the element itself pick({x}) = x -- Returns the function return -- Raises error if z is not in the domain of the function apply(<(x,y)>^rs,z) = if x==z then y else apply(rs,z) -- domain antirestriction ddres(f,xs) = <(n,v) | (n,v) <- f, not member(n,xs)> -- domain restriction dres(f,xs) = <(n,v) | (n,v) <- f, member(n,xs)> -- Overwrites the fuction over(<>,n,v) = <> over(<(x,y)>^rs,n,v) = if x==n then <(x,v)>^rs else <(x,y)>^over(rs,n,v) -- Returns the domain of a relation dom(f) = set(<n | (n,v) <- f>) -- Returns the domain of a relation ran(f) = set(<v | (n,v) <- f>) -- Subset or equals subseteq(S,T) = diff(S,T) == {} |