theory Buggy imports Main begin locale sub = fixes a :: 'a begin definition P :: "'a \ bool" where "P x \ True" end locale loc = X: sub a + Y: sub b for a and b + fixes f :: "'a \ 'b" assumes "f a = b" (* * If the preceding line is removed, then constant "loc" * ends up having type "'a \'a \ ('b \ 'b) \ bool * instead of "'a \ 'b \ ('a \ 'b) \ bool *) lemma assumes "loc a b f" and "loc b c g" shows "loc a c (g o f)" proof interpret F: loc a b f using assms(1) by auto interpret G: loc b c g using assms(2) by auto have "\x. F.X.P x" using F.X.P_def by auto have "\x. G.X.P x" using G.X.P_def by auto (* * Constant G.X.P is unrecognized in the preceding line. * If the "interpret" lines are interchanged, * there is no error. *) qed end