Proposition partial_setoid_mor_unique_im (φ : partial_setoid_morphism) {Γ : ty H} {Δ : form Γ} {x : tm Γ X} {y₁ y₂ : tm Γ Y} (p₁ : Δ ⊢ φ [ ⟨ x , y₁ ⟩ ]) (p₂ : Δ ⊢ φ [ ⟨ x , y₂ ⟩ ]) : Δ ⊢ y₁ ~ y₂. Proof. pose (r := pr12 (pr222 φ)). unfold partial_setoid_mor_unique_im_law in r ; cbn in r. pose (x' := π₂ (π₁ (π₁ (tm_var (((𝟙 ×h X) ×h Y) ×h Y))))). pose (y₁' := π₂ (π₁ (tm_var (((𝟙 ×h X) ×h Y) ×h Y)))). pose (y₂' := π₂ (tm_var (((𝟙 ×h X) ×h Y) ×h Y))). fold x' y₁' y₂' in r. pose proof (hyperdoctrine_proof_subst (!! : tm Γ 𝟙) r) as r'. clear r. rename r' into r. rewrite truth_subst in r. rewrite !forall_subst in r. rewrite !impl_subst in r. rewrite partial_setoid_subst in r. rewrite !hyperdoctrine_comp_subst in r. rewrite !hyperdoctrine_pair_subst in r. rewrite !hyperdoctrine_unit_tm_subst in r. rewrite !hyperdoctrine_pr2_subst in r. rewrite !var_tm_subst in r. rewrite !hyperdoctrine_pr1_subst in r. rewrite !var_tm_subst in r. unfold x', y₁', y₂' in r ; clear x' y₁' y₂'. rewrite !hyperdoctrine_pr2_subst in r. rewrite !hyperdoctrine_pr1_subst in r. rewrite !var_tm_subst in r. rewrite !hyperdoctrine_pair_pr1 in r. rewrite !hyperdoctrine_pair_pr2 in r. pose (x' := π₂ (π₁ (π₁ (tm_var (((Γ ×h X) ×h Y) ×h Y))))). pose (y₁' := π₂ (π₁ (tm_var (((Γ ×h X) ×h Y) ×h Y)))). pose (y₂' := π₂ (tm_var (((Γ ×h X) ×h Y) ×h Y))). fold x' y₁' y₂' in r. pose proof (forall_elim r x) as r'. clear r. rename r' into r. rewrite !forall_subst in r. rewrite !impl_subst in r. rewrite partial_setoid_subst in r. rewrite !hyperdoctrine_comp_subst in r. rewrite !hyperdoctrine_pair_subst in r. rewrite !hyperdoctrine_pr2_subst in r. rewrite !var_tm_subst in r. rewrite !hyperdoctrine_pr1_subst in r. rewrite !var_tm_subst in r. rewrite !tm_subst_comp in r. rewrite !hyperdoctrine_pr1_subst in r. rewrite !var_tm_subst in r. unfold x', y₁', y₂' in r ; clear x' y₁' y₂'. rewrite !hyperdoctrine_pr2_subst in r. rewrite !hyperdoctrine_pr1_subst in r. rewrite !var_tm_subst in r. rewrite !hyperdoctrine_pair_pr1 in r. rewrite !hyperdoctrine_pair_pr2 in r. pose proof (forall_elim r y₁) as r'. clear r. rename r' into r. rewrite !forall_subst in r. rewrite !impl_subst in r. rewrite partial_setoid_subst in r. rewrite !hyperdoctrine_comp_subst in r. rewrite !hyperdoctrine_pair_subst in r. rewrite !hyperdoctrine_pr2_subst in r. rewrite !var_tm_subst in r. rewrite !hyperdoctrine_pr1_subst in r. rewrite !var_tm_subst in r. rewrite !tm_subst_comp in r. rewrite !hyperdoctrine_pr1_subst in r. rewrite !var_tm_subst in r. rewrite !hyperdoctrine_pair_pr1 in r. rewrite !hyperdoctrine_pair_pr2 in r. pose proof (forall_elim r y₂) as r'. clear r. rename r' into r. rewrite !impl_subst in r. rewrite partial_setoid_subst in r. rewrite !hyperdoctrine_comp_subst in r. rewrite !hyperdoctrine_pair_subst in r. rewrite !hyperdoctrine_pr2_subst in r. rewrite !var_tm_subst in r. rewrite !tm_subst_comp in r. rewrite !hyperdoctrine_pr1_subst in r. rewrite !var_tm_subst in r. rewrite !hyperdoctrine_pair_pr1 in r. rewrite !hyperdoctrine_pair_pr2 in r. rewrite !tm_subst_var in r. pose proof (weaken_to_empty r : Δ ⊢ _) as r'. clear r. rename r' into r. pose proof (impl_elim p₁ r) as r'. clear r. rename r' into r. exact (impl_elim p₂ r). Qed.
Require Import UniMath.MoreFoundations.All. Require Import UniMath.CategoryTheory.Core.Prelude. Require Import UniMath.CategoryTheory.Hyperdoctrines.Hyperdoctrine. Require Import UniMath.CategoryTheory.Hyperdoctrines.FirstOrderHyperdoctrine. Require Import UniMath.CategoryTheory.Hyperdoctrines.PartialEqRels.PERs.