No, providing some xs
samples is not what this exercise requires.
This exercise is asking you to prove for all possible values of p,q,xs
, the the equation holds. Note that there are infinitely many possible values for p,q,xs
, so it is unfeasible to brute force all the possible cases: a general mathematical proof must be provided, leveraging some logical principle.
Just to make a comparison, suppose you are asked to prove that 2*x+x = 3*x
in an exercise. The expected solution is not "well, it holds on x=4
and x=10
", neglecting all the other (infinitely many) values for x
. A reasonable solution could be: "I have x=1*x
, and so by the distributive law
2*x+x = 2*x + 1*x = (2+1)*x = 3*x
", which works for all x
.
In this kind of exercises, often one must proceed by induction on something. Here, xs
looks as a good candidate for induction. So, to prove the equation true for all xs
, it is necessary to prove
- the equation holds for
xs=[]
- if the equation holds for
xs=ys
(ys
being arbitrary), then it must hold for xs=y:ys
(y
being an arbitrary value)
If you prove 1. and 2. then you are done.
Just one extra hint: since y
is arbitrary, you do not know if it satisfies predicates p
and/or q
. You can however check all the possible four cases there: both p,q
hold, only p
, only q
, neither.