From ebaa38df778b6fece0c021a082dd57b2f032705b Mon Sep 17 00:00:00 2001 From: pkonowrocki Date: Thu, 4 Jul 2019 21:13:10 +0200 Subject: [PATCH] Final remarks --- ModelsTests/Reasoning/PossibleStatesTest.cs | 90 ----- .../MultiAgentLanguageGUI.csproj | 3 - MultiAgentLanguageGUI/logic.pl | 274 -------------- .../MultiAgentLanguageModels.csproj | 3 - MultiAgentLanguageModels/logic.pl | 265 -------------- README.md | 90 +++-- STORY_1.mar | 16 - STORY_1_Queary.txt | 5 - STORY_2.mar | 16 - STORY_2_Queary.txt | 8 - STORY_3.mar | 12 - STORY_3_Queary.txt | 6 - example_from_lecture_1.mar | 11 - logic.pl | 335 ------------------ models/example.pl | 23 -- models/story1.pl | 12 - models/story2.pl | 12 - run.pl | 1 - screenshot.PNG | Bin 0 -> 20076 bytes tests.pl | 8 - tests/examples_from_Lectures/model.pl | 21 -- tests/examples_from_Lectures/test.pl | 48 --- tests/examples_from_Radzikowska/model.pl | 17 - tests/examples_from_Radzikowska/test.pl | 26 -- tests/examples_mean/model.pl | 18 - tests/examples_mean/test.pl | 33 -- tests/necessary_after_from/model.pl | 61 ---- tests/necessary_after_from/test.pl | 52 --- tests/necessary_engaged/model.pl | 26 -- tests/necessary_engaged/test.pl | 60 ---- tests/necessary_executable/model.pl | 58 --- tests/necessary_executable/test.pl | 66 ---- tests/possibly_after_from/model.pl | 30 -- tests/possibly_after_from/test.pl | 34 -- tests/possibly_engaged/model.pl | 24 -- tests/possibly_engaged/test.pl | 63 ---- tests/possibly_executable/model.pl | 9 - tests/possibly_executable/test.pl | 17 - tests/story1/story.pl | 10 - tests/story1/test.pl | 34 -- tests/story2/story.pl | 15 - tests/story2/test.pl | 38 -- tests/story3/story.pl | 8 - tests/story3/test.pl | 29 -- 44 files changed, 60 insertions(+), 1927 deletions(-) delete mode 100644 ModelsTests/Reasoning/PossibleStatesTest.cs delete mode 100644 MultiAgentLanguageGUI/logic.pl delete mode 100644 MultiAgentLanguageModels/logic.pl delete mode 100644 STORY_1.mar delete mode 100644 STORY_1_Queary.txt delete mode 100644 STORY_2.mar delete mode 100644 STORY_2_Queary.txt delete mode 100644 STORY_3.mar delete mode 100644 STORY_3_Queary.txt delete mode 100644 example_from_lecture_1.mar delete mode 100644 logic.pl delete mode 100644 models/example.pl delete mode 100644 models/story1.pl delete mode 100644 models/story2.pl delete mode 100644 run.pl create mode 100644 screenshot.PNG delete mode 100644 tests.pl delete mode 100644 tests/examples_from_Lectures/model.pl delete mode 100644 tests/examples_from_Lectures/test.pl delete mode 100644 tests/examples_from_Radzikowska/model.pl delete mode 100644 tests/examples_from_Radzikowska/test.pl delete mode 100644 tests/examples_mean/model.pl delete mode 100644 tests/examples_mean/test.pl delete mode 100644 tests/necessary_after_from/model.pl delete mode 100644 tests/necessary_after_from/test.pl delete mode 100644 tests/necessary_engaged/model.pl delete mode 100644 tests/necessary_engaged/test.pl delete mode 100644 tests/necessary_executable/model.pl delete mode 100644 tests/necessary_executable/test.pl delete mode 100644 tests/possibly_after_from/model.pl delete mode 100644 tests/possibly_after_from/test.pl delete mode 100644 tests/possibly_engaged/model.pl delete mode 100644 tests/possibly_engaged/test.pl delete mode 100644 tests/possibly_executable/model.pl delete mode 100644 tests/possibly_executable/test.pl delete mode 100644 tests/story1/story.pl delete mode 100644 tests/story1/test.pl delete mode 100644 tests/story2/story.pl delete mode 100644 tests/story2/test.pl delete mode 100644 tests/story3/story.pl delete mode 100644 tests/story3/test.pl diff --git a/ModelsTests/Reasoning/PossibleStatesTest.cs b/ModelsTests/Reasoning/PossibleStatesTest.cs deleted file mode 100644 index dc1628c..0000000 --- a/ModelsTests/Reasoning/PossibleStatesTest.cs +++ /dev/null @@ -1,90 +0,0 @@ -using MultiAgentLanguageModels.Expressions; -using MultiAgentLanguageModels.Reasoning; -using NUnit.Framework; -using MultiAgentLanguageModels; -using System.Collections.Generic; - -namespace Reasoning -{ - public class PossibleStatesTest - { - [Test] - public void TestPossibleStates() - { - var loaded = new Fluent("loaded"); - var walking = new Fluent("walking"); - var alive = new Fluent("alive"); - var reasoning = new ReasoningEngine(); - var ExpressionsList = new ExpressionsList() - { - new Initially(new And(loaded, walking)), - new Always(new If(walking, alive)), - new Causes("load", loaded), - new Causes("shoot", new Not(loaded)), - new CausesIf("shoot", new Not(alive), loaded) - }; - - var resp = reasoning.GenerateStructure(ExpressionsList); - - Assert.AreEqual(resp, resp); - } - - [Test] - public void TestRes0() - { - var loaded = new Fluent("loaded"); - var walking = new Fluent("walking"); - var alive = new Fluent("alive"); - var reasoning = new ReasoningEngine(); - var ExpressionsList = new ExpressionsList() - { - new Initially(new And(loaded, walking)), - new Always(new If(walking, alive)), - new Causes("load", loaded), - new Causes("shoot", new Not(loaded)), - new CausesIf("shoot", new Not(alive), loaded) - }; - var resp = reasoning.GenerateStructure(ExpressionsList); - - Assert.AreEqual(resp, resp); - } - - [Test] - public void TestRes() - { - var loaded = new Fluent("loaded"); - var walking = new Fluent("walking"); - var alive = new Fluent("alive"); - var reasoning = new ReasoningEngine(); - var ExpressionsList = new ExpressionsList() - { - new Initially(new And(loaded, walking)), - new Always(new If(walking, alive)), - new Causes("load", loaded), - new Causes("shoot", new Not(loaded)), - new CausesIf("shoot", new Not(alive), loaded) - }; - var resp = reasoning.GenerateStructure(ExpressionsList); - - Assert.AreEqual(resp, resp); - } - - - [Test] - public void TestRes_Releases() - { - var hasA = new Fluent("hasA"); - var hasB = new Fluent("hasB"); - var reasoning = new ReasoningEngine(); - var ExpressionsList = new ExpressionsList() - { - new Causes("buypaper", new Or(hasA, hasB)), - new ReleasesIf("buypaper", hasA, new Not(hasA)), - new ReleasesIf("buypaper", hasB, new Not(hasB)) - }; - var resp = reasoning.GenerateStructure(ExpressionsList); - - Assert.AreEqual(resp, resp); - } - } -} \ No newline at end of file diff --git a/MultiAgentLanguageGUI/MultiAgentLanguageGUI.csproj b/MultiAgentLanguageGUI/MultiAgentLanguageGUI.csproj index 892d958..b1b0e94 100644 --- a/MultiAgentLanguageGUI/MultiAgentLanguageGUI.csproj +++ b/MultiAgentLanguageGUI/MultiAgentLanguageGUI.csproj @@ -102,9 +102,6 @@ PreserveNewest - - PreserveNewest - SettingsSingleFileGenerator diff --git a/MultiAgentLanguageGUI/logic.pl b/MultiAgentLanguageGUI/logic.pl deleted file mode 100644 index 6195687..0000000 --- a/MultiAgentLanguageGUI/logic.pl +++ /dev/null @@ -1,274 +0,0 @@ -:- dynamic impossible_by/2. -:- dynamic impossible_if/2. -:- dynamic by_causes/3. -:- dynamic causes_if/3. -:- dynamic by_releases_if/4. -:- dynamic by_releases/3. -:- dynamic releases_if/3. -:- dynamic always/1. -:- dynamic initially/1. - -% Support for tests: -:- multifile impossible_by/2, by_causes_if/4, by_causes/3, after/2, by_releases_if/4, always/1. -:- style_check(-discontiguous). -passed:- nl, ansi_format([bold,fg(green)], 'Passed', []). -failed:- nl, ansi_format([bold,fg(red)], 'Failed', []). - - -% Make sure, "initially" also propagates to after(Result, []). -after(Result, []):- - initially(Result). - -private_impossible_by_if(Action, Group, State):- - impossible_by(Action, Group); - impossible_if(Action, State); - impossible_by_if(Action, Group, State). - -impossible_by_if(Action, Group, []):- - impossible_by(Action, Group), !. - -impossible_by_if(Action, [], State):- - impossible_if(Action, State), !. - - - -by_causes_if(Action, Group, Result, []):- - by_causes(Action, Group, Result). - -by_causes_if(Action, [], Result, State):- - causes_if(Action, Result, State). - - -by_releases_if(Action, Group, Result, _):- - by_releases(Action, Group, Result). - -by_releases_if(Action, _, Result, State):- - releases_if(Action, Result, State). - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Executability queries - TODO: fix possibly_executable_from query -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -necessary_executable_from([[Action, Group] | Program], CurrentState):- - private_necessary_executable_from([[Action, Group] | Program], CurrentState, _), !. - -% CurrentState means "initialState" in the first call, and then set of all changes states -private_necessary_executable_from([[Action, Group] | Program], CurrentState, FinalState):- - ( - (by_causes_if(Action, G, ResultingState, RequiredState);by_releases_if(Action, G, ResultingState, RequiredState)), - ( - subset(G,Group), - ( - not(is_empty(RequiredState)), - ( - is_always(RequiredState) - ; - subset(RequiredState, CurrentState) - ) - ) - ; - initially(Y), - (is_empty(RequiredState), subset(CurrentState,Y)) - ; - (is_empty(RequiredState),is_empty(CurrentState)) - ) - ), - not(private_impossible_by_if(Action, Group, RequiredState)), - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewCurrentState), - private_necessary_executable_from(Program, NewCurrentState, FinalState), !. - -private_necessary_executable_from([], NewCurrentState, FinalState):- - FinalState = NewCurrentState, !. - -necessary_executable(Program):- - necessary_executable_from(Program, []), !. - - - -% CurrentState means "initialState" in the first call, and then set of all changes states -possibly_executable_from([[Action, Group] | Program], CurrentState):- - (by_releases_if(Action, Group, ResultingState, X) ; by_causes_if(Action, Group, ResultingState, X)), - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - not(private_impossible_by_if(Action, Group, X)), - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewCurrentState), - possibly_executable_from(Program, NewCurrentState), !. - -possibly_executable_from([],_). - -possibly_executable(Program):- - possibly_executable_from(Program, []), !. - - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Value queries - TODO: finish possibly_after_from implementation -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -necessary_after_from(State, [[Action, Group] | Program], CurrentState):- - ( - ( - is_always(State) - ) - ; - ( - private_necessary_executable_from([[Action, Group] | Program], CurrentState, StateAfterProgram), - (after(State, [[Action, Group] | Program]) ; subset(State, StateAfterProgram)) - ) - ), !. - -necessary_after(State, Program):- - necessary_after_from(State, Program, []), !. - -possibly_after_from(State, [[Action, Group] | Program], CurrentState):- - is_always(State) - ; - (apply_alwayses(CurrentState, FullCurrentState) ; true), - ( - ( - %Bierzemy stan do którego musimy przejść i idziemy do następnej instrukcji. Jeżeli to się nie powiedzie to zwracamy false bo musimy przejść do ResultingState(!) - by_causes_if(Action, Group, ResultingState, X), - ((not(is_empty(X)),subset(X, FullCurrentState)) ; (is_empty(X),is_empty(FullCurrentState))), - apply_resulting_state(ResultingState, FullCurrentState, NewCurrentState), - possibly_after_from(State, Program, NewCurrentState), ! - ) - ; - ( - % Nie mamy stanu, do którego musimy przejść, generujemy stany usuwając poszczególne fluenty i sprawdzamy - possibly_after_from_without_causes(State, [[Action, Group] | Program], FullCurrentState) - ) - ). - -possibly_after_from_without_causes(State, [[Action, Group] | Program], CurrentState):- - %Ta reguła generuje nowe stany na podstawie reguł releases i weryfikuje dla nich działanie - %by_releases_if(Action, Group, ReleasedFluent, CurrentState), % sprawdzamy, czy możemy w ogóle wykonać releases - ( - %Sprawdzamy dalszy przebieg dla obecnego stanu - by_releases_if(Action, Group, ReleasedFluent, X), %czy akcja w ogóle możliwa - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - possibly_after_from(State, Program, CurrentState) - ) - ; - ( - %Generujemy nowy stan usuwając jeden z uwolnionych fluentów i sprawdzamy dalszy przebieg rekurencyjnie - by_releases_if(Action, Group, ReleasedFluent, X), - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - subtract(CurrentState, [ReleasedFluent], CurrentStateWithoutPositiveReleased), - subtract(CurrentStateWithoutPositiveReleased, [\ReleasedFluent], CurrentStateWithoutAnyReleased), - ( - ( - append([ReleasedFluent], CurrentStateWithoutAnyReleased, NewCurrentStateWithPositiveReleased), - possibly_after_from_without_causes(State, [[Action, Group] | Program], NewCurrentStateWithPositiveReleased) - ) - ; - ( - append([\ReleasedFluent], CurrentStateWithoutAnyReleased, NewCurrentStateWithNegativeReleased), - possibly_after_from_without_causes(State, [[Action, Group] | Program], NewCurrentStateWithNegativeReleased) - ) - ) - ). - -possibly_after_from_without_causes(State, [], CurrentState):- - possibly_after_from(State, [], CurrentState). - -possibly_after_from(State,[], CurrentState):- - negate_list(State, NegatedRequiredState), - intersection(NegatedRequiredState, CurrentState, Common), - is_empty(Common), !. - -possibly_after(State, Program):- - possibly_after_from(State, Program, []), !. - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Engagement queries -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -check_state(Action,[FirstEngaged | _ ], States):- - by_causes_if(Action, FirstEngaged, _, RequiredState), - (subset(RequiredState, States); write('here'), is_always(RequiredState), write('there')). - -necessary_engaged_from(Group, [Action|List], States):- - not(impossible_by_if(Action, Group, RequiredState)), - findall(X, by_causes_if(Action, X, _, RequiredState), Engaged), - check_state(Action, Engaged,States), - necessary_engaged_from(Group, List, RequiredState, Engaged), !. - -necessary_engaged_from(Group, [Action|List], State, Engaged):- - not(impossible_by_if(Action, Group, State)), - findall(X, by_causes_if(Action, X, _, State), NextEngaged), - findall(X, (member(X, Engaged), member(X, NextEngaged)), EngagedInBoth), - necessary_engaged_from(Group, List, State, EngagedInBoth), !. - -necessary_engaged_from(_, [], _, []):- fail. -necessary_engaged_from(Group, [], _, [Item|[]]):- subset(Item, Group), !. -necessary_engaged_from(_, [], _, [_|_]):- fail. - -necessary_engaged(Group, Actions):- - necessary_engaged_from(Group, Actions, []), !. - - -possibly_engaged_from(Group, [Action|List], State):- - not(impossible_by_if(Action, Group, State)), - ( - by_causes_if(Action, X, _, State) - ; - by_causes_if(Action, X, _, CheckedState), - always(CheckedState) - ; - by_causes_if(Action, X, _, CheckedState), - initially(Y), - subset(CheckedState,Y) - ; - causes_if(Action, _, CheckedState), - subset(State,CheckedState) - ), - subset(X, Group), - possibly_engaged_from(Group, List, State), !. - -possibly_engaged_from(_, [], _):- !. - -possibly_engaged(Group, [Action|List]):- - possibly_engaged_from(Group, [Action|List], []), !. - - -% Utils -is_always(State):- - findall(X, always(X), AlwaysList), - is_subset_of_any_always(State, AlwaysList). - -is_subset_of_any_always(State, [Always | AlwaysList]):- - subset(State, Always); - is_subset_of_any_always(State, AlwaysList). -is_subset_of_any_always(_, [[] | []]):- fail. - -apply_alwayses(CurrentState, NewState):- - not(always(X)); - ( - not(subset([X],CurrentState)), - append([X], CurrentState, NewStateWithX), - apply_alwayses(NewStateWithX, NewState) - ). - -apply_resulting_state(ResultingState, CurrentState, NewState):- - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewState). - -negate_list([Item|List], NegatedList):- - negate_list(List, NegatedSublist), - append([\Item], NegatedSublist, NegatedList). -negate_list([Item|[]], NegatedList):- - NegatedList = [\Item]. -negate_list([],[]). - -is_empty([]). \ No newline at end of file diff --git a/MultiAgentLanguageModels/MultiAgentLanguageModels.csproj b/MultiAgentLanguageModels/MultiAgentLanguageModels.csproj index 21100a8..c1ab04c 100644 --- a/MultiAgentLanguageModels/MultiAgentLanguageModels.csproj +++ b/MultiAgentLanguageModels/MultiAgentLanguageModels.csproj @@ -79,9 +79,6 @@ - - PreserveNewest - diff --git a/MultiAgentLanguageModels/logic.pl b/MultiAgentLanguageModels/logic.pl deleted file mode 100644 index 43fa89c..0000000 --- a/MultiAgentLanguageModels/logic.pl +++ /dev/null @@ -1,265 +0,0 @@ -:- dynamic impossible_by/2. -:- dynamic impossible_if/2. -:- dynamic by_causes/3. -:- dynamic causes_if/3. -:- dynamic by_releases_if/4. -:- dynamic by_releases/3. -:- dynamic releases_if/3. -:- dynamic always/1. -:- dynamic initially/1. - -% Support for tests: -:- multifile impossible_by/2, by_causes_if/4, by_causes/3, after/2, by_releases_if/4, always/1. -:- style_check(-discontiguous). -passed:- nl, ansi_format([bold,fg(green)], 'Passed', []). -failed:- nl, ansi_format([bold,fg(red)], 'Failed', []). - - -% Make sure, "initially" also propagates to after(Result, []). -after(Result, []):- - initially(Result). - -private_impossible_by_if(Action, Group, State):- - impossible_by(Action, Group); - impossible_if(Action, State); - impossible_by_if(Action, Group, State). - -impossible_by_if(Action, Group, []):- - impossible_by(Action, Group), !. - -impossible_by_if(Action, [], State):- - impossible_if(Action, State), !. - - - -by_causes_if(Action, Group, Result, []):- - by_causes(Action, Group, Result). - -by_causes_if(Action, [], Result, State):- - causes_if(Action, Result, State). - - -by_releases_if(Action, Group, Result, _):- - by_releases(Action, Group, Result). - -by_releases_if(Action, _, Result, State):- - releases_if(Action, Result, State). - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Executability queries - TODO: fix possibly_executable_from query -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -necessary_executable_from([[Action, Group] | Program], CurrentState):- - private_necessary_executable_from([[Action, Group] | Program], CurrentState, _), !. - -% CurrentState means "initialState" in the first call, and then set of all changes states -private_necessary_executable_from([[Action, Group] | Program], CurrentState, FinalState):- - ( - (by_causes_if(Action, G, ResultingState, RequiredState);by_releases_if(Action, G, ResultingState, RequiredState)), - ( - subset(G,Group), - ( - not(is_empty(RequiredState)), - ( - is_always(RequiredState) - ; - subset(RequiredState, CurrentState) - ) - ) - ; - initially(Y), - (is_empty(RequiredState), subset(CurrentState,Y)) - ; - (is_empty(RequiredState),is_empty(CurrentState)) - ) - ), - not(private_impossible_by_if(Action, Group, RequiredState)), - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewCurrentState), - private_necessary_executable_from(Program, NewCurrentState, FinalState), !. - -private_necessary_executable_from([], NewCurrentState, FinalState):- - FinalState = NewCurrentState, !. - -necessary_executable(Program):- - necessary_executable_from(Program, []), !. - - - -% CurrentState means "initialState" in the first call, and then set of all changes states -possibly_executable_from([[Action, Group] | Program], CurrentState):- - (by_releases_if(Action, Group, ResultingState, X) ; by_causes_if(Action, Group, ResultingState, X)), - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - not(private_impossible_by_if(Action, Group, X)), - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewCurrentState), - possibly_executable_from(Program, NewCurrentState), !. - -possibly_executable_from([],_). - -possibly_executable(Program):- - possibly_executable_from(Program, []), !. - - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Value queries - TODO: finish possibly_after_from implementation -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -necessary_after_from(State, [[Action, Group] | Program], CurrentState):- - ( - ( - is_always(State) - ) - ; - ( - private_necessary_executable_from([[Action, Group] | Program], CurrentState, StateAfterProgram), - (after(State, [[Action, Group] | Program]) ; subset(State, StateAfterProgram)) - ) - ), !. - -necessary_after(State, Program):- - necessary_after_from(State, Program, []), !. - -possibly_after_from(State, [[Action, Group] | Program], CurrentState):- - is_always(State) - ; - (apply_alwayses(CurrentState, FullCurrentState) ; true), - ( - ( - %Bierzemy stan do którego musimy przejść i idziemy do następnej instrukcji. Jeżeli to się nie powiedzie to zwracamy false bo musimy przejść do ResultingState(!) - by_causes_if(Action, Group, ResultingState, X), - ((not(is_empty(X)),subset(X, FullCurrentState)) ; (is_empty(X),is_empty(FullCurrentState))), - apply_resulting_state(ResultingState, FullCurrentState, NewCurrentState), - possibly_after_from(State, Program, NewCurrentState), ! - ) - ; - ( - % Nie mamy stanu, do którego musimy przejść, generujemy stany usuwając poszczególne fluenty i sprawdzamy - possibly_after_from_without_causes(State, [[Action, Group] | Program], FullCurrentState) - ) - ). - -possibly_after_from_without_causes(State, [[Action, Group] | Program], CurrentState):- - %Ta reguła generuje nowe stany na podstawie reguł releases i weryfikuje dla nich działanie - %by_releases_if(Action, Group, ReleasedFluent, CurrentState), % sprawdzamy, czy możemy w ogóle wykonać releases - ( - %Sprawdzamy dalszy przebieg dla obecnego stanu - by_releases_if(Action, Group, ReleasedFluent, X), %czy akcja w ogóle możliwa - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - possibly_after_from(State, Program, CurrentState) - ) - ; - ( - %Generujemy nowy stan usuwając jeden z uwolnionych fluentów i sprawdzamy dalszy przebieg rekurencyjnie - by_releases_if(Action, Group, ReleasedFluent, X), - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - subtract(CurrentState, [ReleasedFluent], CurrentStateWithoutPositiveReleased), - subtract(CurrentStateWithoutPositiveReleased, [\ReleasedFluent], CurrentStateWithoutAnyReleased), - ( - ( - append([ReleasedFluent], CurrentStateWithoutAnyReleased, NewCurrentStateWithPositiveReleased), - possibly_after_from_without_causes(State, [[Action, Group] | Program], NewCurrentStateWithPositiveReleased) - ) - ; - ( - append([\ReleasedFluent], CurrentStateWithoutAnyReleased, NewCurrentStateWithNegativeReleased), - possibly_after_from_without_causes(State, [[Action, Group] | Program], NewCurrentStateWithNegativeReleased) - ) - ) - ). - -possibly_after_from_without_causes(State, [], CurrentState):- - possibly_after_from(State, [], CurrentState). - -possibly_after_from(State,[], CurrentState):- - negate_list(State, NegatedRequiredState), - intersection(NegatedRequiredState, CurrentState, Common), - is_empty(Common), !. - -possibly_after(State, Program):- - possibly_after_from(State, Program, []), !. - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Engagement queries -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -check_state(Action,[FirstEngaged | _ ], States):- - by_causes_if(Action, FirstEngaged, _, RequiredState), - (subset(RequiredState, States); write('here'), is_always(RequiredState), write('there')). - -necessary_engaged_from(Group, [Action|List], States):- - not(impossible_by_if(Action, Group, RequiredState)), - findall(X, by_causes_if(Action, X, _, RequiredState), Engaged), - check_state(Action, Engaged,States), - necessary_engaged_from(Group, List, RequiredState, Engaged), !. - -necessary_engaged_from(Group, [Action|List], State, Engaged):- - not(impossible_by_if(Action, Group, State)), - findall(X, by_causes_if(Action, X, _, State), NextEngaged), - findall(X, (member(X, Engaged), member(X, NextEngaged)), EngagedInBoth), - necessary_engaged_from(Group, List, State, EngagedInBoth), !. - -necessary_engaged_from(_, [], _, []):- fail. -necessary_engaged_from(Group, [], _, [Item|[]]):- subset(Item, Group), !. -necessary_engaged_from(_, [], _, [_|_]):- fail. - -necessary_engaged(Group, Actions):- - necessary_engaged_from(Group, Actions, []), !. - - -possibly_engaged_from(Group, [Action|List], State):- - not(impossible_by_if(Action, Group, State)), - ( by_causes_if(Action, X, _, State); - by_causes_if(Action, X, _, CheckedState), - always(CheckedState) - ), - subset(X, Group), - possibly_engaged_from(Group, List, State), !. - -possibly_engaged_from(_, [], _):- !. - -possibly_engaged(Group, [Action|List]):- - possibly_engaged_from(Group, [Action|List], []), !. - - -% Utils -is_always(State):- - findall(X, always(X), AlwaysList), - is_subset_of_any_always(State, AlwaysList). - -is_subset_of_any_always(State, [Always | AlwaysList]):- - subset(State, Always); - is_subset_of_any_always(State, AlwaysList). -is_subset_of_any_always(_, [[] | []]):- fail. - -apply_alwayses(CurrentState, NewState):- - not(always(X)); - ( - not(subset([X],CurrentState)), - append([X], CurrentState, NewStateWithX), - apply_alwayses(NewStateWithX, NewState) - ). - -apply_resulting_state(ResultingState, CurrentState, NewState):- - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewState). - -negate_list([Item|List], NegatedList):- - negate_list(List, NegatedSublist), - append([\Item], NegatedSublist, NegatedList). -negate_list([Item|[]], NegatedList):- - NegatedList = [\Item]. -negate_list([],[]). - -is_empty([]). \ No newline at end of file diff --git a/README.md b/README.md index a454ddc..ead9adc 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,66 @@ # Multiagent-Action-Language -To do: -### C# GUI ### -- [x] BŁĄD w Test3_PARSER_ERROR brak parsowania dla *impossible by* -- [ ] Podmiana *not by if* na odpowiednik *impossible by if* -- [x] Parser na wyrażenie *not by if* -- [ ] Pusta lista agentów -- [ ] Dodać *initially [alpha]* jako *[alpha] after ()* (chodzi o puste wykonanie programu) + -### C# reasoning ### -- [ ] Dodanie obsługi *[alpha] observable after ...* i *[alpha] after ...* -- [ ] Testy generowania grafu -- [x] Dodać kwerendę wykonywalności *executable* -- [x] Dodać kwerendę wartości *after* -- [ ] Dodać kwerendę zaangażowania *engaged* -- [x] Dodać testy języka AR (przykłady z wykładu) -- [x] Dodać kwerendy z pustego programu -- [x] Dodać kwerendy dla pustej listy agentów +## Summary +Framework for multiagent reasoning from actions written entirely in C#. This implementation extents AR action language (actions with ramifications) on multiple agents. Main assumpions of this action language are: +1. Inertia law +2. Sequencing of actions +3. Nondeterminism of actions -### App tests ### -- [ ] 4 historyjki po 3-4 kwerendy dla grupy 1 **na poniedziałek musi być gotowe** -- [ ] kilka historyjek po 3-4 kwerendy do naszych testów +## Implementation features +### Forward chaining +Obviously, this implementation allows for forward chaining. E.g. for domain: +``` +Fluent R1 +Fluent R2 +Fluent R3 +Agent g1 +Agent g2 +Agent g3 +Agent g4 +Action A1 +Action A2 +A1 by [g1, g3, g4] causes [R1] +A1 by [g1, g3] causes [R3] +A2 by [g3, g4] causes [R2] +``` +and query: +``` +possibly [g2] engaged in (A1, [g1, g2, g3, g4]),(A2, [g2, g3, g4]) +``` +App returns *false*, as suspected with respect to definition. -### Requirements for the deadline ### -- Dokumentacja teoretyczna -- Dokumentacja techniczna -- User Guide -- Testy naszego programu zrobione przez inną grupę **patrz wyżej** -- Testy innego programu zrobione przez nas -- Płytka CD +### Backward chaining +This implementation allows not only forward chaining but also backward chaining. E.g. for domain: +``` +Action fire +Action walk +Agent x +Fluent loaded +Fluent alive +Fluent walked +fire causes [~loaded] +fire causes [~alive] if [loaded] +walk causes [walked] +initially [alive] +[~alive] after (walk, [x]), (fire, [x]) +``` +and query: +``` +necessary [loaded] after (walk, [x]) +``` +App returns *true*, as fluent *loaded* in really necessary after *walk* action, for fluent *alive* to be *false*. -### Conclusions after deadline meeting ### -- kwerendy mogą też dostać wyrażenie logiczne jako resultat - co wtedy? -- program niewykonalny -> necessary true -- niedeterminizm - releases itp nie działa \ No newline at end of file +## Authors +* [pkonowrocki](github.com/pkonowrocki) Piotr Konowrocki +* [ArkadyPL](github.com/ArkadyPL) +* [kocu13](github.com/kocu13) +* [zegadlok](github.com/zegadlok) +* [omelanczukm](github.com/omelanczukm) +* [mazurkiewiczj](github.com/mazurkiewiczj) +* [dawidlazuk](github.com/dawidlazuk) +* [bpolak00](github.com/bpolak00) + +## Final remarks +This project was realized as a part of Knowledge Representation course at Faculty of Mathematics and Information Science at WUT, and was rated 20/20 points by dr Anna Maria Radzikowska. \ No newline at end of file diff --git a/STORY_1.mar b/STORY_1.mar deleted file mode 100644 index e706f76..0000000 --- a/STORY_1.mar +++ /dev/null @@ -1,16 +0,0 @@ -Agent a -Agent b -Agent c -Agent d -Action push -Fluent isRunning -initially [~isRunning] -impossible push by [d] -impossible push if [isRunning] -push by [a] causes [~isRunning] -push by [b] causes [~isRunning] -push by [c] causes [~isRunning] -push by [b,c] causes [~isRunning] -push by [a,b] causes [isRunning] -push by [a,c] causes [isRunning] -push by [a,b,c] causes [~isRunning] \ No newline at end of file diff --git a/STORY_1_Queary.txt b/STORY_1_Queary.txt deleted file mode 100644 index 822dbba..0000000 --- a/STORY_1_Queary.txt +++ /dev/null @@ -1,5 +0,0 @@ -necessary executable (push,[a,b]) from [~isRunning] -necessary executable (push,[a,c]) from [~isRunning] -possibly [a] engaged in push -possibly [b] engaged in push -possibly [c] engaged in push \ No newline at end of file diff --git a/STORY_2.mar b/STORY_2.mar deleted file mode 100644 index 1235304..0000000 --- a/STORY_2.mar +++ /dev/null @@ -1,16 +0,0 @@ -Agent a -Agent b -Action lift -Action protect -Fluent alive -Fluent protected -Fluent up -initially [~alive] -initially [~protected] -initially [~up] -lift by [a,b] causes [up] -lift by [a] causes [~alive] if [~protected && up] -lift by [b] causes [~alive] if [~protected && up] -protect causes [protected] if [up] -impossible lift if [protected || ~alive] -impossible protect if [protected || ~alive || ~up] \ No newline at end of file diff --git a/STORY_2_Queary.txt b/STORY_2_Queary.txt deleted file mode 100644 index f6aa019..0000000 --- a/STORY_2_Queary.txt +++ /dev/null @@ -1,8 +0,0 @@ -necessary executable (lift, [a,b]) from [alive] -necessary executable (protect,[a]) from [up && alive] -necessary executable (protect,[b]) from [up && alive] -necessary up after (lift,[a,b]) from [alive] -necessary protected after (protect,[a]) from [up] -necessary protected after (protect,[b]) from [up] -possibly [a] engaged in protect from [up] -possibly [b] engaged in protect from [up] \ No newline at end of file diff --git a/STORY_3.mar b/STORY_3.mar deleted file mode 100644 index 470e272..0000000 --- a/STORY_3.mar +++ /dev/null @@ -1,12 +0,0 @@ -Agent Bercik -Agent Filemon -Action brew -Fluent brewed -Fluent destroyed -initially [~brewed] -initially [~destroyed] -brew by [Bercik, Filemon] causes [brewed] -brew by [Filemon] releases [brewed] -brew by [Bercik] releases [brewed] -brew by [Bercik] releases [destroyed] - diff --git a/STORY_3_Queary.txt b/STORY_3_Queary.txt deleted file mode 100644 index 178c486..0000000 --- a/STORY_3_Queary.txt +++ /dev/null @@ -1,6 +0,0 @@ -possibly [Filemon] engaged in brew -possibly [Bercik] engaged in brew -possibly [brewed] after (brew,[Bercik, Filemon]) from [~brewed && ~destroyed] -possibly [brewed] after (brew,[Bercik]) from [~brewed && ~destroyed] -possibly [destroyed] after (brew,[Bercik]) from [~brewed && ~destroyed] -possibly [brewed] after (brew,[Filemon]) from [~brewed && ~destroyed] diff --git a/example_from_lecture_1.mar b/example_from_lecture_1.mar deleted file mode 100644 index 94f9b66..0000000 --- a/example_from_lecture_1.mar +++ /dev/null @@ -1,11 +0,0 @@ -Agent Bill -Action shoot -Action load -Fluent loaded -Fluent alive -initially [~loaded] -initially [alive] -load causes [loaded] -shoot causes [~loaded] -shoot causes [~alive] if [loaded] - diff --git a/logic.pl b/logic.pl deleted file mode 100644 index 214f047..0000000 --- a/logic.pl +++ /dev/null @@ -1,335 +0,0 @@ -:- dynamic impossible_by/2. -:- dynamic impossible_if/2. -:- dynamic by_causes/3. -:- dynamic causes_if/3. -:- dynamic by_releases_if/4. -:- dynamic by_releases/3. -:- dynamic releases_if/3. -:- dynamic always/1. -:- dynamic initially/1. - -% Support for tests: -:- multifile impossible_by/2, by_causes_if/4, by_causes/3, after/2, by_releases_if/4, always/1. -:- style_check(-discontiguous). -passed:- nl, ansi_format([bold,fg(green)], 'Passed', []). -failed:- nl, ansi_format([bold,fg(red)], 'Failed', []). - - -% Make sure, "initially" also propagates to after(Result, []). -after(Result, []):- - initially(Result). - -private_impossible_by_if(Action, Group, State):- - impossible_by(Action, Group); - impossible_if(Action, State); - impossible_by_if(Action, Group, State). - -impossible_by_if(Action, Group, []):- - impossible_by(Action, Group), !. - -impossible_by_if(Action, [], State):- - impossible_if(Action, State), !. - - - -by_causes_if(Action, Group, Result, []):- - by_causes(Action, Group, Result). - -by_causes_if(Action, [], Result, State):- - causes_if(Action, Result, State). - - -by_releases_if(Action, Group, Result, _):- - by_releases(Action, Group, Result). - -by_releases_if(Action, _, Result, State):- - releases_if(Action, Result, State). - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Executability queries - TODO: fix possibly_executable_from query -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -necessary_executable_from([[Action, Group] | Program], CurrentState):- - private_necessary_executable_from([[Action, Group] | Program], CurrentState, _), !. - -% CurrentState means "initialState" in the first call, and then set of all changes states -private_necessary_executable_from([[Action, Group] | Program], CurrentState, FinalState):- - ( - (by_causes_if(Action, G, ResultingState, RequiredState);by_releases_if(Action, G, ResultingState, RequiredState)), - ( - subset(G,Group), - ( - not(is_empty(RequiredState)), - ( - is_always(RequiredState) - ; - subset(RequiredState, CurrentState) - ) - ) - ; - initially(Y), - (is_empty(RequiredState), subset(CurrentState,Y)) - ; - (is_empty(RequiredState),is_empty(CurrentState)) - ) - ), - not(private_impossible_by_if(Action, Group, RequiredState)), - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewCurrentState), - private_necessary_executable_from(Program, NewCurrentState, FinalState), !. - -private_necessary_executable_from([], NewCurrentState, FinalState):- - FinalState = NewCurrentState, !. - -necessary_executable(Program):- - necessary_executable_from(Program, []), !. - - - -% CurrentState means "initialState" in the first call, and then set of all changes states -possibly_executable_from([[Action, Group] | Program], CurrentState):- - (by_releases_if(Action, Group, ResultingState, X) ; by_causes_if(Action, Group, ResultingState, X)), - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - not(private_impossible_by_if(Action, Group, X)), - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewCurrentState), - possibly_executable_from(Program, NewCurrentState), !. - -possibly_executable_from([],_). - -possibly_executable(Program):- - possibly_executable_from(Program, []), !. - - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Value queries - TODO: finish possibly_after_from implementation -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -necessary_after_from(State, Program, CurrentState):- - ( - (after(State,ResultingProgram), - subset(ResultingProgram,Program), - are_necessary_connected(Program,CurrentState)) - ; - (private_necessary_after_from(State,Program,CurrentState)) - ). - - -are_necessary_connected([[Action, Group] | Program], CurrentState):- - ( - ( - by_causes_if(Action,G,ResultingState, S), - subset(S,CurrentState), - subset(G,Group) - ) - ; - ( - by_causes(Action,G,ResultingState), - subset(G,Group) - ) - ), - are_necessary_connected(Program, ResultingState). - -are_necessary_connected([],_):- - true. - -private_necessary_after_from( State, [[Action, Group] | Program], CurrentState):- - ( - (is_always(State)) - ; - ( - ( - by_causes_if(Action,G,ResultingState, S), - (subset(S,CurrentState);initially(S);always(S)), - subset(G,Group), - ( - ( - subset(ResultingState,State), - subtract(State,ResultingState,SetWithoutState), - private_necessary_after_from(SetWithoutState, Program, ResultingState) - ) - ; - ( - private_necessary_after_from(State, Program, ResultingState) - ) - ) - ) - - ; - - ( - by_causes(Action,G,ResultingState), - subset(G,Group), - ( - (subset(ResultingState,State), - subtract(State,ResultingState,SetWithoutState), - private_necessary_after_from(SetWithoutState, Program, ResultingState)) - ; - (private_necessary_after_from(State, Program, ResultingState)) - ) - ) - - ) - ), !. - - -private_necessary_after_from([], [],_):- - true, !. - -private_necessary_after_from(State, [] ,_):- - initially(State). - -necessary_after(State, Program):- - necessary_after_from(State, Program, []), !. - -possibly_after_from(State, [[Action, Group] | Program], CurrentState):- - is_always(State) - ; - (apply_alwayses(CurrentState, FullCurrentState) ; true), - ( - ( - %Bierzemy stan do którego musimy przejść i idziemy do następnej instrukcji. Jeżeli to się nie powiedzie to zwracamy false bo musimy przejść do ResultingState(!) - by_causes_if(Action, Group, ResultingState, X), - ((not(is_empty(X)),subset(X, FullCurrentState)) ; (is_empty(X),is_empty(FullCurrentState))), - apply_resulting_state(ResultingState, FullCurrentState, NewCurrentState), - possibly_after_from(State, Program, NewCurrentState), ! - ) - ; - ( - % Nie mamy stanu, do którego musimy przejść, generujemy stany usuwając poszczególne fluenty i sprawdzamy - possibly_after_from_without_causes(State, [[Action, Group] | Program], FullCurrentState) - ) - ). - -possibly_after_from_without_causes(State, [[Action, Group] | Program], CurrentState):- - %Ta reguła generuje nowe stany na podstawie reguł releases i weryfikuje dla nich działanie - %by_releases_if(Action, Group, ReleasedFluent, CurrentState), % sprawdzamy, czy możemy w ogóle wykonać releases - ( - %Sprawdzamy dalszy przebieg dla obecnego stanu - by_releases_if(Action, Group, ReleasedFluent, X), %czy akcja w ogóle możliwa - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - possibly_after_from(State, Program, CurrentState) - ) - ; - ( - %Generujemy nowy stan usuwając jeden z uwolnionych fluentów i sprawdzamy dalszy przebieg rekurencyjnie - by_releases_if(Action, Group, ReleasedFluent, X), - ((not(is_empty(X)),subset(X, CurrentState)) ; (is_empty(X),is_empty(CurrentState))), - subtract(CurrentState, [ReleasedFluent], CurrentStateWithoutPositiveReleased), - subtract(CurrentStateWithoutPositiveReleased, [\ReleasedFluent], CurrentStateWithoutAnyReleased), - ( - ( - append([ReleasedFluent], CurrentStateWithoutAnyReleased, NewCurrentStateWithPositiveReleased), - possibly_after_from_without_causes(State, [[Action, Group] | Program], NewCurrentStateWithPositiveReleased) - ) - ; - ( - append([\ReleasedFluent], CurrentStateWithoutAnyReleased, NewCurrentStateWithNegativeReleased), - possibly_after_from_without_causes(State, [[Action, Group] | Program], NewCurrentStateWithNegativeReleased) - ) - ) - ). - -possibly_after_from_without_causes(State, [], CurrentState):- - possibly_after_from(State, [], CurrentState). - -possibly_after_from(State,[], CurrentState):- - negate_list(State, NegatedRequiredState), - intersection(NegatedRequiredState, CurrentState, Common), - is_empty(Common), !. - -possibly_after(State, Program):- - possibly_after_from(State, Program, []), !. - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Engagement queries -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -check_state(Action,[FirstEngaged | _ ], States):- - by_causes_if(Action, FirstEngaged, _, RequiredState), - (subset(RequiredState, States); is_always(RequiredState)). - -necessary_engaged_from(Group, [Action|List], States):- - not(impossible_by_if(Action, Group, RequiredState)), - findall(X, by_causes_if(Action, X, _, RequiredState), Engaged), - check_state(Action, Engaged,States), - necessary_engaged_from(Group, List, RequiredState, Engaged), !. - -necessary_engaged_from(Group, [Action|List], State, Engaged):- - not(impossible_by_if(Action, Group, State)), - findall(X, by_causes_if(Action, X, _, State), NextEngaged), - findall(X, (member(X, Engaged), member(X, NextEngaged)), EngagedInBoth), - necessary_engaged_from(Group, List, State, EngagedInBoth), !. - -necessary_engaged_from(_, [], _, []):- fail. -necessary_engaged_from(Group, [], _, [Item|[]]):- subset(Item, Group), !. -necessary_engaged_from(_, [], _, [_|_]):- fail. - -necessary_engaged(Group, Actions):- - necessary_engaged_from(Group, Actions, []), !. - - -possibly_engaged_from(Group, [Action|List], State):- - not(impossible_by_if(Action, Group, State)), - ( - by_causes_if(Action, X, _, State) - ; - by_causes_if(Action, X, _, CheckedState), - always(CheckedState) - ; - by_causes_if(Action, X, _, CheckedState), - initially(Y), - subset(CheckedState,Y) - ; - causes_if(Action, _, CheckedState), - subset(State,CheckedState) - ), - subset(X, Group), - possibly_engaged_from(Group, List, State), !. - -possibly_engaged_from(_, [], _):- !. - -possibly_engaged(Group, [Action|List]):- - possibly_engaged_from(Group, [Action|List], []), !. - - -% Utils -is_always(State):- - findall(X, always(X), AlwaysList), - is_subset_of_any_always(State, AlwaysList). - -is_subset_of_any_always(State, [Always | AlwaysList]):- - subset(State, Always); - is_subset_of_any_always(State, AlwaysList). -is_subset_of_any_always(_, [[] | []]):- fail. - -apply_alwayses(CurrentState, NewState):- - not(always(X)); - ( - not(subset([X],CurrentState)), - append([X], CurrentState, NewStateWithX), - apply_alwayses(NewStateWithX, NewState) - ). - -apply_resulting_state(ResultingState, CurrentState, NewState):- - subtract(CurrentState, ResultingState, ListWithoutResultingState), - negate_list(ResultingState, NotResultingState), - subtract(ListWithoutResultingState, NotResultingState, ListWithoutNotResultingState), - append(ListWithoutNotResultingState, ResultingState, NewState). - -negate_list([Item|List], NegatedList):- - negate_list(List, NegatedSublist), - append([\Item], NegatedSublist, NegatedList). -negate_list([Item|[]], NegatedList):- - NegatedList = [\Item]. -negate_list([],[]). - -is_empty([]). \ No newline at end of file diff --git a/models/example.pl b/models/example.pl deleted file mode 100644 index d299e41..0000000 --- a/models/example.pl +++ /dev/null @@ -1,23 +0,0 @@ -after(result, [[action1, [g1, g2]], [action2, [g3, g4]]]). -after(result, [[action1, [g1, g3]], [action2, [g2]]]). -after(beta, [[action1, [g1]]]):- !. - - -observable_after(result, [[action1, [g1]], [action2, [g2]]]). - - -initially(beta). - - -by_causes_if(action1, [g1], result, pi). - -by_causes(action1, [g1], result). - -causes_if(action1, result, pi). - - -impossible_by_if(action1, [g1], pi). - -impossible_by(action1, [g1]). - -impossible_if(action1, pi). diff --git a/models/story1.pl b/models/story1.pl deleted file mode 100644 index 943b4b1..0000000 --- a/models/story1.pl +++ /dev/null @@ -1,12 +0,0 @@ -initially(not(isRunning)). - -impossible_if(push, isRunning). -impossible_by(push, [d]). - -by_causes(push, [a], not(isRunning)). -by_causes(push, [b], not(isRunning)). -by_causes(push, [c], not(isRunning)). -by_causes(push, [b,c], not(isRunning)). -by_causes(push, [a,b], isRunning). -by_causes(push, [a,c], isRunning). -by_causes(push, [a,b,c], not(isRunning)). diff --git a/models/story2.pl b/models/story2.pl deleted file mode 100644 index f963dec..0000000 --- a/models/story2.pl +++ /dev/null @@ -1,12 +0,0 @@ -initially(alive). -initially(not(protected)). -initially(not(up)). - -by_causes(lift,[a,b],up). -by_causes_if(lift,[a],not(alive),(not(protected),up)). -by_causes_if(lift,[b],not(alive),(not(protected),up)). -causes_if(protect,protected,up). - -impossible_if(lift,(protected;not(alive))). -impossible_if(protected,(protected;not(alive);not(up))). - diff --git a/run.pl b/run.pl deleted file mode 100644 index e9fb5bd..0000000 --- a/run.pl +++ /dev/null @@ -1 +0,0 @@ -:- consult('logic.pl'), consult('tests/necessary_engaged/model.pl'). \ No newline at end of file diff --git a/screenshot.PNG b/screenshot.PNG new file mode 100644 index 0000000000000000000000000000000000000000..86fb4b991bd67c1183b4aaa3a3cbc39912d60e2f GIT binary patch literal 20076 zcmcG$cR*9yx-S|P1(p;+1*Hp7EI=$Yse%Ym1Vli35D}#J-r}Mfx*|lW3s8EOUJ|86 z>AeMrgc5p;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$dD)UF+dfsOb8ki!yb~ibQNo$tq1b+_3;EB{d7wq=k zxC(N_f|H!wQP8jI`u`-ZcW8Trus|2TG8bUQzT>gLKfIXjqWzD}1vNgz?*hg9_kX$y zs%K+LqU9&vsGT6Ob9HItSKh^!q>pdCde1>`r(sm|+quhbNw=w9y<_w0Sz)2YjBED_ zPJO#EFAG>JwceIvXlTu4=ZxRR#?avH0BnRXYyvJt{jmwSbR&kz4ODevEGL1~MrMZ< zCf+l6z384s_LsEeyS|5k?yEUl?gBg&fJZQO#f}A@Ko%$OL%kzs?aIyroA{Qqb0=6> zT4^~|-~G2;Xx2LeuRy!&bzSv0UhjGA|BL_hb=lUJXKUEokGp<y*$-TY$9F3=SEy={!o~}Ir&`{2{J)czzWZNE)Y7}tmg&9f-~%2NVR~6X zu-7F-S@^5G_S46%3LL$)w_L&xE);Zfl{Go^+Rg4Q|7kAn_vW7;7Rp$8`P74toANJ0&7NxcSR`3E3RWLfOAQ(R{ zB>YN%KCjS9gRTqv%>G!KT)F!CwA-H-D!;bu+kVDyGpEq%GGIJjGdQeZc!}qD@4rb3 zg6!=Il`*DojvpO6jv7rHKmF8K(NZdhHaS0dng89&j7uofp{x1YEBzev z#bVmu#DOPBFG3+Z-{`NleQ!jI4Vz(q=bK0X7M2L+jPv^@6wSC-e7t9`Q( zxO#}8K+@*hkH<&X^8fYyoB^C-0F6qoG7uC4rn8uuh2Q_L?zfAu`ElVe+oS*arzzZsULD%;3}_yMr>mdKI;Vst0EKc~ Awg3PC literal 0 HcmV?d00001 diff --git a/tests.pl b/tests.pl deleted file mode 100644 index d0afbf1..0000000 --- a/tests.pl +++ /dev/null @@ -1,8 +0,0 @@ -:- write('ALL TESTS STARTED'),nl, - consult('tests/necessary_executable/test.pl'), - consult('tests/possibly_executable/test.pl'), - consult('tests/necessary_engaged/test.pl'), - consult('tests/possibly_engaged/test.pl'), - consult('tests/necessary_after_from/test.pl'), - consult('tests/possibly_after_from/test.pl'), - write('ALL TESTS FINISHED'). diff --git a/tests/examples_from_Lectures/model.pl b/tests/examples_from_Lectures/model.pl deleted file mode 100644 index be4a329..0000000 --- a/tests/examples_from_Lectures/model.pl +++ /dev/null @@ -1,21 +0,0 @@ -initially([heads]). -by_releases(toss,[],[heads]). - -initially([alive, \loaded]). -by_causes(load,[],[loaded]). -causes_if(shoot,[\alive],[loaded]). - -initially([is_student]). -causes_if(studing,[has_diploma],[is_student]). -causes_if(finding_job,[rich],[has_diploma]). -causes_if(living,[happy],[rich]). - -always([thinking]). -initially([not_human]). -causes_if(beeing,[beeing_human],[thinking]). - -initially([\open]). -by_causes(insert,[],[open]). -impossible_if(insert,[\hasCard]). - - diff --git a/tests/examples_from_Lectures/test.pl b/tests/examples_from_Lectures/test.pl deleted file mode 100644 index a85ed9a..0000000 --- a/tests/examples_from_Lectures/test.pl +++ /dev/null @@ -1,48 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - -write('----------- COIN TOSS TESTS ---\n'), - - -write('Test case 0\n'), -(write('possibly_after_from([heads],[[toss,[]]],[])'), -possibly_after_from([heads],[[toss,[]]],[]), passed; failed), nl, - -write('Test case 1\n'), -(write('possibly_after_from([not heads],[[toss,[]]],[])'), -possibly_after_from([\heads],[[toss,[]]],[]), passed; failed), nl, - -write('Test case 2\n'), -(write('not(necessary_after_from([not heads],[[toss,[]]],[]))'), -not(necessary_after_from([\heads],[[toss,[]]],[])), passed; failed), nl, - -write('Test case 3\n'), -(write('not(necessary_after_from([heads],[[toss,[]]],[]))'), -not(necessary_after_from([heads],[[toss,[]]],[])), passed; failed), nl, - - -write('Test case 41\n'), -(write('necessary_after_from([~alive],[[load,[]],[shoot,[]]],[~loaded])'), -necessary_after_from([\alive],[[load,[]],[shoot,[]]],[\loaded]), passed; failed), nl, - - -write('Test case 4b\n'), -(write('possibly_after_from([~alive],[[load,[]],[shoot,[]]],[~loaded])'), -possibly_after_from([\alive],[[load,[]],[shoot,[]]],[\loaded]), passed; failed), nl, - -write('Test case 5a\n'), -(write('necessary_after_from([happy],[[studing,[]],[finding_job,[]],[living,[]]],[])'), -necessary_after_from([happy],[[studing,[]],[finding_job,[]],[living,[]]],[]), passed; failed), nl, - -write('Test case 5b\n'), -(write('possibly_after_from([happy],[[studing,[]],[finding_job,[]],[living,[]]],[])'), -possibly_after_from([happy],[[studing,[]],[finding_job,[]],[living,[]]],[]), passed; failed), nl, - -write('Test case 6a\n'), -(write('necessary_after_from([beeing_human],[[beeing,[]]],[])'), -necessary_after_from([beeing_human],[[beeing,[]]],[]), passed; failed), nl, - -write('Test case 6b\n'), -(write('possibly_after_from([beeing_human],[[beeing,[]]],[])'), -possibly_after_from([beeing_human],[[beeing,[]]],[]), passed; failed), nl, - -write('TESTS FINISHED'),nl. diff --git a/tests/examples_from_Radzikowska/model.pl b/tests/examples_from_Radzikowska/model.pl deleted file mode 100644 index 4cee22a..0000000 --- a/tests/examples_from_Radzikowska/model.pl +++ /dev/null @@ -1,17 +0,0 @@ -by_causes(action1,[],[f1]). -by_causes(action2,[],[f2]). -initially([\f1,\f2]). - -by_causes(a,[x],[f]). -by_causes(b,[y],[g]). -initially([\f,\g]). - -by_causes(load,[],[loaded]). -by_causes(fire,[],[\loaded]). -by_causes_if(fire,[],[\alive],[loaded]). -initially([alive]). -after([\alive],[[fire,[Bill]]]). - -by_causes(fire1,[],[\loaded1]). -causes_if(fire1,[\alive1],[loaded1]). -initially([alive1]). \ No newline at end of file diff --git a/tests/examples_from_Radzikowska/test.pl b/tests/examples_from_Radzikowska/test.pl deleted file mode 100644 index f5d0606..0000000 --- a/tests/examples_from_Radzikowska/test.pl +++ /dev/null @@ -1,26 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - -write('TESTS STARTED'),nl, - -write('Test case 1\n'), -(write('necessary_after_from([f1,f2],[[action1,[actor1]],[action2,[actor2]]],[])'), -necessary_after_from([f1,f2],[[action1,[actor1]],[action2,[actor2]]],[]), passed; failed), nl, - -write('Test case 2\n'), -(write('necessary_after_from([f,g],[[a,[x]],[b,[y]]],[])'), -necessary_after_from([f,g],[[a,[x]],[b,[y]]],[]), passed; failed), nl, - -write('Test case 3\n'), -(write('necessary_after_from([loaded],[[load,[Bill]]],[])'), -necessary_after_from([loaded],[[load,[Bill]]],[]), passed; failed), nl, - -write('Test case 4\n'), -(write('necessary_after_from([\alive],[[fire,[Bill]]],[])'), -necessary_after_from([\alive],[[fire,[Bill]]],[]), passed; failed), nl, - -write('Test case 5\n'), -(write('necessary_after_from([alive1],[],[])'), -necessary_after_from([alive1],[],[]), passed; failed), nl, - - -write('TESTS FINISHED'),nl. diff --git a/tests/examples_mean/model.pl b/tests/examples_mean/model.pl deleted file mode 100644 index 571377f..0000000 --- a/tests/examples_mean/model.pl +++ /dev/null @@ -1,18 +0,0 @@ -after([a],[[work,[John,Tom]]]). -by_causes(work,[],[b]). - - -after([d,e],[[eat,[Magda,Anna]]]). -after([e],[[talk,[Irena,Alice]]]). -by_causes(eat,[],[z]). -by_causes(talk,[],[z]). - -always([f]). -after([\f],[[do,[Milena]]]). - - -after([\g],[[make,[Iwona]]]). -by_causes(make, [Iwona], [g]). - -always([h]). -by_causes_if(swim, [Ula],[i],[h]). \ No newline at end of file diff --git a/tests/examples_mean/test.pl b/tests/examples_mean/test.pl deleted file mode 100644 index c1c80e8..0000000 --- a/tests/examples_mean/test.pl +++ /dev/null @@ -1,33 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - - -write('----------MEAN TESTS ---\n'), -write('Test case 0\n'), -(write('necessary_after([a],[[work,[John,Tom]]])'), -necessary_after([a],[[work,[John,Tom]]]), passed; failed), nl, -(write('possibly_after([a],[[work,[John,Tom]]])'), -possibly_after([a],[[work,[John,Tom]]]), passed; failed), nl, - -write('Test case 0\n'), -(write('necessary_after([d,e],[[eat,[Magda,Anna]],[talk,[Irena,Alice]]])'), -necessary_after([d,e],[[eat,[Magda,Anna]],[talk,[Irena,Alice]]]), passed; failed), nl, -(write('possibly_after([d,e],[[eat,[Magda,Anna]],[talk,[Irena,Alice]]])'), -possibly_after([d,e],[[eat,[Magda,Anna]],[talk,[Irena,Alice]]]), passed; failed), nl, - -write('Test case 0\n'), -(write('necessary_after([f],[[do,[Milena]]])'), -necessary_after([f],[[do,[Milena]]]), passed; failed), nl, -(write('possibly_after([f],[[do,[Milena]]])'), -possibly_after([f],[[do,[Milena]]]), passed; failed), nl, - - -write('Test case 0\n'), -(write('necessary_after([~g],[[make,[Iwona]]])'), -necessary_after([\g],[[make,[Iwona]]]), passed; failed), nl, - -write('Test case 0\n'), -(write('necessary_after([i],[[swim,[Ula]]])'), -necessary_after([i],[[swim,[Ula]]]), passed; failed), nl, - -write('TESTS FINISHED'),nl. - diff --git a/tests/necessary_after_from/model.pl b/tests/necessary_after_from/model.pl deleted file mode 100644 index 847a198..0000000 --- a/tests/necessary_after_from/model.pl +++ /dev/null @@ -1,61 +0,0 @@ - -% Test case 1 a. - should be false because 1st action is not executable from initial state -by_causes_if(na_1a_action1, [na_1a_g1, na_1a_g2], [na_1a_result], [na_1a_pi]). -by_causes(na_1a_action2, [na_1a_g1, na_1a_g2], [na_1a_another]). -after([na_1a_expected], [[na_1a_action1,[na_1a_g1, na_1a_g2]], [na_1a_action2, [na_1a_g1, na_1a_g2]]]). - - - -% Test case 2 a. - should be false because 2nd action is not executable after 1st one -by_causes_if(na_2a_action1, [na_2a_g1, na_2a_g2], [na_2a_result], []). -by_causes_if(na_2a_action2, [na_2a_g1, na_2a_g2], [na_2a_another], [na_2a_pi]). -after([na_2a_expected], [[na_2a_action1,[na_2a_g1, na_2a_g2]], [na_2a_action2, [na_2a_g1, na_2a_g2]]]). - -% Test case 3 a. - should be true because program is executable from initial state, and it is true that "na_3a_expected" after this program -by_causes(na_3a_action1, [na_3a_g1, na_3a_g2], [na_3a_result]). -by_causes_if(na_3a_action2, [na_3a_g1, na_3a_g2], [na_3a_another], [na_3a_result]). -after([na_3a_expected], [[na_3a_action1,[na_3a_g1, na_3a_g2]], [na_3a_action2, [na_3a_g1, na_3a_g2]]]). - - -% Test case 4 a. - should be true because program is executable from initial state, and it is true that "na_4a_expected" after this program -by_causes(na_4a_action1, [na_4a_g1, na_4a_g2], [na_4a_result]). -by_causes_if(na_4a_action2, [na_4a_g1, na_4a_g2], [na_4a_expected], [na_4a_result]). - - -% Test case 5 a. - should be false because 2nd action is not executable after 1st one -by_causes_if(na_5a_action1, [na_5a_g1, na_5a_g2], [na_5a_result], [na_5a_pi]). -by_causes_if(na_5a_action2, [na_5a_g1, na_5a_g2], [na_5a_another],[na_5a_some]). % this is not executable in 'na_5a_result', it is in initial state but it doesn't matter -after([na_5a_expected], [[na_5a_action1,[na_5a_g1, na_5a_g2]], [na_5a_action2, [na_5a_g1, na_5a_g2]]]). - -% Test case 6 a. - should be true because both actions are executable from requested state, and it is true that "na_6a_expected" after this program -by_causes_if(na_6a_action1, [na_6a_g1, na_6a_g2], [na_6a_result], [na_6a_pi]). -by_causes_if(na_6a_action2, [na_6a_g1, na_6a_g2], [na_6a_another], [na_6a_result]). -after([na_6a_expected], [[na_6a_action1,[na_6a_g1, na_6a_g2]], [na_6a_action2, [na_6a_g1, na_6a_g2]]]). - -% Test case 7 a. - should be true because both actions are executable from requested state, and it is true that "na_7a_expected" after this program -by_causes_if(na_7a_action1, [na_7a_g1, na_7a_g2], [na_7a_result], [na_7a_pi]). -by_causes_if(na_7a_action2, [na_7a_g1, na_7a_g2], [na_7a_expected], [na_7a_result]). - -% Test case 8 a. - should be false - trivial, actions undefined -after([na_8a_expected], [[na_8a_action1,[na_8a_g1, na_8a_g2]], [na_8a_action2, [na_8a_g1, na_8a_g2]]]). - -% Test case 9 a. - should be true because expected term is always true -by_causes_if(na_9a_action1, [na_9a_g1, na_9a_g2], [na_9a_result], [na_9a_pi]). -by_causes_if(na_9a_action2, [na_9a_g1, na_9a_g2], [na_9a_another], [na_9a_result]). -always([na_9a_just_make_some_noise]). -always([na_9a_expected, na_9a_not_important]). -always([na_9a_just_make_some_noise2]). - -% Test case 10 a. - should be false because expected term is never true -by_causes_if(na_10a_action1, [na_10a_g1, na_10a_g2], [na_10a_result], [na_10a_pi]). -by_causes_if(na_10a_action2, [na_10a_g1, na_10a_g2], [na_10a_another], [na_10a_result]). -always([na_10a_just_make_some_noise]). -always([na_10a_not_important, na_10a_other_not_important]). -always([na_10a_just_make_some_noise2]). - -% Test case 11 a. - should be true -by_causes(washing,[], [washed]). -by_causes(cooking, [], [cooked]). -by_causes(tyding, [], [tied]). -after([clean],[[cooking,[]],[tyding,[]]]). - diff --git a/tests/necessary_after_from/test.pl b/tests/necessary_after_from/test.pl deleted file mode 100644 index 3c08db8..0000000 --- a/tests/necessary_after_from/test.pl +++ /dev/null @@ -1,52 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - -write('Necessary After From - TESTS STARTED'),nl, - - -write('Test case 1 a. - should be false because 1nd action is not executable from initial state\n'), -(write('not(necessary_after([na_1a_expected], [[na_1a_action1,[na_1a_g1, na_1a_g2]], [na_1a_action2, [na_1a_g1, na_1a_g2]]])).'), -not(necessary_after([na_1a_expected], [[na_1a_action1,[na_1a_g1, na_1a_g2]], [na_1a_action2, [na_1a_g1, na_1a_g2]]])), passed; failed), nl, - -write('Test case 2 a. - should be false because 2nd action is not executable after 1st one\n'), -(write('not(necessary_after([na_2a_expected], [[na_2a_action1,[na_2a_g1, na_2a_g2]], [na_2a_action2, [na_2a_g1, na_2a_g2]]])).'), -not(necessary_after([na_2a_expected], [[na_2a_action1,[na_2a_g1, na_2a_g2]], [na_2a_action2, [na_2a_g1, na_2a_g2]]])), passed; failed), nl, - -write('Test case 3 a. - should be true because program is executable from initial state, and it is true that "na_3a_expected" after this program\n'), -(write('necessary_after_from([na_3a_expected], [[na_3a_action1,[na_3a_g1, na_3a_g2]], [na_3a_action2, [na_3a_g1, na_3a_g2]]], []).'), -necessary_after_from([na_3a_expected], [[na_3a_action1,[na_3a_g1, na_3a_g2]], [na_3a_action2, [na_3a_g1, na_3a_g2]]], []), passed; failed), nl, - -write('Test case 4 a. - should be true because program is executable from initial state, and it is true that "na_4a_expected" after this program\n'), -(write('necessary_after_from([na_4a_expected], [[na_4a_action1,[na_4a_g1, na_4a_g2]], [na_4a_action2, [na_4a_g1, na_4a_g2]]], []).'), -necessary_after_from([na_4a_expected], [[na_4a_action1,[na_4a_g1, na_4a_g2]], [na_4a_action2, [na_4a_g1, na_4a_g2]]], []), passed; failed), nl, -%necessary_after_from([expected], [[action1,[g1, g2]], [action2, [g1, g2]]], []), passed; failed), nl, - -write('Test case 5 a. - should be false because 2nd action is not executable from requested state\n'), -(write('not(necessary_after_from([na_5a_expected], [[na_5a_action1,[na_5a_g1, na_5a_g2]], [na_5a_action2, [na_5a_g1, na_5a_g2]]], [na_5a_pi])).'), -not(necessary_after_from([na_5a_expected], [[na_5a_action1,[na_5a_g1, na_5a_g2]], [na_5a_action2, [na_5a_g1, na_5a_g2]]], [na_5a_pi])), passed; failed), nl, - -write('Test case 6 a. - should be true because both actions are executable from requested state, and it is true that "na_6a_expected" after this program\n'), -(write('necessary_after_from([na_6a_expected], [[na_6a_action1,[na_6a_g1, na_6a_g2]], [na_6a_action2, [na_6a_g1, na_6a_g2]]], [na_6a_pi]).'), -necessary_after_from([na_6a_expected], [[na_6a_action1,[na_6a_g1, na_6a_g2]], [na_6a_action2, [na_6a_g1, na_6a_g2]]], [na_6a_pi]), passed; failed), nl, - -write('Test case 7 a. - should be true because both actions are executable from requested state, and it is true that "na_7a_expected" after this program\n'), -(write('necessary_after_from([na_7a_expected], [[na_7a_action1,[na_7a_g1, na_7a_g2]], [na_7a_action2, [na_7a_g1, na_7a_g2]]], [na_7a_pi]).'), -necessary_after_from([na_7a_expected], [[na_7a_action1,[na_7a_g1, na_7a_g2]], [na_7a_action2, [na_7a_g1, na_7a_g2]]], [na_7a_pi]), passed; failed), nl, - -write('Test case 8 a. - should be false - trivial, actions undefined\n'), -(write('not(necessary_after([na_8a_expected], [[na_8a_action1,[na_8a_g1, na_8a_g2]], [na_8a_action2, [na_8a_g1, na_8a_g2]]])).'), -not(necessary_after([na_8a_expected], [[na_8a_action1,[na_8a_g1, na_8a_g2]], [na_8a_action2, [na_8a_g1, na_8a_g2]]])), passed; failed), nl, - -write('Test case 9 a. - should be true because expected term is always true\n'), -(write('necessary_after_from([na_9a_expected], [[na_9a_action1,[na_9a_g1, na_9a_g2]], [na_9a_action2, [na_9a_g1, na_9a_g2]]], [na_9a_pi]).'), -necessary_after_from([na_9a_expected], [[na_9a_action1,[na_9a_g1, na_9a_g2]], [na_9a_action2, [na_9a_g1, na_9a_g2]]], [na_9a_pi]), passed; failed), nl, - -write('Test case 10 a. - should be false because expected term is never true\n'), -(write('not(necessary_after_from([na_10a_expected], [[na_10a_action1,[na_10a_g1, na_10a_g2]], [na_10a_action2, [na_10a_g1, na_10a_g2]]], [na_10a_pi])).'), -not(necessary_after_from([na_10a_expected], [[na_10a_action1,[na_10a_g1, na_10a_g2]], [na_10a_action2, [na_10a_g1, na_10a_g2]]], [na_10a_pi])), passed; failed), nl, - -write('Test case 11 a. - should be false because expected term is never true\n'), -(write('not(necessary_after_from([na_10a_expected], [[na_10a_action1,[na_10a_g1, na_10a_g2]], [na_10a_action2, [na_10a_g1, na_10a_g2]]], [na_10a_pi])).'), -necessary_after_from([clean], [[washing,[]],[cooking,[]],[tyding,[]]], []), passed; failed), nl, - - -write('Necessary After From - TESTS FINISHED'),nl. diff --git a/tests/necessary_engaged/model.pl b/tests/necessary_engaged/model.pl deleted file mode 100644 index be1dee3..0000000 --- a/tests/necessary_engaged/model.pl +++ /dev/null @@ -1,26 +0,0 @@ -% Test case 1 -by_causes(push, [a], []). -by_causes(push, [b], []). - -by_causes(run, [a], []). -by_causes(run, [b], []). - -% Test case 2 -by_causes(sing, [c], []). -by_causes(sing, [d], []). -by_causes(fly, [c], []). - -% Test case 3 -by_causes(swim, [x, y], []). - -% Test case 4 -by_causes_if(eat, [john],[], [is_hungry]). - -% Test case 5 -by_causes_if(talks, [anna], [],[is_ready]). - -% Test case 6 -by_causes_if(new_6_goes_to_sleep, [nex_6_george], [], [nex_6_is_tired]). -always([nex_6_some_noise1, nex_6_some_noise2]). -always([nex_6_is_tired, nex_6_some_noise]). -always([nex_6_some_noise3]). diff --git a/tests/necessary_engaged/test.pl b/tests/necessary_engaged/test.pl deleted file mode 100644 index 164e887..0000000 --- a/tests/necessary_engaged/test.pl +++ /dev/null @@ -1,60 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - -write('Necessary Engaged - TESTS STARTED'),nl, - -write('Test case 1\n'), -(write('not(necessary_engaged([a], [push])) => '), -not(necessary_engaged([a], [push])), passed; failed), nl, - -(write('not(necessary_engaged([b], [push])) => '), -not(necessary_engaged([b], [push])), passed; failed), nl, - -(write('not(necessary_engaged([a], [run, push])) => '), -not(necessary_engaged([a], [run, push])), passed; failed), nl, - -(write('not(necessary_engaged([a], [push, run])) => '), -not(necessary_engaged([b], [push, run])), passed; failed), nl, - - -write('Test case 2\n'), -(write('necessary_engaged([c], [fly, sing]) => '), -necessary_engaged([c], [fly, sing]), passed; failed), nl, - -(write('necessary_engaged([c], [sing, fly]) => '), -necessary_engaged([c], [sing, fly]), passed; failed), nl, - -(write('not(necessary_engaged([d], [sing])) => '), -not(necessary_engaged([d], [sing])), passed; failed), nl, - -(write('not(necessary_engaged([d], [sing, fly])) => '), -not(necessary_engaged([d], [sing, fly])), passed; failed), nl, - - - -write('Test case 3\n'), -(write('not(necessary_engaged([x], [swim])) => '), -not(necessary_engaged([x], [swim])), passed; failed), nl, - -(write('necessary_engaged([x, y], [swim]) => '), -necessary_engaged([x, y], [swim]), passed; failed), nl, - -(write('necessary_engaged([x, y, z], [swim]) => '), -necessary_engaged([x, y, z], [swim]), passed; failed), nl, - -write('Test case 4a - should fail, wrong state\n'), -(write('not(necessary_engaged([john], [eat], [is_eating])) => '), -not(necessary_engaged_from([john], [eat], [is_eating])), passed; failed), nl, - -write('Test case 4b - should accept, good state\n'), -(write('necessary_engaged([john], [eat], [is_hungry]) => '), -necessary_engaged_from([john], [eat], [is_hungry]), passed; failed), nl, - -write('Test case 5 - should fail, needs always statement\n'), -(write('not(necessary_engaged_from([anna],[talks],[is_bored])) => '), -not(necessary_engaged_from([anna],[talks],[is_bored])), passed; failed), nl, - -write('Test case 6 - should be fine, there is always statement \n'), -(write('necessary_engaged_from([nex_6_george],[new_6_goes_to_sleep],[nex_6_on_monday]) => '), -necessary_engaged_from([nex_6_george],[new_6_goes_to_sleep],[nex_6_on_monday]), passed; failed), nl, - -write('Necessary Engaged - TESTS FINISHED'),nl. diff --git a/tests/necessary_executable/model.pl b/tests/necessary_executable/model.pl deleted file mode 100644 index 81af985..0000000 --- a/tests/necessary_executable/model.pl +++ /dev/null @@ -1,58 +0,0 @@ -% Test case 1 a. - action2 is possible because after action1, result is true -% Test case 1 b. - action2 is not possible because those agents cannot perform given action -by_causes_if(action1, [g1, g2], [result], [pi]). -by_causes_if(action2, [g1, g2], [another], [result]). - - -% Test case 2 a. - action8 is possible because after action7, not(sigma) is true -% Test case 2 b. - action9 is not possible because after action7, not(sigma) is true and then after action8, sigma is true -% Test case 2 c. - action10 is not possible because after action8, sigma is true -% Test case 2 d. - action8 is not possible because after action9, sigma is true -by_causes_if(action7, [g7, g8], [\sigma], [sigma]). -by_causes_if(action8, [g7, g8], [sigma], [\sigma]). -by_causes_if(action9, [g7, g8], [sigma], [sigma]). -by_causes_if(action10, [g7, g8], [sigma], [\sigma]). - - -% Test case 3 - action4 is possible because after action3 the following is true: [alpha, beta] -by_causes_if(action3, [g3, g4], [beta], [alpha]). -by_causes_if(action4, [g3, g4], [other], [alpha, beta]). - - -% Test case 4 - action6 impossible, because we never achieve delta -by_causes_if(action5, [g5, g6], [delta], [psi]). -by_causes_if(action6, [g5, g6], [result3], [delta, gamma]). - - -% Test case 5 a. - action_5_1 impossible by g_5_1 -% Test case 5 b. - action_5_1 possible by g_5_2 -impossible_by(action_5_1, [g_5_1]). -by_causes_if(action_5_1, [g_5_1], [delta_5], [psi_5]). -by_causes_if(action_5_1, [g_5_2], [delta_5], [psi_5]). - - -% Test case 6. - action_6_1 not necessary_executable by g_6_1 -by_releases_if(action_6_1, [g_6_1], [delta_6], [psi_6]). - -% Test case 7 a. - should be false because 2nd action is not executable after 1st one (becuase it requires initial state) -by_causes_if(nex_7a_action1, [nex_7a_g1, nex_7a_g2], [nex_7a_result], [nex_7a_pi]). -by_causes(nex_7a_action2, [nex_7a_g1, nex_7a_g2], [nex_7a_another]). - -% Test case 8 - action_8_2 is possible because of always statement -by_causes_if(nex_8_a1, [nex_8_g1], [nex_8_beta], [nex_8_alpha]). -by_causes_if(nex_8_a2, [nex_8_g1], [nex_8_other], [nex_8_beta]). -always([nex_8_alpha]). - - -% Test case 9 - nex_9_a1 is not possible, always statement only for gamma_9 -by_causes_if(nex_9_a1, [nex_9_g1], [nex_9_beta], [nex_9_alpha]). -by_causes_if(nex_9_a2, [nex_9_g1], [nex_9_other], [nex_9_beta]). -always([nex_9_gamma]). - -% Test case 10 - - -by_causes(washing,[], [washed]). -by_causes(cooking, [], [cooked]). -by_causes(tyding, [], [tied]). -after([clean],[[cooking,[]],[tyding,[]]]). - diff --git a/tests/necessary_executable/test.pl b/tests/necessary_executable/test.pl deleted file mode 100644 index de0f930..0000000 --- a/tests/necessary_executable/test.pl +++ /dev/null @@ -1,66 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - -write('Necessary Executable - TESTS STARTED'),nl, - -write('Test case 1 a. - action2 is possible because after action1, result is true\n'), -(write('necessary_executable_from([[action1,[g1, g2]],[action2,[g1, g2]]], [pi]). => '), -necessary_executable_from([[action1,[g1, g2]],[action2,[g1, g2]]], [pi]), passed; failed), nl, - -write('Test case 1 b. - action2 is not possible because those agents cannot perform given action\n'), -(write('not(necessary_executable_from([[action1,[gX, gY]],[action2,[gX, gY]]], [pi])). => '), -not(necessary_executable_from([[action1,[gX, gY]],[action2,[gX, gY]]], [pi])), passed; failed), nl, - -write('Test case 2 a. - action8 is possible because after action7, not(sigma) is true\n'), -(write('necessary_executable_from([[action7, [g7, g8]],[action8, [g7, g8]]], [sigma]). => '), -necessary_executable_from([[action7, [g7, g8]],[action8, [g7, g8]]], [sigma]), passed; failed), nl, - -write('Test case 2 b. - action9 is not possible because after action7, not(sigma) is true and then after action8, sigma is true\n'), -(write('necessary_executable_from([[action7, [g7, g8]],[action8, [g7, g8]],[action9, [g7, g8]]], [sigma]). => '), -necessary_executable_from([[action7, [g7, g8]],[action8, [g7, g8]],[action9, [g7, g8]]], [sigma]), passed; failed), nl, - -write('Test case 2 c. - action10 is not possible because after action8, sigma is true\n'), -(write('not(necessary_executable_from([[action7, [g7, g8]],[action8, [g7, g8]],[action10, [g7, g8]]], [sigma])). => '), -not(necessary_executable_from([[action7, [g7, g8]],[action8, [g7, g8]],[action10, [g7, g8]]], [sigma])), passed; failed), nl, - -write('Test case 2 d. - action8 is not possible because after action9, sigma is true\n'), -(write('not(necessary_executable_from([[action10, [g7, g8]],[action9, [g7, g8]],[action8, [g7, g8]]], [\sigma])). => '), -not(necessary_executable_from([[action10, [g7, g8]],[action9, [g7, g8]],[action8, [g7, g8]]], [\sigma])), passed; failed), nl, - -write('Test case 3 - action4 is possible because after action3 the following is true: [alpha, beta]\n'), -(write('necessary_executable_from([[action3,[g3, g4]],[action4,[g3, g4]]], [alpha]). => '), -necessary_executable_from([[action3,[g3, g4]],[action4,[g3, g4]]], [alpha]), passed; failed), nl, - -write('Test case 4 - action6 impossible, because we never achieve delta\n'), -(write('not(necessary_executable_from([[action5,[g5, g6]],[action6,[g5, g6]]], [psi])). => '), -not(necessary_executable_from([[action5,[g5, g6]],[action6,[g5, g6]]], [psi])), passed; failed), nl, - -write('Test case 5 a. - action_5_1 impossible by g_5_1\n'), -(write('not(necessary_executable_from([[action_5_1,[g_5_1]]],[psi_5])). => '), -not(necessary_executable_from([[action_5_1,[g_5_1]]],[psi_5])), passed; failed), nl, - -write('Test case 5 b. - action_5_1 possible by g_5_2\n'), -(write('necessary_executable_from([[action_5_1,[g_5_2]]],[psi_5]). => '), -necessary_executable_from([[action_5_1,[g_5_2]]],[psi_5]), passed; failed), nl, - -write('Test case 6. - action_6_1 is executable by g_6_1\n'), -(write('necessary_executable_from([[action_6_1,[g_6_1]]],[psi_6]). => '), -necessary_executable_from([[action_6_1,[g_6_1]]],[psi_6]), passed; failed), nl, - -write('Test case 7 a. - should be false because 2nd action is not executable after 1st one (becuase it requires initial state)\n'), -(write('not(necessary_executable_from([[nex_7a_action1, [nex_7a_g1, nex_7a_g2]],[nex_7a_action2, [nex_7a_g1, nex_7a_g2]]],[nex_7a_pi])). => '), -not(necessary_executable_from([[nex_7a_action1, [nex_7a_g1, nex_7a_g2]],[nex_7a_action2, [nex_7a_g1, nex_7a_g2]]],[nex_7a_pi])), passed; failed), nl, - - -write('Test case 8 - nex_8_a2 is possible because of always statement\n'), -(write('necessary_executable_from([[nex_8_a1,[nex_8_g1]],[nex_8_a2,[nex_8_g1]]], [nex_8_gamma_8]). => '), -necessary_executable_from([[nex_8_a1,[nex_8_g1]],[nex_8_a2,[nex_8_g1]]], [nex_8_gamma_8]), passed; failed), nl, - -write('Test case 9 - action_9_2 is not possible, always statement only for gamma_8\n'), -(write('not(necessary_executable_from([[nex_9_a1,[nex_9_g1]],[nex_9_a2,[nex_9_g1]]], [nex_9_gamma])). => '), -not(necessary_executable_from([[nex_9_a1,[nex_9_g1]],[nex_9_a2,[nex_9_g1]]], [nex_9_gamma])), passed; failed), nl, - -write('Test case 10 - action_9_2 is not possible, always statement only for gamma_8\n'), -(write('not(necessary_executable_from([[nex_9_a1,[nex_9_g1]],[nex_9_a2,[nex_9_g1]]], [nex_9_gamma])). => '), -necessary_executable_from([[washing,[]],[cooking,[]],[tyding,[]]], []), passed; failed), nl, - -write('Necessary Executable - TESTS FINISHED'),nl. diff --git a/tests/possibly_after_from/model.pl b/tests/possibly_after_from/model.pl deleted file mode 100644 index f16b26e..0000000 --- a/tests/possibly_after_from/model.pl +++ /dev/null @@ -1,30 +0,0 @@ -% Test case 0 - Should be true - just causes -by_causes_if(pa_0_action, [pa_0_g1, pa_0_g2], [pa_0_result], [pa_0_cond]). - -% Test case 1 - Should be true - just releases -by_releases_if(pa_1_action1, [pa_1_g1, pa_1_g2], [pa_1_fluent], [pa_1_cond]). - -% Test case 2 - should be true, action from "causes" cause "pa_2_result" which is required by releases -by_releases_if(pa_2_action2, [pa_2_g1, pa_2_g2], [pa_2_fluent], [pa_2_result]). -by_causes_if(pa_2_action1, [pa_2_g1, pa_2_g2], [pa_2_result], [pa_2_cond]). - -% Test case 3 - should be false, actions defined BUT 2nd is NOT achieved from 1st -by_releases_if(pa_3_action2, [pa_3_g1, pa_3_g2], [pa_3_fluent], [pa_3_another_result]). -by_causes_if(pa_3_action1, [pa_3_g1, pa_3_g2], [pa_3_something], [pa_3_cond1]). -by_causes_if(pa_3_action2, [pa_3_g1, pa_3_g2], [pa_3_another_result], [pa_3_something_else]). - -% Test case 4 - Should be true - conditions fulfilled when considering query input + always statement -by_causes_if(pa_4_action, [pa_4_g1, pa_4_g2], [pa_4_fluent], [pa_4_cond1, pa_4_cond2, pa_4_cond3]). -always([pa_4_cond2, pa_4_cond3]). - -% Test case 5 - Should be true - "pa_5_fluentX" is always true so it is possible -by_causes_if(pa_5_action, [pa_5_g1, pa_5_g2], [pa_5_fluent], [pa_5_cond1]). -always([pa_5_fluent1, pa_5_fluent2]). -always([pa_5_fluent3, pa_5_fluentX]). -always([pa_5_fluent4, pa_5_fluent5]). - -% Test case 6 - Should be true - "pa_6_fluentX" is always true so it is possible -by_releases_if(pa_6_action, [pa_6_g1, pa_6_g2], [pa_6_fluent], [pa_6_cond1]). -always([pa_6_fluent1, pa_6_fluent2]). -always([pa_6_fluent3, pa_6_fluentX]). -always([pa_6_fluent4, pa_6_fluent5]). diff --git a/tests/possibly_after_from/test.pl b/tests/possibly_after_from/test.pl deleted file mode 100644 index f248c06..0000000 --- a/tests/possibly_after_from/test.pl +++ /dev/null @@ -1,34 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - -write('Possibly After From - TESTS STARTED'),nl, - - -write('Test case 0 - Should be true - just causes\n'), -(write('possibly_after_from([pa_0_result], [[pa_0_action,[pa_0_g1, pa_0_g2]]], [pa_0_cond]).'), -possibly_after_from([pa_0_result], [[pa_0_action,[pa_0_g1, pa_0_g2]]], [pa_0_cond]), passed; failed), nl, - -write('Test case 1 - Should be true - just releases\n'), -(write('possibly_after_from([pa_1_fluent], [[pa_1_action1,[pa_1_g1, pa_1_g2]]], [pa_1_cond]).'), -possibly_after_from([pa_1_fluent], [[pa_1_action1,[pa_1_g1, pa_1_g2]]], [pa_1_cond]), passed; failed), nl, - -write('Test case 2 - should be true, action from "causes" cause "pa_2_result" which is required by releases\n'), -(write('possibly_after_from([pa_2_fluent], [[pa_2_action1,[pa_2_g1, pa_2_g2]], [pa_2_action2,[pa_2_g1, pa_2_g2]]], [pa_2_cond]).'), -possibly_after_from([pa_2_fluent], [[pa_2_action1,[pa_2_g1, pa_2_g2]], [pa_2_action2,[pa_2_g1, pa_2_g2]]], [pa_2_cond]), passed; failed), nl, - -write('Test case 3 - should be false, actions defined BUT 2nd is NOT achieved from 1st\n'), -(write('not(possibly_after_from([pa_3_fluent], [[pa_3_action1,[pa_3_g1, pa_3_g2]], [pa_3_action2,[pa_3_g1, pa_3_g2]]], [pa_3_cond1])).'), -not(possibly_after_from([pa_3_fluent], [[pa_3_action1,[pa_3_g1, pa_3_g2]], [pa_3_action2,[pa_3_g1, pa_3_g2]]], [pa_3_cond1])), passed; failed), nl, - -write('Test case 4 - should be false, actions defined BUT 2nd is NOT achieved from 1st\n'), -(write('possibly_after_from([pa_4_fluent], [[pa_4_action,[pa_4_g1, pa_4_g2]]], [pa_4_cond1]).'), -possibly_after_from([pa_4_fluent], [[pa_4_action,[pa_4_g1, pa_4_g2]]], [pa_4_cond1]), passed; failed), nl, - -write('Test case 5 - Should be true - "pa_5_fluentX" is always true so it is possible\n'), -(write('possibly_after_from([pa_5_fluentX], [[pa_5_action,[pa_5_g1, pa_5_g2]]], [pa_5_cond1]).'), -possibly_after_from([pa_5_fluentX], [[pa_5_action,[pa_5_g1, pa_5_g2]]], [pa_5_cond1]), passed; failed), nl, - -write('Test case 6 - Should be true - "pa_6_fluentX" is always true so it is possible\n'), -(write('possibly_after_from([pa_6_fluentX], [[pa_6_action,[pa_6_g1, pa_6_g2]]], [pa_6_cond1]).'), -possibly_after_from([pa_6_fluentX], [[pa_6_action,[pa_6_g1, pa_6_g2]]], [pa_6_cond1]), passed; failed), nl, - -write('Possibly After From - TESTS FINISHED'),nl. diff --git a/tests/possibly_engaged/model.pl b/tests/possibly_engaged/model.pl deleted file mode 100644 index c6d2500..0000000 --- a/tests/possibly_engaged/model.pl +++ /dev/null @@ -1,24 +0,0 @@ -% Test case 1 -by_causes(push, [a], []). -by_causes(push, [b], []). - -by_causes(run, [a], []). -by_causes(run, [b], []). - -% Test case 2 -by_causes(sing, [c], []). -by_causes(sing, [d], []). -by_causes(fly, [c], []). - -% Test case 3 -by_causes(swim, [x, y], []). - -% Test case 4 -by_causes_if(eat, [john], [],[is_hungry]). - -% Test case 5 -by_causes_if(talks, [anna], [],[is_ready]). - -% Test case 6 -by_causes_if(goes_to_sleep, [george], [],[is_tired]). -always([is_tired]). \ No newline at end of file diff --git a/tests/possibly_engaged/test.pl b/tests/possibly_engaged/test.pl deleted file mode 100644 index 670727b..0000000 --- a/tests/possibly_engaged/test.pl +++ /dev/null @@ -1,63 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - -write('Possibly Engaged - TESTS STARTED'),nl, - - - -write('Test case 1\n'), -(write('possibly_engaged([a], [push]) => '), -possibly_engaged([a], [push]), passed; failed), nl, - -(write('possibly_engaged([b], [push]) => '), -possibly_engaged([b], [push]), passed; failed), nl, - -(write('possibly_engaged([a], [run, push]) => '), -possibly_engaged([a], [run, push]), passed; failed), nl, - -(write('possibly_engaged([a], [push, run]) => '), -possibly_engaged([b], [push, run]), passed; failed), nl, - - - -write('Test case 2\n'), -(write('possibly_engaged([c], [fly, sing]) => '), -possibly_engaged([c], [fly, sing]), passed; failed), nl, - -(write('possibly_engaged([c], [sing, fly]) => '), -possibly_engaged([c], [sing, fly]), passed; failed), nl, - -(write('not(possibly_engaged([d], [fly, sing])) => '), -not(possibly_engaged([d], [fly, sing])), passed; failed), nl, - -(write('not(possibly_engaged([d], [sing, fly])) => '), -not(possibly_engaged([d], [sing, fly])), passed; failed), nl, - - - -write('Test case 3\n'), -(write('not(possibly_engaged([x], [swim])) => '), -not(possibly_engaged([x], [swim])), passed; failed), nl, - -(write('possibly_engaged([x, y], [swim]) => '), -possibly_engaged([x, y], [swim]), passed; failed), nl, - -(write('possibly_engaged([x, y, z], [swim]) => '), -possibly_engaged([x, y, z], [swim]), passed; failed), nl, - -write('Test case 4a - should fail, wrong state\n'), -(write('not(possibly_engaged_from([john], [eat],[is_tired])) => '), -not(possibly_engaged_from([john], [eat],[is_tired])), passed; failed), nl, -write('Test case 4b - should be good, from state is correct\n'), -(write('possibly_engaged_from([john], [eat],[is_hungry]) => '), -possibly_engaged_from([john], [eat],[is_hungry]), passed; failed), nl, - -write('Test case 5 - should fail, needs always statement\n'), -(write('not(possibly_engaged_from([anna],[talks],[is_bored])) => '), -not(possibly_engaged_from([anna],[talks],[is_bored])), passed; failed), nl, - -write('Test case 6 - should be fine, there is always statement \n'), -(write('possibly_engaged_from([george],[goes_to_sleep],[on_monday]) => '), -possibly_engaged_from([george],[goes_to_sleep],[on_monday]), passed; failed), nl, - - -write('Possibly Engaged - TESTS FINISHED'),nl. diff --git a/tests/possibly_executable/model.pl b/tests/possibly_executable/model.pl deleted file mode 100644 index 27464c2..0000000 --- a/tests/possibly_executable/model.pl +++ /dev/null @@ -1,9 +0,0 @@ -% Test case 1 a. - action_1_1 possibly executable by g_1_1 because of release -by_releases_if(action_1_1, [g_1_1], [delta_1], [psi_1]). - -% Test case 1 b. - action_1_2 possibly executable by g_1_2 because of causes -by_causes_if(action_1_2, [g_1_2], [delta_1], [psi_1]). - -% Test case 2. - action_2_1 possibly executable by g_2_1 because of impossible -impossible_by(action_2_1, [g_2_1]). -by_releases_if(action_2_1, [g_2_1], [delta_2], [psi_2]). \ No newline at end of file diff --git a/tests/possibly_executable/test.pl b/tests/possibly_executable/test.pl deleted file mode 100644 index bd38503..0000000 --- a/tests/possibly_executable/test.pl +++ /dev/null @@ -1,17 +0,0 @@ -:- consult('../../logic.pl'), consult('model.pl'), - -write('Possibly Executable - TESTS STARTED'),nl, - -write('Test case 1 a. - action_1_1 possibly executable by g_1_1 because of release\n'), -(write('possibly_executable_from([[action_1_1,[g_1_1]]],[psi_1]). => '), -possibly_executable_from([[action_1_1,[g_1_1]]],[psi_1]), passed; failed), nl, - -write('Test case 1 b. - action_1_2 possibly executable by g_1_2 because of causes\n'), -(write('possibly_executable_from([[action_1_2,[g_1_2]]],[psi_1]). => '), -possibly_executable_from([[action_1_2,[g_1_2]]],[psi_1]), passed; failed), nl, - -write('Test case 2. - action_2_1 possibly executable by g_2_1 because of impossible\n'), -(write('not(possibly_executable_from([[action_2_1,[g_2_1]]],[psi_2])). => '), -not(possibly_executable_from([[action_2_1,[g_2_1]]],[psi_2])), passed; failed), nl, - -write('Possibly Executable - TESTS FINISHED'),nl. \ No newline at end of file diff --git a/tests/story1/story.pl b/tests/story1/story.pl deleted file mode 100644 index c0f1911..0000000 --- a/tests/story1/story.pl +++ /dev/null @@ -1,10 +0,0 @@ -initially([\isRunning]). -impossible_if(push, [isRunning]). -impossible_by(push, [d]). -by_causes(push, [a], [\isRunning]). -by_causes(push, [b], [\isRunning]). -by_causes(push, [c], [\isRunning]). -by_causes(push, [b, c], [\isRunning]). -by_causes(push, [a, b], [isRunning]). -by_causes(push, [a, c], [isRunning]). -by_causes(push, [a, b, c], [\isRunning]). \ No newline at end of file diff --git a/tests/story1/test.pl b/tests/story1/test.pl deleted file mode 100644 index 8b7af06..0000000 --- a/tests/story1/test.pl +++ /dev/null @@ -1,34 +0,0 @@ -:- consult('../../logic.pl'), consult('story.pl'), -write('---------------------------------------------------------------------------------'),nl, -write('Story 1 - TESTS STARTED'),nl, - -write('Test case 1 - should be true, initial condition ok, agent group ok \n'), -(write('necessary_executable_from([[push,[a,b]]],[\\isRunning]). => '), -necessary_executable_from([[push,[a,b]]],[\isRunning]), passed; failed), nl, - -write('Test case 2 - should be true, initial condition ok, agent group ok \n'), -(write('necessary_executable_from([[push,[a,c]]],[\\isRunning]). => '), -necessary_executable_from([[push,[a,c]]],[\isRunning]), passed; failed), nl, - -write('Test case 3 - should be true, initial condition ok, action expression exists\n'), -(write('necessary_after_from([isRunning], [[push,[A,B]]], [\\isRunning]). => '), -necessary_after_from([isRunning], [[push,[a,b]]], [\isRunning]), passed; failed), nl, - -write('Test case 4 - should be true, initial condition ok, action expression exists\n'), -(write('necessary_after_from([isRunning], [[push,[A,C]]], [\\isRunning]). => '), -necessary_after_from([isRunning], [[push,[a,c]]], [\isRunning]), passed; failed), nl, - -write('Test case 5 - should be true, "a" is necessary because in [a, b] and [a, c] \n'), -(write('necessary_engaged([a], [push]). => '), -possibly_engaged([a], [push]), passed; failed), nl, - -write('Test case 6 - should be true, "b" is possibly because in [a, b] and [a, c] \n'), -(write('necessary_engaged([b], [push]). => '), -possibly_engaged([b], [push]), passed; failed), nl, - -write('Test case 7 - should be true, "c" is possibly because in [a, b] and [a, c] \n'), -(write('necessary_engaged([c], [push]). => '), -possibly_engaged([c], [push]), passed; failed), nl, - -write('Story 1 - TESTS FINISHED'),nl, -write('---------------------------------------------------------------------------------'),nl. diff --git a/tests/story2/story.pl b/tests/story2/story.pl deleted file mode 100644 index 123d030..0000000 --- a/tests/story2/story.pl +++ /dev/null @@ -1,15 +0,0 @@ -initially([alive, \protected, \up]). -by_causes(lift, [a, b], [up]). -by_causes_if(lift, [a], [\alive], [\protected, up]). -by_causes_if(lift, [b], [\alive], [\protected, up]). -causes_if(protect, [protected], [up]). -impossible_if(lift, [protected, \alive]). -impossible_if(lift, [protected, alive]). -impossible_if(lift, [\protected, \alive]). -impossible_if(protect, [protected, \alive, up]). -impossible_if(protect, [\protected, alive, up]). -impossible_if(protect, [protected, alive, up]). -impossible_if(protect, [protected, \alive, \up]). -impossible_if(protect, [\protected, alive, \up]). -impossible_if(protect, [protected, alive, \up]). -impossible_if(protect, [\protected, \alive, \up]). diff --git a/tests/story2/test.pl b/tests/story2/test.pl deleted file mode 100644 index 6e24096..0000000 --- a/tests/story2/test.pl +++ /dev/null @@ -1,38 +0,0 @@ -:- consult('../../logic.pl'), consult('story.pl'), -write('---------------------------------------------------------------------------------'),nl, -write('Story 2 - TESTS STARTED'),nl, - -write('Test case 1 - should be true \n'), -(write('necessary_executable_from([[lift,[a,b]]],[alive]). => '), -necessary_executable_from([[lift,[a,b]]],[alive]), passed; failed), nl, - -write('Test case 2 - should be true \n'), -(write('necessary_executable_from([[protect,[a]]],[up, alive]). => '), -necessary_executable_from([[protect,[a]]],[up, alive]), passed; failed), nl, - -write('Test case 3 - should be true \n'), -(write('necessary_executable_from([[protect,[b]]],[up, alive]). => '), -necessary_executable_from([[protect,[b]]],[up, alive]), passed; failed), nl, - -write('Test case 4 - should be true \n'), -(write('necessary_after_from([up], [[lift,[a,b]]], [alive]). => '), -necessary_after_from([up], [[lift,[a,b]]], [alive]), passed; failed), nl, - -write('Test case 5 - should be true \n'), -(write('necessary_after_from([protected], [[protect,[a]]], [up]). => '), -necessary_after_from([protected], [[protect,[a]]], [up]), passed; failed), nl, - -write('Test case 6 - should be true \n'), -(write('necessary_after_from([protected], [[protect,[b]]], [up]). => '), -necessary_after_from([protected], [[protect,[b]]], [up]), passed; failed), nl, - -write('Test case 7 - should be true \n'), -(write('possibly_engaged([a], [protect]). => '), -possibly_engaged([a], [protect]), passed; failed), nl, - -write('Test case 8 - should be true \n'), -(write('possibly_engaged([b], [protect]). => '), -possibly_engaged([b], [protect]), passed; failed), nl, - -write('Story 2 - TESTS FINISHED'),nl, -write('---------------------------------------------------------------------------------'),nl. diff --git a/tests/story3/story.pl b/tests/story3/story.pl deleted file mode 100644 index dc5f917..0000000 --- a/tests/story3/story.pl +++ /dev/null @@ -1,8 +0,0 @@ -initially([\brewed]). -initially([\destroyed]). -impossible_if(brew,[brewed_destroyed]). -by_causes(brew, [Bercik, Filemon], [brewed]). -by_releases(brew, [Bercik], [brewed]). -by_releases(brew, [Bercik], [destroyed]). -by_releases(brew, [Filemon], [brewed]). - diff --git a/tests/story3/test.pl b/tests/story3/test.pl deleted file mode 100644 index ac1cc6c..0000000 --- a/tests/story3/test.pl +++ /dev/null @@ -1,29 +0,0 @@ -:- consult('../../logic.pl'), consult('story.pl'), -write('---------------------------------------------------------------------------------'),nl, -write('Story 3 - TESTS STARTED'),nl, - - -(write('necessary_executable_from([[brew,[]]],[\brewed]). => '), -necessary_executable_from([[brew,[]]],[\brewed]), passed; failed), nl, - -(write('possibly_engaged([Filemon], [brew]), passed; failed). => '), -possibly_engaged([Filemon], [brew]), passed; failed), nl, - -(write('possibly_engaged([Bercik], [brew]), passed; failed). => '), -possibly_engaged([Bercik], [brew]), passed; failed), nl, - -(write('possibly_after_from([brewed],[[brew,[Bercik, Filemon]]], [\brewed,not destroyed]). => '), -possibly_after_from([brewed],[[brew,[Bercik, Filemon]]], [\brewed,\destroyed]), passed; failed), nl, - -(write('possibly_after_from([brewed],[[brew,[Filemon]]], [\brewed,not destroyed]). => '), -possibly_after_from([brewed],[[brew,[Filemon]]], [\brewed,\destroyed]), passed; failed), nl, - -(write('possibly_after_from([brewed],[[brew,[Bercik]]], [\brewed,not destroyed]). => '), -possibly_after_from([brewed],[[brew,[Bercik]]], [\brewed,\destroyed]), passed; failed), nl, - -(write('possibly_after_from([destroyed],[[brew,[Bercik]]], [\brewed,not destroyed]). => '), -possibly_after_from([destroyed],[[brew,[Bercik]]], [\brewed,\destroyed]), passed; failed), nl, - - -write('Story 2 - TESTS FINISHED'),nl, -write('---------------------------------------------------------------------------------'),nl.