"""Compare the criterion of Theorem 'schema' of main.tex (Ga third slots, curves receiving entries in several columns, relation spaces over Q / k_c / K, support and graph rules, two diagonal rules) with the exhaustive enumeration of ../anc/u101_enum.py (imported read-only; it is the enumeration of Remark 'enumeration'). Class of the theorem (all three columns of weight two): * every column has exactly two weight-one slots (Gm or a curve), plus at most one Ga slot; * every Ga slot receives at most one entry. (With --h2: additionally no relation allowed in any curve slot holding entries; this was the first version.) Layouts: components H (Ga columns, weight 0), P (Gm columns), U_c (columns of E_c), each = U cap span(support) with full support on its support, U from a list of 306 subspaces of Q^3 spanned by vectors with entries in {-1,0,1,2}. Deadness: Ga slot of column j dead iff j not in supp(H); Gm slot dead iff j not in supp(P); copy of E_c in column j: if E_c receives entries in >= 2 copies: dead iff j not in supp(U_c) (support rule); otherwise: dead iff e_j not in U_c (graph rule; the copy is then separated). r = 2 - lam_min(dead set) in the enumeration's adversarial relation model (relation patterns slot by slot, a shared relation forbidden when it would make a provably transcendental period ratio algebraic), then the diagonal rules: r <= 1 if both data have Ga entries and dim H <= 1; r = 0 if dim H = 1, H meets a Ga slot with a row-1-only and one with a row-2-only entry, and no allowed pattern makes the dead-slot space a line off both axes (nonaxis_feasible). Criterion: 1 + 5 dim U - 2r - 2w > 0 for all layouts with dim U <= 2. Without --fast, also evaluates the support rule everywhere and the support rule with axis-only Ga components (the enumeration's own model), to locate disagreements. Exact rational arithmetic. Run (from this folder): python schema_ext_vs_u101.py --fast -> schema_ext_fast_out.log (numbers quoted in the paper; about 15 minutes) python schema_ext_vs_u101.py -> schema_ext_vs_u101_out.log (with the comparison columns; about 35 minutes) """ import sys, os, itertools, time sys.dont_write_bytecode = True HERE = os.path.dirname(os.path.abspath(__file__)) src = open(os.path.join(HERE, 'schema_vs_u101.py'), encoding='utf-8').read() cut = src.index('def schema_eval(') ns = {'__file__': os.path.join(HERE, 'schema_vs_u101.py'), '__name__': 'schema_head'} src = src[:cut].replace("out = open(os.path.join(HERE, 'schema_vs_u101_out.log'), 'w', encoding='utf-8')", "out = open(os.path.join(HERE, ('schema_ext_h2_out.log' if '--h2' in sys.argv else ('schema_ext_fast_out.log' if '--fast' in sys.argv else 'schema_ext_vs_u101_out.log'))), 'w', encoding='utf-8')") exec(compile(src, 'schema_vs_u101_head', 'exec'), ns) u = ns['u']; Ulist = ns['Ulist']; comp = ns['comp']; subsets = ns['subsets']; dim = ns['dim']; pr = ns['pr'] T0 = time.time() def multi_curves(cell): cwe = {} for (p, s, S, T) in cell['dslots']: if s[0] == 'E': cwe.setdefault(s, set()).add(p) return {s for s, ps in cwe.items() if len(ps) > 1} def nonaxis_feasible(cell, dead): """Can the dead-slot space be a line off both coordinate axes (unit 101's adversarial model)? Same pattern search as u101_enum.lam_min, dimension-one branch, with the common line L = (1,1) standing for any non-axis line.""" rows = cell['rows']; ds = cell['dslots'] E = [(1, 0), (0, 1)]; L = (1, 1); used = [] for a in dead: S = ds[a][2] if len(S) == 1: if u.allowed(ds[a], E[S[0]], rows): used.append((a, E[S[0]])); continue return False if u.allowed(ds[a], L, rows): used.append((a, L)); continue return False for (a, za), (b, zb) in itertools.combinations(used, 2): if u.rank([za, zb]) == 1 and u.prov(u.sub(ds[a][3], ds[b][3])): return False return True def schema_eval_ext(cell, rule='ext', ga_axes_only=False): cs = cell['colslots']; ds = cell['dslots'] gm_cols = [p for p in range(3) if 'Gm' in cs[p]] ga_cols = [p for p in range(3) if 'Ga' in cs[p]] ecs = {} for p in range(3): for s in cs[p]: if s[0] == 'E': ecs.setdefault(s, []).append(p) curves = sorted(ecs.items()) multi = multi_curves(cell) # live-Ga refinement: both rows have Ga entries (disjoint supports, one entry per Ga slot) -> eps_1, eps_2 independent; # if dim H <= 1 they cannot both lie in T_{H_0}, so the image of S(G') has K-dimension <= 1. ga_rows = {i for (p, s, S, T) in cell['dslots'] if s == 'Ga' for i in S} both_ga = len(ga_rows) == 2 lam_cache = {}; worst = None for Ui in range(len(Ulist)): for sT in subsets(gm_cols): XT, fullT, _ = comp(Ui, sT) if sT else ((), True, {}) if sT and not fullT: continue for sH in subsets(ga_cols): if sH: XH, fullH, hasH = comp(Ui, sH) if not fullH: continue if ga_axes_only and not all(hasH[p] for p in sH): continue else: XH = () for supp in itertools.product(*[subsets(ps) for s, ps in curves]) if curves else [()]: comps = ([XT] if sT else []) + ([XH] if sH else []) ok = True; w = len(XT) if sT else 0 live = set(('Gm', p) for p in sT) | set(('Ga', p) for p in sH) for (s, ps), S in zip(curves, supp): if not S: continue X, full, has = comp(Ui, S) if not full: ok = False; break comps.append(X); w += len(X) for p in S: if rule == 'support' or s in multi or has[p]: live.add((s, p)) if not ok: continue dU = dim([v for X in comps for v in X]) if comps else 0 if dU >= 3: continue dead = tuple(sorted(a for a, (p, s, S_, T) in enumerate(ds) if (s, p) not in live)) if dead not in lam_cache: lam_cache[dead] = u.lam_min(cell, list(dead)) r = 2 - lam_cache[dead] if rule == 'ext' and both_ga and (len(XH) if sH else 0) <= 1: r = min(r, 1) # line rule: dim H = 1 and H meets a Ga slot with a row-1-only entry and one with a row-2-only entry: # the Ga kernel is a K-line off both axes, so r <= 1, and r = 0 if the dead-slot space lies in an axis. if rule == 'ext' and sH and len(XH) == 1 and r >= 1: rws = [S for (p, s_, S, T) in ds if s_ == 'Ga' and p in sH] if (0,) in rws and (1,) in rws: key2 = ('na', dead) if key2 not in lam_cache: lam_cache[key2] = nonaxis_feasible(cell, list(dead)) r = 1 if (r == 2 or lam_cache[key2]) else 0 val = 1 + 5 * dU - 2 * r - 2 * w if worst is None or val < worst[0]: worst = (val, dU, w, r, dead, Ui, sT, sH, supp) return worst FAST = '--fast' in sys.argv # only the extended criterion (support/axis columns then copy it) REQUIRE_H2 = '--h2' in sys.argv # default: generalised relation spaces, no (H2) def in_class_ext(cell): cs = cell['colslots']; ds = cell['dslots']; rows = cell['rows'] for c in cs: one = [s for s in c if s != 'Ga'] if len(one) != 2: return False, 'column without exactly two weight-one slots' if c.count('Ga') > 1: return False, 'two Ga slots in a column' for (p, s, S, T) in ds: if s == 'Ga' and len(S) > 1: return False, 'Ga slot with two entries' if REQUIRE_H2: E = [(1, 0), (0, 1)] for d in ds: if d[1][0] != 'E': continue for z in [E[0], E[1], (1, 1)]: if u.allowed(d, z, rows): return False, '(H2) not provable (relation allowed in a curve slot)' return True, '' if __name__ == '__main__': from collections import Counter cells, stats = u.run() pr('unit-101 enumeration:', stats, round(time.time() - T0, 1), 's') verdict = {}; cls_of = {} for key in cells: res = u.analyse(key) if res is None: continue pos = res['margin'] > 0 verdict[key] = pos if pos: cls_of[key] = u.sort_cell(res)[0] pr('cells with A <= 8:', len(verdict), ' positive:', sum(verdict.values()), ' sorting:', dict(Counter(cls_of.values())), round(time.time() - T0, 1), 's') why_out = Counter(); agree = Counter(); dis = []; new_in = Counter(); new_out = Counter(); kinds = Counter() for key, pos in verdict.items(): sig, rows, plc = key cell = u.build(sig, rows, [list(r) for r in plc]) ok, why = in_class_ext(cell) isnew = cls_of.get(key) == 'NEW' if not ok: why_out[why] += 1 if isnew: new_out[why] += 1 continue ga = any('Ga' in c for c in cell['colslots']); mu = bool(multi_curves(cell)) kind = ('Ga' if ga else '-') + '/' + ('multi' if mu else 'H1') kinds[kind] += 1 ws = schema_eval_ext(cell, 'ext') if FAST: wsup = wax = ws else: wsup = schema_eval_ext(cell, 'support'); wax = schema_eval_ext(cell, 'support', True) sch = ws[0] > 0; sup = wsup[0] > 0; ax = wax[0] > 0 agree[(kind, pos, sch, sup, ax)] += 1 if isnew: new_in[(kind, sch)] += 1 if sch != pos or sup != pos or ax != pos: dis.append((key, pos, ws, wsup, wax, cls_of.get(key, '-'))) pr('outside the extended class:', dict(why_out)) pr('inside, by kind:', dict(kinds)) pr('(kind, unit101 positive, ext criterion holds, support-rule criterion holds, support rule + axis-only Ga holds) -> count') for k_, v in sorted(agree.items()): pr(' ', k_, v) pr('NEW (634) inside the extended class, (kind, criterion holds):', dict(new_in), '; outside:', dict(new_out)) pr('disagreements (any of the three rules vs unit 101):', len(dis)) pr('disagreements by (u101 class, u101 pos, ext holds):', dict(Counter((d[5], d[1], d[2][0] > 0) for d in dis))) for key, pos, ws, wsup, wax, cl in dis[:80]: pr(' ', key, cl, 'u101 pos' if pos else 'u101 neg', '| ext', ws[:5], ws[6:8], '| support', wsup[:5], '| axisGa', wax[:5]) pr('elapsed', round(time.time() - T0, 1), 's')