| Application module: Production rule | ISO/TS 10303-1739:2019(E) © ISO | 
This clause specifies the information requirements for the Production rule application module. The information requirements are specified as the Application Reference Model (ARM) of this application module.
NOTE 1 A graphical representation of the information requirements is given in Annex C.
NOTE 2 The mapping specification is specified in 5.1. It shows how the information requirements are met by using common resources and constructs defined or imported in the MIM schema of this application module.
This clause defines the information requirements to which implementations shall conform using the EXPRESS language as defined in ISO 10303-11. The following begins the Production_rule_arm schema and identifies the necessary external references.
EXPRESS specification:
         *)
            SCHEMA Production_rule_arm;
(*
The following EXPRESS interface statements specify the elements imported from the ARMs of other application modules.
EXPRESS specification:
*)
            USE FROM
            Activity_arm;
               -- 
            ISO/TS 10303-1047
            USE FROM
            Date_time_assignment_arm;
               -- 
            ISO/TS 10303-1014
            USE FROM
            Identification_assignment_arm;
               -- 
            ISO/TS 10303-1021
            USE FROM
            Product_identification_arm;
               -- 
            ISO/TS 10303-1017
            USE FROM
            Software_arm;
               -- 
            ISO/TS 10303-1746
            USE FROM
            Specification_document_arm;
               -- 
            ISO/TS 10303-1747
            REFERENCE FROM 
            Specification_document_arm
            
               -- 
            ISO/TS 10303-1747
  (get_document_definition);
            
            REFERENCE FROM 
            Support_resource_arm
            
               -- 
            ISO/TS 10303-1800
  (bag_to_set);
            
(*
NOTE 1 The schemas referenced above are specified in the following part of ISO 10303:
Activity_arm ISO/TS 10303-1047 Date_time_assignment_arm ISO/TS 10303-1014 Identification_assignment_arm ISO/TS 10303-1021 Product_identification_arm ISO/TS 10303-1017 Software_arm ISO/TS 10303-1746 Specification_document_arm ISO/TS 10303-1747 Specification_document_arm ISO/TS 10303-1747 Support_resource_arm ISO/TS 10303-1800 
NOTE 2 See Annex C, Figures C.1, C.2, C.3and C.4 for a graphical representation of this schema.
This subclause specifies the ARM types for this application module. The ARM types and definitions are specified below.

EXPRESS specification:
            *)
            TYPE 
            built_in_functions =
            
            EXTENSIBLE
            
            ENUMERATION
            
            OF
            
               
            (attr_val);
            END_TYPE; 
            (*
            
Enumerated item definitions:
attr_val: the available functions.

The clause_select type allows for the designation of the data types Simple_clause and Complex_clause.
EXPRESS specification:
            *)
            TYPE 
            clause_select =
            
            
            SELECT
               (Simple_clause, 
    Complex_clause);
            END_TYPE; 
            (*
            

The constants type is an extensible list of alternate data types that allows for the designation of the data types any_number_value, any_string_value, and Logical_representation_item.
NOTE The list of entity data types may be extended in application modules that use the constructs of this module.
EXPRESS specification:
            *)
            TYPE 
            constants =
            
            EXTENSIBLE
            
            
            SELECT
               (any_number_value, 
    any_string_value, 
    Logical_representation_item);
            END_TYPE; 
            (*
            

EXPRESS specification:
            *)
            TYPE 
            expression_syntax =
            
            EXTENSIBLE
            
            ENUMERATION
            
            OF
            
               
            (express);
            END_TYPE; 
            (*
            
Enumerated item definitions:
express: a source of the syntax. This data type indicates that EXPRESS syntax is used to develop expressions.

The function_symbol type allows for the designation of the data types any_string_value and built_in_functions.
EXPRESS specification:
            *)
            TYPE 
            function_symbol =
            
            
            SELECT
               (any_string_value, 
    built_in_functions);
            END_TYPE; 
            (*
            

The pr_activity_item type is an extension of the activity_item type. It adds the data types Rule_set and Rule_version to the list of alternate data types.
EXPRESS specification:
            *)
            TYPE 
            pr_activity_item =
            
            
            SELECT
            BASED_ON 
            activity_item
            WITH 
            
               (Rule_set, 
    Rule_version);
            END_TYPE; 
            (*
            

The pr_documented_element_select type is an extension of the documented_element_select type. It adds the data type Rule_set to the list of alternate data types.
NOTE The list of entity data types may be extended in application modules that use the constructs of this module.
EXPRESS specification:
            *)
            TYPE 
            pr_documented_element_select =
            
            EXTENSIBLE
            
            GENERIC_ENTITY
            
            
            SELECT
            BASED_ON 
            documented_element_select
            WITH 
            
               (Rule_set);
            END_TYPE; 
            (*
            

The pr_identification_item type is an extension of the identification_item type. It adds the data type Rule_set to the list of alternate data types.
EXPRESS specification:
            *)
            TYPE 
            pr_identification_item =
            
            
            SELECT
            BASED_ON 
            identification_item
            WITH 
            
               (Rule_set);
            END_TYPE; 
            (*
            

The pr_organization_or_person_in_organization_item type is an extension of the organization_or_person_in_organization_item type. It adds the data type Rule_action to the list of alternate data types.
EXPRESS specification:
            *)
            TYPE 
            pr_organization_or_person_in_organization_item =
            
            
            SELECT
            BASED_ON 
            organization_or_person_in_organization_item
            WITH 
            
               (Rule_action);
            END_TYPE; 
            (*
            

EXAMPLE The plus sign "+" is often used to represent concatenation in expressions.
EXPRESS specification:
            *)
            TYPE 
            predicate_symbol =
            STRING;
            END_TYPE; 
            (*
            

The scope_select type allows for the designation of the data types Rule_definition, Rule_set, and Rule_set_group.
EXPRESS specification:
            *)
            TYPE 
            scope_select =
            
            
            SELECT
               (Rule_definition, 
    Rule_set, 
    Rule_set_group);
            END_TYPE; 
            (*
            

The term_select type allows for the designation of the data types Symbol, constants, Func, Scalar_variable, Row_value, and Row_variable.
EXPRESS specification:
            *)
            TYPE 
            term_select =
            
            
            SELECT
               (Symbol, 
    constants, 
    Func, 
    Scalar_variable, 
    Row_value, 
    Row_variable);
            END_TYPE; 
            (*
            
This subclause specifies the ARM entities for this module. Each ARM application entity is an atomic element that embodies a unique application concept and contains attributes specifying the data elements of the entity. The ARM entities and definitions are specified below.


EXPRESS specification:
            *)
            ENTITY Abstract_variable
              ABSTRACT SUPERTYPE
            
            OF (ONEOF (Scalar_variable,
                                Row_variable));
            
            
            
              name : STRING;
            
            
            
              scope : scope_select;
UNIQUE
              UR1: name, scope;
            END_ENTITY;
(*
            
Attribute definitions:
name: the words by which the Abstract_variable is known.
scope: specifies the scope_select for the Abstract_variable.
Formal propositions:
UR1: The combination of name and scope shall be unique within a population of an Abstract_variables.


EXPRESS specification:
            *)
            ENTITY Atomic_formula
              ABSTRACT SUPERTYPE
            
            OF (ONEOF (Rule_condition,
                                Ground_fact));
            
            
            
              predicate_symbol : predicate_symbol;
            
            
            
              terms : LIST[0:?] OF term_select;
            END_ENTITY;
(*
            
Attribute definitions:
predicate_symbol: specifies the predicate_symbol for the Atomic_formula.
terms: specifies a list of the term_select for the Atomic_formula.


EXPRESS specification:
            *)
            ENTITY Attribute_assertion
              SUBTYPE OF (Fact_type);
            
            
            
              entity_type : STRING;
            
            
            
              attribute : STRING;
            END_ENTITY;
(*
            
Attribute definitions:
entity_type: specifies the text that describes the Attribute_assertion.
attribute: specifies the text that describes the Attribute_assertion.


EXPRESS specification:
            *)
            ENTITY Back_chaining_rule
              SUBTYPE OF (Rule_definition);
            
            
            
              head : Rule_condition;
            
            
            
              body : LIST[0:?] OF Rule_condition;
