Skip to content

Commit 0dec856

Browse files
committed
Maps: resolve beq_id_true_iff issues
Update beq_id_false_iff accordingly.
1 parent da5e89c commit 0dec856

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

src/Maps.lidr

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,29 @@ about strings:
8585
> syntax [p] "<->" [q] = iff {p} {q}
8686
>
8787

88-
\todo[inline]{Somehow this doesn't work if put under \idr{where} as usual}
89-
90-
> bto : (beq_id x y = True) -> x = y
91-
> bto {x=MkId n1} {y=MkId n2} prf with (decEq n1 n2)
92-
> bto Refl | (Yes eq) = cong {f=MkId} eq
93-
> bto prf | (No _) = absurd prf
94-
> bfro : (x = y) -> beq_id x y = True
95-
> bfro {x=MkId n1} {y=MkId n2} prf with (decEq n1 n2)
96-
> bfro _ | (Yes _) = Refl
97-
> bfro prf | (No contra) = absurd $ contra $ idInj prf
98-
> where
99-
> idInj : MkId x = MkId y -> x = y
100-
> idInj Refl = Refl
88+
\todo[inline]{Remove when a release with
89+
https://github.com/idris-lang/Idris-dev/pull/3925 happens}
90+
91+
> Uninhabited (False = True) where
92+
> uninhabited Refl impossible
93+
>
10194

10295
> beq_id_true_iff : (beq_id x y = True) <-> x = y
10396
> beq_id_true_iff = (bto, bfro)
97+
> where
98+
> bto : (beq_id x y = True) -> x = y
99+
> bto {x=MkId n1} {y=MkId n2} prf with (decEq n1 n2)
100+
> bto Refl | Yes eq = cong {f=MkId} eq
101+
> bto prf | No _ = absurd prf
102+
>
103+
> idInj : MkId x = MkId y -> x = y
104+
> idInj Refl = Refl
105+
>
106+
> bfro : (x = y) -> beq_id x y = True
107+
> bfro {x=MkId n1} {y=MkId n2} prf with (decEq n1 n2)
108+
> bfro _ | Yes _ = Refl
109+
> bfro prf | No contra = absurd $ contra $ idInj prf
110+
>
104111

105112
Similarly:
106113

@@ -117,11 +124,13 @@ for now}
117124
>
118125
> beq_id_false_iff : (beq_id x y = False) <-> Not (x = y)
119126
> beq_id_false_iff = (to, fro)
120-
> where
121-
> to : (beq_id x y = False) -> Not (x = y)
122-
> to beqf = not_true_and_false beqf . bfro
123-
> fro : (Not (x = y)) -> beq_id x y = False
124-
> fro noteq = not_true_is_false $ noteq . bto
127+
> where
128+
> to : (beq_id x y = False) -> Not (x = y)
129+
> to beqf = not_true_and_false beqf . (snd beq_id_true_iff)
130+
>
131+
> fro : (Not (x = y)) -> beq_id x y = False
132+
> fro noteq = not_true_is_false $ noteq . (fst beq_id_true_iff)
133+
>
125134

126135

127136
== Total Maps

0 commit comments

Comments
 (0)