Objects/Documentation
composition33.py
The cost of an arbitrary chain of proof blocks · composition33.py
Download ↓"""A potential on the three boundary states proves the optimal cost for arbitrary block counts."""
from pathlib import Path
from itertools import product
from interface31 import costs
from coupures32 import joint
import json
def study():
models=json.loads(Path(__file__).with_name('blocs29.json').read_bytes());out=[]
for m in models:
motif=m['motif'];words=m['blocks'];cost={}
for w in words:
c=costs(w,motif,0,0)[0];cost[w]=c
for h in (0,1,2):
for end,val in costs(w,motif,len(w),h).items():
assert val>=c-1-int(bool(h))+int(bool(end))
assert min(costs(w,motif,0,h).values())>=c-int(bool(h))