pierre, hi,
apologies for using the more traditional mailing list approach rather than stackoverflow. [as an experienced python programmer] i need some help in understanding how to use pydatalog. i did logic programming at university in 1991 (we used Hope - a parallel logic language designed at Imperial College) and i'm having difficulty grasping the concepts enough to be able to even get started. if i describe what's needed could you help walk me through it? would be most grateful: i'm sure you could do this in 5 minutes whereas it would take me days and i'd likely have to give up and use pure python!
basically i need to work out the "decay" patterns - they're not, they're phase transforms - based on a set of input particles, a set of output particles, and a set of "intermediaries" which are created and destroyed near-instantaneously.
the "particles" are a list of any of the following eight patterns (four are shown below, there are obviously anti-particles):
down = 'V-T-V-'
up = 'T+V+T+'
electron = 'T-T-T-'
neutrino = 'V+V+V+'
there are two sets of permitted "transforms", "V+T-0" and "V-T+0":
vt_0 = [['T-V-T-', 'V+T+V+'],
['T+V+T+', 'T-T-T-'],
['V+V+V+', 'V-T-V-']
]
v_t0 = [['T+V+T+', 'V-T-V-'],
['V+T+V+', 'V-V-V-'],
['T+T+T+', 'T-V-T-']
]
yes it is actually permitted for the transforms to go *back* to the exact same pair from which they originated, so up+electron can go into a V+T-0 transform *and* come out the other side.
the only other rule is that the transforms *must* occur in pairs. the number of V+T-0 transforms *must* match the number of V-T+0 transforms.
there is one other interesting "gotcha" - a transform that uses the "intermediaries" *may* be both the input *and* the output of a VT0 transform! in the extreme case this would result in one pair of intermediaries not being involved (at all) in any other interactions, effectively being an isolated group.
what i need is to use pydatalog to tell me what VT0 transforms were needed to turn the "input" particles - via the "intermediaries" - into "output" particles. all input particles *must* go via the "intermediaries" as VT0 transforms.
so, to summarise that again:
* there are 8 possible particles
* there are two sets of transforms with 3 pairs each
* the input to each transform is one of the 3 pairs; the output is one of the 3 pairs
* the output must be a list of VT0 transforms where the total number of V+T-0 transforms *must* equal the total number of V-T+0 transforms
* the input is three fixed sets of particles: "incoming", "intermediaries" and "outgoing".
* every particle in the "incoming" set *must* go through the "intermediaries" - as transforms - into the "outgoing" set.
* "intermediaries" are permitted to be considered as part of *both* the incoming *and* the outgoing set i.e. may be inputs to transforms just as the incoming set is *and* they may be the outputs from transforms just as the outgoing set is, even if that means two or even more particles from the intermediary group are *totally* isolated from the rest of the transforms.
that's the lot :) relatively straightforward for someone who knows what they're doing, but i honestly have no clue where to start.
your help appreciated.
l.