Skip to content
Snippets Groups Projects
Commit 3d39850c authored by hansen's avatar hansen
Browse files

Sequences as relations

parent 7db1656d
No related branches found
No related tags found
No related merge requests found
MACHINE SequencesAsRelationsTest
VARIABLES x
INVARIANT x : 1..3
INITIALISATION x := 1
OPERATIONS
foo = PRE 1 = 1 THEN x := 2 END
ASSERTIONS
{} = [];
{(1,1)} = [1]
/*[] /: seq1({1,2});
iseq({1,2}) ={[], [1], [2], [1, 2], [2, 1]};
[1] : iseq({1,2});
iseq1({1,2}) ={[1], [2], [1, 2], [2, 1]};
[1] : iseq1({1,2});
perm({1,2}) = {[1,2], [2,1]};
rev([1,2,3]) = [3,2,1];
conc([[1,2],[3],[4,5]]) = [1,2,3,4,5];
[1,2,3,4] /|\ 3 = [1,2,3];
[1,2,3,4] \|/ 3 = [4];
1 -> [2,3] = [1,2,3];
last([1,2]) = 2;
front([1,2,3]) = [1,2]*/
PROPERTIES
{} = []
& {(1,1)} = [1]
/* Set of injective Sequence */
& iseq({}) = {{}}
& iseq({1}) = {{},{(1,1)}}
/* Set of non empty injective Sequence */
& iseq1({}) = {}
& iseq1({1}) = {{(1,1)}}
/* Size */
& size({}) = 0
& size({(1,1),(2,2)}) = 2
/* Concatenation */
& {(1,1),(2,2)}^{(1,3)} = {(1,1),(2,2),(3,3)}
& {(1,1),(2,2)}^{} = {(1,1),(2,2)}
& {}^{(1,1),(2,2)} = {(1,1),(2,2)}
& {}^{} = {}
/* Prepand */
& 1 -> {(1,2),(2,3)} = {(1,1),(2,2),(3,3)}
& 1 -> {} = {(1,1)}
/* Append */
& {(1,1),(2,2)} <- 3 = {(1,1),(2,2),(3,3)}
& {} <- 1 = {(1,1)}
/* Front */
& front({(1,1)}) = {}
& front({(1,1),(2,2),(3,3)}) = {(1,1),(2,2)}
/* First */
& first({(1,1)}) = 1
& first({(1,1),(2,2)}) = 1
/* Tail */
& tail({(1,1)}) = {}
& tail({(1,1),(2,2),(3,3)}) = {(1,2),(2,3)}
/* Last */
& last({(1,1)}) = 1
& last({(1,1),(2,2)}) = 2
/* Reverse */
& rev({}) = {}
& rev({(1,1)}) = {(1,1)}
& rev({(1,1),(2,2),(3,3)}) = {(1,3),(2,2),(3,1)}
/* Generalized Concatenation */
& conc({(1,{(1,1),(2,2)}),(2,{(1,3)})}) = {(1,1),(2,2),(3,3)}
& conc({(1,{(1,1),(2,2)}),(2,{})}) = {(1,1),(2,2)}
& conc({(1,{}), (2,{(1,1),(2,2)})}) = {(1,1),(2,2)}
& conc({(1,{}),(2,{})}) = {}
/* Perm */
& perm({3,4}) = {{(1,3),(2,4)},{(1,4),(2,3)}}
& perm({}) = {{}}
/* Take first elements */
& {(1,1),(2,2)} /|\ 1 = {(1,1)}
& {(1,1),(2,2)} /|\ 2 = {(1,1),(2,2)}
& {(1,1)} /|\ 0 = {}
& {} /|\ 0 = {}
& {(1,1),(2,2)} \|/ 1 = {(1,2)}
& {(1,1),(2,2)} \|/ 0 = {(1,1),(2,2)}
& {(1,1)} \|/ 1 = {}
& {} \|/ 0 = {}
END
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment