AIMA versions of ch5 and ch6.