this repo has no description
1include "fzn_regular.mzn";
2include "fzn_regular_reif.mzn";
3
4/** @group globals.extensional
5 The sequence of values in array \a x (which must all be in the range 1..\a S)
6 is accepted by the DFA of \a Q states with input 1..\a S and transition
7 function \a d (which maps (1..\a Q, 1..\a S) -> 0..\a Q)) and initial state \a q0
8 (which must be in 1..\a Q) and accepting states \a F (which all must be in
9 1..\a Q). We reserve state 0 to be an always failing state.
10*/
11predicate regular(array[int] of var int: x, int: Q, int: S,
12 array[int,int] of int: d, int: q0, set of int: F) =
13 assert(Q > 0,
14 "regular: 'Q' must be greater than zero",
15
16 assert(S > 0,
17 "regular: 'S' must be greater than zero",
18
19 assert(index_set_1of2(d) = 1..Q /\ index_set_2of2(d) == 1..S,
20 "regular: the transition function 'd' must be [1..Q,1..S]",
21
22 assert(forall([d[i, j] in 0..Q | i in 1..Q, j in 1..S]),
23 "regular: transition function 'd' points to states outside 0..Q",
24
25 % Nb: we need the parentheses around the expression otherwise the
26 % parser thinks it's a generator call!
27 assert((q0 in 1..Q),
28 "regular: start state 'q0' not in 1..Q",
29 assert(F subset 1..Q,
30 "regular: final states in 'F' contain states outside 1..Q",
31
32 fzn_regular(x,Q,S,d,q0,F)
33
34 ))))));
35