# CS50AI 2020 - Quiz 1 - Entailments

I am not asking for a specific answer, as I assume this would be against the rules of this group, just instructions to the correct approach for the following question:

In CS50AI 2020 - Quiz 1, we have the following question:

1. If Hermione is in the library, then Harry is in the library.

2. Hermione is in the library.

3. Ron is in the library and Ron is not in the library.

4. Harry is in the library.

5. Harry is not in the library or Hermione is in the library.

6. Ron is in the library or Hermione is in the library.

Which of the following logical entailments is true? *

• Sentence 6 entails Sentence 3

• Sentence 1 entails Sentence 4

• Sentence 2 entails Sentence 5

• Sentence 1 entails Sentence 2

• Sentence 6 entails Sentence 2

• Sentence 5 entails Sentence 6

As far as I can see, none of these statements (by themselves) entail any of the other statements.

E.g., the first option is: Sentence 6 entails Sentence 3

That is impossible, because Statement 3 is False, so cannot be entailed.

The second option is: Sentence 1 entails Sentence 4, this also appears to be non-proven (i.e. not entailed), because we do not know if Hermione is in the library (i.e if we did know that Hermione was in the library then we could say, we know Harry is in the library, because Hermione is there, but we do not know Hermione is there in the first place).

And so on.

Any pointers in the right direction would be appreciated.

Thanks.

So if it is written A entails B, it means that for all possible worlds, is there any world where A is true and B is true.

So firstly, sentence 3 is never gonna be true.

let's see Sentence 1 entails Sentence 2 option, let's see it through truth table: p: Hermione is in the library q: Harry is in the library

``````p   q   sent1   sent2
T   T     T       T
T   F     F       T
F   T     T       F
F   F     T       F
``````

So, when p and q is true, sentence 1 entails sentence 2.

• I'm pretty sure this logic is wrong, because if so then Sentence 1 entails Sentence 4 as well, and there should only be one answer Commented May 9, 2021 at 9:37
• actually it is wrong Commented Sep 21, 2022 at 23:23
• Truth table seems to be right. Here is how the logic should go. "If in all the worlds/models where sentence-1 is true, sentence-2 is also true, then the entailment holds". Here, we see that sentence-1 holds true in the 1st, 3rd and 4th world but sentence-2 holds true only in the 1st one. So, the entailment does NOT hold true. Commented Feb 2 at 21:49

Let's take a look to the truth table and conclude why `S2 ⊨ S5`:

• Let `p := Hermione is in library`
• Let `q := Harry is in library`
• Let `t := Ron is in library`
• Let `0 := False`
• Let `1 := True`
• And let `S1, S2, ..., S6` the sentences proposed
p q t S1 S2 S3 S4 S5 S6
0 0 0 1 0 0 0 1 0
0 0 1 1 0 0 0 1 1
0 1 0 1 0 0 1 0 0
0 1 1 1 0 0 1 0 1
1 0 0 0 1 0 0 1 1
1 0 1 0 1 0 0 1 1
1 1 0 1 1 0 1 1 1
1 1 1 1 1 0 1 1 1

In every world where `S2` is `True`, `S5` must be `True` as well. And as you can see in the table it actually happens. When Hermione is in the library sentence 5 is always correct. And in terms of logic statement:

S5 = (¬S4 ∨ S2)

• @emichster Thank you for explaining this. I couldn't understand what entailment meant and now I exactly understand by this table.
– Kahf
Commented May 14 at 22:27
• @Kahf I'm glad it has helped 😁 Commented May 17 at 10:47

I'm also solving this question. I initially chose Sentence 1 entails Sentence 4. Hovewer this was not correct answer. Then I chose Sentence 2 entails Sentence 5. The reason is if Hermony in the library if Harry is not in the library or Hermione is in the library. If Harry is not in the library this means Hermione is in fact in the library because there "or" is used. So correct answer is Sentence 2 entails Sentence 5.