Skip to content

Commit c28539b

Browse files
author
Alex Gryzlov
committed
first draft of Maps
1 parent 3c5596f commit c28539b

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

src/Maps.lidr

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ the functional extensionality axiom, which is discussed in the `Logic` chapter.)
187187

188188
First, the empty map returns its default element for all keys:
189189

190-
> t_apply_empty: t_empty v x = v
190+
> t_apply_empty : t_empty v x = v
191191
> t_apply_empty = ?t_apply_empty_rhs
192192

193193
$\square$
@@ -212,7 +212,7 @@ a different key \idr{x2} in the resulting map, we get the same result that
212212
\idr{m} would have given:
213213

214214
> t_update_neq : Not (x1 = x2) -> (t_update x1 v m) x2 = m x2
215-
> t_update_neq x = ?t_update_neq_rhs
215+
> t_update_neq neq = ?t_update_neq_rhs
216216

217217
$\square$
218218

@@ -276,7 +276,7 @@ we do the updates.
276276

277277
> t_update_permute : Not (x2 = x1) -> t_update x1 v1 $ t_update x2 v2 m
278278
> = t_update x2 v2 $ t_update x1 v1 m
279-
> t_update_permute x = ?t_update_permute_rhs
279+
> t_update_permute neq = ?t_update_permute_rhs
280280

281281
$\square$
282282

@@ -302,20 +302,29 @@ partial maps.
302302
> apply_empty : empty {a} x = Nothing {a}
303303
> apply_empty = Refl
304304

305-
\todo[inline]{Finish}
306-
307305
> update_eq : (update x v m) x = Just v
308-
> update_eq = ?update_eq_rhs
306+
> update_eq {x} {v} {m} =
307+
> rewrite t_update_eq {x} {v=Just v} {m} in
308+
> Refl
309309

310310
> update_neq : Not (x2 = x1) -> (update x2 v m) x1 = m x1
311-
> update_neq x = ?update_neq_rhs
311+
> update_neq {x1} {x2} {v} {m} neq =
312+
> rewrite t_update_neq neq {x1=x2} {x2=x1} {v=Just v} {m} in
313+
> Refl
312314

313315
> update_shadow : update x v2 $ update x v1 m = update x v2 m
314-
> update_shadow = ?update_shadow_rhs
316+
> update_shadow {x} {v1} {v2} {m} =
317+
> rewrite t_update_shadow {x} {v1=Just v1} {v2=Just v2} {m} in
318+
> Refl
315319

316320
> update_same : m x = Just v -> update x v m = m
317-
> update_same prf = ?update_same_rhs
321+
> update_same {x} {m} {v} prf =
322+
> rewrite sym prf in
323+
> rewrite t_update_same {x} {m} in
324+
> Refl
318325

319326
> update_permute : Not (x2 = x1) -> update x1 v1 $ update x2 v2 m
320327
> = update x2 v2 $ update x1 v1 m
321-
> update_permute x = ?update_permute_rhs
328+
> update_permute {x1} {x2} {v1} {v2} {m} neq =
329+
> rewrite t_update_permute neq {x1} {x2} {v1=Just v1} {v2=Just v2} {m} in
330+
> Refl

0 commit comments

Comments
 (0)