src/Tools/Code/code_thingol.ML
changeset 32273 3c395fc7ec5e
parent 32131 7913823f14e3
child 32350 5ef633275b15
equal deleted inserted replaced
32272:cc1bf9077167 32273:3c395fc7ec5e
   577       #>> (fn (tyco, tys) => tyco `%% tys)
   577       #>> (fn (tyco, tys) => tyco `%% tys)
   578 and translate_term thy algbr funcgr thm (Const (c, ty)) =
   578 and translate_term thy algbr funcgr thm (Const (c, ty)) =
   579       translate_app thy algbr funcgr thm ((c, ty), [])
   579       translate_app thy algbr funcgr thm ((c, ty), [])
   580   | translate_term thy algbr funcgr thm (Free (v, _)) =
   580   | translate_term thy algbr funcgr thm (Free (v, _)) =
   581       pair (IVar (SOME v))
   581       pair (IVar (SOME v))
   582   | translate_term thy algbr funcgr thm (Abs (abs as (_, ty, _))) =
   582   | translate_term thy algbr funcgr thm (Abs (v, ty, t)) =
   583       let
   583       let
   584         val (v, t) = Syntax.variant_abs abs;
   584         val (v', t') = Syntax.variant_abs (Name.desymbolize false v, ty, t);
   585         val v' = if member (op =) (Term.add_free_names t []) v
   585         val v'' = if member (op =) (Term.add_free_names t' []) v'
   586           then SOME v else NONE
   586           then SOME v' else NONE
   587       in
   587       in
   588         translate_typ thy algbr funcgr ty
   588         translate_typ thy algbr funcgr ty
   589         ##>> translate_term thy algbr funcgr thm t
   589         ##>> translate_term thy algbr funcgr thm t'
   590         #>> (fn (ty, t) => (v', ty) `|=> t)
   590         #>> (fn (ty, t) => (v'', ty) `|=> t)
   591       end
   591       end
   592   | translate_term thy algbr funcgr thm (t as _ $ _) =
   592   | translate_term thy algbr funcgr thm (t as _ $ _) =
   593       case strip_comb t
   593       case strip_comb t
   594        of (Const (c, ty), ts) =>
   594        of (Const (c, ty), ts) =>
   595             translate_app thy algbr funcgr thm ((c, ty), ts)
   595             translate_app thy algbr funcgr thm ((c, ty), ts)