Answers.Body: <p>Your intuition is good. Because "nearby" is only defined with "connected", there could only be 1 station between them. However, it says that the stations are "not_too_far" if at most one station is between them. What about if no stations are between them? If 2 stations are "connected" they should be "not_too_far" as well. </p>
  
  <p>So it should be:</p>
  
  <pre><code>not_too_far(X,Y) :- connected(X,Y) ; nearby(X,Y).
  </code></pre>
  
  <p>Where ; denotes OR. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-27T19:34:44.320Z
Answers.Text: Yep, look at page 18 (32 of the pdf)
Answers.UserDisplayName: Jaden Travnik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-25T15:05:09.360Z
Answers.LastActivityDate: 2016-12-25T15:05:09.360Z
Answers.UserDisplayName: Jaden Travnik
Body: <p>I've just started reading a book about AI. The book is <a href="https://www.cs.bris.ac.uk/%7Eflach/SL/SL.pdf" rel="nofollow noreferrer">Simply Logical: Intelligent Reasoning by Example</a>. There is a very basic exercise (<a href="https://people.cs.bris.ac.uk/%7Eflach/SL/SL.pdf#page=19" rel="nofollow noreferrer">on page 19 of the pdf</a>, page 5 of the book), but I can't figure it out.</p>
  <p>The exercise is</p>
  <blockquote>
  <p>Exercise 1.1. Two stations are 'not too far' if they are on the same or a different line, with at most one station in between. Define rules for the predicate not_too_far.</p>
  </blockquote>
  <p>The only rules I've seen are <strong>nearby</strong> and <strong>connected</strong> and don't know how to use this. What I've done so far is this:</p>
  <blockquote>
  <p>not_too_far(X,Y) :- nearby(X,Y)</p>
  </blockquote>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-24T18:52:50.390Z
Comments.Text: Does it say how nearby is different from connected? Where do the different lines come from?
Comments.UserDisplayName: Jaden Travnik
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-25T14:09:10.260Z
Comments.Text: Let’s define two stations to be nearby if they are on the same line, with at most one station in between. And the are connected if are on the same line, and don't have any station in between. pag 18 you have the source image
Comments.UserDisplayName: ihavenokia
Tags: <books><symbolic-ai><prolog>
Title: Which rules should I define for the predicate "not_to_far" of the exercise 1.1 of the book "Simply Logical: Intelligent Reasoning by Example"?
UserDisplayName: ihavenokia
ThreadText: # Which rules should I define for the predicate "not_to_far" of the exercise 1.1 of the book "Simply Logical: Intelligent Reasoning by Example"?
  
  (Asked by: username_0 on 2016-12-23)
  
  I've just started reading a book about AI. The book is [Simply Logical: Intelligent Reasoning by Example](https://www.cs.bris.ac.uk/%7Eflach/SL/SL.pdf). There is a very basic exercise ([on page 19 of the pdf](https://people.cs.bris.ac.uk/%7Eflach/SL/SL.pdf#page=19), page 5 of the book), but I can't figure it out.
  
  The exercise is
  
  > Exercise 1.1. Two stations are 'not too far' if they are on the same or a different line, with at most one station in between. Define rules for the predicate not\_too\_far.
  
  The only rules I've seen are **nearby** and **connected** and don't know how to use this. What I've done so far is this:
  
  > not\_too\_far(X,Y) :- nearby(X,Y)
  
  **Tags:** books, symbolic-ai, prolog
  
  > **Comments:**
  > **username_1**: Does it say how nearby is different from connected? Where do the different lines come from?  
  > **username_0**: Let’s define two stations to be nearby if they are on the same line, with at most one station in between. And the are connected if are on the same line, and don't have any station in between. pag 18 you have the source image  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-12-25. Score: 3 | Accepted answer
  
  Your intuition is good. Because "nearby" is only defined with "connected", there could only be 1 station between them. However, it says that the stations are "not\_too\_far" if at most one station is between them. What about if no stations are between them? If 2 stations are "connected" they should be "not\_too\_far" as well.
  
  So it should be:
  
  ```
  not_too_far(X,Y) :- connected(X,Y) ; nearby(X,Y).
  
  ```
  
  Where ; denotes OR.
  
  > **Comments:**
  > **username_1**: Yep, look at page 18 (32 of the pdf)  
  
  ---
  
  