In mathematics and theoretical computer science, a set constraint is an equation or an inequation between sets of terms. Similar to systems of (in)equations between numbers, methods are studied for solving systems of set constraints. Different approaches admit different operators (like "∪", "∩", "\", and function application) on sets and different (in)equation relations (like "=", "⊆", and "⊈") between set expressions. Systems of set constraints are useful to describe (in particular infinite) sets of ground terms. They arise in program analysis, abstract interpretation, and type inference. Relation to regular tree grammars Each regular tree grammar can be systematically transformed into a system of set inclusions such that its minimal solution corresponds to the tree language of the grammar. For example, the grammar (terminal and nonterminal symbols indicated by lower and upper case initials, respectively) with the rules {| |- | BoolG || → false |- | BoolG || → true |- | BListG || → nil |- | BListG || → cons(BoolG,BListG) |- | BList1G || → cons(true,BListG) |- | BList1G || → cons(false,BList1G) |} is transformed to the set inclusion system (constants and variables indicated by lower and upper case initials, respectively): {| |- | BoolS || ⊇ false |- | BoolS || ⊇ true |- | BListS || ⊇ nil |- | BListS || ⊇ cons(BoolS,BListS) |- | BList1S || ⊇ cons(true,BListS) |- | BList1S || ⊇ cons(false,BList1S) |} This system has a minimal solution, viz. ("L(N)" denoting the tree language corresponding to the nonterminal N in the above tree grammar): {| |- | BoolS || = L(BoolG) || = { false, true } |- | BListS || = L(BListG) || = { nil, cons(false,nil), cons(true,nil), cons(false,cons(false,nil)), ... } |- | BList1S || = L(BList1G) || = { nil, cons(true,nil), cons(true,cons(false,nil)),... } |} The maximal solution of the system is trivial; it assigns the set of all terms to every variable. Literature Literature on negative constraints Notes Formal languages