Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Updating examples and answer/4
Browse files Browse the repository at this point in the history
  • Loading branch information
jacintodavila committed Nov 2, 2021
1 parent e480149 commit ad36af3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions kb/013_turing_completeness.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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.


").
Expand Down
12 changes: 7 additions & 5 deletions le_input.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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]),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) :-
Expand Down Expand Up @@ -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)).

0 comments on commit ad36af3

Please sign in to comment.