Topology / ALM-Compiler

A Java implementation of the ALM language that compiles to the SPARC variant of Answer Set Programming (ASP).
Apache License 2.0
0 stars 1 forks source link

CALM exception - wrestler and opponent #33

Open anuradha252 opened 5 years ago

anuradha252 commented 5 years ago

Having an issue with the structure of the wrestler and opponent program. all the modules until then work.

structure wrestler_and_opponent
    instances   
      wrestler, opponent in living_entity
      r in restrain
         agent(wrestler) = true
         object(opponent) = true
         ...

Error I receive is Exception in thread "main" edu.ttu.krlab.alm.ALMCompilerPermanentFailure: PROGRAM FAILURE: [Translate Rule] Boolean Function cannot be in a Term Relation at head of rule

I have tried using

               r(O,A) in restrain 
            object(O,true)
            agent(A,true)

and

          r(O,A) in restrain 
            object(O) = true
            agent(A) = true

and

                r in restrain  
            object(opponent,true) 
            agent(wrestler,true) 

Error:Sort Instance [object(opponent,true) at (wrestler_test.p:670:5)] cannot have the same name as element [object:entity->booleans at (wrestler_test.p:23:5)].

none of them work. Could it be because object is a keyword?

I have attached the full program here wrestler_test.txt

anuradha252 commented 5 years ago

is it because this is not allowed in the CALM?

                event :: actions
                  attributes
                    agent : entity -> booleans
                    object : entity -> booleans

should it be?

                   event :: actions
                  attributes
                    agent : entity
                    object : entity 
Topology commented 5 years ago

I just uploaded a new calm.jar. In other bug fixes I was commenting out type checking on attribute definitions to allow Herbrand functions through as arguments. Because I was not type checking anymore, the sort information for the variables of the arguments of attribute functions was not getting registered. I made some changes and it is back to type checking the attribute function definitions.

The calm.jar I've distributed now should have 1 issue with the program, that it couldn't find an answer set to the sort calculating program.

Here is the sort calculating sparc program. I have not investigated why there is no answer set. Are there static constraints that might yield problems?

(Since you are using the calm.jar to develop against, do you want me to dump the sort calculating program if it has no answerset?)

% Pre Model Program
% Automatically Generated By ALM Translator 0.1.0.

sorts

#inanimate_object = {}.

#living_entity = {wrestler, opponent}.

#physical_object = #inanimate_object + #living_entity.

#tangible_entity = #physical_object.

#place = {}.

#spatial_entity = #tangible_entity + #place.

#entity = #spatial_entity.

#thing = #entity.

#integers = {}.

#activity = {}.

#unrestrain = {}.

#unobstruct = #unrestrain.

#make_accessible = #unobstruct.

#restrain = r(#entity, #entity).

#obstruct = #restrain.

#make_inaccessible = #obstruct.

#move = {}.

#actions_new = #make_accessible + #make_inaccessible + #move.

#event = #activity + #actions_new.

#actions = #event.

#universe = #thing + #integers + #actions.

#sort_hierarchy_nodes_ = {universe, timeStep, actions, booleans, integers, comparable_integers_subsort, thing, entity, spatial_entity, place, tangible_entity, physical_object, inanimate_object, living_entity, event, actions_new, activity, make_accessible, make_inaccessible, unobstruct, obstruct, unrestrain, restrain, move}.

#timeStep = {}.

predicates

