Skip to content

Commit a88fd63

Browse files
committed
a bit of cleanup to SumN
1 parent 5541581 commit a88fd63

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

theories/Data/SumN.v

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Require Import ExtLib.Data.Map.FMapPositive.
2+
Require Import ExtLib.Data.Eq.
23
Require Import ExtLib.Tactics.Injection.
34

45
Fixpoint pmap_lookup' (ts : pmap Type) (p : positive) : option Type :=
@@ -67,10 +68,24 @@ Definition OutOf {ts} {T : Type} (n : positive)
6768
| eq_refl => @asNth ts n
6869
end.
6970

70-
Theorem OutOf_Into : forall ts T p pf v,
71-
@OutOf ts T p pf (@Into ts T p pf v) = Some v.
71+
Lemma asNth'_get_lookup : forall p ts v, asNth' (ts:=ts) p p v = Some v.
7272
Proof.
73-
Admitted.
73+
induction p; simpl; intros; auto.
74+
Qed.
75+
76+
Theorem Outof_Into : forall ts T p pf v,
77+
@OutOf ts T p pf (@Into ts T p pf v) = Some v.
78+
Proof using.
79+
unfold OutOf, Into.
80+
intros.
81+
repeat rewrite (eq_Arr_eq pf).
82+
repeat rewrite (eq_Const_eq pf).
83+
repeat rewrite (eq_Const_eq (eq_sym pf)).
84+
unfold asNth. simpl.
85+
rewrite asNth'_get_lookup.
86+
{ generalize dependent (pmap_lookup' ts p).
87+
intros. subst. reflexivity. }
88+
Qed.
7489

7590
Theorem asNth_eq
7691
: forall ts p oe v,

0 commit comments

Comments
 (0)