//forward solving
        private static object InferDistance(this LineSegmentSymbol inputLineSymbol, string label)
        {
            var lineSeg = inputLineSymbol.Shape as LineSegment;

            Debug.Assert(lineSeg != null);

            if (label != null && lineSeg.Distance != null)
            {
                var goal = new EqGoal(new Var(label), lineSeg.Distance);
                TraceInstructionalDesign.FromLineSegmentToDistance(inputLineSymbol);
                goal.Traces.AddRange(inputLineSymbol.Traces);
                return(goal);
            }
            if (label != null && inputLineSymbol.CachedSymbols.Count != 0)
            {
                var goalList = new List <object>();
                foreach (var lss in inputLineSymbol.CachedSymbols)
                {
                    var cachedLss = lss as LineSegmentSymbol;
                    Debug.Assert(cachedLss != null);
                    var cachedLs = cachedLss.Shape as LineSegment;
                    Debug.Assert(cachedLs != null);
                    var goal = new EqGoal(new Var(label), cachedLs.Distance);
                    //goal.Traces.AddRange(cachedLss.Traces);
                    TraceInstructionalDesign.FromLineSegmentToDistance(cachedLss);
                    goal.Traces.AddRange(cachedLss.Traces);
                    goalList.Add(goal);
                }
                return(goalList);
            }
            return(null);
        }
        public void Problem01()
        {
/*            const string input1 = "A(2,0)";
 *          const string input2 = "B(5,4)";*/

            var pt1 = new Point(2, 0);
            var ps1 = new PointSymbol(pt1);

            var pt2 = new Point(5, 4);
            var ps2 = new PointSymbol(pt2);

            var d      = new Var("d");
            var eqGoal = new EqGoal(d, 5);

            var ls  = new LineSegment(pt1, pt2);
            var lss = new LineSegmentSymbol(ls);

            TraceInstructionalDesign.FromPointsToLineSegment(lss);
            TraceInstructionalDesign.FromLineSegmentToDistance(lss);
        }
 //backward solving
 private static object InferDistance(this LineSegmentSymbol inputLineSymbol, double value)
 {
     return(TraceInstructionalDesign.FromLineSegmentToDistance(inputLineSymbol, value));
 }