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
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 Atom
- type Conjunction
- func (p Conjunction[I, A]) Atoms() []A
- func (p Conjunction[I, A]) Cmp(o Conjunction[I, A]) int
- func (p Conjunction[I, A]) Implies(other Conjunction[I, A]) bool
- func (p Conjunction[I, A]) Remove(atom A) (Conjunction[I, A], bool)
- func (p Conjunction[I, A]) String(braces bool, mapping func(I) string) string
- type Equality
- type Equation
- func (p Equation[S, T, P]) CloseOver(o Equation[S, T, P]) Equation[S, T, P]
- func (p Equation[S, T, P]) Cmp(o Equation[S, T, P]) int
- func (p Equation[S, T, P]) Is(truth bool) bool
- func (p Equation[S, T, P]) LeftHandSide() P
- func (p Equation[S, T, P]) Negate() Equation[S, T, P]
- func (p Equation[S, T, P]) RightHandSide() P
- func (p Equation[S, T, P]) Sign() bool
- func (p Equation[S, T, P]) String(mapping func(S) string) string
- type Proposition
- func (p *Proposition[I, A]) And(other Proposition[I, A]) Proposition[I, A]
- func (p *Proposition[I, A]) Clone() Proposition[I, A]
- func (p *Proposition[I, A]) Conjuncts() []Conjunction[I, A]
- func (p *Proposition[I, A]) Equals(other Proposition[I, A]) bool
- func (p *Proposition[I, A]) IsFalse() bool
- func (p *Proposition[I, A]) IsTrue() bool
- func (p *Proposition[I, A]) Negate() Proposition[I, A]
- func (p *Proposition[I, A]) Or(other Proposition[I, A]) Proposition[I, A]
- func (p *Proposition[I, A]) String(mapping func(I) string) string
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Atom ¶
type Atom[I any, A any] interface { array.Comparable[A] // Return the logical negation of this atom Negate() A // Check whether this atom is equivalent to logical truth or falsehood. Is(bool) bool // CloseOver this term and another, producing a potentially updated version // of this term. For example, closing over "x=y" and "y=0" might given // "x=0", etc. CloseOver(o A) A // String returns a human-readable representation String(func(I) string) string }
Atom represents an indivisible part of a proposition.
type Conjunction ¶
Conjunction represents the conjunction of zero or more atoms.
func (Conjunction[I, A]) Atoms ¶
func (p Conjunction[I, A]) Atoms() []A
Atoms returns the underlying atoms which are conjuncted together.
func (Conjunction[I, A]) Cmp ¶
func (p Conjunction[I, A]) Cmp(o Conjunction[I, A]) int
Cmp implementation for Comparable interface
func (Conjunction[I, A]) Implies ¶
func (p Conjunction[I, A]) Implies(other Conjunction[I, A]) bool
Implies checks whether this conjunction implies another. For example, A implies (A B), whilst (A B) implies (A B C), etc.
func (Conjunction[I, A]) Remove ¶
func (p Conjunction[I, A]) Remove(atom A) (Conjunction[I, A], bool)
Remove an atom from this conjunction (if it is contained within), or simply return this conjunction.
type Equality ¶
type Equality[I Variable[I]] struct { // Sign indicates whether this is an Equality (==) or a non-Equality (!=). Sign bool // Left variable Left I // Right variable or constant Right util.Union[I, big.Int] }
Equality represents a fundamental atom which is either an Equality (=) or a non-Equality (≠) between a variable and either a variable or a constant.
func EqualsConst ¶
EqualsConst returns an equality over a variable and a constant
func NotEqualsConst ¶
NotEqualsConst returns an equality over a variable and a constant
type Equation ¶
type Equation[S util.Comparable[S], T poly.Term[S, T], P poly.Polynomial[S, T, P]] struct { // contains filtered or unexported fields }
Equation represents an equation between two polynomials, such as "0 == x + 1" or "0 != 2xy + 3", etc.
func Vanishes ¶
func Vanishes[S util.Comparable[S], T poly.Term[S, T], P poly.Polynomial[S, T, P]](term P) Equation[S, T, P]
Vanishes constraints a new vanishing constraint (P == 0) for a given term P.
func (Equation[S, T, P]) LeftHandSide ¶
func (p Equation[S, T, P]) LeftHandSide() P
LeftHandSide returns the left-hand side of this equation
func (Equation[S, T, P]) Negate ¶
Negate this Equality (i.e. turn it from "==" to "!=" or vice-versa)
func (Equation[S, T, P]) RightHandSide ¶
func (p Equation[S, T, P]) RightHandSide() P
RightHandSide returns the right-hand side of this equation
type Proposition ¶
Proposition provides an abstraction over logical statements made up from conjunctions and disjunctions of atoms (i.e. atomic formulae). Currently, propositions are always stored in Disjunctive Normal Form (DNF).
func NewProposition ¶
func NewProposition[I any, A Atom[I, A]](atom A) Proposition[I, A]
NewProposition constructs a proposition from a single atom.
func Truth ¶
func Truth[I any, A Atom[I, A]](val bool) Proposition[I, A]
Truth constructs either logical truth or logical false
func (*Proposition[I, A]) And ¶
func (p *Proposition[I, A]) And(other Proposition[I, A]) Proposition[I, A]
And returns the conjunction of two propositions.
func (*Proposition[I, A]) Clone ¶
func (p *Proposition[I, A]) Clone() Proposition[I, A]
Clone this proposition making sure the resulting tree is disjoint
func (*Proposition[I, A]) Conjuncts ¶
func (p *Proposition[I, A]) Conjuncts() []Conjunction[I, A]
Conjuncts returns the individual conjunctions which form this proposition.
func (*Proposition[I, A]) Equals ¶
func (p *Proposition[I, A]) Equals(other Proposition[I, A]) bool
Equals returns true if the two propositions are identical.
func (*Proposition[I, A]) IsFalse ¶
func (p *Proposition[I, A]) IsFalse() bool
IsFalse checks whether or not this branch corresponds with logical false or not.
func (*Proposition[I, A]) IsTrue ¶
func (p *Proposition[I, A]) IsTrue() bool
IsTrue checks whether or not this branch corresponds with logical truth or not.
func (*Proposition[I, A]) Negate ¶
func (p *Proposition[I, A]) Negate() Proposition[I, A]
Negate returns the logical negation of this proposition.
func (*Proposition[I, A]) Or ¶
func (p *Proposition[I, A]) Or(other Proposition[I, A]) Proposition[I, A]
Or returns the disjunction of two propositions.
func (*Proposition[I, A]) String ¶
func (p *Proposition[I, A]) String(mapping func(I) string) string