Skip to content

Commit 3eb32c3

Browse files
committed
[docs]: Reasoning behind if-cong lemmas
1 parent 038d641 commit 3eb32c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Data/Bool/Properties.agda

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,18 @@ if-xor false = refl
795795
if-xor true {false} = refl
796796
if-xor true {true } = refl
797797

798+
-- The following congruence lemmas are short hands for
799+
-- cong (if_then x else y)
800+
-- cong (if b then_else y)
801+
-- cong (if b then x else_)
802+
-- cong (if b then_else_)
803+
-- on the different sub-terms in an if_then_else_ expression.
804+
-- With these short hands, the branches x and y can be inferred
805+
-- automatically (i.e., they are implicit arguments) whereas
806+
-- the branches have to be spelled out explicitly when using cong.
807+
-- (Using underscores as in "cong (if b then _ else_)"
808+
-- unfortunately fails to resolve the omitted argument.)
809+
798810
if-cong : {b c} {x y : A} b ≡ c
799811
(if b then x else y) ≡ (if c then x else y)
800812
if-cong refl = refl

0 commit comments

Comments
 (0)