41 (*** flip --- equations merely assumed; certain consequences proved ***) |
41 (*** flip --- equations merely assumed; certain consequences proved ***) |
42 |
42 |
43 val flip_ss = ZF_ss addsimps [flip_LNil, flip_LCons, not_type]; |
43 val flip_ss = ZF_ss addsimps [flip_LNil, flip_LCons, not_type]; |
44 |
44 |
45 goal QUniv.thy "!!b. b:bool ==> b Int X : quniv(A)"; |
45 goal QUniv.thy "!!b. b:bool ==> b Int X : quniv(A)"; |
46 be boolE 1; |
46 by (etac boolE 1); |
47 by (REPEAT (resolve_tac [one_Int_in_quniv, zero_Int_in_quniv] 1 |
47 by (REPEAT (resolve_tac [one_Int_in_quniv, zero_Int_in_quniv] 1 |
48 ORELSE etac ssubst 1)); |
48 ORELSE etac ssubst 1)); |
49 val bool_Int_into_quniv = result(); |
49 val bool_Int_into_quniv = result(); |
50 |
50 |
51 (* (!!x. x : A ==> B(x) : quniv(C)) ==> (UN x:A. B(x)) : quniv(C) *) |
51 (* (!!x. x : A ==> B(x) : quniv(C)) ==> (UN x:A. B(x)) : quniv(C) *) |
84 by (rtac UN_in_quniv 1); |
84 by (rtac UN_in_quniv 1); |
85 by (fast_tac flip_cs 1); |
85 by (fast_tac flip_cs 1); |
86 val flip_llist_quniv_lemma = result(); |
86 val flip_llist_quniv_lemma = result(); |
87 |
87 |
88 goal LListFn.thy "!!l. l: llist(bool) ==> flip(l) : quniv(bool)"; |
88 goal LListFn.thy "!!l. l: llist(bool) ==> flip(l) : quniv(bool)"; |
89 br (flip_llist_quniv_lemma RS bspec RS Int_Vset_in_quniv) 1; |
89 by (rtac (flip_llist_quniv_lemma RS bspec RS Int_Vset_in_quniv) 1); |
90 by (REPEAT (assume_tac 1)); |
90 by (REPEAT (assume_tac 1)); |
91 val flip_in_quniv = result(); |
91 val flip_in_quniv = result(); |
92 |
92 |
93 val [prem] = goal LListFn.thy "l : llist(bool) ==> flip(l): llist(bool)"; |
93 val [prem] = goal LListFn.thy "l : llist(bool) ==> flip(l): llist(bool)"; |
94 by (res_inst_tac [("X", "{flip(l) . l:llist(bool)}")] |
94 by (res_inst_tac [("X", "{flip(l) . l:llist(bool)}")] |
95 LList.coinduct 1); |
95 LList.coinduct 1); |
96 br (prem RS RepFunI) 1; |
96 by (rtac (prem RS RepFunI) 1); |
97 by (fast_tac (ZF_cs addSIs [flip_in_quniv]) 1); |
97 by (fast_tac (ZF_cs addSIs [flip_in_quniv]) 1); |
98 be RepFunE 1; |
98 by (etac RepFunE 1); |
99 by (etac LList.elim 1); |
99 by (etac LList.elim 1); |
100 by (asm_simp_tac flip_ss 1); |
100 by (asm_simp_tac flip_ss 1); |
101 by (asm_simp_tac flip_ss 1); |
101 by (asm_simp_tac flip_ss 1); |
102 by (fast_tac (ZF_cs addSIs [not_type]) 1); |
102 by (fast_tac (ZF_cs addSIs [not_type]) 1); |
103 val flip_type = result(); |
103 val flip_type = result(); |
104 |
104 |
105 val [prem] = goal LListFn.thy |
105 val [prem] = goal LListFn.thy |
106 "l : llist(bool) ==> flip(flip(l)) = l"; |
106 "l : llist(bool) ==> flip(flip(l)) = l"; |
107 by (res_inst_tac [("X1", "{<flip(flip(l)),l> . l:llist(bool)}")] |
107 by (res_inst_tac [("X1", "{<flip(flip(l)),l> . l:llist(bool)}")] |
108 (LList_Eq.coinduct RS lleq_implies_equal) 1); |
108 (LList_Eq.coinduct RS lleq_implies_equal) 1); |
109 br (prem RS RepFunI) 1; |
109 by (rtac (prem RS RepFunI) 1); |
110 by (fast_tac (ZF_cs addSIs [flip_type]) 1); |
110 by (fast_tac (ZF_cs addSIs [flip_type]) 1); |
111 be RepFunE 1; |
111 by (etac RepFunE 1); |
112 by (etac LList.elim 1); |
112 by (etac LList.elim 1); |
113 by (asm_simp_tac flip_ss 1); |
113 by (asm_simp_tac flip_ss 1); |
114 by (asm_simp_tac (flip_ss addsimps [flip_type, not_not]) 1); |
114 by (asm_simp_tac (flip_ss addsimps [flip_type, not_not]) 1); |
115 by (fast_tac (ZF_cs addSIs [not_type]) 1); |
115 by (fast_tac (ZF_cs addSIs [not_type]) 1); |
116 val flip_flip = result(); |
116 val flip_flip = result(); |