1 (* Deriving an inference rule *)
3 Pretty.setmargin 72; (*existing macros just allow this margin*)
7 val [major,minor] = goal IFOL.thy
8 "[| P&Q; [| P; Q |] ==> R |] ==> R";
10 by (resolve_tac [minor] 1);
12 prth (major RS conjunct1);
13 by (resolve_tac [major RS conjunct1] 1);
14 prth (major RS conjunct2);
15 by (resolve_tac [major RS conjunct2] 1);
17 val conjE = prth(result());
20 - val [major,minor] = goal Int_Rule.thy
21 = "[| P&Q; [| P; Q |] ==> R |] ==> R";
25 val major = Thm {hyps=#,maxidx=#,prop=#,sign=#} : thm
26 val minor = Thm {hyps=#,maxidx=#,prop=#,sign=#} : thm
28 [| P; Q |] ==> R [[| P; Q |] ==> R]
29 - by (resolve_tac [minor] 1);
36 - prth (major RS conjunct1);
38 - by (resolve_tac [major RS conjunct1] 1);
42 - prth (major RS conjunct2);
44 - by (resolve_tac [major RS conjunct2] 1);
49 R [P & Q, P & Q, [| P; Q |] ==> R]
50 - val conjE = prth(result());
51 [| ?P & ?Q; [| ?P; ?Q |] ==> ?R |] ==> ?R
52 val conjE = Thm {hyps=#,maxidx=#,prop=#,sign=#} : thm
55 (*** Derived rules involving definitions ***)
59 val prems = goal Int_Rule.thy "(P ==> False) ==> ~P";
61 by (rewrite_goals_tac [not_def]);
62 by (resolve_tac [impI] 1);
63 by (resolve_tac prems 1);
65 val notI = prth(result());
67 val prems = goalw Int_Rule.thy [not_def]
68 "(P ==> False) ==> ~P";
73 - val prems = goal Int_Rule.thy "(P ==> False) ==> ~P";
77 - by (rewrite_goals_tac [not_def]);
81 - by (resolve_tac [impI] 1);
85 - by (resolve_tac prems 1);
93 - val notI = prth(result());
94 (?P ==> False) ==> ~?P
97 - val prems = goalw Int_Rule.thy [not_def]
98 = "(P ==> False) ==> ~P";
106 val [major,minor] = goal Int_Rule.thy "[| ~P; P |] ==> R";
107 by (resolve_tac [FalseE] 1);
108 by (resolve_tac [mp] 1);
109 prth (rewrite_rule [not_def] major);
110 by (resolve_tac [it] 1);
111 by (resolve_tac [minor] 1);
112 val notE = prth(result());
114 val [major,minor] = goalw Int_Rule.thy [not_def]
116 prth (minor RS (major RS mp RS FalseE));
117 by (resolve_tac [it] 1);
120 val prems = goalw Int_Rule.thy [not_def]
123 by (resolve_tac [FalseE] 1);
124 by (resolve_tac [mp] 1);
125 by (resolve_tac prems 1);
126 by (resolve_tac prems 1);
127 val notE = prth(result());
130 - val [major,minor] = goal Int_Rule.thy "[| ~P; P |] ==> R";
136 - by (resolve_tac [FalseE] 1);
140 - by (resolve_tac [mp] 1);
145 - prth (rewrite_rule [not_def] major);
147 - by (resolve_tac [it] 1);
151 - by (resolve_tac [minor] 1);
155 - val notE = prth(result());
158 - val [major,minor] = goalw Int_Rule.thy [not_def]
159 = "[| ~P; P |] ==> R";
165 - prth (minor RS (major RS mp RS FalseE));
167 - by (resolve_tac [it] 1);
175 - goal Int_Rule.thy "[| ~P; P |] ==> R";
179 - prths (map (rewrite_rule [not_def]) it);
184 - val prems = goalw Int_Rule.thy [not_def]
185 = "[| ~P; P |] ==> R";
189 val prems = # : thm list
195 - by (resolve_tac [mp RS FalseE] 1);
200 - by (resolve_tac prems 1);
204 - by (resolve_tac prems 1);
208 - val notE = prth(result());