diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..1892127 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,131 @@ +--- +name: Lint Code Base + +on: + push: + branches: + [main, master] + pull_request: + branches: + [main, master] + workflow_dispatch: + +jobs: + flutter: + name: Flutter Build + runs-on: ubuntu-latest + env: + FLUTTER_VERSION: "3.13.5" + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Flutter Actions + uses: subosito/flutter-action@v2 + with: + channel: stable + flutter-version: 3.13.5 + cache: true + + - run: | + cd frontend + flutter --version + flutter pub get + flutter analyze + + + python: + name: Python Lint + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: 3.11 + cache: 'pip' + + - name: Install dependencies + run: | + cd engine + python --version + python -m pip install --upgrade pip + pip install flake8 pylint pytest + + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py') + + - name: Lint with flake8 + run: | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + + java: + name: Java Build and Test + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 17 + # cache: 'maven' + + # - name: Build with Maven + # run: mvn -B package --file pom.xml + + - run: | + cd backend/src + javac Main.java + # ./mvnw clean install # Assuming you have a Maven wrapper script (mvnw) in your repository + # Additional steps for testing and other build tasks as needed + + + + +# run-lint: +# name: Run Lint +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# with: +# fetch-depth: 0 + +# - name: Setup Flutter SDK +# uses: flutter-actions/setup-flutter@v2 +# with: +# channel: stable +# version: 3.13.5 +# cache: true + +# - uses: subosito/flutter-action@v2 +# with: +# channel: stable +# flutter-version: 3.13.5 +# # cache: true + +# - run: flutter --version + +# - name: Install dependencies +# run: flutter pub get + +# - name: Lint Code Base +# uses: github/super-linter@v4 +# env: +# VALIDATE_ALL_CODEBASE: false +# DEFAULT_BRANCH: main +# GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} +# # SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000..f3c2085 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,25 @@ +--- +name: Pylint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + # python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.11"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py') diff --git a/CODEOWNERS b/CODEOWNERS index 636f4ab..92a3e1f 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,2 +1,3 @@ # Default Reviewer + * @skulos diff --git a/LICENSE b/LICENSE index a6dbb9d..31598cb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -MIT License +# MIT License -Copyright (c) 2022 Hendre Hayman and Zander Kotze +Copyright (c) 2023 Zander Kotze and Hendre Hayman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index f6d03b2..b77e09c 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,41 @@ # verbose-adventure + This is 3 Way Propositional Logic Truth Table Generator that takes an input statement and returns a processed truth table. -Add a list of things that is used for the module such as intellij, python, etc. +[![GitHub Super-Linter](https://github.com/ZanderCowboy/verbose-adventure/actions/workflows/linter.yml/badge.svg)](https://github.com/marketplace/actions/super-linter) + +[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis) ## Dependencies ## Recommended IDE Setup -- IntelliJ + +- IntelliJ +- VS Code +- Android Studio (This is optional which can be used with the UI) ## Project Setup + ### Engine + The engine uses Python 3.11 in a virtual environment ### Backend -The backend uses Java JDK 17 and greater. + +The backend uses Java JDK 17 or greater. ### Frontend -The frontend uses Flutter and Dart SDK. + +The frontend uses the latest version of Flutter and Dart SDK. Android Studio? ### Importing into IntelliJ -Instruction to import the project into IntelliJ +Instruction to import the project into IntelliJ ## Technology Stack + - Flutter - Python - Java -- GRPC \ No newline at end of file +- GRPC diff --git a/backend/README.md b/backend/README.md index 175b668..d0352ce 100644 --- a/backend/README.md +++ b/backend/README.md @@ -3,6 +3,6 @@ A Java HTTP server with a gRPC client to talk to the Python Backend on behalf of the Flutter Frontend ## JDK version + - 17 - 20 -- diff --git a/Discussion.jpg b/docs/Discussion.jpg similarity index 100% rename from Discussion.jpg rename to docs/Discussion.jpg diff --git a/Flowchart.drawio.svg b/docs/Flowchart.drawio.svg similarity index 100% rename from Flowchart.drawio.svg rename to docs/Flowchart.drawio.svg diff --git a/Untitled Diagram.drawio b/docs/Untitled Diagram.drawio similarity index 100% rename from Untitled Diagram.drawio rename to docs/Untitled Diagram.drawio diff --git a/Untitled Diagram.drawio.svg b/docs/Untitled Diagram.drawio.svg similarity index 100% rename from Untitled Diagram.drawio.svg rename to docs/Untitled Diagram.drawio.svg diff --git a/engine/.gitignore b/engine/.gitignore index 9a5e389..a6a8c76 100644 --- a/engine/.gitignore +++ b/engine/.gitignore @@ -1,6 +1,6 @@ # Project Debugging -/Output/*.log -/Output/*.log.* +/output/*.log +/output/*.log.* # intellij /.idea diff --git a/engine/CHANGELOG.md b/engine/CHANGELOG.md index d5dc87e..3f57eca 100644 --- a/engine/CHANGELOG.md +++ b/engine/CHANGELOG.md @@ -1,18 +1,25 @@ # Changes in code -## V0.0.7 -- Created a new Logging package to contain all logging related code. +## v0.0.8 + +- Ran pylint and fixed all linting issues. +- Fixed imports. +- Added GitHub actions for Engine. + +## v0.0.7 + +- Created a new Logging package to contain all logging related code. - Created logging_config using Python logging, printing logs to console and files - Created log folder and files as Output/engine.log, Output/engine.log.1, etc. - Created a rotator for log files, so that a log history can be kept. - Added logging throughout the code. -- Finished some documentation. -- Refactored code, removing redundant parts. +- Finished some documentation. +- Refactored code, removing redundant parts. - Added more TODOs for later development. -- Created a new generalized printing function in PrintDetails.py used to do -'sections of output' logging +- Created a new generalized printing function in PrintDetails.py used to do 'sections of output' logging ## v0.0.6 + - Created a constants file containing all the constants that is used in the code - Created a new file CreateElements.py, moving the array creation to it and out of CreateConditionals.py @@ -29,19 +36,23 @@ - Deleted DumpFile.py and LogicCalculator.py ## v0.0.5 + - created packages: Components, Computation, GRPCServer, Parser, Simulator, Validation - refactored exiting code and moved it around - IN PROGRESS: added metadata to existing code - tested a try-catch block with Parser.Checks -- created Simulator.SimulateServer.py to simulate the input and responses generated +- created Simulator.SimulateServer.py to simulate the input and responses generated from using the GRPCServer - Moved existing code into single files, following the SOLID principle ## v0.0.2 - v0.0.4 -- Added small changes over time. + +- Added small changes over time. ## v0.0.1 + - needs restructuring ## v0.0.0 -- initial code copied from other project \ No newline at end of file + +- initial code copied from other project diff --git a/engine/Components/create_elements.py b/engine/Components/create_elements.py new file mode 100644 index 0000000..fc3deb5 --- /dev/null +++ b/engine/Components/create_elements.py @@ -0,0 +1,29 @@ +"""_summary_ + +Returns: + _type_: _description_ +""" +from engine_logging.logging_config import logger + + +def create_array_of_elements(statement: str) -> list: + """ + This takes a statement as a string and returns an array of elements + For example: + "(P^Q)" => ['(', 'P', '^', 'Q', ')'] + + :rtype: list + :param statement: string + :return: Returns an array of elements + """ + + logger.debug("Creating an array from a string...") + logger.debug("Calling create_array_of_elements(%s)", statement) + + array_of_elements = [] + for _, char in enumerate(statement): + array_of_elements.append(char) + + logger.debug("array_of_elements=%s", array_of_elements) + logger.debug("Finished creating array.") + return array_of_elements diff --git a/engine/README.md b/engine/README.md index 0bb21a0..fd508c3 100644 --- a/engine/README.md +++ b/engine/README.md @@ -1,71 +1,69 @@ -# verbose-adventure Engine +# Propositional Logic Calculator -This is a Python gRPC server that will calculate the final truth column that -will be sent back -** Add some details ** - -## Propositional Logic Calculator +## verbose-adventure Engine -Random Repository - -Propositional Logic Calculator. +This is a Python gRPC server that will calculate the final truth column that +will be sent back +*Add some details* ## Description + Use LogicCalculator to do all the relevant checks and calculations +## GRPCServer Package -# GRPCServer Package To follow This package is responsible for communicating with the GRPC client on the backend side but also calling the necessary packages. -### Calling sequence for the packages with a perfect flow. +### Calling sequence for the packages with a perfect flow +## SIMULATOR Package -# SIMULATOR Package This is responsible for simulating the input that is sent from the Backend. This includes the User Input and input statements. +## PARSER Package + +### Check Errors -# PARSER Package -## Check Errors - Checking for invalid characters such as @, etc. - Checking for unequal number of opening and closing brackets. This takes a string and runs through it to determine if there are any illegal characters and also checks that the number of opening and closing brackets -are equal. +are equal. -- If the string is successful, it is sent to the next section that will do the +- If the string is successful, it is sent to the next section that will do the parsing, turning it from a string into an array. - If not, an appropriate error message is send back to the GRPC Server to handle. -## Parse String -### String to Simple Array +### Parse String + +#### String to Simple Array -### Processing Connectives in Array +#### Processing Connectives in Array -### Restructuring Array into Tree Structured Array +#### Restructuring Array into Tree Structured Array +### Validation -## Validation -### Processing Connectives +#### Processing Connectives -### Processing Brackets +#### Processing Brackets +## VALIDATOR Package -# VALIDATOR Package -## Logic Rules +### Logic Rules -## Connectives +### Connectives +## COMPUTATION Package -# COMPUTATION Package -## Propositional Rules +### Propositional Rules -## +## Flow -# Flow Start with the GRPCServer - First checks as pre-flight @@ -73,4 +71,4 @@ Start with the GRPCServer - If good, proceed: - GRPCServer Parser => checks, parse, validate - If good, proceed: -- GRPCServer Compute => compute \ No newline at end of file +- GRPCServer Compute => compute diff --git a/engine/components/constants.py b/engine/components/constants.py index 9ca30a5..c4a476f 100644 --- a/engine/components/constants.py +++ b/engine/components/constants.py @@ -2,12 +2,12 @@ # Global Variables LEFT_BRACKETS = "({[" RIGHT_BRACKETS = ")}]" -BINARY_CONNECTIVES = ['^', 'v', '->', '<->'] -UNARY_CONNECTIVES = ['!'] +BINARY_CONNECTIVES = ["^", "v", "->", "<->"] +UNARY_CONNECTIVES = ["!"] # Constants used in the Computation package -TRUE = 'T' -FALSE = 'F' +TRUE = "T" +FALSE = "F" # Constants used in the Components package VALID_BRACKETS = "(){}[]" @@ -16,12 +16,12 @@ WHITE_SPACES = " " # Constants used in create_conditionals.py -OPEN_ARROW = '<' -DASH = '-' -CLOSE_ARROW = '>' +OPEN_ARROW = "<" +DASH = "-" +CLOSE_ARROW = ">" COND_ELEM = "->" BICOND_ELEM = "<->" -PRE_CHECK = ['<', '-', '>'] +PRE_CHECK = ["<", "-", ">"] # What are illegal characters diff --git a/engine/components/create_conditionals.py b/engine/components/create_conditionals.py index 4b44675..09001a0 100644 --- a/engine/components/create_conditionals.py +++ b/engine/components/create_conditionals.py @@ -1,5 +1,8 @@ -""" Insert """ -from engine_logging.logging_config import logger +"""_summary_ + +Returns: + _type_: _description_ +""" from components.constants import ( OPEN_ARROW, DASH, @@ -8,6 +11,7 @@ BICOND_ELEM, PRE_CHECK, ) +from engine_logging.logging_config import logger def create_conditionals(array_of_elements: list) -> list: diff --git a/engine/components/create_elements.py b/engine/components/create_elements.py index 1099e12..fc3deb5 100644 --- a/engine/components/create_elements.py +++ b/engine/components/create_elements.py @@ -1,4 +1,8 @@ -""" Insert """ +"""_summary_ + +Returns: + _type_: _description_ +""" from engine_logging.logging_config import logger @@ -12,6 +16,7 @@ def create_array_of_elements(statement: str) -> list: :param statement: string :return: Returns an array of elements """ + logger.debug("Creating an array from a string...") logger.debug("Calling create_array_of_elements(%s)", statement) diff --git a/engine/components/find_variables.py b/engine/components/find_variables.py index 83afe03..9b71a8c 100644 --- a/engine/components/find_variables.py +++ b/engine/components/find_variables.py @@ -1,6 +1,10 @@ -""" Insert """ -from components.constants import VALID_BRACKETS, VALID_CONNECTIVES +"""_summary_ + +Returns: + _type_: _description_ +""" from engine_logging.logging_config import logger +from components.constants import VALID_BRACKETS, VALID_CONNECTIVES def find_variables(statement: str) -> list: @@ -20,10 +24,13 @@ def find_variables(statement: str) -> list: variables_array = [] variables_string = "" non_variable_characters = VALID_BRACKETS + VALID_CONNECTIVES + i: int for i, char in enumerate(statement): duplicate = False - if char not in non_variable_characters: # if char is not a bracket or a connective + if ( + char not in non_variable_characters + ): # if char is not a bracket or a connective # Testing for duplicates duplicate_int = statement.find(char, i + 1) var_str_find = variables_string.find(char) diff --git a/engine/components/print_details.py b/engine/components/print_details.py index d91a250..c27bb46 100644 --- a/engine/components/print_details.py +++ b/engine/components/print_details.py @@ -1,4 +1,5 @@ -""" Insert """ +"""_summary_ +""" from engine_logging.logging_config import logger @@ -20,7 +21,13 @@ def print_details(name: str, *args): max_length = 60 len_name = len(name) amount_stars = max_length - len_name - star_line = "*" * int(amount_stars/2) + " " + name.upper() + " " + "*" * int(amount_stars/2) + star_line = ( + "*" * int(amount_stars / 2) + + " " + + name.upper() + + " " + + "*" * int(amount_stars / 2) + ) logger.info(star_line) for arg_name, arg_value in args: diff --git a/engine/components/regular_expression.py b/engine/components/regular_expression.py index 7f4af22..e57888f 100644 --- a/engine/components/regular_expression.py +++ b/engine/components/regular_expression.py @@ -1,4 +1,8 @@ -""" Insert """ +"""_summary_ + +Returns: + _type_: _description_ +""" import re from engine_logging.logging_config import logger @@ -13,8 +17,8 @@ def validate_input(input_string: str) -> bool: Returns: bool: _description_ """ - logger.debug("Calling validate_input(%s)...", input_string) + pattern = r"^(?:[a-zA-Z](?:_\d+)?|[a-zA-Z])$|[\^v!<>-]" result = re.fullmatch(pattern, input_string) is not None diff --git a/engine/computation/evaluate_statement.py b/engine/computation/evaluate_statement.py index 49fd366..4ea069d 100644 --- a/engine/computation/evaluate_statement.py +++ b/engine/computation/evaluate_statement.py @@ -1,4 +1,5 @@ """ Insert """ +from dataclasses import dataclass from math import log2 from computation.switch_connectives import switch_case @@ -6,6 +7,18 @@ from engine_logging.logging_config import logger +@dataclass +class Pieces: + """_summary_ + """ + variables: list + left_array: list + right_array: list + connective: str + matrix: list + counter: int + + def evaluate_array_as_tree(number_of_variables, variables_as_array, elements_in_tree): """ This is used to take an array of elements in a tree-like structure, and @@ -36,7 +49,9 @@ def evaluate_array_as_tree(number_of_variables, variables_as_array, elements_in_ final_variable_combined, returned_matrix, all_variables, - ) = evaluate_array(elements_in_tree, counter, matrix, variables_as_array) + ) = evaluate_array( + elements_in_tree, counter, matrix, variables_as_array + ) # type: ignore all_variables.append(final_variable_combined[0]) @@ -76,44 +91,71 @@ def evaluate_array(array: list, counter: int, matrix: list, variables: list): # induction case # ******************* LEFT ************************ if len(left_array) != 1: - temp_left_array = left_array + # temp_left_array = left_array counter += 1 + # array_evaluated, left_array, _, _ = evaluate_array( + # temp_left_array, counter, matrix, variables + # ) array_evaluated, left_array, _, _ = evaluate_array( - temp_left_array, counter, matrix, variables + left_array, counter, matrix, variables ) counter -= 1 variables = add_array_to_matrix(matrix, array_evaluated, variables, left_array) # ******************* RIGHT ************************ if len(right_array) != 1: - temp_right_array = right_array + # temp_right_array = right_array counter += 1 + # array_evaluated, right_array, _, _ = evaluate_array( + # temp_right_array, counter, matrix, variables + # ) array_evaluated, right_array, _, _ = evaluate_array( - temp_right_array, counter, matrix, variables + right_array, counter, matrix, variables ) counter -= 1 variables = add_array_to_matrix(matrix, array_evaluated, variables, right_array) # ******************** BASE CASE ************************ + pieces = Pieces(variables=variables, left_array=left_array, right_array=right_array, + connective=connective, matrix=matrix, counter=counter) + return base_case(pieces) + + +# def base_case(variables, piece: Pieces, matrix, counter): +def base_case(base: Pieces): + """_summary_ + + Args: + variables (_type_): _description_ + left_array (_type_): _description_ + right_array (_type_): _description_ + connective (_type_): _description_ + matrix (_type_): _description_ + counter (_type_): _description_ + + Returns: + _type_: _description_ + """ + left_array = base.left_array + right_array = base.right_array + matrix = base.matrix + final_variable_combined = [] if len(left_array) == 1 and len(right_array) == 1: # find variables for left and right - left_variable = left_array[0] - right_variable = right_array[0] - left_variable_position = -1 right_variable_position = -1 # get position for variable in list of variables as a string - for i, item in enumerate(variables): - if left_variable == item: + for i, item in enumerate(base.variables): + if left_array[0] == item: left_variable_position = i break - for i, item in enumerate(variables): - if right_variable == item: + for i, item in enumerate(base.variables): + if right_array[0] == item: right_variable_position = i break @@ -124,14 +166,15 @@ def evaluate_array(array: list, counter: int, matrix: list, variables: list): row_in_matrix = matrix[i] temp_left.append(row_in_matrix[left_variable_position]) temp_right.append(row_in_matrix[right_variable_position]) - returned_array = switch_case(connective, temp_left, temp_right) + + returned_array = switch_case(base.connective, temp_left, temp_right) # get array item for combined variable if len(left_array) == 1 and len(right_array) == 1: - temp_array = [left_array, connective, right_array] + temp_array = [left_array, base.connective, right_array] final_variable_combined = set_new_array_elem(temp_array) - if len(final_variable_combined) == 1 and counter == 0: + if len(final_variable_combined) == 1 and base.counter == 0: # append returned_array to matrix for i, entry_in_return_array in enumerate(returned_array): matrix[i].append(entry_in_return_array) @@ -142,15 +185,18 @@ def evaluate_array(array: list, counter: int, matrix: list, variables: list): returned_array, final_variable_combined, matrix, - variables, + base.variables, ) logger.debug("Evaluation of array in evaluate_array() is done.") - return returned_array, final_variable_combined, matrix, variables + return returned_array, final_variable_combined, matrix, base.variables - logger.debug("**** ERROR! **** \n This should not be reached. " - "Inspect evaluate_array in evaluate_statement.py") + logger.debug( + "**** ERROR! **** \n This should not be reached. " + "Inspect evaluate_array in evaluate_statement.py" + ) return None + def set_new_array_elem(temp_array): """ This is used to set a new array-element from a temporary array of elements diff --git a/engine/computation/table_matrix/display_matrix.py b/engine/computation/table_matrix/display_matrix.py index 15f0c9a..e3f2fba 100644 --- a/engine/computation/table_matrix/display_matrix.py +++ b/engine/computation/table_matrix/display_matrix.py @@ -3,7 +3,7 @@ def display_matrix( - number_of_variables: int, returned_matrix: list, all_variables: list + nr_of_vars: int, returned_matrix: list, all_variables: list ) -> None: """_summary_ @@ -14,25 +14,18 @@ def display_matrix( """ logger.debug("Displaying matrix to console...") - auxiliary_variables = [] # Holds all the placeholder variables - for i in range(number_of_variables, len(all_variables) - 1): - auxiliary_variables.append(all_variables[i]) - number_of_aux_variables = len(auxiliary_variables) + aux_vars = [] # Holds all the placeholder variables + for i in range(nr_of_vars, len(all_variables) - 1): + aux_vars.append(all_variables[i]) + number_of_aux_variables = len(aux_vars) # prints part for variables - print("| ", end="") - for j in range(number_of_variables): - if j != number_of_variables - 1: - print(all_variables[j] + " | ", end="") - else: - print(all_variables[j] + " || ", end="") + print_variables(nr_of_vars, all_variables) # prints auxiliary variables - index_between_auxiliary_variables_and_last = number_of_variables + len( - auxiliary_variables - ) - for j in range(number_of_variables, index_between_auxiliary_variables_and_last): - if j != index_between_auxiliary_variables_and_last - 1: + idx_between_aux_vars_and_last = nr_of_vars + len(aux_vars) + for j in range(nr_of_vars, idx_between_aux_vars_and_last): + if j != idx_between_aux_vars_and_last - 1: print(all_variables[j] + " | ", end="") else: print(all_variables[j] + " || ", end="") @@ -43,7 +36,7 @@ def display_matrix( print("\n", end="") count_characters = get_number_of_spaces( - number_of_variables, number_of_aux_variables, all_variables + nr_of_vars, number_of_aux_variables, all_variables ) print("=" * count_characters) @@ -52,45 +45,36 @@ def display_matrix( print("| ", end="") # prints part for variables - for j in range(number_of_variables): - if j != number_of_variables - 1: + for j in range(nr_of_vars): + if j != nr_of_vars - 1: print(row[j] + " | ", end="") else: print(row[j] + " || ", end="") # prints auxiliary variables - index_between_auxiliary_variables_and_last = number_of_variables + len( - auxiliary_variables - ) - for j in range(number_of_variables, index_between_auxiliary_variables_and_last): - if j != index_between_auxiliary_variables_and_last - 1: - print(row[j] + " | ", end="") - else: - temp_length = len(all_variables[j]) - add_len = 0 - if temp_length % 2 == 1: # odd - add_len = temp_length / 2 + 1 - add_space = "" - for _ in range(int(add_len)): - add_space += " " - print(row[j] + add_space + " || ", end="") + print_aux_vars(nr_of_vars, aux_vars, row, all_variables) # prints last column - temp_length = len(all_variables[-1]) - add_len = 0 - if temp_length % 2 == 1: # odd - add_len = temp_length / 2 + 1 - elif temp_length % 2 == 0: # even - add_len = temp_length / 2 - add_space = "" - for _ in range(int(add_len)): - add_space += " " - print(row[-1] + add_space + " || ", end="") - print("\n", end="") + print_last_column(all_variables, row) print("=" * count_characters) +def print_variables(number_of_variables, all_variables): + """_summary_ + + Args: + number_of_variables (_type_): _description_ + all_variables (_type_): _description_ + """ + print("| ", end="") + for j in range(number_of_variables): + if j != number_of_variables - 1: + print(all_variables[j] + " | ", end="") + else: + print(all_variables[j] + " || ", end="") + + def get_number_of_spaces( number_of_variables: int, nr_auxiliary_variables: int, all_variables: list ) -> int: @@ -139,3 +123,47 @@ def get_number_of_spaces( logger.debug("total_space=%d", total_space) logger.debug("Finished calculating the total space.") return total_space + + +def print_aux_vars(number_of_variables, auxiliary_variables, row, all_variables): + """_summary_ + + Args: + number_of_variables (_type_): _description_ + auxiliary_variables (_type_): _description_ + row (_type_): _description_ + all_variables (_type_): _description_ + """ + idx_between_aux_vars_and_last = number_of_variables + len(auxiliary_variables) + for j in range(number_of_variables, idx_between_aux_vars_and_last): + if j != idx_between_aux_vars_and_last - 1: + print(row[j] + " | ", end="") + else: + temp_length = len(all_variables[j]) + add_len = 0 + if temp_length % 2 == 1: # odd + add_len = temp_length / 2 + 1 + add_space = "" + for _ in range(int(add_len)): + add_space += " " + print(row[j] + add_space + " || ", end="") + + +def print_last_column(all_variables, row): + """_summary_ + + Args: + all_variables (_type_): _description_ + row (_type_): _description_ + """ + temp_length = len(all_variables[-1]) + add_len = 0 + if temp_length % 2 == 1: # odd + add_len = temp_length / 2 + 1 + elif temp_length % 2 == 0: # even + add_len = temp_length / 2 + add_space = "" + for _ in range(int(add_len)): + add_space += " " + print(row[-1] + add_space + " || ", end="") + print("\n", end="") diff --git a/engine/engine_logging/logging_config.py b/engine/engine_logging/logging_config.py index 0eda338..73deb61 100644 --- a/engine/engine_logging/logging_config.py +++ b/engine/engine_logging/logging_config.py @@ -4,8 +4,8 @@ MAX_LOG_FILES = 10 -LOG_FILE_NAME = 'engine.log' -log_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'Output') +LOG_FILE_NAME = "engine.log" +log_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "output") log_file = os.path.join(log_folder, LOG_FILE_NAME) # Create the Output directory if it doesn't exist @@ -14,27 +14,31 @@ if os.path.exists(log_file): for i in range(MAX_LOG_FILES - 1, 0, -1): # starts from 9 moving down to 0 - current_file = f'{log_file}.{i}' - next_file = f'{log_file}.{i + 1}' + current_file = f"{log_file}.{i}" + next_file = f"{log_file}.{i + 1}" if os.path.exists(current_file): - if os.path.exists(log_file + '.' + str(MAX_LOG_FILES)): - os.remove(log_file + '.' + str(MAX_LOG_FILES)) # this will be next_file + if os.path.exists(log_file + "." + str(MAX_LOG_FILES)): + os.remove(log_file + "." + str(MAX_LOG_FILES)) # this will be next_file os.rename(current_file, next_file) - os.rename(log_file, f'{log_file}.1') + os.rename(log_file, f"{log_file}.1") # Configure the logger -logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s\t- %(message)s') +logging.basicConfig( + level=logging.INFO, format="%(asctime)s - %(levelname)s\t- %(message)s" +) # logging.basicConfig(level=logging.DEBUG, # format='%(asctime)s - %(levelname)s\t- %(funcName)s - %(message)s') # Create a logger instance -logger = logging.getLogger('engine_logger') +logger = logging.getLogger("engine_logger") # Create a file handler to write logs to a file file_handler = logging.FileHandler(log_file) -file_formatter = logging.Formatter('%(asctime)s - %(levelname)s\t- %(funcName)s - %(message)s') +file_formatter = logging.Formatter( + "%(asctime)s - %(levelname)s\t- %(funcName)s - %(message)s" +) # file_formatter = logging.Formatter('%(asctime)s - %(levelname)s\t- %(message)s') file_handler.setFormatter(file_formatter) file_handler.setLevel(logging.DEBUG) diff --git a/engine/engine_parser/parse/parse_function.py b/engine/engine_parser/parse/parse_function.py index 50f563d..80f1f9d 100644 --- a/engine/engine_parser/parse/parse_function.py +++ b/engine/engine_parser/parse/parse_function.py @@ -6,8 +6,10 @@ UNARY_CONNECTIVES, BINARY_CONNECTIVES, ) -from components.sanitizer import add_brackets_around_unary_connectives -from components.sanitizer import remove_brackets_around_variables +from components.sanitizer import ( + add_brackets_around_unary_connectives, + remove_brackets_around_variables, +) from components.print_details import print_details from engine_logging.logging_config import logger @@ -39,8 +41,10 @@ def parse_array(elements: list, variables: list): logger.info("Finished parsing array.") return tree_structured_array - logger.debug("**** ERROR! **** \n This should not be reached. " - "Inspect parse_array in parse_function.py") + logger.debug( + "**** ERROR! **** \n This should not be reached. " + "Inspect parse_array in parse_function.py" + ) return None @@ -81,7 +85,7 @@ def parse(arr): # Private Method # ******************* RIGHT *********************** right = [] - arr_right = arr[position_middle + 1 :] + arr_right = arr[position_middle + 1:] if len(arr_right) > 1: if arr_right[0] in LEFT_BRACKETS: right = parse(arr_right) @@ -141,6 +145,8 @@ def find_connective(arr): # Private Method logger.debug("Found connective.") return elem, i - logger.debug("**** ERROR! **** \n This should not be reached. " - "Inspect find_connective in parse_function.py") + logger.debug( + "**** ERROR! **** \n This should not be reached. " + "Inspect find_connective in parse_function.py" + ) return None diff --git a/engine/engine_parser/validate/README.md b/engine/engine_parser/validate/README.md index 8f3059e..407dd77 100644 --- a/engine/engine_parser/validate/README.md +++ b/engine/engine_parser/validate/README.md @@ -5,4 +5,3 @@ ## Logic Rules ## Connectives - diff --git a/engine/examples/keep_these/engine.log.1 b/engine/examples/keep_these/engine.log.1 new file mode 100644 index 0000000..e0d8ba4 --- /dev/null +++ b/engine/examples/keep_these/engine.log.1 @@ -0,0 +1,44 @@ +2023-10-10 15:22:17,211 - INFO - - Starting Engine... +2023-10-10 15:22:17,211 - INFO - simulate_main - Statement: (T v (P ^ Q)) +2023-10-10 15:22:17,211 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-10-10 15:22:17,211 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 15:22:17,211 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-10-10 15:22:17,211 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-10-10 15:22:17,211 - INFO - user_input - Processing statement... +2023-10-10 15:22:17,211 - INFO - analyze_statement - Starting to analyze statement... +2023-10-10 15:22:17,211 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-10-10 15:22:17,211 - INFO - find_variables - Finding variables in statement... +2023-10-10 15:22:17,211 - INFO - find_variables - Found all variables in statement. +2023-10-10 15:22:17,211 - INFO - find_variables - *** Variables: ['T', 'P', 'Q'] *** +2023-10-10 15:22:17,211 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-10-10 15:22:17,211 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 15:22:17,211 - INFO - print_details - -> Number of Variables: 3 +2023-10-10 15:22:17,211 - INFO - print_details - -> Variables: ['T', 'P', 'Q'] +2023-10-10 15:22:17,212 - INFO - print_details - -> Array of Elements: ['(', 'T', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 15:22:17,212 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 15:22:17,212 - INFO - analyze_statement - Analyzing concluded. +2023-10-10 15:22:17,212 - INFO - parse_array - Starting to parse array... +2023-10-10 15:22:17,212 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-10-10 15:22:17,212 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 15:22:17,212 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 15:22:17,212 - INFO - print_details - -> Parsed Array: [['T'], 'v', [['P'], '^', ['Q']]] +2023-10-10 15:22:17,212 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 15:22:17,212 - INFO - parse_array - Finished parsing array. +2023-10-10 15:22:17,213 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-10-10 15:22:17,213 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 15:22:17,213 - INFO - print_details - -> number_of_variables: 3 +2023-10-10 15:22:17,213 - INFO - print_details - -> variables_as_array: ['T', 'P', 'Q'] +2023-10-10 15:22:17,213 - INFO - print_details - -> provided_statement: (T v (P ^ Q)) +2023-10-10 15:22:17,213 - INFO - print_details - -> elements_in_tree: [['T'], 'v', [['P'], '^', ['Q']]] +2023-10-10 15:22:17,213 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 15:22:17,213 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-10-10 15:22:17,213 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-10-10 15:22:17,213 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-10-10 15:22:17,213 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 15:22:17,213 - INFO - print_details - -> Statement: (T v (P ^ Q)) +2023-10-10 15:22:17,213 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'T', 'T', 'T', 'F', 'F', 'F'] +2023-10-10 15:22:17,213 - INFO - print_details - -> All Variables: ['T', 'P', 'Q', 'P^Q', 'Tv(P^Q)'] +2023-10-10 15:22:17,213 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'F', 'T'], ['T', 'F', 'F', 'F', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']] +2023-10-10 15:22:17,213 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 15:22:17,213 - INFO - simulate_main - Finished evaluating statement. +2023-10-10 15:22:17,214 - INFO - - Exiting Engine... diff --git a/engine/examples/keep_these/engine.log.2 b/engine/examples/keep_these/engine.log.2 new file mode 100644 index 0000000..839c50c --- /dev/null +++ b/engine/examples/keep_these/engine.log.2 @@ -0,0 +1,20 @@ +2023-10-10 15:20:31,934 - INFO - - Starting Engine... +2023-10-10 15:20:31,934 - INFO - simulate_main - Statement: (T v (P ^ Q)) +2023-10-10 15:20:31,935 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-10-10 15:20:31,935 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 15:20:31,935 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-10-10 15:20:31,935 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-10-10 15:20:31,935 - INFO - user_input - Processing statement... +2023-10-10 15:20:31,935 - INFO - analyze_statement - Starting to analyze statement... +2023-10-10 15:20:31,935 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-10-10 15:20:31,935 - INFO - find_variables - Finding variables in statement... +2023-10-10 15:20:31,935 - INFO - find_variables - Found all variables in statement. +2023-10-10 15:20:31,936 - INFO - find_variables - *** Variables: ['T', 'P', 'Q'] *** +2023-10-10 15:20:31,936 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-10-10 15:20:31,936 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 15:20:31,936 - INFO - print_details - -> Number of Variables: 3 +2023-10-10 15:20:31,936 - INFO - print_details - -> Variables: ['T', 'P', 'Q'] +2023-10-10 15:20:31,936 - INFO - print_details - -> Array of Elements: ['(', 'T', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 15:20:31,936 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 15:20:31,936 - INFO - analyze_statement - Analyzing concluded. +2023-10-10 15:20:31,936 - INFO - parse_array - Starting to parse array... diff --git a/engine/examples/keep_these/engine.log.3 b/engine/examples/keep_these/engine.log.3 new file mode 100644 index 0000000..2011eaa --- /dev/null +++ b/engine/examples/keep_these/engine.log.3 @@ -0,0 +1,1203 @@ +2023-10-10 00:25:30,256 - INFO - - Starting Engine... +2023-10-10 00:25:30,257 - DEBUG - simulate_main - Calling simulate_main()... +2023-10-10 00:25:30,257 - INFO - simulate_main - Statement: (T v (P -> Q)) +2023-10-10 00:25:30,257 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-10-10 00:25:30,257 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets((T v (P -> Q)))... +2023-10-10 00:25:30,257 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,257 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters((T v (P -> Q))) +2023-10-10 00:25:30,258 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-10-10 00:25:30,258 - DEBUG - validate_input - Calling validate_input(T)... +2023-10-10 00:25:30,258 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,258 - DEBUG - validate_input - Calling validate_input(v)... +2023-10-10 00:25:30,258 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,258 - DEBUG - validate_input - Calling validate_input(P)... +2023-10-10 00:25:30,258 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,259 - DEBUG - validate_input - Calling validate_input(-)... +2023-10-10 00:25:30,259 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,259 - DEBUG - validate_input - Calling validate_input(>)... +2023-10-10 00:25:30,259 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,259 - DEBUG - validate_input - Calling validate_input(Q)... +2023-10-10 00:25:30,259 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,259 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-10-10 00:25:30,259 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-10-10 00:25:30,259 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-10-10 00:25:30,259 - INFO - user_input - Processing statement... +2023-10-10 00:25:30,259 - DEBUG - user_input - statement=(T v (P -> Q)) +2023-10-10 00:25:30,260 - INFO - analyze_statement - Starting to analyze statement... +2023-10-10 00:25:30,260 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-10-10 00:25:30,260 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-10-10 00:25:30,260 - DEBUG - clean_whitespaces - Calling clean_whitespaces((T v (P -> Q)))... +2023-10-10 00:25:30,260 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=(Tv(P->Q)) +2023-10-10 00:25:30,260 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-10-10 00:25:30,260 - INFO - find_variables - Finding variables in statement... +2023-10-10 00:25:30,261 - DEBUG - find_variables - statement=(Tv(P->Q)) +2023-10-10 00:25:30,261 - DEBUG - find_variables - variables_array=['T', 'P', 'Q'] +2023-10-10 00:25:30,261 - INFO - find_variables - Found all variables in statement. +2023-10-10 00:25:30,261 - INFO - find_variables - *** Variables: ['T', 'P', 'Q'] *** +2023-10-10 00:25:30,261 - DEBUG - analyze_statement - variables_arr=['T', 'P', 'Q'] +2023-10-10 00:25:30,261 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-10-10 00:25:30,261 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-10-10 00:25:30,261 - DEBUG - create_array_of_elements - Calling create_array_of_elements((Tv(P->Q))) +2023-10-10 00:25:30,262 - DEBUG - create_array_of_elements - array_of_elements=['(', 'T', 'v', '(', 'P', '-', '>', 'Q', ')', ')'] +2023-10-10 00:25:30,262 - DEBUG - create_array_of_elements - Finished creating array. +2023-10-10 00:25:30,262 - DEBUG - check_conditionals - Calling check_conditionals(['(', 'T', 'v', '(', 'P', '-', '>', 'Q', ')', ')'], ['T', 'P', 'Q'])... +2023-10-10 00:25:30,262 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-10-10 00:25:30,262 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-10-10 00:25:30,262 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', 'T', 'v', '(', 'P', '-', '>', 'Q', ')', ')'] +2023-10-10 00:25:30,263 - DEBUG - create_conditionals - Conditional symbols were found in ['(', 'T', 'v', '(', 'P', '-', '>', 'Q', ')', ')'] +2023-10-10 00:25:30,263 - DEBUG - create_conditionals - array_of_elements=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-10-10 00:25:30,263 - DEBUG - create_conditionals - Finished creating conditionals. +2023-10-10 00:25:30,263 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=3, +variables_arr=['T', 'P', 'Q'], +array_of_elements=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-10-10 00:25:30,263 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,264 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,264 - INFO - print_details - -> Number of Variables: 3 +2023-10-10 00:25:30,264 - INFO - print_details - -> Variables: ['T', 'P', 'Q'] +2023-10-10 00:25:30,264 - INFO - print_details - -> Array of Elements: ['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-10-10 00:25:30,264 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,264 - INFO - analyze_statement - Analyzing concluded. +2023-10-10 00:25:30,265 - INFO - parse_array - Starting to parse array... +2023-10-10 00:25:30,265 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-10-10 00:25:30,265 - DEBUG - remove_brackets_around_variables - arr=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-10-10 00:25:30,265 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-10-10 00:25:30,265 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-10-10 00:25:30,265 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-10-10 00:25:30,265 - DEBUG - add_brackets_around_unary_connectives - arr=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-10-10 00:25:30,266 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-10-10 00:25:30,266 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-10-10 00:25:30,266 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-10-10 00:25:30,266 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'])... +2023-10-10 00:25:30,266 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,266 - DEBUG - parse - Calling parse(['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'])... +2023-10-10 00:25:30,266 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'])... +2023-10-10 00:25:30,266 - DEBUG - remove_outer_brackets - array=['T', 'v', '(', 'P', '->', 'Q', ')'] +2023-10-10 00:25:30,267 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,267 - DEBUG - parse - In parse(): arr=['T', 'v', '(', 'P', '->', 'Q', ')'] +2023-10-10 00:25:30,267 - DEBUG - find_connective - Calling find_connectives(['T', 'v', '(', 'P', '->', 'Q', ')'])... +2023-10-10 00:25:30,267 - DEBUG - find_connective - In find_connective(): elem=v, i=1 +2023-10-10 00:25:30,267 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,267 - DEBUG - parse - Calling parse(['(', 'P', '->', 'Q', ')'])... +2023-10-10 00:25:30,268 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', '->', 'Q', ')'])... +2023-10-10 00:25:30,268 - DEBUG - remove_outer_brackets - array=['P', '->', 'Q'] +2023-10-10 00:25:30,268 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,268 - DEBUG - parse - In parse(): arr=['P', '->', 'Q'] +2023-10-10 00:25:30,268 - DEBUG - find_connective - Calling find_connectives(['P', '->', 'Q'])... +2023-10-10 00:25:30,268 - DEBUG - find_connective - In find_connective(): elem=->, i=1 +2023-10-10 00:25:30,268 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,269 - DEBUG - parse - temp_array=[['P'], '->', ['Q']] +2023-10-10 00:25:30,269 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,269 - DEBUG - parse - temp_array=[['T'], 'v', [['P'], '->', ['Q']]] +2023-10-10 00:25:30,269 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,269 - DEBUG - parse_array - tree_structured_array=[['T'], 'v', [['P'], '->', ['Q']]] +2023-10-10 00:25:30,269 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,269 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,270 - INFO - print_details - -> Parsed Array: [['T'], 'v', [['P'], '->', ['Q']]] +2023-10-10 00:25:30,270 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,270 - INFO - parse_array - Finished parsing array. +2023-10-10 00:25:30,270 - DEBUG - user_input - In user_input(): +number_of_variables=3, +variables_as_array=['T', 'P', 'Q'], +statement=(T v (P -> Q)), +new_elements=[['T'], 'v', [['P'], '->', ['Q']]]. +2023-10-10 00:25:30,270 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-10-10 00:25:30,271 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=3, +variables_as_array=['T', 'P', 'Q'], +provided_statement=(T v (P -> Q)), +elements_in_tree=[['T'], 'v', [['P'], '->', ['Q']]] +2023-10-10 00:25:30,271 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,271 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,271 - INFO - print_details - -> number_of_variables: 3 +2023-10-10 00:25:30,271 - INFO - print_details - -> variables_as_array: ['T', 'P', 'Q'] +2023-10-10 00:25:30,271 - INFO - print_details - -> provided_statement: (T v (P -> Q)) +2023-10-10 00:25:30,272 - INFO - print_details - -> elements_in_tree: [['T'], 'v', [['P'], '->', ['Q']]] +2023-10-10 00:25:30,272 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,272 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-10-10 00:25:30,272 - DEBUG - create_matrix - Creating initial matrix... +2023-10-10 00:25:30,272 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,272 - DEBUG - recursive_table - n=3 +2023-10-10 00:25:30,272 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,273 - DEBUG - recursive_table - n=2 +2023-10-10 00:25:30,273 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,273 - DEBUG - recursive_table - n=1 +2023-10-10 00:25:30,273 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-10-10 00:25:30,273 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,273 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-10-10 00:25:30,273 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,273 - DEBUG - recursive_table - array_table=['TTT', 'TTF', 'TFT', 'TFF', 'FTT', 'FTF', 'FFT', 'FFF'] +2023-10-10 00:25:30,274 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,274 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] +2023-10-10 00:25:30,274 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-10-10 00:25:30,274 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-10-10 00:25:30,274 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[['T'], 'v', [['P'], '->', ['Q']]], +counter=0, +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables_as_array=['T', 'P', 'Q'] +2023-10-10 00:25:30,275 - DEBUG - evaluate_array - Calling evaluate_array([['T'], 'v', [['P'], '->', ['Q']]], 0, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'P', 'Q'])... +2023-10-10 00:25:30,275 - DEBUG - evaluate_array - Calling evaluate_array([['P'], '->', ['Q']], 1, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'P', 'Q'])... +2023-10-10 00:25:30,275 - DEBUG - switch_case - Entering switch_case(->, ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,275 - DEBUG - cond - In cond. case... +2023-10-10 00:25:30,276 - DEBUG - conditional - Calling conditional(['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,276 - DEBUG - conditional - new_row_values=['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'] +2023-10-10 00:25:30,276 - DEBUG - conditional - Returning with new row values. +2023-10-10 00:25:30,276 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], '->', ['Q']])... +2023-10-10 00:25:30,276 - DEBUG - set_new_array_elem - new_array=['P->Q'] +2023-10-10 00:25:30,276 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,277 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'], +final_variable_combined=['P->Q'], +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables=['T', 'P', 'Q'] +2023-10-10 00:25:30,277 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,277 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'], ['T', 'P', 'Q'], ['P->Q'])... +2023-10-10 00:25:30,278 - DEBUG - add_array_to_matrix - variables=['T', 'P', 'Q', 'P->Q'] +2023-10-10 00:25:30,278 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,278 - DEBUG - switch_case - Entering switch_case(v, ['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'])... +2023-10-10 00:25:30,278 - DEBUG - disj - In disj. case... +2023-10-10 00:25:30,278 - DEBUG - disjunction - Calling disjunction(['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'])... +2023-10-10 00:25:30,278 - DEBUG - disjunction - new_row_values=['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'] +2023-10-10 00:25:30,279 - DEBUG - disjunction - Returning with new row values. +2023-10-10 00:25:30,279 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['T'], 'v', ['P->Q']])... +2023-10-10 00:25:30,279 - DEBUG - set_new_array_elem - new_array=['Tv(P->Q)'] +2023-10-10 00:25:30,279 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,279 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'], +final_variable_combined=['Tv(P->Q)'], +matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'T', 'T'], ['F', 'F', 'F', 'T', 'T']], +variables=['T', 'P', 'Q', 'P->Q'] +2023-10-10 00:25:30,280 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,280 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'], returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'T', 'T'], ['F', 'F', 'F', 'T', 'T']], all_variables=['T', 'P', 'Q', 'P->Q', 'Tv(P->Q)'] +2023-10-10 00:25:30,280 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-10-10 00:25:30,280 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'], +returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'T', 'T'], ['F', 'F', 'F', 'T', 'T']], +all_variables=['T', 'P', 'Q', 'P->Q', 'Tv(P->Q)'] +2023-10-10 00:25:30,281 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,281 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,281 - INFO - print_details - -> Statement: (T v (P -> Q)) +2023-10-10 00:25:30,281 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'] +2023-10-10 00:25:30,281 - INFO - print_details - -> All Variables: ['T', 'P', 'Q', 'P->Q', 'Tv(P->Q)'] +2023-10-10 00:25:30,281 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'T', 'T'], ['F', 'F', 'F', 'T', 'T']] +2023-10-10 00:25:30,282 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,282 - INFO - simulate_main - Finished evaluating statement. +2023-10-10 00:25:30,282 - DEBUG - display_matrix - Displaying matrix to console... +2023-10-10 00:25:30,282 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(3, 1, ['T', 'P', 'Q', 'P->Q', 'Tv(P->Q)'])... +2023-10-10 00:25:30,282 - DEBUG - get_number_of_spaces - total_space=32 +2023-10-10 00:25:30,283 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-10-10 00:25:30,284 - DEBUG - simulate_main - Returning from simulate_main()... +2023-10-10 00:25:30,284 - INFO - simulate_main - Statement: ((T ^ Q) v (P ^ Q)) +2023-10-10 00:25:30,284 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-10-10 00:25:30,284 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(((T ^ Q) v (P ^ Q)))... +2023-10-10 00:25:30,284 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,285 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters(((T ^ Q) v (P ^ Q))) +2023-10-10 00:25:30,285 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-10-10 00:25:30,285 - DEBUG - validate_input - Calling validate_input(T)... +2023-10-10 00:25:30,285 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,285 - DEBUG - validate_input - Calling validate_input(^)... +2023-10-10 00:25:30,285 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,285 - DEBUG - validate_input - Calling validate_input(Q)... +2023-10-10 00:25:30,286 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,286 - DEBUG - validate_input - Calling validate_input(v)... +2023-10-10 00:25:30,286 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,286 - DEBUG - validate_input - Calling validate_input(P)... +2023-10-10 00:25:30,286 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,286 - DEBUG - validate_input - Calling validate_input(^)... +2023-10-10 00:25:30,286 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,287 - DEBUG - validate_input - Calling validate_input(Q)... +2023-10-10 00:25:30,287 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,287 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-10-10 00:25:30,287 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-10-10 00:25:30,287 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-10-10 00:25:30,287 - INFO - user_input - Processing statement... +2023-10-10 00:25:30,288 - DEBUG - user_input - statement=((T ^ Q) v (P ^ Q)) +2023-10-10 00:25:30,288 - INFO - analyze_statement - Starting to analyze statement... +2023-10-10 00:25:30,288 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-10-10 00:25:30,288 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-10-10 00:25:30,288 - DEBUG - clean_whitespaces - Calling clean_whitespaces(((T ^ Q) v (P ^ Q)))... +2023-10-10 00:25:30,289 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=((T^Q)v(P^Q)) +2023-10-10 00:25:30,289 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-10-10 00:25:30,289 - INFO - find_variables - Finding variables in statement... +2023-10-10 00:25:30,289 - DEBUG - find_variables - statement=((T^Q)v(P^Q)) +2023-10-10 00:25:30,289 - DEBUG - find_variables - variables_array=['T', 'Q', 'P'] +2023-10-10 00:25:30,289 - INFO - find_variables - Found all variables in statement. +2023-10-10 00:25:30,290 - INFO - find_variables - *** Variables: ['T', 'Q', 'P'] *** +2023-10-10 00:25:30,290 - DEBUG - analyze_statement - variables_arr=['T', 'Q', 'P'] +2023-10-10 00:25:30,290 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-10-10 00:25:30,290 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-10-10 00:25:30,290 - DEBUG - create_array_of_elements - Calling create_array_of_elements(((T^Q)v(P^Q))) +2023-10-10 00:25:30,290 - DEBUG - create_array_of_elements - array_of_elements=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,291 - DEBUG - create_array_of_elements - Finished creating array. +2023-10-10 00:25:30,291 - DEBUG - check_conditionals - Calling check_conditionals(['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'], ['T', 'Q', 'P'])... +2023-10-10 00:25:30,291 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-10-10 00:25:30,291 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-10-10 00:25:30,291 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,292 - DEBUG - create_conditionals - Search for conditionals finished and none were found, returning. +2023-10-10 00:25:30,292 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=3, +variables_arr=['T', 'Q', 'P'], +array_of_elements=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,292 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,293 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,293 - INFO - print_details - -> Number of Variables: 3 +2023-10-10 00:25:30,293 - INFO - print_details - -> Variables: ['T', 'Q', 'P'] +2023-10-10 00:25:30,293 - INFO - print_details - -> Array of Elements: ['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,293 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,293 - INFO - analyze_statement - Analyzing concluded. +2023-10-10 00:25:30,295 - INFO - parse_array - Starting to parse array... +2023-10-10 00:25:30,295 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-10-10 00:25:30,295 - DEBUG - remove_brackets_around_variables - arr=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,295 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-10-10 00:25:30,295 - DEBUG - parse_array - In parse_array(): elements_second=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,296 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-10-10 00:25:30,296 - DEBUG - add_brackets_around_unary_connectives - arr=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,296 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-10-10 00:25:30,296 - DEBUG - parse_array - In parse_array(): elements_second=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,296 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-10-10 00:25:30,297 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'])... +2023-10-10 00:25:30,297 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,297 - DEBUG - parse - Calling parse(['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'])... +2023-10-10 00:25:30,297 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'])... +2023-10-10 00:25:30,297 - DEBUG - remove_outer_brackets - array=['(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')'] +2023-10-10 00:25:30,297 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,298 - DEBUG - parse - In parse(): arr=['(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')'] +2023-10-10 00:25:30,298 - DEBUG - find_connective - Calling find_connectives(['(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')'])... +2023-10-10 00:25:30,298 - DEBUG - find_connective - In find_connective(): elem=v, i=5 +2023-10-10 00:25:30,298 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,298 - DEBUG - parse - Calling parse(['(', 'T', '^', 'Q', ')'])... +2023-10-10 00:25:30,298 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'T', '^', 'Q', ')'])... +2023-10-10 00:25:30,299 - DEBUG - remove_outer_brackets - array=['T', '^', 'Q'] +2023-10-10 00:25:30,299 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,299 - DEBUG - parse - In parse(): arr=['T', '^', 'Q'] +2023-10-10 00:25:30,299 - DEBUG - find_connective - Calling find_connectives(['T', '^', 'Q'])... +2023-10-10 00:25:30,299 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-10-10 00:25:30,299 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,299 - DEBUG - parse - temp_array=[['T'], '^', ['Q']] +2023-10-10 00:25:30,300 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,300 - DEBUG - parse - Calling parse(['(', 'P', '^', 'Q', ')'])... +2023-10-10 00:25:30,300 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', '^', 'Q', ')'])... +2023-10-10 00:25:30,300 - DEBUG - remove_outer_brackets - array=['P', '^', 'Q'] +2023-10-10 00:25:30,300 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,300 - DEBUG - parse - In parse(): arr=['P', '^', 'Q'] +2023-10-10 00:25:30,300 - DEBUG - find_connective - Calling find_connectives(['P', '^', 'Q'])... +2023-10-10 00:25:30,300 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-10-10 00:25:30,300 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,300 - DEBUG - parse - temp_array=[['P'], '^', ['Q']] +2023-10-10 00:25:30,300 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,300 - DEBUG - parse - temp_array=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-10-10 00:25:30,301 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,301 - DEBUG - parse_array - tree_structured_array=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-10-10 00:25:30,301 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,301 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,302 - INFO - print_details - -> Parsed Array: [[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-10-10 00:25:30,302 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,302 - INFO - parse_array - Finished parsing array. +2023-10-10 00:25:30,302 - DEBUG - user_input - In user_input(): +number_of_variables=3, +variables_as_array=['T', 'Q', 'P'], +statement=((T ^ Q) v (P ^ Q)), +new_elements=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]]. +2023-10-10 00:25:30,302 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-10-10 00:25:30,302 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=3, +variables_as_array=['T', 'Q', 'P'], +provided_statement=((T ^ Q) v (P ^ Q)), +elements_in_tree=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-10-10 00:25:30,303 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,303 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,303 - INFO - print_details - -> number_of_variables: 3 +2023-10-10 00:25:30,303 - INFO - print_details - -> variables_as_array: ['T', 'Q', 'P'] +2023-10-10 00:25:30,303 - INFO - print_details - -> provided_statement: ((T ^ Q) v (P ^ Q)) +2023-10-10 00:25:30,303 - INFO - print_details - -> elements_in_tree: [[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-10-10 00:25:30,304 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,304 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-10-10 00:25:30,304 - DEBUG - create_matrix - Creating initial matrix... +2023-10-10 00:25:30,304 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,304 - DEBUG - recursive_table - n=3 +2023-10-10 00:25:30,304 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,304 - DEBUG - recursive_table - n=2 +2023-10-10 00:25:30,305 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,305 - DEBUG - recursive_table - n=1 +2023-10-10 00:25:30,305 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-10-10 00:25:30,305 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,305 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-10-10 00:25:30,306 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,306 - DEBUG - recursive_table - array_table=['TTT', 'TTF', 'TFT', 'TFF', 'FTT', 'FTF', 'FFT', 'FFF'] +2023-10-10 00:25:30,306 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,306 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] +2023-10-10 00:25:30,306 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-10-10 00:25:30,306 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-10-10 00:25:30,306 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]], +counter=0, +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables_as_array=['T', 'Q', 'P'] +2023-10-10 00:25:30,307 - DEBUG - evaluate_array - Calling evaluate_array([[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]], 0, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'Q', 'P'])... +2023-10-10 00:25:30,307 - DEBUG - evaluate_array - Calling evaluate_array([['T'], '^', ['Q']], 1, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'Q', 'P'])... +2023-10-10 00:25:30,307 - DEBUG - switch_case - Entering switch_case(^, ['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'])... +2023-10-10 00:25:30,307 - DEBUG - conj - In conj. case... +2023-10-10 00:25:30,307 - DEBUG - conjunction - Calling conjunction(['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'])... +2023-10-10 00:25:30,308 - DEBUG - conjunction - new_row_values=['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'] +2023-10-10 00:25:30,308 - DEBUG - conjunction - Returning with new row values. +2023-10-10 00:25:30,308 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['T'], '^', ['Q']])... +2023-10-10 00:25:30,308 - DEBUG - set_new_array_elem - new_array=['T^Q'] +2023-10-10 00:25:30,308 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,308 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'], +final_variable_combined=['T^Q'], +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables=['T', 'Q', 'P'] +2023-10-10 00:25:30,309 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,309 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'], ['T', 'Q', 'P'], ['T^Q'])... +2023-10-10 00:25:30,309 - DEBUG - add_array_to_matrix - variables=['T', 'Q', 'P', 'T^Q'] +2023-10-10 00:25:30,309 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,309 - DEBUG - evaluate_array - Calling evaluate_array([['P'], '^', ['Q']], 1, [['T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T'], ['T', 'F', 'T', 'F'], ['T', 'F', 'F', 'F'], ['F', 'T', 'T', 'F'], ['F', 'T', 'F', 'F'], ['F', 'F', 'T', 'F'], ['F', 'F', 'F', 'F']], ['T', 'Q', 'P', 'T^Q'])... +2023-10-10 00:25:30,309 - DEBUG - switch_case - Entering switch_case(^, ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'], ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'])... +2023-10-10 00:25:30,310 - DEBUG - conj - In conj. case... +2023-10-10 00:25:30,310 - DEBUG - conjunction - Calling conjunction(['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'], ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'])... +2023-10-10 00:25:30,310 - DEBUG - conjunction - new_row_values=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-10-10 00:25:30,310 - DEBUG - conjunction - Returning with new row values. +2023-10-10 00:25:30,310 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], '^', ['Q']])... +2023-10-10 00:25:30,310 - DEBUG - set_new_array_elem - new_array=['P^Q'] +2023-10-10 00:25:30,310 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,311 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], +final_variable_combined=['P^Q'], +matrix=[['T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T'], ['T', 'F', 'T', 'F'], ['T', 'F', 'F', 'F'], ['F', 'T', 'T', 'F'], ['F', 'T', 'F', 'F'], ['F', 'F', 'T', 'F'], ['F', 'F', 'F', 'F']], +variables=['T', 'Q', 'P', 'T^Q'] +2023-10-10 00:25:30,312 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,312 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T'], ['T', 'F', 'T', 'F'], ['T', 'F', 'F', 'F'], ['F', 'T', 'T', 'F'], ['F', 'T', 'F', 'F'], ['F', 'F', 'T', 'F'], ['F', 'F', 'F', 'F']], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], ['T', 'Q', 'P', 'T^Q'], ['P^Q'])... +2023-10-10 00:25:30,312 - DEBUG - add_array_to_matrix - variables=['T', 'Q', 'P', 'T^Q', 'P^Q'] +2023-10-10 00:25:30,312 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,313 - DEBUG - switch_case - Entering switch_case(v, ['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-10-10 00:25:30,313 - DEBUG - disj - In disj. case... +2023-10-10 00:25:30,313 - DEBUG - disjunction - Calling disjunction(['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-10-10 00:25:30,313 - DEBUG - disjunction - new_row_values=['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-10-10 00:25:30,314 - DEBUG - disjunction - Returning with new row values. +2023-10-10 00:25:30,314 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['T^Q'], 'v', ['P^Q']])... +2023-10-10 00:25:30,314 - DEBUG - set_new_array_elem - new_array=['(T^Q)v(P^Q)'] +2023-10-10 00:25:30,314 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,314 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'], +final_variable_combined=['(T^Q)v(P^Q)'], +matrix=[['T', 'T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T', 'F', 'T'], ['T', 'F', 'T', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'F', 'T', 'T'], ['F', 'T', 'F', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F', 'F'], ['F', 'F', 'F', 'F', 'F', 'F']], +variables=['T', 'Q', 'P', 'T^Q', 'P^Q'] +2023-10-10 00:25:30,315 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,315 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'], returned_matrix=[['T', 'T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T', 'F', 'T'], ['T', 'F', 'T', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'F', 'T', 'T'], ['F', 'T', 'F', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F', 'F'], ['F', 'F', 'F', 'F', 'F', 'F']], all_variables=['T', 'Q', 'P', 'T^Q', 'P^Q', '(T^Q)v(P^Q)'] +2023-10-10 00:25:30,315 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-10-10 00:25:30,315 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'], +returned_matrix=[['T', 'T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T', 'F', 'T'], ['T', 'F', 'T', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'F', 'T', 'T'], ['F', 'T', 'F', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F', 'F'], ['F', 'F', 'F', 'F', 'F', 'F']], +all_variables=['T', 'Q', 'P', 'T^Q', 'P^Q', '(T^Q)v(P^Q)'] +2023-10-10 00:25:30,316 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,316 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,316 - INFO - print_details - -> Statement: ((T ^ Q) v (P ^ Q)) +2023-10-10 00:25:30,316 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-10-10 00:25:30,316 - INFO - print_details - -> All Variables: ['T', 'Q', 'P', 'T^Q', 'P^Q', '(T^Q)v(P^Q)'] +2023-10-10 00:25:30,316 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T', 'F', 'T'], ['T', 'F', 'T', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'F', 'T', 'T'], ['F', 'T', 'F', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F', 'F'], ['F', 'F', 'F', 'F', 'F', 'F']] +2023-10-10 00:25:30,316 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,317 - INFO - simulate_main - Finished evaluating statement. +2023-10-10 00:25:30,317 - DEBUG - display_matrix - Displaying matrix to console... +2023-10-10 00:25:30,317 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(3, 2, ['T', 'Q', 'P', 'T^Q', 'P^Q', '(T^Q)v(P^Q)'])... +2023-10-10 00:25:30,317 - DEBUG - get_number_of_spaces - total_space=40 +2023-10-10 00:25:30,318 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-10-10 00:25:30,319 - DEBUG - simulate_main - Returning from simulate_main()... +2023-10-10 00:25:30,319 - INFO - simulate_main - Statement: (S ^ (R ^ Q)) +2023-10-10 00:25:30,319 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-10-10 00:25:30,320 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets((S ^ (R ^ Q)))... +2023-10-10 00:25:30,320 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,320 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters((S ^ (R ^ Q))) +2023-10-10 00:25:30,320 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-10-10 00:25:30,320 - DEBUG - validate_input - Calling validate_input(S)... +2023-10-10 00:25:30,320 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,320 - DEBUG - validate_input - Calling validate_input(^)... +2023-10-10 00:25:30,320 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,320 - DEBUG - validate_input - Calling validate_input(R)... +2023-10-10 00:25:30,321 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,321 - DEBUG - validate_input - Calling validate_input(^)... +2023-10-10 00:25:30,321 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,322 - DEBUG - validate_input - Calling validate_input(Q)... +2023-10-10 00:25:30,322 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,322 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-10-10 00:25:30,322 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-10-10 00:25:30,322 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-10-10 00:25:30,322 - INFO - user_input - Processing statement... +2023-10-10 00:25:30,323 - DEBUG - user_input - statement=(S ^ (R ^ Q)) +2023-10-10 00:25:30,323 - INFO - analyze_statement - Starting to analyze statement... +2023-10-10 00:25:30,323 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-10-10 00:25:30,323 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-10-10 00:25:30,323 - DEBUG - clean_whitespaces - Calling clean_whitespaces((S ^ (R ^ Q)))... +2023-10-10 00:25:30,323 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=(S^(R^Q)) +2023-10-10 00:25:30,323 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-10-10 00:25:30,324 - INFO - find_variables - Finding variables in statement... +2023-10-10 00:25:30,324 - DEBUG - find_variables - statement=(S^(R^Q)) +2023-10-10 00:25:30,324 - DEBUG - find_variables - variables_array=['S', 'R', 'Q'] +2023-10-10 00:25:30,324 - INFO - find_variables - Found all variables in statement. +2023-10-10 00:25:30,324 - INFO - find_variables - *** Variables: ['S', 'R', 'Q'] *** +2023-10-10 00:25:30,325 - DEBUG - analyze_statement - variables_arr=['S', 'R', 'Q'] +2023-10-10 00:25:30,325 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-10-10 00:25:30,325 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-10-10 00:25:30,325 - DEBUG - create_array_of_elements - Calling create_array_of_elements((S^(R^Q))) +2023-10-10 00:25:30,325 - DEBUG - create_array_of_elements - array_of_elements=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,326 - DEBUG - create_array_of_elements - Finished creating array. +2023-10-10 00:25:30,326 - DEBUG - check_conditionals - Calling check_conditionals(['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'], ['S', 'R', 'Q'])... +2023-10-10 00:25:30,326 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-10-10 00:25:30,326 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-10-10 00:25:30,326 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,326 - DEBUG - create_conditionals - Search for conditionals finished and none were found, returning. +2023-10-10 00:25:30,327 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=3, +variables_arr=['S', 'R', 'Q'], +array_of_elements=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,327 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,327 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,327 - INFO - print_details - -> Number of Variables: 3 +2023-10-10 00:25:30,327 - INFO - print_details - -> Variables: ['S', 'R', 'Q'] +2023-10-10 00:25:30,328 - INFO - print_details - -> Array of Elements: ['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,328 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,328 - INFO - analyze_statement - Analyzing concluded. +2023-10-10 00:25:30,328 - INFO - parse_array - Starting to parse array... +2023-10-10 00:25:30,328 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-10-10 00:25:30,328 - DEBUG - remove_brackets_around_variables - arr=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,329 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-10-10 00:25:30,329 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,329 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-10-10 00:25:30,329 - DEBUG - add_brackets_around_unary_connectives - arr=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,329 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-10-10 00:25:30,329 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-10-10 00:25:30,329 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-10-10 00:25:30,329 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'])... +2023-10-10 00:25:30,330 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,330 - DEBUG - parse - Calling parse(['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'])... +2023-10-10 00:25:30,330 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'])... +2023-10-10 00:25:30,330 - DEBUG - remove_outer_brackets - array=['S', '^', '(', 'R', '^', 'Q', ')'] +2023-10-10 00:25:30,330 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,330 - DEBUG - parse - In parse(): arr=['S', '^', '(', 'R', '^', 'Q', ')'] +2023-10-10 00:25:30,330 - DEBUG - find_connective - Calling find_connectives(['S', '^', '(', 'R', '^', 'Q', ')'])... +2023-10-10 00:25:30,330 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-10-10 00:25:30,330 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,330 - DEBUG - parse - Calling parse(['(', 'R', '^', 'Q', ')'])... +2023-10-10 00:25:30,331 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'R', '^', 'Q', ')'])... +2023-10-10 00:25:30,331 - DEBUG - remove_outer_brackets - array=['R', '^', 'Q'] +2023-10-10 00:25:30,331 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,332 - DEBUG - parse - In parse(): arr=['R', '^', 'Q'] +2023-10-10 00:25:30,332 - DEBUG - find_connective - Calling find_connectives(['R', '^', 'Q'])... +2023-10-10 00:25:30,332 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-10-10 00:25:30,332 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,332 - DEBUG - parse - temp_array=[['R'], '^', ['Q']] +2023-10-10 00:25:30,332 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,333 - DEBUG - parse - temp_array=[['S'], '^', [['R'], '^', ['Q']]] +2023-10-10 00:25:30,333 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,333 - DEBUG - parse_array - tree_structured_array=[['S'], '^', [['R'], '^', ['Q']]] +2023-10-10 00:25:30,333 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,333 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,333 - INFO - print_details - -> Parsed Array: [['S'], '^', [['R'], '^', ['Q']]] +2023-10-10 00:25:30,333 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,334 - INFO - parse_array - Finished parsing array. +2023-10-10 00:25:30,334 - DEBUG - user_input - In user_input(): +number_of_variables=3, +variables_as_array=['S', 'R', 'Q'], +statement=(S ^ (R ^ Q)), +new_elements=[['S'], '^', [['R'], '^', ['Q']]]. +2023-10-10 00:25:30,334 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-10-10 00:25:30,334 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=3, +variables_as_array=['S', 'R', 'Q'], +provided_statement=(S ^ (R ^ Q)), +elements_in_tree=[['S'], '^', [['R'], '^', ['Q']]] +2023-10-10 00:25:30,334 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,335 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,335 - INFO - print_details - -> number_of_variables: 3 +2023-10-10 00:25:30,335 - INFO - print_details - -> variables_as_array: ['S', 'R', 'Q'] +2023-10-10 00:25:30,335 - INFO - print_details - -> provided_statement: (S ^ (R ^ Q)) +2023-10-10 00:25:30,335 - INFO - print_details - -> elements_in_tree: [['S'], '^', [['R'], '^', ['Q']]] +2023-10-10 00:25:30,335 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,335 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-10-10 00:25:30,335 - DEBUG - create_matrix - Creating initial matrix... +2023-10-10 00:25:30,336 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,336 - DEBUG - recursive_table - n=3 +2023-10-10 00:25:30,336 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,336 - DEBUG - recursive_table - n=2 +2023-10-10 00:25:30,336 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,336 - DEBUG - recursive_table - n=1 +2023-10-10 00:25:30,337 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-10-10 00:25:30,337 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,337 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-10-10 00:25:30,337 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,337 - DEBUG - recursive_table - array_table=['TTT', 'TTF', 'TFT', 'TFF', 'FTT', 'FTF', 'FFT', 'FFF'] +2023-10-10 00:25:30,337 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,338 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] +2023-10-10 00:25:30,338 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-10-10 00:25:30,338 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-10-10 00:25:30,338 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[['S'], '^', [['R'], '^', ['Q']]], +counter=0, +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables_as_array=['S', 'R', 'Q'] +2023-10-10 00:25:30,339 - DEBUG - evaluate_array - Calling evaluate_array([['S'], '^', [['R'], '^', ['Q']]], 0, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['S', 'R', 'Q'])... +2023-10-10 00:25:30,339 - DEBUG - evaluate_array - Calling evaluate_array([['R'], '^', ['Q']], 1, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['S', 'R', 'Q'])... +2023-10-10 00:25:30,339 - DEBUG - switch_case - Entering switch_case(^, ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,340 - DEBUG - conj - In conj. case... +2023-10-10 00:25:30,340 - DEBUG - conjunction - Calling conjunction(['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,340 - DEBUG - conjunction - new_row_values=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-10-10 00:25:30,340 - DEBUG - conjunction - Returning with new row values. +2023-10-10 00:25:30,340 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['R'], '^', ['Q']])... +2023-10-10 00:25:30,340 - DEBUG - set_new_array_elem - new_array=['R^Q'] +2023-10-10 00:25:30,340 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,340 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], +final_variable_combined=['R^Q'], +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables=['S', 'R', 'Q'] +2023-10-10 00:25:30,340 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,340 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], ['S', 'R', 'Q'], ['R^Q'])... +2023-10-10 00:25:30,341 - DEBUG - add_array_to_matrix - variables=['S', 'R', 'Q', 'R^Q'] +2023-10-10 00:25:30,341 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,341 - DEBUG - switch_case - Entering switch_case(^, ['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-10-10 00:25:30,342 - DEBUG - conj - In conj. case... +2023-10-10 00:25:30,342 - DEBUG - conjunction - Calling conjunction(['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-10-10 00:25:30,342 - DEBUG - conjunction - new_row_values=['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'] +2023-10-10 00:25:30,342 - DEBUG - conjunction - Returning with new row values. +2023-10-10 00:25:30,342 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['S'], '^', ['R^Q']])... +2023-10-10 00:25:30,342 - DEBUG - set_new_array_elem - new_array=['S^(R^Q)'] +2023-10-10 00:25:30,343 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,343 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'], +final_variable_combined=['S^(R^Q)'], +matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'F'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']], +variables=['S', 'R', 'Q', 'R^Q'] +2023-10-10 00:25:30,344 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,344 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'], returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'F'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']], all_variables=['S', 'R', 'Q', 'R^Q', 'S^(R^Q)'] +2023-10-10 00:25:30,344 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-10-10 00:25:30,344 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'], +returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'F'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']], +all_variables=['S', 'R', 'Q', 'R^Q', 'S^(R^Q)'] +2023-10-10 00:25:30,345 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,345 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,345 - INFO - print_details - -> Statement: (S ^ (R ^ Q)) +2023-10-10 00:25:30,345 - INFO - print_details - -> Final Calculated Array: ['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'] +2023-10-10 00:25:30,345 - INFO - print_details - -> All Variables: ['S', 'R', 'Q', 'R^Q', 'S^(R^Q)'] +2023-10-10 00:25:30,345 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'F'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']] +2023-10-10 00:25:30,346 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,346 - INFO - simulate_main - Finished evaluating statement. +2023-10-10 00:25:30,346 - DEBUG - display_matrix - Displaying matrix to console... +2023-10-10 00:25:30,346 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(3, 1, ['S', 'R', 'Q', 'R^Q', 'S^(R^Q)'])... +2023-10-10 00:25:30,346 - DEBUG - get_number_of_spaces - total_space=30 +2023-10-10 00:25:30,347 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-10-10 00:25:30,348 - DEBUG - simulate_main - Returning from simulate_main()... +2023-10-10 00:25:30,348 - INFO - simulate_main - Statement: (P v Q) +2023-10-10 00:25:30,348 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-10-10 00:25:30,348 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets((P v Q))... +2023-10-10 00:25:30,348 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,348 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters((P v Q)) +2023-10-10 00:25:30,349 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-10-10 00:25:30,349 - DEBUG - validate_input - Calling validate_input(P)... +2023-10-10 00:25:30,349 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,349 - DEBUG - validate_input - Calling validate_input(v)... +2023-10-10 00:25:30,349 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,349 - DEBUG - validate_input - Calling validate_input(Q)... +2023-10-10 00:25:30,349 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,349 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-10-10 00:25:30,350 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-10-10 00:25:30,350 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-10-10 00:25:30,350 - INFO - user_input - Processing statement... +2023-10-10 00:25:30,350 - DEBUG - user_input - statement=(P v Q) +2023-10-10 00:25:30,350 - INFO - analyze_statement - Starting to analyze statement... +2023-10-10 00:25:30,350 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-10-10 00:25:30,350 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-10-10 00:25:30,351 - DEBUG - clean_whitespaces - Calling clean_whitespaces((P v Q))... +2023-10-10 00:25:30,351 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=(PvQ) +2023-10-10 00:25:30,351 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-10-10 00:25:30,351 - INFO - find_variables - Finding variables in statement... +2023-10-10 00:25:30,351 - DEBUG - find_variables - statement=(PvQ) +2023-10-10 00:25:30,351 - DEBUG - find_variables - variables_array=['P', 'Q'] +2023-10-10 00:25:30,351 - INFO - find_variables - Found all variables in statement. +2023-10-10 00:25:30,351 - INFO - find_variables - *** Variables: ['P', 'Q'] *** +2023-10-10 00:25:30,351 - DEBUG - analyze_statement - variables_arr=['P', 'Q'] +2023-10-10 00:25:30,352 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-10-10 00:25:30,352 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-10-10 00:25:30,352 - DEBUG - create_array_of_elements - Calling create_array_of_elements((PvQ)) +2023-10-10 00:25:30,352 - DEBUG - create_array_of_elements - array_of_elements=['(', 'P', 'v', 'Q', ')'] +2023-10-10 00:25:30,352 - DEBUG - create_array_of_elements - Finished creating array. +2023-10-10 00:25:30,352 - DEBUG - check_conditionals - Calling check_conditionals(['(', 'P', 'v', 'Q', ')'], ['P', 'Q'])... +2023-10-10 00:25:30,352 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-10-10 00:25:30,353 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-10-10 00:25:30,353 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', 'P', 'v', 'Q', ')'] +2023-10-10 00:25:30,353 - DEBUG - create_conditionals - Search for conditionals finished and none were found, returning. +2023-10-10 00:25:30,353 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=2, +variables_arr=['P', 'Q'], +array_of_elements=['(', 'P', 'v', 'Q', ')'] +2023-10-10 00:25:30,353 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,354 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,354 - INFO - print_details - -> Number of Variables: 2 +2023-10-10 00:25:30,354 - INFO - print_details - -> Variables: ['P', 'Q'] +2023-10-10 00:25:30,354 - INFO - print_details - -> Array of Elements: ['(', 'P', 'v', 'Q', ')'] +2023-10-10 00:25:30,354 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,354 - INFO - analyze_statement - Analyzing concluded. +2023-10-10 00:25:30,354 - INFO - parse_array - Starting to parse array... +2023-10-10 00:25:30,355 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-10-10 00:25:30,355 - DEBUG - remove_brackets_around_variables - arr=['(', 'P', 'v', 'Q', ')'] +2023-10-10 00:25:30,355 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-10-10 00:25:30,355 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'P', 'v', 'Q', ')'] +2023-10-10 00:25:30,355 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-10-10 00:25:30,355 - DEBUG - add_brackets_around_unary_connectives - arr=['(', 'P', 'v', 'Q', ')'] +2023-10-10 00:25:30,356 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-10-10 00:25:30,356 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'P', 'v', 'Q', ')'] +2023-10-10 00:25:30,356 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-10-10 00:25:30,356 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', 'P', 'v', 'Q', ')'])... +2023-10-10 00:25:30,356 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,356 - DEBUG - parse - Calling parse(['(', 'P', 'v', 'Q', ')'])... +2023-10-10 00:25:30,356 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', 'v', 'Q', ')'])... +2023-10-10 00:25:30,356 - DEBUG - remove_outer_brackets - array=['P', 'v', 'Q'] +2023-10-10 00:25:30,357 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,357 - DEBUG - parse - In parse(): arr=['P', 'v', 'Q'] +2023-10-10 00:25:30,357 - DEBUG - find_connective - Calling find_connectives(['P', 'v', 'Q'])... +2023-10-10 00:25:30,357 - DEBUG - find_connective - In find_connective(): elem=v, i=1 +2023-10-10 00:25:30,357 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,357 - DEBUG - parse - temp_array=[['P'], 'v', ['Q']] +2023-10-10 00:25:30,357 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,358 - DEBUG - parse_array - tree_structured_array=[['P'], 'v', ['Q']] +2023-10-10 00:25:30,358 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,358 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,358 - INFO - print_details - -> Parsed Array: [['P'], 'v', ['Q']] +2023-10-10 00:25:30,358 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,358 - INFO - parse_array - Finished parsing array. +2023-10-10 00:25:30,359 - DEBUG - user_input - In user_input(): +number_of_variables=2, +variables_as_array=['P', 'Q'], +statement=(P v Q), +new_elements=[['P'], 'v', ['Q']]. +2023-10-10 00:25:30,359 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-10-10 00:25:30,359 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=2, +variables_as_array=['P', 'Q'], +provided_statement=(P v Q), +elements_in_tree=[['P'], 'v', ['Q']] +2023-10-10 00:25:30,360 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,360 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,360 - INFO - print_details - -> number_of_variables: 2 +2023-10-10 00:25:30,361 - INFO - print_details - -> variables_as_array: ['P', 'Q'] +2023-10-10 00:25:30,361 - INFO - print_details - -> provided_statement: (P v Q) +2023-10-10 00:25:30,361 - INFO - print_details - -> elements_in_tree: [['P'], 'v', ['Q']] +2023-10-10 00:25:30,361 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,361 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-10-10 00:25:30,362 - DEBUG - create_matrix - Creating initial matrix... +2023-10-10 00:25:30,362 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,362 - DEBUG - recursive_table - n=2 +2023-10-10 00:25:30,362 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,362 - DEBUG - recursive_table - n=1 +2023-10-10 00:25:30,362 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-10-10 00:25:30,362 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,363 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-10-10 00:25:30,363 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,363 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']] +2023-10-10 00:25:30,363 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-10-10 00:25:30,363 - INFO - create_matrix - *** Initial Matrix: [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']] *** +2023-10-10 00:25:30,363 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[['P'], 'v', ['Q']], +counter=0, +matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], +variables_as_array=['P', 'Q'] +2023-10-10 00:25:30,364 - DEBUG - evaluate_array - Calling evaluate_array([['P'], 'v', ['Q']], 0, [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], ['P', 'Q'])... +2023-10-10 00:25:30,364 - DEBUG - switch_case - Entering switch_case(v, ['T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,364 - DEBUG - disj - In disj. case... +2023-10-10 00:25:30,364 - DEBUG - disjunction - Calling disjunction(['T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,364 - DEBUG - disjunction - new_row_values=['T', 'T', 'T', 'F'] +2023-10-10 00:25:30,364 - DEBUG - disjunction - Returning with new row values. +2023-10-10 00:25:30,364 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], 'v', ['Q']])... +2023-10-10 00:25:30,364 - DEBUG - set_new_array_elem - new_array=['PvQ'] +2023-10-10 00:25:30,365 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,365 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'T', 'F'], +final_variable_combined=['PvQ'], +matrix=[['T', 'T', 'T'], ['T', 'F', 'T'], ['F', 'T', 'T'], ['F', 'F', 'F']], +variables=['P', 'Q'] +2023-10-10 00:25:30,365 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,365 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'T', 'T', 'F'], returned_matrix=[['T', 'T', 'T'], ['T', 'F', 'T'], ['F', 'T', 'T'], ['F', 'F', 'F']], all_variables=['P', 'Q', 'PvQ'] +2023-10-10 00:25:30,365 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-10-10 00:25:30,366 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'T', 'T', 'F'], +returned_matrix=[['T', 'T', 'T'], ['T', 'F', 'T'], ['F', 'T', 'T'], ['F', 'F', 'F']], +all_variables=['P', 'Q', 'PvQ'] +2023-10-10 00:25:30,366 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,366 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,366 - INFO - print_details - -> Statement: (P v Q) +2023-10-10 00:25:30,366 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'T', 'F'] +2023-10-10 00:25:30,367 - INFO - print_details - -> All Variables: ['P', 'Q', 'PvQ'] +2023-10-10 00:25:30,367 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T'], ['T', 'F', 'T'], ['F', 'T', 'T'], ['F', 'F', 'F']] +2023-10-10 00:25:30,367 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,367 - INFO - simulate_main - Finished evaluating statement. +2023-10-10 00:25:30,367 - DEBUG - display_matrix - Displaying matrix to console... +2023-10-10 00:25:30,367 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(2, 0, ['P', 'Q', 'PvQ'])... +2023-10-10 00:25:30,368 - DEBUG - get_number_of_spaces - total_space=16 +2023-10-10 00:25:30,368 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-10-10 00:25:30,368 - DEBUG - simulate_main - Returning from simulate_main()... +2023-10-10 00:25:30,369 - INFO - simulate_main - Statement: (P -> (Q ^ R)) +2023-10-10 00:25:30,369 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-10-10 00:25:30,369 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets((P -> (Q ^ R)))... +2023-10-10 00:25:30,369 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,369 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters((P -> (Q ^ R))) +2023-10-10 00:25:30,369 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-10-10 00:25:30,369 - DEBUG - validate_input - Calling validate_input(P)... +2023-10-10 00:25:30,370 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,370 - DEBUG - validate_input - Calling validate_input(-)... +2023-10-10 00:25:30,370 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,370 - DEBUG - validate_input - Calling validate_input(>)... +2023-10-10 00:25:30,370 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,370 - DEBUG - validate_input - Calling validate_input(Q)... +2023-10-10 00:25:30,371 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,371 - DEBUG - validate_input - Calling validate_input(^)... +2023-10-10 00:25:30,371 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,371 - DEBUG - validate_input - Calling validate_input(R)... +2023-10-10 00:25:30,371 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,371 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-10-10 00:25:30,371 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-10-10 00:25:30,372 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-10-10 00:25:30,372 - INFO - user_input - Processing statement... +2023-10-10 00:25:30,372 - DEBUG - user_input - statement=(P -> (Q ^ R)) +2023-10-10 00:25:30,372 - INFO - analyze_statement - Starting to analyze statement... +2023-10-10 00:25:30,372 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-10-10 00:25:30,372 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-10-10 00:25:30,373 - DEBUG - clean_whitespaces - Calling clean_whitespaces((P -> (Q ^ R)))... +2023-10-10 00:25:30,373 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=(P->(Q^R)) +2023-10-10 00:25:30,373 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-10-10 00:25:30,373 - INFO - find_variables - Finding variables in statement... +2023-10-10 00:25:30,373 - DEBUG - find_variables - statement=(P->(Q^R)) +2023-10-10 00:25:30,373 - DEBUG - find_variables - variables_array=['P', 'Q', 'R'] +2023-10-10 00:25:30,374 - INFO - find_variables - Found all variables in statement. +2023-10-10 00:25:30,374 - INFO - find_variables - *** Variables: ['P', 'Q', 'R'] *** +2023-10-10 00:25:30,374 - DEBUG - analyze_statement - variables_arr=['P', 'Q', 'R'] +2023-10-10 00:25:30,374 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-10-10 00:25:30,374 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-10-10 00:25:30,374 - DEBUG - create_array_of_elements - Calling create_array_of_elements((P->(Q^R))) +2023-10-10 00:25:30,374 - DEBUG - create_array_of_elements - array_of_elements=['(', 'P', '-', '>', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,375 - DEBUG - create_array_of_elements - Finished creating array. +2023-10-10 00:25:30,375 - DEBUG - check_conditionals - Calling check_conditionals(['(', 'P', '-', '>', '(', 'Q', '^', 'R', ')', ')'], ['P', 'Q', 'R'])... +2023-10-10 00:25:30,375 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-10-10 00:25:30,375 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-10-10 00:25:30,375 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', 'P', '-', '>', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,375 - DEBUG - create_conditionals - Conditional symbols were found in ['(', 'P', '-', '>', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,375 - DEBUG - create_conditionals - array_of_elements=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,376 - DEBUG - create_conditionals - Finished creating conditionals. +2023-10-10 00:25:30,376 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=3, +variables_arr=['P', 'Q', 'R'], +array_of_elements=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,376 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,376 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,376 - INFO - print_details - -> Number of Variables: 3 +2023-10-10 00:25:30,376 - INFO - print_details - -> Variables: ['P', 'Q', 'R'] +2023-10-10 00:25:30,376 - INFO - print_details - -> Array of Elements: ['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,377 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,377 - INFO - analyze_statement - Analyzing concluded. +2023-10-10 00:25:30,377 - INFO - parse_array - Starting to parse array... +2023-10-10 00:25:30,377 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-10-10 00:25:30,377 - DEBUG - remove_brackets_around_variables - arr=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,377 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-10-10 00:25:30,377 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,378 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-10-10 00:25:30,378 - DEBUG - add_brackets_around_unary_connectives - arr=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,378 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-10-10 00:25:30,378 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-10-10 00:25:30,378 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-10-10 00:25:30,378 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'])... +2023-10-10 00:25:30,378 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,378 - DEBUG - parse - Calling parse(['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'])... +2023-10-10 00:25:30,379 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'])... +2023-10-10 00:25:30,379 - DEBUG - remove_outer_brackets - array=['P', '->', '(', 'Q', '^', 'R', ')'] +2023-10-10 00:25:30,379 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,379 - DEBUG - parse - In parse(): arr=['P', '->', '(', 'Q', '^', 'R', ')'] +2023-10-10 00:25:30,379 - DEBUG - find_connective - Calling find_connectives(['P', '->', '(', 'Q', '^', 'R', ')'])... +2023-10-10 00:25:30,379 - DEBUG - find_connective - In find_connective(): elem=->, i=1 +2023-10-10 00:25:30,379 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,380 - DEBUG - parse - Calling parse(['(', 'Q', '^', 'R', ')'])... +2023-10-10 00:25:30,380 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'Q', '^', 'R', ')'])... +2023-10-10 00:25:30,380 - DEBUG - remove_outer_brackets - array=['Q', '^', 'R'] +2023-10-10 00:25:30,380 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,380 - DEBUG - parse - In parse(): arr=['Q', '^', 'R'] +2023-10-10 00:25:30,380 - DEBUG - find_connective - Calling find_connectives(['Q', '^', 'R'])... +2023-10-10 00:25:30,380 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-10-10 00:25:30,381 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,381 - DEBUG - parse - temp_array=[['Q'], '^', ['R']] +2023-10-10 00:25:30,381 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,381 - DEBUG - parse - temp_array=[['P'], '->', [['Q'], '^', ['R']]] +2023-10-10 00:25:30,381 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,381 - DEBUG - parse_array - tree_structured_array=[['P'], '->', [['Q'], '^', ['R']]] +2023-10-10 00:25:30,381 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,382 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,382 - INFO - print_details - -> Parsed Array: [['P'], '->', [['Q'], '^', ['R']]] +2023-10-10 00:25:30,382 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,382 - INFO - parse_array - Finished parsing array. +2023-10-10 00:25:30,382 - DEBUG - user_input - In user_input(): +number_of_variables=3, +variables_as_array=['P', 'Q', 'R'], +statement=(P -> (Q ^ R)), +new_elements=[['P'], '->', [['Q'], '^', ['R']]]. +2023-10-10 00:25:30,382 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-10-10 00:25:30,383 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=3, +variables_as_array=['P', 'Q', 'R'], +provided_statement=(P -> (Q ^ R)), +elements_in_tree=[['P'], '->', [['Q'], '^', ['R']]] +2023-10-10 00:25:30,383 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,383 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,383 - INFO - print_details - -> number_of_variables: 3 +2023-10-10 00:25:30,383 - INFO - print_details - -> variables_as_array: ['P', 'Q', 'R'] +2023-10-10 00:25:30,383 - INFO - print_details - -> provided_statement: (P -> (Q ^ R)) +2023-10-10 00:25:30,384 - INFO - print_details - -> elements_in_tree: [['P'], '->', [['Q'], '^', ['R']]] +2023-10-10 00:25:30,384 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,384 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-10-10 00:25:30,384 - DEBUG - create_matrix - Creating initial matrix... +2023-10-10 00:25:30,384 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,384 - DEBUG - recursive_table - n=3 +2023-10-10 00:25:30,384 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,385 - DEBUG - recursive_table - n=2 +2023-10-10 00:25:30,385 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,385 - DEBUG - recursive_table - n=1 +2023-10-10 00:25:30,385 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-10-10 00:25:30,385 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,385 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-10-10 00:25:30,385 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,386 - DEBUG - recursive_table - array_table=['TTT', 'TTF', 'TFT', 'TFF', 'FTT', 'FTF', 'FFT', 'FFF'] +2023-10-10 00:25:30,386 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,386 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] +2023-10-10 00:25:30,386 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-10-10 00:25:30,386 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-10-10 00:25:30,386 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[['P'], '->', [['Q'], '^', ['R']]], +counter=0, +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables_as_array=['P', 'Q', 'R'] +2023-10-10 00:25:30,387 - DEBUG - evaluate_array - Calling evaluate_array([['P'], '->', [['Q'], '^', ['R']]], 0, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['P', 'Q', 'R'])... +2023-10-10 00:25:30,387 - DEBUG - evaluate_array - Calling evaluate_array([['Q'], '^', ['R']], 1, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['P', 'Q', 'R'])... +2023-10-10 00:25:30,387 - DEBUG - switch_case - Entering switch_case(^, ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,387 - DEBUG - conj - In conj. case... +2023-10-10 00:25:30,387 - DEBUG - conjunction - Calling conjunction(['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,388 - DEBUG - conjunction - new_row_values=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-10-10 00:25:30,388 - DEBUG - conjunction - Returning with new row values. +2023-10-10 00:25:30,388 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['Q'], '^', ['R']])... +2023-10-10 00:25:30,388 - DEBUG - set_new_array_elem - new_array=['Q^R'] +2023-10-10 00:25:30,388 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,388 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], +final_variable_combined=['Q^R'], +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables=['P', 'Q', 'R'] +2023-10-10 00:25:30,389 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,389 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], ['P', 'Q', 'R'], ['Q^R'])... +2023-10-10 00:25:30,389 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'R', 'Q^R'] +2023-10-10 00:25:30,389 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,389 - DEBUG - switch_case - Entering switch_case(->, ['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-10-10 00:25:30,390 - DEBUG - cond - In cond. case... +2023-10-10 00:25:30,390 - DEBUG - conditional - Calling conditional(['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-10-10 00:25:30,390 - DEBUG - conditional - new_row_values=['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'] +2023-10-10 00:25:30,390 - DEBUG - conditional - Returning with new row values. +2023-10-10 00:25:30,390 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], '->', ['Q^R']])... +2023-10-10 00:25:30,390 - DEBUG - set_new_array_elem - new_array=['P->(Q^R)'] +2023-10-10 00:25:30,390 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,391 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'], +final_variable_combined=['P->(Q^R)'], +matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'T'], ['F', 'F', 'T', 'F', 'T'], ['F', 'F', 'F', 'F', 'T']], +variables=['P', 'Q', 'R', 'Q^R'] +2023-10-10 00:25:30,391 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,391 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'], returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'T'], ['F', 'F', 'T', 'F', 'T'], ['F', 'F', 'F', 'F', 'T']], all_variables=['P', 'Q', 'R', 'Q^R', 'P->(Q^R)'] +2023-10-10 00:25:30,391 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-10-10 00:25:30,391 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'], +returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'T'], ['F', 'F', 'T', 'F', 'T'], ['F', 'F', 'F', 'F', 'T']], +all_variables=['P', 'Q', 'R', 'Q^R', 'P->(Q^R)'] +2023-10-10 00:25:30,392 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,392 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,392 - INFO - print_details - -> Statement: (P -> (Q ^ R)) +2023-10-10 00:25:30,393 - INFO - print_details - -> Final Calculated Array: ['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'] +2023-10-10 00:25:30,393 - INFO - print_details - -> All Variables: ['P', 'Q', 'R', 'Q^R', 'P->(Q^R)'] +2023-10-10 00:25:30,393 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'T'], ['F', 'F', 'T', 'F', 'T'], ['F', 'F', 'F', 'F', 'T']] +2023-10-10 00:25:30,393 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,393 - INFO - simulate_main - Finished evaluating statement. +2023-10-10 00:25:30,393 - DEBUG - display_matrix - Displaying matrix to console... +2023-10-10 00:25:30,394 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(3, 1, ['P', 'Q', 'R', 'Q^R', 'P->(Q^R)'])... +2023-10-10 00:25:30,394 - DEBUG - get_number_of_spaces - total_space=31 +2023-10-10 00:25:30,394 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-10-10 00:25:30,395 - DEBUG - simulate_main - Returning from simulate_main()... +2023-10-10 00:25:30,395 - INFO - simulate_main - Statement: ((P -> Q) <-> ((!Q) -> (!P))) +2023-10-10 00:25:30,396 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-10-10 00:25:30,396 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(((P -> Q) <-> ((!Q) -> (!P))))... +2023-10-10 00:25:30,396 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,396 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters(((P -> Q) <-> ((!Q) -> (!P)))) +2023-10-10 00:25:30,396 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-10-10 00:25:30,396 - DEBUG - validate_input - Calling validate_input(P)... +2023-10-10 00:25:30,396 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,397 - DEBUG - validate_input - Calling validate_input(-)... +2023-10-10 00:25:30,397 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,397 - DEBUG - validate_input - Calling validate_input(>)... +2023-10-10 00:25:30,397 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,397 - DEBUG - validate_input - Calling validate_input(Q)... +2023-10-10 00:25:30,397 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,397 - DEBUG - validate_input - Calling validate_input(<)... +2023-10-10 00:25:30,397 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,398 - DEBUG - validate_input - Calling validate_input(-)... +2023-10-10 00:25:30,398 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,398 - DEBUG - validate_input - Calling validate_input(>)... +2023-10-10 00:25:30,398 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,398 - DEBUG - validate_input - Calling validate_input(!)... +2023-10-10 00:25:30,398 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,398 - DEBUG - validate_input - Calling validate_input(Q)... +2023-10-10 00:25:30,399 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,399 - DEBUG - validate_input - Calling validate_input(-)... +2023-10-10 00:25:30,399 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,399 - DEBUG - validate_input - Calling validate_input(>)... +2023-10-10 00:25:30,399 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,399 - DEBUG - validate_input - Calling validate_input(!)... +2023-10-10 00:25:30,399 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,400 - DEBUG - validate_input - Calling validate_input(P)... +2023-10-10 00:25:30,400 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-10-10 00:25:30,400 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-10-10 00:25:30,400 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-10-10 00:25:30,400 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-10-10 00:25:30,400 - INFO - user_input - Processing statement... +2023-10-10 00:25:30,401 - DEBUG - user_input - statement=((P -> Q) <-> ((!Q) -> (!P))) +2023-10-10 00:25:30,401 - INFO - analyze_statement - Starting to analyze statement... +2023-10-10 00:25:30,401 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-10-10 00:25:30,402 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-10-10 00:25:30,402 - DEBUG - clean_whitespaces - Calling clean_whitespaces(((P -> Q) <-> ((!Q) -> (!P))))... +2023-10-10 00:25:30,402 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=((P->Q)<->((!Q)->(!P))) +2023-10-10 00:25:30,402 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-10-10 00:25:30,403 - INFO - find_variables - Finding variables in statement... +2023-10-10 00:25:30,403 - DEBUG - find_variables - statement=((P->Q)<->((!Q)->(!P))) +2023-10-10 00:25:30,403 - DEBUG - find_variables - variables_array=['P', 'Q'] +2023-10-10 00:25:30,403 - INFO - find_variables - Found all variables in statement. +2023-10-10 00:25:30,403 - INFO - find_variables - *** Variables: ['P', 'Q'] *** +2023-10-10 00:25:30,404 - DEBUG - analyze_statement - variables_arr=['P', 'Q'] +2023-10-10 00:25:30,404 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-10-10 00:25:30,404 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-10-10 00:25:30,404 - DEBUG - create_array_of_elements - Calling create_array_of_elements(((P->Q)<->((!Q)->(!P)))) +2023-10-10 00:25:30,404 - DEBUG - create_array_of_elements - array_of_elements=['(', '(', 'P', '-', '>', 'Q', ')', '<', '-', '>', '(', '(', '!', 'Q', ')', '-', '>', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,404 - DEBUG - create_array_of_elements - Finished creating array. +2023-10-10 00:25:30,405 - DEBUG - check_conditionals - Calling check_conditionals(['(', '(', 'P', '-', '>', 'Q', ')', '<', '-', '>', '(', '(', '!', 'Q', ')', '-', '>', '(', '!', 'P', ')', ')', ')'], ['P', 'Q'])... +2023-10-10 00:25:30,405 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-10-10 00:25:30,405 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-10-10 00:25:30,405 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', '(', 'P', '-', '>', 'Q', ')', '<', '-', '>', '(', '(', '!', 'Q', ')', '-', '>', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,405 - DEBUG - create_conditionals - Conditional symbols were found in ['(', '(', 'P', '-', '>', 'Q', ')', '<', '-', '>', '(', '(', '!', 'Q', ')', '-', '>', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,405 - DEBUG - create_conditionals - array_of_elements=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,406 - DEBUG - create_conditionals - Finished creating conditionals. +2023-10-10 00:25:30,406 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=2, +variables_arr=['P', 'Q'], +array_of_elements=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,406 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,406 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,406 - INFO - print_details - -> Number of Variables: 2 +2023-10-10 00:25:30,406 - INFO - print_details - -> Variables: ['P', 'Q'] +2023-10-10 00:25:30,407 - INFO - print_details - -> Array of Elements: ['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,407 - INFO - print_details - ************************** ANALYSIS ************************** +2023-10-10 00:25:30,407 - INFO - analyze_statement - Analyzing concluded. +2023-10-10 00:25:30,407 - INFO - parse_array - Starting to parse array... +2023-10-10 00:25:30,407 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-10-10 00:25:30,407 - DEBUG - remove_brackets_around_variables - arr=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,407 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-10-10 00:25:30,408 - DEBUG - parse_array - In parse_array(): elements_second=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,408 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-10-10 00:25:30,408 - DEBUG - add_brackets_around_unary_connectives - arr=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,408 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-10-10 00:25:30,408 - DEBUG - parse_array - In parse_array(): elements_second=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-10-10 00:25:30,408 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-10-10 00:25:30,409 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'])... +2023-10-10 00:25:30,409 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-10-10 00:25:30,409 - DEBUG - parse - Calling parse(['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'])... +2023-10-10 00:25:30,409 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'])... +2023-10-10 00:25:30,409 - DEBUG - remove_outer_brackets - array=['(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'] +2023-10-10 00:25:30,409 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,410 - DEBUG - parse - In parse(): arr=['(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'] +2023-10-10 00:25:30,410 - DEBUG - find_connective - Calling find_connectives(['(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'])... +2023-10-10 00:25:30,410 - DEBUG - find_connective - In find_connective(): elem=<->, i=5 +2023-10-10 00:25:30,410 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,410 - DEBUG - parse - Calling parse(['(', 'P', '->', 'Q', ')'])... +2023-10-10 00:25:30,410 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', '->', 'Q', ')'])... +2023-10-10 00:25:30,411 - DEBUG - remove_outer_brackets - array=['P', '->', 'Q'] +2023-10-10 00:25:30,411 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,411 - DEBUG - parse - In parse(): arr=['P', '->', 'Q'] +2023-10-10 00:25:30,411 - DEBUG - find_connective - Calling find_connectives(['P', '->', 'Q'])... +2023-10-10 00:25:30,411 - DEBUG - find_connective - In find_connective(): elem=->, i=1 +2023-10-10 00:25:30,411 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,412 - DEBUG - parse - temp_array=[['P'], '->', ['Q']] +2023-10-10 00:25:30,412 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,412 - DEBUG - parse - Calling parse(['(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'])... +2023-10-10 00:25:30,412 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'])... +2023-10-10 00:25:30,412 - DEBUG - remove_outer_brackets - array=['(', '!', 'Q', ')', '->', '(', '!', 'P', ')'] +2023-10-10 00:25:30,412 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,412 - DEBUG - parse - In parse(): arr=['(', '!', 'Q', ')', '->', '(', '!', 'P', ')'] +2023-10-10 00:25:30,413 - DEBUG - find_connective - Calling find_connectives(['(', '!', 'Q', ')', '->', '(', '!', 'P', ')'])... +2023-10-10 00:25:30,413 - DEBUG - find_connective - In find_connective(): elem=->, i=4 +2023-10-10 00:25:30,413 - DEBUG - find_connective - Found connective. +2023-10-10 00:25:30,413 - DEBUG - parse - Calling parse(['(', '!', 'Q', ')'])... +2023-10-10 00:25:30,413 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '!', 'Q', ')'])... +2023-10-10 00:25:30,413 - DEBUG - remove_outer_brackets - array=['!', 'Q'] +2023-10-10 00:25:30,413 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,414 - DEBUG - parse - In parse(): arr=['!', 'Q'] +2023-10-10 00:25:30,414 - DEBUG - parse - temp_arr=['!', 'Q'] +2023-10-10 00:25:30,414 - DEBUG - parse - Returning with parsed list of unary connectives. +2023-10-10 00:25:30,414 - DEBUG - parse - Calling parse(['(', '!', 'P', ')'])... +2023-10-10 00:25:30,414 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '!', 'P', ')'])... +2023-10-10 00:25:30,414 - DEBUG - remove_outer_brackets - array=['!', 'P'] +2023-10-10 00:25:30,414 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-10-10 00:25:30,414 - DEBUG - parse - In parse(): arr=['!', 'P'] +2023-10-10 00:25:30,415 - DEBUG - parse - temp_arr=['!', 'P'] +2023-10-10 00:25:30,415 - DEBUG - parse - Returning with parsed list of unary connectives. +2023-10-10 00:25:30,415 - DEBUG - parse - temp_array=[['!', 'Q'], '->', ['!', 'P']] +2023-10-10 00:25:30,415 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,415 - DEBUG - parse - temp_array=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-10-10 00:25:30,415 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-10-10 00:25:30,416 - DEBUG - parse_array - tree_structured_array=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-10-10 00:25:30,416 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,416 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,416 - INFO - print_details - -> Parsed Array: [[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-10-10 00:25:30,416 - INFO - print_details - *************************** PARSE *************************** +2023-10-10 00:25:30,416 - INFO - parse_array - Finished parsing array. +2023-10-10 00:25:30,417 - DEBUG - user_input - In user_input(): +number_of_variables=2, +variables_as_array=['P', 'Q'], +statement=((P -> Q) <-> ((!Q) -> (!P))), +new_elements=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]]. +2023-10-10 00:25:30,417 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-10-10 00:25:30,417 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=2, +variables_as_array=['P', 'Q'], +provided_statement=((P -> Q) <-> ((!Q) -> (!P))), +elements_in_tree=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-10-10 00:25:30,417 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,418 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,418 - INFO - print_details - -> number_of_variables: 2 +2023-10-10 00:25:30,418 - INFO - print_details - -> variables_as_array: ['P', 'Q'] +2023-10-10 00:25:30,418 - INFO - print_details - -> provided_statement: ((P -> Q) <-> ((!Q) -> (!P))) +2023-10-10 00:25:30,418 - INFO - print_details - -> elements_in_tree: [[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-10-10 00:25:30,418 - INFO - print_details - ************************** SUMMARY ************************** +2023-10-10 00:25:30,418 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-10-10 00:25:30,418 - DEBUG - create_matrix - Creating initial matrix... +2023-10-10 00:25:30,419 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,419 - DEBUG - recursive_table - n=2 +2023-10-10 00:25:30,419 - DEBUG - recursive_table - Creating table entries recursively... +2023-10-10 00:25:30,419 - DEBUG - recursive_table - n=1 +2023-10-10 00:25:30,419 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-10-10 00:25:30,419 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,419 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-10-10 00:25:30,419 - DEBUG - recursive_table - Finished creating array of table entries. +2023-10-10 00:25:30,420 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']] +2023-10-10 00:25:30,420 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-10-10 00:25:30,420 - INFO - create_matrix - *** Initial Matrix: [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']] *** +2023-10-10 00:25:30,420 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]], +counter=0, +matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], +variables_as_array=['P', 'Q'] +2023-10-10 00:25:30,420 - DEBUG - evaluate_array - Calling evaluate_array([[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]], 0, [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], ['P', 'Q'])... +2023-10-10 00:25:30,421 - DEBUG - evaluate_array - Calling evaluate_array([['P'], '->', ['Q']], 1, [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], ['P', 'Q'])... +2023-10-10 00:25:30,421 - DEBUG - switch_case - Entering switch_case(->, ['T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,421 - DEBUG - cond - In cond. case... +2023-10-10 00:25:30,421 - DEBUG - conditional - Calling conditional(['T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,422 - DEBUG - conditional - new_row_values=['T', 'F', 'T', 'T'] +2023-10-10 00:25:30,422 - DEBUG - conditional - Returning with new row values. +2023-10-10 00:25:30,422 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], '->', ['Q']])... +2023-10-10 00:25:30,422 - DEBUG - set_new_array_elem - new_array=['P->Q'] +2023-10-10 00:25:30,422 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,422 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'T', 'T'], +final_variable_combined=['P->Q'], +matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], +variables=['P', 'Q'] +2023-10-10 00:25:30,423 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,423 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], ['T', 'F', 'T', 'T'], ['P', 'Q'], ['P->Q'])... +2023-10-10 00:25:30,423 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'P->Q'] +2023-10-10 00:25:30,423 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,424 - DEBUG - evaluate_array - Calling evaluate_array([['!', 'Q'], '->', ['!', 'P']], 1, [['T', 'T', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'F', 'T']], ['P', 'Q', 'P->Q'])... +2023-10-10 00:25:30,424 - DEBUG - evaluate_array - Calling evaluate_array(['!', 'Q'], 2, [['T', 'T', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'F', 'T']], ['P', 'Q', 'P->Q'])... +2023-10-10 00:25:30,424 - DEBUG - switch_case - Entering switch_case(!, ['T', 'F', 'T', 'T'], ['T', 'F', 'T', 'F'])... +2023-10-10 00:25:30,424 - DEBUG - neg - In neg. case... +2023-10-10 00:25:30,424 - DEBUG - negation - Calling negation(['T', 'F', 'T', 'T'])... +2023-10-10 00:25:30,425 - DEBUG - negation - new_row_values=['F', 'T', 'F', 'F'] +2023-10-10 00:25:30,425 - DEBUG - negation - Returning with new row values. +2023-10-10 00:25:30,425 - DEBUG - set_new_array_elem - Calling set_new_array_elem(['_', '!', 'Q'])... +2023-10-10 00:25:30,425 - DEBUG - set_new_array_elem - new_array=['!Q'] +2023-10-10 00:25:30,425 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,425 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['F', 'T', 'F', 'F'], +final_variable_combined=['!Q'], +matrix=[['T', 'T', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'F', 'T']], +variables=['P', 'Q', 'P->Q'] +2023-10-10 00:25:30,426 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,426 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'F', 'T']], ['F', 'T', 'F', 'F'], ['P', 'Q', 'P->Q'], ['!Q'])... +2023-10-10 00:25:30,426 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'P->Q', '!Q'] +2023-10-10 00:25:30,426 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,426 - DEBUG - evaluate_array - Calling evaluate_array(['!', 'P'], 2, [['T', 'T', 'T', 'F'], ['T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F'], ['F', 'F', 'T', 'F']], ['P', 'Q', 'P->Q', '!Q'])... +2023-10-10 00:25:30,426 - DEBUG - switch_case - Entering switch_case(!, ['F', 'T', 'F', 'F'], ['T', 'T', 'F', 'F'])... +2023-10-10 00:25:30,426 - DEBUG - neg - In neg. case... +2023-10-10 00:25:30,427 - DEBUG - negation - Calling negation(['F', 'T', 'F', 'F'])... +2023-10-10 00:25:30,427 - DEBUG - negation - new_row_values=['T', 'F', 'T', 'T'] +2023-10-10 00:25:30,427 - DEBUG - negation - Returning with new row values. +2023-10-10 00:25:30,427 - DEBUG - set_new_array_elem - Calling set_new_array_elem(['_', '!', 'P'])... +2023-10-10 00:25:30,427 - DEBUG - set_new_array_elem - new_array=['!P'] +2023-10-10 00:25:30,427 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,427 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'T', 'T'], +final_variable_combined=['!P'], +matrix=[['T', 'T', 'T', 'F'], ['T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F'], ['F', 'F', 'T', 'F']], +variables=['P', 'Q', 'P->Q', '!Q'] +2023-10-10 00:25:30,428 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,428 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T', 'F'], ['T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F'], ['F', 'F', 'T', 'F']], ['T', 'F', 'T', 'T'], ['P', 'Q', 'P->Q', '!Q'], ['!P'])... +2023-10-10 00:25:30,428 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'P->Q', '!Q', '!P'] +2023-10-10 00:25:30,428 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,428 - DEBUG - switch_case - Entering switch_case(->, ['F', 'T', 'F', 'F'], ['T', 'F', 'T', 'T'])... +2023-10-10 00:25:30,429 - DEBUG - cond - In cond. case... +2023-10-10 00:25:30,429 - DEBUG - conditional - Calling conditional(['F', 'T', 'F', 'F'], ['T', 'F', 'T', 'T'])... +2023-10-10 00:25:30,429 - DEBUG - conditional - new_row_values=['T', 'F', 'T', 'T'] +2023-10-10 00:25:30,429 - DEBUG - conditional - Returning with new row values. +2023-10-10 00:25:30,429 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['!Q'], '->', ['!P']])... +2023-10-10 00:25:30,430 - DEBUG - set_new_array_elem - new_array=['(!Q)->(!P)'] +2023-10-10 00:25:30,430 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,430 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'T', 'T'], +final_variable_combined=['(!Q)->(!P)'], +matrix=[['T', 'T', 'T', 'F', 'T'], ['T', 'F', 'F', 'T', 'F'], ['F', 'T', 'T', 'F', 'T'], ['F', 'F', 'T', 'F', 'T']], +variables=['P', 'Q', 'P->Q', '!Q', '!P'] +2023-10-10 00:25:30,430 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,430 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T', 'F', 'T'], ['T', 'F', 'F', 'T', 'F'], ['F', 'T', 'T', 'F', 'T'], ['F', 'F', 'T', 'F', 'T']], ['T', 'F', 'T', 'T'], ['P', 'Q', 'P->Q', '!Q', '!P'], ['(!Q)->(!P)'])... +2023-10-10 00:25:30,430 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)'] +2023-10-10 00:25:30,430 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-10-10 00:25:30,430 - DEBUG - switch_case - Entering switch_case(<->, ['T', 'F', 'T', 'T'], ['T', 'F', 'T', 'T'])... +2023-10-10 00:25:30,430 - DEBUG - bicond - In bicond. case... +2023-10-10 00:25:30,430 - DEBUG - biconditional - Calling biconditional(['T', 'F', 'T', 'T'], ['T', 'F', 'T', 'T'])... +2023-10-10 00:25:30,431 - DEBUG - biconditional - new_row_values=['T', 'T', 'T', 'T'] +2023-10-10 00:25:30,431 - DEBUG - biconditional - Returning with new row values. +2023-10-10 00:25:30,431 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P->Q'], '<->', ['(!Q)->(!P)']])... +2023-10-10 00:25:30,432 - DEBUG - set_new_array_elem - new_array=['(P->Q)<->((!Q)->(!P))'] +2023-10-10 00:25:30,432 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-10-10 00:25:30,432 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'T', 'T'], +final_variable_combined=['(P->Q)<->((!Q)->(!P))'], +matrix=[['T', 'T', 'T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F', 'T', 'T', 'T'], ['F', 'F', 'T', 'F', 'T', 'T', 'T']], +variables=['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)'] +2023-10-10 00:25:30,432 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-10-10 00:25:30,432 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'T', 'T', 'T'], returned_matrix=[['T', 'T', 'T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F', 'T', 'T', 'T'], ['F', 'F', 'T', 'F', 'T', 'T', 'T']], all_variables=['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)', '(P->Q)<->((!Q)->(!P))'] +2023-10-10 00:25:30,433 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-10-10 00:25:30,433 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'T', 'T', 'T'], +returned_matrix=[['T', 'T', 'T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F', 'T', 'T', 'T'], ['F', 'F', 'T', 'F', 'T', 'T', 'T']], +all_variables=['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)', '(P->Q)<->((!Q)->(!P))'] +2023-10-10 00:25:30,433 - DEBUG - print_details - Printing details... +2023-10-10 00:25:30,433 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,433 - INFO - print_details - -> Statement: ((P -> Q) <-> ((!Q) -> (!P))) +2023-10-10 00:25:30,434 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'T', 'T'] +2023-10-10 00:25:30,434 - INFO - print_details - -> All Variables: ['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)', '(P->Q)<->((!Q)->(!P))'] +2023-10-10 00:25:30,434 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F', 'T', 'T', 'T'], ['F', 'F', 'T', 'F', 'T', 'T', 'T']] +2023-10-10 00:25:30,434 - INFO - print_details - ************************** EVALUATE ************************** +2023-10-10 00:25:30,434 - INFO - simulate_main - Finished evaluating statement. +2023-10-10 00:25:30,434 - DEBUG - display_matrix - Displaying matrix to console... +2023-10-10 00:25:30,435 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(2, 4, ['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)', '(P->Q)<->((!Q)->(!P))'])... +2023-10-10 00:25:30,435 - DEBUG - get_number_of_spaces - total_space=64 +2023-10-10 00:25:30,435 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-10-10 00:25:30,436 - DEBUG - simulate_main - Returning from simulate_main()... +2023-10-10 00:25:30,436 - INFO - - Exiting Engine... diff --git a/engine/examples/keep_these/engine.log.4 b/engine/examples/keep_these/engine.log.4 new file mode 100644 index 0000000..a25c6b0 --- /dev/null +++ b/engine/examples/keep_these/engine.log.4 @@ -0,0 +1,1203 @@ +2023-08-30 12:12:18,571 - INFO - - Starting Engine... +2023-08-30 12:12:18,571 - DEBUG - simulate_main - Calling simulate_main()... +2023-08-30 12:12:18,571 - INFO - simulate_main - Statement: (T v (P -> Q)) +2023-08-30 12:12:18,571 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-08-30 12:12:18,571 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets((T v (P -> Q)))... +2023-08-30 12:12:18,571 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,571 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters((T v (P -> Q))) +2023-08-30 12:12:18,571 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-08-30 12:12:18,571 - DEBUG - validate_input - Calling validate_input(T)... +2023-08-30 12:12:18,572 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,572 - DEBUG - validate_input - Calling validate_input(v)... +2023-08-30 12:12:18,572 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,572 - DEBUG - validate_input - Calling validate_input(P)... +2023-08-30 12:12:18,572 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,572 - DEBUG - validate_input - Calling validate_input(-)... +2023-08-30 12:12:18,572 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,572 - DEBUG - validate_input - Calling validate_input(>)... +2023-08-30 12:12:18,572 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,572 - DEBUG - validate_input - Calling validate_input(Q)... +2023-08-30 12:12:18,572 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,572 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-08-30 12:12:18,572 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-08-30 12:12:18,572 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-08-30 12:12:18,572 - INFO - user_input - Processing statement... +2023-08-30 12:12:18,572 - DEBUG - user_input - statement=(T v (P -> Q)) +2023-08-30 12:12:18,573 - INFO - analyze_statement - Starting to analyze statement... +2023-08-30 12:12:18,573 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-08-30 12:12:18,573 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-08-30 12:12:18,573 - DEBUG - clean_whitespaces - Calling clean_whitespaces((T v (P -> Q)))... +2023-08-30 12:12:18,573 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=(Tv(P->Q)) +2023-08-30 12:12:18,573 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-08-30 12:12:18,573 - INFO - find_variables - Finding variables in statement... +2023-08-30 12:12:18,573 - DEBUG - find_variables - statement=(Tv(P->Q)) +2023-08-30 12:12:18,573 - DEBUG - find_variables - variables_array=['T', 'P', 'Q'] +2023-08-30 12:12:18,573 - INFO - find_variables - Found all variables in statement. +2023-08-30 12:12:18,573 - INFO - find_variables - *** Variables: ['T', 'P', 'Q'] *** +2023-08-30 12:12:18,573 - DEBUG - analyze_statement - variables_arr=['T', 'P', 'Q'] +2023-08-30 12:12:18,573 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-08-30 12:12:18,573 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-08-30 12:12:18,573 - DEBUG - create_array_of_elements - Calling create_array_of_elements((Tv(P->Q))) +2023-08-30 12:12:18,573 - DEBUG - create_array_of_elements - array_of_elements=['(', 'T', 'v', '(', 'P', '-', '>', 'Q', ')', ')'] +2023-08-30 12:12:18,573 - DEBUG - create_array_of_elements - Finished creating array. +2023-08-30 12:12:18,573 - DEBUG - check_conditionals - Calling check_conditionals(['(', 'T', 'v', '(', 'P', '-', '>', 'Q', ')', ')'], ['T', 'P', 'Q'])... +2023-08-30 12:12:18,573 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-08-30 12:12:18,573 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-08-30 12:12:18,574 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', 'T', 'v', '(', 'P', '-', '>', 'Q', ')', ')'] +2023-08-30 12:12:18,574 - DEBUG - create_conditionals - Conditional symbols were found in ['(', 'T', 'v', '(', 'P', '-', '>', 'Q', ')', ')'] +2023-08-30 12:12:18,574 - DEBUG - create_conditionals - array_of_elements=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-08-30 12:12:18,574 - DEBUG - create_conditionals - Finished creating conditionals. +2023-08-30 12:12:18,574 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=3, +variables_arr=['T', 'P', 'Q'], +array_of_elements=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-08-30 12:12:18,574 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,574 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,574 - INFO - print_details - -> Number of Variables: 3 +2023-08-30 12:12:18,574 - INFO - print_details - -> Variables: ['T', 'P', 'Q'] +2023-08-30 12:12:18,574 - INFO - print_details - -> Array of Elements: ['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-08-30 12:12:18,574 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,574 - INFO - analyze_statement - Analyzing concluded. +2023-08-30 12:12:18,574 - INFO - parse_array - Starting to parse array... +2023-08-30 12:12:18,574 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-08-30 12:12:18,574 - DEBUG - remove_brackets_around_variables - arr=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-08-30 12:12:18,574 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-08-30 12:12:18,574 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-08-30 12:12:18,574 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-08-30 12:12:18,574 - DEBUG - add_brackets_around_unary_connectives - arr=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-08-30 12:12:18,574 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-08-30 12:12:18,575 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'] +2023-08-30 12:12:18,575 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-08-30 12:12:18,575 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'])... +2023-08-30 12:12:18,575 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,575 - DEBUG - parse - Calling parse(['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'])... +2023-08-30 12:12:18,575 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'T', 'v', '(', 'P', '->', 'Q', ')', ')'])... +2023-08-30 12:12:18,575 - DEBUG - remove_outer_brackets - array=['T', 'v', '(', 'P', '->', 'Q', ')'] +2023-08-30 12:12:18,575 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,575 - DEBUG - parse - In parse(): arr=['T', 'v', '(', 'P', '->', 'Q', ')'] +2023-08-30 12:12:18,575 - DEBUG - find_connective - Calling find_connectives(['T', 'v', '(', 'P', '->', 'Q', ')'])... +2023-08-30 12:12:18,575 - DEBUG - find_connective - In find_connective(): elem=v, i=1 +2023-08-30 12:12:18,575 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,575 - DEBUG - parse - Calling parse(['(', 'P', '->', 'Q', ')'])... +2023-08-30 12:12:18,575 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', '->', 'Q', ')'])... +2023-08-30 12:12:18,575 - DEBUG - remove_outer_brackets - array=['P', '->', 'Q'] +2023-08-30 12:12:18,575 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,575 - DEBUG - parse - In parse(): arr=['P', '->', 'Q'] +2023-08-30 12:12:18,575 - DEBUG - find_connective - Calling find_connectives(['P', '->', 'Q'])... +2023-08-30 12:12:18,575 - DEBUG - find_connective - In find_connective(): elem=->, i=1 +2023-08-30 12:12:18,576 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,576 - DEBUG - parse - temp_array=[['P'], '->', ['Q']] +2023-08-30 12:12:18,576 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,576 - DEBUG - parse - temp_array=[['T'], 'v', [['P'], '->', ['Q']]] +2023-08-30 12:12:18,576 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,576 - DEBUG - parse_array - tree_structured_array=[['T'], 'v', [['P'], '->', ['Q']]] +2023-08-30 12:12:18,576 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,576 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,576 - INFO - print_details - -> Parsed Array: [['T'], 'v', [['P'], '->', ['Q']]] +2023-08-30 12:12:18,576 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,576 - INFO - parse_array - Finished parsing array. +2023-08-30 12:12:18,576 - DEBUG - user_input - In user_input(): +number_of_variables=3, +variables_as_array=['T', 'P', 'Q'], +statement=(T v (P -> Q)), +new_elements=[['T'], 'v', [['P'], '->', ['Q']]]. +2023-08-30 12:12:18,576 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-08-30 12:12:18,576 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=3, +variables_as_array=['T', 'P', 'Q'], +provided_statement=(T v (P -> Q)), +elements_in_tree=[['T'], 'v', [['P'], '->', ['Q']]] +2023-08-30 12:12:18,576 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,576 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,576 - INFO - print_details - -> number_of_variables: 3 +2023-08-30 12:12:18,576 - INFO - print_details - -> variables_as_array: ['T', 'P', 'Q'] +2023-08-30 12:12:18,576 - INFO - print_details - -> provided_statement: (T v (P -> Q)) +2023-08-30 12:12:18,576 - INFO - print_details - -> elements_in_tree: [['T'], 'v', [['P'], '->', ['Q']]] +2023-08-30 12:12:18,577 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,577 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-08-30 12:12:18,577 - DEBUG - create_matrix - Creating initial matrix... +2023-08-30 12:12:18,577 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,577 - DEBUG - recursive_table - n=3 +2023-08-30 12:12:18,577 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,577 - DEBUG - recursive_table - n=2 +2023-08-30 12:12:18,577 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,577 - DEBUG - recursive_table - n=1 +2023-08-30 12:12:18,577 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-08-30 12:12:18,577 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,577 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-08-30 12:12:18,577 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,577 - DEBUG - recursive_table - array_table=['TTT', 'TTF', 'TFT', 'TFF', 'FTT', 'FTF', 'FFT', 'FFF'] +2023-08-30 12:12:18,577 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,577 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] +2023-08-30 12:12:18,577 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-08-30 12:12:18,577 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-08-30 12:12:18,577 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[['T'], 'v', [['P'], '->', ['Q']]], +counter=0, +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables_as_array=['T', 'P', 'Q'] +2023-08-30 12:12:18,578 - DEBUG - evaluate_array - Calling evaluate_array([['T'], 'v', [['P'], '->', ['Q']]], 0, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'P', 'Q'])... +2023-08-30 12:12:18,578 - DEBUG - evaluate_array - Calling evaluate_array([['P'], '->', ['Q']], 1, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'P', 'Q'])... +2023-08-30 12:12:18,578 - DEBUG - switch_case - Entering switch_case(->, ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,578 - DEBUG - cond - In cond. case... +2023-08-30 12:12:18,578 - DEBUG - conditional - Calling conditional(['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,578 - DEBUG - conditional - new_row_values=['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'] +2023-08-30 12:12:18,578 - DEBUG - conditional - Returning with new row values. +2023-08-30 12:12:18,578 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], '->', ['Q']])... +2023-08-30 12:12:18,578 - DEBUG - set_new_array_elem - new_array=['P->Q'] +2023-08-30 12:12:18,578 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,578 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'], +final_variable_combined=['P->Q'], +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables=['T', 'P', 'Q'] +2023-08-30 12:12:18,578 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,578 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'], ['T', 'P', 'Q'], ['P->Q'])... +2023-08-30 12:12:18,578 - DEBUG - add_array_to_matrix - variables=['T', 'P', 'Q', 'P->Q'] +2023-08-30 12:12:18,578 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,578 - DEBUG - switch_case - Entering switch_case(v, ['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'])... +2023-08-30 12:12:18,578 - DEBUG - disj - In disj. case... +2023-08-30 12:12:18,578 - DEBUG - disjunction - Calling disjunction(['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'T', 'T', 'T', 'F', 'T', 'T'])... +2023-08-30 12:12:18,579 - DEBUG - disjunction - new_row_values=['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'] +2023-08-30 12:12:18,579 - DEBUG - disjunction - Returning with new row values. +2023-08-30 12:12:18,579 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['T'], 'v', ['P->Q']])... +2023-08-30 12:12:18,579 - DEBUG - set_new_array_elem - new_array=['Tv(P->Q)'] +2023-08-30 12:12:18,579 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,579 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'], +final_variable_combined=['Tv(P->Q)'], +matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'T', 'T'], ['F', 'F', 'F', 'T', 'T']], +variables=['T', 'P', 'Q', 'P->Q'] +2023-08-30 12:12:18,579 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,579 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'], returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'T', 'T'], ['F', 'F', 'F', 'T', 'T']], all_variables=['T', 'P', 'Q', 'P->Q', 'Tv(P->Q)'] +2023-08-30 12:12:18,579 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-08-30 12:12:18,579 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'], +returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'T', 'T'], ['F', 'F', 'F', 'T', 'T']], +all_variables=['T', 'P', 'Q', 'P->Q', 'Tv(P->Q)'] +2023-08-30 12:12:18,579 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,579 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,579 - INFO - print_details - -> Statement: (T v (P -> Q)) +2023-08-30 12:12:18,579 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'T', 'T', 'T', 'F', 'T', 'T'] +2023-08-30 12:12:18,579 - INFO - print_details - -> All Variables: ['T', 'P', 'Q', 'P->Q', 'Tv(P->Q)'] +2023-08-30 12:12:18,579 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'T'], ['T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'T'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'T', 'T'], ['F', 'F', 'F', 'T', 'T']] +2023-08-30 12:12:18,579 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,579 - INFO - simulate_main - Finished evaluating statement. +2023-08-30 12:12:18,580 - DEBUG - display_matrix - Displaying matrix to console... +2023-08-30 12:12:18,580 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(3, 1, ['T', 'P', 'Q', 'P->Q', 'Tv(P->Q)'])... +2023-08-30 12:12:18,580 - DEBUG - get_number_of_spaces - total_space=32 +2023-08-30 12:12:18,580 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-08-30 12:12:18,580 - DEBUG - simulate_main - Returning from simulate_main()... +2023-08-30 12:12:18,580 - INFO - simulate_main - Statement: ((T ^ Q) v (P ^ Q)) +2023-08-30 12:12:18,580 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-08-30 12:12:18,580 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(((T ^ Q) v (P ^ Q)))... +2023-08-30 12:12:18,580 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,580 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters(((T ^ Q) v (P ^ Q))) +2023-08-30 12:12:18,580 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-08-30 12:12:18,580 - DEBUG - validate_input - Calling validate_input(T)... +2023-08-30 12:12:18,580 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,580 - DEBUG - validate_input - Calling validate_input(^)... +2023-08-30 12:12:18,580 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,580 - DEBUG - validate_input - Calling validate_input(Q)... +2023-08-30 12:12:18,581 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,581 - DEBUG - validate_input - Calling validate_input(v)... +2023-08-30 12:12:18,581 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,581 - DEBUG - validate_input - Calling validate_input(P)... +2023-08-30 12:12:18,581 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,581 - DEBUG - validate_input - Calling validate_input(^)... +2023-08-30 12:12:18,581 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,581 - DEBUG - validate_input - Calling validate_input(Q)... +2023-08-30 12:12:18,581 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,581 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-08-30 12:12:18,581 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-08-30 12:12:18,581 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-08-30 12:12:18,581 - INFO - user_input - Processing statement... +2023-08-30 12:12:18,581 - DEBUG - user_input - statement=((T ^ Q) v (P ^ Q)) +2023-08-30 12:12:18,581 - INFO - analyze_statement - Starting to analyze statement... +2023-08-30 12:12:18,581 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-08-30 12:12:18,581 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-08-30 12:12:18,581 - DEBUG - clean_whitespaces - Calling clean_whitespaces(((T ^ Q) v (P ^ Q)))... +2023-08-30 12:12:18,581 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=((T^Q)v(P^Q)) +2023-08-30 12:12:18,581 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-08-30 12:12:18,582 - INFO - find_variables - Finding variables in statement... +2023-08-30 12:12:18,582 - DEBUG - find_variables - statement=((T^Q)v(P^Q)) +2023-08-30 12:12:18,582 - DEBUG - find_variables - variables_array=['T', 'Q', 'P'] +2023-08-30 12:12:18,582 - INFO - find_variables - Found all variables in statement. +2023-08-30 12:12:18,582 - INFO - find_variables - *** Variables: ['T', 'Q', 'P'] *** +2023-08-30 12:12:18,582 - DEBUG - analyze_statement - variables_arr=['T', 'Q', 'P'] +2023-08-30 12:12:18,582 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-08-30 12:12:18,582 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-08-30 12:12:18,582 - DEBUG - create_array_of_elements - Calling create_array_of_elements(((T^Q)v(P^Q))) +2023-08-30 12:12:18,582 - DEBUG - create_array_of_elements - array_of_elements=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,582 - DEBUG - create_array_of_elements - Finished creating array. +2023-08-30 12:12:18,582 - DEBUG - check_conditionals - Calling check_conditionals(['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'], ['T', 'Q', 'P'])... +2023-08-30 12:12:18,582 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-08-30 12:12:18,582 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-08-30 12:12:18,582 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,582 - DEBUG - create_conditionals - Search for conditionals finished and none were found, returning. +2023-08-30 12:12:18,582 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=3, +variables_arr=['T', 'Q', 'P'], +array_of_elements=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,582 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,582 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,582 - INFO - print_details - -> Number of Variables: 3 +2023-08-30 12:12:18,583 - INFO - print_details - -> Variables: ['T', 'Q', 'P'] +2023-08-30 12:12:18,583 - INFO - print_details - -> Array of Elements: ['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,583 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,583 - INFO - analyze_statement - Analyzing concluded. +2023-08-30 12:12:18,583 - INFO - parse_array - Starting to parse array... +2023-08-30 12:12:18,583 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-08-30 12:12:18,583 - DEBUG - remove_brackets_around_variables - arr=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,583 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-08-30 12:12:18,583 - DEBUG - parse_array - In parse_array(): elements_second=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,583 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-08-30 12:12:18,583 - DEBUG - add_brackets_around_unary_connectives - arr=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,583 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-08-30 12:12:18,583 - DEBUG - parse_array - In parse_array(): elements_second=['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,583 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-08-30 12:12:18,583 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'])... +2023-08-30 12:12:18,583 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,583 - DEBUG - parse - Calling parse(['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'])... +2023-08-30 12:12:18,584 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')', ')'])... +2023-08-30 12:12:18,584 - DEBUG - remove_outer_brackets - array=['(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')'] +2023-08-30 12:12:18,584 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,584 - DEBUG - parse - In parse(): arr=['(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')'] +2023-08-30 12:12:18,584 - DEBUG - find_connective - Calling find_connectives(['(', 'T', '^', 'Q', ')', 'v', '(', 'P', '^', 'Q', ')'])... +2023-08-30 12:12:18,584 - DEBUG - find_connective - In find_connective(): elem=v, i=5 +2023-08-30 12:12:18,584 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,584 - DEBUG - parse - Calling parse(['(', 'T', '^', 'Q', ')'])... +2023-08-30 12:12:18,584 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'T', '^', 'Q', ')'])... +2023-08-30 12:12:18,584 - DEBUG - remove_outer_brackets - array=['T', '^', 'Q'] +2023-08-30 12:12:18,584 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,584 - DEBUG - parse - In parse(): arr=['T', '^', 'Q'] +2023-08-30 12:12:18,584 - DEBUG - find_connective - Calling find_connectives(['T', '^', 'Q'])... +2023-08-30 12:12:18,584 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-08-30 12:12:18,584 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,584 - DEBUG - parse - temp_array=[['T'], '^', ['Q']] +2023-08-30 12:12:18,584 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,584 - DEBUG - parse - Calling parse(['(', 'P', '^', 'Q', ')'])... +2023-08-30 12:12:18,585 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', '^', 'Q', ')'])... +2023-08-30 12:12:18,585 - DEBUG - remove_outer_brackets - array=['P', '^', 'Q'] +2023-08-30 12:12:18,585 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,585 - DEBUG - parse - In parse(): arr=['P', '^', 'Q'] +2023-08-30 12:12:18,585 - DEBUG - find_connective - Calling find_connectives(['P', '^', 'Q'])... +2023-08-30 12:12:18,585 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-08-30 12:12:18,585 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,585 - DEBUG - parse - temp_array=[['P'], '^', ['Q']] +2023-08-30 12:12:18,585 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,585 - DEBUG - parse - temp_array=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-08-30 12:12:18,585 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,585 - DEBUG - parse_array - tree_structured_array=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-08-30 12:12:18,585 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,585 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,585 - INFO - print_details - -> Parsed Array: [[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-08-30 12:12:18,585 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,585 - INFO - parse_array - Finished parsing array. +2023-08-30 12:12:18,585 - DEBUG - user_input - In user_input(): +number_of_variables=3, +variables_as_array=['T', 'Q', 'P'], +statement=((T ^ Q) v (P ^ Q)), +new_elements=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]]. +2023-08-30 12:12:18,586 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-08-30 12:12:18,586 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=3, +variables_as_array=['T', 'Q', 'P'], +provided_statement=((T ^ Q) v (P ^ Q)), +elements_in_tree=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-08-30 12:12:18,586 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,586 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,586 - INFO - print_details - -> number_of_variables: 3 +2023-08-30 12:12:18,586 - INFO - print_details - -> variables_as_array: ['T', 'Q', 'P'] +2023-08-30 12:12:18,586 - INFO - print_details - -> provided_statement: ((T ^ Q) v (P ^ Q)) +2023-08-30 12:12:18,586 - INFO - print_details - -> elements_in_tree: [[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]] +2023-08-30 12:12:18,586 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,586 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-08-30 12:12:18,586 - DEBUG - create_matrix - Creating initial matrix... +2023-08-30 12:12:18,586 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,586 - DEBUG - recursive_table - n=3 +2023-08-30 12:12:18,586 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,586 - DEBUG - recursive_table - n=2 +2023-08-30 12:12:18,586 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,586 - DEBUG - recursive_table - n=1 +2023-08-30 12:12:18,587 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-08-30 12:12:18,587 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,587 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-08-30 12:12:18,587 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,587 - DEBUG - recursive_table - array_table=['TTT', 'TTF', 'TFT', 'TFF', 'FTT', 'FTF', 'FFT', 'FFF'] +2023-08-30 12:12:18,587 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,587 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] +2023-08-30 12:12:18,587 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-08-30 12:12:18,587 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-08-30 12:12:18,587 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]], +counter=0, +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables_as_array=['T', 'Q', 'P'] +2023-08-30 12:12:18,587 - DEBUG - evaluate_array - Calling evaluate_array([[['T'], '^', ['Q']], 'v', [['P'], '^', ['Q']]], 0, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'Q', 'P'])... +2023-08-30 12:12:18,587 - DEBUG - evaluate_array - Calling evaluate_array([['T'], '^', ['Q']], 1, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'Q', 'P'])... +2023-08-30 12:12:18,587 - DEBUG - switch_case - Entering switch_case(^, ['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'])... +2023-08-30 12:12:18,587 - DEBUG - conj - In conj. case... +2023-08-30 12:12:18,587 - DEBUG - conjunction - Calling conjunction(['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'])... +2023-08-30 12:12:18,587 - DEBUG - conjunction - new_row_values=['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'] +2023-08-30 12:12:18,587 - DEBUG - conjunction - Returning with new row values. +2023-08-30 12:12:18,587 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['T'], '^', ['Q']])... +2023-08-30 12:12:18,587 - DEBUG - set_new_array_elem - new_array=['T^Q'] +2023-08-30 12:12:18,588 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,588 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'], +final_variable_combined=['T^Q'], +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables=['T', 'Q', 'P'] +2023-08-30 12:12:18,588 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,588 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'], ['T', 'Q', 'P'], ['T^Q'])... +2023-08-30 12:12:18,588 - DEBUG - add_array_to_matrix - variables=['T', 'Q', 'P', 'T^Q'] +2023-08-30 12:12:18,588 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,588 - DEBUG - evaluate_array - Calling evaluate_array([['P'], '^', ['Q']], 1, [['T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T'], ['T', 'F', 'T', 'F'], ['T', 'F', 'F', 'F'], ['F', 'T', 'T', 'F'], ['F', 'T', 'F', 'F'], ['F', 'F', 'T', 'F'], ['F', 'F', 'F', 'F']], ['T', 'Q', 'P', 'T^Q'])... +2023-08-30 12:12:18,588 - DEBUG - switch_case - Entering switch_case(^, ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'], ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'])... +2023-08-30 12:12:18,588 - DEBUG - conj - In conj. case... +2023-08-30 12:12:18,588 - DEBUG - conjunction - Calling conjunction(['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'], ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'])... +2023-08-30 12:12:18,588 - DEBUG - conjunction - new_row_values=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-08-30 12:12:18,588 - DEBUG - conjunction - Returning with new row values. +2023-08-30 12:12:18,588 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], '^', ['Q']])... +2023-08-30 12:12:18,588 - DEBUG - set_new_array_elem - new_array=['P^Q'] +2023-08-30 12:12:18,588 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,588 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], +final_variable_combined=['P^Q'], +matrix=[['T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T'], ['T', 'F', 'T', 'F'], ['T', 'F', 'F', 'F'], ['F', 'T', 'T', 'F'], ['F', 'T', 'F', 'F'], ['F', 'F', 'T', 'F'], ['F', 'F', 'F', 'F']], +variables=['T', 'Q', 'P', 'T^Q'] +2023-08-30 12:12:18,588 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,588 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T'], ['T', 'F', 'T', 'F'], ['T', 'F', 'F', 'F'], ['F', 'T', 'T', 'F'], ['F', 'T', 'F', 'F'], ['F', 'F', 'T', 'F'], ['F', 'F', 'F', 'F']], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], ['T', 'Q', 'P', 'T^Q'], ['P^Q'])... +2023-08-30 12:12:18,589 - DEBUG - add_array_to_matrix - variables=['T', 'Q', 'P', 'T^Q', 'P^Q'] +2023-08-30 12:12:18,589 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,589 - DEBUG - switch_case - Entering switch_case(v, ['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-08-30 12:12:18,589 - DEBUG - disj - In disj. case... +2023-08-30 12:12:18,589 - DEBUG - disjunction - Calling disjunction(['T', 'T', 'F', 'F', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-08-30 12:12:18,589 - DEBUG - disjunction - new_row_values=['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-08-30 12:12:18,589 - DEBUG - disjunction - Returning with new row values. +2023-08-30 12:12:18,589 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['T^Q'], 'v', ['P^Q']])... +2023-08-30 12:12:18,589 - DEBUG - set_new_array_elem - new_array=['(T^Q)v(P^Q)'] +2023-08-30 12:12:18,589 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,589 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'], +final_variable_combined=['(T^Q)v(P^Q)'], +matrix=[['T', 'T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T', 'F', 'T'], ['T', 'F', 'T', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'F', 'T', 'T'], ['F', 'T', 'F', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F', 'F'], ['F', 'F', 'F', 'F', 'F', 'F']], +variables=['T', 'Q', 'P', 'T^Q', 'P^Q'] +2023-08-30 12:12:18,589 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,589 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'], returned_matrix=[['T', 'T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T', 'F', 'T'], ['T', 'F', 'T', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'F', 'T', 'T'], ['F', 'T', 'F', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F', 'F'], ['F', 'F', 'F', 'F', 'F', 'F']], all_variables=['T', 'Q', 'P', 'T^Q', 'P^Q', '(T^Q)v(P^Q)'] +2023-08-30 12:12:18,589 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-08-30 12:12:18,589 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'], +returned_matrix=[['T', 'T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T', 'F', 'T'], ['T', 'F', 'T', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'F', 'T', 'T'], ['F', 'T', 'F', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F', 'F'], ['F', 'F', 'F', 'F', 'F', 'F']], +all_variables=['T', 'Q', 'P', 'T^Q', 'P^Q', '(T^Q)v(P^Q)'] +2023-08-30 12:12:18,589 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,589 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,589 - INFO - print_details - -> Statement: ((T ^ Q) v (P ^ Q)) +2023-08-30 12:12:18,589 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-08-30 12:12:18,589 - INFO - print_details - -> All Variables: ['T', 'Q', 'P', 'T^Q', 'P^Q', '(T^Q)v(P^Q)'] +2023-08-30 12:12:18,590 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'T', 'F', 'T'], ['T', 'F', 'T', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'F', 'T', 'T'], ['F', 'T', 'F', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F', 'F'], ['F', 'F', 'F', 'F', 'F', 'F']] +2023-08-30 12:12:18,590 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,590 - INFO - simulate_main - Finished evaluating statement. +2023-08-30 12:12:18,590 - DEBUG - display_matrix - Displaying matrix to console... +2023-08-30 12:12:18,590 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(3, 2, ['T', 'Q', 'P', 'T^Q', 'P^Q', '(T^Q)v(P^Q)'])... +2023-08-30 12:12:18,590 - DEBUG - get_number_of_spaces - total_space=40 +2023-08-30 12:12:18,590 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-08-30 12:12:18,590 - DEBUG - simulate_main - Returning from simulate_main()... +2023-08-30 12:12:18,590 - INFO - simulate_main - Statement: (S ^ (R ^ Q)) +2023-08-30 12:12:18,590 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-08-30 12:12:18,590 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets((S ^ (R ^ Q)))... +2023-08-30 12:12:18,590 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,590 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters((S ^ (R ^ Q))) +2023-08-30 12:12:18,590 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-08-30 12:12:18,590 - DEBUG - validate_input - Calling validate_input(S)... +2023-08-30 12:12:18,590 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,590 - DEBUG - validate_input - Calling validate_input(^)... +2023-08-30 12:12:18,591 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,591 - DEBUG - validate_input - Calling validate_input(R)... +2023-08-30 12:12:18,591 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,591 - DEBUG - validate_input - Calling validate_input(^)... +2023-08-30 12:12:18,591 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,591 - DEBUG - validate_input - Calling validate_input(Q)... +2023-08-30 12:12:18,591 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,591 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-08-30 12:12:18,591 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-08-30 12:12:18,591 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-08-30 12:12:18,591 - INFO - user_input - Processing statement... +2023-08-30 12:12:18,591 - DEBUG - user_input - statement=(S ^ (R ^ Q)) +2023-08-30 12:12:18,591 - INFO - analyze_statement - Starting to analyze statement... +2023-08-30 12:12:18,591 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-08-30 12:12:18,591 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-08-30 12:12:18,591 - DEBUG - clean_whitespaces - Calling clean_whitespaces((S ^ (R ^ Q)))... +2023-08-30 12:12:18,591 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=(S^(R^Q)) +2023-08-30 12:12:18,591 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-08-30 12:12:18,591 - INFO - find_variables - Finding variables in statement... +2023-08-30 12:12:18,591 - DEBUG - find_variables - statement=(S^(R^Q)) +2023-08-30 12:12:18,591 - DEBUG - find_variables - variables_array=['S', 'R', 'Q'] +2023-08-30 12:12:18,592 - INFO - find_variables - Found all variables in statement. +2023-08-30 12:12:18,592 - INFO - find_variables - *** Variables: ['S', 'R', 'Q'] *** +2023-08-30 12:12:18,592 - DEBUG - analyze_statement - variables_arr=['S', 'R', 'Q'] +2023-08-30 12:12:18,592 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-08-30 12:12:18,592 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-08-30 12:12:18,592 - DEBUG - create_array_of_elements - Calling create_array_of_elements((S^(R^Q))) +2023-08-30 12:12:18,592 - DEBUG - create_array_of_elements - array_of_elements=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,592 - DEBUG - create_array_of_elements - Finished creating array. +2023-08-30 12:12:18,592 - DEBUG - check_conditionals - Calling check_conditionals(['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'], ['S', 'R', 'Q'])... +2023-08-30 12:12:18,592 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-08-30 12:12:18,592 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-08-30 12:12:18,592 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,592 - DEBUG - create_conditionals - Search for conditionals finished and none were found, returning. +2023-08-30 12:12:18,592 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=3, +variables_arr=['S', 'R', 'Q'], +array_of_elements=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,592 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,592 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,592 - INFO - print_details - -> Number of Variables: 3 +2023-08-30 12:12:18,592 - INFO - print_details - -> Variables: ['S', 'R', 'Q'] +2023-08-30 12:12:18,592 - INFO - print_details - -> Array of Elements: ['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,592 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,592 - INFO - analyze_statement - Analyzing concluded. +2023-08-30 12:12:18,592 - INFO - parse_array - Starting to parse array... +2023-08-30 12:12:18,593 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-08-30 12:12:18,593 - DEBUG - remove_brackets_around_variables - arr=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,593 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-08-30 12:12:18,593 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,593 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-08-30 12:12:18,593 - DEBUG - add_brackets_around_unary_connectives - arr=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,593 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-08-30 12:12:18,593 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'] +2023-08-30 12:12:18,593 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-08-30 12:12:18,593 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'])... +2023-08-30 12:12:18,593 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,593 - DEBUG - parse - Calling parse(['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'])... +2023-08-30 12:12:18,593 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'S', '^', '(', 'R', '^', 'Q', ')', ')'])... +2023-08-30 12:12:18,593 - DEBUG - remove_outer_brackets - array=['S', '^', '(', 'R', '^', 'Q', ')'] +2023-08-30 12:12:18,593 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,593 - DEBUG - parse - In parse(): arr=['S', '^', '(', 'R', '^', 'Q', ')'] +2023-08-30 12:12:18,593 - DEBUG - find_connective - Calling find_connectives(['S', '^', '(', 'R', '^', 'Q', ')'])... +2023-08-30 12:12:18,593 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-08-30 12:12:18,593 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,593 - DEBUG - parse - Calling parse(['(', 'R', '^', 'Q', ')'])... +2023-08-30 12:12:18,594 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'R', '^', 'Q', ')'])... +2023-08-30 12:12:18,594 - DEBUG - remove_outer_brackets - array=['R', '^', 'Q'] +2023-08-30 12:12:18,594 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,594 - DEBUG - parse - In parse(): arr=['R', '^', 'Q'] +2023-08-30 12:12:18,594 - DEBUG - find_connective - Calling find_connectives(['R', '^', 'Q'])... +2023-08-30 12:12:18,594 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-08-30 12:12:18,594 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,594 - DEBUG - parse - temp_array=[['R'], '^', ['Q']] +2023-08-30 12:12:18,594 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,594 - DEBUG - parse - temp_array=[['S'], '^', [['R'], '^', ['Q']]] +2023-08-30 12:12:18,594 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,594 - DEBUG - parse_array - tree_structured_array=[['S'], '^', [['R'], '^', ['Q']]] +2023-08-30 12:12:18,594 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,594 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,594 - INFO - print_details - -> Parsed Array: [['S'], '^', [['R'], '^', ['Q']]] +2023-08-30 12:12:18,594 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,594 - INFO - parse_array - Finished parsing array. +2023-08-30 12:12:18,594 - DEBUG - user_input - In user_input(): +number_of_variables=3, +variables_as_array=['S', 'R', 'Q'], +statement=(S ^ (R ^ Q)), +new_elements=[['S'], '^', [['R'], '^', ['Q']]]. +2023-08-30 12:12:18,594 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-08-30 12:12:18,594 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=3, +variables_as_array=['S', 'R', 'Q'], +provided_statement=(S ^ (R ^ Q)), +elements_in_tree=[['S'], '^', [['R'], '^', ['Q']]] +2023-08-30 12:12:18,595 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,595 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,595 - INFO - print_details - -> number_of_variables: 3 +2023-08-30 12:12:18,595 - INFO - print_details - -> variables_as_array: ['S', 'R', 'Q'] +2023-08-30 12:12:18,595 - INFO - print_details - -> provided_statement: (S ^ (R ^ Q)) +2023-08-30 12:12:18,595 - INFO - print_details - -> elements_in_tree: [['S'], '^', [['R'], '^', ['Q']]] +2023-08-30 12:12:18,595 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,595 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-08-30 12:12:18,595 - DEBUG - create_matrix - Creating initial matrix... +2023-08-30 12:12:18,595 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,595 - DEBUG - recursive_table - n=3 +2023-08-30 12:12:18,595 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,595 - DEBUG - recursive_table - n=2 +2023-08-30 12:12:18,595 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,595 - DEBUG - recursive_table - n=1 +2023-08-30 12:12:18,595 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-08-30 12:12:18,595 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,595 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-08-30 12:12:18,595 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,595 - DEBUG - recursive_table - array_table=['TTT', 'TTF', 'TFT', 'TFF', 'FTT', 'FTF', 'FFT', 'FFF'] +2023-08-30 12:12:18,595 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,595 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] +2023-08-30 12:12:18,596 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-08-30 12:12:18,596 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-08-30 12:12:18,596 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[['S'], '^', [['R'], '^', ['Q']]], +counter=0, +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables_as_array=['S', 'R', 'Q'] +2023-08-30 12:12:18,596 - DEBUG - evaluate_array - Calling evaluate_array([['S'], '^', [['R'], '^', ['Q']]], 0, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['S', 'R', 'Q'])... +2023-08-30 12:12:18,596 - DEBUG - evaluate_array - Calling evaluate_array([['R'], '^', ['Q']], 1, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['S', 'R', 'Q'])... +2023-08-30 12:12:18,596 - DEBUG - switch_case - Entering switch_case(^, ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,596 - DEBUG - conj - In conj. case... +2023-08-30 12:12:18,596 - DEBUG - conjunction - Calling conjunction(['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,596 - DEBUG - conjunction - new_row_values=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-08-30 12:12:18,596 - DEBUG - conjunction - Returning with new row values. +2023-08-30 12:12:18,596 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['R'], '^', ['Q']])... +2023-08-30 12:12:18,596 - DEBUG - set_new_array_elem - new_array=['R^Q'] +2023-08-30 12:12:18,596 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,596 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], +final_variable_combined=['R^Q'], +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables=['S', 'R', 'Q'] +2023-08-30 12:12:18,596 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,596 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], ['S', 'R', 'Q'], ['R^Q'])... +2023-08-30 12:12:18,596 - DEBUG - add_array_to_matrix - variables=['S', 'R', 'Q', 'R^Q'] +2023-08-30 12:12:18,596 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,597 - DEBUG - switch_case - Entering switch_case(^, ['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-08-30 12:12:18,597 - DEBUG - conj - In conj. case... +2023-08-30 12:12:18,597 - DEBUG - conjunction - Calling conjunction(['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-08-30 12:12:18,597 - DEBUG - conjunction - new_row_values=['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'] +2023-08-30 12:12:18,597 - DEBUG - conjunction - Returning with new row values. +2023-08-30 12:12:18,597 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['S'], '^', ['R^Q']])... +2023-08-30 12:12:18,597 - DEBUG - set_new_array_elem - new_array=['S^(R^Q)'] +2023-08-30 12:12:18,597 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,597 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'], +final_variable_combined=['S^(R^Q)'], +matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'F'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']], +variables=['S', 'R', 'Q', 'R^Q'] +2023-08-30 12:12:18,597 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,597 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'], returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'F'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']], all_variables=['S', 'R', 'Q', 'R^Q', 'S^(R^Q)'] +2023-08-30 12:12:18,597 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-08-30 12:12:18,597 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'], +returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'F'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']], +all_variables=['S', 'R', 'Q', 'R^Q', 'S^(R^Q)'] +2023-08-30 12:12:18,598 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,598 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,598 - INFO - print_details - -> Statement: (S ^ (R ^ Q)) +2023-08-30 12:12:18,598 - INFO - print_details - -> Final Calculated Array: ['T', 'F', 'F', 'F', 'F', 'F', 'F', 'F'] +2023-08-30 12:12:18,598 - INFO - print_details - -> All Variables: ['S', 'R', 'Q', 'R^Q', 'S^(R^Q)'] +2023-08-30 12:12:18,598 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'F'], ['F', 'T', 'F', 'F', 'F'], ['F', 'F', 'T', 'F', 'F'], ['F', 'F', 'F', 'F', 'F']] +2023-08-30 12:12:18,598 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,598 - INFO - simulate_main - Finished evaluating statement. +2023-08-30 12:12:18,598 - DEBUG - display_matrix - Displaying matrix to console... +2023-08-30 12:12:18,598 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(3, 1, ['S', 'R', 'Q', 'R^Q', 'S^(R^Q)'])... +2023-08-30 12:12:18,598 - DEBUG - get_number_of_spaces - total_space=30 +2023-08-30 12:12:18,598 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-08-30 12:12:18,598 - DEBUG - simulate_main - Returning from simulate_main()... +2023-08-30 12:12:18,598 - INFO - simulate_main - Statement: (P v Q) +2023-08-30 12:12:18,598 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-08-30 12:12:18,599 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets((P v Q))... +2023-08-30 12:12:18,599 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,599 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters((P v Q)) +2023-08-30 12:12:18,599 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-08-30 12:12:18,599 - DEBUG - validate_input - Calling validate_input(P)... +2023-08-30 12:12:18,599 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,599 - DEBUG - validate_input - Calling validate_input(v)... +2023-08-30 12:12:18,599 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,599 - DEBUG - validate_input - Calling validate_input(Q)... +2023-08-30 12:12:18,599 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,599 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-08-30 12:12:18,599 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-08-30 12:12:18,599 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-08-30 12:12:18,599 - INFO - user_input - Processing statement... +2023-08-30 12:12:18,599 - DEBUG - user_input - statement=(P v Q) +2023-08-30 12:12:18,599 - INFO - analyze_statement - Starting to analyze statement... +2023-08-30 12:12:18,599 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-08-30 12:12:18,599 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-08-30 12:12:18,599 - DEBUG - clean_whitespaces - Calling clean_whitespaces((P v Q))... +2023-08-30 12:12:18,599 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=(PvQ) +2023-08-30 12:12:18,600 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-08-30 12:12:18,600 - INFO - find_variables - Finding variables in statement... +2023-08-30 12:12:18,600 - DEBUG - find_variables - statement=(PvQ) +2023-08-30 12:12:18,600 - DEBUG - find_variables - variables_array=['P', 'Q'] +2023-08-30 12:12:18,600 - INFO - find_variables - Found all variables in statement. +2023-08-30 12:12:18,600 - INFO - find_variables - *** Variables: ['P', 'Q'] *** +2023-08-30 12:12:18,600 - DEBUG - analyze_statement - variables_arr=['P', 'Q'] +2023-08-30 12:12:18,600 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-08-30 12:12:18,600 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-08-30 12:12:18,600 - DEBUG - create_array_of_elements - Calling create_array_of_elements((PvQ)) +2023-08-30 12:12:18,600 - DEBUG - create_array_of_elements - array_of_elements=['(', 'P', 'v', 'Q', ')'] +2023-08-30 12:12:18,600 - DEBUG - create_array_of_elements - Finished creating array. +2023-08-30 12:12:18,600 - DEBUG - check_conditionals - Calling check_conditionals(['(', 'P', 'v', 'Q', ')'], ['P', 'Q'])... +2023-08-30 12:12:18,600 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-08-30 12:12:18,600 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-08-30 12:12:18,600 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', 'P', 'v', 'Q', ')'] +2023-08-30 12:12:18,600 - DEBUG - create_conditionals - Search for conditionals finished and none were found, returning. +2023-08-30 12:12:18,600 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=2, +variables_arr=['P', 'Q'], +array_of_elements=['(', 'P', 'v', 'Q', ')'] +2023-08-30 12:12:18,600 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,600 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,600 - INFO - print_details - -> Number of Variables: 2 +2023-08-30 12:12:18,601 - INFO - print_details - -> Variables: ['P', 'Q'] +2023-08-30 12:12:18,601 - INFO - print_details - -> Array of Elements: ['(', 'P', 'v', 'Q', ')'] +2023-08-30 12:12:18,601 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,601 - INFO - analyze_statement - Analyzing concluded. +2023-08-30 12:12:18,601 - INFO - parse_array - Starting to parse array... +2023-08-30 12:12:18,601 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-08-30 12:12:18,601 - DEBUG - remove_brackets_around_variables - arr=['(', 'P', 'v', 'Q', ')'] +2023-08-30 12:12:18,601 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-08-30 12:12:18,601 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'P', 'v', 'Q', ')'] +2023-08-30 12:12:18,601 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-08-30 12:12:18,601 - DEBUG - add_brackets_around_unary_connectives - arr=['(', 'P', 'v', 'Q', ')'] +2023-08-30 12:12:18,601 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-08-30 12:12:18,601 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'P', 'v', 'Q', ')'] +2023-08-30 12:12:18,601 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-08-30 12:12:18,601 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', 'P', 'v', 'Q', ')'])... +2023-08-30 12:12:18,601 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,601 - DEBUG - parse - Calling parse(['(', 'P', 'v', 'Q', ')'])... +2023-08-30 12:12:18,601 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', 'v', 'Q', ')'])... +2023-08-30 12:12:18,601 - DEBUG - remove_outer_brackets - array=['P', 'v', 'Q'] +2023-08-30 12:12:18,601 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,602 - DEBUG - parse - In parse(): arr=['P', 'v', 'Q'] +2023-08-30 12:12:18,602 - DEBUG - find_connective - Calling find_connectives(['P', 'v', 'Q'])... +2023-08-30 12:12:18,602 - DEBUG - find_connective - In find_connective(): elem=v, i=1 +2023-08-30 12:12:18,602 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,602 - DEBUG - parse - temp_array=[['P'], 'v', ['Q']] +2023-08-30 12:12:18,602 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,602 - DEBUG - parse_array - tree_structured_array=[['P'], 'v', ['Q']] +2023-08-30 12:12:18,602 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,602 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,602 - INFO - print_details - -> Parsed Array: [['P'], 'v', ['Q']] +2023-08-30 12:12:18,602 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,602 - INFO - parse_array - Finished parsing array. +2023-08-30 12:12:18,602 - DEBUG - user_input - In user_input(): +number_of_variables=2, +variables_as_array=['P', 'Q'], +statement=(P v Q), +new_elements=[['P'], 'v', ['Q']]. +2023-08-30 12:12:18,602 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-08-30 12:12:18,602 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=2, +variables_as_array=['P', 'Q'], +provided_statement=(P v Q), +elements_in_tree=[['P'], 'v', ['Q']] +2023-08-30 12:12:18,602 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,602 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,602 - INFO - print_details - -> number_of_variables: 2 +2023-08-30 12:12:18,602 - INFO - print_details - -> variables_as_array: ['P', 'Q'] +2023-08-30 12:12:18,602 - INFO - print_details - -> provided_statement: (P v Q) +2023-08-30 12:12:18,602 - INFO - print_details - -> elements_in_tree: [['P'], 'v', ['Q']] +2023-08-30 12:12:18,602 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,602 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-08-30 12:12:18,602 - DEBUG - create_matrix - Creating initial matrix... +2023-08-30 12:12:18,602 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,602 - DEBUG - recursive_table - n=2 +2023-08-30 12:12:18,602 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,602 - DEBUG - recursive_table - n=1 +2023-08-30 12:12:18,602 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-08-30 12:12:18,602 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,602 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-08-30 12:12:18,603 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,603 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']] +2023-08-30 12:12:18,603 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-08-30 12:12:18,603 - INFO - create_matrix - *** Initial Matrix: [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']] *** +2023-08-30 12:12:18,603 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[['P'], 'v', ['Q']], +counter=0, +matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], +variables_as_array=['P', 'Q'] +2023-08-30 12:12:18,603 - DEBUG - evaluate_array - Calling evaluate_array([['P'], 'v', ['Q']], 0, [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], ['P', 'Q'])... +2023-08-30 12:12:18,603 - DEBUG - switch_case - Entering switch_case(v, ['T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,603 - DEBUG - disj - In disj. case... +2023-08-30 12:12:18,604 - DEBUG - disjunction - Calling disjunction(['T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,604 - DEBUG - disjunction - new_row_values=['T', 'T', 'T', 'F'] +2023-08-30 12:12:18,604 - DEBUG - disjunction - Returning with new row values. +2023-08-30 12:12:18,604 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], 'v', ['Q']])... +2023-08-30 12:12:18,604 - DEBUG - set_new_array_elem - new_array=['PvQ'] +2023-08-30 12:12:18,604 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,604 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'T', 'F'], +final_variable_combined=['PvQ'], +matrix=[['T', 'T', 'T'], ['T', 'F', 'T'], ['F', 'T', 'T'], ['F', 'F', 'F']], +variables=['P', 'Q'] +2023-08-30 12:12:18,604 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,604 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'T', 'T', 'F'], returned_matrix=[['T', 'T', 'T'], ['T', 'F', 'T'], ['F', 'T', 'T'], ['F', 'F', 'F']], all_variables=['P', 'Q', 'PvQ'] +2023-08-30 12:12:18,604 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-08-30 12:12:18,604 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'T', 'T', 'F'], +returned_matrix=[['T', 'T', 'T'], ['T', 'F', 'T'], ['F', 'T', 'T'], ['F', 'F', 'F']], +all_variables=['P', 'Q', 'PvQ'] +2023-08-30 12:12:18,604 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,604 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,604 - INFO - print_details - -> Statement: (P v Q) +2023-08-30 12:12:18,604 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'T', 'F'] +2023-08-30 12:12:18,604 - INFO - print_details - -> All Variables: ['P', 'Q', 'PvQ'] +2023-08-30 12:12:18,604 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T'], ['T', 'F', 'T'], ['F', 'T', 'T'], ['F', 'F', 'F']] +2023-08-30 12:12:18,604 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,604 - INFO - simulate_main - Finished evaluating statement. +2023-08-30 12:12:18,604 - DEBUG - display_matrix - Displaying matrix to console... +2023-08-30 12:12:18,605 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(2, 0, ['P', 'Q', 'PvQ'])... +2023-08-30 12:12:18,605 - DEBUG - get_number_of_spaces - total_space=16 +2023-08-30 12:12:18,605 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-08-30 12:12:18,605 - DEBUG - simulate_main - Returning from simulate_main()... +2023-08-30 12:12:18,605 - INFO - simulate_main - Statement: (P -> (Q ^ R)) +2023-08-30 12:12:18,605 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-08-30 12:12:18,605 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets((P -> (Q ^ R)))... +2023-08-30 12:12:18,605 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,605 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters((P -> (Q ^ R))) +2023-08-30 12:12:18,605 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-08-30 12:12:18,605 - DEBUG - validate_input - Calling validate_input(P)... +2023-08-30 12:12:18,605 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,605 - DEBUG - validate_input - Calling validate_input(-)... +2023-08-30 12:12:18,605 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,605 - DEBUG - validate_input - Calling validate_input(>)... +2023-08-30 12:12:18,605 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,605 - DEBUG - validate_input - Calling validate_input(Q)... +2023-08-30 12:12:18,605 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,606 - DEBUG - validate_input - Calling validate_input(^)... +2023-08-30 12:12:18,606 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,606 - DEBUG - validate_input - Calling validate_input(R)... +2023-08-30 12:12:18,606 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,606 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-08-30 12:12:18,606 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-08-30 12:12:18,606 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-08-30 12:12:18,606 - INFO - user_input - Processing statement... +2023-08-30 12:12:18,606 - DEBUG - user_input - statement=(P -> (Q ^ R)) +2023-08-30 12:12:18,606 - INFO - analyze_statement - Starting to analyze statement... +2023-08-30 12:12:18,606 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-08-30 12:12:18,606 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-08-30 12:12:18,606 - DEBUG - clean_whitespaces - Calling clean_whitespaces((P -> (Q ^ R)))... +2023-08-30 12:12:18,606 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=(P->(Q^R)) +2023-08-30 12:12:18,606 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-08-30 12:12:18,606 - INFO - find_variables - Finding variables in statement... +2023-08-30 12:12:18,606 - DEBUG - find_variables - statement=(P->(Q^R)) +2023-08-30 12:12:18,606 - DEBUG - find_variables - variables_array=['P', 'Q', 'R'] +2023-08-30 12:12:18,606 - INFO - find_variables - Found all variables in statement. +2023-08-30 12:12:18,606 - INFO - find_variables - *** Variables: ['P', 'Q', 'R'] *** +2023-08-30 12:12:18,607 - DEBUG - analyze_statement - variables_arr=['P', 'Q', 'R'] +2023-08-30 12:12:18,607 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-08-30 12:12:18,607 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-08-30 12:12:18,607 - DEBUG - create_array_of_elements - Calling create_array_of_elements((P->(Q^R))) +2023-08-30 12:12:18,607 - DEBUG - create_array_of_elements - array_of_elements=['(', 'P', '-', '>', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,607 - DEBUG - create_array_of_elements - Finished creating array. +2023-08-30 12:12:18,607 - DEBUG - check_conditionals - Calling check_conditionals(['(', 'P', '-', '>', '(', 'Q', '^', 'R', ')', ')'], ['P', 'Q', 'R'])... +2023-08-30 12:12:18,607 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-08-30 12:12:18,607 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-08-30 12:12:18,607 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', 'P', '-', '>', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,607 - DEBUG - create_conditionals - Conditional symbols were found in ['(', 'P', '-', '>', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,607 - DEBUG - create_conditionals - array_of_elements=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,607 - DEBUG - create_conditionals - Finished creating conditionals. +2023-08-30 12:12:18,607 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=3, +variables_arr=['P', 'Q', 'R'], +array_of_elements=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,607 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,607 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,607 - INFO - print_details - -> Number of Variables: 3 +2023-08-30 12:12:18,607 - INFO - print_details - -> Variables: ['P', 'Q', 'R'] +2023-08-30 12:12:18,607 - INFO - print_details - -> Array of Elements: ['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,607 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,608 - INFO - analyze_statement - Analyzing concluded. +2023-08-30 12:12:18,608 - INFO - parse_array - Starting to parse array... +2023-08-30 12:12:18,608 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-08-30 12:12:18,608 - DEBUG - remove_brackets_around_variables - arr=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,608 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-08-30 12:12:18,608 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,608 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-08-30 12:12:18,608 - DEBUG - add_brackets_around_unary_connectives - arr=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,608 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-08-30 12:12:18,608 - DEBUG - parse_array - In parse_array(): elements_second=['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'] +2023-08-30 12:12:18,608 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-08-30 12:12:18,608 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'])... +2023-08-30 12:12:18,608 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,608 - DEBUG - parse - Calling parse(['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'])... +2023-08-30 12:12:18,608 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', '->', '(', 'Q', '^', 'R', ')', ')'])... +2023-08-30 12:12:18,608 - DEBUG - remove_outer_brackets - array=['P', '->', '(', 'Q', '^', 'R', ')'] +2023-08-30 12:12:18,608 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,608 - DEBUG - parse - In parse(): arr=['P', '->', '(', 'Q', '^', 'R', ')'] +2023-08-30 12:12:18,608 - DEBUG - find_connective - Calling find_connectives(['P', '->', '(', 'Q', '^', 'R', ')'])... +2023-08-30 12:12:18,608 - DEBUG - find_connective - In find_connective(): elem=->, i=1 +2023-08-30 12:12:18,608 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,609 - DEBUG - parse - Calling parse(['(', 'Q', '^', 'R', ')'])... +2023-08-30 12:12:18,609 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'Q', '^', 'R', ')'])... +2023-08-30 12:12:18,609 - DEBUG - remove_outer_brackets - array=['Q', '^', 'R'] +2023-08-30 12:12:18,609 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,609 - DEBUG - parse - In parse(): arr=['Q', '^', 'R'] +2023-08-30 12:12:18,609 - DEBUG - find_connective - Calling find_connectives(['Q', '^', 'R'])... +2023-08-30 12:12:18,609 - DEBUG - find_connective - In find_connective(): elem=^, i=1 +2023-08-30 12:12:18,609 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,609 - DEBUG - parse - temp_array=[['Q'], '^', ['R']] +2023-08-30 12:12:18,609 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,609 - DEBUG - parse - temp_array=[['P'], '->', [['Q'], '^', ['R']]] +2023-08-30 12:12:18,609 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,609 - DEBUG - parse_array - tree_structured_array=[['P'], '->', [['Q'], '^', ['R']]] +2023-08-30 12:12:18,609 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,609 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,609 - INFO - print_details - -> Parsed Array: [['P'], '->', [['Q'], '^', ['R']]] +2023-08-30 12:12:18,609 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,609 - INFO - parse_array - Finished parsing array. +2023-08-30 12:12:18,609 - DEBUG - user_input - In user_input(): +number_of_variables=3, +variables_as_array=['P', 'Q', 'R'], +statement=(P -> (Q ^ R)), +new_elements=[['P'], '->', [['Q'], '^', ['R']]]. +2023-08-30 12:12:18,609 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-08-30 12:12:18,609 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=3, +variables_as_array=['P', 'Q', 'R'], +provided_statement=(P -> (Q ^ R)), +elements_in_tree=[['P'], '->', [['Q'], '^', ['R']]] +2023-08-30 12:12:18,610 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,610 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,610 - INFO - print_details - -> number_of_variables: 3 +2023-08-30 12:12:18,610 - INFO - print_details - -> variables_as_array: ['P', 'Q', 'R'] +2023-08-30 12:12:18,610 - INFO - print_details - -> provided_statement: (P -> (Q ^ R)) +2023-08-30 12:12:18,610 - INFO - print_details - -> elements_in_tree: [['P'], '->', [['Q'], '^', ['R']]] +2023-08-30 12:12:18,610 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,610 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-08-30 12:12:18,610 - DEBUG - create_matrix - Creating initial matrix... +2023-08-30 12:12:18,610 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,610 - DEBUG - recursive_table - n=3 +2023-08-30 12:12:18,610 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,610 - DEBUG - recursive_table - n=2 +2023-08-30 12:12:18,610 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,610 - DEBUG - recursive_table - n=1 +2023-08-30 12:12:18,610 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-08-30 12:12:18,610 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,610 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-08-30 12:12:18,610 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,610 - DEBUG - recursive_table - array_table=['TTT', 'TTF', 'TFT', 'TFF', 'FTT', 'FTF', 'FFT', 'FFF'] +2023-08-30 12:12:18,610 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,611 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] +2023-08-30 12:12:18,611 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-08-30 12:12:18,611 - INFO - create_matrix - *** Initial Matrix: [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']] *** +2023-08-30 12:12:18,611 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[['P'], '->', [['Q'], '^', ['R']]], +counter=0, +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables_as_array=['P', 'Q', 'R'] +2023-08-30 12:12:18,611 - DEBUG - evaluate_array - Calling evaluate_array([['P'], '->', [['Q'], '^', ['R']]], 0, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['P', 'Q', 'R'])... +2023-08-30 12:12:18,611 - DEBUG - evaluate_array - Calling evaluate_array([['Q'], '^', ['R']], 1, [['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['P', 'Q', 'R'])... +2023-08-30 12:12:18,611 - DEBUG - switch_case - Entering switch_case(^, ['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,611 - DEBUG - conj - In conj. case... +2023-08-30 12:12:18,611 - DEBUG - conjunction - Calling conjunction(['T', 'T', 'F', 'F', 'T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F', 'T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,611 - DEBUG - conjunction - new_row_values=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'] +2023-08-30 12:12:18,611 - DEBUG - conjunction - Returning with new row values. +2023-08-30 12:12:18,611 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['Q'], '^', ['R']])... +2023-08-30 12:12:18,611 - DEBUG - set_new_array_elem - new_array=['Q^R'] +2023-08-30 12:12:18,611 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,611 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], +final_variable_combined=['Q^R'], +matrix=[['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], +variables=['P', 'Q', 'R'] +2023-08-30 12:12:18,611 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,611 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'T', 'F'], ['T', 'F', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'T', 'F'], ['F', 'F', 'T'], ['F', 'F', 'F']], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'], ['P', 'Q', 'R'], ['Q^R'])... +2023-08-30 12:12:18,612 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'R', 'Q^R'] +2023-08-30 12:12:18,612 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,612 - DEBUG - switch_case - Entering switch_case(->, ['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-08-30 12:12:18,612 - DEBUG - cond - In cond. case... +2023-08-30 12:12:18,612 - DEBUG - conditional - Calling conditional(['T', 'T', 'T', 'T', 'F', 'F', 'F', 'F'], ['T', 'F', 'F', 'F', 'T', 'F', 'F', 'F'])... +2023-08-30 12:12:18,612 - DEBUG - conditional - new_row_values=['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'] +2023-08-30 12:12:18,612 - DEBUG - conditional - Returning with new row values. +2023-08-30 12:12:18,612 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], '->', ['Q^R']])... +2023-08-30 12:12:18,612 - DEBUG - set_new_array_elem - new_array=['P->(Q^R)'] +2023-08-30 12:12:18,612 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,612 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'], +final_variable_combined=['P->(Q^R)'], +matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'T'], ['F', 'F', 'T', 'F', 'T'], ['F', 'F', 'F', 'F', 'T']], +variables=['P', 'Q', 'R', 'Q^R'] +2023-08-30 12:12:18,612 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,612 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'], returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'T'], ['F', 'F', 'T', 'F', 'T'], ['F', 'F', 'F', 'F', 'T']], all_variables=['P', 'Q', 'R', 'Q^R', 'P->(Q^R)'] +2023-08-30 12:12:18,612 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-08-30 12:12:18,612 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'], +returned_matrix=[['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'T'], ['F', 'F', 'T', 'F', 'T'], ['F', 'F', 'F', 'F', 'T']], +all_variables=['P', 'Q', 'R', 'Q^R', 'P->(Q^R)'] +2023-08-30 12:12:18,612 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,612 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,612 - INFO - print_details - -> Statement: (P -> (Q ^ R)) +2023-08-30 12:12:18,612 - INFO - print_details - -> Final Calculated Array: ['T', 'F', 'F', 'F', 'T', 'T', 'T', 'T'] +2023-08-30 12:12:18,612 - INFO - print_details - -> All Variables: ['P', 'Q', 'R', 'Q^R', 'P->(Q^R)'] +2023-08-30 12:12:18,613 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'T', 'T'], ['T', 'T', 'F', 'F', 'F'], ['T', 'F', 'T', 'F', 'F'], ['T', 'F', 'F', 'F', 'F'], ['F', 'T', 'T', 'T', 'T'], ['F', 'T', 'F', 'F', 'T'], ['F', 'F', 'T', 'F', 'T'], ['F', 'F', 'F', 'F', 'T']] +2023-08-30 12:12:18,613 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,613 - INFO - simulate_main - Finished evaluating statement. +2023-08-30 12:12:18,613 - DEBUG - display_matrix - Displaying matrix to console... +2023-08-30 12:12:18,613 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(3, 1, ['P', 'Q', 'R', 'Q^R', 'P->(Q^R)'])... +2023-08-30 12:12:18,613 - DEBUG - get_number_of_spaces - total_space=31 +2023-08-30 12:12:18,613 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-08-30 12:12:18,613 - DEBUG - simulate_main - Returning from simulate_main()... +2023-08-30 12:12:18,613 - INFO - simulate_main - Statement: ((P -> Q) <-> ((!Q) -> (!P))) +2023-08-30 12:12:18,613 - INFO - simulate_main - Before proceeding, doing checks for unequal brackets and illegal characters. +2023-08-30 12:12:18,613 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(((P -> Q) <-> ((!Q) -> (!P))))... +2023-08-30 12:12:18,613 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,613 - DEBUG - check_for_illegal_characters - Calling check_for_illegal_characters(((P -> Q) <-> ((!Q) -> (!P)))) +2023-08-30 12:12:18,613 - DEBUG - check_for_illegal_characters - ******************** starting input validation ******************* +2023-08-30 12:12:18,613 - DEBUG - validate_input - Calling validate_input(P)... +2023-08-30 12:12:18,613 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,613 - DEBUG - validate_input - Calling validate_input(-)... +2023-08-30 12:12:18,613 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(>)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(Q)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(<)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(-)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(>)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(!)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(Q)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(-)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(>)... +2023-08-30 12:12:18,614 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,614 - DEBUG - validate_input - Calling validate_input(!)... +2023-08-30 12:12:18,615 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,615 - DEBUG - validate_input - Calling validate_input(P)... +2023-08-30 12:12:18,615 - DEBUG - validate_input - Checked against a regex. result(is it valid?)=True. +2023-08-30 12:12:18,615 - DEBUG - check_for_illegal_characters - ******************** finished input validation ******************* +2023-08-30 12:12:18,615 - INFO - check_for_illegal_characters - PASS: There were no illegal characters found. +2023-08-30 12:12:18,615 - INFO - simulate_main - All checks are valid, proceeding with extracting information from statement. +2023-08-30 12:12:18,615 - INFO - user_input - Processing statement... +2023-08-30 12:12:18,615 - DEBUG - user_input - statement=((P -> Q) <-> ((!Q) -> (!P))) +2023-08-30 12:12:18,615 - INFO - analyze_statement - Starting to analyze statement... +2023-08-30 12:12:18,615 - INFO - analyze_statement - The statement is sanitized from any whitespaces. +2023-08-30 12:12:18,615 - DEBUG - analyze_statement - All whitespaces need to be removed, proceeding. +2023-08-30 12:12:18,615 - DEBUG - clean_whitespaces - Calling clean_whitespaces(((P -> Q) <-> ((!Q) -> (!P))))... +2023-08-30 12:12:18,615 - DEBUG - clean_whitespaces - Finished removing whitespaces: statement=((P->Q)<->((!Q)->(!P))) +2023-08-30 12:12:18,615 - DEBUG - analyze_statement - Finished removing any whitespaces found in statement. Proceeding with finding variables. +2023-08-30 12:12:18,615 - INFO - find_variables - Finding variables in statement... +2023-08-30 12:12:18,615 - DEBUG - find_variables - statement=((P->Q)<->((!Q)->(!P))) +2023-08-30 12:12:18,615 - DEBUG - find_variables - variables_array=['P', 'Q'] +2023-08-30 12:12:18,615 - INFO - find_variables - Found all variables in statement. +2023-08-30 12:12:18,615 - INFO - find_variables - *** Variables: ['P', 'Q'] *** +2023-08-30 12:12:18,615 - DEBUG - analyze_statement - variables_arr=['P', 'Q'] +2023-08-30 12:12:18,615 - INFO - analyze_statement - The statement is converted to an array and any conditionals are sanitized. +2023-08-30 12:12:18,615 - DEBUG - create_array_of_elements - Creating an array from a string... +2023-08-30 12:12:18,616 - DEBUG - create_array_of_elements - Calling create_array_of_elements(((P->Q)<->((!Q)->(!P)))) +2023-08-30 12:12:18,616 - DEBUG - create_array_of_elements - array_of_elements=['(', '(', 'P', '-', '>', 'Q', ')', '<', '-', '>', '(', '(', '!', 'Q', ')', '-', '>', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,616 - DEBUG - create_array_of_elements - Finished creating array. +2023-08-30 12:12:18,616 - DEBUG - check_conditionals - Calling check_conditionals(['(', '(', 'P', '-', '>', 'Q', ')', '<', '-', '>', '(', '(', '!', 'Q', ')', '-', '>', '(', '!', 'P', ')', ')', ')'], ['P', 'Q'])... +2023-08-30 12:12:18,616 - INFO - check_conditionals - PASS: Any conditional symbols present, are in the desired form. +2023-08-30 12:12:18,616 - DEBUG - create_conditionals - Creating one-piece conditionals from single elements. +2023-08-30 12:12:18,616 - DEBUG - create_conditionals - Searching for a '-' in array_of_elements=['(', '(', 'P', '-', '>', 'Q', ')', '<', '-', '>', '(', '(', '!', 'Q', ')', '-', '>', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,616 - DEBUG - create_conditionals - Conditional symbols were found in ['(', '(', 'P', '-', '>', 'Q', ')', '<', '-', '>', '(', '(', '!', 'Q', ')', '-', '>', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,616 - DEBUG - create_conditionals - array_of_elements=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,616 - DEBUG - create_conditionals - Finished creating conditionals. +2023-08-30 12:12:18,616 - DEBUG - analyze_statement - In analyze_statement(): +len(variables_arr)=2, +variables_arr=['P', 'Q'], +array_of_elements=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,616 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,616 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,616 - INFO - print_details - -> Number of Variables: 2 +2023-08-30 12:12:18,616 - INFO - print_details - -> Variables: ['P', 'Q'] +2023-08-30 12:12:18,616 - INFO - print_details - -> Array of Elements: ['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,616 - INFO - print_details - ************************** ANALYSIS ************************** +2023-08-30 12:12:18,616 - INFO - analyze_statement - Analyzing concluded. +2023-08-30 12:12:18,616 - INFO - parse_array - Starting to parse array... +2023-08-30 12:12:18,616 - DEBUG - remove_brackets_around_variables - Removing brackets around standalone variables... +2023-08-30 12:12:18,616 - DEBUG - remove_brackets_around_variables - arr=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,617 - DEBUG - remove_brackets_around_variables - Finished removing all brackets around variables. +2023-08-30 12:12:18,617 - DEBUG - parse_array - In parse_array(): elements_second=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,617 - DEBUG - add_brackets_around_unary_connectives - Adding brackets around unary connectives... +2023-08-30 12:12:18,617 - DEBUG - add_brackets_around_unary_connectives - arr=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,617 - DEBUG - add_brackets_around_unary_connectives - Finished adding brackets around all unary connectives. +2023-08-30 12:12:18,617 - DEBUG - parse_array - In parse_array(): elements_second=['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'] +2023-08-30 12:12:18,617 - INFO - parse_array - Final checks are ran before parsing concludes. +2023-08-30 12:12:18,617 - DEBUG - check_left_and_right_brackets - Calling check_left_and_right_brackets(['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'])... +2023-08-30 12:12:18,617 - INFO - check_left_and_right_brackets - PASS: The number of left and right brackets are equal. +2023-08-30 12:12:18,617 - DEBUG - parse - Calling parse(['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'])... +2023-08-30 12:12:18,617 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')', ')'])... +2023-08-30 12:12:18,617 - DEBUG - remove_outer_brackets - array=['(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'] +2023-08-30 12:12:18,617 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,617 - DEBUG - parse - In parse(): arr=['(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'] +2023-08-30 12:12:18,617 - DEBUG - find_connective - Calling find_connectives(['(', 'P', '->', 'Q', ')', '<->', '(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'])... +2023-08-30 12:12:18,617 - DEBUG - find_connective - In find_connective(): elem=<->, i=5 +2023-08-30 12:12:18,617 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,617 - DEBUG - parse - Calling parse(['(', 'P', '->', 'Q', ')'])... +2023-08-30 12:12:18,617 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', 'P', '->', 'Q', ')'])... +2023-08-30 12:12:18,617 - DEBUG - remove_outer_brackets - array=['P', '->', 'Q'] +2023-08-30 12:12:18,617 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,618 - DEBUG - parse - In parse(): arr=['P', '->', 'Q'] +2023-08-30 12:12:18,618 - DEBUG - find_connective - Calling find_connectives(['P', '->', 'Q'])... +2023-08-30 12:12:18,618 - DEBUG - find_connective - In find_connective(): elem=->, i=1 +2023-08-30 12:12:18,618 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,618 - DEBUG - parse - temp_array=[['P'], '->', ['Q']] +2023-08-30 12:12:18,618 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,618 - DEBUG - parse - Calling parse(['(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'])... +2023-08-30 12:12:18,618 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '(', '!', 'Q', ')', '->', '(', '!', 'P', ')', ')'])... +2023-08-30 12:12:18,618 - DEBUG - remove_outer_brackets - array=['(', '!', 'Q', ')', '->', '(', '!', 'P', ')'] +2023-08-30 12:12:18,618 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,618 - DEBUG - parse - In parse(): arr=['(', '!', 'Q', ')', '->', '(', '!', 'P', ')'] +2023-08-30 12:12:18,618 - DEBUG - find_connective - Calling find_connectives(['(', '!', 'Q', ')', '->', '(', '!', 'P', ')'])... +2023-08-30 12:12:18,618 - DEBUG - find_connective - In find_connective(): elem=->, i=4 +2023-08-30 12:12:18,618 - DEBUG - find_connective - Found connective. +2023-08-30 12:12:18,618 - DEBUG - parse - Calling parse(['(', '!', 'Q', ')'])... +2023-08-30 12:12:18,618 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '!', 'Q', ')'])... +2023-08-30 12:12:18,618 - DEBUG - remove_outer_brackets - array=['!', 'Q'] +2023-08-30 12:12:18,618 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,618 - DEBUG - parse - In parse(): arr=['!', 'Q'] +2023-08-30 12:12:18,618 - DEBUG - parse - temp_arr=['!', 'Q'] +2023-08-30 12:12:18,619 - DEBUG - parse - Returning with parsed list of unary connectives. +2023-08-30 12:12:18,619 - DEBUG - parse - Calling parse(['(', '!', 'P', ')'])... +2023-08-30 12:12:18,619 - DEBUG - remove_outer_brackets - Calling remove_outer_brackets(['(', '!', 'P', ')'])... +2023-08-30 12:12:18,619 - DEBUG - remove_outer_brackets - array=['!', 'P'] +2023-08-30 12:12:18,619 - DEBUG - remove_outer_brackets - Finished removing outer brackets. +2023-08-30 12:12:18,619 - DEBUG - parse - In parse(): arr=['!', 'P'] +2023-08-30 12:12:18,619 - DEBUG - parse - temp_arr=['!', 'P'] +2023-08-30 12:12:18,619 - DEBUG - parse - Returning with parsed list of unary connectives. +2023-08-30 12:12:18,619 - DEBUG - parse - temp_array=[['!', 'Q'], '->', ['!', 'P']] +2023-08-30 12:12:18,619 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,619 - DEBUG - parse - temp_array=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-08-30 12:12:18,619 - DEBUG - parse - Returning with parsed list for binary connectives. +2023-08-30 12:12:18,619 - DEBUG - parse_array - tree_structured_array=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-08-30 12:12:18,619 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,619 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,619 - INFO - print_details - -> Parsed Array: [[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-08-30 12:12:18,619 - INFO - print_details - *************************** PARSE *************************** +2023-08-30 12:12:18,619 - INFO - parse_array - Finished parsing array. +2023-08-30 12:12:18,619 - DEBUG - user_input - In user_input(): +number_of_variables=2, +variables_as_array=['P', 'Q'], +statement=((P -> Q) <-> ((!Q) -> (!P))), +new_elements=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]]. +2023-08-30 12:12:18,619 - INFO - user_input - Gathered all information needed including variables and parsed array. +2023-08-30 12:12:18,619 - DEBUG - simulate_main - In simulate_main(): +number_of_variables=2, +variables_as_array=['P', 'Q'], +provided_statement=((P -> Q) <-> ((!Q) -> (!P))), +elements_in_tree=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-08-30 12:12:18,619 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,620 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,620 - INFO - print_details - -> number_of_variables: 2 +2023-08-30 12:12:18,620 - INFO - print_details - -> variables_as_array: ['P', 'Q'] +2023-08-30 12:12:18,620 - INFO - print_details - -> provided_statement: ((P -> Q) <-> ((!Q) -> (!P))) +2023-08-30 12:12:18,620 - INFO - print_details - -> elements_in_tree: [[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]] +2023-08-30 12:12:18,620 - INFO - print_details - ************************** SUMMARY ************************** +2023-08-30 12:12:18,620 - INFO - evaluate_array_as_tree - Starting evaluation of array of elements... +2023-08-30 12:12:18,620 - DEBUG - create_matrix - Creating initial matrix... +2023-08-30 12:12:18,620 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,620 - DEBUG - recursive_table - n=2 +2023-08-30 12:12:18,620 - DEBUG - recursive_table - Creating table entries recursively... +2023-08-30 12:12:18,620 - DEBUG - recursive_table - n=1 +2023-08-30 12:12:18,620 - DEBUG - recursive_table - array_table=['T', 'F'] +2023-08-30 12:12:18,620 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,620 - DEBUG - recursive_table - array_table=['TT', 'TF', 'FT', 'FF'] +2023-08-30 12:12:18,620 - DEBUG - recursive_table - Finished creating array of table entries. +2023-08-30 12:12:18,620 - DEBUG - create_matrix - In create_matrix(): new_matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']] +2023-08-30 12:12:18,620 - INFO - create_matrix - Finished creating the initial 'truth' matrix. +2023-08-30 12:12:18,620 - INFO - create_matrix - *** Initial Matrix: [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']] *** +2023-08-30 12:12:18,620 - DEBUG - evaluate_array_as_tree - In evaluate_array_as_tree(): +elements_in_tree=[[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]], +counter=0, +matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], +variables_as_array=['P', 'Q'] +2023-08-30 12:12:18,620 - DEBUG - evaluate_array - Calling evaluate_array([[['P'], '->', ['Q']], '<->', [['!', 'Q'], '->', ['!', 'P']]], 0, [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], ['P', 'Q'])... +2023-08-30 12:12:18,621 - DEBUG - evaluate_array - Calling evaluate_array([['P'], '->', ['Q']], 1, [['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], ['P', 'Q'])... +2023-08-30 12:12:18,621 - DEBUG - switch_case - Entering switch_case(->, ['T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,621 - DEBUG - cond - In cond. case... +2023-08-30 12:12:18,621 - DEBUG - conditional - Calling conditional(['T', 'T', 'F', 'F'], ['T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,621 - DEBUG - conditional - new_row_values=['T', 'F', 'T', 'T'] +2023-08-30 12:12:18,621 - DEBUG - conditional - Returning with new row values. +2023-08-30 12:12:18,621 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P'], '->', ['Q']])... +2023-08-30 12:12:18,621 - DEBUG - set_new_array_elem - new_array=['P->Q'] +2023-08-30 12:12:18,621 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,621 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'T', 'T'], +final_variable_combined=['P->Q'], +matrix=[['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], +variables=['P', 'Q'] +2023-08-30 12:12:18,621 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,621 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T'], ['T', 'F'], ['F', 'T'], ['F', 'F']], ['T', 'F', 'T', 'T'], ['P', 'Q'], ['P->Q'])... +2023-08-30 12:12:18,621 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'P->Q'] +2023-08-30 12:12:18,621 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,621 - DEBUG - evaluate_array - Calling evaluate_array([['!', 'Q'], '->', ['!', 'P']], 1, [['T', 'T', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'F', 'T']], ['P', 'Q', 'P->Q'])... +2023-08-30 12:12:18,621 - DEBUG - evaluate_array - Calling evaluate_array(['!', 'Q'], 2, [['T', 'T', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'F', 'T']], ['P', 'Q', 'P->Q'])... +2023-08-30 12:12:18,621 - DEBUG - switch_case - Entering switch_case(!, ['T', 'F', 'T', 'T'], ['T', 'F', 'T', 'F'])... +2023-08-30 12:12:18,621 - DEBUG - neg - In neg. case... +2023-08-30 12:12:18,621 - DEBUG - negation - Calling negation(['T', 'F', 'T', 'T'])... +2023-08-30 12:12:18,621 - DEBUG - negation - new_row_values=['F', 'T', 'F', 'F'] +2023-08-30 12:12:18,621 - DEBUG - negation - Returning with new row values. +2023-08-30 12:12:18,622 - DEBUG - set_new_array_elem - Calling set_new_array_elem(['_', '!', 'Q'])... +2023-08-30 12:12:18,622 - DEBUG - set_new_array_elem - new_array=['!Q'] +2023-08-30 12:12:18,622 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,622 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['F', 'T', 'F', 'F'], +final_variable_combined=['!Q'], +matrix=[['T', 'T', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'F', 'T']], +variables=['P', 'Q', 'P->Q'] +2023-08-30 12:12:18,622 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,622 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T'], ['T', 'F', 'F'], ['F', 'T', 'T'], ['F', 'F', 'T']], ['F', 'T', 'F', 'F'], ['P', 'Q', 'P->Q'], ['!Q'])... +2023-08-30 12:12:18,622 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'P->Q', '!Q'] +2023-08-30 12:12:18,622 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,622 - DEBUG - evaluate_array - Calling evaluate_array(['!', 'P'], 2, [['T', 'T', 'T', 'F'], ['T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F'], ['F', 'F', 'T', 'F']], ['P', 'Q', 'P->Q', '!Q'])... +2023-08-30 12:12:18,622 - DEBUG - switch_case - Entering switch_case(!, ['F', 'T', 'F', 'F'], ['T', 'T', 'F', 'F'])... +2023-08-30 12:12:18,622 - DEBUG - neg - In neg. case... +2023-08-30 12:12:18,622 - DEBUG - negation - Calling negation(['F', 'T', 'F', 'F'])... +2023-08-30 12:12:18,622 - DEBUG - negation - new_row_values=['T', 'F', 'T', 'T'] +2023-08-30 12:12:18,622 - DEBUG - negation - Returning with new row values. +2023-08-30 12:12:18,622 - DEBUG - set_new_array_elem - Calling set_new_array_elem(['_', '!', 'P'])... +2023-08-30 12:12:18,622 - DEBUG - set_new_array_elem - new_array=['!P'] +2023-08-30 12:12:18,622 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,622 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'T', 'T'], +final_variable_combined=['!P'], +matrix=[['T', 'T', 'T', 'F'], ['T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F'], ['F', 'F', 'T', 'F']], +variables=['P', 'Q', 'P->Q', '!Q'] +2023-08-30 12:12:18,622 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,622 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T', 'F'], ['T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F'], ['F', 'F', 'T', 'F']], ['T', 'F', 'T', 'T'], ['P', 'Q', 'P->Q', '!Q'], ['!P'])... +2023-08-30 12:12:18,623 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'P->Q', '!Q', '!P'] +2023-08-30 12:12:18,623 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,623 - DEBUG - switch_case - Entering switch_case(->, ['F', 'T', 'F', 'F'], ['T', 'F', 'T', 'T'])... +2023-08-30 12:12:18,623 - DEBUG - cond - In cond. case... +2023-08-30 12:12:18,623 - DEBUG - conditional - Calling conditional(['F', 'T', 'F', 'F'], ['T', 'F', 'T', 'T'])... +2023-08-30 12:12:18,623 - DEBUG - conditional - new_row_values=['T', 'F', 'T', 'T'] +2023-08-30 12:12:18,623 - DEBUG - conditional - Returning with new row values. +2023-08-30 12:12:18,623 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['!Q'], '->', ['!P']])... +2023-08-30 12:12:18,623 - DEBUG - set_new_array_elem - new_array=['(!Q)->(!P)'] +2023-08-30 12:12:18,623 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,623 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'F', 'T', 'T'], +final_variable_combined=['(!Q)->(!P)'], +matrix=[['T', 'T', 'T', 'F', 'T'], ['T', 'F', 'F', 'T', 'F'], ['F', 'T', 'T', 'F', 'T'], ['F', 'F', 'T', 'F', 'T']], +variables=['P', 'Q', 'P->Q', '!Q', '!P'] +2023-08-30 12:12:18,623 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,623 - DEBUG - add_array_to_matrix - Calling add_array_to_matrix([['T', 'T', 'T', 'F', 'T'], ['T', 'F', 'F', 'T', 'F'], ['F', 'T', 'T', 'F', 'T'], ['F', 'F', 'T', 'F', 'T']], ['T', 'F', 'T', 'T'], ['P', 'Q', 'P->Q', '!Q', '!P'], ['(!Q)->(!P)'])... +2023-08-30 12:12:18,623 - DEBUG - add_array_to_matrix - variables=['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)'] +2023-08-30 12:12:18,623 - DEBUG - add_array_to_matrix - Added array to matrix. +2023-08-30 12:12:18,623 - DEBUG - switch_case - Entering switch_case(<->, ['T', 'F', 'T', 'T'], ['T', 'F', 'T', 'T'])... +2023-08-30 12:12:18,623 - DEBUG - bicond - In bicond. case... +2023-08-30 12:12:18,623 - DEBUG - biconditional - Calling biconditional(['T', 'F', 'T', 'T'], ['T', 'F', 'T', 'T'])... +2023-08-30 12:12:18,623 - DEBUG - biconditional - new_row_values=['T', 'T', 'T', 'T'] +2023-08-30 12:12:18,623 - DEBUG - biconditional - Returning with new row values. +2023-08-30 12:12:18,623 - DEBUG - set_new_array_elem - Calling set_new_array_elem([['P->Q'], '<->', ['(!Q)->(!P)']])... +2023-08-30 12:12:18,624 - DEBUG - set_new_array_elem - new_array=['(P->Q)<->((!Q)->(!P))'] +2023-08-30 12:12:18,624 - DEBUG - set_new_array_elem - Finished setting new array element. +2023-08-30 12:12:18,624 - DEBUG - evaluate_array - In evaluate_array(): +returned_array=['T', 'T', 'T', 'T'], +final_variable_combined=['(P->Q)<->((!Q)->(!P))'], +matrix=[['T', 'T', 'T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F', 'T', 'T', 'T'], ['F', 'F', 'T', 'F', 'T', 'T', 'T']], +variables=['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)'] +2023-08-30 12:12:18,624 - DEBUG - evaluate_array - Evaluation of array in evaluate_array() is done. +2023-08-30 12:12:18,624 - DEBUG - evaluate_array_as_tree - returned_array=['T', 'T', 'T', 'T'], returned_matrix=[['T', 'T', 'T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F', 'T', 'T', 'T'], ['F', 'F', 'T', 'F', 'T', 'T', 'T']], all_variables=['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)', '(P->Q)<->((!Q)->(!P))'] +2023-08-30 12:12:18,624 - DEBUG - evaluate_array_as_tree - Finished evaluating array. +2023-08-30 12:12:18,624 - DEBUG - simulate_main - In simulate_main(): +final_value_array=['T', 'T', 'T', 'T'], +returned_matrix=[['T', 'T', 'T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F', 'T', 'T', 'T'], ['F', 'F', 'T', 'F', 'T', 'T', 'T']], +all_variables=['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)', '(P->Q)<->((!Q)->(!P))'] +2023-08-30 12:12:18,624 - DEBUG - print_details - Printing details... +2023-08-30 12:12:18,624 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,624 - INFO - print_details - -> Statement: ((P -> Q) <-> ((!Q) -> (!P))) +2023-08-30 12:12:18,624 - INFO - print_details - -> Final Calculated Array: ['T', 'T', 'T', 'T'] +2023-08-30 12:12:18,624 - INFO - print_details - -> All Variables: ['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)', '(P->Q)<->((!Q)->(!P))'] +2023-08-30 12:12:18,624 - INFO - print_details - -> Final Matrix: [['T', 'T', 'T', 'F', 'T', 'T', 'T'], ['T', 'F', 'F', 'T', 'F', 'F', 'T'], ['F', 'T', 'T', 'F', 'T', 'T', 'T'], ['F', 'F', 'T', 'F', 'T', 'T', 'T']] +2023-08-30 12:12:18,624 - INFO - print_details - ************************** EVALUATE ************************** +2023-08-30 12:12:18,624 - INFO - simulate_main - Finished evaluating statement. +2023-08-30 12:12:18,624 - DEBUG - display_matrix - Displaying matrix to console... +2023-08-30 12:12:18,624 - DEBUG - get_number_of_spaces - Calling get_number_of_spaces(2, 4, ['P', 'Q', 'P->Q', '!Q', '!P', '(!Q)->(!P)', '(P->Q)<->((!Q)->(!P))'])... +2023-08-30 12:12:18,624 - DEBUG - get_number_of_spaces - total_space=64 +2023-08-30 12:12:18,624 - DEBUG - get_number_of_spaces - Finished calculating the total space. +2023-08-30 12:12:18,625 - DEBUG - simulate_main - Returning from simulate_main()... +2023-08-30 12:12:18,625 - INFO - - Exiting Engine... diff --git a/engine/main.py b/engine/main.py index ee0844b..9d951bf 100644 --- a/engine/main.py +++ b/engine/main.py @@ -1,5 +1,5 @@ """ -This is the main entry for Engine. +This is the main entry for Engine. """ from engine_logging.logging_config import logger from simulator.simulate_main import simulate_main diff --git a/engine/requirements.txt b/engine/requirements.txt new file mode 100644 index 0000000..d4f6307 --- /dev/null +++ b/engine/requirements.txt @@ -0,0 +1,3 @@ +flake8==6.1.0 +pylint==3.0.1 +pytest==7.4.2 \ No newline at end of file diff --git a/engine/simulator/input_statements.py b/engine/simulator/input_statements.py index 6899c37..0ddfa81 100644 --- a/engine/simulator/input_statements.py +++ b/engine/simulator/input_statements.py @@ -1,41 +1,37 @@ """ Insert """ # Test cases that is used in simulate_main.py test_cases = [ - # "(P <-> (P <-> (P <-> (P <-> P))))", - # "(P ^ Q)", # valid - "(T v (P ^ Q))", # valid - # "((T v P) ^ Q)", # valid - # "(T v (P -> Q))", # valid - # "(T v (P -> Q)", # invalid - # "((T ^ Q) v (P ^ Q))", # valid - # "((T ^ T) v (P ^ Q))", # valid - # "((T ^ T) v ((P ^ (T ^ Q)) ^ Q))", # valid - # "(S ^ (R ^ Q))", # valid - # "((R ^ (Q v (!P))) <-> (((R ^ Q) v (R ^ P)) ^ T))", # valid - # "((R ^ (Q v (P))) <-> (((R ^ Q) v (R ^ P)) ^ T))", # valid - - # "R ^ (Q v !P) <-> (R ^ Q) v (R ^ P) ^ T" # valid, but binding rules - # should be applied. - # "((!R) ^ P)", # valid - # "(P v Q)", # valid - # "(!P)", # valid - # "(!(P ^ (Q <-> !Q)))", # valid - - # Add more test cases here - # "(P ^ Q ^ R)", # valid - # "(P v Q v R)", # valid - # "(P ^ !Q)", # valid - # "(P -> (Q ^ R))", # valid - # "(P -> (Q v R))", # valid - # "((P ^ Q) v (R ^ S))", # valid - # "(P <-> Q)", # valid - # "(!(!P))", # valid - - # ERROR checking!!! - # "((P v Q) ^ (!R))", # valid - # "((P -> Q) <-> ((!Q) -> (!P)))", # valid - - # Edge cases - # "(P_1 ^ P_2)", - # "(Q ^ (R_20 -> T_2))" + # "(P <-> (P <-> (P <-> (P <-> P))))", + # "(P ^ Q)", # valid + "(T v (P ^ Q))", # valid + # "((T v P) ^ Q)", # valid + # "(T v (P -> Q))", # valid + # "(T v (P -> Q)", # invalid + # "((T ^ Q) v (P ^ Q))", # valid + # "((T ^ T) v (P ^ Q))", # valid + # "((T ^ T) v ((P ^ (T ^ Q)) ^ Q))", # valid + # "(S ^ (R ^ Q))", # valid + # "((R ^ (Q v (!P))) <-> (((R ^ Q) v (R ^ P)) ^ T))", # valid + # "((R ^ (Q v (P))) <-> (((R ^ Q) v (R ^ P)) ^ T))", # valid + # "R ^ (Q v !P) <-> (R ^ Q) v (R ^ P) ^ T" # valid, but binding rules + # should be applied. + # "((!R) ^ P)", # valid + # "(P v Q)", # valid + # "(!P)", # valid + # "(!(P ^ (Q <-> !Q)))", # valid + # Add more test cases here + # "(P ^ Q ^ R)", # valid + # "(P v Q v R)", # valid + # "(P ^ !Q)", # valid + # "(P -> (Q ^ R))", # valid + # "(P -> (Q v R))", # valid + # "((P ^ Q) v (R ^ S))", # valid + # "(P <-> Q)", # valid + # "(!(!P))", # valid + # ERROR checking!!! + # "((P v Q) ^ (!R))", # valid + # "((P -> Q) <-> ((!Q) -> (!P)))", # valid + # Edge cases + # "(P_1 ^ P_2)", + # "(Q ^ (R_20 -> T_2))" ] diff --git a/engine/simulator/simulate_main.py b/engine/simulator/simulate_main.py index ecc1078..6143305 100644 --- a/engine/simulator/simulate_main.py +++ b/engine/simulator/simulate_main.py @@ -35,15 +35,15 @@ def simulate_main(): ) and check_for_illegal_characters(statement): pass except UnequalBracketsExcept as ce: - logger.exception("Unequal Brackets Exception: ", ce) + logger.exception("Unequal Brackets Exception: %s", ce) continue except IllegalCharactersException as ice: - logger.exception("Illegal Characters Exception: ", ice) + logger.exception("Illegal Characters Exception: %s", ice) continue else: pass - # todo Look into why statement is sent to user_input() and then + # NOTE: Look into why statement is sent to user_input() and then # returned again logger.info( diff --git a/frontend/README.md b/frontend/README.md index 03d619c..032a60d 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -2,6 +2,10 @@ A new Flutter project. +[![GitHub Super-Linter](https://github.com/ZanderCowboy/verbose-adventure/actions/workflows/linter.yml/badge.svg)](https://github.com/marketplace/actions/super-linter) + +[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis) + ## Getting Started This project is a starting point for a Flutter application. diff --git a/frontend/analysis_options.yaml b/frontend/analysis_options.yaml index 61b6c4d..7c10e91 100644 --- a/frontend/analysis_options.yaml +++ b/frontend/analysis_options.yaml @@ -7,7 +7,8 @@ # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. -include: package:flutter_lints/flutter.yaml +# include: package:flutter_lints/flutter.yaml +include: package:very_good_analysis/analysis_options.yaml linter: # The lint rules applied to this project can be customized in the diff --git a/frontend/lib/main.dart b/frontend/lib/main.dart index 008fa38..5b96f11 100644 --- a/frontend/lib/main.dart +++ b/frontend/lib/main.dart @@ -4,24 +4,16 @@ void main() { runApp(const MyApp()); } +/// class MyApp extends StatelessWidget { + /// const MyApp({super.key}); - // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or simply save your changes to "hot reload" in a Flutter IDE). - // Notice that the counter didn't reset back to zero; the application - // is not restarted. primarySwatch: Colors.blue, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), @@ -29,18 +21,12 @@ class MyApp extends StatelessWidget { } } +/// class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); - - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". + /// + const MyHomePage({required this.title, super.key}); + /// final String title; @override @@ -52,47 +38,18 @@ class _MyHomePageState extends State { void _incrementCounter() { setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. _counter++; }); } @override Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. return Scaffold( appBar: AppBar( - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. title: Text(widget.title), ), body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Invoke "debug painting" (press "p" in the console, choose the - // "Toggle Debug Paint" action from the Flutter Inspector in Android - // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) - // to see the wireframe for each widget. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( @@ -109,7 +66,7 @@ class _MyHomePageState extends State { onPressed: _incrementCounter, tooltip: 'Increment', child: const Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. + ), ); } } diff --git a/frontend/pubspec.lock b/frontend/pubspec.lock index f470282..a47d5ac 100644 --- a/frontend/pubspec.lock +++ b/frontend/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" fake_async: dependency: transitive description: @@ -63,13 +63,13 @@ packages: source: sdk version: "0.0.0" flutter_lints: - dependency: "direct dev" + dependency: "direct main" description: name: flutter_lints - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.3" flutter_test: dependency: "direct dev" description: flutter @@ -79,10 +79,10 @@ packages: dependency: transitive description: name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.1" matcher: dependency: transitive description: @@ -176,6 +176,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + very_good_analysis: + dependency: "direct dev" + description: + name: very_good_analysis + sha256: "9ae7f3a3bd5764fb021b335ca28a34f040cd0ab6eec00a1b213b445dae58a4b8" + url: "https://pub.dev" + source: hosted + version: "5.1.0" web: dependency: transitive description: diff --git a/frontend/pubspec.yaml b/frontend/pubspec.yaml index a05e574..e03d5a1 100644 --- a/frontend/pubspec.yaml +++ b/frontend/pubspec.yaml @@ -1,90 +1,27 @@ name: frontend description: A new Flutter project. -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: 'none' -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. version: 1.0.0+1 environment: - sdk: '>=2.19.6 <3.0.0' + sdk: '>=3.0.0 <4.0.0' -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: + cupertino_icons: ^1.0.6 flutter: sdk: flutter - - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.2 + flutter_lints: ^2.0.3 dev_dependencies: flutter_test: sdk: flutter - - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. - flutter_lints: ^2.0.0 - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. + very_good_analysis: ^5.1.0 + flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages diff --git a/frontend/windows/runner/flutter_window.cpp b/frontend/windows/runner/flutter_window.cpp index b25e363..955ee30 100644 --- a/frontend/windows/runner/flutter_window.cpp +++ b/frontend/windows/runner/flutter_window.cpp @@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() { this->Show(); }); + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + return true; }