Skip to content

Conversation

@Coda-Coda
Copy link
Collaborator

@Coda-Coda Coda-Coda commented Oct 1, 2024

@jkopanski asked me to make a series of pull requests (#6 #7 #8 #9) bringing in work from the erc20 branch that is applicable more generally. This one adds lemmas about the EVM state and addresses.

All except #9 should be able to be merged in any order.

I have tested that lake build succeeds.

Copy link
Collaborator

@Julek Julek left a comment

Choose a reason for hiding this comment

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

See comments

lemma top_lt_UInt256_size : top < UInt256.size := by decide
lemma top_le_UInt256_size : top ≤ UInt256.size := le_of_lt top_lt_UInt256_size

lemma ofUInt256_lt_UInt256_size {u : UInt256} : ↑(ofUInt256 u) < UInt256.size := by
Copy link
Collaborator

@Julek Julek Oct 7, 2024

Choose a reason for hiding this comment

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

Shorted version that doesn't use open simps:

lemma ofUInt256_lt_UInt256_size {u : UInt256} : ↑(ofUInt256 u) < UInt256.size := by
  unfold ofUInt256 Fin.ofNat
  trans (2 ^ 160) <;> 
    simp only [UInt256.size, Nat.reducePow, Nat.reduceAdd, gt_iff_lt, Nat.ofNat_pos, Nat.mod_lt, Nat.reduceLT]

Copy link
Collaborator

Choose a reason for hiding this comment

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

In general, we have a strong preference for only using open simps as a closing tactic.

@jkopanski jkopanski requested a review from Julek October 8, 2024 11:12
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.

4 participants