# Tip: checking predicates are equivalent

**URL:** <https://alloytools.discourse.group/t/tip-checking-predicates-are-equivalent/48>\
**Category:** Uncategorized\
**Created:** [August 26, 2020, 3:58pm UTC](https://alloytools.discourse.group/t/tip-checking-predicates-are-equivalent/48 "2020-08-26T15:58:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hwayne](https://yyz2.discourse-cdn.com/free1/user_avatar/alloytools.discourse.group/hwayne/32/67_2.png) [@hwayne](https://alloytools.discourse.group/u/hwayne)\
**Post date:** [August 26, 2020, 3:58pm UTC](https://alloytools.discourse.group/t/tip-checking-predicates-are-equivalent/48/1 "2020-08-26T15:58:08Z")

</div>

This is covered in _Software Abstractions_ but I often see beginners not use it, so I’m sharing it here again.

Say we have a spec like

```auto
sig Node {
  , edges: set Node
}

pred dag {
  all n: Node | n not in n.^edges
}

```

And we decide to simplify our predicate, to make it faster or more obvious or whatnot. Here I’ll put it in relational form:

```auto
pred dag2 {
  no iden & ^edges
}

```

How do you know your simplification is correct? The easiest way is to just make it a property! Write a check that they’re either both true or both false, like this:

```auto
assert equivalence {
  dag <=> dag2
}

check equivalence

```

If you don’t get a counterexample, you know it holds in the scope you checked.
