2014-07-19 19:09:47 +00:00
|
|
|
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
-- Author: Leonardo de Moura
|
|
|
|
import decidable tactic
|
|
|
|
using bit decidable tactic
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
definition ite (c : Prop) {H : decidable c} {A : Type} (t e : A) : A
|
2014-07-19 19:09:47 +00:00
|
|
|
:= rec H (assume Hc, t) (assume Hnc, e)
|
|
|
|
|
|
|
|
notation `if` c `then` t `else` e:45 := ite c t e
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
theorem if_pos {c : Prop} {H : decidable c} (Hc : c) {A : Type} (t e : A) : (if c then t else e) = t
|
2014-07-19 19:09:47 +00:00
|
|
|
:= decidable_rec
|
2014-07-21 01:40:43 +00:00
|
|
|
(assume Hc : c, refl (@ite c (inl Hc) A t e))
|
2014-07-19 19:09:47 +00:00
|
|
|
(assume Hnc : ¬c, absurd_elim (@ite c (inr Hnc) A t e = t) Hc Hnc)
|
|
|
|
H
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
theorem if_neg {c : Prop} {H : decidable c} (Hnc : ¬c) {A : Type} (t e : A) : (if c then t else e) = e
|
2014-07-19 19:09:47 +00:00
|
|
|
:= decidable_rec
|
|
|
|
(assume Hc : c, absurd_elim (@ite c (inl Hc) A t e = e) Hc Hnc)
|
2014-07-21 01:40:43 +00:00
|
|
|
(assume Hnc : ¬c, refl (@ite c (inr Hnc) A t e))
|
2014-07-19 19:09:47 +00:00
|
|
|
H
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
theorem if_t_t (c : Prop) {H : decidable c} {A : Type} (t : A) : (if c then t else t) = t
|
2014-07-19 19:09:47 +00:00
|
|
|
:= decidable_rec
|
2014-07-21 01:40:43 +00:00
|
|
|
(assume Hc : c, refl (@ite c (inl Hc) A t t))
|
|
|
|
(assume Hnc : ¬c, refl (@ite c (inr Hnc) A t t))
|
2014-07-19 19:09:47 +00:00
|
|
|
H
|
|
|
|
|
|
|
|
theorem if_true {A : Type} (t e : A) : (if true then t else e) = t
|
|
|
|
:= if_pos trivial t e
|
|
|
|
|
|
|
|
theorem if_false {A : Type} (t e : A) : (if false then t else e) = e
|
|
|
|
:= if_neg not_false_trivial t e
|