title: how to improve simple prolog login?
body: <p>I am building my first project in swi-prolog.It is an expert system that guess user identification base on the input of the user. This of the code produces a dialog that allows a user to enter information, then verifies the information and allows the user to have access. Is there any way to improve the code?</p>
  
  <pre><code> % user facts to enable the user to log in
  user(dac,dac11).
  user(dac101,daa).
  
  % login Gui. checks the database to log in
  loginGui :- new(Dialog,dialog('Login')),
            send_list(Dialog, append,
                    [
                      new( UserName, text_item(username)),
                      new(Password, text_item(password)),
                      button(enter, and(message(@prolog,
                                 checkUser,
                                UserName?selection,
                                 Password?selection),
                                  message(Dialog, destroy)
                                 ))]),
                      send(Dialog, default_button, enter),
                      send(Dialog, open).
  
  % verfies user logging
  checkUser(UserName,Password):-user(UserName,Password),
                                 UserName \== Password,
                                 new(Dialog,dialog('Login')),
                    send_list(Dialog, append,
                    [
                      new(  label(welcome_to_criminal_system,welcome_to_criminal_system)),
                      button(enter, and(message(@prolog,
                                 ask_user),
                                  message(Dialog, destroy)
                                 ))]),
                      send(Dialog, default_button, enter),
                      send(Dialog, open).
  
  
  % main menu loggin , user can search or select different option
  ask_user :-
          new(Dialog, dialog('Main Menu')),
          all_offence(T),all_eye_color(E),all_skin_colour(Skin),
           all_hair_colour(HC) ,all_hair_style(HS),
          send_list(Dialog, append,
                    [ new(N1, text_item(firstName)),
                      new(N2, text_item(lastName)),
                      new(N3, new(S, menu(gender))),
                      new(N4, new(Offense, menu(offense,cycle))),
                      new(N5 , new(Eye,menu(eye_color,cycle))),
                      new(N6,  new(Hair,menu(hair_color,cycle))),
                      new(N8,  new(HairStyle,menu(hair_style,cycle))),
                      new(N9, new(Skincolor,menu(skin_color,cycle))),
                      button(all_criminals,and(message(@prolog,
                                                        all_criminals),
                                                               message(Dialog, destroy))),
                      button(add_criminals,and(message(@prolog,add_criminal_gui), message(Dialog, destroy))),
                      button(exit, message(Dialog, destroy)),
                      button(enter, and(message(@prolog,
                                                pick_search_algorithm,
                                                N1?selection,
                                                N2?selection,
                                                N3?selection,
                                                N4?selection,
                                                N5?selection,
                                                N6?selection,
                                                N8?selection,
                                                N9?selection),
                                        message(Dialog, destroy)))
                    ]),
          send_list(Offense, append,T),
          send_list(Eye, append,E),
          send_list(Hair, append,HC),
          send_list(HairStyle, append,HS),
          send_list(Skincolor, append,Skin),
          send_list(S, append,  [male, female,none]),
          send(Dialog, default_button, enter),
          send(Dialog, open).
  </code></pre>