diff --git a/src/morphism.rs b/src/morphism.rs index 9ba1ecb..a433bdc 100644 --- a/src/morphism.rs +++ b/src/morphism.rs @@ -65,7 +65,7 @@ impl MorphismBase { &m.get_type().src_type, &src_type.clone().normalize() ) { - let dst_type = + let dst_type = m.get_type().dst_type.clone() .apply_substitution( &|x| σ.get(x).cloned() ) .clone(); @@ -185,6 +185,7 @@ impl MorphismBase { None } + /// finde a morphism that matches the given morphism type pub fn find_morphism(&self, ty: &MorphismType) -> Option< ( M, HashMap ) > { @@ -255,4 +256,3 @@ impl MorphismBase { } //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>\\ - diff --git a/src/steiner_tree.rs b/src/steiner_tree.rs index d168812..c8984dd 100644 --- a/src/steiner_tree.rs +++ b/src/steiner_tree.rs @@ -34,7 +34,7 @@ impl SteinerTree { let mut new_goals = Vec::new(); let mut added = false; - for g in self.goals.clone() { + for g in self.goals.clone() { if let Ok(σ) = crate::unify(&ty.dst_type, &g) { if !added { self.edges.push(ty.clone()); @@ -107,8 +107,13 @@ impl PathApproxSteinerTreeSolver { let mut new_path_iter = new_path.into_iter().peekable(); // check all existing nodes.. + + if new_path_iter.peek().unwrap() == &src_type { + new_path_iter.next(); + } + for mt in tree.iter() { -// assert!( mt.src_type == &src_type ); + //assert!( mt.src_type == &src_type ); if let Some(t) = new_path_iter.peek() { if &mt.dst_type == t { // eliminate this node from new path @@ -196,7 +201,7 @@ impl SteinerTreeProblem { pub fn solve_approx_path(&mut self, morphisms: &MorphismBase) -> Option< SteinerTree > { if let Some(master) = self.src_types.first() { - + } } */ @@ -238,4 +243,3 @@ impl SteinerTreeProblem { None } } - diff --git a/src/term.rs b/src/term.rs index 29c7d27..2879ced 100644 --- a/src/term.rs +++ b/src/term.rs @@ -14,8 +14,6 @@ pub enum TypeTerm { Num(i64), Char(char), - - /* Complex Terms */ // Type Parameters @@ -47,10 +45,9 @@ impl TypeTerm { *self = TypeTerm::App(vec![ self.clone(), t.into() - ]) + ]) } } - self }