153 Goal "!M N. (M,N) : LListD(diag(A)) --> ntrunc k M = ntrunc k N"; |
153 Goal "!M N. (M,N) : LListD(diag(A)) --> ntrunc k M = ntrunc k N"; |
154 by (res_inst_tac [("n", "k")] less_induct 1); |
154 by (res_inst_tac [("n", "k")] less_induct 1); |
155 by (safe_tac ((claset_of Fun.thy) delrules [equalityI])); |
155 by (safe_tac ((claset_of Fun.thy) delrules [equalityI])); |
156 by (etac LListD.elim 1); |
156 by (etac LListD.elim 1); |
157 by (safe_tac (claset_of Prod.thy delrules [equalityI] addSEs [diagE])); |
157 by (safe_tac (claset_of Prod.thy delrules [equalityI] addSEs [diagE])); |
158 by (res_inst_tac [("n", "n")] natE 1); |
158 by (exhaust_tac "n" 1); |
159 by (Asm_simp_tac 1); |
159 by (Asm_simp_tac 1); |
160 by (rename_tac "n'" 1); |
160 by (rename_tac "n'" 1); |
161 by (res_inst_tac [("n", "n'")] natE 1); |
161 by (exhaust_tac "n'" 1); |
162 by (asm_simp_tac (simpset() addsimps [CONS_def]) 1); |
162 by (asm_simp_tac (simpset() addsimps [CONS_def]) 1); |
163 by (asm_simp_tac (simpset() addsimps [CONS_def, less_Suc_eq]) 1); |
163 by (asm_simp_tac (simpset() addsimps [CONS_def, less_Suc_eq]) 1); |
164 qed "LListD_implies_ntrunc_equality"; |
164 qed "LListD_implies_ntrunc_equality"; |
165 |
165 |
166 (*The domain of the LListD relation*) |
166 (*The domain of the LListD relation*) |
315 by (rename_tac "y" 1); |
315 by (rename_tac "y" 1); |
316 by (stac prem1 1); |
316 by (stac prem1 1); |
317 by (stac prem2 1); |
317 by (stac prem2 1); |
318 by (Simp_tac 1); |
318 by (Simp_tac 1); |
319 by (strip_tac 1); |
319 by (strip_tac 1); |
320 by (res_inst_tac [("n", "n")] natE 1); |
320 by (exhaust_tac "n" 1); |
321 by (rename_tac "m" 2); |
321 by (rename_tac "m" 2); |
322 by (res_inst_tac [("n", "m")] natE 2); |
322 by (exhaust_tac "m" 2); |
323 by (ALLGOALS (asm_simp_tac (simpset() addsimps [less_Suc_eq]))); |
323 by (ALLGOALS (asm_simp_tac (simpset() addsimps [less_Suc_eq]))); |
324 result(); |
324 result(); |
325 |
325 |
326 |
326 |
327 (*** Lconst -- defined directly using lfp, but equivalent to a LList_corec ***) |
327 (*** Lconst -- defined directly using lfp, but equivalent to a LList_corec ***) |
780 (** Two lemmas about natrec n x (%m.g), which is essentially (g^n)(x) **) |
780 (** Two lemmas about natrec n x (%m.g), which is essentially (g^n)(x) **) |
781 |
781 |
782 Goal |
782 Goal |
783 "nat_rec (LCons b l) (%m. lmap(f)) n = \ |
783 "nat_rec (LCons b l) (%m. lmap(f)) n = \ |
784 \ LCons (nat_rec b (%m. f) n) (nat_rec l (%m. lmap(f)) n)"; |
784 \ LCons (nat_rec b (%m. f) n) (nat_rec l (%m. lmap(f)) n)"; |
785 by (nat_ind_tac "n" 1); |
785 by (induct_tac "n" 1); |
786 by (ALLGOALS Asm_simp_tac); |
786 by (ALLGOALS Asm_simp_tac); |
787 qed "fun_power_lmap"; |
787 qed "fun_power_lmap"; |
788 |
788 |
789 goal Nat.thy "nat_rec (g x) (%m. g) n = nat_rec x (%m. g) (Suc n)"; |
789 goal Nat.thy "nat_rec (g x) (%m. g) n = nat_rec x (%m. g) (Suc n)"; |
790 by (nat_ind_tac "n" 1); |
790 by (induct_tac "n" 1); |
791 by (ALLGOALS Asm_simp_tac); |
791 by (ALLGOALS Asm_simp_tac); |
792 qed "fun_power_Suc"; |
792 qed "fun_power_Suc"; |
793 |
793 |
794 val Pair_cong = read_instantiate_sg (sign_of Prod.thy) |
794 val Pair_cong = read_instantiate_sg (sign_of Prod.thy) |
795 [("f","Pair")] (standard(refl RS cong RS cong)); |
795 [("f","Pair")] (standard(refl RS cong RS cong)); |