8177
|
1 |
(* Title: HOL/IMPP/Natural.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: David von Oheimb, TUM
|
|
4 |
Copyright 1999 TUM
|
|
5 |
*)
|
|
6 |
|
17477
|
7 |
AddIs evalc.intros;
|
|
8 |
AddIs evaln.intros;
|
8177
|
9 |
|
|
10 |
AddSEs evalc_elim_cases;
|
|
11 |
AddSEs evaln_elim_cases;
|
|
12 |
|
|
13 |
(* evaluation of com is deterministic *)
|
|
14 |
Goal "<c,s> -c-> t ==> (!u. <c,s> -c-> u --> u=t)";
|
10962
|
15 |
by (etac evalc.induct 1);
|
8177
|
16 |
by (thin_tac "<?c,s1> -c-> s2" 8);
|
|
17 |
(*blast_tac needs Unify.search_bound := 40*)
|
|
18 |
by (ALLGOALS (best_tac (claset() addEs [evalc_WHILE_case])));
|
|
19 |
qed_spec_mp "com_det";
|
|
20 |
|
|
21 |
Goal "<c,s> -n-> t ==> <c,s> -c-> t";
|
10962
|
22 |
by (etac evaln.induct 1);
|
17477
|
23 |
by (ALLGOALS (resolve_tac evalc.intros THEN_ALL_NEW atac));
|
8177
|
24 |
qed "evaln_evalc";
|
|
25 |
|
|
26 |
Goal "[| Suc n <= m'; (!!m. n <= m ==> P (Suc m)) |] ==> P m'";
|
|
27 |
by (cut_facts_tac (premises()) 1);
|
|
28 |
by (ftac Suc_le_D 1);
|
|
29 |
by (Clarify_tac 1);
|
|
30 |
by (eresolve_tac (premises()) 1);
|
|
31 |
qed "Suc_le_D_lemma";
|
|
32 |
|
|
33 |
Goal "<c,s> -n-> t ==> !m. n<=m --> <c,s> -m-> t";
|
10962
|
34 |
by (etac evaln.induct 1);
|
8177
|
35 |
by (ALLGOALS (EVERY'[strip_tac,TRY o etac Suc_le_D_lemma, REPEAT o smp_tac 1]));
|
17477
|
36 |
by (ALLGOALS (resolve_tac evaln.intros THEN_ALL_NEW atac));
|
8177
|
37 |
qed_spec_mp "evaln_nonstrict";
|
|
38 |
|
|
39 |
Goal "<c,s> -n-> s' ==> <c,s> -Suc n-> s'";
|
10962
|
40 |
by (etac evaln_nonstrict 1);
|
8177
|
41 |
by Auto_tac;
|
|
42 |
qed "evaln_Suc";
|
|
43 |
|
|
44 |
Goal "[| <c1,s1> -n1-> t1; <c2,s2> -n2-> t2 |] ==> \
|
|
45 |
\ ? n. <c1,s1> -n -> t1 & <c2,s2> -n -> t2";
|
|
46 |
by (cut_facts_tac [read_instantiate [("m","n1"),("n","n2")] nat_le_linear] 1);
|
|
47 |
by (blast_tac (claset() addDs [evaln_nonstrict]) 1);
|
|
48 |
qed "evaln_max2";
|
|
49 |
|
|
50 |
Goal "<c,s> -c-> t ==> ? n. <c,s> -n-> t";
|
10962
|
51 |
by (etac evalc.induct 1);
|
8177
|
52 |
by (ALLGOALS (REPEAT o etac exE));
|
|
53 |
by (TRYALL(EVERY'[datac evaln_max2 1, REPEAT o eresolve_tac [exE, conjE]]));
|
17477
|
54 |
by (ALLGOALS (rtac exI THEN' resolve_tac evaln.intros THEN_ALL_NEW atac));
|
8177
|
55 |
qed "evalc_evaln";
|
|
56 |
|
|
57 |
Goal "<c,s> -c-> t = (? n. <c,s> -n-> t)";
|
|
58 |
by (fast_tac (claset() addEs [evalc_evaln, evaln_evalc]) 1);
|
|
59 |
qed "eval_eq";
|