feat(library/standard/if): cleanup 'if-then-else' theorems

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-07-21 02:40:43 +01:00
parent ba9dd8b686
commit 293ed333c7

View file

@ -11,20 +11,20 @@ notation `if` c `then` t `else` e:45 := ite c t e
theorem if_pos {c : Bool} {H : decidable c} (Hc : c) {A : Type} (t e : A) : (if c then t else e) = t
:= decidable_rec
(assume Hc : c, calc (@ite c (inl Hc) A t e) = t : refl _)
(assume Hc : c, refl (@ite c (inl Hc) A t e))
(assume Hnc : ¬c, absurd_elim (@ite c (inr Hnc) A t e = t) Hc Hnc)
H
theorem if_neg {c : Bool} {H : decidable c} (Hnc : ¬c) {A : Type} (t e : A) : (if c then t else e) = e
:= decidable_rec
(assume Hc : c, absurd_elim (@ite c (inl Hc) A t e = e) Hc Hnc)
(assume Hnc : ¬c, calc (@ite c (inr Hnc) A t e) = e : refl _)
(assume Hnc : ¬c, refl (@ite c (inr Hnc) A t e))
H
theorem if_t_t (c : Bool) {H : decidable c} {A : Type} (t : A) : (@ite c H A t t) = t -- check why '(if c then t else t) = t' fails
theorem if_t_t (c : Bool) {H : decidable c} {A : Type} (t : A) : (if c then t else t) = t
:= decidable_rec
(assume Hc : c, calc (@ite c (inl Hc) A t t) = t : refl _)
(assume Hnc : ¬c, calc (@ite c (inr Hnc) A t t) = t : refl _)
(assume Hc : c, refl (@ite c (inl Hc) A t t))
(assume Hnc : ¬c, refl (@ite c (inr Hnc) A t t))
H
theorem if_true {A : Type} (t e : A) : (if true then t else e) = t