% Define the parent relationship
parent(alice, bob).
parent(alice, charlie).
parent(bob, david).
parent(bob, emily).
parent(charlie, frank).
parent(charlie, grace).

% Define the male and female relationships
male(bob).
male(charlie).
male(david).
male(frank).

female(alice).
female(emily).
female(grace).

% Define the sister relationship
sister(X, Y) :-
    female(X),
    parent(Z, X), % X and Y have the same parent
    parent(Z, Y), % Y and X have the same parent
    X \= Y.      % X and Y are different individuals

% Query to find sisters
?- sister(X, Y). 

Prolog Online Compiler

Write, Run & Share Prolog code online using OneCompiler's Prolog online compiler for free. It's one of the robust, feature-rich online compilers for Prolog language. Getting started with the OneCompiler's Prolog editor is easy and fast. The editor shows sample boilerplate code when you choose language as Prolog and start coding.