Copy BTA6 with correctness proof from my repo