## 5.319. period

Origin

N. Beldiceanu

Constraint

$\mathrm{𝚙𝚎𝚛𝚒𝚘𝚍}\left(\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂},\mathrm{𝙲𝚃𝚁}\right)$

Arguments
 $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}$ $\mathrm{𝚍𝚟𝚊𝚛}$ $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛}-\mathrm{𝚍𝚟𝚊𝚛}\right)$ $\mathrm{𝙲𝚃𝚁}$ $\mathrm{𝚊𝚝𝚘𝚖}$
Restrictions
 $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}\ge 1$ $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}\le |\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}|$ $\mathrm{𝚛𝚎𝚚𝚞𝚒𝚛𝚎𝚍}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂},\mathrm{𝚟𝚊𝚛}\right)$ $\mathrm{𝙲𝚃𝚁}\in \left[=,\ne ,<,\ge ,>,\le \right]$
Purpose

Let us note ${V}_{0},{V}_{1},\cdots ,{V}_{m-1}$ the variables of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ collection. $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}$ is the period of the sequence ${V}_{0}{V}_{1}\cdots {V}_{m-1}$ according to constraint $\mathrm{𝙲𝚃𝚁}$. This means that $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}$ is the smallest natural number such that ${V}_{i}\mathrm{𝙲𝚃𝚁}{V}_{i+\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}}$ holds for all $i\in 0,1,\cdots ,m-\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}-1$.

Example
$\left(3,〈1,1,4,1,1,4,1,1〉,=\right)$

The $\mathrm{𝚙𝚎𝚛𝚒𝚘𝚍}$ constraint holds since, as depicted by Figure 5.319.1, its first argument $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}=3$ is equal (i.e., since $\mathrm{𝙲𝚃𝚁}$ is set to $=$) to the period of the sequence $11411411$.

Typical
 $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}>1$ $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}<|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}|$ $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}|>2$ $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}.\mathrm{𝚟𝚊𝚛}\right)>1$ $\mathrm{𝙲𝚃𝚁}\in \left[=\right]$
Symmetries
• Items of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ can be reversed.

• Items of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ can be shifted.

• All occurrences of two distinct values of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}.\mathrm{𝚟𝚊𝚛}$ can be swapped; all occurrences of a value of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}.\mathrm{𝚟𝚊𝚛}$ can be renamed to any unused value.

Arg. properties
• Functional dependency: $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}$ determined by $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ and $\mathrm{𝙲𝚃𝚁}$.

• Contractible wrt. $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ when $\mathrm{𝙲𝚃𝚁}\in \left[=\right]$ and $\mathrm{𝙿𝙴𝚁𝙸𝙾𝙳}=1$.

• Prefix-contractible wrt. $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$.

• Suffix-contractible wrt. $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$.

Algorithm

When $\mathrm{𝙲𝚃𝚁}$ corresponds to the equality constraint, a potentially incomplete filtering algorithm based on 13 deductions rules is described in [BeldiceanuPoder04]. The generalisation of these rules to the case where $\mathrm{𝙲𝚃𝚁}$ is not the equality constraint is discussed.

generalisation: $\mathrm{𝚙𝚎𝚛𝚒𝚘𝚍}_\mathrm{𝚟𝚎𝚌𝚝𝚘𝚛𝚜}$ ($\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}$ replaced by vector).
soft variant: $\mathrm{𝚙𝚎𝚛𝚒𝚘𝚍}_\mathrm{𝚎𝚡𝚌𝚎𝚙𝚝}_\mathtt{0}$ (value 0 can match any other value).