[Community Puzzle] When pigs fly

https://www.codingame.com/training/expert/when-pigs-fly

Send your feedback or ask for help here!

Created by @UnicornP,validated by @Katie,@darynka_xo and @Djoums.
If you have any issues, feel free to ping them.

I don’t understand test case 9 (Final Test). According to me, the answer should be “No pigs can fly”.

I think the answer given – “Some pigs can fly” – would be justified as followed:
[A] Chickens with beaks can fly (from statements 7, 8, 9)
[B] Some llamas with mouths are chickens with beaks (statement 2)
[C] Some llamas with mouths can fly (A + B)
[D] All llamas with toenails are pigs (statement 5).
However, we cannot conclude that “some pigs can fly” from (C + D), as we have no way of knowing that there are some llamas that have both mouths and toenails… which I suppose is overlooked by the solution???

Anyone could give me some help with this? Thanks :slight_smile:

1 Like

It’s actually a question we had during the validation process, here’s the answer I came up with :

Step 1, from those facts :
CHICKENS with BEAKS are LLAMAS with MOUTHS
GEESE are CHICKENS
GEESE have BEAKS
BEAKS are TOENAILS
You get : some GEESE with TOENAILS are LLAMAS (technically with MOUTHS but we don’t care).

Then step 2 :
LLAMAS with TOENAILS are PIGS
Combined with the result of step 1 you can say : some GEESE with TOENAILS are PIGS

And finally :
CHICKENS with TOENAILS are TREES that can FLY
Tells you that some GEESE with TOENAILS are TREES that can FLY, which combined with step 2 tells you that some PIGS are TREES that can FLY.

2 Likes

Thanks for your help!

There is a flaw in your reasoning however: from “some GEESE with TOENAILS are PIGS” and “some GEESE with TOENAILS are TREES that can FLY”, you cannot deduce that “some PIGS are TREES that can FLY” (the GEESE that are PIGS might not be the same GEESE that can FLY).

This is easily fixed though, as you have “all GEESE with TOENAILS are PIGS” and “all GEESE with TOENAILS are TREES than can FLY” (rather than just some). And from the former you can deduce “some PIGS are GEESE with TOENAILS” (logically flawed, but this assumption is well specified in the puzzle description).

Yes step 1 should say all GEESE with TOENAILS are LLAMAS, that solves the problem.
I like this test, your program can get it right without you understanding why :smiley:

Continuing the discussion from [Community Puzzle] When pigs fly:

I still don’t follow this. Do the rules explain how we can deduce the existence of “GEESE with TOENAILS”? It seemed reasonably clear to me that only pure “Object” categories would be guaranteed to be non-empty, as the mere existence of some combination of attributes shouldn’t imply the existence of individuals that meet all of those attributes. In retrospect, I gather that that’s not the intent.

So, does the fact that “GEESE with TOENAILS” is mentioned on the left-hand side of an “are” statement imply that some member of such a set exists? Would it be the same if it were on the right? Has anyone else worked on this puzzle since then?

Some X can fly means that X has a subcategory that can fly. This subcategory might be empty, it is not questionned here.

Continuing the discussion from [Community Puzzle] When pigs fly:

I do not see the problem here in the last test case:

(a) GEESE are CHICKENS
(b) CHICKENS with BEAKS are LLAMAS with MOUTHS
(c) MOUTHS are HOLES
(d) GEESE have BEAKS
(e) LLAMAS with TOENAILS are PIGS
(f) PIGS are TREES that can WALK
(g) CHICKENS with EYES and TOENAILS are TREES that can FLY
(h) BEAKS are TOENAILS
(i) CHICKENS have EYES

You take a geese
with (a) it is a chicken
with (d) it have beaks
with (h) it have toenails
with (b) it have mouths and it is a llama
with (e) it is a pig ***
with (i) it have eyes
with (g) it is a tree and it flies**

So a geese is a pig than can fly !

That’s all !

3 Likes

I just solved it and here is the reformulation of the problem I used:

if "PIGS" implies "FLY":
    -> "All pigs can fly"
else if any category implies "PIGS" and also implies "FLY":
    -> "Some pigs can fly"
else:
    -> "No pigs can fly"

Of course you don’t want to consider any possible category (or the category “PIGS that can FLY” would always work for second option).
Just consider categories that are actually present in the rules.

1 Like

Arg! Validator 7 fails for me, while all the tests pass.

2 Likes

Hey guys,
If you want to test your code :
[PINGS with WINGS are GODS, GODS with WINGS can FLY] , the answer should be “Some PIGS can FLY”
If you pass this one you can try that one :
[PINGS with WINGS are GODS, GODS with WINGS and MOUTH can FLY, PIGS have MOUTH] , the answer should also be “Some PIGS can FLY”
Best regards

2 Likes

Same here, but I fail validator 9 as well. I must be missing some subtle effect in large loops…

Hi
I don’t understand the test case #6. I don’t see why we can conclude that “No pigs can fly”. I think we can’t conclude anything because we don’t know anything about pigs having limbs. So all answers seem possible.
Thanks
Adam

1 Like

I think there’s are two implicit assumptions at play:

  1. PIGS exist.
  2. If no path through the explicit rules exists that indicates that PIGS “are”, “have”, or “can” do something, then they don’t. PIGS are just entities with no attributes in that case.

Another way to think about it is to change in your mind what the output statements are to the following three possibilities:

  1. With these rules I can prove that all PIGS fly.
  2. With these rules I can prove that some PIGS fly.
  3. The rules present are insufficient to conclude that any PIGS fly.
4 Likes

Hi,
first thanks Nowis5, your sentences help me.

I have some other sentences what i created :slight_smile:

[1] “PIGS that can RUN are GODS”, “GODS can FLY” the answer should also be “Some PIGS can FLY”
[2] “PIGS that can RUN are GODS”, “GODS that can RUN and EAT can FLY”, “PIGS can EAT” the answer should also be “Some PIGS can FLY”
[3] “PIGS with WINGS that can RUN are GODS”, “GODS can FLY” the answer should also be “Some PIGS can FLY”
[4] “PIGS have WINGS”, “MOUTH are WINGS”, “GODS with MOUTH can FLY”, “PIGS are GODS” the answer should also be “Some PIGS can FLY”
[5] “PIGS with WINGS are GODS”, “MOUTH are WINGS”, “GODS with MOUTH can FLY” the answer should also be “Some PIGS can FLY”

Most importantly, to pass the test (7) after you submit your solution you need to reevaluate sentences you already check ! maybe you say one element are for some pigs but you know after it’s for all pigs !

But we don’t know if there are PIGS that can RUN.

This puzzle seems overrated with its “Very Hard” difficulty.
I know that it can be an endless debate, but this puzzle is easier that the logic puzzle “Einstein’s riddle solver” that is rated as an hard puzzle.
In my opinion this puzzle is average (parsing is not very difficult), but I set it as a “hard” puzzle.

4 Likes

If you solve both, then your average solved difficulty won’t suffer :smiley:

There is a special note for this case in puzzle description:

Note for logicians and mathematicians : The statement (2) is not an hypothetical proposition, it implies that MICE with WINGS do exist. In a nutshell: All objects evoked are supposed to exist.

Obviously, “PIGS that can RUN” were evoked thus we know they exist by puzzle definition.

I added the note, actually.

2 Likes