WHERE
 
              WR1: SELF.head.positive = TRUE;
 
              WR2: local_vars_of(SELF.head) <= local_vars_of(SELF.body);
            END_ENTITY;
(*
            
Attribute definitions:
head: specifies the Rule_condition for the Back_chaining_rule.
body: specifies a list of the Rule_condition for the Back_chaining_rule.
Formal propositions:
WR1: The positive of head shall be set to TRUE.
WR2: The set of variable of head shall be a subset of set of variable of body.


EXPRESS specification:
            *)
            ENTITY Complex_clause
              ABSTRACT SUPERTYPE
            
            OF (ONEOF (Complex_conjunctive_clause,
                                Complex_disjunctive_clause));
            
            
            
              clauses : LIST[2:?] OF clause_select;
            END_ENTITY;
(*
            
Attribute definitions:
clauses: specifies a list of the clause_select for the Complex_clause. There shall exist two or more clause_select for the Complex_clause.


EXPRESS specification:
            *)
            ENTITY Complex_conjunctive_clause
              SUBTYPE OF (Complex_clause);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Complex_disjunctive_clause
              SUBTYPE OF (Complex_clause);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Entity_assertion
              SUBTYPE OF (Fact_type);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Enum_reference_prefix;
            
            
            
              prefix : STRING;
            END_ENTITY;
(*
            
Attribute definitions:
prefix: specifies the text that describes the Enum_reference_prefix.


EXPRESS specification:
            *)
            ENTITY Extent;
            
            
            
              variable_id : 
            OPTIONAL 
            STRING;
            
            
            
              source : STRING;
            
            
            
              query_expression : STRING;
            
            
            
              syntax : 
            OPTIONAL 
            expression_syntax;
            END_ENTITY;
(*
            
Attribute definitions:
variable_id: specifies the text that describes the variable identifier of the Extent. The value of this attribute need not be specified.
source: specifies the text that describes the origin of the Extent.
query_expression: specifies the text that describes the expression used to extract the Extent.
syntax: specifies a role of the expression_syntax for the Extent. The value of this attribute need not be specified.


EXPRESS specification:
            *)
            ENTITY Fact_type
              ABSTRACT SUPERTYPE
            
            OF (ONEOF (Entity_assertion,
                                Attribute_assertion));
            
            
            
              source : Extent;
            
            
            
              predicate_symbol : STRING;
            END_ENTITY;
(*
            
Attribute definitions:
source: specifies a role of the Extent for the Fact_type.
predicate_symbol: specifies the text that describes the Fact_type.


EXPRESS specification:
            *)
            ENTITY Forward_chaining_rule
              SUBTYPE OF (Rule_definition);
            
            
            
              premise : clause_select;
            
            
            
              conclusion : Literal_conjunction;
WHERE
 
              WR1: local_vars_of(SELF.conclusion) <= local_vars_of(SELF.premise);
            END_ENTITY;
(*
            
Attribute definitions:
premise: specifies the clause_select for the Forward_chaining_rule.
conclusion: specifies a role of the Literal_conjunction for the Forward_chaining_rule.
Formal propositions:
WR1: The set of variable of conclusion shall be a subset of set of variable of premise.


EXPRESS specification:
            *)
            ENTITY Func;
            
            
            
              func_sym : function_symbol;
            
            
            
              terms : LIST[0:?] OF term_select;
            END_ENTITY;
(*
            
Attribute definitions:
func_sym: specifies the function_symbol for the Func.
terms: specifies a list of the term_select for the Func.


NOTE The variable being assigned to may be used in rules (provided that the variable is in the scope of the rule). In such rules, the value bound to the variable is the value provided by the Global_assignment.
EXPRESS specification:
            *)
            ENTITY Global_assignment;
            
            
            
              variable : Abstract_variable;
            
            
            
              val : term_select;
WHERE
 
              WR1: NOT(contains_variable(SELF.val));
            END_ENTITY;
(*
            
Attribute definitions:
variable: specifies a role of the Abstract_variable for the Global_assignment.
val: specifies the term_select for the Global_assignment.
Formal propositions:
WR1: The val shall not contain a variable.


A Ground_fact is a type of Atomic_formula. A Ground_fact is an Atomic_formula that does not contain variables. A Ground_fact can be used to represent a true statement about the domain. The statement that it represents does not contain logical connectives.
EXAMPLE Logical connectives may include: and, or, not, implication, bi-conditional.
EXPRESS specification:
            *)
            ENTITY Ground_fact
              SUBTYPE OF (Atomic_formula);
WHERE
 
              WR1: SIZEOF(QUERY(r <* SELF\Atomic_formula.terms | contains_variable(r))) = 0;
            END_ENTITY;
(*
            
Formal propositions:
WR1: The terms inherited from Atomic_formula shall not contain variables.


EXPRESS specification:
            *)
            ENTITY Literal_conjunction
              SUBTYPE OF (Simple_clause);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Literal_disjunction
              SUBTYPE OF (Simple_clause);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Row_value;
            
            
            
              values : LIST[0:?] OF term_select;
WHERE
 
              WR1: SIZEOF(QUERY(v <* SELF.values | contains_variable(v))) = 0;
 
              WR2: SIZEOF(QUERY(v <* SELF.values | 'PRODUCTION_RULE_ARM.ROW_VALUE' IN TYPEOF(v))) = 0;
            END_ENTITY;
(*
            
Attribute definitions:
values: specifies a list of the term_select for the Row_value.
Formal propositions:
WR1: No member of values shall contain variable.
WR2: No member if values shall be of type Row_value.


EXPRESS specification:
            *)
            ENTITY Row_variable
              SUBTYPE OF (Abstract_variable);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Rule_action
              ABSTRACT SUPERTYPE
            
            OF (ONEOF (Rule_submission,
                                Rule_adoption,
                                Rule_rejection,
                                Rule_supersedence,
                                Rule_creation,
                                Rule_expiration,
                                Rule_change_request,
                                Rule_request,
                                Rule_modification));
            
            
            
              subject_rule : Rule_version;
DERIVE
              subject_action_assignment : SET[0:?] OF Organization_or_person_in_organization_assignment := bag_to_set(QUERY(temp <* USEDIN ( SELF , 'PERSON_ORGANIZATION_ASSIGNMENT_ARM.' + 
            'ORGANIZATION_OR_PERSON_IN_ORGANIZATION_ASSIGNMENT.ITEMS' ) 
            | ( temp.role = 'subject action assignment')));
UNIQUE
              UR1: subject_rule, subject_action_assignment;
WHERE
 
              WR1: EXISTS (subject_action_assignment) AND (SIZEOF(subject_action_assignment) = 1 );
            END_ENTITY;
(*
            
Attribute definitions:
subject_rule: specifies the Rule_version as the version of a Rule_product for which some management Rule_action has occurred.
subject_action_assignment: specifies a role of the Organization_or_person_in_organization_assignment for the Rule_action.
Formal propositions:
UR1: The combination of subject_action_assignment and subject_rule shall be unique within a population of Rule_actions.
WR1: The subject_action_assignment shall exist and it's size shall be one.


EXPRESS specification:
            *)
            ENTITY Rule_adoption
              SUBTYPE OF (Rule_action);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Rule_change_request
              SUBTYPE OF (Rule_action);
            
            
            
              change_reason : STRING;
            END_ENTITY;
(*
            
Attribute definitions:
change_reason: specifies the human-interpretable reason for requesting a Rule_change_request.


EXPRESS specification:
            *)
            ENTITY Rule_condition
              SUBTYPE OF (Atomic_formula);
            
            
            
              positive : BOOLEAN;
            END_ENTITY;
(*
            
Attribute definitions:
positive: specifies a logical value.


EXPRESS specification:
            *)
            ENTITY Rule_creation
              SUBTYPE OF (Rule_action);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Rule_definition
              ABSTRACT SUPERTYPE
            
            OF (ONEOF (Forward_chaining_rule,
                                Back_chaining_rule))
              SUBTYPE OF (Rule_software_definition);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Rule_expiration
              SUBTYPE OF (Rule_action);
            
            
            
              expiration_rationale : STRING;
            END_ENTITY;
