Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Internal.PolyTimeOptionPair

Pairing computed optional values #

ComputableInPolyTime.optionPair assembles two computed optional fields into one optional pair. It returns none when either field is absent, retains the original input for both computations, and requires no inhabitant of either field type. The result uses the existing encPair layout inside encOption.

theorem Turing.MultiTapeTM.ComputableInPolyTime.optionPair {α β γ : Type} {encA : α ↪ List Bool} {encB : β ↪ List Bool} {encC : γ ↪ List Bool} {f : α → Option β} {g : α → Option γ} (hf : ComputableInPolyTime f encA (encOption encB)) (hg : ComputableInPolyTime g encA (encOption encC)) :
ComputableInPolyTime (fun (a : α) => (f a).elim none fun (b : β) => Option.map (fun (c : γ) => (b, c)) (g a)) encA (encOption (encPair encB encC))

Pair two computed optional values, preserving the original input for both field machines.