Skip to content

Commit b7edfdf

Browse files
authored
feat: splitting property assertions (#1321)
* enable previously broken tests This enables several tests which were previously broken due to the lack of splitting for property assertions. * support splitting property assertions Splitting property assertions is more challenging than expected since we want to maintain the notion that a property is an execution computation, rather than a term which can be reduced to an arithmetic expression. * simplify Assertion type and tidy up This simplifies the assertion type to take only a single generic parameter F.
1 parent 22dbb78 commit b7edfdf

File tree

16 files changed

+301
-268
lines changed

16 files changed

+301
-268
lines changed

pkg/corset/compiler/translator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,9 @@ func (t *translator) translateDefProperty(decl *ast.DefProperty) []SyntaxError {
645645
assertion, errors := t.translateLogical(decl.Assertion, module, 0)
646646
//
647647
if len(errors) == 0 {
648+
comp := term.NewLogicalComputation[word.BigEndian, hir.LogicalTerm, hir.Term](assertion)
648649
// Add translated constraint
649-
module.AddConstraint(hir.NewAssertion(decl.Handle, module.Id(), decl.Domain, assertion))
650+
module.AddConstraint(hir.NewAssertion(decl.Handle, module.Id(), decl.Domain, comp))
650651
}
651652
// Done
652653
return errors

pkg/ir/air/constraint.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
package air
1414

1515
import (
16-
"github.com/consensys/go-corset/pkg/ir/term"
1716
"github.com/consensys/go-corset/pkg/schema"
1817
"github.com/consensys/go-corset/pkg/schema/constraint"
1918
"github.com/consensys/go-corset/pkg/schema/constraint/interleaving"
@@ -39,7 +38,7 @@ import (
3938
type ConstraintBound[F field.Element[F]] interface {
4039
schema.Constraint[F]
4140

42-
constraint.Assertion[F, term.Testable[F]] |
41+
constraint.Assertion[F] |
4342
interleaving.Constraint[F, *ColumnAccess[F]] |
4443
lookup.Constraint[F, *ColumnAccess[F]] |
4544
permutation.Constraint[F] |
@@ -63,9 +62,9 @@ func newAir[F field.Element[F], C ConstraintBound[F]](constraint C) Air[F, C] {
6362

6463
// NewAssertion constructs a new AIR assertion
6564
func NewAssertion[F field.Element[F]](handle string, ctx schema.ModuleId, domain util.Option[int],
66-
term term.Testable[F]) Assertion[F] {
65+
term constraint.Property) Assertion[F] {
6766
//
68-
return newAir(constraint.NewAssertion(handle, ctx, domain, term))
67+
return newAir(constraint.NewAssertion[F](handle, ctx, domain, term))
6968
}
7069

7170
// NewInterleavingConstraint creates a new interleaving constraint with a given handle.

pkg/ir/air/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type (
7171
// Assertion captures the notion of an arbitrary property which should hold for
7272
// all acceptable traces. However, such a property is not enforced by the
7373
// prover.
74-
Assertion[F field.Element[F]] = Air[F, constraint.Assertion[F, term.Testable[F]]]
74+
Assertion[F field.Element[F]] = Air[F, constraint.Assertion[F]]
7575
// InterleavingConstraint captures the essence of an interleaving constraint
7676
// at the MIR level.
7777
InterleavingConstraint[F field.Element[F]] = Air[F, interleaving.Constraint[F, *ColumnAccess[F]]]

pkg/ir/hir/constraint.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ type Constraint struct {
3838
}
3939

4040
// NewAssertion constructs a new assertion
41-
func NewAssertion(handle string, ctx schema.ModuleId, domain util.Option[int], term LogicalTerm,
41+
func NewAssertion(handle string, ctx schema.ModuleId, domain util.Option[int], term constraint.Property,
4242
) Constraint {
4343
//
44-
return Constraint{constraint.NewAssertion(handle, ctx, domain, term)}
44+
return Constraint{constraint.NewAssertion[word.BigEndian](handle, ctx, domain, term)}
4545
}
4646

4747
// NewVanishingConstraint constructs a new vanishing constraint

0 commit comments

Comments
 (0)