public static List <EdgeAggregator> InstantiateTransitive(CongruentTriangles cts1, CongruentTriangles cts2) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); Dictionary <Point, Point> firstTriangleCorrespondence = cts1.HasTriangle(cts2.ct1); Dictionary <Point, Point> secondTriangleCorrespondence = cts1.HasTriangle(cts2.ct2); // Same Congruence if (firstTriangleCorrespondence != null && secondTriangleCorrespondence != null) { return(newGrounded); } // No relationship between congruences if (firstTriangleCorrespondence == null && secondTriangleCorrespondence == null) { return(newGrounded); } // Acquiring the triangle that links the congruences Triangle linkTriangle = firstTriangleCorrespondence != null ? cts2.ct1 : cts2.ct2; List <Point> linkPts = linkTriangle.points; Dictionary <Point, Point> otherCorrGCTSpts = cts1.OtherTriangle(linkTriangle); Dictionary <Point, Point> otherCorrCTSpts = cts2.OtherTriangle(linkTriangle); // Link the other triangles together in a new congruence Dictionary <Point, Point> newCorrespondence = new Dictionary <Point, Point>(); foreach (Point linkPt in linkPts) { Point otherGpt; if (!otherCorrGCTSpts.TryGetValue(linkPt, out otherGpt)) { throw new ArgumentException("Something strange happened in Triangle correspondence."); } Point otherCpt; if (!otherCorrCTSpts.TryGetValue(linkPt, out otherCpt)) { throw new ArgumentException("Something strange happened in Triangle correspondence."); } newCorrespondence.Add(otherGpt, otherCpt); } List <Point> triOne = new List <Point>(); List <Point> triTwo = new List <Point>(); foreach (KeyValuePair <Point, Point> pair in newCorrespondence) { triOne.Add(pair.Key); triTwo.Add(pair.Value); } // // Create the new congruence // AlgebraicCongruentTriangles acts = new AlgebraicCongruentTriangles(new Triangle(triOne), new Triangle(triTwo)); List <GroundedClause> antecedent = new List <GroundedClause>(); antecedent.Add(cts1); antecedent.Add(cts2); newGrounded.Add(new EdgeAggregator(antecedent, acts, annotation)); return(newGrounded); }