equal
deleted
inserted
replaced
99 let |
99 let |
100 |
100 |
101 val (_,thy1) = |
101 val (_,thy1) = |
102 fold_map (fn ak => fn thy => |
102 fold_map (fn ak => fn thy => |
103 let val dt = ([], Binding.name ak, NoSyn, [(Binding.name ak, [@{typ nat}], NoSyn)]) |
103 let val dt = ([], Binding.name ak, NoSyn, [(Binding.name ak, [@{typ nat}], NoSyn)]) |
104 val ((dt_names, {inject,case_thms,...}),thy1) = Datatype.add_datatype |
104 val (dt_names, thy1) = Datatype.add_datatype |
105 Datatype.default_config [ak] [dt] thy |
105 Datatype.default_config [ak] [dt] thy; |
106 val inject_flat = flat inject |
106 |
|
107 val injects = maps (#inject o Datatype.the_datatype thy1) dt_names; |
107 val ak_type = Type (Sign.intern_type thy1 ak,[]) |
108 val ak_type = Type (Sign.intern_type thy1 ak,[]) |
108 val ak_sign = Sign.intern_const thy1 ak |
109 val ak_sign = Sign.intern_const thy1 ak |
109 |
110 |
110 val inj_type = @{typ nat} --> ak_type |
111 val inj_type = @{typ nat} --> ak_type |
111 val inj_on_type = inj_type --> @{typ "nat set"} --> @{typ bool} |
112 val inj_on_type = inj_type --> @{typ "nat set"} --> @{typ bool} |
113 (* first statement *) |
114 (* first statement *) |
114 val stmnt1 = HOLogic.mk_Trueprop |
115 val stmnt1 = HOLogic.mk_Trueprop |
115 (Const (@{const_name "inj_on"},inj_on_type) $ |
116 (Const (@{const_name "inj_on"},inj_on_type) $ |
116 Const (ak_sign,inj_type) $ HOLogic.mk_UNIV @{typ nat}) |
117 Const (ak_sign,inj_type) $ HOLogic.mk_UNIV @{typ nat}) |
117 |
118 |
118 val simp1 = @{thm inj_on_def}::inject_flat |
119 val simp1 = @{thm inj_on_def} :: injects; |
119 |
120 |
120 val proof1 = fn _ => EVERY [simp_tac (HOL_basic_ss addsimps simp1) 1, |
121 val proof1 = fn _ => EVERY [simp_tac (HOL_basic_ss addsimps simp1) 1, |
121 rtac @{thm ballI} 1, |
122 rtac @{thm ballI} 1, |
122 rtac @{thm ballI} 1, |
123 rtac @{thm ballI} 1, |
123 rtac @{thm impI} 1, |
124 rtac @{thm impI} 1, |