(*
            
Attribute definitions:
expiration_rationale: specifies the human-interpretable reason for the Rule_expiration.


EXPRESS specification:
            *)
            ENTITY Rule_justification
              SUBTYPE OF (Rule_action);
            
            
            
              justified_action : Rule_action;
            
            
            
              justification_rationale : STRING;
WHERE
 
              WR1: SELF <> justified_action;
            END_ENTITY;
(*
            
Attribute definitions:
justified_action: specifies the Rule_action that results from the Rule_justification.
justification_rationale: specifies the text that describes the Rule_justification.
Formal propositions:
WR1: The justified_action shall not be this Rule_justification.


EXPRESS specification:
            *)
            ENTITY Rule_modification
              SUBTYPE OF (Rule_action);
            
            
            
              modification_rationale : Rule_change_request;
            END_ENTITY;
(*
            
Attribute definitions:
modification_rationale: specifies a role of the Rule_change_request for the Rule_modification.


EXPRESS specification:
            *)
            ENTITY Rule_priority;
            
            
            
              priority : INTEGER;
            
            
            
              prioritized_rule : Rule_definition;
WHERE
 
              WR1: priority >= 0;
            END_ENTITY;
(*
            
Attribute definitions:
priority: specifies the integer for the priority number of the Rule_priority. The lowest numeric value shall have the highest priority.
prioritized_rule: specifies a role of the Rule_definition for the Rule_priority.
Formal propositions:
WR1: A number less than zero shall not be allowed.


EXPRESS specification:
            *)
            ENTITY Rule_product
              SUBTYPE OF (Software);
            END_ENTITY;
(*
            


EXPRESS specification:
            *)
            ENTITY Rule_rejection
              SUBTYPE OF (Rule_action);
            
            
            
              rejection_reason : STRING;
            END_ENTITY;
(*
            
Attribute definitions:
rejection_reason: specifies the human-interpretable explanation for the Rule_rejection.


EXPRESS specification:
            *)
            ENTITY Rule_request
              SUBTYPE OF (Rule_action);
            END_ENTITY;
(*
            


A Rule_set is a type of Rule_software_definition. A Rule_set is an association among Rule_priority.
NOTE The purpose for a Rule_set is renamed from the initial_context attribute inherited from Product_view_definition.
EXPRESS specification:
            *)
            ENTITY Rule_set
              SUBTYPE OF (Rule_software_definition);
            
            
            
              conflict_resolution_strategy : 
            OPTIONAL 
            STRING;
            
            
            
              rule_member : SET[1:?] OF Rule_priority;
DERIVE
              engine : SET[1:1] OF Document_definition := get_document_definition(SELF, 'engine', 
            		'SPECIFICATION_DOCUMENT_ARM.LANGUAGE_REFERENCE_MANUAL');
INVERSE
              purpose : Identification_assignment FOR items;
WHERE
 
              WR1: purpose.role = 'purpose';
            END_ENTITY;
(*
            
Attribute definitions:
conflict_resolution_strategy: specifies the text that describes a conflict resolution strategy for the Rule_set. The value of this attribute need not be specified.
rule_member: specifies a role of the Rule_priority for the Rule_set. There shall be one or more Rule_priority for the Rule_set.
engine: specifies a role of the Language_reference_manual for the Rule_set.
purpose: an inverse relationship that specifies that the existence of the Rule_set is dependent on the existence of the Identification_assignment that specifies the Rule_set as its items.
Formal propositions:
WR1: The role of the purpose shall be 'purpose'.


EXPRESS specification:
            *)
            ENTITY Rule_set_group
              SUBTYPE OF (Rule_software_definition);
            
            
            
              elements : SET[2:?] OF Rule_set;
            END_ENTITY;
(*
            
Attribute definitions:
elements: specifies the Rule_set for the Rule_set_group. There may be more than two Rule_set for the Rule_set_group.


EXPRESS specification:
            *)
            ENTITY Rule_software_definition
              SUPERTYPE OF (ONEOF (Rule_definition,
                       Rule_set_group,
                       Rule_set))
              SUBTYPE OF (Software_definition);
            
            
            
              SELF\Product_view_definition.defined_version : Rule_version;
            END_ENTITY;
