theory Strange imports Main begin locale partial_order = fixes le :: "'a \ 'a \ bool" assumes le_refl: "le x x" and le_antisym: "le x y \ le y x \ x = y" and le_trans: "le x y \ le y z \ le x z" locale sup_semilattice = fixes I :: 'a and sup :: "'a \ 'a \ 'a" assumes sup_unit_left: "sup I x = x" and sup_unit_right: "sup x I = x" and sup_commute: "sup x y = sup y x" and sup_assoc: "sup x (sup y z) = sup (sup x y) z" and sup_idem: "sup x x = x" begin definition le where "le x y = (sup x y = y)" lemma le_refl: "le x x" using le_def sup_idem by blast lemma le_antisym: "\ le x y; le y x \ \ x = y" using le_def sup_commute by auto lemma le_trans: "\ le x y; le y z \ \ le x z" using le_def sup_assoc by metis lemma le_po: "partial_order le" proof fix x y z show "le x x" using le_refl by auto show "le x y \ le y x \ x = y" using le_antisym by auto show "le x y \ le y z \ le x z" using le_trans by blast qed interpretation partial_order le using le_po by auto end sublocale sup_semilattice \ partial_order proof fix x y z show "le x x" using le_refl by auto (* Fails! Nitpick gives a counterexample. *) show "le x y \ le y x \ x = y" using le_antisym by auto show "le x y \ le y z \ le x z" using le_trans by blast qed end