-
Notifications
You must be signed in to change notification settings - Fork 36
Design of Weasel #491
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
base: main
Are you sure you want to change the base?
Design of Weasel #491
Conversation
| | ("forall" | "∀") , numerical_type , [ id ] , prop | ||
| | ("exists" | "∃") , numerical_type , [ id ] , prop | ||
| | (* predicate application *) ; | ||
| | "call" , ind , { term } ; (the function must return an i32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should the function return an i32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on what type we use for prop and how term values get converted to prop. Here the design is to 1. use i32 to encode prop, 2. use pure functions returning i32 as predicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but we could instead allow any function call as long as it is part of an expression returning an i32, for instance call $f = i64.const 42 ?
I'm not opposed to having only function returning an i32. I understand it is easier so it may be better to start like this and relax later if needed, but I just wanted to understand why you wanted such a restriction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, my mind went like this:
- E-ACSL used
intforprop
-> 2. we should useint32forprop
-> 3. predicates should have return typei32
But I didn't realize one subtle point : 1. and 2. are only about internal representation, whereas 3. is about external representation.
So, I think it is better (more intuitive) to simply distinguish zero and non-zero numbers when representing prop externally, be it i32 or i64. That is:
| | "call" , ind , { term } ; (the function must return an i32) | |
| | "call" , ind , { term } ; (the function must return wasm_int_type) |
|
I added the In the following week I'll implement what's currently in the grammar. That involves the so-called "interval inference" (computing the smallest accommodatable numerical type), but also some type checking work, because:
|
Is this really needed? The way I understand this is : if a function is used in a contract, it must be pure. So we check it has the pure attribute, and in a separate phase, we check that every function with the pure attribute is actually pure. Instead, we could simply check that every function used in a contract is pure directly, without going through an attribute (it may be useful for Owi to have this information anyway, even out of the Weasel context).
Makes sense.
Makes sense too. :) |
Well, it's simply because Gospel has One argument favoring |
No description provided.