let fpp_item term predicate tau_of_ctype_logic fmt x =
function
| Formula.Cons k ->
fprintf fmt "function %s (): int = %d@\n" x k
| Formula.Function ([], t) ->
fprintf fmt "logic %s: %a@\n" x (export_tau tau_of_ctype_logic) t
| Formula.Function (tl, t) ->
fprintf fmt "logic %s: @[<hov 0>%a -> %a@]@\n" x
(pp_list (export_tau tau_of_ctype_logic) ) tl (export_tau tau_of_ctype_logic) t
| Formula.Predicate [] ->
fprintf fmt "logic %s: prop@\n" x
| Formula.Predicate tl ->
fprintf fmt "logic %s: @[<hov 0>%a -> prop@]@\n" x
(pp_list (export_tau tau_of_ctype_logic)) tl
| Formula.FunctionDef (xs,tr,exp) ->
Format.fprintf fmt "@[<hv 2>function %s (%a) : %a =@ @[<hov 0>%a@]@]@\n"
x (pp_list (pp_param tau_of_ctype_logic)) xs (export_tau tau_of_ctype_logic) tr term exp
| Formula.PredicateDef (xs,prop) ->
Format.fprintf fmt "@[<hv 2>predicate %s (%a) =@ @[<hov 0>%a@]@]@\n"
x (pp_list (pp_param tau_of_ctype_logic)) xs predicate prop
| Formula.Axiom p ->
begin
match Fol_norm.compile p with
| Fol_norm.Pred p' -> fprintf fmt "@[<hv 2>axiom %s:@ %a@]@\n" x predicate p'
| Fol_norm.Conv (defs,p') ->
fpp_lf_let tau_of_ctype_logic fmt defs ;
fprintf fmt "@[<hv 2>axiom %s:@ %a@]@\n" x predicate p'
end
| Formula.Type 0 ->
fprintf fmt "type %s@\n" x
| Formula.Type 1 ->
fprintf fmt "type 'a %s@\n" x
| Formula.Type n ->
fprintf fmt "@[<hov 2>type ('a" ;
for k=2 to n do
fprintf fmt ",%c" (char_of_int (int_of_char 'a'+k-1))
done ;
Format.fprintf fmt ") %s@]@\n" x
| Formula.Trecord c ->
begin
Format.fprintf fmt "type %s@\n" c.Cil_types.cname ;
let l = c.Cil_types.cfields in
List.iter (fun f -> export_get_set_field tau_of_ctype_logic fmt f) l ;
List.iter (fun f -> export_generated_axiomatics tau_of_ctype_logic fmt f) l
end