QuotMain.thy
changeset 286 a031bcaf6719
parent 285 8ebdef196fd5
child 288 f1a840dd0743
equal deleted inserted replaced
285:8ebdef196fd5 286:a031bcaf6719
   168     val ((_, [th']), _) = Variable.import true [th] ctxt;
   168     val ((_, [th']), _) = Variable.import true [th] ctxt;
   169   in th' end);
   169   in th' end);
   170 *}
   170 *}
   171 
   171 
   172 section {* ATOMIZE *}
   172 section {* ATOMIZE *}
   173 
       
   174 text {*
       
   175   Unabs_def converts a definition given as
       
   176 
       
   177     c \<equiv> %x. %y. f x y
       
   178 
       
   179   to a theorem of the form
       
   180 
       
   181     c x y \<equiv> f x y
       
   182 
       
   183   This function is needed to rewrite the right-hand
       
   184   side to the left-hand side.
       
   185 *}
       
   186 
       
   187 ML {*
       
   188 fun unabs_def ctxt def =
       
   189 let
       
   190   val (lhs, rhs) = Thm.dest_equals (cprop_of def)
       
   191   val xs = strip_abs_vars (term_of rhs)
       
   192   val (_, ctxt') = Variable.add_fixes (map fst xs) ctxt
       
   193 
       
   194   val thy = ProofContext.theory_of ctxt'
       
   195   val cxs = map (cterm_of thy o Free) xs
       
   196   val new_lhs = Drule.list_comb (lhs, cxs)
       
   197 
       
   198   fun get_conv [] = Conv.rewr_conv def
       
   199     | get_conv (x::xs) = Conv.fun_conv (get_conv xs)
       
   200 in
       
   201   get_conv xs new_lhs |>
       
   202   singleton (ProofContext.export ctxt' ctxt)
       
   203 end
       
   204 *}
       
   205 
   173 
   206 lemma atomize_eqv[atomize]: 
   174 lemma atomize_eqv[atomize]: 
   207   shows "(Trueprop A \<equiv> Trueprop B) \<equiv> (A \<equiv> B)" 
   175   shows "(Trueprop A \<equiv> Trueprop B) \<equiv> (A \<equiv> B)" 
   208 proof
   176 proof
   209   assume "A \<equiv> B" 
   177   assume "A \<equiv> B"