Finish upgrading

This commit is contained in:
Yiyun Liu 2025-05-30 18:09:34 -04:00
parent fcdbee2a91
commit 60555037bc

View file

@ -211,7 +211,7 @@ Module Typing.
hauto lq:on inv:Level. hauto lq:on inv:Level.
Qed. Qed.
Lemma upgrading Φ Γ Δ a A : Lemma upgrading_liftable Φ Γ Δ a A :
Γ a ;; A -> Γ a ;; A ->
liftable Φ a -> liftable Φ a ->
ctx_fleq Φ Γ Δ -> ctx_fleq Φ Γ Δ ->
@ -236,4 +236,56 @@ Module Typing.
simpl. by constructor. simpl. by constructor.
Qed. Qed.
Definition or_lvl (a : bool) l :=
match l with
| Fixed => Fixed
| Floating => Floating (a || )
end.
Definition or_ctx (a : bool) : ctx -> ctx := map (fun '(,A) => (or_lvl a , A)).
Lemma or_fixed_ctx (Γ : ctx) :
fixed_ctx (or_ctx Γ) = fixed_ctx Γ.
Proof.
elim : Γ => //=.
- case => //=.
move => 0 _ Γ.
move => h0. f_equal => //.
destruct 0 => //=.
Qed.
Definition or_ctx_lookup 0 i Γ A :
lookup i Γ (, A) ->
lookup i (or_ctx 0 Γ) (or_lvl 0 , A).
Proof.
elim : Γ i A; sauto.
Qed.
Lemma upgrading Γ a A :
Γ a ;; A ->
or_ctx Γ a ;; A.
Proof.
move => h. elim : Γ a A /h.
- move => Γ i 0 A h hi.
move /(or_ctx_lookup ) in hi.
apply T_Var with (0 := or_lvl 0); eauto.
destruct 0, => //=.
- hauto lq:on ctrs:Wt.
- move => Γ a A B /= ha iha.
rewrite Bool.orb_diag in iha.
hauto lq:on ctrs:Wt.
- move => Γ 0 a b A B hb ihb ha iha hla.
econstructor; eauto.
+ apply : upgrading_liftable. apply ha. eauto. clear.
elim : Γ => //=.
* constructor.
* case => //= 0 A Γ h0.
destruct 0 => //=.
by constructor.
constructor => //.
clear. sauto lq:on.
+ by rewrite or_fixed_ctx.
- hauto lq:on ctrs:Wt.
Qed.
End Typing. End Typing.