src/HOL/TLA/Intensional.thy
changeset 24180 9f818139951b
parent 21624 6f79647cf536
child 30528 7173bf123335
equal deleted inserted replaced
24179:c89d77d97f84 24180:9f818139951b
   241 
   241 
   242 
   242 
   243 (* ======== Functions to "unlift" intensional implications into HOL rules ====== *)
   243 (* ======== Functions to "unlift" intensional implications into HOL rules ====== *)
   244 
   244 
   245 ML {*
   245 ML {*
   246 
       
   247 local
       
   248   val intD = thm "intD";
       
   249   val inteq_reflection = thm "inteq_reflection";
       
   250   val intensional_rews = thms "intensional_rews";
       
   251 in
       
   252 
       
   253 (* Basic unlifting introduces a parameter "w" and applies basic rewrites, e.g.
   246 (* Basic unlifting introduces a parameter "w" and applies basic rewrites, e.g.
   254    |- F = G    becomes   F w = G w
   247    |- F = G    becomes   F w = G w
   255    |- F --> G  becomes   F w --> G w
   248    |- F --> G  becomes   F w --> G w
   256 *)
   249 *)
   257 
   250 
   258 fun int_unlift th =
   251 fun int_unlift th =
   259   rewrite_rule intensional_rews (th RS intD handle THM _ => th);
   252   rewrite_rule @{thms intensional_rews} (th RS @{thm intD} handle THM _ => th);
   260 
   253 
   261 (* Turn  |- F = G  into meta-level rewrite rule  F == G *)
   254 (* Turn  |- F = G  into meta-level rewrite rule  F == G *)
   262 fun int_rewrite th =
   255 fun int_rewrite th =
   263   zero_var_indexes (rewrite_rule intensional_rews (th RS inteq_reflection))
   256   zero_var_indexes (rewrite_rule @{thms intensional_rews} (th RS @{thm inteq_reflection}))
   264 
   257 
   265 (* flattening turns "-->" into "==>" and eliminates conjunctions in the
   258 (* flattening turns "-->" into "==>" and eliminates conjunctions in the
   266    antecedent. For example,
   259    antecedent. For example,
   267 
   260 
   268          P & Q --> (R | S --> T)    becomes   [| P; Q; R | S |] ==> T
   261          P & Q --> (R | S --> T)    becomes   [| P; Q; R | S |] ==> T
   297 fun int_use th =
   290 fun int_use th =
   298     case (concl_of th) of
   291     case (concl_of th) of
   299       Const _ $ (Const ("Intensional.Valid", _) $ _) =>
   292       Const _ $ (Const ("Intensional.Valid", _) $ _) =>
   300               (flatten (int_unlift th) handle THM _ => th)
   293               (flatten (int_unlift th) handle THM _ => th)
   301     | _ => th
   294     | _ => th
   302 
       
   303 end
       
   304 *}
   295 *}
   305 
   296 
   306 setup {*
   297 setup {*
   307   Attrib.add_attributes [
   298   Attrib.add_attributes [
   308     ("int_unlift", Attrib.no_args (Thm.rule_attribute (K int_unlift)), ""),
   299     ("int_unlift", Attrib.no_args (Thm.rule_attribute (K int_unlift)), ""),