163 prove {* reg_artm *} |
159 prove {* reg_artm *} |
164 apply(tactic {* ObjectLogic.full_atomize_tac 1 *}) |
160 apply(tactic {* ObjectLogic.full_atomize_tac 1 *}) |
165 apply(tactic {* REGULARIZE_tac' @{context} @{thm "TrueI"} @{thm my_int_equiv} *}) |
161 apply(tactic {* REGULARIZE_tac' @{context} @{thm "TrueI"} @{thm my_int_equiv} *}) |
166 done |
162 done |
167 |
163 |
168 ML {* |
164 (* rep-abs injection *) |
|
165 |
|
166 ML {* |
|
167 (* FIXME: is this the right get_fun function for rep-abs injection *) |
169 fun mk_repabs lthy (T, T') trm = |
168 fun mk_repabs lthy (T, T') trm = |
170 Quotient_Def.get_fun repF lthy (T, T') |
169 Quotient_Def.get_fun repF lthy (T, T') |
171 $ (Quotient_Def.get_fun absF lthy (T, T') $ trm) |
170 $ (Quotient_Def.get_fun absF lthy (T, T') $ trm) |
172 *} |
171 *} |
173 |
172 |
174 ML {* |
173 ML {* |
|
174 (* replaces a term for the bound variable, *) |
|
175 (* possible capture *) |
175 fun replace_bnd0 (trm, Abs (x, T, t)) = |
176 fun replace_bnd0 (trm, Abs (x, T, t)) = |
176 Abs (x, T, subst_bound (trm, t)) |
177 Abs (x, T, subst_bound (trm, t)) |
177 *} |
178 *} |
178 |
179 |
179 ML {* |
180 ML {* |
|
181 (* bound variables need to be treated properly, *) |
|
182 (* as the type of subterms need to be calculated *) |
|
183 |
180 fun inj_REPABS lthy (rtrm, qtrm) = |
184 fun inj_REPABS lthy (rtrm, qtrm) = |
181 let |
185 let |
182 val rty = fastype_of rtrm |
186 val rty = fastype_of rtrm |
183 val qty = fastype_of qtrm |
187 val qty = fastype_of qtrm |
184 in |
188 in |
185 case (rtrm, qtrm) of |
189 case (rtrm, qtrm) of |
186 (Abs (x, T, t), Abs (x', T', t')) => |
190 (Abs (x, T, t), Abs (x', T', t')) => |
187 let |
191 let |
188 val (y, s) = Term.dest_abs (x, T, t) |
192 val (y, s) = Term.dest_abs (x, T, t) |
189 val (y', s') = Term.dest_abs (x', T', t') |
193 val (y', s') = Term.dest_abs (x', T', t') |
190 val yvar = Free (y, T) |
194 val yvar = Free (y, T) |
191 val res = lambda yvar (inj_REPABS lthy (s, s')) |
195 val res = lambda yvar (inj_REPABS lthy (s, s')) |
192 in |
196 in |
193 if T = T' |
197 if T = T' |
194 then res |
198 then res |
195 else mk_repabs lthy (rty, qty) (replace_bnd0 (mk_repabs lthy (T, T') (Bound 0), res)) |
199 else mk_repabs lthy (rty, qty) (replace_bnd0 (mk_repabs lthy (T, T') (Bound 0), res)) |
196 end |
200 end |
197 (* FIXME: Does one havae to look at the abstraction or go under the lambda. *) |
201 (* FIXME: Does one have to look at the abstraction or have to go under the lambda? *) |
198 | (Const (@{const_name "Ball"}, T) $ r $ t, Const (@{const_name "All"}, _) $ t') => |
202 | (Const (@{const_name "Ball"}, T) $ r $ t, Const (@{const_name "All"}, _) $ t') => |
199 Const (@{const_name "Ball"}, T) $ r $ (inj_REPABS lthy (t, t')) |
203 Const (@{const_name "Ball"}, T) $ r $ (inj_REPABS lthy (t, t')) |
200 | (Const (@{const_name "Bex"}, T) $ r $ t, Const (@{const_name "Ex"}, _) $ t') => |
204 | (Const (@{const_name "Bex"}, T) $ r $ t, Const (@{const_name "Ex"}, _) $ t') => |
201 Const (@{const_name "Bex"}, T) $ r $ (inj_REPABS lthy (t, t')) |
205 Const (@{const_name "Bex"}, T) $ r $ (inj_REPABS lthy (t, t')) |
202 | (rtrm as _ $ _, qtrm as _ $ _) => |
206 | (_ $ _, _ $ _) => |
203 let |
207 let |
204 val (rhead, rargs) = Term.strip_comb rtrm |
208 val (rhead, rargs) = strip_comb rtrm |
205 val (qhead, qargs) = Term.strip_comb qtrm |
209 val (qhead, qargs) = strip_comb qtrm |
206 val rhead' = inj_REPABS lthy (rhead, qhead) |
210 val rhead' = inj_REPABS lthy (rhead, qhead) |
207 val rargs' = map (inj_REPABS lthy) (rargs ~~ qargs) |
211 val rargs' = map (inj_REPABS lthy) (rargs ~~ qargs) |
208 val res = list_comb (rhead', rargs') |
212 val result = list_comb (rhead', rargs') |
209 in |
213 in |
210 if rty = qty |
214 if rty = qty |
211 then res |
215 then result |
212 else mk_repabs lthy (rty, qty) res |
216 else mk_repabs lthy (rty, qty) res |
213 end |
217 end |
214 (* FIXME: cases for frees and vars *) |
218 (* FIXME: cases for frees and vars? *) |
215 | _ => rtrm |
219 | _ => rtrm |
216 end |
220 end |
217 *} |
221 *} |
218 |
222 |
219 ML {* |
223 ML {* |