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

Smt rw tac: Added the import to Smt.Reconstruction.Certifying #65

Merged
merged 8 commits into from
Sep 3, 2023

Conversation

mhk119
Copy link
Collaborator

@mhk119 mhk119 commented Aug 28, 2023

No description provided.

@tomaz1502
Copy link
Collaborator

tomaz1502 commented Sep 1, 2023

This is looking good! Two comments about the last commit (please make a PR before pushing to main, so its easier to review):

  • It's not necessary to do replaceMainGoal [mv] at the end of evalSMTRw. The goal is already closed when you do mv'.refl
  • The variable m inside both for-loops in smtRw does not need to be mutable

@tomaz1502
Copy link
Collaborator

tomaz1502 commented Sep 1, 2023

Also, in smtRw you could iterate through arrays instead of indices to avoid unsafe operations, like:

  for innerArr in arr do
    let m := innerArr.size
    if m > 1 then
      for j in [: m-1] do
        let r ← mv'.rewrite (← mv'.getType) (mkAppN assoc #[innerArr[m-j-2]!]) true
        mv' ← mv'.replaceTargetEq r.eNew r.eqProof

You could also iterate through the Exprs in innerArr.reverse instead of the indices.
It looks like you are always skipping the last element of each array? if j = 0 then m - j - 2 = m - 2, whereas the last element is at position m - 1

@mhk119
Copy link
Collaborator Author

mhk119 commented Sep 3, 2023

This is looking good! Two comments about the last commit (please make a PR before pushing to main, so its easier to review):

  • It's not necessary to do replaceMainGoal [mv] at the end of evalSMTRw. The goal is already closed when you do mv'.refl
  • The variable m inside both for-loops in smtRw does not need to be mutable

Oh thanks. This is nicer.

@mhk119 mhk119 closed this Sep 3, 2023
@mhk119
Copy link
Collaborator Author

mhk119 commented Sep 3, 2023

Also, in smtRw you could iterate through arrays instead of indices to avoid unsafe operations, like:

  for innerArr in arr do
    let m := innerArr.size
    if m > 1 then
      for j in [: m-1] do
        let r ← mv'.rewrite (← mv'.getType) (mkAppN assoc #[innerArr[m-j-2]!]) true
        mv' ← mv'.replaceTargetEq r.eNew r.eqProof

You could also iterate through the Exprs in innerArr.reverse instead of the indices. It looks like you are always skipping the last element of each array? if j = 0 then m - j - 2 = m - 2, whereas the last element is at position m - 1

Yes. I am skipping the last element deliberately. This is also why I iterated over indices instead. I can try iterating through arrays though.

@mhk119 mhk119 reopened this Sep 3, 2023
let n := arr.size
let mut mv' := mv
let assoc := (opsAssocNull op)[0]!
let null := (opsAssocNull op)[1]!
Copy link
Collaborator

@tomaz1502 tomaz1502 Sep 1, 2023

Choose a reason for hiding this comment

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

This is no big deal, but I believe it would be better if opsAssocNull returned
a pair with the two Expr instead of an Array, unless you're planning to extend
this function to return more constants in the future. Then you can do
let (assoc, null) := opsAssocNull op at smtRw.
(sorry I forgot to publish the comment before)

Copy link
Collaborator Author

@mhk119 mhk119 Sep 3, 2023

Choose a reason for hiding this comment

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

Yes, I plan to add more operators.

@mhk119 mhk119 closed this Sep 3, 2023
@tomaz1502 tomaz1502 reopened this Sep 3, 2023
@tomaz1502 tomaz1502 merged commit 8cb2f22 into ufmg-smite:main Sep 3, 2023
0 of 2 checks passed
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.

2 participants