src/Doc/ZF/IFOL_examples.thy
 author wenzelm Sat, 05 Apr 2014 15:03:40 +0200 changeset 56421 1ffd7eaa778b parent 51798 ad3a241def73 permissions -rw-r--r--
updated to jedit_build-20140405: Code2HTML.jar, CommonControls.jar, Console.jar, kappalayout.jar, Navigator.jar, SideKick.jar, doc with jEdit manuals (ant dist-manuals);
```

theory IFOL_examples imports "~~/src/FOL/IFOL" begin

text{*Quantifier example from the book Logic and Computation*}
lemma "(EX y. ALL x. Q(x,y)) -->  (ALL x. EX y. Q(x,y))"
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (rule impI)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (rule allI)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (rule exI)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (erule exE)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (erule allE)
--{* @{subgoals[display,indent=0,margin=65]} *}
txt{*Now @{text "apply assumption"} fails*}
oops

text{*Trying again, with the same first two steps*}
lemma "(EX y. ALL x. Q(x,y)) -->  (ALL x. EX y. Q(x,y))"
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (rule impI)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (rule allI)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (erule exE)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (rule exI)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (erule allE)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply assumption
--{* @{subgoals[display,indent=0,margin=65]} *}
done

lemma "(EX y. ALL x. Q(x,y)) -->  (ALL x. EX y. Q(x,y))"
by (tactic {*IntPr.fast_tac @{context} 1*})

text{*Example of Dyckhoff's method*}
lemma "~ ~ ((P-->Q) | (Q-->P))"
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (unfold not_def)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (rule impI)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (erule disj_impE)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (erule imp_impE)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply (erule imp_impE)
--{* @{subgoals[display,indent=0,margin=65]} *}
apply assumption
apply (erule FalseE)+
done

end
```