Skip to content

Similar state names in different classes should be allowed #24

@CatarinaGamboa

Description

@CatarinaGamboa

Why

Two different classes can have states that are named the same.

Currently, if two classes have the same state name they need to be changed to not conflict with each other but that does not make a lot of sense. It should be possible to have the same state names in different classes

Example

Currently the following example gives an error:

@StateSet({"uninitialized", "initialized"})
public class SM1 {

	@StateRefinement(to="uninitialized(this)")
	public SM1() {...}
	

	@StateRefinement(from="uninitialized(this)", to="initialized(this)")
	public void initialize() {...}
}

@StateSet({"uninitialized", "initialized"})
public class SM2 {

	@StateRefinement(to="uninitialized(this)")
	public SM2() {...}
	

	@StateRefinement(from="uninitialized(this)", to="initialized(this)")
	public void initialize() {...}
}

class SimpleTest {
	public static void main(String[] args) {	
		SM1 sm1 = new SM1();
		SM2 sm2 = new SM2();
		sm1.initialize();
		sm2.initialize();
	}
}

The error provided is:
Sort mismatch at argument #1 for function (declare-fun sm2_state1 (test.project.SM2) Int) supplied sort is test.project.SM1
It happens because when translating into SMT each state is matched with their parameters received and the method uninitialized can only be either matched with SM1 or SM2.

Intended behavior

Allow different classes to have the same state names and disambiguate between them when translating to SMT.
The code snippet above should pass the verification without raising errors.

Steps

  1. Find out here the translation to SMT of these states is happening and include the class as a prefix before converting into SMT.
  2. Fix the issues and create examples to test the changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions