18 Available from the author: kaufmann@cli.com |
18 Available from the author: kaufmann@cli.com |
19 *) |
19 *) |
20 |
20 |
21 open Ramsey; |
21 open Ramsey; |
22 |
22 |
23 val ramsey_congs = mk_congs Ramsey.thy ["Atleast"]; |
|
24 val ramsey_ss = arith_ss addcongs ramsey_congs; |
|
25 |
|
26 (*** Cliques and Independent sets ***) |
23 (*** Cliques and Independent sets ***) |
27 |
24 |
28 goalw Ramsey.thy [Clique_def] "Clique(0,V,E)"; |
25 goalw Ramsey.thy [Clique_def] "Clique(0,V,E)"; |
29 by (fast_tac ZF_cs 1); |
26 by (fast_tac ZF_cs 1); |
30 val Clique0 = result(); |
27 val Clique0 = result(); |
93 "m: nat ==> \ |
90 "m: nat ==> \ |
94 \ ALL n: nat. ALL A B. Atleast((m#+n) #- succ(0), A Un B) --> \ |
91 \ ALL n: nat. ALL A B. Atleast((m#+n) #- succ(0), A Un B) --> \ |
95 \ Atleast(m,A) | Atleast(n,B)"; |
92 \ Atleast(m,A) | Atleast(n,B)"; |
96 by (nat_ind_tac "m" prems 1); |
93 by (nat_ind_tac "m" prems 1); |
97 by (fast_tac (ZF_cs addSIs [Atleast0]) 1); |
94 by (fast_tac (ZF_cs addSIs [Atleast0]) 1); |
98 by (ASM_SIMP_TAC ramsey_ss 1); |
95 by (asm_simp_tac arith_ss 1); |
99 by (rtac ballI 1); |
96 by (rtac ballI 1); |
|
97 by (rename_tac "n" 1); (*simplifier does NOT preserve bound names!*) |
100 by (nat_ind_tac "n" [] 1); |
98 by (nat_ind_tac "n" [] 1); |
101 by (fast_tac (ZF_cs addSIs [Atleast0]) 1); |
99 by (fast_tac (ZF_cs addSIs [Atleast0]) 1); |
102 by (ASM_SIMP_TAC (ramsey_ss addrews [add_succ_right]) 1); |
100 by (asm_simp_tac (arith_ss addsimps [add_succ_right]) 1); |
103 by (safe_tac ZF_cs); |
101 by (safe_tac ZF_cs); |
104 by (etac (Atleast_succD RS bexE) 1); |
102 by (etac (Atleast_succD RS bexE) 1); |
105 by (etac UnE 1); |
103 by (etac UnE 1); |
106 (**case x:B. Instantiate the 'ALL A B' induction hypothesis. **) |
104 (**case x:B. Instantiate the 'ALL A B' induction hypothesis. **) |
107 by (dres_inst_tac [("x1","A"), ("x","B-{x}")] (spec RS spec) 2); |
105 by (dres_inst_tac [("x1","A"), ("x","B-{x}")] (spec RS spec) 2); |
116 by (etac nat_succI 1); |
114 by (etac nat_succI 1); |
117 by (etac (mp RS disjE) 1); |
115 by (etac (mp RS disjE) 1); |
118 (*cases Atleast(succ(m1),A) and Atleast(succ(n1),B)*) |
116 (*cases Atleast(succ(m1),A) and Atleast(succ(n1),B)*) |
119 by (REPEAT (eresolve_tac [asm_rl, Atleast_Diff_succI, notE] 2)); |
117 by (REPEAT (eresolve_tac [asm_rl, Atleast_Diff_succI, notE] 2)); |
120 (*proving the condition*) |
118 (*proving the condition*) |
121 by (ASM_SIMP_TAC (ramsey_ss addrews [add_succ_right]) 1); |
119 by (asm_simp_tac (arith_ss addsimps [add_succ_right]) 1); |
122 by (etac Atleast_superset 1 THEN fast_tac ZF_cs 1); |
120 by (etac Atleast_superset 1 THEN fast_tac ZF_cs 1); |
123 val pigeon2_lemma = result(); |
121 val pigeon2_lemma = result(); |
124 |
122 |
125 (* [| m:nat; n:nat; Atleast(m #+ n #- succ(0), A Un B) |] ==> |
123 (* [| m:nat; n:nat; Atleast(m #+ n #- succ(0), A Un B) |] ==> |
126 Atleast(m,A) | Atleast(n,B) *) |
124 Atleast(m,A) | Atleast(n,B) *) |
145 Ramsey_step_lemma.*) |
143 Ramsey_step_lemma.*) |
146 val prems = goal Ramsey.thy |
144 val prems = goal Ramsey.thy |
147 "[| Atleast(m #+ n, A); m: nat; n: nat |] ==> \ |
145 "[| Atleast(m #+ n, A); m: nat; n: nat |] ==> \ |
148 \ Atleast(succ(m), {x:A. ~P(x)}) | Atleast(n, {x:A. P(x)})"; |
146 \ Atleast(succ(m), {x:A. ~P(x)}) | Atleast(n, {x:A. P(x)})"; |
149 by (rtac (nat_succI RS pigeon2) 1); |
147 by (rtac (nat_succI RS pigeon2) 1); |
150 by (SIMP_TAC (ramsey_ss addrews prems) 3); |
148 by (simp_tac (arith_ss addsimps prems) 3); |
151 by (rtac Atleast_superset 3); |
149 by (rtac Atleast_superset 3); |
152 by (REPEAT (resolve_tac prems 1)); |
150 by (REPEAT (resolve_tac prems 1)); |
153 by (fast_tac ZF_cs 1); |
151 by (fast_tac ZF_cs 1); |
154 val Atleast_partition = result(); |
152 val Atleast_partition = result(); |
155 |
153 |