Prolog by Example A Prolog program is composed by facts and rules, which are special cases of definite (or Horn) clauses, i.e. clauses with at most one positive literal (the…