Conversation
6d97e50 to
2e0f7b4
Compare
414d1de to
49e1588
Compare
AVM/Class/Member.lean
Outdated
| /-- Extra method logic. The method invariant is combined with auto-generated | ||
| method body constraints to create the method logic. -/ | ||
| invariant : (self : Object lab) → methodId.Args.type → Bool | ||
| invariant : (self : Object lab) → methodId.Args.type -> Bool |
There was a problem hiding this comment.
We should revert this change, and agree on one style of arrows. I've been using unicode arrows for functions (->) and monad assignment (<-).
AVM/Class/Member.lean
Outdated
| invariant : (self : Object lab) → methodId.Args.type -> Bool | ||
| /-- Objects created in the method call. -/ | ||
| created : (self : Object lab) → methodId.Args.type → List SomeObject | ||
| created : (self : Object lab) → methodId.Args.type -> List SomeObject |
Anoma/Nullifier.lean
Outdated
| /-- Not a secret. Use this instance when ownership is not relevant -/ | ||
| instance NullifierKeyCommitment.instInhabited : Inhabited NullifierKeyCommitment where | ||
| default := NullifierKeyCommitment.privateMk | ||
| deriving instance Inhabited for NullifierKeyCommitment |
There was a problem hiding this comment.
Why don't we just add Inhabited to the deriving clause in the NullifierKeyCommitment definition?
There was a problem hiding this comment.
I've added an explicit instance
Apps/OwnedCounter.lean
Outdated
| methods := fun | ||
| | Methods.Incr => counterIncr | ||
| | Methods.Transfer => counterTransfer | ||
| invariant _ _ := True |
There was a problem hiding this comment.
I think it's more readable to not write the invariants explicitly when they're the default ones (always true). Then there is essentially no invariant, and we're only adding visual clutter, imo.
There was a problem hiding this comment.
Besides, we should be using true and false instead of True and False. The first ones are booleans, the second ones are in Prop. There seems to be some weird coercion going on, but this is potentially confusing - let's just use the constants in Bool.
There was a problem hiding this comment.
I've removed the invariants.
I'll use true and false for Bool from now on.
Apps/OwnedCounter.lean
Outdated
| PublicFields := ⟨Unit⟩ | ||
| MethodId := Methods | ||
| MethodArgs := fun | ||
| | Methods.Incr => {type := Nat} |
There was a problem hiding this comment.
Let's decide on a uniform way of promoting Type to SomeType. The convention I've been following is to write e.g. \<Nat\> (as above for PrivateFields and PublicFields).
There was a problem hiding this comment.
I've changed it to <Nat>
b51ab64 to
198eb21
Compare
This pr adds an example app with ownership (OwnedCounter) and the machinery needed to implement it.
The owned counter is the same as the universal counter with two differences:
Transfermethod.