+exception DoNotExtract;;
+
+let pp_abstracted_ty current_module_uri =
+ let rec args context =
+ function
+ Cic.Lambda (n,s,t) ->
+ let n =
+ match n with
+ Cic.Anonymous -> Cic.Anonymous
+ | Cic.Name n -> Cic.Name (String.uncapitalize n)
+ in
+ (match analyze_type context s with
+ `Statement
+ | `Type
+ | `Sort Cic.Prop ->
+ args ((Some (n,Cic.Decl s))::context) t
+ | `Sort _ ->
+ let n =
+ match n with
+ Cic.Anonymous -> Cic.Anonymous
+ | Cic.Name name -> Cic.Name ("'" ^ name) in
+ let abstr,res =
+ args ((Some (n,Cic.Decl s))::context) t
+ in
+ (match n with
+ Cic.Anonymous -> abstr
+ | Cic.Name name -> name::abstr),
+ res)
+ | ty ->
+ match analyze_type context ty with
+ ` Sort _
+ | `Statement -> raise DoNotExtract
+ | `Type ->
+ (* BUG HERE: this can be a real System F type *)
+ let head = pp ~in_type:true current_module_uri ty context in
+ [],head
+ in
+ args
+;;
+
+