Source/Packages

Component.Pointwise

packages/components/src/Component/Pointwise.alpha

408 lines49 declarations15.8 KiBSHA-256 b4c565ce95d3

def · lines 122–146

pointwiseFold

Full file
One structural fold serves semantic evaluators, use analysis and lowerings. The value domain may differ from the literal word representation: reference models use exact natural bit patterns, while a lowering uses typed fragments.
122def pointwiseFold =
123  (lambda erased word : Type 0 .
124    erased value : Type 0 .
125    erased inputs : Nat .
126    unrestricted unary : (pi unrestricted operation : PointwiseUnary . unrestricted x : value . value) .
127    unrestricted binary : (pi unrestricted operation : PointwiseBinary . unrestricted x : value . unrestricted y : value . value) .
128    unrestricted literal : (pi unrestricted bits : word . value) .
129    unrestricted expression : (family PointwiseExpression word inputs) .
130    unrestricted values : (pi unrestricted index : (family StdFin inputs) . value) .
131    eliminate
132      PointwiseExpression
133      (lambda unrestricted current : (family PointwiseExpression word inputs) . value)
134      expression
135      (branch PointwiseInput index . values index)
136      (branch PointwiseConstant bits . literal bits)
137      (branch PointwiseUnaryExpression operation operand result . unary operation result)
138      (branch
139        PointwiseBinaryExpression
140        operation
141        left
142        right
143        leftResult
144        rightResult
145        .
146        binary operation leftResult rightResult))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.