LARA

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cartesianproducts [2015/04/21 17:40]
wikiadmin
cartesianproducts [2015/04/21 17:43]
wikiadmin
Line 38: Line 38:
  
 ...would have their corresponding sets: ...would have their corresponding sets:
-\ENode \subseteq Node \] +\begin{equation*} ​ENode \subseteq Node \end{equation*} 
-\ELeaf \subseteq Leaf \]+\begin{equation*} ​ELeaf \subseteq Leaf \end{equation*}
  
 Now, a user could want to indicate that ENode not only matches Node'​s,​ but actually matches **all** of them (same for ELeaf of Leaf'​s). He would **need** to specify the following constraints:​ Now, a user could want to indicate that ENode not only matches Node'​s,​ but actually matches **all** of them (same for ELeaf of Leaf'​s). He would **need** to specify the following constraints:​
-\ENode \supseteq Node \] +\begin{equation*} ​ENode \supseteq Node \end{equation*} 
-\ELeaf \supseteq Leaf \]+\begin{equation*} ​ELeaf \supseteq Leaf \end{equation*}
  
 (Note that we then have equality between the sets of the extractors and their corresponding types. This is the situation we have with case classes.) (Note that we then have equality between the sets of the extractors and their corresponding types. This is the situation we have with case classes.)
Line 65: Line 65:
  
 This is readily expressible thanks to the set operators: This is readily expressible thanks to the set operators:
-\[EvenNode \cap OddNode = \emptyset \] +\begin{equation*}EvenNode \cap OddNode = \emptyset \end{equation*} 
-\[EvenNode \cup OddNode = Node \]+\begin{equation*}EvenNode \cup OddNode = Node \end{equation*}
  
 ==== Analyzing patterns ==== ==== Analyzing patterns ====
Line 91: Line 91:
  
 The set of values for the scrutinee which **will** be matched by a given pattern can now be seen as a subset of $s$ expressed by constraints. Recall that each extractor $ex$ has a corresponding set $EX$ which defines all values which it matches. A pattern will successfully match a value if all extractors in it match what they are submitted with. In other words, for a pattern with calls to extractors $ex_1,​ex_2,​\ldots$ is a cartesian product of the same dimension as $s$, where the positions corresponding to the extractors are "​replaced"​ with the proper sets: The set of values for the scrutinee which **will** be matched by a given pattern can now be seen as a subset of $s$ expressed by constraints. Recall that each extractor $ex$ has a corresponding set $EX$ which defines all values which it matches. A pattern will successfully match a value if all extractors in it match what they are submitted with. In other words, for a pattern with calls to extractors $ex_1,​ex_2,​\ldots$ is a cartesian product of the same dimension as $s$, where the positions corresponding to the extractors are "​replaced"​ with the proper sets:
-\EX_1 \times B \times EX_2 \times \ldots \]. Note that by construction of the types $A,​B,​\ldots$,​ this is always a subset of $s$.+\begin{equation*} ​EX_1 \times B \times EX_2 \times \ldots \end{equation*}. Note that by construction of the types $A,​B,​\ldots$,​ this is always a subset of $s$.
  
 === Completeness,​ disjointness and the like === === Completeness,​ disjointness and the like ===