private static IEnumerable<ProofBox> Boxes(Rule rule) { switch (rule.Type) { case RuleType.DisjunctionElimination: yield return ((DisjunctionEliminationRule)rule).Case1; yield return ((DisjunctionEliminationRule)rule).Case2; break; case RuleType.ImpliesIntroduction: yield return ((ImpliesIntroductionRule)rule).Box; break; case RuleType.NegIntroduction: yield return ((NegIntroductionRule)rule).Box; break; case RuleType.ProofByContradiction: yield return ((ProofByContradictionRule)rule).Box; break; } }
private static string RuleToBoxProver(Rule rule) { switch (rule.Type) { case RuleType.Premise: return "premise"; case RuleType.Assumption: return "assumption"; case RuleType.Copy: CopyRule copy = (CopyRule)rule; return $"by copy @l{copy.Line.To}"; case RuleType.ConjunctionIntroduction: var conjI = (ConjunctionIntroductionRule)rule; return $"by con_i @l{conjI.Left.To} @l{conjI.Right.To}"; case RuleType.ConjunctionElimination: var conjE = (ConjunctionEliminationRule)rule; return $"by con_e{conjE.Variant} @l{conjE.Line.To}"; case RuleType.DisjunctionIntroduction: var disjI = (DisjunctionIntroductionRule)rule; return $"by dis_i{disjI.Variant} @l{disjI.Line.To}"; case RuleType.DisjunctionElimination: var disjE = (DisjunctionEliminationRule)rule; return $"by dis_e @l{disjE.Disjunction.To} @l{disjE.Case1.End.To} @l{disjE.Case2.End.To}"; case RuleType.ImpliesIntroduction: var impI = (ImpliesIntroductionRule)rule; return $"by imp_i @l{impI.Box.End.To}"; case RuleType.ImpliesElimination: var impE = (ImpliesEliminationRule)rule; return $"by imp_e @l{impE.Assumption.To} @l{impE.Implication.To}"; case RuleType.NegIntroduction: var negI = (NegIntroductionRule)rule; return $"by neg_i @l{negI.Box.End.To}"; case RuleType.NegElimination: var negE = (NegEliminationRule)rule; return $"by neg_e @l{negE.Line.To} @l{negE.NegLine.To}"; case RuleType.BotElimination: var bE = (BotEliminationRule)rule; return $"by bot_e @l{bE.Bot.To}"; case RuleType.NegNegIntroduction: var nnI = (NegNegIntroductionRule)rule; return $"by nni @l{nnI.Line.To}"; case RuleType.NegNegElimination: var nnE = (NegNegEliminationRule)rule; return $"by nne @l{nnE.Line.To}"; case RuleType.ModusTollens: var mt = (ModusTollensRule)rule; return $"by mt @{mt.Implication.To} @{mt.NegConclusion.To}"; case RuleType.ProofByContradiction: var pbc = (ProofByContradictionRule)rule; return $"by pbc @l{pbc.Box.End.To}"; case RuleType.LawOfExcludedMiddle: return "by lem"; default: throw new NotImplementedException(); } }