Ejemplo n.º 1
0
        //
        // DO NOT generate a new clause, instead, report the result and generate all applicable
        //
        private static List <EdgeAggregator> StrengthenToRightTriangle(Triangle tri, RightAngle ra, GroundedClause original)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // This angle must belong to this triangle.
            if (!tri.HasAngle(ra))
            {
                return(newGrounded);
            }

            // Strengthen the old triangle to a right triangle
            Strengthened newStrengthened = new Strengthened(tri, new RightTriangle(tri));

            tri.SetProvenToBeRight();

            // Hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(tri);
            antecedent.Add(original);

            newGrounded.Add(new EdgeAggregator(antecedent, newStrengthened, annotation));

            return(newGrounded);
        }
Ejemplo n.º 2
0
        private static List <EdgeAggregator> InstantiateToIsoscelesTrapezoid(Trapezoid trapezoid, CongruentSegments css, GroundedClause original)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Does this paralle set apply to this triangle?
            if (!trapezoid.CreatesCongruentLegs(css))
            {
                return(newGrounded);
            }

            //
            // Create the new IsoscelesTrapezoid object
            //
            Strengthened newIsoscelesTrapezoid = new Strengthened(trapezoid, new IsoscelesTrapezoid(trapezoid));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(original);
            antecedent.Add(css);

            newGrounded.Add(new EdgeAggregator(antecedent, newIsoscelesTrapezoid, annotation));

            return(newGrounded);
        }
Ejemplo n.º 3
0
        //     A __________ B
        //      /          \
        //     /            \
        //    /              \
        // D /________________\ C
        //
        // Trapezoid(A, B, C, D) -> Parallel(Segment(A, B), Segment(C, D))
        //
        private static List <EdgeAggregator> InstantiateFromIsoscelesTrapezoid(GroundedClause clause)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is IsoscelesTrapezoid)
            {
                IsoscelesTrapezoid trapezoid = clause as IsoscelesTrapezoid;

                newGrounded.AddRange(InstantiateFromIsoscelesTrapezoid(trapezoid, trapezoid));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                // Only interested in strenghthened intersection -> perpendicular or -> perpendicular bisector
                if (!(streng.strengthened is IsoscelesTrapezoid))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateFromIsoscelesTrapezoid(streng.strengthened as IsoscelesTrapezoid, streng));
            }

            return(newGrounded);
        }
        //     A _________________ B
        //      /                /
        //     /     \/         /
        //    /      /\        /
        // D /________________/ C
        //
        // Parallelogram(A, B, C, D) -> SegmentBisector(Segment(A, C), Segment(B, D)), SegmentBisector(Segment(B, D), Segment(A, C)),
        //
        private static List <EdgeAggregator> InstantiateTheorem(Parallelogram parallelogram, GroundedClause original)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Generate only if the diagonals are a part of the original figure.
            if (parallelogram.diagonalIntersection == null)
            {
                return(newGrounded);
            }

            // Determine the CongruentSegments opposing sides and output that.
            Intersection diagInter = parallelogram.diagonalIntersection;
            Strengthened sb1       = new Strengthened(diagInter, new SegmentBisector(diagInter, diagInter.lhs));
            Strengthened sb2       = new Strengthened(diagInter, new SegmentBisector(diagInter, diagInter.rhs));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(original);

            newGrounded.Add(new EdgeAggregator(antecedent, sb1, annotation));
            newGrounded.Add(new EdgeAggregator(antecedent, sb2, annotation));

            return(newGrounded);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Figure out what possible segment combinations are before showing the window.
        /// </summary>
        protected override void OnShow()
        {
            var options = new List <Midpoint>();
            List <GroundedClause> current = new List <GroundedClause>();

            //Populate current midpoint givens.
            foreach (GroundedClause gc in currentGivens)
            {
                Midpoint m = gc as Midpoint;
                if (m != null)
                {
                    current.Add(m);
                }
            }

            //Each inmiddle that can be strengthened to a midpoint that is not already a given is an option.
            foreach (InMiddle im in parser.backendParser.implied.inMiddles)
            {
                Strengthened s = im.CanBeStrengthened();
                if (s != null)
                {
                    Midpoint m = s.strengthened as Midpoint;
                    if (!StructurallyContains(current, m))
                    {
                        options.Add(m);
                    }
                }
            }

            optionsBox.ItemsSource = null; //Makes sure the box is graphically updated.
            optionsBox.ItemsSource = options;
        }
Ejemplo n.º 6
0
        //
        // This implements forward and Backward instantiation
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.PERPENDICULAR_DEFINITION;

            // FROM Perpendicular
            if (clause is Perpendicular)
            {
                return(InstantiateFromPerpendicular(clause, clause as Perpendicular));
            }

            // TO Perpendicular
            if (clause is RightAngle || clause is Intersection)
            {
                return(InstantiateToPerpendicular(clause));
            }

            // Handle Strengthening; may be a Perpendicular (FROM) or Right Angle (TO)

            Strengthened streng = clause as Strengthened;

            if (streng != null)
            {
                if (streng.strengthened is Perpendicular && !(streng.strengthened is PerpendicularBisector))
                {
                    return(InstantiateFromPerpendicular(clause, streng.strengthened as Perpendicular));
                }
                else if (streng.strengthened is RightAngle)
                {
                    return(InstantiateToPerpendicular(clause));
                }
            }

            return(new List <EdgeAggregator>());
        }
        //     A _________________ B
        //      /                /
        //     /                /
        //    /                /
        // D /________________/ C
        //
        // Parallelogram(A, B, C, D) -> SegmentBisector(Segment(A, C), Segment(B, D)), SegmentBisector(Segment(B, D), Segment(A, C)),
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.DIAGONALS_PARALLELOGRAM_BISECT_EACH_OTHER;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Parallelogram)
            {
                Parallelogram newPara = clause as Parallelogram;

                newGrounded.AddRange(InstantiateTheorem(newPara, newPara));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Parallelogram))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateTheorem(streng.strengthened as Parallelogram, streng));
            }

            return(newGrounded);
        }
Ejemplo n.º 8
0
        //
        // Congruent(Segment(A, M), Segment(M, B)) -> Midpoint(M, Segment(A, B))
        //
        private static List <EdgeAggregator> InstantiateToMidpoint(InMiddle im, CongruentSegments css)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            Point midpoint = css.cs1.SharedVertex(css.cs2);

            // Does this InMiddle relate to the congruent segments?
            if (!im.point.StructurallyEquals(midpoint))
            {
                return(newGrounded);
            }

            // Do the congruent segments combine into a single segment equating to the InMiddle?
            Segment overallSegment = new Segment(css.cs1.OtherPoint(midpoint), css.cs2.OtherPoint(midpoint));

            if (!im.segment.StructurallyEquals(overallSegment))
            {
                return(newGrounded);
            }

            Strengthened newMidpoint = new Strengthened(im, new Midpoint(im));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(im);
            antecedent.Add(css);

            newGrounded.Add(new EdgeAggregator(antecedent, newMidpoint, annotation));

            return(newGrounded);
        }
Ejemplo n.º 9
0
        //
        //     C
        //     |\
        //     | \
        //     |  \
        //     |   O
        //     |    \
        //     |_    \
        //   A |_|____\ B
        //
        // SemiCircle(O, BC), Angle(BAC) -> RightAngle(BAC)
        //
        public static List <EdgeAggregator> InstantiateTheorem(Semicircle semi, Angle angle, GroundedClause original)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // The angle needs to be inscribed in the given semicircle

            // Note: Previously this was checked indirectly by verifying that the angle intercepts a semicircle, but since semicircles now
            // require 3 points to be defined, it is safer to directly verify that the angle is inscribed in the semicircle.
            // (There may not have been any points defined on the other side of the diameter,
            // meaning there would not actually be any defined semicircles which the angle intercepts).

            if (!semi.AngleIsInscribed(angle))
            {
                return(newGrounded);
            }

            Strengthened newRight = new Strengthened(angle, new RightAngle(angle));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(original);
            antecedent.Add(angle);

            newGrounded.Add(new EdgeAggregator(antecedent, newRight, annotation));

            return(newGrounded);
        }
