2015-11-07 20:54:01 +00:00
|
|
|
-- Conditional congruence
|
|
|
|
import logic.connectives logic.quantifiers
|
|
|
|
|
2015-11-17 00:40:54 +00:00
|
|
|
-- TODO(dhs): either add this to the library or add a `ceqv` rule for
|
|
|
|
-- ¬ c ==> (¬ c ↔ true) in addition to (c ↔ false)
|
|
|
|
lemma not_workaround [simp] : ∀ (P : Prop), (P ↔ false) → (¬ P ↔ true) := sorry
|
|
|
|
|
2015-11-07 20:54:01 +00:00
|
|
|
namespace if_congr
|
|
|
|
constants {A : Type} {b c : Prop} (dec_b : decidable b) (dec_c : decidable c)
|
|
|
|
{x y u v : A} (h_c : b ↔ c) (h_t : x = u) (h_e : y = v)
|
|
|
|
|
2015-11-16 19:01:53 +00:00
|
|
|
attribute dec_b [instance]
|
2015-11-17 00:00:00 +00:00
|
|
|
attribute dec_c [instance]
|
|
|
|
attribute h_c [simp]
|
|
|
|
attribute h_t [simp]
|
|
|
|
attribute h_e [simp]
|
2015-11-07 20:54:01 +00:00
|
|
|
|
|
|
|
attribute if_congr [congr]
|
|
|
|
|
2015-11-17 00:00:00 +00:00
|
|
|
#simplify eq env 0 (ite b x y)
|
2015-11-07 20:54:01 +00:00
|
|
|
end if_congr
|
|
|
|
|
|
|
|
namespace if_ctx_simp_congr
|
|
|
|
constants {A : Type} {b c : Prop} (dec_b : decidable b)
|
|
|
|
{x y u v : A} (h_c : b ↔ c) (h_t : c → x = u) (h_e : ¬c → y = v)
|
|
|
|
|
2015-11-17 00:00:00 +00:00
|
|
|
attribute dec_b [instance]
|
|
|
|
attribute h_c [simp]
|
|
|
|
attribute h_t [simp]
|
|
|
|
attribute h_e [simp]
|
2015-11-07 20:54:01 +00:00
|
|
|
|
|
|
|
attribute if_ctx_simp_congr [congr]
|
2015-11-17 00:00:00 +00:00
|
|
|
|
|
|
|
#simplify eq env 0 (ite b x y)
|
2015-11-07 20:54:01 +00:00
|
|
|
|
|
|
|
end if_ctx_simp_congr
|
|
|
|
|
|
|
|
namespace if_congr_prop
|
|
|
|
constants {b c x y u v : Prop} (dec_b : decidable b) (dec_c : decidable c)
|
|
|
|
(h_c : b ↔ c) (h_t : c → (x ↔ u)) (h_e : ¬c → (y ↔ v))
|
|
|
|
|
2015-11-16 19:01:53 +00:00
|
|
|
attribute dec_b [instance]
|
|
|
|
attribute dec_c [instance]
|
|
|
|
attribute h_c [simp]
|
|
|
|
attribute h_t [simp]
|
|
|
|
attribute h_e [simp]
|
2015-11-07 20:54:01 +00:00
|
|
|
|
|
|
|
attribute if_congr_prop [congr]
|
|
|
|
|
2015-11-17 00:00:00 +00:00
|
|
|
#simplify iff env 0 (ite b x y)
|
2015-11-07 20:54:01 +00:00
|
|
|
end if_congr_prop
|
|
|
|
|
|
|
|
namespace if_ctx_simp_congr_prop
|
|
|
|
constants (b c x y u v : Prop) (dec_b : decidable b)
|
|
|
|
(h_c : b ↔ c) (h_t : c → (x ↔ u)) (h_e : ¬ c → (y ↔ v))
|
|
|
|
|
2015-11-16 19:01:53 +00:00
|
|
|
attribute dec_b [instance]
|
|
|
|
attribute h_c [simp]
|
|
|
|
attribute h_t [simp]
|
|
|
|
attribute h_e [simp]
|
2015-11-07 20:54:01 +00:00
|
|
|
|
|
|
|
attribute if_ctx_simp_congr_prop [congr]
|
2015-11-17 00:00:00 +00:00
|
|
|
#simplify iff env 0 (ite b x y)
|
2015-11-07 20:54:01 +00:00
|
|
|
|
|
|
|
end if_ctx_simp_congr_prop
|
|
|
|
|
|
|
|
namespace if_simp_congr_prop
|
|
|
|
constants (b c x y u v : Prop) (dec_b : decidable b)
|
|
|
|
(h_c : b ↔ c) (h_t : x ↔ u) (h_e : y ↔ v)
|
|
|
|
|
2015-11-16 19:01:53 +00:00
|
|
|
attribute dec_b [instance]
|
|
|
|
attribute h_c [simp]
|
|
|
|
attribute h_t [simp]
|
|
|
|
attribute h_e [simp]
|
2015-11-07 20:54:01 +00:00
|
|
|
|
|
|
|
attribute if_simp_congr_prop [congr]
|
2015-11-17 00:00:00 +00:00
|
|
|
#simplify iff env 0 (ite b x y)
|
2015-11-07 20:54:01 +00:00
|
|
|
end if_simp_congr_prop
|