(*
            
Attribute definitions:
defined_version: an attribute inherited from the Product_view_definition shall be redeclared as the Rule_version for the Rule_software_definition.


EXPRESS specification:
            *)
            ENTITY Rule_submission
              SUBTYPE OF (Rule_action);
            
            
            
              submission_rationale : STRING;
            END_ENTITY;
(*
            
Attribute definitions:
submission_rationale: specifies the text that describes the rationale for the Rule_submission.


EXPRESS specification:
            *)
            ENTITY Rule_supersedence
              SUBTYPE OF (Rule_action);
            
            
            
              superseded_rule : Rule_version;
            END_ENTITY;
(*
            
Attribute definitions:
superseded_rule: specifies the Rule_version that has been superseded for the Rule_supersedence.


EXPRESS specification:
            *)
            ENTITY Rule_version
              SUBTYPE OF (Software_version);
            
            
            
              SELF\Product_version.of_product : Rule_product;
INVERSE
              management_action : SET[1:?] OF Rule_action FOR subject_rule;
              product_definition : SET[1:?] OF Rule_software_definition FOR defined_version;
            END_ENTITY;
(*
            
Attribute definitions:
of_product: an attribute inherited from the Product_version shall be redeclared as the Rule_product for the Rule_version.
management_action: an inverse relationship that specifies that the existence of the Rule_version is dependent on the existence of the Rule_action that specifies the Rule_version as its subject_rule. There shall be one or more Rule_actions for a Rule_version.
product_definition: an inverse relationship that specifies that the existence of the Rule_version is dependent on the existence of the Rule_software_definition that specifies the Rule_version as its defined_version. There shall be one or more Rule_software_definitions for a Rule_version.


EXPRESS specification:
            *)
            ENTITY Scalar_variable
              SUBTYPE OF (Abstract_variable);
            END_ENTITY;
(*
            


A Simple_clause is one of a Literal_conjunction or a Literal_disjunction. A Simple_clause is the result of applying the same operator to all the formulas. It is a syntactic construct used in the construction of rules, and may correspond to a structure used in the inference mechanism.
EXAMPLE A clause in clausal logic may be represented by a Simple_clause.
EXPRESS specification:
            *)
            ENTITY Simple_clause
              ABSTRACT SUPERTYPE
            
            OF (ONEOF (Literal_conjunction,
                                Literal_disjunction));
            
            
            
              formulas : LIST[1:?] OF Rule_condition;
            END_ENTITY;
(*
            
Attribute definitions:
formulas: specifies the role of the Rule_condition for the Simple_clause. There shall exist one or more Rule_conditions for the Simple_clause.


A Symbol is a type of Representation_item used by the rules system to name the things on which assertions are made.
EXAMPLE EXPRESS entity instances could be represented by symbols. An entity instance encoded using the clear text encoding (ISO 10303-21) #34=POINT(1.0,2.0,1.0); might be represented in the production system as a Symbol with name '#34'.
EXPRESS specification:
            *)
            ENTITY Symbol
              SUBTYPE OF (Representation_item);
UNIQUE
              UR1: SELF\Representation_item.name;
            END_ENTITY;
(*
            
Formal propositions:
UR1: The name shall be unique within a population of Symbols.
This subclause specifies the ARM functions for this module. The ARM functions and definitions are specified below.
EXPRESS specification:
         *)
         FUNCTION contains_variable (x : term_select) : BOOLEAN;
         IF ('PRODUCTION_RULE_ARM.ABSTRACT_VARIABLE' IN TYPEOF(x)) THEN RETURN (TRUE);
      ELSE IF (('PRODUCTION_RULE_ARM.FUNC' IN TYPEOF(X)) AND
              (SIZEOF(QUERY(y <* x.terms | contains_variable(y))) > 0)) 
              THEN RETURN (TRUE);
              ELSE RETURN (FALSE);
           END_IF;
  END_IF;
         END_FUNCTION;
         
