Objects/Documentation
coupures32.py
Two cuts in a proof chain · coupures32.py
Download ↓"""Three proof blocks, exact dynamic composition and independent joint breadth-first search."""
from collections import deque
from itertools import product
from functools import lru_cache
from pathlib import Path
from interface31 import costs
import json
def joint(blocks,motif,k,retain):
word=''.join(blocks);ends=[sum(map(len,blocks[:i+1])) for i in range(len(blocks))]
parents=[0,motif]+[{'A':1,'B':2,'X':3}[x] for x in word];q=deque([(0,0,0,0)]);seen=set()
while q:
live,i,spent,d=q.popleft()
if i==len(word):return d
if (live,i,spent) in seen:continue
seen.add((live,i,spent));stop=next(z for z in ends if z>i)
for v in (0,1,*range(i+2,stop+2)):