I came home one day to find my dog Mike unusually affectionate. He came over and buried his head besire my leg and the arm of the chair I was sitting in. He was acting sheepishly. I thought this over a bit and finally the light bulb came on.
I went into the back yard, and sure enough, newly dug holes.
Mike had done some definite thinking.
First, he'd done something he knew was wrong, and remembered it (digging). Second, he was trying to ameliorate the problem by embarassed, ingratiating behavior. Third, he was anticipating future behavior - punishment - because of his actions.
Don't tell me some dogs can't think.