# Help with propositional formulas

**Douglas O. Matoso
**
douglas@rocknaveia.com

*Sat, 19 Jul 2003 22:55:11 -0300*

Hi,
I have an school assignment that asks to implement an truth table of
propositional formulas. I'm having difficulties in the following part:
data Prop = Var Char | Not Prop | And Prop Prop | Or Prop Prop
type Subst = [(Char,Bool)]
- Define a function
bools :: Int -> [[Bool]]
that calculates all possible lists of logical values of a specific length.
For
example, bools 2 should give the following list:
[[False,False],
[False,True ],
[True ,False],
[True ,True ]]
- Define a function
substs :: Prop -> [Subst]
that calculates all possible substitutions for the variables of a
proposition.
For example, substs p2 should give the following list:
[[('A',False),('B',False)],
[('A',False),('B',True) ],
[('A',True) ,('B',False)],
[('A',True) ,('B',True) ]]
I would be thankful for any help.
Douglas Matoso
**************************************************************************************************
** Este email foi scaneado contra virus e conteudo malicioso **
**************************************************************************************************