Skip to content

Commit

Permalink
adding blogic negative surface redundancy removal
Browse files Browse the repository at this point in the history
  • Loading branch information
josd committed Feb 14, 2023
1 parent 91b7c5b commit 4273854
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions RELEASE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
EYE release

[v2.10.3] adding blogic negative surface redundancy removal
[v2.10.2] using log:onQuerySurface instead of log:onConstructSurface
[v2.10.1] fixing https://github.com/eyereasoner/Notation3-By-Example/blob/main/log/blogic/negativeSurface3.n3
[v2.10.0] backward rules are now using log:onConstructSurface instead of log:onQuerySurface
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.10.2
2.10.3
52 changes: 26 additions & 26 deletions eye.pl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:- use_module(library(semweb/turtle)).
:- catch(use_module(library(http/http_open)), _, true).

version_info('EYE v2.10.2 josd').
version_info('EYE v2.10.3 josd').

license_info('MIT License

Expand Down Expand Up @@ -706,14 +706,14 @@
assertz(flag(blogic)),
retractall(flag(nope)),
assertz(flag(nope)),
% positive surfaces
% positive surface
assertz(implies('<http://www.w3.org/2000/10/swap/log#onPositiveSurface>'(_, G), G, '<>')),
% inference fuse
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
makevars(G, H, beta(V)),
call(H)
), false, '<>')),
% negative surfaces
% negative surface resolve positive surface
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
\+member('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(_, _), L),
Expand All @@ -723,13 +723,24 @@
append(K, D, E),
conj_list(F, E)
), '<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, F), '<>')),
% negative surface even level erasure
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
select('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(W, H), L, K),
conj_list(C, K),
conj_list(H, M),
select('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(W, C), M, _)
), '<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(W, C), '<>')),
% negative surface redundancy removal
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
list_to_set(L, M),
conj_list(H, M),
( \+'<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, H)
-> assertz('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, H))
; true
)), true, '<>')),
% adjust graffiti
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
findvars(G, U, beta),
findall(M,
Expand All @@ -740,14 +751,15 @@
),
W \= V
), '<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(W, G), '<>')),
% forward rules
% forward rule
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
select('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(_, H), L, K),
conj_list(C, K),
domain(V, C, P),
makevars('<http://www.w3.org/2000/10/swap/log#implies>'(P, H), B, beta(V))
), B, '<>')),
% forward rule with contrapositives
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
select('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(W, H), L, K),
Expand All @@ -767,6 +779,7 @@
),
makevars('<http://www.w3.org/2000/10/swap/log#implies>'(D, E), B, beta(V))
), B, '<>')),
% forward rule with positive premis negative conclusion
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
\+member('<http://www.w3.org/2000/10/swap/log#onPositiveSurface>'(_, _), L),
Expand All @@ -779,6 +792,7 @@
domain(V, R, P),
makevars('<http://www.w3.org/2000/10/swap/log#implies>'(P, E), B, beta(V))
), B, '<>')),
% forward rule with mixed premis and negative conclusion
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
select(J, L, K),
Expand All @@ -798,6 +812,7 @@
C = '<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([], H),
makevars('<http://www.w3.org/2000/10/swap/log#implies>'(J, C), B, beta(V))
), B, '<>')),
% premis resolution
assertz(implies((implies('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(_, D), C, _),
D \= implies(_, _, _),
D \= (implies(_, _, _), _),
Expand All @@ -807,7 +822,7 @@
domain(V, true, P),
makevars('<http://www.w3.org/2000/10/swap/log#implies>'(P, C), B, beta(V))
), B, '<>')),
% backward rules
% backward rule
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
( select('<http://www.w3.org/2000/10/swap/log#onQuerySurface>'(_, H), L, K)
Expand All @@ -822,16 +837,19 @@
assertz(C)
; true
)), true, '<>')),
% queries
% ask surface
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onAskSurface>'([], G),
G \= true,
conj_list(G, L),
select(J, L, K),
conj_list(H, K),
T = ('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([],
'<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([], J)), H),
assertz('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([], T))
), true, '<>')),
( \+'<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([], T)
-> assertz('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([], T))
; true
)), true, '<>')),
% query surface
assertz(implies(('<http://www.w3.org/2000/10/swap/log#onQuerySurface>'(V, G),
conj_list(G, L),
( ( select('<http://www.w3.org/2000/10/swap/log#onQuerySurface>'(_, H), L, K)
Expand All @@ -851,24 +869,6 @@
retractall(brake)
; true
)), true, '<>')),
% warn for multiple models
assertz(implies((flag(warn),
'<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G),
conj_list(G, L),
select('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(_, H), L, K),
findall(M,
( member(M, K),
M \= '<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(_, _)
),
J
),
conj_list(C, J),
length(K, N),
length(J, I),
N > I,
makevars('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(V, G), B, beta(V)),
format(user_error, '** WARNING ** multiple models ~w~n', B)
), true, '<>')),
% extended unifier
asserta((unify(A, true) :-
nonvar(A),
Expand Down
Binary file modified eye.zip
Binary file not shown.

0 comments on commit 4273854

Please sign in to comment.