Library UniMath.CategoryTheory.Hyperdoctrines.PartialEqRels.Logic.Disjunction

1. The formula

    Proposition per_subobject_disj_laws
      : per_subobject_laws (ψ ψ).
    Proof.
      split.
      - use forall_intro.
        use impl_intro.
        use weaken_right.
        hypersimplify.
        use (disj_elim (hyperdoctrine_hyp _)).
        + use weaken_right.
          use (per_subobject_def ψ).
          apply hyperdoctrine_hyp.
        + use weaken_right.
          use (per_subobject_def ψ).
          apply hyperdoctrine_hyp.
      - do 2 use forall_intro.
        use impl_intro.
        use weaken_right.
        use impl_intro.
        use hyp_sym.
        hypersimplify.
        pose (γ₁ := π (tm_var ((𝟙 ×h Γ) ×h Γ)))).
        pose (γ₂ := π (tm_var ((𝟙 ×h Γ) ×h Γ))).
        fold γ₁ γ₂.
        use (disj_elim (weaken_left (hyperdoctrine_hyp _) _)).
        + use hyp_ltrans.
          use weaken_right.
          use disj_intro_left.
          use (per_subobject_eq ψ).
          * exact γ₁.
          * use weaken_left.
            apply hyperdoctrine_hyp.
          * use weaken_right.
            apply hyperdoctrine_hyp.
        + use hyp_ltrans.
          use weaken_right.
          use disj_intro_right.
          use (per_subobject_eq ψ).
          * exact γ₁.
          * use weaken_left.
            apply hyperdoctrine_hyp.
          * use weaken_right.
            apply hyperdoctrine_hyp.
    Qed.

    Definition per_subobject_disj
      : per_subobject Γ.
    Proof.
      use make_per_subobject.
      - exact (ψ ψ).
      - exact per_subobject_disj_laws.
    Defined.

2. Introduction rules

    Proposition per_subobject_disj_intro_left
      : per_subobject_mor_law
          (id_partial_setoid_morphism Γ)
          ψ
          per_subobject_disj.
    Proof.
      do 2 use forall_intro.
      use impl_intro.
      use weaken_right.
      use impl_intro.
      cbn.
      hypersimplify.
      pose (γ₁ := π (tm_var ((𝟙 ×h Γ) ×h Γ)))).
      pose (γ₂ := π (tm_var ((𝟙 ×h Γ) ×h Γ))).
      fold γ₁ γ₂.
      use disj_intro_left.
      use per_subobject_eq.
      - exact γ₁.
      - use weaken_left.
        apply hyperdoctrine_hyp.
      - use weaken_right.
        apply hyperdoctrine_hyp.
    Qed.

    Proposition per_subobject_disj_intro_right
      : per_subobject_mor_law
          (id_partial_setoid_morphism Γ)
          ψ
          per_subobject_disj.
    Proof.
      do 2 use forall_intro.
      use impl_intro.
      use weaken_right.
      use impl_intro.
      cbn.
      hypersimplify.
      pose (γ₁ := π (tm_var ((𝟙 ×h Γ) ×h Γ)))).
      pose (γ₂ := π (tm_var ((𝟙 ×h Γ) ×h Γ))).
      fold γ₁ γ₂.
      use disj_intro_right.
      use per_subobject_eq.
      - exact γ₁.
      - use weaken_left.
        apply hyperdoctrine_hyp.
      - use weaken_right.
        apply hyperdoctrine_hyp.
    Qed.

3. Elimination rule

    Context {χ : per_subobject Γ}
            (p : per_subobject_mor_law (id_partial_setoid_morphism Γ) ψ χ)
            (q : per_subobject_mor_law (id_partial_setoid_morphism Γ) ψ χ).

    Proposition per_subobject_disj_elim
      : per_subobject_mor_law
          (id_partial_setoid_morphism Γ)
          per_subobject_disj
          χ.
    Proof.
      do 2 use forall_intro.
      use impl_intro.
      use weaken_right.
      use impl_intro.
      cbn.
      hypersimplify.
      pose (γ₁ := π (tm_var ((𝟙 ×h Γ) ×h Γ)))).
      pose (γ₂ := π (tm_var ((𝟙 ×h Γ) ×h Γ))).
      fold γ₁ γ₂.
      use hyp_sym.
      use (disj_elim (weaken_left (hyperdoctrine_hyp _) _)).
      - use hyp_ltrans.
        use weaken_right.
        use (per_subobject_mor p).
        + exact γ₁.
        + cbn.
          hypersimplify.
          use weaken_left.
          apply hyperdoctrine_hyp.
        + use weaken_right.
          apply hyperdoctrine_hyp.
      - use hyp_ltrans.
        use weaken_right.
        use (per_subobject_mor q).
        + exact γ₁.
        + cbn.
          hypersimplify.
          use weaken_left.
          apply hyperdoctrine_hyp.
        + use weaken_right.
          apply hyperdoctrine_hyp.
    Qed.
  End Disjunction.

