"""The two complete proofs of the Robbins theorem, step by step, for the Boole Lab: bl theory robbins (and robbins_ab, robbins_e, robbins_cd, robbins_c), bl prove , hint, bl replay mann | mccune. * Mann's variant: A. L. Mann, A Complete Proof of the Robbins Conjecture (2003), as formalized in mathlib (Archive/Robbins.lean, J. Tan, 2026, Apache 2.0). The scripts write out every creative step, as mathlib does: nth_rw, rw_ac and ac_rfl. The proofs are those of module robbins_proof, in the syntax of the lab. * McCune's variant: the proofs found by W. McCune's program EQP in 1996 (files eqp-lemma3, eqp-lemma1 and eqp-lemma0 at www.cs.unm.edu/~mccune/papers/robbins/). Every equation is quoted with its EQP number and justification (para(a,b): equation a substituted into equation b; demod: simplified by the listed equations). A step is one call of auto with the instances of its parents, found once offline. A stage is a list of steps proved in one theory of theories.py. The stages are joined outside the lab (assemble): the constants of a stage are replaced by terms, as in robbins_proof (Section.use). """ import re from kernel import Inst from syntax import term from tactics import TacticError import robbins as rb import robbins_proof as rp W, W2, Q = rp.W, rp.W2, rp.Q A3, A4, A5 = rp.A3, rp.A4, rp.A5 # (depth, pool) of robbins.Goal.auto, tried in turn by the tactic auto SEARCH = ((1, 2), (1, 3), (2, 2)) SEARCH_LIMIT = 60_000 def both_ways(rules): """Each rule as written and backwards, unless it has ← already.""" texts = [] for rule in rules: rule = " ".join(rule.split()) for t in ([rule] if rule.startswith("←") else [rule, "← " + rule]): if t not in texts: texts.append(t) return texts def auto(g, rules): """The tactic auto in a Robbins theory: a search of robbins.Goal.auto (one, then two rewrites on each side, modulo A1 and A2) with the rules in both directions. Returns (depth, pool) of the search that found the proof; on failure g is unchanged.""" texts = both_ways(rules or ["R"]) for depth, pool in SEARCH: try: g.auto(*texts, pool=pool, depth=depth, limit=SEARCH_LIMIT) return depth, pool except TacticError: continue raise TacticError("auto: no proof found") # --- Mann's variant (mathlib) ---------------------------------------------- MANN_1 = [ ("mann_44", "44", ["nth_rw 2 [← R (n(a + b)) (n(a) + b)]", "nth_rw 3 [← R b a]", "ac_rfl"]), ("mann_45", "45", ["nth_rw 2 [← R (n(n(a) + b)) (a + b)]", "nth_rw 3 [← R b a]", "ac_rfl"]), ("mann_46", "46", ["nth_rw 5 [← R b (n(n(a) + b) + a + b)]", "nth_rw 2 [← mann_45 a b]", "ac_rfl"]), ("mann_47", "47", [f"nth_rw 3 [← R c ({W})]", "rw [mann_46 a b]", "ac_rfl"]), ("mann_48", "48", [f"nth_rw 2 [← R (n(b + c)) ({W} + c)]", "rw_ac [mann_47 a b c]", "ac_rfl"]), ("mann_49", "49", [f"nth_rw 3 [← R d ({W2})]", "rw [mann_48 a b c]", "ac_rfl"]), ("mann_50", "50", [f"nth_rw 3 [← mann_49 ({A3}) a (a + a) ({Q})]", f"rw_ac [mann_44 ({A3}) ({Q} + (a + a))]", "ac_rfl"]), ("mann_51", "51", [f"nth_rw 1 [← R (n({Q} + ({A5}))) ({Q} + n({A3}))]", "rw_ac [mann_50 a]", f"rw_ac [mann_47 ({A3}) a (n({A3}))]"]), ("mann_52", "52", [f"rw [← R ({Q} + (a + a)) ({A3})]", "rw_ac [mann_51 a]", "ac_rfl"]), ("mann_53", "53", [f"nth_rw 8 [← R a ({Q} + ({A4}))]", "rw_ac [mann_51 a]", f"rw_ac [mann_45 ({A3}) a]", "ac_rfl"]), ("mann_54", "54", [f"nth_rw 3 [← R b ({Q} + n({A3}))]", "rw [mann_53 a]", "ac_rfl"]), ("winker", "Winker", ["rw [← mann_52 a]", "nth_rw 5 [← mann_54 a (a + a)]", "ac_rfl"]), ] N = "n(A + n(B))" MANN_3 = [ ("pair1", "A + c = c", ["rw [hc]", "rw_ac [h]", "ac_rfl"]), ("pair2", "n(B) = n(c)", ["rw [hc]", "nth_rw 1 [← m38]", "rw_ac [h, h]", "ac_rfl"]), ("pair3a", "A + (A + (A + B)) = B", ["rw [h, h, h]"]), ("pair3", "c + n(A + n(c)) = c", ["rw [← pair2]", "nth_rw 1 [hc]", "nth_rw 1 [← pair3a]", "rw_ac [← m40a]", "rw_ac [h, h]", "rw [hc]", "ac_rfl"]), ("pair4", "n(n(c + n(c)) + n(c)) = c", ["nth_rw 4 [← R c (A + n(c))]", "nth_rw 3 [← pair3]", "nth_rw 1 [← pair1]", "ac_rfl"]), ("fin", "d + d + d + d = d + d + d", ["nth_rw 1 [hd]", "rw_ac [← m40b]", "rw_ac [← hd]"]), ("idem", "d + d + d + (d + d + d) = d + d + d", ["rw_ac [fin, fin, fin]"]), ] Z = "n(e + n(e))" MANN_4 = [ ("zero1", f"e = n(n(e) + {Z})", ["nth_rw 1 [← R e e]", "rw [h]"]), ("zero2", "e + x = n(n(e + x) + n(e + x + n(e)))", ["nth_rw 1 [← R (e + x) e]", "rw_ac [h]", "ac_rfl"]), ("zero3", f"x = n(n(x + n(e) + {Z}) + n(x + e))", [f"nth_rw 1 [← R x (n(e) + {Z})]", "rw [← zero1]", "ac_rfl"]), ("zero4", "n(e) = n(n(e + n(e) + n(e)) + e)", ["nth_rw 1 [← R (n(e)) (e + n(e))]", "rw [← zero1]", "ac_rfl"]), ("zero5", f"e = n(n(e + n(e) + {Z}) + n(e))", ["nth_rw 1 [zero3 e]", "rw [h]"]), ("zero6", "e = n(n(e + n(e) + n(e)) + n(e))", ["nth_rw 1 [← R e (e + n(e) + n(e))]", "rw_ac [← zero4]", "rw_ac [h]", "ac_rfl"]), ("zero7", f"n(e + n(e) + n(e)) = {Z}", ["rw [← R (n(e + n(e) + n(e))) e]", "rw [← zero4, ← zero6]", "ac_rfl"]), ("zero8", f"n(e) = n(e + {Z})", ["nth_rw 1 [zero4]", "rw [zero7]", "ac_rfl"]), ("zero9", f"e + {Z} = e", [f"rw [zero2 ({Z})]", "rw [← zero8]", "nth_rw 6 [zero5]", "ac_rfl"]), ("zero", f"x + {Z} = x", ["nth_rw 2 [zero3 x]", f"rw [← R (x + {Z}) e]", "rw_ac [zero9]", "ac_rfl"]), ("nn1", f"{Z} = n(n(x) + n(n(x)))", [f"rw [← R ({Z}) x]", "ac_simp [zero]"]), ("nn2", "n(x) = n(n(n(x) + n(n(n(x)))))", ["nth_rw 1 [← R (n(x)) (n(n(x)))]", "rw_ac [← nn1 x]", "ac_simp [zero]"]), ("nn3", "n(n(n(x))) = n(x)", ["nth_rw 1 [← R (n(n(n(x)))) (n(x))]", "rw_ac [← nn1 (n(x))]", "ac_simp [zero]", "rw_ac [← nn2 x]"]), ("neg_neg", "n(n(x)) = x", [f"auto [nn3 (n(x + {Z}) + n(x + n({Z}))), R x ({Z})]"]), ("huntington", "n(n(x) + n(y)) + n(n(x) + y) = x", ["nth_rw 3 [← neg_neg x]", "nth_rw 3 [← R (n(x)) y]", "rw [neg_neg]", "ac_rfl"]), ] # --- McCune's variant (EQP, 1996) ------------------------------------------ # (EQP number, EQP justification, the equation as EQP printed it, script). # The equations are W. McCune's (EQP 0.9 proofs, 1996), quoted with # attribution; the scripts are ours. EQP_M550 = [ ('10', 'para(7,7)', 'n(n(n(x+y)+n(x)+y)+y) = n(x+y)', ['auto [R]']), ('11', 'para(7,7)', 'n(n(n(n(x)+y)+x+y)+y) = n(n(x)+y)', ['auto [R]']), ('29', 'para(11,7)', 'n(n(n(n(x)+y)+x+y+y)+n(n(x)+y)) = y', ['auto [eqp11, R]']), ('54', 'para(29,7)', 'n(n(n(n(n(x)+y)+x+y+y)+n(n(x)+y)+z)+n(y+z)) = z', ['auto [eqp29, R]']), ('217', 'para(54,7)', 'n(n(n(n(n(x)+y)+x+y+y)+n(n(x)+y)+n(y+z)+z)+z) = n(y+z)', ['auto [R (n(y + z)) (n(n(n(x) + y) + x + y + y) + n(n(x) + y) + z), ' 'eqp54 x y z]']), ('674', 'para(217,7)', 'n(n(n(n(n(n(x)+y)+x+y+y)+n(n(x)+y)+n(y+z)+z)+z+u)+n(n(y+z)+u)) = u', ['auto [eqp217, R]']), ('6736', 'para(10,674)', 'n(n(n(n(x+x+x)+x)+n(x+x+x))+n(n(n(x+x+x)+x)+x+x+x+x+x)) = n(n(x+x+x)+x)', ['auto [eqp10 (x + x + x) (n(n(x + x + x) + x) + (x + x)), eqp674 (x + x ' '+ x) x (x + x) (n(n(x + x + x) + x))]']), ('8855', 'para(6736,7),demod([54]),flip(1)', 'n(n(n(x+x+x)+x)+x+x+x+x+x) = n(x+x+x)', ['auto [R (n(n(n(x + x + x) + x) + (x + x + x + x + x))) (n(n(x + x + ' 'x) + x) + n(x + x + x)), eqp6736 x, eqp54 (x + x + x) x ' '(n(x + x + x))]']), ('8865', 'para(8855,7)', 'n(n(n(n(x+x+x)+x)+n(x+x+x)+x+x)+n(x+x+x)) = n(n(x+x+x)+x)+x+x', ['auto [R (n(n(x + x + x) + x) + (x + x)) (x + x + x), eqp8855 x]']), ('8866', 'para(8855,7),demod([11])', 'n(n(n(x+x+x)+x)+n(x+x+x)) = x', ['auto [R x (n(n(x + x + x) + x) + (x + x + x + x)), eqp8855 x, eqp11 (x ' '+ x + x) x]']), ('8870', 'para(8866,7)', 'n(n(n(n(x+x+x)+x)+n(x+x+x)+y)+n(x+y)) = y', ['auto [R y (n(n(x + x + x) + x) + n(x + x + x)), eqp8866 x]']), ('8871', 'back_demod(8865),demod([8870]),flip(1)', 'n(n(x+x+x)+x)+x+x = x+x', ['auto [eqp8865 x, eqp8870 x (x + x)]']), ] EQP_LEMMA1 = [ ('4', 'para(2,3)', 'n(n(C) + n(D + n(C))) = D', ['auto [h, R]']), ('8', "para(2',3)", 'n(n(D + n(C + x) + y) + n(C + x + y)) = D + y', ['auto [h, R]']), ('20', 'para(4,3)', 'n(D + n(C + n(D + n(C)))) = n(D + n(C))', ['auto [eqp4, R]']), ('34', 'para(3,3)', 'n(n(n(n(x) + y) + n(x + y) + z) + n(y + z)) = z', ['auto [R]']), ('35', 'para(3,3)', 'n(n(n(n(x) + y) + x + y) + y) = n(n(x) + y)', ['auto [R]']), ('56', 'para(2,34)', 'n(n(C) + n(D + n(C + n(x)) + n(C + x))) = D', ['auto [h, eqp34]']), ('151', 'para(20,3)', 'n(n(D + n(C + n(D + n(C))) + x) + n(n(D + n(C)) + x)) = x', ['auto [eqp20, R]']), ('152', 'para(20,3),demod([2])', 'n(n(D + n(C)) + n(C + n(D + n(C)))) = D', ['auto [h, R D (C + n(D + n(C))), eqp20]']), ('173', 'para(152,3)', 'n(D + n(D + n(C) + n(C + n(D + n(C))))) = n(C + n(D + n(C)))', ['auto [eqp152, R]']), ('197', "para(2',151)", 'n(n(C + n(D + n(C))) + n(C + n(C + n(D + n(C))))) = C', ['auto [h, eqp151]']), ('280', 'para(35,3)', 'n(n(n(n(n(x) + y) + x + y) + y + z) + n(n(n(x) + y) + z)) = z', ['auto [eqp35, R]']), ('837', 'para(4,151),demod([173])', 'n(C + n(D + n(C))) = n(C)', ['auto [eqp4, eqp151, eqp173]']), ('839', 'back_demod(197),demod([837,837])', 'n(n(C) + n(C + n(C))) = C', ['auto [eqp837, eqp197]']), ('842', 'para(839,3)', 'n(n(C + x) + n(n(C) + n(C + n(C)) + x)) = x', ['auto [eqp839, R]']), ('844', 'para(839,3)', 'n(C + n(C + n(C + n(C)))) = n(C + n(C))', ['auto [eqp839, R]']), ('883', 'para(844,3)', 'n(n(C + n(C)) + n(C + C + n(C + n(C)))) = C', ['auto [eqp844, R]']), ('946', 'para(883,3)', 'n(C + n(C + n(C) + n(C + C + n(C + n(C))))) = n(C + C + n(C + n(C)))', ['auto [eqp883, R]']), ('1706', 'para(839,280),demod([946])', 'n(C + C + n(C + n(C))) = n(C)', ['auto [eqp280 C C (n(C)), eqp839, eqp946]']), ('1734', 'para(1706,8),demod([56]),flip(1)', 'D + n(C + n(C)) = D', ['auto [eqp8 C (n(C + n(C))), eqp1706, eqp56 C]']), ('1745', "para(2',1734'),demod([2])", 'C + n(C + n(C)) = C', ['auto [h, eqp1734]']), ('1802', "para(1745',3),demod([842]),flip(1)", 'n(C + n(C)) + x = x', ['auto [R (n(C + n(C)) + x) C, eqp1745, eqp842 x]']), ] EQP_LEMMA0 = [ ('4', 'para(1,2)', 'n(n(C) + n(C + n(C))) = C', ['auto [h, R]']), ('5', "para(1',2)", 'n(n(C + n(C) + x) + n(C + x)) = C + x', ['auto [h, R]']), ('8', 'para(4,2)', 'n(n(C + x) + n(n(C) + n(C + n(C)) + x)) = x', ['auto [eqp4, R]']), ('9', 'para(4,2)', 'n(C + n(C + n(C) + n(C))) = n(C)', ['auto [eqp4, R]']), ('13', 'para(1,8)', 'n(n(C) + n(C + n(C) + n(C + n(C)))) = C', ['auto [h, eqp8]']), ('20', 'para(9,2),demod([1])', 'n(n(C) + n(C + n(C) + n(C))) = C', ['auto [h, R C (C + n(C) + n(C)), eqp9]']), ('22', 'para(9,2),demod([20]),flip(1)', 'n(C + n(C) + n(C)) = n(C + n(C))', ['auto [eqp20, eqp9, R (n(C + n(C) + n(C))) C]']), ('24', 'back_demod(9),demod([22])', 'n(C + n(C + n(C))) = n(C)', ['auto [eqp22, eqp9]']), ('32', 'para(24,5),demod([13]),flip(1)', 'C + n(C + n(C)) = C', ['auto [eqp24, eqp5, eqp13]']), ('35', "para(32',2),demod([8]),flip(1)", 'n(C + n(C)) + x = x', ['auto [eqp32, eqp8 x, R (x + n(C + n(C))) C]']), ('42', 'para(35,2),demod([35])', 'n(n(n(x)) + n(x)) = n(C + n(C))', ['auto [eqp35 (n(x)), R (n(C + n(C))) x, eqp35 x]']), ('50', 'para(42,2),demod([35])', 'n(n(n(n(x)) + x)) = n(n(x))', ['auto [eqp42 x, R (n(n(x))) x, eqp35 (n(x + n(n(x))))]']), ('52', 'para(42,2),demod([35,50])', 'n(n(n(x))) = n(x)', ['auto [eqp42, R, eqp35, eqp50]']), ('58', 'para(2,52),demod([2])', 'n(n(x)) = x', ['auto [R, eqp52]']), ('87', 'para(2,58),flip(1)', 'n(n(x) + y) + n(x + y) = n(y)', ['auto [R, eqp58]']), ] # EQP's Lemma 0 ends with a contradiction with -(n(B + n(A)) + n(n(B) + # n(A)) = A): equations 87 and 58 give Huntington's equation. EQP_FINAL = ("88", "87, 58", "n(n(x) + n(y)) + n(n(x) + y) = x", ["rw_ac [eqp87 y (n(x))]", "rw [eqp58]"]) def _mann(rows, statements): return [{"name": name, "statement": statements(name, text), "script": script, "source_pl": source(text, "pl"), "source_en": source(text, "en")} for name, text, script in rows] def source(text, lang): if text.isdigit(): return f"Mann, {'lemat' if lang == 'pl' else 'lemma'} {text}" if text == "Winker": return ("Mann: warunek Winkera" if lang == "pl" else "Mann: Winker's condition") return "mathlib: exists_idempotent / exists_zero" def _theorem_4(name): """The mathlib theorem whose proof the step of stage 4 belongs to.""" if name.startswith("zero"): return "exists_zero" return "huntington" if name == "huntington" else "neg_neg" def _eqp(rows, extra=None): steps = [{"name": f"eqp{num}", "statement": eq, "script": script, "source_pl": f"EQP {num} [{just}]", "source_en": f"EQP {num} [{just}]"} for num, just, eq, script in rows] if extra: num, parents, eq, script = extra steps.append({"name": "huntington", "statement": eq, "script": script, "source_pl": f"EQP {num}: z równań {parents}", "source_en": f"EQP {num}: from equations {parents}"}) return steps VARIANTS = { "mann": { "title_pl": "Mann (2003), jak w mathlib", "title_en": "Mann (2003), as in mathlib", "stages": [ {"theory": "robbins", "title_pl": "lematy 44–54 i warunek Winkera q + 2a = 2a", "title_en": "lemmas 44–54 and Winker's condition q + 2a = 2a", "steps": _mann(MANN_1, lambda n, t: rp.STATEMENTS[n])}, {"theory": None, "title_pl": "lematy 33–40 z założeniami (w robbins_ab jako " "fakty dane)", "title_en": "lemmas 33–40 with hypotheses (given facts in " "robbins_ab)", "steps": []}, {"theory": "robbins_ab", "title_pl": "z A + B = B element idempotentny d + d + d", "title_en": "from A + B = B an idempotent d + d + d", "steps": [{"name": n, "statement": s, "script": script, "source_pl": "mathlib: exists_idempotent", "source_en": "mathlib: exists_idempotent"} for n, s, script in MANN_3]}, {"theory": "robbins_e", "title_pl": "z e + e = e: zero, n(n(x)) = x i równanie " "Huntingtona", "title_en": "from e + e = e: a zero, n(n(x)) = x and " "Huntington's equation", "steps": [{"name": n, "statement": s, "script": script, "source_pl": "mathlib: " + _theorem_4(n), "source_en": "mathlib: " + _theorem_4(n)} for n, s, script in MANN_4]}, ], }, "mccune": { "title_pl": "McCune (EQP, 1996)", "title_en": "McCune (EQP, 1996)", "stages": [ {"theory": "robbins", "title_pl": "poszukiwanie m5-50: 12 równań do warunku Winkera", "title_en": "search m5-50: 12 equations to Winker's " "condition", "steps": _eqp(EQP_M550)}, {"theory": "robbins_cd", "title_pl": "lemat 1: z D + C = C zero n(C + n(C))", "title_en": "Lemma 1: from D + C = C a zero n(C + n(C))", "steps": _eqp(EQP_LEMMA1)}, {"theory": "robbins_c", "title_pl": "lemat 0: z C + C = C równanie Huntingtona", "title_en": "Lemma 0: from C + C = C Huntington's equation", "steps": _eqp(EQP_LEMMA0, EQP_FINAL)}, ], }, } def steps_of(theory): """The steps of both variants in a theory: [(variant, stage number, step)], in the order of the variants.""" found = [] for key, variant in VARIANTS.items(): for i, stage in enumerate(variant["stages"], 1): if stage["theory"] == theory: found += [(key, i, step) for step in stage["steps"]] return found # --- running a script outside the lab (assemble, tests) -------------------- _LINE = re.compile(r"(rw|rw_ac|ac_simp|auto)\s*\[(.*)\]|nth_rw\s+(\d+)\s*" r"\[(.*)\]|(ac_rfl)") def _rules(text): """'a, R (x + y) z' -> ['a', 'R (x + y) z']: split at top-level commas.""" parts, depth, now = [], 0, "" for ch in text: depth += {"(": 1, ")": -1}.get(ch, 0) if ch == "," and depth == 0: parts.append(now.strip()) now = "" else: now += ch return parts + [now.strip()] def run_line(g, line, hypothesis="h"): """One line of a script on a robbins.Goal (only the forms used in the scripts above). `hypothesis` renames h (h1 in a Section).""" line = re.sub(r"\bh\b", hypothesis, line) m = _LINE.fullmatch(line.strip()) if m is None: raise TacticError(f"cannot run {line!r}") tag, rules, k, nth, rfl = m.groups() if rfl: g.ac() elif k: g.nth_rw(int(k), *_rules(nth)) elif tag == "auto": auto(g, _rules(rules)) else: getattr(g, tag)(*_rules(rules)) def script(lines, hypothesis="h"): def run(g): for line in lines: run_line(g, line, hypothesis) return run def mccune_theorem(): """McCune's three EQP proofs joined into one kernel: the 12 equations of m5-50 in the Robbins algebra, Lemma 1 for C, D and Lemma 0 for C as sections, then C := n(C + n(C)) (equation 1802), C := x + x and D := q (equation 8871). Returns the kernel; its theorem huntington is Huntington's equation from A1, A2 and R.""" K = rb.theory() m550, lemma1, lemma0 = (s["steps"] for s in VARIANTS["mccune"]["stages"]) for step in m550: rb.lemma(K, step["name"], step["statement"], script(step["script"])) S1 = rb.Section(K, "CD", ["D + C = C"]) for step in lemma1: S1.lemma(step["name"], step["statement"], script(step["script"], "h1")) S0 = rb.Section(K, "C", ["C + C = C"]) for step in lemma0: S0.lemma(step["name"], step["statement"], script(step["script"], "h1")) zero = term("n(C + n(C))") S0.use(S1, {"C": zero}, Inst("eqp1802", (zero,)), prefix="l0_") # C := a + a, D := q(a): a, not x, which the lemmas use themselves winker = rb.Goal(K, f"{Q} + (a + a) = a + a") winker.exact_ac(Inst("eqp8871", ("a",))) S1.use(K, {"C": "a + a", "D": Q}, winker.qed(), prefix="l1_") return K def assemble(variant): """The whole proof in one kernel: (kernel, name of the theorem).""" if variant == "mann": return rp.robbins_theorem(), "huntington" return mccune_theorem(), "l1_l0_huntington" # --- given facts: Mann's lemmas with hypotheses in robbins_ab ------------- def given(theory, kernel): """Facts of a theory proved by the engine before the lab starts: [(name, l, r, proof, note_pl, note_en)]. In robbins_ab these are the instances of Mann's lemmas 38 and 40 (lemmas with hypotheses, which the lab cannot state); the kernel checks them like any proof.""" if theory != "robbins_ab": return [] M = rp.hypothetical_lemmas(rb.theory()) hyp = rb.congr_n(Inst("h", ())) # n(A + B) = n(B) K = rb.Library(dict(kernel.signature)) K.facts, K.assumptions = dict(kernel.facts), dict(kernel.assumptions) found = [] def add(name, proof, pl, en, statement=None): if statement is not None: g = rb.Goal(K, statement) g.rw("hd") g.exact_ac(proof) proof = g.qed() l, r = K.conclusion(proof) K.theorem(name, (), l, r, proof) found.append((name, l, r, proof, pl, en)) add("m38", M[38, 2]({"a": "A", "b": "B"}, hyp), "lemat 38 Manna dla k = 2 (założenie: n(A + B) = n(B))", "Mann's lemma 38 for k = 2 (hypothesis: n(A + B) = n(B))") add("m40a", M["40a"]({"a": "A", "b": "B"}, hyp), "lemat 40 Manna (założenie: n(A + B) = n(B))", "Mann's lemma 40 (hypothesis: n(A + B) = n(B))") proofs = {} for name, statement, lines in MANN_3[:5]: # pair1 ... pair4 g = rb.Goal(K, statement) script(lines)(g) proofs[name] = rb.transport(g.qed(), {}, proofs) K.theorem(name, (), *K.conclusion(proofs[name]), proofs[name]) add("m40b", M["40b"]({"a": "c", "b": "c"}, proofs["pair4"]), "lemat 40 Manna dla a = b = c (założenie: pair4, dowiedzione " "przez silnik tak samo)", "Mann's lemma 40 for a = b = c (hypothesis: pair4, proved by " "the engine the same way)", "c + (d + d) = c + (d + d + d)") return [f for f in found if f[0] in ("m38", "m40a", "m40b")]