Skip to content

Commit f7a345a

Browse files
committed
Formalization of Girard\'s SN proof is completed
1 parent 3c645ab commit f7a345a

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

README.mkd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# A Formalization of Typed and Untyped λ-Calculus in SSReflect-Coq and Agda2
22

3-
By Kazuhiko Sakaguchi, Nov. 2011 - July 2014.
3+
By Kazuhiko Sakaguchi, Nov. 2011 - Aug. 2014.
44

55
This is a formalization of the λ-calculus written in SSReflect-Coq and Agda2, and it contains the following definitions and theorems:
66

@@ -12,11 +12,12 @@ This is a formalization of the λ-calculus written in SSReflect-Coq and Agda2, a
1212
* Subject reduction (type preservation) theorem
1313
* Strong normalization theorem
1414
* Using a type-free version of the reducibility predicate
15-
* Using a typed version of the reducibility predicate (depends on a part of the subject reduction proof)
15+
* Using a typed version of the reducibility predicate
1616
* System F (second order typed lambda calculus): coq/LC/Debruijn/F.v
1717
* Subject reduction (type preservation) theorem
1818
* Strong normalization theorem
1919
* Using a type-free version of the reducibility candidates
20+
* Using a typed version of the reducibility candidates (Girard's original proof)
2021

2122
## References
2223

coq/LC/Debruijn/F.v

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,31 @@ Proof.
13511351
by rewrite /insert take0 drop0 sub0n => _ /=; apply.
13521352
Qed.
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

13561381
End strong_normalization_proof_typed.

0 commit comments

Comments
 (0)