src/HOL/Lex/MaxPrefix.ML
author wenzelm
Wed, 25 Oct 2000 18:39:01 +0200
changeset 10338 291ce4c4b50e
parent 8442 96023903c2df
permissions -rw-r--r--
use Library/List_Prefix;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4714
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Lex/MaxPrefix.ML
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
     4
    Copyright   1998 TUM
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
     5
*)
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
     6
4832
bc11b5b06f87 Added conversion of reg.expr. to automata.
nipkow
parents: 4726
diff changeset
     7
Delsplits [split_if];
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4910
diff changeset
     8
Goalw [is_maxpref_def] "!(ps::'a list) res. \
4910
697d17fe1665 Reordered a few parameters.
nipkow
parents: 4832
diff changeset
     9
\ (maxsplit P res ps qs = (xs,ys)) = \
697d17fe1665 Reordered a few parameters.
nipkow
parents: 4832
diff changeset
    10
\ (if ? us. us <= qs & P(ps@us) then xs@ys=ps@qs & is_maxpref P xs (ps@qs) \
4714
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    11
\  else (xs,ys)=res)";
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    12
by (induct_tac "qs" 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    13
 by (simp_tac (simpset() addsplits [split_if]) 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    14
 by (Blast_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    15
by (Asm_simp_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    16
by (etac thin_rl 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    17
by (Clarify_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    18
by (case_tac "? us. us <= list & P (ps @ a # us)" 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    19
 by (Asm_simp_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    20
 by (subgoal_tac "? us. us <= a # list & P (ps @ us)" 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    21
  by (Asm_simp_tac 1);
10338
291ce4c4b50e use Library/List_Prefix;
wenzelm
parents: 8442
diff changeset
    22
 by (blast_tac (claset() addIs [thm "prefix_Cons" RS iffD2]) 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    23
by (subgoal_tac "~P(ps@[a])" 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    24
 by (Blast_tac 2);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    25
by (Asm_simp_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    26
by (case_tac "? us. us <= a#list & P (ps @ us)" 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    27
 by (Asm_simp_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    28
 by (Clarify_tac 1);
8442
96023903c2df case_tac now subsumes both boolean and datatype cases;
wenzelm
parents: 8423
diff changeset
    29
 by (case_tac "us" 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    30
  by (rtac iffI 1);
10338
291ce4c4b50e use Library/List_Prefix;
wenzelm
parents: 8442
diff changeset
    31
   by (asm_full_simp_tac (simpset() addsimps [thm "prefix_Cons", thm "prefix_append"]) 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    32
   by (Blast_tac 1);
10338
291ce4c4b50e use Library/List_Prefix;
wenzelm
parents: 8442
diff changeset
    33
  by (asm_full_simp_tac (simpset() addsimps [thm "prefix_Cons", thm "prefix_append"]) 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    34
  by (Clarify_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    35
  by (etac disjE 1);
10338
291ce4c4b50e use Library/List_Prefix;
wenzelm
parents: 8442
diff changeset
    36
   by (fast_tac (claset() addDs [order_antisym]) 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    37
  by (Clarify_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    38
  by (etac disjE 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    39
   by (Clarify_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    40
   by (Asm_full_simp_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    41
  by (etac disjE 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    42
   by (Clarify_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    43
   by (Asm_full_simp_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    44
  by (Blast_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    45
 by (Asm_full_simp_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    46
by (subgoal_tac "~P(ps)" 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    47
by (Asm_simp_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    48
by (fast_tac (claset() addss simpset()) 1);
4714
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    49
qed_spec_mp "maxsplit_lemma";
4832
bc11b5b06f87 Added conversion of reg.expr. to automata.
nipkow
parents: 4726
diff changeset
    50
Addsplits [split_if];
4714
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    51
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4910
diff changeset
    52
Goalw [is_maxpref_def]
5118
6b995dad8a9d Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    53
 "~(? us. us<=xs & P us) ==> is_maxpref P ps xs = (ps = [])";
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    54
by (Blast_tac 1);
4714
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    55
qed "is_maxpref_Nil";
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    56
Addsimps [is_maxpref_Nil];
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    57
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4910
diff changeset
    58
Goalw [is_maxsplitter_def]
4910
697d17fe1665 Reordered a few parameters.
nipkow
parents: 4832
diff changeset
    59
 "is_maxsplitter P (%xs. maxsplit P ([],xs) [] xs)";
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    60
by (simp_tac (simpset() addsimps [maxsplit_lemma]) 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5118
diff changeset
    61
by (fast_tac (claset() addss simpset()) 1);
4714
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    62
qed "is_maxsplitter_maxsplit";
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    63
bcdf68c78e18 New scanner in abstract form.
nipkow
parents:
diff changeset
    64
val maxsplit_eq = rewrite_rule [is_maxsplitter_def] is_maxsplitter_maxsplit;