End partial_soundness.
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: MinimunLanguage L} {pL: PropositionalLanguage L} {SL: SeparationLanguage L} {SM: Semantics L MD} {kiSM: KripkeIntuitionisticSemantics L MD tt SM} {kminSM: KripkeMinimunSemantics L MD tt SM} {kpSM: KripkePropositionalSemantics L MD tt SM}.

(* Specifications: *)
Lemma hoare_seq_total_sound: forall c1 c2 P1 P2 P3,
triple_total_valid P1 c1 P2 ->
triple_total_valid P2 c2 P3 ->
triple_total_valid P1 (Ssequence c1 c2) P3.
Lemma hoare_if_total_sound: forall b c1 c2 B P1 P2,
(forall s, s |= B <-> eval_bool s b) ->
triple_total_valid (P1 && B) c1 P2 ->
triple_total_valid (P1 && ~~ B) c2 P2 ->
triple_total_valid P1 (Sifthenelse b c1 c2) P2.
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).