1 (* Title: ZF/IMP/Equiv.ML |
1 (* Title: ZF/IMP/Equiv.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Heiko Loetzbeyer & Robert Sandner, TUM |
3 Author: Heiko Loetzbeyer & Robert Sandner, TUM |
4 Copyright 1994 TUM |
4 Copyright 1994 TUM |
5 *) |
5 *) |
6 |
6 |
7 val prems = goal Equiv.thy "[| a: aexp; sigma: loc -> nat |] ==> \ |
7 val prems = goal Equiv.thy "[| a: aexp; sigma: loc -> nat |] ==> \ |
8 \ <a,sigma> -a-> n <-> A(a,sigma) = n"; |
8 \ <a,sigma> -a-> n <-> A(a,sigma) = n"; |
9 by (res_inst_tac [("x","n")] spec 1); (* quantify n *) |
9 by (res_inst_tac [("x","n")] spec 1); (* quantify n *) |
10 by (res_inst_tac [("x","a")] aexp.induct 1); (* struct. ind. *) |
10 by (res_inst_tac [("x","a")] aexp.induct 1); (* struct. ind. *) |
11 by (resolve_tac prems 1); (* type prem. *) |
11 by (resolve_tac prems 1); (* type prem. *) |
12 by (rewrite_goals_tac A_rewrite_rules); (* rewr. Den. *) |
12 by (rewrite_goals_tac A_rewrite_rules); (* rewr. Den. *) |
13 by (TRYALL (fast_tac (ZF_cs addSIs (evala.intrs@prems) |
13 by (TRYALL (fast_tac (ZF_cs addSIs (evala.intrs@prems) |
14 addSEs aexp_elim_cases))); |
14 addSEs aexp_elim_cases))); |
15 qed "aexp_iff"; |
15 qed "aexp_iff"; |
16 |
16 |
17 |
17 |
18 val aexp1 = prove_goal Equiv.thy |
18 val aexp1 = prove_goal Equiv.thy |
19 "[| <a,sigma> -a-> n; a: aexp; sigma: loc -> nat |] \ |
19 "[| <a,sigma> -a-> n; a: aexp; sigma: loc -> nat |] \ |
20 \ ==> A(a,sigma) = n" (* destruction rule *) |
20 \ ==> A(a,sigma) = n" (* destruction rule *) |
21 (fn prems => [(fast_tac (ZF_cs addSIs ((aexp_iff RS iffD1)::prems)) 1)]); |
21 (fn prems => [(fast_tac (ZF_cs addSIs ((aexp_iff RS iffD1)::prems)) 1)]); |
22 val aexp2 = aexp_iff RS iffD2; |
22 val aexp2 = aexp_iff RS iffD2; |
23 |
23 |
24 |
24 |
25 val bexp_elim_cases = |
25 val bexp_elim_cases = |
33 ]; |
33 ]; |
34 |
34 |
35 |
35 |
36 val prems = goal Equiv.thy "[| b: bexp; sigma: loc -> nat |] ==> \ |
36 val prems = goal Equiv.thy "[| b: bexp; sigma: loc -> nat |] ==> \ |
37 \ <b,sigma> -b-> w <-> B(b,sigma) = w"; |
37 \ <b,sigma> -b-> w <-> B(b,sigma) = w"; |
38 by (res_inst_tac [("x","w")] spec 1); (* quantify w *) |
38 by (res_inst_tac [("x","w")] spec 1); (* quantify w *) |
39 by (res_inst_tac [("x","b")] bexp.induct 1); (* struct. ind. *) |
39 by (res_inst_tac [("x","b")] bexp.induct 1); (* struct. ind. *) |
40 by (resolve_tac prems 1); (* type prem. *) |
40 by (resolve_tac prems 1); (* type prem. *) |
41 by (rewrite_goals_tac B_rewrite_rules); (* rewr. Den. *) |
41 by (rewrite_goals_tac B_rewrite_rules); (* rewr. Den. *) |
42 by (TRYALL (fast_tac (ZF_cs addSIs (evalb.intrs@prems@[aexp2]) |
42 by (TRYALL (fast_tac (ZF_cs addSIs (evalb.intrs@prems@[aexp2]) |
43 addSDs [aexp1] addSEs bexp_elim_cases))); |
43 addSDs [aexp1] addSEs bexp_elim_cases))); |
44 qed "bexp_iff"; |
44 qed "bexp_iff"; |
45 |
45 |
46 val bexp1 = prove_goal Equiv.thy |
46 val bexp1 = prove_goal Equiv.thy |
68 by (asm_simp_tac (ZF_ss addsimps [bexp1]) 1); |
68 by (asm_simp_tac (ZF_ss addsimps [bexp1]) 1); |
69 by (asm_simp_tac (ZF_ss addsimps [bexp1]) 1); |
69 by (asm_simp_tac (ZF_ss addsimps [bexp1]) 1); |
70 |
70 |
71 (* while *) |
71 (* while *) |
72 by (etac (rewrite_rule [Gamma_def] |
72 by (etac (rewrite_rule [Gamma_def] |
73 (Gamma_bnd_mono RS lfp_Tarski RS ssubst)) 1); |
73 (Gamma_bnd_mono RS lfp_Tarski RS ssubst)) 1); |
74 by (asm_simp_tac (ZF_ss addsimps [bexp1]) 1); |
74 by (asm_simp_tac (ZF_ss addsimps [bexp1]) 1); |
75 by (fast_tac (comp_cs addSIs [bexp1,idI]@evalb_type_intrs) 1); |
75 by (fast_tac (comp_cs addSIs [bexp1,idI]@evalb_type_intrs) 1); |
76 |
76 |
77 by (etac (rewrite_rule [Gamma_def] |
77 by (etac (rewrite_rule [Gamma_def] |
78 (Gamma_bnd_mono RS lfp_Tarski RS ssubst)) 1); |
78 (Gamma_bnd_mono RS lfp_Tarski RS ssubst)) 1); |
79 by (asm_simp_tac (ZF_ss addsimps [bexp1]) 1); |
79 by (asm_simp_tac (ZF_ss addsimps [bexp1]) 1); |
80 by (fast_tac (comp_cs addSIs [bexp1,compI]@evalb_type_intrs) 1); |
80 by (fast_tac (comp_cs addSIs [bexp1,compI]@evalb_type_intrs) 1); |
81 |
81 |
82 val com1 = result(); |
82 val com1 = result(); |
83 |
83 |