ex/Qsort.ML
changeset 195 df6b3bd14dcb
parent 171 16c4ea954511
equal deleted inserted replaced
194:b93cc55cb7ab 195:df6b3bd14dcb
    13 by(ALLGOALS(asm_simp_tac (ss setloop (split_tac [expand_if]))));
    13 by(ALLGOALS(asm_simp_tac (ss setloop (split_tac [expand_if]))));
    14 result();
    14 result();
    15 
    15 
    16 
    16 
    17 goal Qsort.thy "(Alls x:[x:xs.P(x)].Q(x)) = (Alls x:xs. P(x)-->Q(x))";
    17 goal Qsort.thy "(Alls x:[x:xs.P(x)].Q(x)) = (Alls x:xs. P(x)-->Q(x))";
    18 by(list_ind_tac "xs" 1);
    18 by(list.induct_tac "xs" 1);
    19 by(ALLGOALS(asm_simp_tac (ss setloop (split_tac [expand_if]))));
    19 by(ALLGOALS(asm_simp_tac (ss setloop (split_tac [expand_if]))));
    20 val ss = ss addsimps [result()];
    20 val ss = ss addsimps [result()];
    21 
    21 
    22 goal Qsort.thy
    22 goal Qsort.thy
    23  "((Alls x:xs.P(x)) & (Alls x:xs.Q(x))) = (Alls x:xs. P(x)&Q(x))";
    23  "((Alls x:xs.P(x)) & (Alls x:xs.Q(x))) = (Alls x:xs. P(x)&Q(x))";
    24 by(list_ind_tac "xs" 1);
    24 by(list.induct_tac "xs" 1);
    25 by(ALLGOALS(asm_simp_tac ss));
    25 by(ALLGOALS(asm_simp_tac ss));
    26 val ss = ss addsimps [result()];
    26 val ss = ss addsimps [result()];
    27 
    27 
    28 goal HOL.thy "((~P --> Q) & (P --> Q)) = Q";
    28 goal HOL.thy "((~P --> Q) & (P --> Q)) = Q";
    29 by(fast_tac HOL_cs 1);
    29 by(fast_tac HOL_cs 1);
    35 val ss = ss addsimps [result()];
    35 val ss = ss addsimps [result()];
    36 
    36 
    37 goal Qsort.thy
    37 goal Qsort.thy
    38  "sorted(le,xs@ys) = (sorted(le,xs) & sorted(le,ys) & \
    38  "sorted(le,xs@ys) = (sorted(le,xs) & sorted(le,ys) & \
    39 \                     (Alls x:xs. Alls y:ys. le(x,y)))";
    39 \                     (Alls x:xs. Alls y:ys. le(x,y)))";
    40 by(list_ind_tac "xs" 1);
    40 by(list.induct_tac "xs" 1);
    41 by(ALLGOALS(asm_simp_tac ss));
    41 by(ALLGOALS(asm_simp_tac ss));
    42 val ss = ss addsimps [result()];
    42 val ss = ss addsimps [result()];
    43 
    43 
    44 goal Qsort.thy 
    44 goal Qsort.thy 
    45  "!!le. [| total(le); transf(le) |] ==>  sorted(le,qsort(le,xs))";
    45  "!!le. [| total(le); transf(le) |] ==>  sorted(le,qsort(le,xs))";
    67 val ss = ss addsimps [result()];
    67 val ss = ss addsimps [result()];
    68 
    68 
    69 goal Qsort.thy
    69 goal Qsort.thy
    70  "sorted(le,xs@ys) = (sorted(le,xs) & sorted(le,ys) & \
    70  "sorted(le,xs@ys) = (sorted(le,xs) & sorted(le,ys) & \
    71 \                     (!x. x mem xs --> (!y. y mem ys --> le(x,y))))";
    71 \                     (!x. x mem xs --> (!y. y mem ys --> le(x,y))))";
    72 by(list_ind_tac "xs" 1);
    72 by(list.induct_tac "xs" 1);
    73 by(ALLGOALS(asm_simp_tac (ss setloop (split_tac [expand_if]))));
    73 by(ALLGOALS(asm_simp_tac (ss setloop (split_tac [expand_if]))));
    74 by(fast_tac HOL_cs 1);
    74 by(fast_tac HOL_cs 1);
    75 val ss = ss addsimps [result()];
    75 val ss = ss addsimps [result()];
    76 
    76 
    77 goal Qsort.thy
    77 goal Qsort.thy