On Fri, 2011-02-25 at 11:23 +0100, Daniel Warzecha wrote:
> Hi,
>
>
>
> I found the error, it seems that "Depth > 1" is wrong, it should be
> "Depth @> 1" to work.
>
>
> I don't understand why this rule would never be true. The rule should
> be read as
>
> "The attacker KNOWS the HASH of DATA at the depth DEPTH, and the
> attacker knows DATA at DEPTH - 1."
> So basically if someone knows a data, he can build the hash of it.
>
>
> What would be a base case?
>
>
> I have several facts made up dynamically in the program that are
> basically knows(Data,1).
> So wouldn't that work?
>
>
> Greetings,
> Daniel Warzecha
>
>
> 2011/2/25 Daniel Thomas <
address@hidden>
> Hello,
>
> There shouldn't be any real differences in syntax between
> SWI-Prolog and
> GNU Prolog for Java - they are both fairly standards compliant
> (I like
> to think that GNU Prolog for Java is slightly better at that).
>
>
> > knows(hash(Data),Depth) :-
> > Depth > 1,
> > DepthMinus1 is Depth - 1,
> > knows(Data,DepthMinus1).
>
> This rule will never be true as it has no base case. I take it
> that the
> purpose is to check that the number of hashes on the first
> argument is
> the number specified by the second argument. (It won't
> calculate it for
> you as the second argument won't instantiate in time)
>
> If there is a syntax error being generated could I see it?
> Something
> should be stored in the getLoadingErrors().
>
> I hope this helps,
>
> Daniel
>
>
>
> On Wed, 2011-02-23 at 00:12 +0100, Daniel Warzecha wrote:
> > And again a hello,
> >
> >
> >
> > thanks for the advice. I've probably doused the "infinite"
> problem
> > adding a depth rule (the infinite problem being exactly what
> you
> > described).
> > Anyways, the Prolog code I'm re-using was written for
> SWI-Prolog. That
> > probably brings additional problems with it (it also
> explains why the
> > dynamic rules were written as they were).
> > It seems that the interpreter throws an error when it tries
> to use the
> > following rule:
> >
> >
> > knows(hash(Data),Depth) :-
> > Depth > 1,
> > DepthMinus1 is Depth - 1,
> > knows(Data,DepthMinus1).
> >
> >
> > Is there a GNU Prolog specific syntax error in there, or
> should this
> > normally work?
> >
> >
> > Greetings,
> > Daniel Warzecha
> >
> > 2011/2/22 Daniel Thomas <
address@hidden>
> > Hello,
> >
> > You might want to look at the listing/1 or findall/3
> > predicates for
> > looking at what knowledge has been gained thus far.
> >
> > > Also it seems that my prolog rules generate
> infinite
> > knowledge. Do you
> > > perhaps know of an inbuilt predicate to prevent
> this?
> >
> >
> > I am not quite sure what you mean by infinite
> knowledge? Do
> > you mean
> > that it is creating an infinite number of predicate
> values and
> > hence not
> > terminating? In that case you probably want to alter
> your
> > rules so that
> > doesn't happen. If you are not sure how to do so
> then you
> > probably need
> > to find some guide to help teach you prolog. I had
> the
> > advantage of
> > lectures on it
>
http://www.cl.cam.ac.uk/teaching/0910/Prolog/
> > was a very
> > good and well taught course but just reading the
> lecture notes
> > probably
> > doesn't help as much as one might like.
> >
> > You can put write/1 instructions or use listing/1 or
> findall/3
> > at
> > various different points in your prolog to see what
> is
> > happening there.
> > It would be neater if trace/0 was working but I
> don't think
> > that it is.
> > You might try debugging your prolog using a normal
> prolog
> > interpreter
> > such as gnuprolog or swiprolog.
> >
> > I hope this helps,
> >
> > Daniel
> >
> >
> > On Tue, 2011-02-22 at 22:03 +0100, Daniel Warzecha
> wrote:
> > > Hello again,
> > >
> > >
> > > thank you for your help so far.
> > >
> > >
> > > I started producing goal results. Now is the time
> to debug
> > my prolog
> > > rules.
> > >
> > >
> > > Is there some way to print the knowledge that has
> been
> > gained so far?
> > >
> > >
> > > So I could trace a goal like this?
> > >
> > >
> > > isKey(X)?
> > >
> > >
> > > X -> isSymKey(X) -> isKey(X).
> > >
> > >
> > > Also it seems that my prolog rules generate
> infinite
> > knowledge. Do you
> > > perhaps know of an inbuilt predicate to prevent
> this?
> > > (Do not feel that you need to answer this, this is
> just from
> > a
> > > relatively new prolog user to someone who
> maintains a
> > problem domain
> > > library)
> > >
> > >
> > > Greetings,
> > >
> > >
> > > Daniel Warzecha
> >
> >
> >
>
>
>