Skip to content

Commit

Permalink
refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
josd committed Jan 2, 2025
1 parent 5a49c11 commit ca70839
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
6 changes: 3 additions & 3 deletions wepl/dining-philosophers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

'<urn:example:run>'(A, B, C) :-
sleep(B),
format('% ~w thinking for ~w seconds~n', [A, B]),
%format('% ~w thinking for ~w seconds~n', [A, B]),
'<urn:example:pickup>'(A),
sleep(C),
format('% ~w eating for ~w seconds~n', [A, C]),
%format('% ~w eating for ~w seconds~n', [A, C]),
'<urn:example:putdown>'(A).

'<urn:example:got>'('<urn:example:all>', '<urn:example:dinner>') :+
'<urn:example:got>'('<urn:example:all>', '<urn:example:dinner>') :-
thread_create('<urn:example:run>'('<urn:example:person1>', 0.1, 0.1), A, []),
thread_create('<urn:example:run>'('<urn:example:person2>', 0.2, 0.2), B, []),
thread_create('<urn:example:run>'('<urn:example:person3>', 0.15, 0.1), C, []),
Expand Down
23 changes: 0 additions & 23 deletions wepl/output/dining-philosophers.pl
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
:- op(1200, xfx, :+).

% <urn:example:person1> thinking for 0.1 seconds
% <urn:example:person3> thinking for 0.15 seconds
% <urn:example:person2> thinking for 0.2 seconds
% <urn:example:person1> eating for 0.1 seconds
% <urn:example:person4> thinking for 0.25 seconds
% <urn:example:person5> thinking for 0.25 seconds
% <urn:example:person3> eating for 0.1 seconds
% <urn:example:person2> eating for 0.2 seconds
% <urn:example:person4> eating for 0.2 seconds
% <urn:example:person5> eating for 0.1 seconds
% <urn:example:person1> thinking for 0.1 seconds
% <urn:example:person3> thinking for 0.15 seconds
% <urn:example:person2> thinking for 0.2 seconds
% <urn:example:person1> eating for 0.1 seconds
% <urn:example:person4> thinking for 0.25 seconds
% <urn:example:person3> eating for 0.1 seconds
% <urn:example:person5> thinking for 0.25 seconds
% <urn:example:person4> eating for 0.2 seconds
% <urn:example:person2> eating for 0.2 seconds
% <urn:example:person5> eating for 0.1 seconds
% answers
answer('<urn:example:got>'('<urn:example:all>', '<urn:example:dinner>')).

% proof steps
step(('<urn:example:got>'('<urn:example:all>', '<urn:example:dinner>'):+thread_create('<urn:example:run>'('<urn:example:person1>', 0.1, 0.1), A, []), thread_create('<urn:example:run>'('<urn:example:person2>', 0.2, 0.2), B, []), thread_create('<urn:example:run>'('<urn:example:person3>', 0.15, 0.1), C, []), thread_create('<urn:example:run>'('<urn:example:person4>', 0.25, 0.2), D, []), thread_create('<urn:example:run>'('<urn:example:person5>', 0.25, 0.1), E, []), thread_join(A, _), thread_join(B, _), thread_join(C, _), thread_join(D, _), thread_join(E, _)),
(thread_create('<urn:example:run>'('<urn:example:person1>', 0.1, 0.1), '$BLOB'("<thread>(3,0x564742e252c0)"), []), thread_create('<urn:example:run>'('<urn:example:person2>', 0.2, 0.2), '$BLOB'("<thread>(4,0x564742e25310)"), []), thread_create('<urn:example:run>'('<urn:example:person3>', 0.15, 0.1), '$BLOB'("<thread>(5,0x564742e25360)"), []), thread_create('<urn:example:run>'('<urn:example:person4>', 0.25, 0.2), '$BLOB'("<thread>(6,0x564742e253b0)"), []), thread_create('<urn:example:run>'('<urn:example:person5>', 0.25, 0.1), '$BLOB'("<thread>(7,0x564742e24d70)"), []), thread_join('$BLOB'("<thread>(3,0x564742e252c0)"), true), thread_join('$BLOB'("<thread>(4,0x564742e25310)"), true), thread_join('$BLOB'("<thread>(5,0x564742e25360)"), true), thread_join('$BLOB'("<thread>(6,0x564742e253b0)"), true), thread_join('$BLOB'("<thread>(7,0x564742e24d70)"), true)),
'<urn:example:got>'('<urn:example:all>', '<urn:example:dinner>')).
step((true:+'<urn:example:got>'('<urn:example:all>', '<urn:example:dinner>')),
'<urn:example:got>'('<urn:example:all>', '<urn:example:dinner>'),
true).

0 comments on commit ca70839

Please sign in to comment.