Zulip Chat Archive
Stream: Is there code for X?
Topic: ite.intro
Yaël Dillies (Oct 23 2021 at 19:45):
Do we not have any introduction rule for ite
and dite
?
Yury G. Kudryashov (Oct 23 2021 at 20:35):
What exactly are you looking for?
Kyle Miller (Oct 23 2021 at 20:43):
Usually ite
and dite
are just terms, not types, unless the cases are types themselves. Do you mean something like this?
lemma ite.if_true {p q r : Prop} [decidable p] (hp : p) (hq : q) : if p then q else r :=
decidable.rec_on_true hp hq
lemma ite.if_false {p q r : Prop} [decidable p] (hp : ¬p) (hq : r) : if p then q else r :=
decidable.rec_on_false hp hq
These are like constructors if ite
had been Prop
-valued and an inductive type:
inductive ite' (p q r : Prop) : Prop
| if_true : p → q → ite'
| if_false : ¬p → r → ite'
Yaël Dillies (Oct 23 2021 at 20:48):
Exactly what I meant was q → r → ite p q r
.
Johan Commelin (Oct 23 2021 at 21:00):
Wouldn't (p → q) → (¬p → r) → ite p q r
be more useful/general?
Yaël Dillies (Oct 23 2021 at 21:09):
Yup it would.
Yaël Dillies (Oct 23 2021 at 21:09):
The best would be to have both.
Yury G. Kudryashov (Oct 23 2021 at 22:29):
I can't find it. Feel free to PR both functions (and a dite
version of Johan's function).
Last updated: Dec 20 2023 at 11:08 UTC