Ejemplo n.º 10
0
        private bool StronglyRelated(GroundedClause firstNode, GroundedClause secondNode)
        {
            if (firstNode is SegmentRatio && secondNode is SegmentRatio)
            {
                return(true);
            }
            if (firstNode is ProportionalAngles && secondNode is ProportionalAngles)
            {
                return(true);
            }

            if (firstNode is Congruent && secondNode is Congruent)
            {
                if (firstNode is CongruentAngles && secondNode is CongruentAngles)
                {
                    return(true);
                }
                if (firstNode is CongruentSegments && secondNode is CongruentSegments)
                {
                    return(true);
                }
                if (firstNode is CongruentTriangles && secondNode is CongruentTriangles)
                {
                    return(true);
                }
                return(false);
            }

            if (firstNode is Equation && secondNode is Equation)
            {
                if (firstNode is AngleEquation && secondNode is AngleEquation)
                {
                    return(true);
                }
                if (firstNode is SegmentEquation && secondNode is SegmentEquation)
                {
                    return(true);
                }
                return(false);
            }

            //
            // We may strenghthen for many reasons (right triangle, isosceles triangle as well as perpendicular bisector)
            // Compare those strengthened values for a relationship
            //
            if (firstNode is Strengthened && secondNode is Strengthened)
            {
                Strengthened streng1 = firstNode as Strengthened;
                Strengthened streng2 = secondNode as Strengthened;

                return(StronglyRelated(streng1.strengthened, streng2.strengthened));
            }

            //if (firstNode is Similar)
            //{
            //    return secondNode is Similar;
            //}

            return(firstNode.GetType() == secondNode.GetType());
        }
        private static List <EdgeAggregator> CheckAndGenerateSupplementaryCongruentImplyRightAngles(Supplementary supplementary, CongruentAngles conAngles)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            //The given pairs must contain the same angles (i.e., the angles must be both supplementary AND congruent)
            if (!((supplementary.angle1.Equals(conAngles.ca1) && supplementary.angle2.Equals(conAngles.ca2)) ||
                  (supplementary.angle2.Equals(conAngles.ca1) && supplementary.angle1.Equals(conAngles.ca2))))
            {
                return(newGrounded);
            }
            //if (!(supplementary.StructurallyEquals(conAngles))) return newGrounded;

            //
            // Now we have two supplementary and congruent angles, which must be right angles
            //
            Strengthened streng  = new Strengthened(supplementary.angle1, new RightAngle(supplementary.angle1));
            Strengthened streng2 = new Strengthened(supplementary.angle2, new RightAngle(supplementary.angle2));

            // Construct hyperedges
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(supplementary);
            antecedent.Add(conAngles);

            newGrounded.Add(new EdgeAggregator(antecedent, streng, annotation));
            newGrounded.Add(new EdgeAggregator(antecedent, streng2, annotation));

            return(newGrounded);
        }
Ejemplo n.º 12
0
        public static void Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.RIGHT_TRIANGLE_DEFINITION;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            //
            // Instantiating FROM a right triangle
            //
            Strengthened streng = clause as Strengthened;

            if (streng == null)
            {
                return;
            }

            if (streng.strengthened is RightTriangle)
            {
                candidateRight.Add(streng);

                foreach (Strengthened iso in candidateIsosceles)
                {
                    InstantiateRightTriangle(streng, iso);
                }
            }
            else if (streng.strengthened is IsoscelesTriangle)
            {
                candidateIsosceles.Add(streng);

                foreach (Strengthened right in candidateRight)
                {
                    InstantiateRightTriangle(right, streng);
                }
            }
        }