(*
         Argument definitions:
x: the specified term_select.
EXPRESS specification:
         *)
         FUNCTION local_vars_aux (thing : GENERIC; accum : SET[0:?] OF Scalar_variable) : SET[0:?] OF Scalar_variable;
         LOCAL i,j,k : INTEGER; END_LOCAL;
  IF (('PRODUCTION_RULE_ARM.ABSTRACT_VARIABLE' IN TYPEOF(thing)) AND 
      ('PRODUCTION_RULE_ARM.RULE_DEFINITION' IN (TYPEOF(thing.scope))))
   THEN accum := accum + thing;
   ELSE IF ('PRODUCTION_RULE_ARM.RULE_CONDITION' IN TYPEOF(thing))
        THEN REPEAT i := 1 TO HIINDEX(thing\Atomic_formula.terms);
                accum := local_vars_aux(thing\Atomic_formula.terms[i],accum);
             END_REPEAT;
        ELSE IF ('PRODUCTION_RULE_ARM.SIMPLE_CLAUSE' IN TYPEOF(thing))
             THEN REPEAT j := 1 TO HIINDEX(thing.formulas);
                        accum := local_vars_aux(thing.formulas[j],accum);
                  END_REPEAT;
             ELSE IF ('PRODUCTION_RULE_ARM.COMPLEX_CLAUSE' IN TYPEOF(thing))
                  THEN REPEAT k := 1 TO HIINDEX(thing.clauses);
                        accum := local_vars_aux(thing.clauses[k],accum);
                       END_REPEAT;
                  END_IF;
             END_IF;
        END_IF;
  END_IF;
  RETURN(accum);
         END_FUNCTION;
         
(*
         Argument definitions:
thing: specified entity instance.
accum: the specified set of Scalar_variables.
EXPRESS specification:
         *)
         FUNCTION local_vars_of (thing : GENERIC) : SET[0:?] OF Scalar_variable;
         LOCAL
    accum : SET [0:?] OF Scalar_variable := [];
  END_LOCAL;
  RETURN (local_vars_aux(thing, accum));
         END_FUNCTION;
         
(*
         Argument definitions:
thing: specified entity instance.
This subclause specifies the ARM rules for this module. The ARM rules and definitions are specified below.
EXPRESS specification:
         *)
         RULE max_one_entity_prefix FOR
         
         
         (Enum_reference_prefix);
WHERE
 
           WR1: SIZEOF(QUERY(x <* Enum_reference_prefix | TRUE)) <= 1;
         END_RULE;
         
(*
         Argument definitions:
Enum_reference_prefix : the set of all instances of Enum_reference_prefix.
Formal propositions:
WR1: There shall be no more than one instance of type Enum_reference_prefix in population of entity instances.
EXPRESS specification:
         *)
         RULE rule_software_definition_constraint FOR
         
         
         (Product_view_definition);
WHERE
 
           WR1: SIZEOF (QUERY ( pvd <* Product_view_definition | ( NOT('PRODUCTION_RULE_ARM.' + 'RULE_SOFTWARE_DEFINITION' 
         IN TYPEOF(pvd))) 
         AND ('PRODUCTION_RULE_ARM.' + 'RULE_VERSION' IN TYPEOF (pvd . defined_version)))) = 0;
         END_RULE;
         
(*
         Argument definitions:
Product_view_definition : the set of all instances of Product_view_definition.
Formal propositions:
WR1: There shall not be any instance of Product_view_definition that refers Rule_version as defined_version and is not an instance of Rule_software_definition.
EXPRESS specification:
         *)
         RULE rule_version_constraint FOR
         
         
         (Product_version);
WHERE
 
           WR1: SIZEOF (QUERY(pv <* Product_version | (NOT('PRODUCTION_RULE_ARM.' + 'RULE_VERSION' IN TYPEOF(pv))) 
         AND ( 'PRODUCTION_RULE_ARM.' + 'RULE_PRODUCT' IN TYPEOF(pv.of_product)))) = 0;
         END_RULE;
         
(*
         Argument definitions:
Product_version : the set of all instances of Product_version.
Formal propositions:
WR1: There shall not be any instance of Product_version that refers Rule_product as of_product and is not an instance of Rule_version.
         *)
         END_SCHEMA;  -- Production_rule_arm
(*
         © ISO 2019 — All rights reserved