from research import *
s=begin(1012,'Alternative complete walk basis','Do the clean and unclean ordered walks together recover the same list?',{},['C1008','File58 §§13.3–13.4'])
from algebra import Matrix
p=json.loads((ROOT/'model/structural_transfer_inputs.json').read_text())
def pref(order):return [[int(j in order[:i]) for j in range(9)] for i in range(1,len(order)+1)]
M=Matrix(pref(p['clean_order'])+pref(p['unclean_order']));y=M*Matrix(p['Esau_counts'])
finish(s,{'measurements':list(y),'determinant':M.det(),'recovered':list(M.inv()*y)},'The two complete walks form another integer basis. The same accumulation-and-difference operation used for genealogical paths reconstructs this counted list.','Separate universal register dependencies from source-specific equalities.',{'unimodular':M.det()==-1,'prefixes':list(y)==[20,40,50,250,450,490,20,50,60]})
