You said that you usually write "p if and only if q" (I will write q <=> q in the following) as
p :- q.
q :- p.
but this is only true if
- no other suggestions for p and q
- variables are not involved
, , p q , , .
,
p(X) :- q(X).
q(X) :- p(X).
forall X: p(X) <= q(X) and forall X': q(X') <= p(X')
forall X,X': p(X) <= q(X) and q(X') <= p(X')
,
forall X: p(X) <= q(X) and q(X) <= p(X)
, , " ".
p(X,Y) :- q(X,Z).
forall X,Y exists Z: p(X,Y) <=> q(X,Z)
q/2 , . , ..
- , , " p <= > q?", p q . -
p_iff_q(X) :- p(X) <=> q(X).
Prolog
p_iff_q(X) :- p(X),q(X) ; \+p(X),\+q(X).