Skip to content

Commit

Permalink
Add a neutral inversion lemma for type well-formedness and use it.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppedrot committed Sep 12, 2023
1 parent 3b197fe commit 735a6c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 2 additions & 4 deletions theories/BundledAlgorithmicTyping.v
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,12 @@ Section BundledConv.
assert [Γ |-[de] M : U].
{
eapply algo_conv_wh in Hconv as [neM neN].
inversion HM ; subst ; clear HM.
all: solve [now inversion neM| assumption].
now eapply neutral_ty_inv.
}
assert [Γ |-[de] N : U].
{
eapply algo_conv_wh in Hconv as [neM neN].
inversion HN ; subst ; clear HN.
all: solve [now inversion neN| assumption].
now eapply neutral_ty_inv.
}
assert (well_typed (ta := de) Γ M) by now eexists.
assert (well_typed (ta := de) Γ N) by now eexists.
Expand Down
3 changes: 1 addition & 2 deletions theories/Decidability/Termination.v
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ Proof.
split.
2: intros [|] ; cbn ; easy.
eapply (IHM tt A) ; tea.
inversion Hty ; subst ; tea.
1-6: inv_whne.
apply neutral_ty_inv in Hty; [|tea].
now exists U.
- intros * ???? ? ? wu' ?.
apply compute_domain.
Expand Down
12 changes: 12 additions & 0 deletions theories/TypeConstructorsInj.v
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,18 @@ Proof.
* prod_splitter; tea; right; now eapply TypeTrans.
Qed.

Lemma neutral_ty_inv Γ A :
[Γ |- A] -> whne A -> [Γ |- A : U].
Proof.
intros Hty Hne.
unshelve eapply TypeRefl, ty_conv_inj in Hty.
- now constructor.
- now constructor.
- cbn in *.
apply Fundamental in Hty; destruct Hty.
now eapply escapeTm.
Qed.

Lemma prod_ty_inv Γ A B :
[Γ |- tProd A B] ->
[Γ |- A] × [Γ,, A |- B].
Expand Down

0 comments on commit 735a6c7

Please sign in to comment.