 //  Copyright © 2015 Rob Rix. All rights reserved.
 
-enum ABT<Syntax, Term> {
+enum Scoping<Syntax, Term> {
 	case Variable(Name)
 	case Abstraction(Name, Term)
 	case Identity(Syntax)
 
 
-	static func equal(syntaxEqual syntaxEqual: (Syntax, Syntax) -> Bool, termEqual: (Term, Term) -> Bool)(_ left: ABT, _ right: ABT) -> Bool {
+	static func equal(syntaxEqual syntaxEqual: (Syntax, Syntax) -> Bool, termEqual: (Term, Term) -> Bool)(_ left: Scoping, _ right: Scoping) -> Bool {
 		switch (left, right) {
 		case let (.Variable(name1), .Variable(name2)):
 			return name1 == name2

		return variables
	}

	var out: ABT<AST<ABTTerm>, ABTTerm> {
		switch self {
		case let .In(_, out):
			return out

}


func == <Syntax: Equatable, Term: Equatable> (left: Scoping<Syntax, Term>, right: Scoping<Syntax, Term>) -> Bool {
	return Scoping.equal(syntaxEqual: ==, termEqual: ==)(left, right)
}


indirect enum ABTTerm {
	case In(Set<Name>, Scoping<AST<ABTTerm>, ABTTerm>)

	static func Variable(name: Name) -> ABTTerm {
		return .In([ name ], .Variable(name))