Ejemplo n.º 13
0
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.RIGHT_TRIANGLE_DEFINITION;

            //
            // Instantiating FROM a right triangle
            //
            Strengthened streng = clause as Strengthened;

            if (clause is RightTriangle)
            {
                return(InstantiateFromRightTriangle(clause as RightTriangle, clause));
            }
            if (streng != null && streng.strengthened is RightTriangle)
            {
                return(InstantiateFromRightTriangle(streng.strengthened as RightTriangle, clause));
            }

            //
            // Instantiating TO a right triangle
            //
            if (clause is RightAngle || clause is Strengthened || clause is Triangle)
            {
                return(InstantiateToRightTriangle(clause));
            }

            return(new List <EdgeAggregator>());
        }
Ejemplo n.º 14
0
        private static List <EdgeAggregator> InstantiateToSquare(Rhombus rhombus, RightAngle ra, GroundedClause originalRhom, GroundedClause originalRightAngle)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Does this right angle apply to this quadrilateral?
            if (!rhombus.HasAngle(ra))
            {
                return(newGrounded);
            }

            //
            // Create the new Square object
            //
            Strengthened newSquare = new Strengthened(rhombus, new Square(rhombus));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(originalRhom);
            antecedent.Add(originalRightAngle);

            newGrounded.Add(new EdgeAggregator(antecedent, newSquare, annotation));

            return(newGrounded);
        }
        //     A _________________ B
        //      /                /
        //     /                /
        //    /                /
        // D /________________/ C
        //
        // Parallelogram(A, B, C, D) -> Congruent(Angle(DAB), Angle(BCD)), Congruent(Angle(ADC), Angle(ABC))
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.OPPOSITE_ANGLES_PARALLELOGRAM_ARE_CONGRUENT;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Parallelogram)
            {
                Parallelogram para = clause as Parallelogram;

                newGrounded.AddRange(InstantiateTheorem(para, para));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Parallelogram))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateTheorem(streng.strengthened as Parallelogram, streng));
            }

            return(newGrounded);
        }
Ejemplo n.º 16
0
        //  A ________________  B
        //   |                |
        //   |                |
        //   |                |
        // D |________________| C
        //
        // Rectangle(A, B, C, D) -> Congruent(Segment(A, C), Segment(B, D))
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.DIAGONALS_OF_RECTANGLE_ARE_CONGRUENT;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Rectangle)
            {
                Rectangle rectangle = clause as Rectangle;

                newGrounded.AddRange(InstantiateToTheorem(rectangle, rectangle));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Rectangle))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateToTheorem(streng.strengthened as Rectangle, streng));
            }

            return(newGrounded);
        }
Ejemplo n.º 17
0
        //
        // In order for two triangles to be isosceles, we require the following:
        //    IsoscelesTriangle(A, B, C) -> \angle BAC \cong \angle BCA
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause c)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.ISOSCELES_TRIANGLE_THEOREM;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (c is EquilateralTriangle || (c as Strengthened).strengthened is EquilateralTriangle)
            {
                return(newGrounded);
            }

            if (c is IsoscelesTriangle)
            {
                return(InstantiateTheorem(c, c as IsoscelesTriangle));
            }

            Strengthened streng = c as Strengthened;

            if (streng != null)
            {
                if (streng.strengthened is IsoscelesTriangle)
                {
                    return(InstantiateTheorem(c, streng.strengthened as IsoscelesTriangle));
                }
            }

            return(newGrounded);
        }
Ejemplo n.º 18
0
        public static List <EdgeAggregator> InstantiateFromSegmentBisector(InMiddle im, SegmentBisector sb, GroundedClause original)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Does this bisector apply to this InMiddle? Check point of intersection
            if (!im.point.StructurallyEquals(sb.bisected.intersect))
            {
                return(newGrounded);
            }

            // Segments must equate
            if (!im.segment.StructurallyEquals(sb.bisected.OtherSegment(sb.bisector)))
            {
                return(newGrounded);
            }

            // Create the midpoint
            Strengthened newMidpoint = new Strengthened(im, new Midpoint(im));

            // For hypergraph
            List <GroundedClause> antecedent = Utilities.MakeList <GroundedClause>(original);

            antecedent.Add(im);

            newGrounded.Add(new EdgeAggregator(antecedent, newMidpoint, annotation));

            return(newGrounded);
        }
        private static List <EdgeAggregator> CheckAndGenerateCongruentAdjacentImplyPerpendicular(Intersection intersection, CongruentAngles conAngles)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // The given angles must belong to the intersection. That is, the vertex must align and all rays must overlay the intersection.
            if (!intersection.InducesBothAngles(conAngles))
            {
                return(newGrounded);
            }

            //
            // Now we have perpendicular scenario
            //
            Strengthened streng = new Strengthened(intersection, new Perpendicular(intersection));

            // Construct hyperedge
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(intersection);
            antecedent.Add(conAngles);

            newGrounded.Add(new EdgeAggregator(antecedent, streng, annotation));

            return(newGrounded);
        }
Ejemplo n.º 20
0
        //  A    _______  B
        //      /       \
        //   Y /_________\ Z
        //    /           \
        // D /_____________\ C
        //
        // Trapezoid(A, B, C, D), Median(Y, Z) -> Parallel(Segment(A, B), Segment(Y, Z)), Parallel(Segment(C, D), Segment(Y, Z))
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.MEDIAN_TRAPEZOID_PARALLEL_TO_BASE;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Trapezoid)
            {
                Trapezoid trapezoid = clause as Trapezoid;

                newGrounded.AddRange(InstantiateToTheorem(trapezoid, trapezoid));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Trapezoid))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateToTheorem(streng.strengthened as Trapezoid, streng));
            }

            return(newGrounded);
        }
Ejemplo n.º 21
0
        //  A    _______  B
        //      /       \
        //     /         \
        //    /           \
        // D /_____________\ C
        //
        // IsoscelesTrapezoid(A, B, C, D) -> Congruent(Angle(A, D, C), Angle(B, C, D)), Congruent(Angle(D, A, B), Angle(C, B, A))
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.BASE_ANGLES_OF_ISOSCELES_TRAPEZOID_CONGRUENT;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is IsoscelesTrapezoid)
            {
                IsoscelesTrapezoid trapezoid = clause as IsoscelesTrapezoid;

                newGrounded.AddRange(InstantiateToTheorem(trapezoid, trapezoid));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is IsoscelesTrapezoid))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateToTheorem(streng.strengthened as IsoscelesTrapezoid, streng));
            }

            return(newGrounded);
        }
        //
        // Kite(A, B, C, D) -> Perpendicular(Intersection(Segment(A, C), Segment(B, D))
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.DIAGONALS_OF_KITE_ARE_PERPENDICULAR;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Kite)
            {
                Kite kite = clause as Kite;

                newGrounded.AddRange(InstantiateToTheorem(kite, kite));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Kite))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateToTheorem(streng.strengthened as Kite, streng));
            }

            return(newGrounded);
        }
        private static List <EdgeAggregator> InstantiateToTheorem(Quadrilateral quad, CongruentSegments cs1, CongruentSegments cs2)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Are the pairs on the opposite side of this quadrilateral?
            if (!quad.HasOppositeCongruentSides(cs1))
            {
                return(newGrounded);
            }
            if (!quad.HasOppositeCongruentSides(cs2))
            {
                return(newGrounded);
            }

            //
            // Create the new Rhombus object
            //
            Strengthened newParallelogram = new Strengthened(quad, new Parallelogram(quad));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(quad);
            antecedent.Add(cs1);
            antecedent.Add(cs2);

            newGrounded.Add(new EdgeAggregator(antecedent, newParallelogram, annotation));

            return(newGrounded);
        }
Ejemplo n.º 24
0
        private static List <EdgeAggregator> InstantiateToParallelogram(Quadrilateral quad, Parallel parallel1, Parallel parallel2)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Does this paralle set apply to this triangle?
            if (!quad.HasOppositeParallelSides(parallel1))
            {
                return(newGrounded);
            }
            if (!quad.HasOppositeParallelSides(parallel2))
            {
                return(newGrounded);
            }

            //
            // Create the new Parallelogram object
            //
            Strengthened newParallelogram = new Strengthened(quad, new Parallelogram(quad));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(quad);
            antecedent.Add(parallel1);
            antecedent.Add(parallel2);

            newGrounded.Add(new EdgeAggregator(antecedent, newParallelogram, annotation));

            return(newGrounded);
        }
        //  A __________  B
        //   |          |
        //   |          |
        //   |          |
        // D |__________| C
        //
        // Rhombus(A, B, C, D) -> AngleBisector(Angle(A, B, C), Segment(B, D))
        //                        AngleBisector(Angle(A, D, C), Segment(B, D))
        //                        AngleBisector(Angle(B, A, D), Segment(A, C))
        //                        AngleBisector(Angle(B, C, D), Segment(A, C))
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.DIAGONALS_OF_RHOMBUS_BISECT_ANGLES_OF_RHOMBUS;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Rhombus)
            {
                Rhombus rhombus = clause as Rhombus;

                newGrounded.AddRange(InstantiateToTheorem(rhombus, rhombus));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Rhombus))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateToTheorem(streng.strengthened as Rhombus, streng));
            }

            return(newGrounded);
        }
Ejemplo n.º 26
0
        private static List <EdgeAggregator> InstantiateToRectangle(Parallelogram parallelogram, RightAngle ra, GroundedClause originalPara, GroundedClause originalRightAngle)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Does this right angle apply to this quadrilateral?
            if (!parallelogram.HasAngle(ra))
            {
                return(newGrounded);
            }

            //
            // Create the new Rectangle object
            //
            Strengthened newRectangle = new Strengthened(parallelogram, new Rectangle(parallelogram));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(originalPara);
            antecedent.Add(originalRightAngle);

            newGrounded.Add(new EdgeAggregator(antecedent, newRectangle, annotation));

            return(newGrounded);
        }
        private static List <EdgeAggregator> InstantiateToDefinition(Triangle tri, CongruentSegments cs1, CongruentSegments cs2)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Do these congruences relate one common segment?
            Segment shared = cs1.SharedSegment(cs2);

            if (shared == null)
            {
                return(newGrounded);
            }

            //
            // Do these congruences apply to this triangle?
            //
            if (!tri.HasSegment(cs1.cs1) || !tri.HasSegment(cs1.cs2))
            {
                return(newGrounded);
            }
            if (!tri.HasSegment(cs2.cs1) || !tri.HasSegment(cs2.cs2))
            {
                return(newGrounded);
            }

            //
            // These cannot be reflexive congruences.
            //
            if (cs1.IsReflexive() || cs2.IsReflexive())
            {
                return(newGrounded);
            }

            //
            // Are the non-shared segments unique?
            //
            Segment other1 = cs1.OtherSegment(shared);
            Segment other2 = cs2.OtherSegment(shared);

            if (other1.StructurallyEquals(other2))
            {
                return(newGrounded);
            }

            //
            // Generate the new equialteral clause
            //
            Strengthened newStrengthened = new Strengthened(tri, new EquilateralTriangle(tri));

            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(cs1);
            antecedent.Add(cs2);
            antecedent.Add(tri);

            newGrounded.Add(new EdgeAggregator(antecedent, newStrengthened, annotation));

            return(newGrounded);
        }
        //
        //          C
        //         /)
        //        /  )
        //       / )
        //      / )
        //   A /)_________ B
        //
        // Tangent(Circle(O), Segment(AB)), Intersection(Segment(AC), Segment(AB)) -> 2 * Angle(CAB) = Arc(C, B)
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.CHORD_AND_TANGENT_ANGLE_IS_HALF_INTERCEPTED_ARC;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Intersection)
            {
                Intersection newInter = clause as Intersection;

                foreach (Tangent tangent in candidateTangent)
                {
                    newGrounded.AddRange(InstantiateTheorem(newInter, tangent, tangent));
                }

                foreach (Strengthened streng in candidateStrengthened)
                {
                    newGrounded.AddRange(InstantiateTheorem(newInter, streng.strengthened as Tangent, streng));
                }

                candidateIntersection.Add(newInter);
            }
            else if (clause is Tangent)
            {
                Tangent tangent = clause as Tangent;

                if (!(tangent.intersection is CircleSegmentIntersection))
                {
                    return(newGrounded);
                }

                foreach (Intersection oldInter in candidateIntersection)
                {
                    newGrounded.AddRange(InstantiateTheorem(oldInter, tangent, tangent));
                }

                candidateTangent.Add(tangent);
            }

            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Tangent))
                {
                    return(newGrounded);
                }

                foreach (Intersection oldInter in candidateIntersection)
                {
                    newGrounded.AddRange(InstantiateTheorem(oldInter, streng.strengthened as Tangent, streng));
                }

                candidateStrengthened.Add(streng);
            }

            return(newGrounded);
        }
        //
        //   T
        //   |\
        //   | \
        //   |  \ N <-----------Right Angle
        //   | / \
        //   |/___\
        //   U     S
        //
        //  Altitude(Segment(U, N), Triangle(S, U, T)), RightTriangle(S, U, T) -> Similar(RightTriangle(S, U, T), RightTriangle(S, N, U)),
        //                                                                        Similar(RightTriangle(S, N, U), RightTriangle(U, N, T))
        //                                                                        Similar(RightTriangle(U, N, T), RightTriangle(S, U, T))
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause c)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.ALTITUDE_OF_RIGHT_TRIANGLES_IMPLIES_SIMILAR;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (!(c is Altitude) && !(c is RightTriangle) && !(c is Strengthened))
            {
                return(newGrounded);
            }

            if (c is Strengthened)
            {
                Strengthened streng = c as Strengthened;

                if (!(streng.strengthened is RightTriangle))
                {
                    return(newGrounded);
                }

                foreach (Altitude altitude in candidateAltitudes)
                {
                    newGrounded.AddRange(InstantiateRight(streng.strengthened as RightTriangle, altitude, streng));
                }

                candidateStrengthened.Add(streng);
            }
            else if (c is RightTriangle)
            {
                RightTriangle rt = c as RightTriangle;

                foreach (Altitude altitude in candidateAltitudes)
                {
                    newGrounded.AddRange(InstantiateRight(rt, altitude, rt));
                }

                candRightTriangles.Add(rt);
            }
            else if (c is Altitude)
            {
                Altitude altitude = c as Altitude;

                foreach (RightTriangle rt in candRightTriangles)
                {
                    newGrounded.AddRange(InstantiateRight(rt, altitude, rt));
                }

                foreach (Strengthened stren in candidateStrengthened)
                {
                    newGrounded.AddRange(InstantiateRight(stren.strengthened as RightTriangle, altitude, stren));
                }

                candidateAltitudes.Add(altitude);
            }

            return(newGrounded);
        }
Ejemplo n.º 30
0
        //
        // DO NOT generate a new clause, instead, report the result and generate all applicable
        // clauses attributed to this strengthening of a triangle from scalene to isosceles
        //
        private static EdgeAggregator StrengthenToIsosceles(Triangle tri, CongruentSegments ccss)
        {
            Strengthened newStrengthened = new Strengthened(tri, new IsoscelesTriangle(tri));

            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(ccss);
            antecedent.Add(tri);

            return(new EdgeAggregator(antecedent, newStrengthened, annotation));
        }