let check_goals =
  let t = Globals.string_id#get_tab_string_to_id in
  let is_typed n =
    let type_found = ref false in
    Hashtbl.iter
      (fun (st,_) idst ->
        if (n = st) then
          try
             ignore (Globals.type_table#get_type idst);
            type_found := true
          with Not_found -> ())
      t;
    !type_found
  in
  List.iter
    (function
        LTL_goal(_,lvc) ->
          List.iter
            (function
                Base(Var(n)) ->
                  let nst = Globals.string_id#get_name n in
                  if not (is_typed nst) then
                    add_sem_error 
                      (11, nst, "","","","")
              | Base(Const(n)) ->
                  let nst = Globals.string_id#get_name n in
                  if not (is_typed nst) then
                    Error_handler.displayWarning
                      7 (nst^" in LTL goal")
              | _ -> ())
            lvc

      | Secrecy(lc) ->
          List.iter
            (fun n ->
              let nst = Globals.string_id#get_name n in
              if not (is_typed nst) then
                Error_handler.displayWarning
                  7 (nst^" in Secrecy goal"))
            lc

      | Authentication(lc) ->
          List.iter
            (fun n ->
              let nst = Globals.string_id#get_name n in
              if not (is_typed nst) then
                Error_handler.displayWarning
                  7 (nst^" in Authentication goal"))
            lc

      | Weak_authentication(lc) ->
          List.iter
            (fun n ->
              let nst = Globals.string_id#get_name n in
              if not (is_typed nst) then
                Error_handler.displayWarning
                  7 (nst^" in Weak authentication goal"))
            lc

      | Auth(r1,r2,_) ->
          (try ignore (Globals.string_id#get_name (find_player_in_role r1))
          with Not_found ->
            add_sem_error(20,"in authentication goal, invalid role name "^(Globals.string_id#get_name r1),"","","",""));
          (try ignore (Globals.string_id#get_name (find_player_in_role r2))
          with Not_found ->
            add_sem_error(20,"in authentication goal, invalid role name "^(Globals.string_id#get_name r2),"","","",""))

      | Weak_auth(r1,r2,_) ->
          (try ignore (Globals.string_id#get_name (find_player_in_role r1))
          with Not_found ->
            add_sem_error(20,"in weak authentication goal, invalid role name "^(Globals.string_id#get_name r1),"","","",""));
          (try ignore (Globals.string_id#get_name (find_player_in_role r2))
          with Not_found ->
            add_sem_error(20,"in weak authentication goal, invalid role name "^(Globals.string_id#get_name r2),"","","","")))