public static PrintRule DefaultRewriteRule(Term t, PrettyPrintFormat format)
        {
            var prefix = new Func <bool, string>(isPrime => t.PrettyName +
                                                 (format.showType ? t.GenericType : "") +
                                                 (t.generalizationCounter >= 0 ? (isPrime ? "'" : "") + "_" + t.generalizationCounter : "") +
                                                 (t.iterationOffset > 0 ? "_-" + t.iterationOffset : "") +
                                                 (format.showTermId && t.generalizationCounter < 0 && t.id != -1 ? "[" + (t.id >= 0 ? t.id.ToString() : $"g{-t.id}") + (isPrime ? "'" : "") + "]" : "") +
                                                 (t.TheorySpecificMeaning == null ? "(" : ""));

            return(new PrintRule
            {
                prefix = prefix,
                infix = new Func <bool, string>(_ => ", "),
                suffix = new Func <bool, string>(_ => t.TheorySpecificMeaning == null ? ")" : ""),
                color = PrintConstants.defaultTermColor,
                printChildren = true,
                associative = false,
                indent = true,
                isDefault = true,
                precedence = 0,
                historyConstraints = new ConstraintType(),
                prefixLineBreak = LineBreakSetting.After,
                infixLineBreak = LineBreakSetting.After,
                suffixLineBreak = LineBreakSetting.Before,
                parentheses = ParenthesesSetting.Never
            });
        }
        public PrettyPrintFormat NextEqualityExplanationPrintingDepth()
        {
            var nextFormat = new PrettyPrintFormat
            {
                maxWidth             = maxWidth,
                MaxTermPrintingDepth = MaxTermPrintingDepth,
                MaxEqualityExplanationPrintingDepth     = MaxEqualityExplanationPrintingDepth,
                CurrentEqualityExplanationPrintingDepth = CurrentEqualityExplanationPrintingDepth + 1,
                ShowEqualityExplanations = ShowEqualityExplanations,
                showTermId            = showTermId,
                showType              = showType,
                rewritingEnabled      = rewritingEnabled,
                printRuleDict         = printRuleDict,
                childIndex            = childIndex,
                printContextSensitive = printContextSensitive,
                termNumbers           = termNumbers,
                equalityNumbers       = equalityNumbers
            };

            return(nextFormat);
        }
        public PrettyPrintFormat NextTermPrintingDepth(Term parent, int childNo)
        {
            var nextFormat = new PrettyPrintFormat
            {
                maxWidth             = maxWidth,
                MaxTermPrintingDepth = MaxTermPrintingDepth == 0 ? 0 : MaxTermPrintingDepth - 1,
                MaxEqualityExplanationPrintingDepth     = MaxEqualityExplanationPrintingDepth,
                CurrentEqualityExplanationPrintingDepth = CurrentEqualityExplanationPrintingDepth,
                ShowEqualityExplanations = ShowEqualityExplanations,
                showTermId            = showTermId,
                showType              = showType,
                rewritingEnabled      = rewritingEnabled,
                printRuleDict         = printRuleDict,
                childIndex            = childNo,
                printContextSensitive = printContextSensitive,
                termNumbers           = termNumbers,
                equalityNumbers       = equalityNumbers
            };

            nextFormat.history.AddRange(history);
            nextFormat.history.Add(Tuple.Create(parent, childNo));
            return(nextFormat);
        }