Skip to content

Commit 2459465

Browse files
committed
[stdlib]: iftrue / iffalse
Very simple lemmas that allow to reduce if-expression.
1 parent f8ce68b commit 2459465

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

theories/prelude/Logic.ec

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,16 @@ lemma if_same b (vT : 'a) :
376376
(if b then vT else vT) = vT
377377
by [].
378378

379+
(* -------------------------------------------------------------------- *)
380+
lemma iftrue ['a] (b : bool) (x y : 'a) :
381+
b => (if b then x else y) = x.
382+
proof. by move=> ->. qed.
383+
384+
lemma iffalse ['a] (b : bool) (x y : 'a) :
385+
!b => (if b then x else y) = y.
386+
proof. by move=> ->. qed.
387+
388+
(* -------------------------------------------------------------------- *)
379389
lemma if_neg b (vT vF : 'a) :
380390
(if !b then vT else vF) = if b then vF else vT
381391
by smt().

0 commit comments

Comments
 (0)