12 *) |
12 *) |
13 |
13 |
14 |
14 |
15 (**** Some simple backward proofs ****) |
15 (**** Some simple backward proofs ****) |
16 |
16 |
17 goal FOLP.thy "?p:P|P --> P"; |
17 goal (theory "FOLP") "?p:P|P --> P"; |
18 by (rtac impI 1); |
18 by (rtac impI 1); |
19 by (rtac disjE 1); |
19 by (rtac disjE 1); |
20 by (assume_tac 3); |
20 by (assume_tac 3); |
21 by (assume_tac 2); |
21 by (assume_tac 2); |
22 by (assume_tac 1); |
22 by (assume_tac 1); |
23 val mythm = result(); |
23 val mythm = result(); |
24 |
24 |
25 goal FOLP.thy "?p:(P & Q) | R --> (P | R)"; |
25 goal (theory "FOLP") "?p:(P & Q) | R --> (P | R)"; |
26 by (rtac impI 1); |
26 by (rtac impI 1); |
27 by (etac disjE 1); |
27 by (etac disjE 1); |
28 by (dtac conjunct1 1); |
28 by (dtac conjunct1 1); |
29 by (rtac disjI1 1); |
29 by (rtac disjI1 1); |
30 by (rtac disjI2 2); |
30 by (rtac disjI2 2); |
31 by (REPEAT (assume_tac 1)); |
31 by (REPEAT (assume_tac 1)); |
32 result(); |
32 result(); |
33 |
33 |
34 (*Correct version, delaying use of "spec" until last*) |
34 (*Correct version, delaying use of "spec" until last*) |
35 goal FOLP.thy "?p:(ALL x y. P(x,y)) --> (ALL z w. P(w,z))"; |
35 goal (theory "FOLP") "?p:(ALL x y. P(x,y)) --> (ALL z w. P(w,z))"; |
36 by (rtac impI 1); |
36 by (rtac impI 1); |
37 by (rtac allI 1); |
37 by (rtac allI 1); |
38 by (rtac allI 1); |
38 by (rtac allI 1); |
39 by (dtac spec 1); |
39 by (dtac spec 1); |
40 by (dtac spec 1); |
40 by (dtac spec 1); |
42 result(); |
42 result(); |
43 |
43 |
44 |
44 |
45 (**** Demonstration of fast_tac ****) |
45 (**** Demonstration of fast_tac ****) |
46 |
46 |
47 goal FOLP.thy "?p:(EX y. ALL x. J(y,x) <-> ~J(x,x)) \ |
47 goal (theory "FOLP") "?p:(EX y. ALL x. J(y,x) <-> ~J(x,x)) \ |
48 \ --> ~ (ALL x. EX y. ALL z. J(z,y) <-> ~ J(z,x))"; |
48 \ --> ~ (ALL x. EX y. ALL z. J(z,y) <-> ~ J(z,x))"; |
49 by (fast_tac FOLP_cs 1); |
49 by (fast_tac FOLP_cs 1); |
50 result(); |
50 result(); |
51 |
51 |
52 goal FOLP.thy "?p:ALL x. P(x,f(x)) <-> \ |
52 goal (theory "FOLP") "?p:ALL x. P(x,f(x)) <-> \ |
53 \ (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))"; |
53 \ (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))"; |
54 by (fast_tac FOLP_cs 1); |
54 by (fast_tac FOLP_cs 1); |
55 result(); |
55 result(); |
56 |
56 |
57 |
57 |
58 (**** Derivation of conjunction elimination rule ****) |
58 (**** Derivation of conjunction elimination rule ****) |
59 |
59 |
60 val [major,minor] = goal FOLP.thy "[| p:P&Q; !!x y.[| x:P; y:Q |] ==>f(x,y):R |] ==> ?p:R"; |
60 val [major,minor] = goal (theory "FOLP") "[| p:P&Q; !!x y.[| x:P; y:Q |] ==>f(x,y):R |] ==> ?p:R"; |
61 by (rtac minor 1); |
61 by (rtac minor 1); |
62 by (resolve_tac [major RS conjunct1] 1); |
62 by (resolve_tac [major RS conjunct1] 1); |
63 by (resolve_tac [major RS conjunct2] 1); |
63 by (resolve_tac [major RS conjunct2] 1); |
64 prth (topthm()); |
64 prth (topthm()); |
65 result(); |
65 result(); |
67 |
67 |
68 (**** Derived rules involving definitions ****) |
68 (**** Derived rules involving definitions ****) |
69 |
69 |
70 (** Derivation of negation introduction **) |
70 (** Derivation of negation introduction **) |
71 |
71 |
72 val prems = goal FOLP.thy "(!!x. x:P ==> f(x):False) ==> ?p:~P"; |
72 val prems = goal (theory "FOLP") "(!!x. x:P ==> f(x):False) ==> ?p:~P"; |
73 by (rewtac not_def); |
73 by (rewtac not_def); |
74 by (rtac impI 1); |
74 by (rtac impI 1); |
75 by (resolve_tac prems 1); |
75 by (resolve_tac prems 1); |
76 by (assume_tac 1); |
76 by (assume_tac 1); |
77 result(); |
77 result(); |
78 |
78 |
79 val [major,minor] = goal FOLP.thy "[| p:~P; q:P |] ==> ?p:R"; |
79 val [major,minor] = goal (theory "FOLP") "[| p:~P; q:P |] ==> ?p:R"; |
80 by (rtac FalseE 1); |
80 by (rtac FalseE 1); |
81 by (rtac mp 1); |
81 by (rtac mp 1); |
82 by (resolve_tac [rewrite_rule [not_def] major] 1); |
82 by (resolve_tac [rewrite_rule [not_def] major] 1); |
83 by (rtac minor 1); |
83 by (rtac minor 1); |
84 result(); |
84 result(); |
85 |
85 |
86 (*Alternative proof of above result*) |
86 (*Alternative proof of above result*) |
87 val [major,minor] = goalw FOLP.thy [not_def] |
87 val [major,minor] = goalw (theory "FOLP") [not_def] |
88 "[| p:~P; q:P |] ==> ?p:R"; |
88 "[| p:~P; q:P |] ==> ?p:R"; |
89 by (resolve_tac [minor RS (major RS mp RS FalseE)] 1); |
89 by (resolve_tac [minor RS (major RS mp RS FalseE)] 1); |
90 result(); |
90 result(); |
91 |
|
92 writeln"Reached end of file."; |
|