 
 /// A goal that's satisfied when two properties are equal.
 public func == <P: PropertyProtocol>(lhs: P, rhs: P) -> Goal where P.Value: Equatable {
-    let constraint = equal([ lhs, rhs ])
-    return { state in
-        do {
-            return Generator(values: [ try state.constraining(constraint) ])
-        } catch {
-            return Generator()
-        }
-    }
+    return goal(equal([ lhs, rhs ]))
 }
 
 

/// are compatible with the goal.
public typealias Goal = (State) -> Generator<State>


// MARK: - Equality

/// A goal that's satisfied when a variable equals a value.
public func == <V: VariableProtocol>(variable: V, value: V.Value) -> Goal where V.Value: Equatable {
    return { state in
        do {
            return Generator(values: [ try state.unifying(variable.variable, value) ])
        } catch {
            return Generator()
        }
    }
}

/// A goal that's satisfied when a value equals a variable.


/// A goal that's satisfied when a property doesn't equal a value.
public func != <Value: Hashable>(property: Property<Value>, value: Value) -> Goal {
    return goal(unequal([ property ], values: Set([ value ])))
}

/// A goal that's satisfied when a property doesn't equal a value.
