I don’t like that assumption; you can only check it after you’ve done all the work, rather than beforehand, and it conceivably could turn out to be false. I think a better assumption would be “The first chunk of L has a feerate f_0 which does not exceed f”
I think by “topologically valid” you’re meaning that no parents follow their child, and that all parents are included; ie if you have c spends p spends gp, then [gp, p, c] and [gp, p] are topologically valid, but [p,c] is not. This lets you say that if b is topologically valid, then for any a,x, if a + b is topologically valid, then b + a is also topologically valid. You also have a + b being t.v implies a is t.v, and that gives you b_1 + b_2 + .. + b_n being t.v and a_0 + b_1 + .. + b_n + a_n being t.v gives b_1 + .. + b_n + a_0 + .. + a_n being t.v.
For the intermediate steps, you’re not moving txs all the way to the front, though, so I think you want something slightly cleverer still; perhaps a + b + c and a + c being t.v gives a + c + b being t.v is enough.
I think you could rewrite this slightly:
- Chunk to (c_0, .., c_n) normally, pick t.
- Note that fee rate of c_0 \le f (is it?) and the feerate of c_i \ge c_{i+1} as a property of chunking.
- Construct c^\prime_t by reordering c_t to ensure the good txs are at the start.
- If c_{t-1} has feerate less than f or c_t \cap T \ne T then the good txs at that start of c^\prime_t will have higher feerate than c_{t-1} (because every tail of T has higher feerate than f) and the final good txs will appear in chunk t-1 or lower on the next round.
- Otherwise, the good txs at the start of c^\prime_t are precisely T, those txs and each of c_0, .., c_{t-1} have feerate f (as c_0's feerate is f_0 \le f by assumption, and by feerate c_i \ge c_{i+1} due to the chunking algorithm, and T has feerate f by definition). But in that case reordering to be T, c_0, .., c_{t-1} doesn’t change the diagram, because all the reordered chunks have precisely the same feerate.
Note that your good txs will never get split up once you’ve moved them, so c_0 will have the same composition and feerate it had originally until t=0 and c_0 \cap T = T, and merging some subset of the good txs into c_{t-1} will mean all of them are merged.
Also, I think your theorem needs a tweak: if you have equal size txs with feerates a=0,b=6,c=9,d=0,e=5, and start with L=[a,b,c,d,e] and T=[a,e], then your original chunks were [a,b,c], [d,e] with both those chunks and T having a feerate of 5. But your new linearisation of [a,e,b,c,d] chunks to [a,e,b,c] [d] with feerates 6.25 and 0. Which is fine, it’s just that T doesn’t actually become the first chunk, since we end up finding a chunk with feerate greater than f instead.