FUNCTION equal_maths_values

(* SCHEMA step_merged_ap_schema; *)
-- IN AP242
FUNCTION equal_maths_values
      (val1 : maths_value;
       val2 : maths_value ) : LOGICAL;
      FUNCTION mem_of_vs
         (val1 : maths_value;
          val2 : maths_value ) : LOGICAL;
         IF NOT has_values_space(val2) THEN
            RETURN (UNKNOWN);
         END_IF;
         IF NOT member_of(val1, values_space_of(val2)) THEN
            RETURN (FALSE);
         END_IF;
         RETURN (UNKNOWN);
      END_FUNCTION;
   LOCAL
      types1 : SET OF STRING;
      types2 : SET OF STRING;
      list1 : LIST OF maths_value;
      list2 : LIST OF maths_value;
      cum : LOGICAL := TRUE;
   END_LOCAL;
      IF NOT EXISTS(val1) OR NOT EXISTS(val2) THEN
         RETURN (FALSE);
      END_IF;
      IF val1 = val2 THEN
         RETURN (TRUE);
      END_IF;
      types1 := stripped_typeof(val1);
      types2 := stripped_typeof(val2);
      IF ('MATHS_ATOM' IN types1) OR ('COMPLEX_NUMBER_LITERAL' IN types1) THEN
         IF 'MATHS_ATOM' IN types2 THEN
            RETURN (FALSE);
         END_IF;
         IF 'COMPLEX_NUMBER_LITERAL' IN types2 THEN
            RETURN (FALSE);
         END_IF;
         IF 'LIST' IN types2 THEN
            RETURN (FALSE);
         END_IF;
         IF 'MATHS_SPACE' IN types2 THEN
            RETURN (FALSE);
         END_IF;
         IF 'MATHS_FUNCTION' IN types2 THEN
            RETURN (FALSE);
         END_IF;
         IF 'GENERIC_EXPRESSION' IN types2 THEN
            RETURN (mem_of_vs(val1, val2));
         END_IF;
         RETURN (UNKNOWN);
      END_IF;
      IF ('MATHS_ATOM' IN types2) OR ('COMPLEX_NUMBER_LITERAL' IN types2) THEN
         RETURN (equal_maths_values(val2, val1));
      END_IF;
      IF 'LIST' IN types1 THEN
         IF 'LIST' IN types2 THEN
            list1 := val1;
            list2 := val2;
            IF SIZEOF(list1) <> SIZEOF(list2) THEN
               RETURN (FALSE);
            END_IF;
            REPEAT i := 1 TO SIZEOF(list1) BY 1;
               cum := cum AND equal_maths_values(list1[i], list2[i]);
               IF cum = FALSE THEN
                  RETURN (FALSE);
               END_IF;
            END_REPEAT;
            RETURN (cum);
         END_IF;
         IF 'MATHS_SPACE' IN types2 THEN
            RETURN (FALSE);
         END_IF;
         IF 'MATHS_FUNCTION' IN types2 THEN
            RETURN (FALSE);
         END_IF;
         IF 'GENERIC_EXPRESSION' IN types2 THEN
            RETURN (mem_of_vs(val1, val2));
         END_IF;
         RETURN (UNKNOWN);
      END_IF;
      IF 'LIST' IN types2 THEN
         RETURN (equal_maths_values(val2, val1));
      END_IF;
      IF 'MATHS_SPACE' IN types1 THEN
         IF 'MATHS_SPACE' IN types2 THEN
            RETURN (equal_maths_spaces(val1, val2));
         END_IF;
         IF 'MATHS_FUNCTION' IN types2 THEN
            RETURN (FALSE);
         END_IF;
         IF 'GENERIC_EXPRESSION' IN types2 THEN
            RETURN (mem_of_vs(val1, val2));
         END_IF;
         RETURN (UNKNOWN);
      END_IF;
      IF 'MATHS_SPACE' IN types2 THEN
         RETURN (equal_maths_values(val2, val1));
      END_IF;
      IF 'MATHS_FUNCTION' IN types1 THEN
         IF 'MATHS_FUNCTION' IN types2 THEN
            RETURN (equal_maths_functions(val1, val2));
         END_IF;
         IF 'GENERIC_EXPRESSION' IN types2 THEN
            RETURN (mem_of_vs(val1, val2));
         END_IF;
         RETURN (UNKNOWN);
      END_IF;
      IF 'MATHS_FUNCTION' IN types2 THEN
         RETURN (equal_maths_values(val2, val1));
      END_IF;
      IF ('GENERIC_EXPRESSION' IN types1) AND ('GENERIC_EXPRESSION' IN types2) THEN
         IF NOT has_values_space(val1) OR NOT has_values_space(val2) THEN
            RETURN (UNKNOWN);
         END_IF;
         IF NOT compatible_spaces(values_space_of(val1), values_space_of(val2)) THEN
            RETURN (FALSE);
         END_IF;
      END_IF;
      RETURN (UNKNOWN);
END_FUNCTION;

Referenced By

Defintion equal_maths_values is references by the following definitions:
DefinitionType
 member_of FUNCTION
 simplify_function_application FUNCTION


[Top Level Definitions] [Exit]

Generated by STEP Tools® EXPRESS to HTML Converter
2017-01-19T11:17:24-05:00