Hoare-style composition rules for TM combinators #
This file provides Hoare-triple composition rules for all four TM combinators. Each rule specifies how pre/postconditions and time bounds compose.
Main results #
seqTM_hoareTime— sequential composition: timeb₁ + 1 + b₂complementTM_hoareTime— complement flips output cell 1: timeb + p_bound + 4ifTM_hoareTime— if-then-else branching: timeb_test + p_bound + max b_then b_else + 5loopTM_hoareTime— loop invariant with variant: time(k + 1) * b_iter
Tape transition effects #
All combinators apply transitionTape / transitionInput at phase boundaries.
These are the identity on stable tapes (head ≥ 1, read ≠ ▷) — see transitionTape_eq_self.
The AllTapesWF invariant ensures stability is preserved across transitions.
Sequential composition of Hoare triples.
AllTapesWF is preserved through the standard combinator phase transition
(transitionTape / transitionInput).
Complement Hoare triple. If tm satisfies a Hoare triple whose
postcondition provides output WF (for rewind), a head bound, and a
property of output cell 1, then complementTM tm satisfies a triple
where output cell 1 is flipped. Time: b + p_bound + 4.
If-then-else Hoare triple. Composes test, then-branch, and else-branch
Hoare triples. The test postcondition must include AllTapesWF (for rewind)
and a head bound. Branch routing maps the test postcondition to the branch
precondition on transitioned tapes (output gets head = 1, cells preserved).
Time: b_test + p_bound + max b_then b_else + 5
(test + transition + rewind + check + branch + halt).
Loop invariant rule. Each iteration (≤ b_iter steps) either halts with
post or returns to the loop start with inv preserved and variant decreased.
The variant is bounded by k under inv, giving total time (k + 1) * b_iter.