\$\begingroup\$

Task

Your task is to write a function or a program in a language of your choice that analyzes a couple of statements and determines whether it can be concluded from those statements that pigs are able to fly.

Input

The input is a String that can be read from STDIN, taken as a function argument or even be stored in a file. The input can be described using the following EBNF:

input = statement , {statement}; statement = (("Pigs are ", attribute) | ("Everything that is ", attribute, "is also ", attribute)), ". "; attribute = [not], ("able to fly" | singleAttribute); singleAttribute = letter, {letter}; letter = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" ;

Example input (see more examples below):

Pigs are green. Everything that is green is also intelligent. Everything that is able to fly is also not intelligent. Pigs are sweet.

Output

The output can be returned by your function, be written to a file or print to STDOUT. There are 5 different cases to be handled:

The given statements are valid, consistent and have as a logical consequence that pigs can fly. In that case, you must output Yes . The given statements are valid, consistent and have as a logical consequence that pigs can not fly. In that case, you must output No . It can not be concluded from the given, valid and consistent statements whether pigs can fly or not. In that case, you must output Maybe . The given statements are valid, but not consistent (i.e. there's a contradiction in the given statements). Since ex falso quodlibet, we decide to output Yes in that case. The given statements are not valid, i.e. they are not formatted according to the given EBNF. In that case, you may do whatever you want.

Details

You may assume that the given attributes are independent from each other. So, for example, a pig may be young and old, green, red and blue at the same time without causing any inconsistency. However, a pig may not be 'green' and 'not green' at the same time, that's a contradiction and should be handled as described in (4).

For every attribute, assume that there is at least one object (not necessarily a pig) in the universe that has the given attribute, and one object that doesn't have it.

Example Inputs & Outputs

Input:

Pigs are green. Everything that is green is also intelligent. Everything that is able to fly is also not intelligent.

Output: Since Pigs are green and therefore intelligent, and everything that is able to fly is not intelligent, pigs cannot fly. Output is No .

Input:

Pigs are old. Everything that is not able to fly is also not old.

Output: If pigs were not able to fly, they were also not old. But as they are old, you must output Yes .

Input:

Everything that is sweet is also not old. Everything that is intelligent is also blue.

Output: Maybe .

Input:

Pigs are not able to fly. Everything that is red is also sweet. Everything that is sweet is also not red.

Output: Although the first statement implies that pigs can not fly, the following statements contradict each other and therefore the output must be Yes .

Input:

Pigs are very smart. Pigs are able to fly.

Output: Whatever you want, as the String doesn't match the criteria mentioned above.

Winner

This is code-golf, so the shortest correct answer (in bytes) wins. The winner will be chosen one week after the first correct answer is posted.