anchor.diff:  
   == Background
   
  -In this CIP we assume the following baseline semantics as a given and well-defined.
  -Further, we consider a simple rewrite semantics for grouping and aggregation, that lays the foundation for the rewrite semantics that is proposed in the <<Proposal>> section of this CIP.
  -
  -We also use following driving table in most of the CIP's examples:
  +In this CIP we assume two baseline semantics as a given and well-defined.
  +Each baseline semantics captures on capability of the WITH and the RETURN clause in isolation -- similar to https://en.wikipedia.org/wiki/Relational_algebra[relational algebra operators].
  +
  +_<<Baseline projection>>_ :: Describes the projection of binding table
  +_<<Baseline aggregation>>_ :: Describes grouping and aggregation of binding table
  +
  +The WITH and the RETURN clause also allow ordering and truncating the driving table, but we ignore these aspects in the background considerations.
  +
  +We define a <<Simple rewrite semantics>> for grouping and aggregation.
  +As its name suggests, the simple rewrite semantics is defined as a syntax transformation to a linear composition of the baseline semantics.
  +The simple rewrite semantics lays the foundation for the rewrite semantics that is proposed in the <<Proposal>> section of this CIP.
  +
  +We briefly demonstrate the <<Limits of the simple rewrite semantics>> to motivate the proposed semantics.
  +
  +Further, we use following driving table in most of the CIP's examples:
   
   .Example driving table
   |===
  
positive.code: WITH AGGR(_L_)
  ----
  
  Let's call this the _simple rewrite semantics_ for the WITH and RETURN clause.
  
  .Simple rewrite semantics
  ====
  
negative.code: 
  [NOTE]
  ====
  A less artificial example is calculating the total gross of an order as the discounted sum of the net values –– product price multiplied by amount –– of the order's line items in query such as:
  
  .[[Q5]]Q5
  [source, cypher]
  ----
  MATCH
  (c:Customer)-[:LOCATED_IN]->(s:State),
  (c)-[:ORDERED]->(o:Order),
  (o)-[:INCLUDES]->(li:LineItem)-->(p:Product)
  RETURN s AS state, c AS customer, o AS order,
         SUM(li.amount * p.price) * c.discount * s.vat AS totalGross
  ----
  ====
  
  It has been documented on multiple occasions (e.g. cf. http://opencypher.org/articles/2017/07/27/ocig1-aggregations-article/[First oCIG Meeting]) that the existing semantics of Cypher is imprecise on such queries.
  
  A precise semantics on such queries has to provide
  
  * A clear definition which <ProjectionItem>s constitute the grouping keys
  * Clear rules which sub-expressions are allowed in <ProjectionItem>s containing aggregation functions
  
  This proposal provides a such precise semantics.
  
  