Finish prov_extract
This commit is contained in:
parent
919f1513ce
commit
a6fd48c009
1 changed files with 37 additions and 110 deletions
|
@ -1256,19 +1256,6 @@ Proof.
|
||||||
- hauto lq:on inv:ERed.R, prov ctrs:prov.
|
- hauto lq:on inv:ERed.R, prov ctrs:prov.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
(* Can consider combine prov and provU *)
|
|
||||||
Fixpoint prov {n} (h : Tm n) (a : Tm n) : Prop :=
|
|
||||||
match a with
|
|
||||||
| (TBind p0 A0 B0) => prov_bind p0 A0 B0 h
|
|
||||||
| (Abs a) => prov (ren_Tm shift h) a
|
|
||||||
| (App a b) => prov h a
|
|
||||||
| (Pair a b) => prov h a /\ prov h b
|
|
||||||
| (Proj p a) => prov h a
|
|
||||||
| Bot => False
|
|
||||||
| VarTm _ => False
|
|
||||||
| Univ i => prov_univ i h
|
|
||||||
end.
|
|
||||||
|
|
||||||
Fixpoint extract {n} (a : Tm n) : Tm n :=
|
Fixpoint extract {n} (a : Tm n) : Tm n :=
|
||||||
match a with
|
match a with
|
||||||
| TBind p A B => TBind p A B
|
| TBind p A B => TBind p A B
|
||||||
|
@ -1297,120 +1284,60 @@ Proof.
|
||||||
- sfirstorder.
|
- sfirstorder.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Lemma prov_bind_ren n m p (A : Tm n) B (ξ : fin n -> fin m) a :
|
Lemma ren_morphing n m (a : Tm n) (ρ : fin n -> Tm m) :
|
||||||
prov_bind p A B a ->
|
(forall i, ρ i = extract (ρ i)) ->
|
||||||
prov_bind p (ren_Tm ξ A) (ren_Tm (upRen_Tm_Tm ξ) B) (ren_Tm ξ a).
|
extract (subst_Tm ρ a) = subst_Tm ρ (extract a).
|
||||||
Proof.
|
Proof.
|
||||||
case : a => //=.
|
move : m ρ.
|
||||||
hauto l:on use:Pars.renaming.
|
elim : n /a => n //=.
|
||||||
Qed.
|
move => a ha m ρ hi.
|
||||||
|
rewrite ha.
|
||||||
Lemma prov_ren n m (ξ : fin n -> fin m) h a :
|
- destruct i as [i|] => //.
|
||||||
prov h a -> prov (ren_Tm ξ h) (ren_Tm ξ a).
|
rewrite ren_extract.
|
||||||
Proof.
|
rewrite -hi.
|
||||||
move : m ξ h. elim : n / a => //=.
|
|
||||||
- move => n a ih m ξ h.
|
|
||||||
move /ih => {ih}.
|
|
||||||
move /(_ _ (upRen_Tm_Tm ξ)) => /=.
|
|
||||||
move => h0.
|
|
||||||
suff : ren_Tm (upRen_Tm_Tm ξ) (ren_Tm shift h) = ren_Tm shift (ren_Tm ξ h) by move => <-.
|
|
||||||
clear.
|
|
||||||
case : h => * /=; by asimpl.
|
|
||||||
- hauto l:on.
|
|
||||||
- hauto l:on use:prov_bind_ren.
|
|
||||||
- hauto lq:on inv:Tm.
|
|
||||||
Qed.
|
|
||||||
|
|
||||||
Definition hfb {n} (a : Tm n) :=
|
|
||||||
match a with
|
|
||||||
| TBind _ _ _ => true
|
|
||||||
| Univ _ => true
|
|
||||||
| _ => false
|
|
||||||
end.
|
|
||||||
|
|
||||||
Lemma prov_morph n m (ρ : fin n -> Tm m) h a :
|
|
||||||
prov h a ->
|
|
||||||
hfb h ->
|
|
||||||
prov (subst_Tm ρ h) (subst_Tm ρ a).
|
|
||||||
Proof.
|
|
||||||
move : m ρ h. elim : n / a => //=.
|
|
||||||
- move => n a ih m ρ h + hb.
|
|
||||||
move /ih => {ih}.
|
|
||||||
move /(_ _ (up_Tm_Tm ρ) ltac:(hauto lq:on inv:Tm)).
|
|
||||||
by asimpl.
|
by asimpl.
|
||||||
- hauto q:on.
|
- by asimpl.
|
||||||
- move => n p A ihA B ihB m ρ h /=. move => //= + h0.
|
|
||||||
case : h h0 => //=.
|
|
||||||
move => p0 A0 B0 _ [? [h1 h2]]. subst.
|
|
||||||
hauto l:on use:Pars.substing.
|
|
||||||
- hauto l:on inv:Tm.
|
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Lemma ren_hfb {n m} (ξ : fin n -> fin m) u : hfb (ren_Tm ξ u) = hfb u.
|
Lemma ren_subst_bot n (a : Tm (S n)) :
|
||||||
Proof. move : m ξ. elim : n /u =>//=. Qed.
|
extract (subst_Tm (scons Bot VarTm) a) = subst_Tm (scons Bot VarTm) (extract a).
|
||||||
|
|
||||||
Hint Rewrite @ren_hfb : prov.
|
|
||||||
|
|
||||||
Lemma prov_par n (u : Tm n) a b : prov u a -> hfb u -> Par.R a b -> prov u b.
|
|
||||||
Proof.
|
Proof.
|
||||||
move => + + h. move : u.
|
apply ren_morphing. destruct i as [i|] => //=.
|
||||||
elim : n a b /h => //=.
|
|
||||||
- move => n a0 a1 b0 b1 ha iha hb ihb u /= h h0.
|
|
||||||
have h1 : hfb (ren_Tm shift u) by eauto using ren_hfb.
|
|
||||||
move /iha /(_ h1) : h.
|
|
||||||
move /(prov_morph _ _ (scons b1 VarTm)) /(_ h1).
|
|
||||||
by asimpl.
|
|
||||||
- hauto lq:on rew:db:prov.
|
|
||||||
- hauto lq:on rew:db:prov.
|
|
||||||
- hauto lq:on rew:db:prov.
|
|
||||||
- move => n a0 a1 ha iha A B. move /iha.
|
|
||||||
hauto l:on use:prov_ren.
|
|
||||||
- hauto l:on rew:db:prov.
|
|
||||||
- hauto lq:on rew:db:prov.
|
|
||||||
- hauto l:on rew:db:prov.
|
|
||||||
- move => n p A0 A1 B0 B1 hA ihA hB ihB u.
|
|
||||||
case : u => //=.
|
|
||||||
move => p0 A B [? [h2 h3]]. subst.
|
|
||||||
move => ?. repeat split => //=;
|
|
||||||
hauto l:on use:rtc_r rew:db:prov.
|
|
||||||
Qed.
|
|
||||||
|
|
||||||
Lemma prov_pars n (u : Tm n) a b : hfb u -> prov u a -> rtc Par.R a b -> prov u b.
|
|
||||||
Proof.
|
|
||||||
induction 3; hauto lq:on ctrs:rtc use:prov_par.
|
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Definition prov_extract_spec {n} u (a : Tm n) :=
|
Definition prov_extract_spec {n} u (a : Tm n) :=
|
||||||
match u with
|
match u with
|
||||||
| TBind p A B => exists A0 B0, extract a = TBind p A0 B0 /\ rtc Par.R A A0 /\ rtc Par.R B B0
|
| TBind p A B => exists A0 B0, extract a = TBind p A0 B0 /\ rtc Par.R A A0 /\ rtc Par.R B B0
|
||||||
| Univ i => extract a = Univ i
|
| Univ i => extract a = Univ i
|
||||||
|
| VarTm i => extract a = VarTm i
|
||||||
| _ => True
|
| _ => True
|
||||||
end.
|
end.
|
||||||
|
|
||||||
Lemma prov_extract n u (a : Tm n) :
|
Lemma prov_extract n u (a : Tm n) :
|
||||||
prov u a -> prov_extract_spec u a.
|
prov u a -> prov_extract_spec u a.
|
||||||
Proof.
|
Proof.
|
||||||
move : u. elim : n / a => //=.
|
move => h.
|
||||||
- move => n a ih [] //=.
|
elim : u a /h.
|
||||||
+ move => p A B /=.
|
- sfirstorder.
|
||||||
move /ih {ih}.
|
- move => h a ha ih.
|
||||||
simpl.
|
case : h ha ih => //=.
|
||||||
move => [A0[B0[h [h0 h1]]]].
|
+ move => i ha ih.
|
||||||
have : exists A1, rtc Par.R A A1 /\ ren_Tm shift A1 = A0
|
move /(_ Bot) in ih.
|
||||||
by hauto l:on use:Pars.antirenaming.
|
rewrite -ih.
|
||||||
move => [A1 [h3 h4]].
|
by rewrite ren_subst_bot.
|
||||||
have : exists B1, rtc Par.R B B1 /\ ren_Tm (upRen_Tm_Tm shift) B1 = B0
|
+ move => p A B h ih.
|
||||||
by hauto l:on use:Pars.antirenaming.
|
move /(_ Bot) : ih => [A0][B0][h0][h1]h2.
|
||||||
move => [B1 [h5 h6]].
|
rewrite ren_subst_bot in h0.
|
||||||
subst.
|
rewrite h0.
|
||||||
have {}h0 : subst_Tm (scons Bot VarTm) (extract a) =
|
eauto.
|
||||||
subst_Tm (scons Bot VarTm) (ren_Tm shift (TBind p A1 B1)) by sauto lq:on.
|
+ move => i h /(_ Bot).
|
||||||
move : h0. asimpl.
|
by rewrite ren_subst_bot => ->.
|
||||||
hauto lq:on.
|
- hauto lq:on.
|
||||||
+ hauto q:on.
|
- hauto lq:on.
|
||||||
- hauto lq:on rew:off inv:Tm rew:db:prov.
|
- hauto lq:on.
|
||||||
- hauto inv:Tm l:on rew:db:prov.
|
- sfirstorder.
|
||||||
- hauto l:on inv:Tm rew:db:prov.
|
- sfirstorder.
|
||||||
|
- sfirstorder.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Definition union {A : Type} (R0 R1 : A -> A -> Prop) a b :=
|
Definition union {A : Type} (R0 R1 : A -> A -> Prop) a b :=
|
||||||
|
|
Loading…
Add table
Reference in a new issue