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

Simplification in RecordEqualityCaseAnalysis #116

Open
DavePearce opened this issue May 29, 2017 · 0 comments
Open

Simplification in RecordEqualityCaseAnalysis #116

DavePearce opened this issue May 29, 2017 · 0 comments

Comments

@DavePearce
Copy link
Member

Currently, RecordEqualityCaseAnalysis could perform more simplification as it is constructing new terms. As an example, consider this:

type Point is ({int x, int y} r)

assert:
    forall(Point p, Point q):
        if:
            p == {x: 1, y: 2}
            q.x == 1
            q.y == 2
        then:
            p == q

This produces the following proof:

 74. exists(Point p, Point q).((((p == {x: 1, y: 2}) && (q.x == 1) && (q.y = () 
 78. exists(Point p, Point q).((p == {x: 1, y: 2}) && (1 == q.x) && ( (Simp 74) 
 77. (p == {x: 1, y: 2}) && (1 == q.x) && (2 == q.y) && (p != q)  (Exists-E 78) 
 62. p == {x: 1, y: 2}                                               (And-E 77) 
 75. 1 == q.x                                                        (And-E 77) 
 76. 2 == q.y                                                        (And-E 77) 
 69. p != q                                                          (And-E 77) 
 79. {x: 1, y: 2} != q                                             (Eq-S 69,62) 
 80. q != {x: 1, y: 2}                                                (Simp 79) 
 85. (q.x != {x: 1, y: 2}.x) || (q.y != {x: 1, y: 2}.y)              (Req-C 80) 
 88. (1 != q.x) || (2 != q.y)                                         (Simp 85) 
 91. (1 != 1) || (2 != 2)                                       (Eq-S 88,75,76) 
 57. false                                                            (Simp 91) 

We can see that when Req-C is applied it produces unsimplified expressions of the form {x: 1, y: 2}.x.

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

No branches or pull requests

1 participant