let rec add_declaration d =
  try
    Wp_parameters.debug ~dkey:"logic" "Adding declaration %s (%t)@."
      d.Formula.d_name d.Formula.d_title ;
    if !locked then Wp_parameters.fatal
      "Locked datalib (when declaring %t)" d.Formula.d_title ;
    let old = Hashtbl.find gindex d.Formula.d_name in
    Wp_parameters.fatal
      "Duplicate definition for name '%s':@ Old: %t@ New: %t"
      d.Formula.d_name old.Formula.d_title d.Formula.d_title
  with Not_found ->
    begin
      Hashtbl.add gindex d.Formula.d_name (compile_let_decl d) ;
      let s = s_index d.Formula.d_section in
      gsection.(s) <- Dset.add d gsection.(s)
    end