Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:46:21+00:00 2026-06-04T23:46:21+00:00

Recently I tried the book Building Expert Systems in Prolog which is freely available

  • 0

Recently I tried the book “Building Expert Systems in Prolog” which is freely available at http://www.amzi.com/ExpertSystemsInProlog.

There is a code called native shell at the appendix along with a bird identification database. The problem is that after consulting with the shell and running:

main.

load.

solve.

It asks “nostrils:external_tubular?”

If you answer no, then an stack overflow occurs. The problem is probably at the section blow:

prove(true,_) :- !.
prove((Goal,Rest),Hist) :-
    prov(Goal,[Goal|Hist]),
    prove(Rest,Hist).
prove(Goal,Hist) :-
    prov(Goal,[Goal|Hist]).

prov(true,_) :- !.
prov(menuask(X,Y,Z),Hist) :- menuask(X,Y,Z,Hist), !.
prov(ask(X,Y),Hist) :- ask(X,Y,Hist), !.
prov(Goal,Hist) :-
    clause(Goal,Body),
    prove(Body,Hist).

Can somebody please please help me? Any help is highly appreciated.

Full code of the shell: http://www.amzi.com/ExpertSystemsInProlog/code/native/native.pro

Full code for database: http://www.amzi.com/ExpertSystemsInProlog/code/native/birds.nkb

I’m using swi prolog.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:46:22+00:00Added an answer on June 4, 2026 at 11:46 pm

    I found the problem to be here:

    prove((Goal,Rest),Hist) :-
        prov(Goal,[Goal|Hist]),
        prove(Rest,Hist).
    prove(Goal,Hist) :-
        prov(Goal,[Goal|Hist]).
    

    Since swi-prolog allows the head ((x,y,z), [h]) to match the second prove predicate, somehow in the inference process the prove(Goal,Hist) is triggered which will cause the infinite loop to occur. It took me 8 hours to analyze the trace.

    Therefore to fix the issue, we need a cut to be placed in the beginning of prove((Goal,Rest),Hist). The code should look like this:

    prove((Goal,Rest),Hist) :-
        !,
        prov(Goal,[Goal|Hist]),
        prove(Rest,Hist).
    prove(Goal,Hist) :-
        prov(Goal,[Goal|Hist]).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently tried sharpening my rails skills with this tool: http://github.com/edgecase/ruby_koans but I
I recently tried to mirror some input within input(text) fields. Using String.fromCharCode(event.which) for instance,
I recently tried building my own shared and weak pointers. Code that compiles using
I recently tried out Microsoft's TFS-in-the-cloud service (TFSPreview.com) and felt the TFS team finally
I recently tried to upgrade a .net 2.0 project which had its DAL generated
I recently tried to create a global header file which would have all definitions
I recently tried to combine SEAM and GWT in a project - but failed
I recently tried to figure out how to use freeglut with NetBeans 7. I
I recently tried using the Cloud9 online IDE . It starts by creating a
I recently tried to pull some results and was struggling to work out the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.