-
Notifications
You must be signed in to change notification settings - Fork 2
Discussion about the Datalog model of GRIN #2
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: souffle-experiment
Are you sure you want to change the base?
Conversation
|
|
||
| // literal value | ||
| // example: result <- pure 1 | ||
| // QUESTION: why the type? |
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.
VariableSimpleType uses this.
|
|
||
| // bind pattern | ||
| // example: node@(Ctag param0 param1) <- pure input_value | ||
| // QUESTION: what about: node @ (Ctag param0) <- f x |
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.
Just initial design. Main motivation was to be simple.
| Call(node, f) | ||
| CallArgument(node, 0, x) | ||
| */ | ||
| /* QUESTION: is the third field of NodePattern redundant? |
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.
Keep AST simple, so that DL analysis is simple.
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.
Just use a transformation on the GRIN level.
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.
Add linter check.
| .decl Case(case_result:Variable, scrutinee:Variable) | ||
| .decl Alt(case_result:Variable, alt_value:Variable, t:Tag) | ||
| // NOTE: first could be just alt_value since it's unique | ||
| // QUESTION: why the tag here again? Maybe just store it here, and let case_result be alt_value |
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.
In general, we can add redundant fields to avoid additional JOINs in DL clauses. In this specific instance, the tag field can be omitted since that information is always available when using this AltParameter relation.
| // pure a.k.a. return value | ||
| // example: pure value | ||
| // QUESTION: shouldn't this be the return value of a function? | ||
| // QUESTION: can the return value of a function be only of form: pure <var_name> ? |
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.
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.
Just use a transformation on the GRIN level.
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.
Add linter check.
| .decl EffectfulFunction(f:Function) | ||
| .output EffectfulFunction(delimiter=",") | ||
|
|
||
| // QUESTION: Why do we need f to have parameters? |
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.
This probably meant that f is function. Use a relation for that?
| , CodeNameInst(f,n) | ||
| , Effectful(n). | ||
|
|
||
| // QUESTION: CallArgument(n,_,_) means that it is not a nullary function? Why do we need this 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.
This probably meant that n is the result of a function call.
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.
This is probably redundant?
|
|
||
| // QUESTION: CallArgument(n,_,_) means that it is not a nullary function? Why do we need this restriction? | ||
| Effectful(n) :- External(f,1), Call(n, f), CallArgument(n,_,_). | ||
| // QUESTION: Is Update really effectful? Didn't we settle on a conclusion that Updates can only be inside evals |
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.
This is faithful to the Boq PhD, but since then we changed the semantics of "effectful". In the original PhD everything that returned () was effectful, but now only externals that are marked effectful are effectful.
| seqAlg :: [G.ExpF (G.Exp, DL ()) -> DL ()] -> G.ExpF (G.Exp, DL ()) -> DL () | ||
| seqAlg algs exp = mapM_ ($ exp) algs | ||
|
|
||
| -- QUESTION: What is this? It doesn't interact with the AST and it has no side-effects. |
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.
This was just an experiment to define algebra compositions.
| -- call_result <- f value0 value1 | ||
| -- .decl Call(call_result:Variable, f:Function) | ||
| -- .decl CallArgument(call_result:Variable, i:number, value:Variable) | ||
| -- QUESTION: Why is this AST invalid? We can express this using the current model of the DL AST. |
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, see the discussion above.
This is just a placeholder PR where we discuss some questions about the Datalog model of GRIN.