Simplify the definition of algo_dom

This commit is contained in:
Yiyun Liu 2025-03-04 22:28:18 -05:00
parent 5087b8c6ce
commit a23be7f9b5

View file

@ -183,6 +183,10 @@ Inductive algo_dom : PTm -> PTm -> Prop :=
algo_dom_r c0 c1 -> algo_dom_r c0 c1 ->
algo_dom (PInd P0 u0 b0 c0) (PInd P1 u1 b1 c1) algo_dom (PInd P0 u0 b0 c0) (PInd P1 u1 b1 c1)
(* | A_Conf a b : *)
(* tm_conf a b -> *)
(* algo_dom a b *)
with algo_dom_r : PTm -> PTm -> Prop := with algo_dom_r : PTm -> PTm -> Prop :=
| A_NfNf a b : | A_NfNf a b :
algo_dom a b -> algo_dom a b ->
@ -195,19 +199,12 @@ with algo_dom_r : PTm -> PTm -> Prop :=
algo_dom_r a b algo_dom_r a b
| A_HRedR a b b' : | A_HRedR a b b' :
ishne a \/ ishf a -> HRed.nf a ->
HRed.R b b' -> HRed.R b b' ->
algo_dom_r a b' -> algo_dom_r a b' ->
(* ----------------------- *) (* ----------------------- *)
algo_dom_r a b. algo_dom_r a b.
Lemma algo_dom_hf_hne (a b : PTm) :
algo_dom a b ->
(ishf a \/ ishne a) /\ (ishf b \/ ishne b).
Proof.
induction 1 =>//=; hauto lq:on.
Qed.
Lemma hf_no_hred (a b : PTm) : Lemma hf_no_hred (a b : PTm) :
ishf a -> ishf a ->
HRed.R a b -> HRed.R a b ->
@ -220,6 +217,13 @@ Lemma hne_no_hred (a b : PTm) :
False. False.
Proof. elim : a b => //=; hauto l:on inv:HRed.R. Qed. Proof. elim : a b => //=; hauto l:on inv:HRed.R. Qed.
Lemma algo_dom_no_hred (a b : PTm) :
algo_dom a b ->
HRed.nf a /\ HRed.nf b.
Proof.
induction 1 =>//=; try hauto inv:HRed.R use:hne_no_hred, hf_no_hred lq:on unfold:HRed.nf.
Qed.
Derive Signature for algo_dom algo_dom_r. Derive Signature for algo_dom algo_dom_r.
Fixpoint hred (a : PTm) : option (PTm) := Fixpoint hred (a : PTm) : option (PTm) :=
@ -342,9 +346,7 @@ Defined.
Next Obligation. Next Obligation.
intros. intros.
destruct h. destruct h.
exfalso. apply algo_dom_hf_hne in H0. exfalso. sfirstorder use: algo_dom_no_hred.
destruct H0 as [h0 h1].
sfirstorder use:hf_no_hred, hne_no_hred.
exfalso. sfirstorder. exfalso. sfirstorder.
assert ( b' = b'0)by eauto using hred_deter. subst. assert ( b' = b'0)by eauto using hred_deter. subst.
apply h. apply h.
@ -353,7 +355,8 @@ Defined.
Next Obligation. Next Obligation.
simpl. intros. simpl. intros.
inversion h; subst =>//=. inversion h; subst =>//=.
move {h}. hauto lq:on use:algo_dom_hf_hne, hf_no_hred, hne_no_hred, hred_sound. exfalso. sfirstorder use:algo_dom_no_hred.
move {h}.
assert (a' = a'0) by eauto using hred_deter, hred_sound. by subst. assert (a' = a'0) by eauto using hred_deter, hred_sound. by subst.
exfalso. sfirstorder use:hne_no_hred, hf_no_hred. exfalso. sfirstorder use:hne_no_hred, hf_no_hred.
Defined. Defined.