Пример #1
0
        public Page23Theorem11(bool onoff, bool complete)
            : base(onoff, complete)
        {
            problemName = "Midpoint Theorem";

            Point a = new Point("A", -3, 0); points.Add(a);
            Point m = new Point("M", 0, 0);  points.Add(m);
            Point b = new Point("B", 3, 0);  points.Add(b);

            List<Point> pts = new List<Point>();
            pts.Add(a);
            pts.Add(m);
            pts.Add(b);
            collinear.Add(new Collinear(pts));

                        parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);

            given.Add(new Midpoint((InMiddle)parser.Get(new InMiddle( m, (Segment)parser.Get(new Segment(a, b))))));

            Multiplication product1 = new Multiplication(new NumericValue(2), (Segment)parser.Get(new Segment(a, m)));
            goals.Add(new GeometricSegmentEquation(product1, (Segment)parser.Get(new Segment(a, b))));

            Multiplication product2 = new Multiplication(new NumericValue(2), (Segment)parser.Get(new Segment(m, b)));
            goals.Add(new GeometricSegmentEquation(product2, (Segment)parser.Get(new Segment(a, b))));
        }
Пример #2
0
        //
        // AngleBisector(SegmentA, D), Angle(C, A, B)) -> 2 m\angle CAD = m \angle CAB,
        //                                                2 m\angle BAD = m \angle CAB
        //
        //   A ________________________B
        //    |\
        //    | \
        //    |  \
        //    |   \
        //    |    \
        //    C     D
        //
        public static List<EdgeAggregator> Instantiate(GroundedClause c)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.ANGLE_BISECTOR_THEOREM;

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

            if (!(c is AngleBisector)) return newGrounded;

            AngleBisector angleBisector = c as AngleBisector;
            KeyValuePair<Angle, Angle> adjacentAngles = angleBisector.GetBisectedAngles();

            // Construct 2 m\angle CAD
            Multiplication product1 = new Multiplication(new NumericValue(2), adjacentAngles.Key);
            // Construct 2 m\angle BAD
            Multiplication product2 = new Multiplication(new NumericValue(2), adjacentAngles.Value);

            // 2X = AB
            GeometricAngleEquation newEq1 = new GeometricAngleEquation(product1, angleBisector.angle);
            GeometricAngleEquation newEq2 = new GeometricAngleEquation(product2, angleBisector.angle);

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

            newGrounded.Add(new EdgeAggregator(antecedent, newEq1, annotation));
            newGrounded.Add(new EdgeAggregator(antecedent, newEq2, annotation));

            return newGrounded;
        }
Пример #3
0
        public static List <GenericInstantiator.EdgeAggregator> InstantiateProportion(GroundedClause clause)
        {
            List <GenericInstantiator.EdgeAggregator> newGrounded = new List <GenericInstantiator.EdgeAggregator>();

            ProportionalAngles propAngs = clause as ProportionalAngles;

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

            // Do not generate equations based on 'forced' proportions
            if (propAngs.proportion.Key == -1 || propAngs.proportion.Value == -1)
            {
                return(newGrounded);
            }

            // Create a product on the left hand side
            Multiplication productLHS = new Multiplication(new NumericValue(propAngs.proportion.Key), propAngs.smallerAngle.DeepCopy());

            // Create a product on the right hand side, if it applies.
            GroundedClause rhs = propAngs.largerAngle.DeepCopy();

            if (propAngs.proportion.Value > 1)
            {
                rhs = new Multiplication(new NumericValue(propAngs.proportion.Key), rhs);
            }

            //
            // Create the equation
            //
            Equation newEquation = null;

            if (propAngs is AlgebraicProportionalAngles)
            {
                newEquation = new AlgebraicAngleEquation(productLHS, rhs);
            }
            else if (propAngs is GeometricProportionalAngles)
            {
                newEquation = new GeometricAngleEquation(productLHS, rhs);
            }

            List <GroundedClause> antecedent = Utilities.MakeList <GroundedClause>(propAngs);

            newGrounded.Add(new GenericInstantiator.EdgeAggregator(antecedent, newEquation, defAnnotation));

            return(newGrounded);
        }