4. Stability under substitution

  Proposition per_subobject_disj_subst
              {Γ₁ Γ₂ : partial_setoid H}
              (s : partial_setoid_morphism Γ₁ Γ₂)
              (ψ ψ : per_subobject Γ₂)
    : per_subobject_mor_law
        (id_partial_setoid_morphism Γ₁)
        (per_subobject_subst s (per_subobject_disj ψ ψ))
        (per_subobject_disj (per_subobject_subst s ψ) (per_subobject_subst s ψ)).
  Proof.
    do 2 use forall_intro.
    use impl_intro.
    use weaken_right.
    use impl_intro.
    cbn.
    rewrite partial_setoid_subst.
    rewrite !exists_subst.
    use hyp_sym.
    use (exists_elim (weaken_left (hyperdoctrine_hyp _) _)).
    rewrite !conj_subst.
    use hyp_ltrans.
    use weaken_right.
    hypersimplify_form.
    hypersimplify.
    pose (γ₁ := π (tm_var (((𝟙 ×h Γ₁) ×h Γ₁) ×h Γ₂))))).
    pose (γ₁' := π (tm_var (((𝟙 ×h Γ₁) ×h Γ₁) ×h Γ₂)))).
    pose (γ₂ := π (tm_var (((𝟙 ×h Γ₁) ×h Γ₁) ×h Γ₂))).
    fold γ₁ γ₁' γ₂.
    use hyp_rtrans.
    use hyp_sym.
    use (disj_elim (weaken_left (hyperdoctrine_hyp _) _)).
    - use hyp_ltrans.
      use weaken_right.
      use disj_intro_left.
      use exists_intro.
      + exact γ₂.
      + hypersimplify.
        fold γ₁'.
        use conj_intro.
        * use weaken_left.
          use (partial_setoid_mor_eq_defined s).
          ** exact γ₁.
          ** exact γ₂.
          ** use weaken_left.
             apply hyperdoctrine_hyp.
          ** use weaken_right.
             exact (partial_setoid_mor_cod_defined s _ _ (hyperdoctrine_hyp _)).
          ** use weaken_right.
             apply hyperdoctrine_hyp.
        * use weaken_right.
          apply hyperdoctrine_hyp.
    - use hyp_ltrans.
      use weaken_right.
      use disj_intro_right.
      use exists_intro.
      + exact γ₂.
      + hypersimplify.
        fold γ₁'.
        use conj_intro.
        * use weaken_left.
          use (partial_setoid_mor_eq_defined s).
          ** exact γ₁.
          ** exact γ₂.
          ** use weaken_left.
             apply hyperdoctrine_hyp.
          ** use weaken_right.
             exact (partial_setoid_mor_cod_defined s _ _ (hyperdoctrine_hyp _)).
          ** use weaken_right.
             apply hyperdoctrine_hyp.
        * use weaken_right.
          apply hyperdoctrine_hyp.
  Qed.

5. Fiberwise binary coproducts

  Definition fiberwise_bincoproducts_per_subobject
    : fiberwise_bincoproducts (disp_cat_per_subobject_cleaving H).
  Proof.
    use make_fiberwise_bincoproducts_locally_propositional.
    - apply locally_prop_disp_cat_per_subobject.
    - intros Γ ψ ψ.
      exact (per_subobject_disj ψ ψ).
    - intros Γ ψ ψ.
      exact (per_subobject_disj_intro_left ψ ψ).
    - intros Γ ψ ψ.
      exact (per_subobject_disj_intro_right ψ ψ).
    - intros Γ ψ ψ χ p q.
      exact (per_subobject_disj_elim ψ ψ p q).
    - intros Γ₁ Γ₂ s ψ ψ.
      exact (per_subobject_disj_subst s ψ ψ).
  Defined.
End Disjunction.