From ad36af387bc0ac5d697eab37fbe1a76091c40d4b Mon Sep 17 00:00:00 2001 From: jacintodavila <> Date: Mon, 1 Nov 2021 21:30:02 -0400 Subject: [PATCH] Updating examples and answer/4 --- kb/013_turing_completeness.pl | 4 ++-- le_input.pl | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/kb/013_turing_completeness.pl b/kb/013_turing_completeness.pl index e1657ea..9a45e56 100644 --- a/kb/013_turing_completeness.pl +++ b/kb/013_turing_completeness.pl @@ -17,7 +17,7 @@ some tm goes from a tape one to a tape two if it changes q0 from [] to a left list and from the tape one to a right list and the left list is the reverse of a second left list - and one appends the second left list to the right list to obtain the tape two. + and appending the second left list then the right list gives the tape two. %turing(Tape0, Tape) :- % perform(q0, [], Ls, Tape0, Rs), @@ -76,7 +76,7 @@ rule2 says that q0 and b lead to qf and 1 after performing stay. query run is: - some tm goes from [1,1,1] to which tape. + some tm goes from [1,1,1,b] to which tape. "). diff --git a/le_input.pl b/le_input.pl index 887a630..6dd21f8 100644 --- a/le_input.pl +++ b/le_input.pl @@ -1566,7 +1566,7 @@ % [A, is, an, individual, or, is, a, company, at, B]). % Prolog predef_dict([has_as_head_before, A, B, C], [list-list, symbol-term, rest_of_list-list], [A, has, B, as, head, before, C]). -predef_dict([append, A, B, C],[first_list-list, second_list-list, third_list-list], [the, concatenation, of, A, then, B, becomes, C]). +predef_dict([append, A, B, C],[first_list-list, second_list-list, third_list-list], [appending, A, then, B, gives, C]). predef_dict([reverse, A, B], [list-list, other_list-list], [A, is, the, reverse, of, B]). predef_dict([same_date, T1, T2], [time_1-time, time_2-time], [T1, is, the, same, date, as, T2]). % see reasoner.pl before/2 predef_dict([between,Minimum,Maximum,Middle], [min-date, max-date, middle-date], @@ -1698,8 +1698,8 @@ (SwishModule:example(Scenario, [scenario(Facts, _)]) -> true; print_message(error, "Scenario: ~w does not exist"-[Scenario]))), !, %print_message(informational, "Facts: ~w"-[Facts]), - extract_goal_command(Goal, SwishModule, _InnerGoal, Command), - print_message(informational, "Command: ~w"-[Command]), + extract_goal_command(Goal, SwishModule, InnerGoal, Command), + print_message(informational, "Command: ~w"-[Command]), trace, query_with_facts(at(Command,SwishModule),Scenario,Unknowns,Explanation,Result), print_message(informational,"Result:~w, Explanation: ~w"-[Result,Explanation]), print_message(informational,"Unknowns: ~w"-[Unknowns]), @@ -1782,12 +1782,12 @@ % answer/4 % answer(+English, with(+Scenario), -Explanations, -Result) :- -answer(English, Arg, E, Result) :- +answer(English, Arg, E, Result) :- trace, parsed, !, pengine_self(SwishModule), translate_command(SwishModule, English, _, Goal, PreScenario), ((Arg = with(ScenarioName), PreScenario=noscenario) -> Scenario=ScenarioName; Scenario=PreScenario), extract_goal_command(Goal, SwishModule, _InnerGoal, Command), - (Scenario==noscenario -> Facts = [] ; SwishModule:example(Scenario, [scenario(Facts, _)])), + (Scenario==noscenario -> Facts = [] ; SwishModule:example(Scenario, [scenario(Facts, _)])), !, setup_call_catcher_cleanup(assert_facts(SwishModule, Facts), catch(query(Command,_,E,Result), Error, ( print_message(error, Error), fail ) ), _Result, @@ -1970,6 +1970,7 @@ user:answer( EnText) :- answer( EnText). user:answer( EnText, Scenario) :- answer( EnText, Scenario). user:answer( EnText, Scenario, Result) :- answer( EnText, Scenario, Result). +user:answer( EnText, Scenario, E, Result) :- answer( EnText, Scenario, E, Result). user:explainedAnswer(Query,Unknowns,Explanation,Result) :- explainedAnswer(Query,Unknowns,Explanation,Result). user:(show Something) :- @@ -2023,5 +2024,6 @@ sandbox:safe_primitive(le_input:show( _Something)). sandbox:safe_primitive(le_input:answer( _EnText, _Scenario)). sandbox:safe_primitive(le_input:answer( _EnText, _Scenario, _Result)). +sandbox:safe_primitive(le_input:answer( _EnText, _Scenario, _Explanation, _Result)). sandbox:safe_primitive(le_input:explainedAnswer(_,_,_,_)). sandbox:safe_primitive(le_input:le_taxlog_translate( _EnText, _Terms)).