View source with formatted comments or as raw
    1:- use_module('../../prolog/scasp').    2
    3% Given 3 birds, which can fly?
    4
    5%#pred penguin(X) :: '@(X) is a penguin'.
    6penguin(sam). % sam is a penguin
    7%#pred wounded_bird(X) :: '@(X) is a wounded bird'.
    8wounded_bird(john). % john is wounded
    9
   10%#pred bird(X) :: '@(X) is a bird'.
   11bird(tweety). % tweety is just a bird
   12% penguines and wounded birds are still birds
   13%bird(X) :- penguin(X,_Y), s(_C).
   14bird(X) :- wounded_bird(X).
   15
   16%% #pred ab(X) :: '@(X) is abnormal'.
   17%% #pred not ab(X) :: '@(X) is not abnormal'.
   18% penguins and wounded birds are abnormal
   19ab(X) :- penguin(X).
   20ab(X) :- wounded_bird(X).
   21
   22%#pred flies(X) :: '@(X) can fly'.
   23% birds can fly if they are not abnormal
   24flies(X) :- bird(X), not ab(X).
   25
   26%#pred -flies(X) :: '@(X) can not fly'.
   27% explicit closed world assumptions
   28-flies(X) :- ab(X).
   29-flies(X) :- -bird(X).
   30
   31-wounded_bird(X) :- not wounded_bird(X).
   32
   33-bird(X) :- not bird(X).
   34
   35-penguin(X) :- not penguin(X).
   36
   37-ab(X) :- not ab(X).
   38
   39
   40%?- flies(X).