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

Sort Unification for Subsort Relations in Modules #5

Open
WilfredTA opened this issue Oct 10, 2022 · 0 comments
Open

Sort Unification for Subsort Relations in Modules #5

WilfredTA opened this issue Oct 10, 2022 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@WilfredTA
Copy link
Member

Athena rejects the use of unifiable sorts constructed via subsorts when in the context of a module.

Below are two code snippets, identical except that the second code snippet defines the BTree and related code inside of a Tree module, while the first snippet is defined in the top level Athena context.

datatype (BTree T) :=
    null |
    (leaf T) |
    (root (BTree T) (BTree T))

domains Sort1, Sort2, Sort

subsorts (Sort1 Sort2) Sort

declare data1: Sort1
declare data2: Sort2

define tree1 := (leaf data1)
define tree2 := (leaf data2)
define tree := (root tree1 tree2)
module Tree {

  datatype (BTree T) :=
      null |
      (leaf T) |
      (root (BTree T) (BTree T))
  
  domains Sort1, Sort2, Sort
  
  subsorts (Sort1 Sort2) Sort
  
  declare data1: Sort1
  declare data2: Sort2
  
  define tree1 := (leaf data1)
  define tree2 := (leaf data2)
  define tree := (root tree1 tree2)
}

Example 1 runs without error, while evaluating example 2 will cause Athena to report the following problem:

Error: Unable to infer a sort for the term: 

(Tree.root (Tree.leaf Tree.data1)

           (Tree.leaf Tree.data2))

(Failed to unify the sorts Tree.Sort2 and Tree.Sort1.).
@WilfredTA WilfredTA added bug Something isn't working help wanted Extra attention is needed labels Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant