theory Demo3 = Main: section{* Propositional logic *} subsection{* Basic rules *} text{* \ *} thm conjI conjE text{* \ *} thm disjI1 disjI2 disjE text{* \ *} thm impI impE subsection{* Examples *} text{* a simple backward step: *} lemma "A \ B" apply(rule conjI) oops text{* a simple backward proof: *} lemma "B \ A \ A \ B" apply(rule impI) apply(erule conjE) apply(rule conjI) apply(assumption) apply(assumption) done lemma "A \ B \ B \ A" oops lemma "\ A \ B; B \ C \ \ A \ C" oops thm notI notE lemma "\A \ \B \ \(A \ B)" oops text {* Case distinctions *} thm FalseE lemma "(\P \ False) \ P" apply (cases "P") oops text{* Explicit backtracking: *} lemma "\ P \ Q; A \ B \ \ A" apply(erule conjE) back apply(assumption) done text{* UGLY! EVIL! AVOID! *} text{* Implict backtracking: chaining with , *} lemma "\ P \ Q; A \ B \ \ A" apply(erule conjE, assumption) done text {* more rules *} text{* \ *} thm conjunct1 conjunct2 text{* \ *} thm disjCI text{* \ *} thm mp text{* = (iff) *} thm iffI iffE iffD1 iffD2 text{* Equality *} thm refl sym trans text{* \ *} thm notI notE text{* Contradictions *} thm FalseE ccontr classical excluded_middle end