Documentation

Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Sem

Linear-time canonical binary addition -- composed semantics #

This file composes the one-pass full-adder scan with the three checked rewind contracts. The resulting machine restores both operands, returns a canonical sum, preserves the complete external tape frame, and carries explicit time and all-prefix auxiliary-space bounds.

def Complexity.TM.binaryRippleAddPost {n : } (lhsIdx rhsIdx resultIdx : Fin n) (lhs rhs : ) (inp₀ : Tape) (work₀ : Fin nTape) (out₀ : Tape) :

Postcondition for completed binary ripple addition.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem Complexity.TM.binaryRippleAddTM_hoareTime_frame_internal {n : } (lhsIdx rhsIdx resultIdx : Fin n) (hdistinct : BinaryRippleAddDistinct lhsIdx rhsIdx resultIdx) (lhs rhs : ) (inp₀ : Tape) (work₀ : Fin nTape) (out₀ : Tape) (hlhs : (work₀ lhsIdx).HasBinaryNat lhs) (hrhs : (work₀ rhsIdx).HasBinaryNat rhs) (hresult : (work₀ resultIdx).HasBinaryNat 0) (hinput : Parked inp₀) (hother : ∀ (i : Fin n), i lhsIdxi rhsIdxi resultIdxParked (work₀ i)) (houtput : Parked out₀) :
    (binaryRippleAddTM lhsIdx rhsIdx resultIdx).HoareTime (fun (inp : Tape) (work : Fin nTape) (out : Tape) => inp = inp₀ work = work₀ out = out₀) (binaryRippleAddPost lhsIdx rhsIdx resultIdx lhs rhs inp₀ work₀ out₀) (binaryRippleAddTime lhs rhs)
    theorem Complexity.TM.binaryRippleAddTM_hoareTimeSpace_frame_internal {n : } (lhsIdx rhsIdx resultIdx : Fin n) (hdistinct : BinaryRippleAddDistinct lhsIdx rhsIdx resultIdx) (lhs rhs inputLength initialSpace : ) (inp₀ : Tape) (work₀ : Fin nTape) (out₀ : Tape) (hlhs : (work₀ lhsIdx).HasBinaryNat lhs) (hrhs : (work₀ rhsIdx).HasBinaryNat rhs) (hresult : (work₀ resultIdx).HasBinaryNat 0) (hinput : Parked inp₀) (hother : ∀ (i : Fin n), i lhsIdxi rhsIdxi resultIdxParked (work₀ i)) (houtput : Parked out₀) (hinitial : { state := (binaryRippleAddTM lhsIdx rhsIdx resultIdx).qstart, input := inp₀, work := work₀, output := out₀ }.WithinAuxSpace inputLength initialSpace) :
    (binaryRippleAddTM lhsIdx rhsIdx resultIdx).HoareTimeSpace (fun (inp : Tape) (work : Fin nTape) (out : Tape) => inp = inp₀ work = work₀ out = out₀) (binaryRippleAddPost lhsIdx rhsIdx resultIdx lhs rhs inp₀ work₀ out₀) (binaryRippleAddTime lhs rhs) inputLength (initialSpace + binaryRippleAddTime lhs rhs)