Proposition exp_partial_setoid_eq_trans {Γ : ty H} {Δ : form Γ} {f g h : tm Γ (ℙ (X ×h Y))} (p : Δ ⊢ exp_partial_setoid_eq [ ⟨ f , g ⟩ ]) (q : Δ ⊢ exp_partial_setoid_eq [ ⟨ g , h ⟩ ]) : Δ ⊢ exp_partial_setoid_eq [ ⟨ f , h ⟩ ]. Proof. refine (weaken_cut p _). unfold exp_partial_setoid_eq. simplify_form. do 2 use forall_intro. simplify. pose (γ := π₁ (π₁ (tm_var ((Γ ×h X) ×h Y)))). pose (x := π₂ (π₁ (tm_var ((Γ ×h X) ×h Y)))). pose (y := π₂ (tm_var ((Γ ×h X) ×h Y))). fold γ x y. use hyp_sym. simple refine (weaken_cut (weaken_left (forall_elim (hyperdoctrine_hyp _) x) _) _). use hyp_ltrans. use weaken_right. simplify_form. use hyp_sym. simple refine (weaken_cut (weaken_left (forall_elim (hyperdoctrine_hyp _) y) _) _). use hyp_ltrans. use weaken_right. simplify. use (iff_trans (weaken_right (hyperdoctrine_hyp _) _)). use weaken_left. refine (hyperdoctrine_cut (hyperdoctrine_proof_subst _ q) _). unfold exp_partial_setoid_eq. simplify. simple refine (hyperdoctrine_cut (forall_elim (hyperdoctrine_hyp _) x) _). simplify_form. simple refine (hyperdoctrine_cut (forall_elim (hyperdoctrine_hyp _) y) _). simplify. apply hyperdoctrine_hyp. 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.Tripos. Require Import UniMath.CategoryTheory.Hyperdoctrines.GenericPredicate. Require Import UniMath.CategoryTheory.Hyperdoctrines.PartialEqRels.PERs. Require Import UniMath.CategoryTheory.Hyperdoctrines.PartialEqRels.PERMorphisms.