4714
|
1 |
(* Title: HOL/Lex/MaxPrefix.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Tobias Nipkow
|
|
4 |
Copyright 1998 TUM
|
|
5 |
*)
|
|
6 |
|
|
7 |
Delsplits [expand_if];
|
|
8 |
goalw thy [is_maxpref_def] "!(ps::'a list) res. \
|
|
9 |
\ (maxsplit P ps qs res = (xs,ys)) = \
|
|
10 |
\ (if (? us. us <= qs & P(ps@us)) then xs@ys=ps@qs & is_maxpref P xs (ps@qs) \
|
|
11 |
\ else (xs,ys)=res)";
|
|
12 |
by(induct_tac "qs" 1);
|
|
13 |
by(simp_tac (simpset() addsplits [expand_if]) 1);
|
|
14 |
by(Blast_tac 1);
|
|
15 |
by(Asm_simp_tac 1);
|
|
16 |
be thin_rl 1;
|
|
17 |
by(Clarify_tac 1);
|
|
18 |
by(case_tac "? us. us <= list & P (ps @ a # us)" 1);
|
|
19 |
by(Asm_simp_tac 1);
|
|
20 |
by(subgoal_tac "? us. us <= a # list & P (ps @ us)" 1);
|
|
21 |
by(Asm_simp_tac 1);
|
|
22 |
by(blast_tac (claset() addIs [prefix_Cons RS iffD2]) 1);
|
|
23 |
by(subgoal_tac "~P(ps@[a])" 1);
|
|
24 |
by(Blast_tac 2);
|
|
25 |
by(Asm_simp_tac 1);
|
|
26 |
by(case_tac "? us. us <= a#list & P (ps @ us)" 1);
|
|
27 |
by(Asm_simp_tac 1);
|
|
28 |
by(Clarify_tac 1);
|
|
29 |
by(exhaust_tac "us" 1);
|
|
30 |
br iffI 1;
|
|
31 |
by(asm_full_simp_tac (simpset() addsimps [prefix_Cons,prefix_append]) 1);
|
|
32 |
by(Blast_tac 1);
|
|
33 |
by(asm_full_simp_tac (simpset() addsimps [prefix_Cons,prefix_append]) 1);
|
|
34 |
by(Clarify_tac 1);
|
|
35 |
be disjE 1;
|
|
36 |
by(fast_tac (claset() addDs [prefix_antisym]) 1);
|
|
37 |
by(Clarify_tac 1);
|
|
38 |
be disjE 1;
|
|
39 |
by(Clarify_tac 1);
|
|
40 |
by(Asm_full_simp_tac 1);
|
|
41 |
be disjE 1;
|
|
42 |
by(Clarify_tac 1);
|
|
43 |
by(Asm_full_simp_tac 1);
|
|
44 |
by(Blast_tac 1);
|
|
45 |
by(Asm_full_simp_tac 1);
|
|
46 |
by(Blast_tac 1);
|
|
47 |
by(subgoal_tac "~P(ps)" 1);
|
|
48 |
by(Asm_simp_tac 1);
|
|
49 |
by(fast_tac (claset() addss simpset()) 1);
|
|
50 |
qed_spec_mp "maxsplit_lemma";
|
|
51 |
Addsplits [expand_if];
|
|
52 |
|
|
53 |
goalw thy [is_maxpref_def]
|
|
54 |
"!!P. ~(? us. us<=xs & P us) ==> is_maxpref P ps xs = (ps = [])";
|
|
55 |
by(Blast_tac 1);
|
|
56 |
qed "is_maxpref_Nil";
|
|
57 |
Addsimps [is_maxpref_Nil];
|
|
58 |
|
|
59 |
goalw thy [is_maxsplitter_def]
|
|
60 |
"is_maxsplitter P (%xs. maxsplit P [] xs ([],xs))";
|
|
61 |
by(simp_tac (simpset() addsimps [maxsplit_lemma]) 1);
|
|
62 |
by(fast_tac (claset() addss simpset()) 1);
|
|
63 |
qed "is_maxsplitter_maxsplit";
|
|
64 |
|
|
65 |
val maxsplit_eq = rewrite_rule [is_maxsplitter_def] is_maxsplitter_maxsplit;
|