### 5.1.6 Transforming a list into a boolean expression

The list2exp command is the inverse of exp2list; it takes lists and tranforms them into boolean expressions. It can do this in two ways.

- list2exp can take two arguments:
  - L, a list of values of the form [a1,…,an].
  - x, a variable name.
- list2exp(L,x) returns the boolean expression (x=a1) or … or (x=an).
- Alternatively, list2exp can take two arguments:
  - L, a list where each element of L it itself a list of n values of the form [a1,…,an].
  - vars, a list [x1,…,xn] of n variable names.
- list2exp(L,vars) returns a boolean expression of the form (x1=a1) and … and (xn=an) for each list of n values in the first argument, combined with ors.

#### Examples

list2exp([0,1,2],a)

a=0∨a=1∨a=2 |  |  |  |  |  |  |  |  |  |

list2exp(solve(x^2-1=0,x),x)

x=−1∨x=1 |  |  |  |  |  |  |  |  |  |

list2exp([[3,9],[-1,1]],[x,y])

x=3∧y=9∨x=−1∧y=1 |  |  |  |  |  |  |  |  |  |