I agree that the solution is weird even though the result is correct. This one is a better solution:
Constrain(beta2,phi2)
= Constrain((a?beta4:beta3),(a?true:phi3))
= (a ? Constrain(beta4,true) : Constrain(beta3,phi3))
= (a ? true : Constrain(beta3,phi3))
= (a ? true : Constrain((b?true:beta5),phi3))
= (a ? true : (b ? Constrain(true,phi3) : Constrain(beta5,phi3) ))
= (a ? true : (b ? phi3 : Constrain(beta5,phi3) ))
= (a ? true : (b ? phi3 : Constrain((c?true:false),(c?false:true)) ))
= (a ? true : (b ? phi3 : Constrain(true,false) ))
= (a ? true : (b ? phi3 : false ))
Do you agree with this one?