(* ** Some Hoare Rules *)
From Undecidability Require Export TM.Compound.Multi TM.Combinators.Combinators.
From Undecidability.TM.Hoare Require Import HoareLogic HoareRegister.
(* *** Nop *)
(* A classic example for Hoare logic *)
(* *** [Relabel] *)
(* *** [Return] *)
(* *** Sequential Composition *)
(* *** Switch *)

(* Stronger version, where the running time depends on the output label of [pM1] *)
Lemma Switch_SpecT_strong (sig : finType) (n : nat) (F1 F2 : finType) (pM1 : pTM sig F1 n) (pM2 : F1 -> pTM sig F2 n)
(P : Assert sig n) (Q : F1 -> Assert sig n) (R : F2 -> Assert sig n)
(k k1 : nat) (k2 : F1 -> nat) :
TripleT P k1 pM1 Q ->
(forall (y : F1), TripleT (Q y) (k2 y) (pM2 y) R) ->
(forall tin yout tout, P tin -> Q yout tout -> 1 + k1 + k2 yout <= k) ->
TripleT P k (Switch pM1 pM2) R.