Are Pigs able to fly? 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 &amp; 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.
Perl, 363 353 350 347 343 297 266 264
$_=&lt;&gt;;s/able to fly/X/g;$m=' ?(not )?\b(P|\w+)';$h{$1?N.$2:$2}{$3?N.$4:$4}=$h{$3?$4:N.$4}{$1?$2:N.$2}=1while s/$m.{8}$m\.//;map{%x=0,r($_,$_)}%h;sub r{($a,$b)=@_;$e+=$h{$a}{N.$b};$x{$b}++or$h{$a}{$b}=1,map{r($a,$_)}%{$h{$b}}}print$e|$h{P}{X}?Yes:$h{P}{NX}?No:Maybe

Ungolfed/Explanation:
# Read one line from STDIN
$_=&lt;&gt;;
# Replaces special attribute with X
s/able to fly/X/g;
# Prepare attribute match
$m=' ?(not )?\b(P|\w+)';
# Match &quot;Everything that is A is also B. &quot;
#                        &quot;\bA........ \bB\.&quot;
# Match &quot;Pigs are B. &quot;
#     &quot;\bP........\bB\.&quot;
while(s/$m.{8}$m\.//)
{
  # Add facts for A =&gt; B and !B =&gt; !A, where A may equal &quot;P&quot; for &quot;Pigs are&quot;
  # Facts are stored as a hash of hashes %h; keys%h are the source attributes;
  # keys%{$h{$a}} are the attributes that follow from attribute $a
  # A &quot;not attribute&quot; is stored as &quot;Nattribute&quot;, while a &quot;attribute&quot; is just stored as &quot;attribute&quot;
  $h{$1?N.$2:$2}{$3?N.$4:$4}=$h{$3?$4:N.$4}{$1?$2:N.$2}=1
}
# For all known source attributes ... (this should really be keys%h but we dont mind the extra hashrefs)
map{%x=0,r($_,$_)}%h;
sub r
{
  ($a,$b)=@_;
  # ... remember that we hit a negation and therefor an inconsistency ...
  # If we check/add $b and find an existing &quot;N$b&quot; that means that attribute $b is supposed to be true and not true at the same time
  # It is cheaper bytewise to just add up all consistency errors (remember each fact has a hard value of 1) than to exit right here
  $e+=$h{$a}{N.$b};
  # ... remember that we processed this attribute for the current source attribute so we prevent loops ...
  $x{$b}++or
  # ... add a new fact and then follow the chains (again omitting keys).
  $h{$a}{$b}=1,map{r($a,$_)}%{$h{$b}}
}
# Did we happen on an inconsistency? Do pigs fly? Dont pigs fly? Maybe (Bitwise or is okay too)
print$e|$h{P}{X}?Yes:$h{P}{NX}?No:Maybe