Quantum Concurrent Prolog

10 views
Skip to first unread message

Philip Thrift

unread,
Jan 19, 2020, 6:08:34 AM1/19/20
to Everything List

This may make sense only to those steeped in Concurrent Prolog culture (which may not exist anymore, but was a big late-1980s thing for sure), which is the "process-oriented" (like Actors, Communicating Sequential Processes) version (hack, some might say) of Prolog. It terms of (mathematical) logic, CP's denotational semantics has been approached as some sort of of "linear logic", but it's complicated.

I've determined, formally, what a Quantum Concurrent Prolog would be. It involves something like superpositional unification (logical variables with temporary multiple bindings of possibilities).



Stochastic Concurrent Logic Programming

 

The term ‘stochastic’ in this note will refer to two types of probability:

stochastic = classical-probabilistic + quantum-probabilistic

or, simply

stochastic = probabilistic + quantum

 
 

The guarded Horn clause (GHC)

From Wikipedia:Concurrent_logic_programming:

Concurrent logic programming is a variant of logic programming in which programs are sets of guarded Horn clauses (GHCs) of the form:

     H :- G1, …, Gm | B1, …, Bn.

The conjunction G1, … , Gm is called the guard of the clause, the conjunction B1, …, Bn. the body of the clause and | is the commitment operator.

However, procedurally, when there are several clauses whose heads H match a given goal, then all of the clauses are executed in parallel, checking whether their guards hold. If the guards of more than one clause hold, then a committed choice is made to one of the clauses, and execution proceeds with the subgoals [the body] of the chosen clause. These subgoals can also be executed in parallel. Thus concurrent logic programming implements a form of “don’t care nondeterminism”, rather than “don’t know nondeterminism”.

 
 

The probabilistic guarded Horn clause (PGHC)

     H :- G1, …, Gm : P | B1, …, Bn.

Final term of the guard is a positive number or logical variable that is bound to a nonnegative number at the completion of the other guard terms. j may be 0.

The quantum guarded Horn clause (QGHC)

     H1 :- G1,1, …, G1,m_1 : Q1; …; Hk :- Gk,1, …; Gk,m_k : Qk | B1, …, Bn.

Head is a disjunction separated by semicolon character ‘;’. (Priority of operators: ‘|’, ‘;’, ‘:-‘.) of PGHC-type head+guards EXCEPT final term of each guard is a complex number or logical variable that is bound to a complex number at the completion of the other guard terms.

The disjunctive head+guards are called ‘superpositions’., and their resultant probability is determined by the Feynman ‘sum over histories’ rule:

     Q = Q1 + … + Qk
     P = |Q|

Superpositional bindings (unifications) are undone

Example:

a(1, Q) :- Q1 is Q×(1.0+1.0i) : Q1; a(2, Q) :- Q1 is Q×(1.0-1.0i) : Q1 | print(‘A’).
a(1, Q) :- Q1 is Q×(-1.0+1.0i) : Q1; a(2, Q) :- Q1 is Q×(-1.0-1.0i) : Q1 | print(‘B’).

:- Q is 2.0-3.0i, a(X,Q).

(X not bound at resolution.)

 
 

Read-only logical variables in QGHCs

 

to be added

cf. https://codicalist.wordpress.com/2018/04/08/cp-stochastic-concurrent-prolog/

examples …

 
 
measure(M) :- measure(M,_,list of complex numbers).

measure(a,1,Q) :- nth1(Q,1, Qa1) : Qa1;
measure(a,2,Q) :- nth1(Q,2, Qa2) : Qa2
      | print(a).
measure(b,1,Q) :- nth1(Q,3, Qb1) : Qb1;
measure(b,2,Q) :- nth1(Q,4, Qb2)) : Qb2
      | print(b)

 

@philipthrift
Reply all
Reply to author
Forward
0 new messages