@@ -1351,6 +1351,31 @@ Proof.
13511351 by rewrite /insert take0 drop0 sub0n => _ /=; apply.
13521352Qed .
13531353
1354-
1354+ Theorem typed_term_is_snorm ctx t ty : typing ctx t ty -> SN t.
1355+ Proof .
1356+ move => H.
1357+ have {H}: typing (map some (map (odflt (tyvar 0)) ctx)) t ty
1358+ by move: H; apply ctxleq_preserves_typing;
1359+ elim: ctx {t ty} => // [[]] // ty ctx H; rewrite ctxleqE eqxx.
1360+ move: {ctx} (map _ ctx) => ctx.
1361+ have ->: (map some ctx) =
1362+ [seq Some x.2 | x <- zip (map var (iota 0 (size ctx))) ctx]
1363+ by elim: ctx 0 => //= {t ty} ty ctx IH n; rewrite -IH.
1364+ move => /reduce_lemma; move => /(_ (map some ctx) [::]) /= /(_ I).
1365+ rewrite unzip1_zip ?size_map ?size_iota ?leqnn; last by [].
1366+ have H: Forall
1367+ (fun c => reducible c.2 [::] (map some ctx) c.1)
1368+ (zip (map var (iota 0 (size ctx))) ctx)
1369+ by apply Forall_nth; case => {t ty} t ty n; rewrite
1370+ size_zip size_map size_iota minnn nth_map' (nth_map' (@fst _ _)) /=
1371+ -/unzip1 -/unzip2 unzip1_zip ?unzip2_zip ?size_map ?size_iota // => H;
1372+ rewrite (nth_map 0 t var) ?size_iota // nth_iota // add0n;
1373+ apply (CR4' (@reducibility_isrc (nth ty ctx n) [::] I)) => //=;
1374+ rewrite subst_nil_ty (nth_map ty).
1375+ move/(_ H) => {H} /(rc_cr1 (reducibility_isrc _ _)) /= /(_ I).
1376+ set f := subst_term _ _ _; set g := typemap _ _.
1377+ rewrite -/((fun t => f (g t)) t); apply acc_preservation => x y H.
1378+ by rewrite {}/f {}/g; apply subst_reduction1, substtyp_reduction1.
1379+ Qed .
13551380
13561381End strong_normalization_proof_typed.
0 commit comments