Skip to content

Commit cde1454

Browse files
authored
Merge pull request #948 from MetaCoq/consistency-makes-us-of-canonicity
consistency makes use of canonicity
2 parents c098091 + 2b710a4 commit cde1454

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

pcuic/theories/PCUICCanonicity.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ From MetaCoq.PCUIC Require Import PCUICTyping PCUICEquality PCUICAst PCUICAstUti
2020
Lemma pcuic_canonicity {cf:checker_flags} {nor : normalizing_flags} Σ {normalization_in: NormalizationIn Σ} t i u args :
2121
axiom_free Σ -> wf Σ ->
2222
Σ ;;; [] |- t : mkApps (tInd i u) args ->
23-
{ t':term & (Σ ;;; [] |- t =s t') * construct_cofix_discr (head t')}.
23+
{ t':term & (Σ ;;; [] |- t' : mkApps (tInd i u) args) * (Σ ;;; [] |- t =s t') * construct_cofix_discr (head t')}.
2424
Proof.
2525
intros axΣ wfΣ typ_ind. pose proof (_ ; typ_ind) as wt.
2626
eapply wh_normalization in wt ; eauto.
@@ -29,7 +29,7 @@ Proof.
2929
pose proof (typ_ind' := typ_ind).
3030
eapply subject_reduction in typ_ind; eauto.
3131
eapply whnf_classification with (args := args) in typ_ind as ctor; auto.
32-
exists t'; split; eauto.
32+
exists t'; repeat split; eauto.
3333
eapply cumulAlgo_cumulSpec.
3434
eapply red_ws_cumul_pb. split; eauto.
3535
now eapply subject_is_open_term.

pcuic/theories/PCUICConsistency.v

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ From MetaCoq.PCUIC Require Import PCUICTyping PCUICEquality PCUICAst PCUICAstUti
1515
PCUICParallelReductionConfluence
1616
PCUICWcbvEval PCUICClosed PCUICClosedTyp
1717
PCUICReduction PCUICCSubst PCUICOnFreeVars PCUICWellScopedCumulativity
18-
PCUICWcbvEval PCUICClassification PCUICSN PCUICNormalization PCUICViews.
18+
PCUICWcbvEval PCUICClassification PCUICCanonicity PCUICSN PCUICNormalization PCUICViews.
1919

2020
From Equations Require Import Equations.
2121

@@ -46,28 +46,23 @@ Theorem pcuic_consistent {cf:checker_flags} {nor : normalizing_flags} Σ
4646
Σ ;;; [] |- t : tInd False_pcuic [] -> False.
4747
Proof.
4848
intros Hdecl wfΣ axΣ typ_false.
49-
pose proof (_ ; typ_false) as wt.
49+
destruct (pcuic_canonicity Σ t False_pcuic [] []) as [t' [[typ_false' eqtt'] ctor]]; eauto.
5050
destruct Hdecl as [Hdecl Hidecl].
5151
destruct False_pcuic as [kn n]. destruct n; cbn in *; [| now rewrite nth_error_nil in Hidecl].
52-
eapply wh_normalization in wt ; eauto. destruct wt as [empty [Hnormal Hempty]].
53-
pose proof (Hempty_ := Hempty).
54-
eapply subject_reduction in typ_false; eauto.
55-
eapply ind_whnf_classification with (indargs := []) in typ_false as ctor; auto.
56-
- unfold isConstruct_app in ctor.
57-
destruct decompose_app eqn:decomp.
58-
apply decompose_app_inv in decomp.
59-
rewrite decomp in typ_false.
60-
destruct t0; try discriminate ctor.
61-
apply PCUICValidity.inversion_mkApps in typ_false as H; auto.
52+
rewrite /construct_cofix_discr /head in ctor.
53+
destruct decompose_app eqn:decomp.
54+
apply decompose_app_inv in decomp; subst.
55+
destruct t0; try discriminate ctor.
56+
- apply PCUICValidity.inversion_mkApps in typ_false' as H; auto.
6257
destruct H as (?&typ_ctor&_).
6358
apply inversion_Construct in typ_ctor as (?&?&?&?&?&?&?); auto.
64-
eapply Construct_Ind_ind_eq with (args' := []) in typ_false; tea.
59+
eapply Construct_Ind_ind_eq with (args' := []) in typ_false'; tea.
6560
2: eauto.
6661
destruct (on_declared_constructor d).
6762
destruct p.
6863
destruct s.
6964
destruct p.
70-
destruct typ_false as (((((->&_)&_)&_)&_)&_).
65+
destruct typ_false' as (((((->&_)&_)&_)&_)&_).
7166
clear -Hdecl d wfΣ. destruct wfΣ.
7267
cbn in *.
7368
destruct d as ((?&?)&?).
@@ -77,7 +72,9 @@ Proof.
7772
cbn in H0. noconf H0.
7873
cbn in H1. rewrite nth_error_nil in H1.
7974
discriminate.
80-
- unfold notCoInductive, check_recursivity_kind. destruct wfΣ.
75+
- eapply @typing_cofix_coind with (indargs := []) in typ_false'; eauto.
76+
unfold check_recursivity_kind in typ_false'. destruct wfΣ.
8177
unshelve eapply declared_minductive_to_gen in Hdecl; eauto.
82-
red in Hdecl. cbn. rewrite Hdecl; cbn. auto.
78+
red in Hdecl. rewrite Hdecl in typ_false'.
79+
cbn in typ_false'. inversion typ_false'.
8380
Qed.

0 commit comments

Comments
 (0)