@@ -243,13 +243,15 @@ Proof.
243243 destruct (singleton_list Helen) as [eelem He].
244244 subst.
245245 destruct i.
246- -- unfold poly_prod in Hpeq.
247- simpl; f_equal.
248- simpl in Hpeq.
249- apply Peq_head_eq in Hpeq.
250- (* Done, just dont wanna do manual math *)
251- admit.
252- -- easy.
246+ * unfold poly_prod in Hpeq.
247+ simpl; f_equal.
248+ simpl in Hpeq.
249+ apply Peq_head_eq in Hpeq.
250+ (* Why can't we use lca here? *)
251+ repeat rewrite Cplus_0_r in Hpeq.
252+ repeat rewrite Cmult_1_r in Hpeq.
253+ auto.
254+ * easy.
253255 - clear H.
254256 forward IHn. { lia. }
255257 destruct ds as [| d ds]; try easy.
@@ -281,10 +283,12 @@ Proof.
281283 destruct IHn as [f [Hperm Hpermeq] ].
282284
283285 exists (fun i =>
284- if i =? 0 then k else
285- let i' := f i in
286- if k <=? i' then i'
287- else (i' + 1)%nat).
286+ match i with
287+ | 0 => k
288+ | S i' =>
289+ let j := f i' in
290+ if j <? k then j else S j
291+ end).
288292
289293 (* need inverse of f0 *)
290294 split. { admit. }
@@ -295,8 +299,16 @@ Proof.
295299 subst.
296300 simpl.
297301 rewrite Hpermeq.
298- bdestruct (length e1 <=? f (S i'))%nat.
299- + Search lt.
300- Search nth_error.
301- Check nth_error_app1.
302- rewrite (nth_error_app2 e1 (d :: e2) H).
302+ bdestruct (f i' <? length e1)%nat.
303+ + do 2 rewrite (nth_error_app1 _ _ H); reflexivity.
304+ + replace (e1 ++ d :: e2) with ((e1 ++ [d]) ++ e2)
305+ by ( rewrite <- app_assoc; auto ).
306+ assert (Hsecond : (length (e1 ++ [d]) <= S (f i'))%nat).
307+ { rewrite app_length. simpl. lia. }
308+ rewrite (nth_error_app2 _ _ H).
309+ rewrite (nth_error_app2 _ _ Hsecond).
310+ rewrite app_length.
311+ simpl length.
312+ rewrite Nat.add_1_r.
313+ auto.
314+ Admitted .
0 commit comments