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

Improve readability our constraint printing #300

Open
gltrost opened this issue Mar 1, 2021 · 2 comments
Open

Improve readability our constraint printing #300

gltrost opened this issue Mar 1, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@gltrost
Copy link
Contributor

gltrost commented Mar 1, 2021

Currently when printing constraints, we print them in a hard to read syntax. For example:

Internal : (SP in stack range: (and (bvult (bvadd (bvsub #x0000000040000000 #x0000000000800000)
                   #x0000000000000080)
            RSP0)
     (bvule RSP0 #x0000000040000000)): (let ((a!1 (not (and (= ((_ extract 63 30) RSP0)
                        #b0000000000000000000000000000000000)
                     (bvule ((_ extract 29 0) RSP0)
                            #b111111100000000000000010000000)))))
  (and a!1
       (= ((_ extract 63 31) RSP0) #b000000000000000000000000000000000)
       (bvule ((_ extract 30 0) RSP0) #b1000000000000000000000000000000)))|#540| = |init_\|#540\||: (= |#540| |init_\|#540\||)|#510| = |init_\|#510\||: (= |#510| |init_\|#510\||)|#480| = |init_\|#480\||: (= |#480| |init_\|#480\||)mem0 = init_mem0: (= mem0 init_mem0)ZF0 = init_ZF0: (= ZF0 init_ZF0)YMM90 = init_YMM90: (= YMM90 init_YMM90)YMM80 = init_YMM80: (= YMM80 init_YMM80)YMM70 = init_YMM70: (= YMM7

is difficult to understand. Things that should be fixed include

  1. the explicitly long strings of zeros
  2. the \n printings
  3. left-sided binary operations like =
  4. long indentations

If anyone has other requests with respect to printing constraints, please share!

@gltrost gltrost self-assigned this Mar 1, 2021
@gltrost gltrost added the enhancement New feature or request label Mar 1, 2021
@codyroux
Copy link
Contributor

codyroux commented Mar 2, 2021

I was actually hoping that Constraint.to_string could be significantly improved as well, e.g. by printing the constructors in an easy to read format, e.g. ITE (a, b, c) as if a then b else c, Subst(a, b, c) as let b = c in a etc.

@gltrost gltrost mentioned this issue Mar 18, 2021
@codyroux
Copy link
Contributor

Based on comments from here: #244 (comment) I'd recommend never having Z3 variables contain #. Sadly BIL "nameless" variables by default are of the form e.g. #123, so probably hooking Expr.mk_const_s, or just Environment.mk_init_var would be a good idea.

gltrost added a commit that referenced this issue Apr 14, 2021
…nting more readability (#307)

* Add improvements to Constraint.pp_constr: improving readability of ITE, Clause, adding basic colors, removing some empty-parens, removing some back-slashes and unescaping new lines.

* Use Expr.simplify to expr values when printing in Constr.pp_constr

* Remove white space printing from Constr.t printings with newly written function Constr.preen_expr

* Add colorful flag to control for special-word highlighting when printing contraints

* Add improvements to Constraint.pp_constr: improving readability of ITE, Clause, adding basic colors, removing some empty-parens, removing some back-slashes and unescaping new lines.

* Use Expr.simplify to expr values when printing in Constr.pp_constr

* Remove white space printing from Constr.t printings with newly written function Constr.preen_expr

* Add colorful flag to control for special-word highlighting when printing contraints

* Add del_empty_constr_hyps and to_color to improve Constr.pp_constr

* Allow for proper Expr.expr indentation

* Add descriptions to new printing helper functions in constraint.ml

* Make style changes to constraint-printing that were recommended in PR

* Rename pp_constr to pp and add unit input to better handle colorful variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants