Based on my post on stackoverflow I also want to ask here. Is their a possibility on python with swiplserver to consult a file (like the consult command in the libary pyswip).
My setup based on the introductions of this forum is:
from swiplserver import PrologMQI, PrologThread
with PrologMQI() as mqi:
with mqi.create_thread() as prolog_thread:
result = prolog_thread.query("member(X, [color(blue), color(red)])")
print(result)
now I want to use the abilities I already have in some prolog file, call it prop.pl with example predicate
:-op(800, fx, ¬).
:-op(801, xfy, ∧).
:-op(802, xfy, ∨).
:-op(803, xfy, →).
:-op(804, xfy, ↔).
:-op(800, xfy, #).
m_Proposition_Binary_x_y(X ∨ Y, X, Y).
m_Proposition_Binary_x_y(X ∧ Y, X, Y).
m_Proposition_Binary_x_y(X → Y, X, Y).
m_Proposition_Binary_x_y(X ↔ Y, X, Y).
m_Proposition(X) :-
m_Proposition_Atom(X).
m_Proposition(Binary) :-
m_Proposition_Binary_x_y(Binary, X, Y),
m_Proposition(X),
m_Proposition(Y).
m_Proposition(¬ X) :-
m_Proposition(X).
m_Proposition_Atom(p).
m_Proposition_Atom(q).
How can I load that file in my server, so I can use e.g. the query
result = intersection([A,(A→B)], [p, (p→q)], Aim).