Section total_soundness.
Existing Instance unit_kMD.
Context {P: ProgrammingLanguage}
{iP: ImperativeProgrammingLanguage P}
{MD: Model}
{R: Relation model}
{po_R: PreOrder Krelation}
{BSS: BigStepSemantics P model}
{iBSS: ImpBigStepSemantics P model BSS}.
Context {L: Language}
{minL: MinimumLanguage L}
{pL: PropositionalLanguage L}
{sepconL: SepconLanguage L}
{wandL: WandLanguage L}
{SM: Semantics L MD}
{kiSM: KripkeIntuitionisticSemantics L MD tt SM}
{kminSM: KripkeMinimumSemantics L MD tt SM}
{kpSM: KripkePropositionalSemantics L MD tt SM}.

Lemma hoare_while_total_sound:
forall {A: Type} (R: A -> A -> Prop) (Wf: well_founded R) (EQ LE: A -> expr) (D: model -> A),
(forall s v, s |= EQ v <-> D s = v) ->
(forall s v, s |= LE v <-> R (D s) v) ->
(forall s1 s2, s1 <= s2 -> D s1 = D s2) ->
forall b c B P,
(forall s, s |= B <-> eval_bool s b) ->
(forall v, triple_total_valid (P && B && EQ v) c (P && LE v)) ->
triple_total_valid P (Swhile b c) (P && ~~ B).