Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- type Constraint
- func (p Constraint[F]) Accepts(tr trace.Trace[F], _ schema.AnySchema[F]) (bit.Set, schema.Failure)
- func (p Constraint[F]) Bounds(module uint) util.Bounds
- func (p Constraint[F]) Consistent(schema schema.AnySchema[F]) []error
- func (p Constraint[F]) Contexts() []schema.ModuleId
- func (p Constraint[F]) Lisp(mapping schema.AnySchema[F]) sexp.SExp
- func (p Constraint[F]) Name() string
- func (p Constraint[F]) Substitute(map[string]F)
- type Failure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
type Constraint[F field.Element[F]] struct { Handle string // Evaluation Context for this constraint which must match that of the // source and target expressions. Context schema.ModuleId // Targets returns the indices of the columns composing the "left" table of the // permutation. Targets []register.Id // Sources returns the indices of the columns composing the "right" table of the // permutation. Sources []register.Id }
Constraint declares a constraint that one (or more) columns are a permutation of another.
func NewConstraint ¶
func NewConstraint[F field.Element[F]](handle string, context schema.ModuleId, targets []register.Id, sources []register.Id) Constraint[F]
NewConstraint creates a new permutation
func (Constraint[F]) Accepts ¶
Accepts checks whether a permutation holds between the source and target columns.
func (Constraint[F]) Bounds ¶
func (p Constraint[F]) Bounds(module uint) util.Bounds
Bounds determines the well-definedness bounds for this constraint for both the negative (left) or positive (right) directions. For example, consider an expression such as "(shift X -1)". This is technically undefined for the first row of any trace and, by association, any constraint evaluating this expression on that first row is also undefined (and hence must pass).
func (Constraint[F]) Consistent ¶
func (p Constraint[F]) Consistent(schema schema.AnySchema[F]) []error
Consistent applies a number of internal consistency checks. Whilst not strictly necessary, these can highlight otherwise hidden problems as an aid to debugging.
func (Constraint[F]) Contexts ¶
func (p Constraint[F]) Contexts() []schema.ModuleId
Contexts returns the evaluation contexts (i.e. enclosing module + length multiplier) for this constraint. Most constraints have only a single evaluation context, though some (e.g. lookups) have more. Note that all constraints have at least one context (which we can call the "primary" context).
func (Constraint[F]) Lisp ¶
func (p Constraint[F]) Lisp(mapping schema.AnySchema[F]) sexp.SExp
Lisp converts this schema element into a simple S-Expression, for example so it can be printed.
func (Constraint[F]) Name ¶
func (p Constraint[F]) Name() string
Name returns a unique name for a given constraint. This is useful purely for identifying constraints in reports, etc.
func (Constraint[F]) Substitute ¶
func (p Constraint[F]) Substitute(map[string]F)
Substitute any matchined labelled constants within this constraint