pub fn renaming<Z: Clone, W: Clone, Y: AsRef<W>>(&self, other: &Pattern<F, Y>, renaming: &mut HashMap<Z, W>) -> bool where X: AsRef<Z> + PartialOrd<Y>, Z: Hash + Eq, W: Eq, F: PartialEq {
		match (self.kind(), other.kind()) {
			(PatternKind::Cons(f1, subs1), PatternKind::Cons(f2, subs2)) if f1 == f2 && subs1.len() == subs2.len() => {
				for i in 0..subs1.len() {
					let a = &subs1[i];
					let b = &subs2[i];

					if !a.renaming(b, renaming) {
						return false
					}
				}

				true
			},
			(PatternKind::Var(x), PatternKind::Var(y)) => {
				let z = x.as_ref();
				if let Some(w) = renaming.get(z) {
					if w == y.as_ref() {
						true
					} else {
						false
					}
				} else {
					if x <= y {
						renaming.insert(z.clone(), y.as_ref().clone());
						true
					} else {
						false
					}
				}
			},
			_ => false
		}
	}
/// Find a renaming from X -> Y so that both patterns are equals.
Find a renaming from X -> Y so that both patterns are equals.
Find a renaming from X - > Y so that both patterns are equals .
pub fn renaming<Z: Clone, W: Clone, Y: AsRef<W>>(&self, other: &Pattern<F, Y>, renaming: &mut HashMap<Z, W>) -> bool where X: AsRef<Z> + PartialOrd<Y>, Z: Hash + Eq, W: Eq, F: PartialEq {
		match (self.kind(), other.kind()) {
			(PatternKind::Cons(f1, subs1), PatternKind::Cons(f2, subs2)) if f1 == f2 && subs1.len() == subs2.len() => {
				for i in 0..subs1.len() {
					let a = &subs1[i];
					let b = &subs2[i];
					if !a.renaming(b, renaming) {
						return false
					}
				}
				true
			},
			(PatternKind::Var(x), PatternKind::Var(y)) => {
				let z = x.as_ref();
				if let Some(w) = renaming.get(z) {
					if w == y.as_ref() {
						true
					} else {
						false
					}
				} else {
					if x <= y {
						renaming.insert(z.clone(), y.as_ref().clone());
						true
					} else {
						false
					}
				}
			},
			_ => false
		}
	}
pub fn renaming < Z : Clone , W : Clone , Y : AsRef < W > > ( & self , other : & Pattern < F , Y > , renaming : & mut HashMap < Z , W > ) -> bool where X : AsRef < Z > + PartialOrd < Y > , Z : Hash + Eq , W : Eq , F : PartialEq { match ( self . kind ( ) , other . kind ( ) ) { ( PatternKind :: Cons ( f1 , subs1 ) , PatternKind :: Cons ( f2 , subs2 ) ) if f1 == f2 && subs1 . len ( ) == subs2 . len ( ) => { for i in 0 .. subs1 . len ( ) { let a = & subs1 [ i ] ; let b = & subs2 [ i ] ; if ! a . renaming ( b , renaming ) { return false } } true } , ( PatternKind :: Var ( x ) , PatternKind :: Var ( y ) ) => { let z = x . as_ref ( ) ; if let Some ( w ) = renaming . get ( z ) { if w == y . as_ref ( ) { true } else { false } } else { if x <= y { renaming . insert ( z . clone ( ) , y . as_ref ( ) . clone ( ) ) ; true } else { false } } } , _ => false } }
Find a renaming from X -> Y so that both patterns are equals.
Find a renaming from X - > Y so that both patterns are equals .
&self
other
&Pattern<F, Y>
renaming
&mut HashMap<Z, W>
&self
other
&Pattern<F, Y>
renaming
&mut HashMap<Z, W>