Say I have a Boolean formula that uses a known set of tokens, e.g.:
- Boolean operators:
and
,or
,not
- Grouping operators:
(
,)
Given a Boolean formula using those tokens, e.g.:
F: (A or B) and not(A and C)
How can I convert this definition to a Python expression of set operators?
Fp = (x in A or x in B) and not(x in A and x in C)
For background on this question, see this thread and accepted answer.