Liste des Groupes | Revenir à s logic |
Hi,
One of the pelettier test cases was to test
how long it takes to terminate with "false",
the other was to test how long it takes to
terminate with "true". The Prolog time/1
predicate can be used to measure both, a
"false" outcome and a "true" outcome.
Wangs algorithm can be easily extended to
biconditional:
:- op(1100, xfx, <->).
prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
prove(L) :- select((A<->B),L,R), !, prove([-A,B|R]), prove([-B,A|R]).
prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
prove(L) :- select(-(A<->B),L,R), !, prove([-A,-B|R]), prove([B,A|R]).
prove(L) :- select(-A,L,R), member(A,R), !.
Usually Theorem Provers choke on these
test cases, unless they work with some
XOR representation inspired by Boolean Rings.
But provers insprired by Boolean Algebra explode:
/* success timing */
?- between(5,10,N), nasty_bicond(N,X),
time(prove([X<->X])), fail; true.
% 211,301 inferences, 0.000 CPU in 0.013 seconds
% 971,051 inferences, 0.047 CPU in 0.060 seconds
% 4,386,029 inferences, 0.266 CPU in 0.270 seconds
% 19,547,363 inferences, 1.219 CPU in 1.209 seconds
% 86,183,093 inferences, 5.141 CPU in 5.355 seconds
% 376,634,555 inferences, 22.969 CPU in 23.355 seconds
true.
/* failure timing */
?- between(5,10,N), nasty_bicond(N,X),
M is N+1, nasty_bicond(M,Y),
time(\+ prove([X<->Y])), fail; true.
% 113,383 inferences, 0.000 CPU in 0.008 seconds
% 514,955 inferences, 0.031 CPU in 0.032 seconds
% 2,308,703 inferences, 0.141 CPU in 0.143 seconds
% 10,233,763 inferences, 0.625 CPU in 0.632 seconds
% 44,928,359 inferences, 2.781 CPU in 2.773 seconds
% 195,659,867 inferences, 12.078 CPU in 12.142 seconds
true.
The pelletier test case generator:
nasty_bicond(0, x0) :- !.
nasty_bicond(N, (X<->Y)) :-
number_codes(N, L),
atom_codes(X, [0'x|L]),
M is N-1,
nasty_bicond(M, Y).
What is a Boolean Ring:
https://en.wikipedia.org/wiki/Boolean_ring
What is a Boolean Algebra:
https://en.wikipedia.org/wiki/Boolean_algebra_%28structure%29
Julio Di Egidio schrieb:On 05/12/2024 22:26, Julio Di Egidio wrote:On 02/12/2024 12:37, Julio Di Egidio wrote:>On 02/12/2024 09:49, Mild Shock wrote:Could it be that your procedure doesn't>
terminate always? Why is this not finished
after more than 1 minute?
The solver *is* very slow at the moment, and you are trying to prove a too complicated statement:
>
```
?- unfold(tnt((p<->(q<->r))<->(p<->q)), X).
```
That 'pelletier' is actually false. I guess you have miscopied it, this one is true (classically):
>
`((p <-> (q <-> r)) <-> (p <-> q)) <-> r`.
>
Meanwhile, I have narrowed the problem of non-termination down to the imp-elim rule, and already have a tentative fix in place.
>
Though I have added that 'pelletier' to my neg cases and the test is now failing: and I don't know exactly why (the trace is again overwhelming), but I guess either I am trading termination for completeness, or this is finally a failure of TNT.
>
I need a (more) principled approach...
>
-Julio
>
Les messages affichés proviennent d'usenet.