# See https://en.wikipedia.org/wiki/Disjunction_elimination

@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
@prefix : <https://eyereasoner.github.io/ns#>.

# water is an inorganic compound
:water :is :InorganicCompound.

# water is solid or liquid or gas
[ log:graph (
    [ log:triple (var:A :is :InorganicCompound)]
)] log:implies [ log:graph (
    [ log:triple ((var:A) log:allPossibleCases (
        [ log:graph (
            [ log:triple (var:A :is :solid)]
        )]
        [ log:graph (
            [ log:triple (var:A :is :liquid)]
        )]
        [ log:graph (
            [ log:triple (var:A :is :gas)]
        )]
    ))]
)].

# solid, liquid and gas things are observable
[ log:graph (
    [ log:triple (var:A :is :solid)]
)] log:implies [ log:graph (
    [ log:triple (var:A :is :observable)]
)].

[ log:graph (
    [ log:triple (var:A :is :liquid)]
)] log:implies [ log:graph (
    [ log:triple (var:A :is :observable)]
)].

[ log:graph (
    [ log:triple (var:A :is :gas)]
)] log:implies [ log:graph (
    [ log:triple (var:A :is :observable)]
)].

# proof by cases

[ log:graph (
    [ log:triple ((var:A) log:allPossibleCases var:B)]
    [ log:triple ((
        [ log:graph (
            [ log:triple (var:B list:member [ log:graph (
                var:A :is var:C
            )])]
        )]
        [ log:graph (
            [ log:triple ([ log:graph (
                [ log:triple (var:A :is var:C)]
            )] log:implies [ log:graph (
                [ log:triple (var:A :is :observable)]
            )])]
        )]
    ) log:forAllIn var:SCOPE)]
)] log:implies [ log:graph (
    [ log:triple (var:A :is :observable)]
)].


# query
[ log:graph (
    [ log:triple (var:A :is var:B)]
)] log:impliesAnswer [ log:graph (
    [ log:triple (var:A :is var:B)]
)].
