src/HOL/Lex/Prefix.ML
changeset 4643 1b40fcac5a09
parent 4423 a129b817b58a
child 4647 42af8ae6e2c1
equal deleted inserted replaced
4642:2d3910d6ab10 4643:1b40fcac5a09
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Richard Mayr & Tobias Nipkow
     3     Author:     Richard Mayr & Tobias Nipkow
     4     Copyright   1995 TUM
     4     Copyright   1995 TUM
     5 *)
     5 *)
     6 
     6 
     7 open Prefix;
     7 (* Junk: *)
     8 
       
     9 val [maj,min] = goal Prefix.thy "[| Q([]); !! y ys. Q(y#ys) |] ==> ! l. Q(l)";
     8 val [maj,min] = goal Prefix.thy "[| Q([]); !! y ys. Q(y#ys) |] ==> ! l. Q(l)";
    10 by (rtac allI 1);
     9 by (rtac allI 1);
    11 by (list.induct_tac "l" 1);
    10 by (list.induct_tac "l" 1);
    12 by (rtac maj 1);
    11 by (rtac maj 1);
    13 by (rtac min 1);
    12 by (rtac min 1);
    14 val list_cases = result();
    13 val list_cases = result();
       
    14 
       
    15 (** <= is a partial order: **)
       
    16 
       
    17 goalw thy [prefix_def] "xs <= (xs::'a list)";
       
    18 by(Simp_tac 1);
       
    19 qed "prefix_refl";
       
    20 Addsimps[prefix_refl];
       
    21 
       
    22 goalw thy [prefix_def] "!!xs::'a list. [| xs <= ys; ys <= zs |] ==> xs <= zs";
       
    23 by(Clarify_tac 1);
       
    24 by(Simp_tac 1);
       
    25 qed "prefix_trans";
       
    26 
       
    27 goalw thy [prefix_def] "!!xs::'a list. [| xs <= ys; ys <= xs |] ==> xs = ys";
       
    28 by(Clarify_tac 1);
       
    29 by(Asm_full_simp_tac 1);
       
    30 qed "prefix_antisym";
       
    31 
       
    32 (** recursion equations **)
    15 
    33 
    16 goalw Prefix.thy [prefix_def] "[] <= xs";
    34 goalw Prefix.thy [prefix_def] "[] <= xs";
    17 by (simp_tac (simpset() addsimps [eq_sym_conv]) 1);
    35 by (simp_tac (simpset() addsimps [eq_sym_conv]) 1);
    18 qed "Nil_prefix";
    36 qed "Nil_prefix";
    19 Addsimps[Nil_prefix];
    37 Addsimps[Nil_prefix];
    23 by (Simp_tac 1);
    41 by (Simp_tac 1);
    24 by (Simp_tac 1);
    42 by (Simp_tac 1);
    25 qed "prefix_Nil";
    43 qed "prefix_Nil";
    26 Addsimps [prefix_Nil];
    44 Addsimps [prefix_Nil];
    27 
    45 
       
    46 goalw thy [prefix_def] "(xs <= ys@[y]) = (xs = ys@[y] | xs <= ys)";
       
    47 br iffI 1;
       
    48  be exE 1;
       
    49  by(rename_tac "zs" 1);
       
    50  by(res_inst_tac [("xs","zs")] snoc_eq_cases 1);
       
    51   by(Asm_full_simp_tac 1);
       
    52  by(hyp_subst_tac 1);
       
    53  by(asm_full_simp_tac (simpset() delsimps [append_assoc]
       
    54                                  addsimps [append_assoc RS sym])1);
       
    55 be disjE 1;
       
    56  by(Asm_simp_tac 1);
       
    57 by(Clarify_tac 1);
       
    58 by (Simp_tac 1);
       
    59 qed "prefix_snoc";
       
    60 Addsimps [prefix_snoc];
       
    61 
       
    62 goalw Prefix.thy [prefix_def] "(x#xs <= y#ys) = (x=y & xs<=ys)";
       
    63 by (Simp_tac 1);
       
    64 by (Fast_tac 1);
       
    65 qed"Cons_prefix_Cons";
       
    66 Addsimps [Cons_prefix_Cons];
       
    67 
       
    68 goalw thy [prefix_def] "!!xs. xs <= ys ==> xs <= ys@zs";
       
    69 by(Clarify_tac 1);
       
    70 by (Simp_tac 1);
       
    71 qed "prefix_prefix";
       
    72 Addsimps [prefix_prefix];
       
    73 
    28 (* nicht sehr elegant bewiesen - Induktion eigentlich ueberfluessig *)
    74 (* nicht sehr elegant bewiesen - Induktion eigentlich ueberfluessig *)
    29 goalw Prefix.thy [prefix_def]
    75 goalw Prefix.thy [prefix_def]
    30    "(xs <= y#ys) = (xs=[] | (? zs. xs=y#zs & zs <= ys))";
    76    "(xs <= y#ys) = (xs=[] | (? zs. xs=y#zs & zs <= ys))";
    31 by (list.induct_tac "xs" 1);
    77 by (list.induct_tac "xs" 1);
    32 by (Simp_tac 1);
    78 by (Simp_tac 1);
    33 by (Simp_tac 1);
    79 by (Simp_tac 1);
    34 by (Fast_tac 1);
    80 by (Fast_tac 1);
    35 qed "prefix_Cons";
    81 qed "prefix_Cons";
    36 
       
    37 goalw Prefix.thy [prefix_def] "(x#xs <= y#ys) = (x=y & xs<=ys)";
       
    38 by (Simp_tac 1);
       
    39 by (Fast_tac 1);
       
    40 qed"Cons_prefix_Cons";
       
    41 Addsimps [Cons_prefix_Cons];