Skip to content
Snippets Groups Projects
Commit df472e0d authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Replace some uses of `map_fold_weak_ind` with `map_fold_ind`.

parent 37a77700
No related branches found
No related tags found
1 merge request!566Stronger induction principle for `map_fold`.
...@@ -378,12 +378,11 @@ Proof. ...@@ -378,12 +378,11 @@ Proof.
intros Hnode t. intros Hnode t.
remember (gtest_size t) as n eqn:Hn. revert t Hn. remember (gtest_size t) as n eqn:Hn. revert t Hn.
induction (lt_wf n) as [n _ IH]; intros [ts] ->; simpl in *. induction (lt_wf n) as [n _ IH]; intros [ts] ->; simpl in *.
apply Hnode. revert ts IH. apply Hnode. induction ts as [|k t m ? Hfold IHm] using map_fold_ind.
apply (map_fold_weak_ind (λ r ts, ( n', n' < S r _) map_Forall (λ _, P) ts)). - apply map_Forall_empty.
- intros IH. apply map_Forall_empty. - apply map_Forall_insert; [done|]. split.
- intros k t m r ? IHm IHt. apply map_Forall_insert; [done|]. split. + eapply IH; [|done]. rewrite Hfold. lia.
+ eapply IHt; [|done]; lia. + eapply IHm. intros; eapply IH; [|done]. rewrite Hfold. lia.
+ eapply IHm. intros; eapply IHt;[|done]; lia.
Qed. Qed.
(** We show that [gtest K] is countable itself. This means that we can use (** We show that [gtest K] is countable itself. This means that we can use
...@@ -415,13 +414,11 @@ Global Program Instance gtest_countable `{Countable K} : Countable (gtest K) := ...@@ -415,13 +414,11 @@ Global Program Instance gtest_countable `{Countable K} : Countable (gtest K) :=
inj_countable' enc dec _. inj_countable' enc dec _.
Next Obligation. Next Obligation.
intros K ?? enc dec_list dec t. intros K ?? enc dec_list dec t.
induction (Nat.lt_wf_0_projected gtest_size t) as [[ts] _ IH]. induction (Nat.lt_wf_0_projected gtest_size t) as [[ts] _ IH]. f_equal/=.
simpl in *; f_equal. induction ts as [|i t ts ? Hfold IHts] using map_fold_ind; [done|].
revert ts IH. rewrite Hfold. f_equal/=.
apply (map_fold_weak_ind (λ r ts, _ dec_list dec r = ts)); [done|]. - eapply IH. rewrite map_fold_insert_L by auto with lia. lia.
intros i t ts r ? IHts IHt; simpl. f_equal. - apply IHts; intros t' ?. eapply IH.
- eapply IHt. rewrite map_fold_insert_L by auto with lia. lia.
- apply IHts; intros t' ?. eapply IHt.
rewrite map_fold_insert_L by auto with lia. lia. rewrite map_fold_insert_L by auto with lia. lia.
Qed. Qed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment