@@ -38,6 +38,7 @@ Definition atom `{wfl : WcbvFlags} Σ t :=
3838 | tBox
3939 | tCoFix _ _
4040 | tLambda _ _
41+ | tLazy _
4142 | tFix _ _ => true
4243 | tConstruct ind c [] => negb with_constructor_as_block && isSome (lookup_constructor Σ ind c)
4344 | _ => false
@@ -258,7 +259,7 @@ Section Wcbv.
258259 | eval_app_cong f f' a a' :
259260 eval f f' ->
260261 ~~ (isLambda f' || (if with_guarded_fix then isFixApp f' else isFix f') || isBox f' || isConstructApp f'
261- || isPrimApp f') ->
262+ || isPrimApp f' || isLazyApp f' ) ->
262263 eval a a' ->
263264 eval (tApp f a) (tApp f' a')
264265
@@ -272,13 +273,12 @@ Section Wcbv.
272273 eval_primitive eval p p' ->
273274 eval (tPrim p) (tPrim p')
274275
275- (*
276- | eval_lazy : eval (tLazy t) (tLazy t)
277- | eval_force t v v' : eval t (tLazy v) ->
276+ | eval_force t v v' :
277+ eval t (tLazy v) ->
278278 eval v v' ->
279- eval (tForce t) v' *)
279+ eval (tForce t) v'
280280
281- (** Atoms are values (includes abstractions, cofixpoints and constructors ) *)
281+ (** Atoms are values (includes abstractions, cofixpoints, constructors and lazy ) *)
282282 | eval_atom t : atom Σ t -> eval t t.
283283
284284 Hint Constructors eval : core.
@@ -615,7 +615,7 @@ Section eval_rect.
615615 isBox f'
616616 ||
617617 isConstructApp f'
618- || isPrimApp f'))
618+ || isPrimApp f' || isLazyApp f' ))
619619 (e0 : eval Σ a a'),
620620 P a a' e0
621621 → P (tApp f16 a)
@@ -626,14 +626,17 @@ Section eval_rect.
626626
627627 (forall p p' (ev : eval_primitive (eval Σ) p p'),
628628 eval_primitive_ind _ P _ _ ev ->
629- P (tPrim p) (tPrim p') (eval_prim _ _ _ ev))
629+ P (tPrim p) (tPrim p') (eval_prim _ _ _ ev)) ->
630+ (forall t t' v (ev1 : eval Σ t (tLazy t')) (ev2 : eval Σ t' v),
631+ P _ _ ev1 -> P _ _ ev2 ->
632+ P (tForce t) v (eval_force _ t t' v ev1 ev2))
630633
631- → (∀ (t : term) (i : atom Σ t),
634+ → (∀ (t : term) (i : atom Σ t),
632635 P t t (eval_atom Σ t i))
633636 → ∀ (t t0 : term) (e : eval Σ t t0),
634637 P t t0 e.
635638 Proof using Type .
636- intros ?????????????????????? H.
639+ intros ??????????????????????? H.
637640 revert t t0 H.
638641 fix aux 3.
639642 move aux at top.
@@ -785,6 +788,7 @@ Section Wcbv.
785788 + destruct with_guarded_fix.
786789 now cbn in i1. now cbn in i1.
787790 + constructor.
791+ + now destruct with_guarded_fix; cbn in i1.
788792 + cbn in i. destruct with_guarded_fix; cbn in i; rtoProp; intuition auto.
789793 * destruct b0 as (ind & c & mdecl & idecl & cdecl & args & [H1 H2 H3 H4]).
790794 rewrite -[tApp _ _](mkApps_app _ (firstn n l) [a']).
@@ -1058,7 +1062,7 @@ Section Wcbv.
10581062 rewrite !mkApps_app /=.
10591063 eapply eval_app_cong; tea.
10601064 eapply IHargs => //.
1061- rewrite isFixApp_mkApps // /= isConstructApp_mkApps // !negb_or isPrimApp_mkApps.
1065+ rewrite isFixApp_mkApps // /= isConstructApp_mkApps // !negb_or isPrimApp_mkApps isLazyApp_mkApps .
10621066 rtoProp; intuition auto.
10631067 apply nisLambda_mkApps => //.
10641068 destruct with_guarded_fix => //; eapply nisFix_mkApps => //.
@@ -1304,15 +1308,15 @@ Section Wcbv.
13041308 cbn in i. rtoProp; intuition auto.
13051309 + exfalso. rewrite !negb_or in i. specialize (IHev1 _ ev'1); noconf IHev1.
13061310 cbn in i. rewrite guarded in i. rtoProp; intuition auto.
1307- rewrite isFixApp_mkApps in H3 => //.
1311+ rewrite isFixApp_mkApps in H4 => //.
13081312 + exfalso. rewrite !negb_or in i. specialize (IHev1 _ ev'1); noconf IHev1.
13091313 cbn in i. rewrite guarded in i. rtoProp; intuition auto.
1310- rewrite isFixApp_mkApps in H3 => //.
1314+ rewrite isFixApp_mkApps in H4 => //.
13111315 + exfalso. rewrite !negb_or in i. specialize (IHev1 _ ev'1); noconf IHev1.
13121316 cbn in i. rewrite unguarded in i. now cbn in i.
13131317 + exfalso. rewrite !negb_or in i. specialize (IHev1 _ ev'1); noconf IHev1.
13141318 cbn in i. rtoProp; intuition auto.
1315- now rewrite isConstructApp_mkApps in H1 .
1319+ now rewrite isConstructApp_mkApps in H2 .
13161320 + specialize (IHev1 _ ev'1); noconf IHev1.
13171321 specialize (IHev2 _ ev'2); noconf IHev2.
13181322 now assert (i0 = i) as -> by now apply uip.
@@ -1329,6 +1333,7 @@ Section Wcbv.
13291333 induction ev in a, ev0 |- *; depelim ev0; eauto.
13301334 destruct a.
13311335 f_equal; eauto. specialize (e0 _ e). now noconf e0.
1336+ - depelim ev'; go.
13321337 - depelim ev'; try go.
13331338 2: now assert (i0 = i) as -> by now apply uip.
13341339 exfalso. invs i. rewrite e in H0. destruct args; cbn in H0; invs H0.
0 commit comments