It depends what you want to do. Julia's base language doesn't include
logical reasoning. If you want to translate a Prolog program into Julia,
you can get away with `if x then y`, but if you want to implement logical
reasoning, then you need to build some machinery yourself. I would use

immutable Implication

immutable And


then (a && b) => c becomes Implication(And(:a, :b), :c)

Then I would define functions to perform backward-chaining. Julia is quite
nice for this kind of thing, because of multiple dispatch.

Then of course, you'll need unification/matching for variables, but that's
not too hard to write either. Read carefully Artificial Intelligence: A
modern approach, and try to implement its pseudocode in Julia. Write a lot
of tests to make sure that it works correctly, then slowly move up from
there. It takes a lot of time to learn mathematics; there are no short-cuts.


On Tue, Sep 20, 2016 at 11:25 AM, Kevin Liu <> wrote:

> The negation I'm guessing would be x = false, iff an equivalence of type
> and value (but in Julia?), implication a combination of if x = true then y
> = false? Is it as simple as this?
> On Tuesday, September 20, 2016 at 11:56:46 AM UTC-3, Kevin Liu wrote:
>> Would anyone know how to represent logical connectives (e.g. negation ¬,
>> conjunction ∧, disjunction ∨, material implication ⇒, biconditional iff ⇔)
>> and quantifiers (e.g. all ∀, exists ∃) in Julia?
>> I understand 'all' can be a for loop. Is the conjunction a comma like in
>> Prolog? Disjunction the 'else' of an if statement? 'Exists' an x = true?
>> On Tuesday, September 20, 2016 at 12:31:23 AM UTC-3, Kevin Liu wrote:
>>> Thanks Cedric, read some of that and LilKanren.jl and this is where I am
>>> with the code (attached). Will continue tomorrow. Feel a bit lost, nothing
>>> out of the usual.
>>> On Monday, September 19, 2016 at 9:15:43 PM UTC-3, Cedric St-Jean wrote:
>>>> You might want to roll your own, too. It's instructive, and not
>>>> particularly hard. Russell and Norvig's textbook has a good section on it.
>>>> On Monday, September 19, 2016 at 5:44:04 PM UTC-4, Kevin Liu wrote:
>>>>> Thanks for the direction, Stefan.
>>>>> On Monday, September 19, 2016 at 3:10:19 PM UTC-3, Stefan Karpinski
>>>>> wrote:
>>>>>> You might try LilKanren.jl <>.
>>>>>> On Mon, Sep 19, 2016 at 10:21 AM, Kevin Liu <> wrote:
>>>>>>> Hello. What would be the long-term solution for using Horn clauses
>>>>>>> in Julia? Is the present solution to call Prolog from C and C from 
>>>>>>> Julia?
>>>>>>> Thanks

Reply via email to