• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/usr/eclipseclp/documents/tutorial/

Lines Matching defs:and

11 % the License for the specific language governing rights and limitations
23 \chapter{Propia and CHR}
28 There are two elegant and simple ways of building constraints
29 available in \eclipse{}, called {\em Propia} and {\em Constraint
38 the start times $S1$ and $S2$
52 and by Propia.
56 ordering of the tasks is possible, and then to enforce the constraint
82 and narrows the domain of $S2$ to \verb91..59.
105 Propia and CHRs make it easy to turn the logical statement of a
109 \section{The Role of Propia and CHR in Problem Modelling}
112 To formulate and solve a problem in \eclipse{} the standard pattern is
129 \item Posting and reposting constraints during search is an
130 unnecessary and computationally expensive overhead
131 \item Mixing constraint behaviour and search behaviour makes it harder
132 to explore and optimize the algorithm executed by the program.
134 Propia and CHR's support the separation of constraint setup and search
143 limited quantity of raw materials (\verb0Raw10 and \verb0Raw20),
179 \verb0product0 which chooses an item and leaves a choice point at each
182 Try running it, and the program
188 This program leaves no choice points during constraint setup, and
191 In the remainder of this chapter we show how to use Propia and CHR's,
193 examples, and outline their implementation.
196 Propia and CHRs can be used to build clear problem models that have no
211 finding all solutions to the goal and extracting any information that
235 $Y \neq 0$, $Y \neq 1$, $Y \neq 2$ and so on for all values except $3$
236 and $4$!)
250 unique, and succeeds without propagating further information if there
253 Fails if there is no solution, and propagates no information otherwise
307 % (e.g. \verb0consistent0, \verb0unique0, \verb0most0 and \verb0ac0).
318 find more and more solutions, each time combining the information from
326 from solutions to the more constrained goal, propagates it, and
337 and as a term which can be manipulated as data.
349 $p(a,f(Y))$ is the MSG of $p(a,f(b))$ and $p(a,f(c))$.
353 For example, any other term that generalises $p(a,f(b)$ and
356 terms (because it generalises the two terms), and it captures all the
361 of $p(0,0)$ and $p(1,1)$ is $p(X,X)$.
389 because the MSG of $0$ and $1$ is a variable with domain \verb90..19.
390 Thus the result of the above example is not only to equate $X$ and $Z$
400 then MSG can only capture functor and arity.
401 In this case the MSG of $f(a,1)$ and $f(a,2)$ is simply $f(_,_)$, even
405 introducing a bottom $\bot$ and a top $\top$.
409 meet of two terms is the result of unifying them; and their join is
424 of $OutTerm$ and $S$. Call it $MSG$
439 two terms $\top$ and $\bot$ in the MSG class.
442 $S$ to $Goal$ and initialising $OutTerm := S$.
466 \subsection{Propia and Related Techniques}
474 it admits n-ary constraints, and secondly it handles predicates
479 Propia simply finds all solutions and
483 %applied to the binary constraints between the tuple identifiers and
508 simplification and constraint propagation.
510 and a {\em body}, and are written either
528 Thus if several rules share the same head and one fires, the other
553 is entailed, and CHR simply postpones the handling of the constraint
578 Sometimes different constraints interact, and more can be deduced
603 \verb0prec0, and combining it with \verb0noclash0.
606 For the following code to work, $S1$ and $S2$ may be numbers or
625 A CHR rule may have one or many goals in the head, and may take the
645 are variables and edges are disequality constraints.
649 The constraints are then declared, and subsequently defined by rules.
665 posted, and the CHRs seek to extend this clique to
680 the new variable \verb0X0 and each other variable in the original
692 Don't try and find a clique that has already been found, or
702 CHR's are implemented using the \eclipse{} suspension and waking
732 and the goal
740 detect this and \verb0p(X,Y)0 does not fire.
756 the guard as a constraint, and fail (the entailment test) as soon as
773 entailment test is efficient but incomplete, and therefore rules may
779 Constraints in {\tt ic} are handled separately and individually. More
782 Propia and CHRs provide alternative methods of achieving more global
788 combining sets of constraints to extract transitive closures, and
791 Both are fun to implement and use!
793 \section{Propia and CHR Exercise}
796 The problem is to implement three constraints, \verb'and', \verb'or'
797 and \verb'xor'
798 in CHRs and, as a separate exercise, in Propia.
800 All boolean variables have domain $\{0,1\}$: $0$ for 'false' and $1$
803 \noindent and(X,Y,Z) =def (X \& Y) = Z\\
809 \verb0cons_and0, \verb0cons_or0 and \verb0cons_xor0
825 and get the correct answer.
827 Note: you are not allowed to load the ic library nor to use search and