% Fluent Function [encloses]
encloses(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_encloses].
dom_encloses(#spatial_entity, #spatial_entity, #timeStep).

% Static Function [defined_raw_material]
defined_raw_material(#event).

% Domain Function [dom_defined_raw_material].
dom_defined_raw_material(#event).

% Attribute Function [toward] for sort [event].
event_toward(#event, #spatial_entity).

% Domain Function [dom_event_toward] for attribute function [toward] of sort [event].
dom_event_toward(#event, #spatial_entity).

% Static Function [defined_toward]
defined_toward(#event).

% Domain Function [dom_defined_toward].
dom_defined_toward(#event).

% Static Function [defined_beneficiary]
defined_beneficiary(#event).

% Domain Function [dom_defined_beneficiary].
dom_defined_beneficiary(#event).

% Fluent Function [is_near]
is_near(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_near].
dom_is_near(#spatial_entity, #spatial_entity, #timeStep).

% Attribute Function [away_from] for sort [event].
event_away_from(#event, #spatial_entity).

% Domain Function [dom_event_away_from] for attribute function [away_from] of sort [event].
dom_event_away_from(#event, #spatial_entity).

% Static Function [defined_base]
defined_base(#event).

% Domain Function [dom_defined_base].
dom_defined_base(#event).

% Special Function [sink]
sink(#sort_hierarchy_nodes_).

% Domain Function [dom_sink].
dom_sink(#sort_hierarchy_nodes_).

% Fluent Function [is_opposite]
is_opposite(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_opposite].
dom_is_opposite(#spatial_entity, #spatial_entity, #timeStep).

% Fluent Function [is_on]
is_on(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_on].
dom_is_on(#spatial_entity, #spatial_entity, #timeStep).

% Fluent Function [accessible_to]
accessible_to(#entity, #thing, #timeStep).

% Domain Function [dom_accessible_to].
dom_accessible_to(#entity, #thing, #timeStep).

% Special Function [has_parent]
has_parent(#sort_hierarchy_nodes_).

% Domain Function [dom_has_parent].
dom_has_parent(#sort_hierarchy_nodes_).

% Special Function [subsort]
subsort(#sort_hierarchy_nodes_, #sort_hierarchy_nodes_).

% Domain Function [dom_subsort].
dom_subsort(#sort_hierarchy_nodes_, #sort_hierarchy_nodes_).

% Static Function [defined_path]
defined_path(#event).

% Domain Function [dom_defined_path].
dom_defined_path(#event).

% Fluent Function [is_inside]
is_inside(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_inside].
dom_is_inside(#spatial_entity, #spatial_entity, #timeStep).

% Attribute Function [result] for sort [event].
event_result(#event, #entity).

% Domain Function [dom_event_result] for attribute function [result] of sort [event].
dom_event_result(#event, #entity).

% Attribute Function [experiencer] for sort [event].
event_experiencer(#event, #entity).

% Domain Function [dom_event_experiencer] for attribute function [experiencer] of sort [event].
dom_event_experiencer(#event, #entity).

% Attribute Function [destination] for sort [event].
event_destination(#event, #spatial_entity).

% Domain Function [dom_event_destination] for attribute function [destination] of sort [event].
dom_event_destination(#event, #spatial_entity).

% Fluent Function [is_inaccessible]
is_inaccessible(#entity, #timeStep).

% Domain Function [dom_is_inaccessible].
dom_is_inaccessible(#entity, #timeStep).

% Fluent Function [is_in_front_of]
is_in_front_of(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_in_front_of].
dom_is_in_front_of(#spatial_entity, #spatial_entity, #timeStep).

% Attribute Function [agent] for sort [event].
event_agent(#event, #entity).

% Domain Function [dom_event_agent] for attribute function [agent] of sort [event].
dom_event_agent(#event, #entity).

% Static Function [defined_result]
defined_result(#event).

% Domain Function [dom_defined_result].
dom_defined_result(#event).

% Attribute Function [object] for sort [event].
event_object(#event, #entity).

% Domain Function [dom_event_object] for attribute function [object] of sort [event].
dom_event_object(#event, #entity).

% Fluent Function [is_between]
is_between(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_between].
dom_is_between(#spatial_entity, #spatial_entity, #timeStep).

% Fluent Function [abuts]
abuts(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_abuts].
dom_abuts(#spatial_entity, #spatial_entity, #timeStep).

% Static Function [defined_instrument]
defined_instrument(#event).

% Domain Function [dom_defined_instrument].
dom_defined_instrument(#event).

% Fluent Function [is_along]
is_along(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_along].
dom_is_along(#spatial_entity, #spatial_entity, #timeStep).

% Fluent Function [is_outside]
is_outside(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_outside].
dom_is_outside(#spatial_entity, #spatial_entity, #timeStep).

% Static Function [defined_agent]
defined_agent(#event).

% Domain Function [dom_defined_agent].
dom_defined_agent(#event).

% Fluent Function [is_at]
is_at(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_at].
dom_is_at(#spatial_entity, #spatial_entity, #timeStep).

% Special Function [occurs]
occurs(#actions, #timeStep).

% Domain Function [dom_occurs].
dom_occurs(#actions, #timeStep).

% Fluent Function [is_restrained]
is_restrained(#tangible_entity, #timeStep).

% Domain Function [dom_is_restrained].
dom_is_restrained(#tangible_entity, #timeStep).

% Fluent Function [is_obstructed]
is_obstructed(#spatial_entity, #timeStep).

% Domain Function [dom_is_obstructed].
dom_is_obstructed(#spatial_entity, #timeStep).

% Attribute Function [base] for sort [event].
event_base(#event, #thing).

% Domain Function [dom_event_base] for attribute function [base] of sort [event].
dom_event_base(#event, #thing).

% Fluent Function [is_accessible]
is_accessible(#entity, #timeStep).

% Domain Function [dom_is_accessible].
dom_is_accessible(#entity, #timeStep).

% Attribute Function [raw_material] for sort [event].
event_raw_material(#event, #tangible_entity).

% Domain Function [dom_event_raw_material] for attribute function [raw_material] of sort [event].
dom_event_raw_material(#event, #tangible_entity).

% Static Function [defined_recipient]
defined_recipient(#event).

% Domain Function [dom_defined_recipient].
dom_defined_recipient(#event).

% Fluent Function [is_under]
is_under(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_under].
dom_is_under(#spatial_entity, #spatial_entity, #timeStep).

% Attribute Function [recipient] for sort [event].
event_recipient(#event, #entity).

% Domain Function [dom_event_recipient] for attribute function [recipient] of sort [event].
dom_event_recipient(#event, #entity).

% Fluent Function [is_behind]
is_behind(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_behind].
dom_is_behind(#spatial_entity, #spatial_entity, #timeStep).

% Attribute Function [site] for sort [event].
event_site(#event, #spatial_entity).

% Domain Function [dom_event_site] for attribute function [site] of sort [event].
dom_event_site(#event, #spatial_entity).

% Attribute Function [instrument] for sort [event].
event_instrument(#event, #entity).

% Domain Function [dom_event_instrument] for attribute function [instrument] of sort [event].
dom_event_instrument(#event, #entity).

% Fluent Function [is_below]
is_below(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_below].
dom_is_below(#spatial_entity, #spatial_entity, #timeStep).

% Attribute Function [origin] for sort [event].
event_origin(#event, #spatial_entity).

% Domain Function [dom_event_origin] for attribute function [origin] of sort [event].
dom_event_origin(#event, #spatial_entity).

% Static Function [defined_donor]
defined_donor(#event).

% Domain Function [dom_defined_donor].
dom_defined_donor(#event).

% Attribute Function [beneficiary] for sort [event].
event_beneficiary(#event, #living_entity).

% Domain Function [dom_event_beneficiary] for attribute function [beneficiary] of sort [event].
dom_event_beneficiary(#event, #living_entity).

% Special Function [instance]
instance(#universe, #sort_hierarchy_nodes_).

% Domain Function [dom_instance].
dom_instance(#universe, #sort_hierarchy_nodes_).

% Fluent Function [restrained_by]
restrained_by(#tangible_entity, #entity, #timeStep).

% Domain Function [dom_restrained_by].
dom_restrained_by(#tangible_entity, #entity, #timeStep).

% Fluent Function [inaccessible_to]
inaccessible_to(#entity, #thing, #timeStep).

% Domain Function [dom_inaccessible_to].
dom_inaccessible_to(#entity, #thing, #timeStep).

% Attribute Function [path] for sort [event].
event_path(#event, #spatial_entity).

% Domain Function [dom_event_path] for attribute function [path] of sort [event].
dom_event_path(#event, #spatial_entity).

% Special Function [source]
source(#sort_hierarchy_nodes_).

% Domain Function [dom_source].
dom_source(#sort_hierarchy_nodes_).

% Fluent Function [location]
location(#spatial_entity, #place, #timeStep).

% Domain Function [dom_location].
dom_location(#spatial_entity, #place, #timeStep).

% Fluent Function [is_above]
is_above(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_above].
dom_is_above(#spatial_entity, #spatial_entity, #timeStep).

% Special Function [is_a]
is_a(#universe, #sort_hierarchy_nodes_).

% Domain Function [dom_is_a].
dom_is_a(#universe, #sort_hierarchy_nodes_).

% Fluent Function [is_beside]
is_beside(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_beside].
dom_is_beside(#spatial_entity, #spatial_entity, #timeStep).

% Attribute Function [donor] for sort [event].
event_donor(#event, #entity).

% Domain Function [dom_event_donor] for attribute function [donor] of sort [event].
dom_event_donor(#event, #entity).

% Special Function [has_child]
has_child(#sort_hierarchy_nodes_).

% Domain Function [dom_has_child].
dom_has_child(#sort_hierarchy_nodes_).

% Fluent Function [is_held]
is_held(#tangible_entity, #timeStep).

% Domain Function [dom_is_held].
dom_is_held(#tangible_entity, #timeStep).

% Static Function [defined_object]
defined_object(#event).

% Domain Function [dom_defined_object].
dom_defined_object(#event).

% Fluent Function [is_blocked]
is_blocked(#spatial_entity, #timeStep).

% Domain Function [dom_is_blocked].
dom_is_blocked(#spatial_entity, #timeStep).

% Static Function [defined_experiencer]
defined_experiencer(#event).

% Domain Function [dom_defined_experiencer].
dom_defined_experiencer(#event).

% Special Function [link]
link(#sort_hierarchy_nodes_, #sort_hierarchy_nodes_).

% Domain Function [dom_link].
dom_link(#sort_hierarchy_nodes_, #sort_hierarchy_nodes_).

% Fluent Function [is_over]
is_over(#spatial_entity, #spatial_entity, #timeStep).

% Domain Function [dom_is_over].
dom_is_over(#spatial_entity, #spatial_entity, #timeStep).

rules

%---------------------
%-- Section: link
%---------------------

% [thing] is a child sort of [universe]
link(thing, universe).

% [entity] is a child sort of [thing]
link(entity, thing).

% [spatial_entity] is a child sort of [entity]
link(spatial_entity, entity).

% [tangible_entity] is a child sort of [spatial_entity]
link(tangible_entity, spatial_entity).

% [physical_object] is a child sort of [tangible_entity]
link(physical_object, tangible_entity).

% [inanimate_object] is a child sort of [physical_object]
link(inanimate_object, physical_object).

% [living_entity] is a child sort of [physical_object]
link(living_entity, physical_object).

% [place] is a child sort of [spatial_entity]
link(place, spatial_entity).

% [integers] is a child sort of [universe]
link(integers, universe).

% [actions] is a child sort of [universe]
link(actions, universe).

% [event] is a child sort of [actions]
link(event, actions).

% [activity] is a child sort of [event]
link(activity, event).

% [actions_new] is a child sort of [event]
link(actions_new, event).

% [make_accessible] is a child sort of [actions_new]
link(make_accessible, actions_new).

% [unobstruct] is a child sort of [make_accessible]
link(unobstruct, make_accessible).

% [unrestrain] is a child sort of [unobstruct]
link(unrestrain, unobstruct).

% [make_inaccessible] is a child sort of [actions_new]
link(make_inaccessible, actions_new).

% [obstruct] is a child sort of [make_inaccessible]
link(obstruct, make_inaccessible).

% [restrain] is a child sort of [obstruct]
link(restrain, obstruct).

% [move] is a child sort of [actions_new]
link(move, actions_new).

%---------------------
%-- Section: instance
%---------------------

% Base case of [instance] relation.
% If X is a Y then X is an instance of Y.
instance(X, Y) :- is_a(X, Y).

% Closure On [instance] relation.
% X is an instance of Z if X is an instance of Y and there is a link from Y to Z.
instance(X, Z) :- instance(X, Y), link(Y, Z).

%---------------------
%-- Section: subsort
%---------------------

% Base case of [subsort] relation.
% If there is a link from X to Y in the sort hierarchy then X is a subsort of Y.
subsort(X, Y) :- link(X, Y).

% Closure On [subsort] relation.
% X is a subsort of Z if there is a link from X to Y and Y is a subsort of Z.
subsort(X, Z) :- link(X, Y), subsort(Y, Z).

% [subsort] needs the closed world assumption since it is a total boolean function.
-subsort(X, Y) :- not subsort(X, Y).

%---------------------
%-- Section: has_parent
%---------------------

% Sort X has a parent in the hierarchy if there is a link from X to some sort Y.
has_parent(X) :- link(X, Y).

% [has_parent] needs the closed world assumption since it is a total boolean function.
-has_parent(X) :- not has_parent(X).

%---------------------
%-- Section: has_child
%---------------------

% X has a child in the hierarchy if there is a link from some sort Y to X.
has_child(X) :- link(Y, X).

% [has_child] needs the closed world assumption since it is a total boolean function.
-has_child(X) :- not has_child(X).

%---------------------
%-- Section: source
%---------------------

% If sort X has no child sort, X is a source sort
source(X) :- -has_child(X).

% [source] needs the closed world assumption since it is a total boolean function.
-source(X) :- not source(X).

%---------------------
%-- Section: sink
%---------------------

% If sort X has no parent sort, X is a sink sort
sink(X) :- -has_parent(X).

% [sink] needs the closed world assumption since it is a total boolean function.
-sink(X) :- not sink(X).

%---------------------
%-- Section: Auxiliary Rules For Static Functions
%---------------------

% Function [defined_raw_material] is a defined static function and has the closed world assumption.
-defined_raw_material(X0) :- not defined_raw_material(X0).

% Definition of [dom_event_toward] when [event_toward] is a positive boolean function.
dom_event_toward(X0, X1) :- event_toward(X0, X1).

% Definition of [dom_event_toward] when [event_toward] is a positive boolean function.
dom_event_toward(X0, X1) :- -event_toward(X0, X1).

% Closed world assumption holds for [dom_event_toward] since [event_toward] is a static function.
-dom_event_toward(X0, X1) :- not dom_event_toward(X0, X1).

% Function [defined_toward] is a defined static function and has the closed world assumption.
-defined_toward(X0) :- not defined_toward(X0).

% Function [defined_beneficiary] is a defined static function and has the closed world assumption.
-defined_beneficiary(X0) :- not defined_beneficiary(X0).

% Definition of [dom_event_away_from] when [event_away_from] is a positive boolean function.
dom_event_away_from(X0, X1) :- event_away_from(X0, X1).

% Definition of [dom_event_away_from] when [event_away_from] is a positive boolean function.
dom_event_away_from(X0, X1) :- -event_away_from(X0, X1).

% Closed world assumption holds for [dom_event_away_from] since [event_away_from] is a static function.
-dom_event_away_from(X0, X1) :- not dom_event_away_from(X0, X1).

% Function [defined_base] is a defined static function and has the closed world assumption.
-defined_base(X0) :- not defined_base(X0).

% Function [sink] is a defined static function and has the closed world assumption.
-sink(X0) :- not sink(X0).

% Function [has_parent] is a defined static function and has the closed world assumption.
-has_parent(X0) :- not has_parent(X0).

% Function [subsort] is a defined static function and has the closed world assumption.
-subsort(X0, X1) :- not subsort(X0, X1).

% Function [defined_path] is a defined static function and has the closed world assumption.
-defined_path(X0) :- not defined_path(X0).

% Definition of [dom_event_result] when [event_result] is a positive boolean function.
dom_event_result(X0, X1) :- event_result(X0, X1).

% Definition of [dom_event_result] when [event_result] is a positive boolean function.
dom_event_result(X0, X1) :- -event_result(X0, X1).

% Closed world assumption holds for [dom_event_result] since [event_result] is a static function.
-dom_event_result(X0, X1) :- not dom_event_result(X0, X1).

% Definition of [dom_event_experiencer] when [event_experiencer] is a positive boolean function.
dom_event_experiencer(X0, X1) :- event_experiencer(X0, X1).

% Definition of [dom_event_experiencer] when [event_experiencer] is a positive boolean function.
dom_event_experiencer(X0, X1) :- -event_experiencer(X0, X1).

% Closed world assumption holds for [dom_event_experiencer] since [event_experiencer] is a static function.
-dom_event_experiencer(X0, X1) :- not dom_event_experiencer(X0, X1).

% Definition of [dom_event_destination] when [event_destination] is a positive boolean function.
dom_event_destination(X0, X1) :- event_destination(X0, X1).

% Definition of [dom_event_destination] when [event_destination] is a positive boolean function.
dom_event_destination(X0, X1) :- -event_destination(X0, X1).

% Closed world assumption holds for [dom_event_destination] since [event_destination] is a static function.
-dom_event_destination(X0, X1) :- not dom_event_destination(X0, X1).

% Definition of [dom_event_agent] when [event_agent] is a positive boolean function.
dom_event_agent(X0, X1) :- event_agent(X0, X1).

% Definition of [dom_event_agent] when [event_agent] is a positive boolean function.
dom_event_agent(X0, X1) :- -event_agent(X0, X1).

% Closed world assumption holds for [dom_event_agent] since [event_agent] is a static function.
-dom_event_agent(X0, X1) :- not dom_event_agent(X0, X1).

% Function [defined_result] is a defined static function and has the closed world assumption.
-defined_result(X0) :- not defined_result(X0).

% Definition of [dom_event_object] when [event_object] is a positive boolean function.
dom_event_object(X0, X1) :- event_object(X0, X1).

% Definition of [dom_event_object] when [event_object] is a positive boolean function.
dom_event_object(X0, X1) :- -event_object(X0, X1).

% Closed world assumption holds for [dom_event_object] since [event_object] is a static function.
-dom_event_object(X0, X1) :- not dom_event_object(X0, X1).

% Function [defined_instrument] is a defined static function and has the closed world assumption.
-defined_instrument(X0) :- not defined_instrument(X0).

% Function [defined_agent] is a defined static function and has the closed world assumption.
-defined_agent(X0) :- not defined_agent(X0).

% Definition of [dom_event_base] when [event_base] is a positive boolean function.
dom_event_base(X0, X1) :- event_base(X0, X1).

% Definition of [dom_event_base] when [event_base] is a positive boolean function.
dom_event_base(X0, X1) :- -event_base(X0, X1).

% Closed world assumption holds for [dom_event_base] since [event_base] is a static function.
-dom_event_base(X0, X1) :- not dom_event_base(X0, X1).

% Definition of [dom_event_raw_material] when [event_raw_material] is a positive boolean function.
dom_event_raw_material(X0, X1) :- event_raw_material(X0, X1).

% Definition of [dom_event_raw_material] when [event_raw_material] is a positive boolean function.
dom_event_raw_material(X0, X1) :- -event_raw_material(X0, X1).

% Closed world assumption holds for [dom_event_raw_material] since [event_raw_material] is a static function.
-dom_event_raw_material(X0, X1) :- not dom_event_raw_material(X0, X1).

% Function [defined_recipient] is a defined static function and has the closed world assumption.
-defined_recipient(X0) :- not defined_recipient(X0).

% Definition of [dom_event_recipient] when [event_recipient] is a positive boolean function.
dom_event_recipient(X0, X1) :- event_recipient(X0, X1).

% Definition of [dom_event_recipient] when [event_recipient] is a positive boolean function.
dom_event_recipient(X0, X1) :- -event_recipient(X0, X1).

% Closed world assumption holds for [dom_event_recipient] since [event_recipient] is a static function.
-dom_event_recipient(X0, X1) :- not dom_event_recipient(X0, X1).

% Definition of [dom_event_site] when [event_site] is a positive boolean function.
dom_event_site(X0, X1) :- event_site(X0, X1).

% Definition of [dom_event_site] when [event_site] is a positive boolean function.
dom_event_site(X0, X1) :- -event_site(X0, X1).

% Closed world assumption holds for [dom_event_site] since [event_site] is a static function.
-dom_event_site(X0, X1) :- not dom_event_site(X0, X1).

% Definition of [dom_event_instrument] when [event_instrument] is a positive boolean function.
dom_event_instrument(X0, X1) :- event_instrument(X0, X1).

% Definition of [dom_event_instrument] when [event_instrument] is a positive boolean function.
dom_event_instrument(X0, X1) :- -event_instrument(X0, X1).

% Closed world assumption holds for [dom_event_instrument] since [event_instrument] is a static function.
-dom_event_instrument(X0, X1) :- not dom_event_instrument(X0, X1).

% Definition of [dom_event_origin] when [event_origin] is a positive boolean function.
dom_event_origin(X0, X1) :- event_origin(X0, X1).

% Definition of [dom_event_origin] when [event_origin] is a positive boolean function.
dom_event_origin(X0, X1) :- -event_origin(X0, X1).

% Closed world assumption holds for [dom_event_origin] since [event_origin] is a static function.
-dom_event_origin(X0, X1) :- not dom_event_origin(X0, X1).

% Function [defined_donor] is a defined static function and has the closed world assumption.
-defined_donor(X0) :- not defined_donor(X0).

% Definition of [dom_event_beneficiary] when [event_beneficiary] is a positive boolean function.
dom_event_beneficiary(X0, X1) :- event_beneficiary(X0, X1).

% Definition of [dom_event_beneficiary] when [event_beneficiary] is a positive boolean function.
dom_event_beneficiary(X0, X1) :- -event_beneficiary(X0, X1).

% Closed world assumption holds for [dom_event_beneficiary] since [event_beneficiary] is a static function.
-dom_event_beneficiary(X0, X1) :- not dom_event_beneficiary(X0, X1).

% Function [instance] is a defined static function and has the closed world assumption.
-instance(X0, X1) :- not instance(X0, X1).

% Definition of [dom_event_path] when [event_path] is a positive boolean function.
dom_event_path(X0, X1) :- event_path(X0, X1).

% Definition of [dom_event_path] when [event_path] is a positive boolean function.
dom_event_path(X0, X1) :- -event_path(X0, X1).

% Closed world assumption holds for [dom_event_path] since [event_path] is a static function.
-dom_event_path(X0, X1) :- not dom_event_path(X0, X1).

% Function [source] is a defined static function and has the closed world assumption.
-source(X0) :- not source(X0).

% Function [is_a] is a defined static function and has the closed world assumption.
-is_a(X0, X1) :- not is_a(X0, X1).

% Definition of [dom_event_donor] when [event_donor] is a positive boolean function.
dom_event_donor(X0, X1) :- event_donor(X0, X1).

% Definition of [dom_event_donor] when [event_donor] is a positive boolean function.
dom_event_donor(X0, X1) :- -event_donor(X0, X1).

% Closed world assumption holds for [dom_event_donor] since [event_donor] is a static function.
-dom_event_donor(X0, X1) :- not dom_event_donor(X0, X1).

% Function [has_child] is a defined static function and has the closed world assumption.
-has_child(X0) :- not has_child(X0).

% Function [defined_object] is a defined static function and has the closed world assumption.
-defined_object(X0) :- not defined_object(X0).

% Function [defined_experiencer] is a defined static function and has the closed world assumption.
-defined_experiencer(X0) :- not defined_experiencer(X0).

% Function [link] is a defined static function and has the closed world assumption.
-link(X0, X1) :- not link(X0, X1).

%---------------------
%-- Section: Axioms - State Constraints With Only Static Functions
%---------------------

% State Constraint: This condition is impossible in all states.
:- instance(X, make_accessible), -defined_object(X).

% State Constraint: This condition is impossible in all states.
:- instance(X, make_inaccessible), -defined_object(X).

% State Constraint: This condition is impossible in all states.
:- instance(X, obstruct), event_object(X, O), -instance(X, spatial_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, unobstruct), event_object(X, O), -instance(X, spatial_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, unrestrain), event_object(X, O), -instance(X, tangible_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, restrain), event_object(X, O), -instance(X, tangible_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), -defined_object(X).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_object(X, O), -instance(O, tangible_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_origin(X, Or), -instance(Or, spatial_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_destination(X, D), -instance(D, spatial_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_away_from(X, Aw), -instance(Aw, spatial_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_toward(X, T), -instance(T, spatial_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_path(X, P), -instance(P, spatial_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_destination(X, D), -instance(D, place), -instance(D, tangible_entity).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_object(X, Y), event_origin(X, Y).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_object(X, Y), event_destination(X, Y).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_object(X, Y), event_away_from(X, Y).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_object(X, Y), event_toward(X, Y).

% State Constraint: This condition is impossible in all states.
:- instance(X, move), event_object(X, Y), event_path(X, Y).

% State Constraint for function [origin].
-event_origin(X, Or1) :- instance(X, move), event_origin(X, Or), #spatial_entity(Or1), #spatial_entity(Or), Or1!=Or.

% State Constraint for function [destination].
-event_destination(X, D1) :- instance(X, move), event_destination(X, D), #spatial_entity(D1), #spatial_entity(D), D1!=D.

%---------------------
%-- Section: Axioms - Satic Function Definitions
%---------------------

% Definition for function [defined_agent].
defined_agent(X) :- event_agent(X, Y).

% Definition for function [defined_object].
defined_object(X) :- event_object(X, Y).

% Definition for function [defined_base].
defined_base(X) :- event_base(X, Y).

% Definition for function [defined_instrument].
defined_instrument(X) :- event_instrument(X, Y).

% Definition for function [defined_recipient].
defined_recipient(X) :- event_recipient(X, Y).

% Definition for function [defined_donor].
defined_donor(X) :- event_donor(X, Y).

% Definition for function [defined_beneficiary].
defined_beneficiary(X) :- event_beneficiary(X, Y).

% Definition for function [defined_result].
defined_result(X) :- event_result(X, Y).

% Definition for function [defined_raw_material].
defined_raw_material(X) :- event_raw_material(X, Y).

% Definition for function [defined_experiencer].
defined_experiencer(X) :- event_experiencer(X, Y).

% Definition for function [defined_path].
defined_path(X) :- event_path(X, Y).

% Definition for function [defined_toward].
defined_toward(X) :- event_toward(X, Y).

%---------------------
%-- Section: integer_range
%---------------------

% There are no rules in this section.

%---------------------
%-- Section: Theory - Constant Declarations
%---------------------

% There are no rules in this section.

%---------------------
%-- Section: Structure - Sort Instances
%---------------------

% Sort Instance [wrestler] for sort [living_entity].
is_a(wrestler, living_entity).

% Sort Instance [opponent] for sort [living_entity].
is_a(opponent, living_entity).

% Sort Instance [r(O, A)] for sort [restrain].
is_a(r(O, A), restrain) :- instance(O, entity), instance(A, entity).

%---------------------
%-- Section: Structure - Attribute Definitions
%---------------------

% Definition of attribute [object] for instance [r(O, A)] of sort [restrain].
event_object(r(O, A), O) :- instance(O, entity).

% Definition of attribute [agent] for instance [r(O, A)] of sort [restrain].
event_agent(r(O, A), A) :- instance(O, entity), instance(A, entity).

%---------------------
%-- Section: Structure - Static Function Definitions
%---------------------

% There are no rules in this section.

% END OF PROGRAM
zhangyuanlin commented 5 years ago

I found the bug in the alm program. Will send u the new file.