Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogma-core: Including missing operator notPreviousNot in generated spec #168

Closed
ivanperez-keera opened this issue Nov 22, 2024 · 6 comments
Closed
Assignees
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Bug Admin only: Change request pertaining to error detected
Milestone

Comments

@ivanperez-keera
Copy link
Member

Description

When an input spec uses the Z SMV operator, the produced Copilot spec refers to a function notPreviousNot that is not defined. This function should be included in the generated spec.

Type

  • Bug: Ogma produces invalid code.

Additional context

None.

Requester

  • Ivan Perez.

Method to check presence of bug

Compiling the following spec produces an invalid Copilot module:

{
  "test_componentSpec": {
    "Functions": [
    ],
    "Internal_variables": [
    ],
    "Other_variables": [
    ],
    "Requirements": [
      {
        "CoCoSpecCode": "true",
        "fretish": "unimportant",
        "name": "testCopilot-001",
        "ptLTL": "Z TRUE"
      }
    ]
  }
}
Monitor.hs:17:24: error:
    Variable not in scope: notPreviousNot :: Stream Bool -> Stream Bool
   |
17 | propTestCopilot_001 = (notPreviousNot true)

Expected result

The execution above should produce a Copilot specification that can be compiled and where notPreviousNot has been defined.

Desired result

The execution above should produce a Copilot specification that can be compiled and where notPreviousNot has been defined.

Proposed solution

Add a definition for notPreviousNot to the generated Copilot spec.

Further notes

None.

@ivanperez-keera ivanperez-keera added CR:Status:Initiated Admin only: Change request that has been initiated CR:Type:Bug Admin only: Change request pertaining to error detected labels Nov 22, 2024
@ivanperez-keera
Copy link
Member Author

Change Manager: Confirmed that the issue exists.

@ivanperez-keera ivanperez-keera added CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager and removed CR:Status:Initiated Admin only: Change request that has been initiated labels Nov 22, 2024
@ivanperez-keera
Copy link
Member Author

Technical Lead: Confirmed that the issue should be addressed.

@ivanperez-keera ivanperez-keera added CR:Status:Accepted Admin only: Change request accepted by technical lead and removed CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager labels Nov 22, 2024
@ivanperez-keera
Copy link
Member Author

Technical Lead: Issue scheduled for fixing in Ogma 1.5.

Fix assigned to: @ivanperez-keera .

@ivanperez-keera ivanperez-keera added CR:Status:Scheduled Admin only: Change requested scheduled and removed CR:Status:Accepted Admin only: Change request accepted by technical lead labels Nov 22, 2024
@ivanperez-keera ivanperez-keera added this to the 1.5.0 milestone Nov 22, 2024
@ivanperez-keera ivanperez-keera self-assigned this Nov 22, 2024
@ivanperez-keera ivanperez-keera added CR:Status:Implementation Admin only: Change request that is currently being implemented and removed CR:Status:Scheduled Admin only: Change requested scheduled labels Nov 22, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 22, 2024
When an input spec uses the Z SMV operator, the produced Copilot spec
refers to a function notPreviousNot that is not defined. This function
should be included in the generated spec.

This commit makes the Copilot generator include a default definition for
notPreviousNot.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 22, 2024
@ivanperez-keera
Copy link
Member Author

Implementor: Solution implemented, review requested.

@ivanperez-keera ivanperez-keera added CR:Status:Verification Admin only: Change request that is currently being verified and removed CR:Status:Implementation Admin only: Change request that is currently being implemented labels Nov 22, 2024
@ivanperez-keera
Copy link
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
    • The solution proposed produces the expected result. Details:
      The following dockerfile checks that a spec containing a Z operator, which is mapped to notPreviousNot, is translated into a Copilot spec that can be compiled, after which it prints the message "Success":
      --- Dockerfile
      FROM ubuntu:trusty
      
      ENV DEBIAN_FRONTEND=noninteractive
      
      RUN apt-get update
      
      RUN apt-get install --yes software-properties-common
      RUN add-apt-repository ppa:hvr/ghc
      RUN apt-get update
      
      RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4
      RUN apt-get install --yes libz-dev
      
      ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH
      
      RUN cabal update
      RUN cabal v1-sandbox init
      RUN cabal v1-install alex happy
      RUN apt-get install --yes git
      
      ADD zspec.json /tmp/zspec.json
      
      SHELL ["/bin/bash", "-c"]
      CMD git clone $REPO \
          && cd $NAME \
          && git checkout $COMMIT \
          && cd .. \
          && cabal v1-sandbox init \
          && cabal v1-install $NAME/$PAT**/ copilot-4.1 --constraint="aeson>=2.0.3.0" \
          && ./.cabal-sandbox/bin/ogma fret-component-spec --fret-file-name /tmp/zspec.json > Spec.hs \
          && cabal v1-exec -- runhaskell Spec.hs \
          && echo "Success"
      
      --- zspec.json
      {
        "test_componentSpec": {
          "Functions": [
          ],
          "Internal_variables": [
          ],
          "Other_variables": [
          ],
          "Requirements": [
            {
              "CoCoSpecCode": "true",
              "fretish": "unimportant",
              "name": "testCopilot-001",
              "ptLTL": "Z TRUE"
            }
          ]
        }
      }
      
      Command (substitute variables based on new path after merge):
      $ docker run -e "REPO=https://github.com/ivanperez-keera/ogma" -e "NAME=ogma" -e "PAT=ogma"  -e "COMMIT=090d256846fb69b12fb47acf1e6dfba286e51952" -it ogma-verify-168
      
  • Implementation is documented. Details:
    No updates needed. Change is internal to module.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No updates needed. Change is internal to module.
  • Required version bumps are evaluated. Details:
    No updates needed. Change is bug fix.

@ivanperez-keera
Copy link
Member Author

Change Manager: Implementation ready to be merged.

@ivanperez-keera ivanperez-keera added CR:Status:Closed Admin only: Change request that has been completed and removed CR:Status:Verification Admin only: Change request that is currently being verified labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Bug Admin only: Change request pertaining to error detected
Projects
None yet
Development

No branches or pull requests

1 participant