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

Printing rational numbers in Princess #15

Closed
daniel-raffler opened this issue Oct 13, 2024 · 2 comments
Closed

Printing rational numbers in Princess #15

daniel-raffler opened this issue Oct 13, 2024 · 2 comments

Comments

@daniel-raffler
Copy link

Hello,
there seems to be a slight issue in Princess when printing rational numbers. Fractions that were created with Rationals.frac work fine, but for terms that were created with Rationals.int the output is "(Rat_int X)".

Here is an example:

import ap.SimpleAPI
import ap.util.Debug
import org.scalatest.funsuite.AnyFunSuite

class PrettyPrintBug extends AnyFunSuite {
  import ap.theories.rationals.Rationals._
  import ap.parser.IExpression.{Sort => _, _};

  val withAssertions = false;

  test("Pretty printing") {
    Debug.enableAllAssertions(withAssertions)
    SimpleAPI.withProver(enableAssert = withAssertions) { p =>
      import p._

      // Fine
      val oneRat = smtPP(frac(1, 1))
      println(oneRat)
      assertResult("(/ 1 1)")(oneRat)

      // Not fine
      val one = smtPP(int(1))
      println(one) // This will print "(Rat_int 1)"
      assertResult("1.0")(one)
    }
  }
}

We want the output to be a valid Real number in SMTLIB, so either "1.0" or "(/ 1 1)" should be fine. Could this be fixed in Princess?

pruemmer added a commit that referenced this issue Oct 13, 2024
@pruemmer
Copy link
Collaborator

pruemmer commented Oct 13, 2024 via email

@daniel-raffler
Copy link
Author

Thanks for the quick fix!

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

No branches or pull requests

2 participants