Пример #4
0
        public IPage120Problem8(bool onoff, bool complete)
            : base(onoff, complete)
        {
            problemName = "Overlapping Right Triangles";

            Point a = new Point("A", 0, 3); points.Add(a);
            Point m = new Point("M", 2, 1.5); points.Add(m);
            Point b = new Point("B", 4, 3); points.Add(b);
            Point c = new Point("C", 4, 0); points.Add(c);
            Point d = new Point("D", 0, 0); points.Add(d);

            Segment ad = new Segment(a, d); segments.Add(ad);
            Segment bc = new Segment(b, c); segments.Add(bc);
            Segment cd = new Segment(c, d); segments.Add(cd);

            List<Point> pts = new List<Point>();
            pts.Add(a);
            pts.Add(m);
            pts.Add(c);
            collinear.Add(new Collinear(pts));

            pts = new List<Point>();
            pts.Add(b);
            pts.Add(m);
            pts.Add(d);
            collinear.Add(new Collinear(pts));

            //   given.Add(new Midpoint(m, (Segment)parser.Get(new Segment(a, c))));
            parser = new LiveGeometry.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);

            given.Add(new GeometricCongruentSegments((Segment)parser.Get(new Segment(a, m)), (Segment)parser.Get(new Segment(m, c))));
            given.Add(new Midpoint((InMiddle)parser.Get(new InMiddle( m, (Segment)parser.Get(new Segment(b, d))))));
            given.Add(new RightAngle((Angle)parser.Get(new Angle(b, c, d))));

            goals.Add(new GeometricCongruentTriangles(new Triangle(b, m, c), new Triangle(d, m, a)));
            goals.Add(new Strengthened((Angle)parser.Get(new Angle(a, d, c)), new RightAngle((Angle)parser.Get(new Angle(a, d, c)))));
            goals.Add(new GeometricCongruentTriangles(new Triangle(a, d, c), new Triangle(b, c, d)));

            Multiplication product = new Multiplication(new NumericValue(2), (Segment)parser.Get(new Segment(c, m)));
            goals.Add(new GeometricSegmentEquation(product, (Segment)parser.Get(new Segment(b, d))));
        }
Пример #5
0
        public static List<EdgeAggregator> InstantiateMidpointTheorem(GroundedClause original, Midpoint midpt)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Construct 2AM
            Multiplication product1 = new Multiplication(new NumericValue(2), new Segment(midpt.point, midpt.segment.Point1));
            // Construct 2BM
            Multiplication product2 = new Multiplication(new NumericValue(2), new Segment(midpt.point, midpt.segment.Point2));

            // 2X = AB
            GeometricSegmentEquation newEq1 = new GeometricSegmentEquation(product1, midpt.segment);
            GeometricSegmentEquation newEq2 = new GeometricSegmentEquation(product2, midpt.segment);

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

            newGrounded.Add(new EdgeAggregator(antecedent, newEq1, annotation));
            newGrounded.Add(new EdgeAggregator(antecedent, newEq2, annotation));

            return newGrounded;
        }
        private static List<EdgeAggregator> InstantiateToTheorem(Trapezoid trapezoid, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // If median has not been checked, check now
            if (!trapezoid.IsMedianChecked()) trapezoid.FindMedian();
            // Generate only if the median is valid (exists in the original figure)
            if (!trapezoid.IsMedianValid()) return newGrounded;

            Addition sum = new Addition(trapezoid.baseSegment, trapezoid.oppBaseSegment);
            Multiplication product = new Multiplication(new NumericValue(2), trapezoid.median);

            GeometricSegmentEquation gseq = new GeometricSegmentEquation(product, sum);

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

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

            return newGrounded;
        }
Пример #7
0
        //
        // Inflate a single term possibly creating a subtraction and / or multiplication node
        //
        private static GroundedClause InflateTerm(GroundedClause clause)
        {
            GroundedClause newClause = null;

            // This may not be necessary....
            // If the multiplier is non-unit (not 1), create a multiplication node
            if (Math.Abs(clause.multiplier) != 1)
            {
                newClause = new Multiplication(new NumericValue(Math.Abs(clause.multiplier)), clause);
            }

            // If the multiplier is negative, convert to subtraction
            if (clause.multiplier < 0)
            {
                newClause = new Subtraction(new NumericValue(0), newClause == null ? clause : newClause);
            }

            // Reset multiplier accordingly
            clause.multiplier = 1;

            return newClause == null ? clause : newClause;
        }
Пример #8
0
        public static List<GenericInstantiator.EdgeAggregator> InstantiateProportion(GroundedClause clause)
        {
            List<GenericInstantiator.EdgeAggregator> newGrounded = new List<GenericInstantiator.EdgeAggregator>();

            ProportionalAngles propAngs = clause as ProportionalAngles;
            if (propAngs == null) return newGrounded;

            // Do not generate equations based on 'forced' proportions
            if (propAngs.proportion.Key == -1 || propAngs.proportion.Value == -1) return newGrounded;

            // Create a product on the left hand side
            Multiplication productLHS = new Multiplication(new NumericValue(propAngs.proportion.Key), propAngs.smallerAngle.DeepCopy());

            // Create a product on the right hand side, if it applies.
            GroundedClause rhs = propAngs.largerAngle.DeepCopy();
            if (propAngs.proportion.Value > 1)
            {
                rhs = new Multiplication(new NumericValue(propAngs.proportion.Key), rhs);
            }

            //
            // Create the equation
            //
            Equation newEquation = null;
            if (propAngs is AlgebraicProportionalAngles)
            {
                newEquation = new AlgebraicAngleEquation(productLHS, rhs);
            }
            else if (propAngs is GeometricProportionalAngles)
            {
                newEquation = new GeometricAngleEquation(productLHS, rhs);
            }

            List<GroundedClause> antecedent = Utilities.MakeList<GroundedClause>(propAngs);
            newGrounded.Add(new GenericInstantiator.EdgeAggregator(antecedent, newEquation, defAnnotation));

            return newGrounded;
        }
        private static EdgeAggregator CreateClause(Intersection inter, GroundedClause original, Angle theAngle, Arc theArc)
        {
            Multiplication product = new Multiplication(new NumericValue(2), theAngle);
            GeometricAngleArcEquation angArcEq = new GeometricAngleArcEquation(product, theArc);

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);
            antecedent.Add(inter);

            return new EdgeAggregator(antecedent, angArcEq, annotation);
        }
        //
        //          C
        //         /)
        //        /  )
        //       / )
        //      / )
        //   A /)_________ B
        //
        // Tangent(Circle(O), Segment(AB)), Intersection(Segment(AC), Segment(AB)) -> 2 * Angle(CAB) = Arc(C, B)
        //
        public static List<EdgeAggregator> InstantiateTheorem(Intersection inter, Tangent tangent, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            CircleSegmentIntersection tan = tangent.intersection as CircleSegmentIntersection;

            //
            // Does this tangent apply to this intersection?
            //
            if (!inter.intersect.StructurallyEquals(tangent.intersection.intersect)) return newGrounded;

            Segment secant = null;
            Segment tanSegment = null;
            if (tan.HasSegment(inter.lhs))
            {
                secant = inter.rhs;
                tanSegment = inter.lhs;
            }
            else if (tan.HasSegment(inter.rhs))
            {
                secant = inter.lhs;
                tanSegment = inter.rhs;
            }
            else return newGrounded;

            //
            // Acquire the angle and intercepted arc.
            //
            Segment chord = tan.theCircle.GetChord(secant);
            if (chord == null) return newGrounded;
            //Segment chord = tan.theCircle.ContainsChord(secant);

            // Arc
            // We want the MINOR ARC only!
            if (tan.theCircle.DefinesDiameter(chord))
            {
                Arc theArc = null;
                Point midpt = PointFactory.GeneratePoint(tan.theCircle.Midpoint(chord.Point1, chord.Point2));
                Point opp = PointFactory.GeneratePoint(tan.theCircle.OppositePoint(midpt));

                Point tanPoint = tanSegment.OtherPoint(inter.intersect);

                if (tanPoint != null)
                {
                    // Angle; the smaller angle is always the chosen angle
                    Angle theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, tanPoint);

                    theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, midpt, chord);
                    newGrounded.Add(CreateClause(inter, original, theAngle, theArc));

                    theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, opp, chord);
                    newGrounded.Add(CreateClause(inter, original, theAngle, theArc));
                }
                else
                {
                    // Angle; the smaller angle is always the chosen angle
                    Angle theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, tanSegment.Point1);

                    theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, midpt, chord);
                    newGrounded.Add(CreateClause(inter, original, theAngle, theArc));

                    theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, opp, chord);
                    newGrounded.Add(CreateClause(inter, original, theAngle, theArc));

                    // Angle; the smaller angle is always the chosen angle
                    theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, tanSegment.Point2);

                    theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, midpt, chord);
                    newGrounded.Add(CreateClause(inter, original, theAngle, theArc));

                    theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, opp, chord);
                    newGrounded.Add(CreateClause(inter, original, theAngle, theArc));

                }
            }
            else
            {
                Arc theArc = new MinorArc(tan.theCircle, chord.Point1, chord.Point2);

                // Angle; the smaller angle is always the chosen angle
                Point endPnt = (inter.intersect.StructurallyEquals(tanSegment.Point1)) ? tanSegment.Point2 : tanSegment.Point1;
                Angle theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, endPnt);

                if (theAngle.measure > 90)
                {
                    //If the angle endpoint was already set to Point2, or if the intersect equals Point2, then the smaller angle does not exist
                    //In this case, should we create a major arc or return nothing?
                    if (endPnt.StructurallyEquals(tanSegment.Point2) || inter.intersect.StructurallyEquals(tanSegment.Point2)) return newGrounded;
                    theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, tanSegment.Point2);
                }

                Multiplication product = new Multiplication(new NumericValue(2), theAngle);
                GeometricAngleArcEquation angArcEq = new GeometricAngleArcEquation(product, theArc);

                // For hypergraph
                List<GroundedClause> antecedent = new List<GroundedClause>();
                antecedent.Add(original);
                antecedent.Add(inter);
                antecedent.Add(theArc);
                antecedent.Add(theAngle);

                newGrounded.Add(new EdgeAggregator(antecedent, angArcEq, annotation));
            }

            return newGrounded;
        }
        //     /        A
        //    /         |)
        //   /          | )
        //  /           |  )
        // Q------- O---X---) D
        //   \          |  )
        //    \         | )
        //     \        |)
        //      \        C
        //
        // Inscribed Angle(AQC) -> Angle(AQC) = 2 * Arc(AC)
        //
        private static List<EdgeAggregator> InstantiateTheorem(Circle circle, Angle angle)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Acquire all circles in which the angle is inscribed
            List<Circle> circles = Circle.IsInscribedAngle(angle);

            //
            // Get this particular inscribed circle.
            //
            Circle inscribed = null;
            foreach (Circle c in circles)
            {
                if (circle.StructurallyEquals(c)) inscribed = c;
            }

            if (inscribed == null) return newGrounded;

            // Get the intercepted arc
            Arc intercepted = Arc.GetInterceptedArc(inscribed, angle);

            //
            // Create the equation
            //
            Multiplication product = new Multiplication(new NumericValue(2), angle);
            GeometricAngleArcEquation gaaeq = new GeometricAngleArcEquation(product, intercepted);

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(circle);
            antecedent.Add(angle);
            antecedent.Add(intercepted);

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

            return newGrounded;
        }