First, we have to apply the first lambda expression to a and b to get:
((a b) ((λx.((x x) true)) (λx.((x x) false)))) ((λx.((x x) true)) (λx.((x x) false)))
Next, we apply the next lambda expression to both the true and false functions, substituting x with itself:
((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) true) (((λx.((x x) true)) (λx.((x x) false))) false)
Now, we reduce the innermost expressions first. We have the following:
(λx.((x x) true)) (λx.((x x) false))
= ((λx.((x x) true)) (λx.((x x) false))) true
= ((λx.((x x) true)) (λx.((x x) false))) false
Notice that the expressions are the same. We'll just reduce it to either one, so we have:
((λx.((x x) true)) (λx.((x x) false))) true
Next, we can apply the same step to the expression (λx.((x x) true)) (λx.((x x) false)). We have:
(λx.((x x) true)) (λx.((x x) false))
= ((λx.((x x) true)) (λx.((x x) false))) true
= ((λx.((x x) true)) (λx.((x x) false))) false
Again, the expressions are the same. We'll reduce it to just one, so we have:
((λx.((x x) true)) (λx.((x x) false))) true
= ((λx.((x x) true)) (λx.((x x) false))) false
Now that we've simplified the inside expressions, let's substitute them into the original expression:
((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) true) (((λx.((x x) true)) (λx.((x x) false))) false)
= ((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
Now we can apply the same steps to simplify the nested inner expressions:
(λx.((x x) true)) (λx.((x x) false))
= ((λx.((x x) true)) (λx.((x x) false))) false
= ((λx.((x x) true)) (λx.((x x) false))) false
Substituting this back in, we have:
((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
= ((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
Notice that the expression has not changed. We can simplify it again:
(λx.((x x) true)) (λx.((x x) false))
= ((λx.((x x) true)) (λx.((x x) false))) false
= ((λx.((x x) true)) (λx.((x x) false))) false
So we substitute this back in again:
((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
= ((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
We continue to simplify the innermost expressions until they cannot be simplified anymore:
(λx.((x x) true)) (λx.((x x) false))
= ((λx.((x x) true)) (λx.((x x) false))) false
= ((λx.((x x) true)) (λx.((x x) false))) false
Substituting back in, we have:
((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
= ((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
Now we can substitute again:
(λx.((x x) true)) (λx.((x x) false))
= ((λx.((x x) true)) (λx.((x x) false))) false
= ((λx.((x x) true)) (λx.((x x) false))) false
Substituting back in for the last time, we have:
((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
= ((a b) ((λx.((x x) true)) (λx.((x x) false)))) (((λx.((x x) true)) (λx.((x x) false))) false) (((λx.((x x) true)) (λx.((x x) false))) false)
Since we cannot simplify further, this is our final answer.