Skip to content

PositivityChecker for Haskell - #21

Open
faiso-k wants to merge 22 commits into
aprove-developers:mainfrom
faiso-k:main
Open

PositivityChecker for Haskell#21
faiso-k wants to merge 22 commits into
aprove-developers:mainfrom
faiso-k:main

Conversation

@faiso-k

@faiso-k faiso-k commented Jun 26, 2026

Copy link
Copy Markdown

Pull Request

Pre-Submission Checklist

Before submitting this PR, please confirm:


Summary

  • What: strict positivity checker for Haskell
  • Why: Fabian Berkner Bachelor thesis
  • How: testing data declaration in Translator.java and Aprove.java

Type of Change

Select all that apply:

  • Bug fix
  • New feature
  • Documentation update

Testing

Tested on TPDB and own test cases


✅ Final Checklist

  • Self-review completed
  • Code is clean and well-commented
  • Documentation updated (if needed)
  • No new warnings/errors introduced

Additional Notes

New Exception StrictPositivityException added

@eleanoremeyer eleanoremeyer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss this in person. @faiso-k

Comment thread src/aprove/cli/Main.java

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these imports used?

JUST_NEG,
JUST_POS,
STRICT_POS,
// GUARD_POS, //not quite sure (think it is for records)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss this

UNUSED; // does not occur

/**
* Simulates behavior of additive of the Occurrence semiring (a+b):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additive behavior (state what it is used for)

}

/**
* Simulates behavior of multiplicative of the Occurrence semiring (a*b):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiplicative behavior (state what it is used for)

import java.io.*;
import java.util.*;

import aprove.input.Programs.haskell.StrictPositivityException;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this import used?

final List<HaskellDecl> decls = new ArrayList<>(List.of());

for (var module : modMap.values()) {
decls.addAll(module.getDecls());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if two modules contain declarations with same name?

// }
// }

final List<DataDecl> dataDecl = decls.stream()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicit for-each loop so you save redundancy and traverse only once.

// OccurrenceGraph graph = builder.buildFromDataDecl(dataDecl, synTypeDecls, preludeTyCons);

List<Violation> violations = new ArrayList<>();
Map<String, Occurrence> selfLoops = new LinkedHashMap<>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this used for?

}

public void check(Modules mods) throws StrictPositivityException {
// debug(mods);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of this?

throw new StrictPositivityException(sb.toString());
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add explanation to this function and checkForIOResult

//check if arrow function
if (name.equals("->")) {
// System.out.println("WalkArrow called");
walkArrow(apply, pol, target);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same as

                walkType(args[0], flip(pol), target)
                walkType(args[1], pol, target)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants