Skip to content

Conversation

@Anabra
Copy link
Collaborator

@Anabra Anabra commented Apr 27, 2020

This is just a placeholder PR where we discuss some questions about the Datalog model of GRIN.

@Anabra Anabra marked this pull request as draft April 27, 2020 01:15

// literal value
// example: result <- pure 1
// QUESTION: why the type?
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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?
Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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
Copy link
Collaborator Author

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> ?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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?
Copy link
Collaborator Author

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?
Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.
Copy link
Collaborator Author

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.
Copy link
Collaborator Author

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.

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