//  Copyright (c) 2015 Rob Rix. All rights reserved.

public func constraints(graph: Graph<Node>) -> (Term, assumptions: AssumptionSet, constraints: ConstraintSet) {
	let parameters = Node.parameters(graph)
	let returns = Node.returns(graph)
	let returnType: Term = reduce(returns, nil) { $0.0.map { .product(Term(), $0) } ?? Term() } ?? .Unit
	return (reduce(parameters, returnType) {
		.function(Term(), $0.0)
	}, [:], [])
}


import Manifold

//  Copyright (c) 2015 Rob Rix. All rights reserved.

public func constraints(graph: Graph<Node>) -> (Term, constraints: ConstraintSet) {
	let parameters = Node.parameters(graph)
	let returns = Node.returns(graph)
	let returnType: Term = reduce(returns, nil) { $0.0.map { .product(Term(), $0) } ?? Term() } ?? .Unit
	return (reduce(parameters, returnType) {
		.function(Term(), $0.0)
	}, [])
}


import Manifold

Remove the assumption set return.
Remove the assumption set return.

Graphs don’t have anything corresponding to variables, so we don’t need
to generate assumptions about them.
