Time- and resource-bounded runs of abstract machines

DefinitionOne iteration step with absorbing halted states#✓fully proved

One iteration, preserving a state once its output is available.

def next (step : State → State) (out : State → Option Output) (s : State) : State :=
  match out s with
  | some _ => s
  | none => step s
Used by 10

DefinitionResource-bounded active step#✓fully proved

An active step with a resource bound on its source.

def boundedStep (step : State → State) (out : State → Option Output)
    (measure : State → ℕ) (S : ℕ) (s t : State) : Prop :=
  out s = none ∧ measure s ≤ S ∧ t = step s
Used by 6

DefinitionOutput reachability within time and resource bounds#✓fully proved

Reach an output in at most T active steps, with every state bounded by S.

def ReachesOutput (step : State → State) (out : State → Option Output)
    (measure : State → ℕ) (s : State) (T S : ℕ) (b : Output) : Prop :=
  ∃ t, Relation.RelatesWithinSteps (boundedStep step out measure S) s t T ∧
    out t = some b ∧ measure t ≤ S
Uses 1 · Used by 9

DefinitionBounded run from an input's initial state#✓fully proved

Reach an output starting from an input's initial state.

def Runs (init : Input → State) (step : State → State) (out : State → Option Output)
    (measure : State → ℕ) (a : Input) (T S : ℕ) (b : Output) : Prop :=
  ReachesOutput step out measure (init a) T S b
Uses 1 · Used by 4

TheoremIterates of a halted state are constant#✓fully proved

Every iterate of an already halted state is that state.

theorem iterate_of_some (h : out s = some b) (n : ℕ) : (next step out)^[n] s = s
Uses 1 · Used by 3

TheoremA halted state reaches its output with any time budget#✓fully proved

A halted state reaches its output with any remaining time budget.

theorem ReachesOutput.halt (ho : out s = some b) (hs : measure s ≤ S) :
    ReachesOutput step out measure s T S b
Uses 2 · Used by 1

TheoremPrepending a bounded step to a successful computation#✓fully proved

Prepend an active bounded step to a successful computation.

theorem ReachesOutput.prepend (ho : out s = none) (hs : measure s ≤ S)
    (h : ReachesOutput step out measure (step s) T S b) :
    ReachesOutput step out measure s (T + 1) S b
Uses 2 · Used by 1

TheoremCanonical finite path to an output bounds all iterates#✓fully proved

A canonical finite path ending in an output has the source's all-iterate bounds.

theorem relatesInSteps_iterate {n : ℕ}
    (h : Relation.RelatesInSteps (boundedStep step out measure S) s t n)
    (ho : out t = some b) (hs : measure t ≤ S) :
    (∀ T, n ≤ T → out ((next step out)^[T] s) = some b) ∧
      ∀ k, measure ((next step out)^[k] s) ≤ S
Uses 3 · Used by 1

TheoremOutput reachability gives stable outputs and bounded iterates#✓fully proved

Reachability gives stable outputs after the budget and bounds every iterate.

theorem ReachesOutput.iterate (h : ReachesOutput step out measure s T S b) :
    (∀ U, T ≤ U → out ((next step out)^[U] s) = some b) ∧
      ∀ n, measure ((next step out)^[n] s) ≤ S
Uses 4 · Used by 3

TheoremOutput reachability from the iteration condition#✓fully proved

The source iteration condition constructs a canonical bounded path.

theorem reachesOutput_of_iterate
    (ho : out ((next step out)^[T] s) = some b)
    (hs : ∀ n, measure ((next step out)^[n] s) ≤ S) :
    ReachesOutput step out measure s T S b
Uses 5 · Used by 1

TheoremCharacterization of output reachability by iterates#✓fully proved

Exact source characterization, including bounds on all natural-number iterates.

theorem reachesOutput_iff_iterate :
    ReachesOutput step out measure s T S b ↔
      out ((next step out)^[T] s) = some b ∧
        ∀ n, measure ((next step out)^[n] s) ≤ S
Uses 4 · Used by 2

TheoremTerminal iterates are stable#✓fully proved

A terminal iterate remains unchanged at every later iteration count.

theorem iterate_stable (ho : out ((next step out)^[T] s) = some b)
    {U : ℕ} (hU : T ≤ U) : (next step out)^[U] s = (next step out)^[T] s
Uses 2 · Used by 1

TheoremOutput reachability via bounded iterates after halting#✓fully proved

Finite visited-state bounds are equivalent to all-iterate bounds after halting.

theorem reachesOutput_iff_bounded_iterate :
    ReachesOutput step out measure s T S b ↔
      out ((next step out)^[T] s) = some b ∧
        ∀ n ≤ T, measure ((next step out)^[n] s) ≤ S
Uses 4

TheoremMonotonicity of output reachability in the bounds#✓fully proved

Increasing either bound preserves reachability.

theorem ReachesOutput.mono {U R : ℕ} (h : ReachesOutput step out measure s T S b)
    (hT : T ≤ U) (hS : S ≤ R) : ReachesOutput step out measure s U R b
Uses 2 · Used by 1

TheoremUniqueness of reached outputs#✓fully proved

Output values reached from the same state are unique, regardless of bounds.

theorem ReachesOutput.unique {U R : ℕ} {c : Output}
    (h : ReachesOutput step out measure s T S b)
    (h' : ReachesOutput step out measure s U R c) : b = c
Uses 3 · Used by 1

DefinitionInput-initialized iteration with absorbing halting#✓fully proved

Iteration initialized by an input, with absorbing halting.

def run (init : Input → State) (step : State → State) (out : State → Option Output)
    (a : Input) (n : ℕ) : State := (next step out)^[n] (init a)
Uses 1 · Used by 2

TheoremCharacterization of bounded runs by initialized iteration#✓fully proved

The source Runs interface, stated using initialized iteration.

theorem runs_iff_iterate {init : Input → State} {a : Input} :
    Runs init step out measure a T S b ↔
      out (run init step out a T) = some b ∧
        ∀ n, measure (run init step out a n) ≤ S
Uses 3

TheoremThe output of a successful run persists#✓fully proved

The output of a successful initialized run is present at every later time.

theorem Runs.out_run {init : Input → State} {a : Input}
    (h : Runs init step out measure a T S b) {U : ℕ} (hU : T ≤ U) :
    out (run init step out a U) = some b
Uses 4

TheoremMonotonicity of bounded runs in time and resources#✓fully proved

Increasing time and resource bounds preserves initialized runs.

theorem Runs.mono {init : Input → State} {a : Input} {U R : ℕ}
    (h : Runs init step out measure a T S b) (hT : T ≤ U) (hS : S ≤ R) :
    Runs init step out measure a U R b
Uses 2

TheoremUniqueness of run outputs#✓fully proved

Initialized runs have unique outputs.

theorem Runs.unique {init : Input → State} {a : Input} {U R : ℕ} {c : Output}
    (h : Runs init step out measure a T S b)
    (h' : Runs init step out measure a U R c) : b = c
Uses 2
20 fully proved

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.