Library UniMath.MoreFoundations.StructureIdentity

Structure identity

abstract the proof of Poset_rect for use in multiple situations

See Section 9.8 of the HoTT book, on "The structure identity principle".

  Open Scope poset.

  Context {Base : UU}
          (Data : Base -> Poset).
  Definition Struc := b, Data b.
for example: Base = hSet, Data = PartialOrder, Struc = Poset

  Local Definition DataEquiv (b:Base) (d d':Data b) := d d' d' d.

  Local Definition StrucEquiv (X Y:Struc)
    := (p: pr1 X = pr1 Y), DataEquiv _ (transportf Data p (pr2 X)) (pr2 Y).

  Notation "X ≅ Y" := (StrucEquiv X Y).

  Theorem Struc_univalence (X Y:Struc) : X=Y XY.
  Show proof.
    simple refine (@remakeweq _ _ _ _ _).
    { intermediate_weq (XY).
      { apply total2_paths_equiv'. }
      { use weqfibtototal; intro p. apply weqimplimpl.
        { intros q. split; induction q; apply isrefl_posetRelation. }
        { intros e. apply isantisymm_posetRelation.
          - exact (pr1 e).
          - exact (pr2 e). }
        { apply (setproperty (Data _)). }
        { apply (propproperty (DataEquiv _ _ _)). } } }
    { intros e. induction e. exists (idpath _). split; apply isrefl_posetRelation. }
    try reflexivity.     intro e. now induction e.

  Theorem Equiv_rect (X Y : Struc) (P : X Y -> UU) :
    ( e : X = Y, P (Struc_univalence _ _ e)) -> f, P f.
  Show proof.
    intros ih f.
    set (p := ih (invmap (Struc_univalence _ _) f)).
    set (h := homotweqinvweq (Struc_univalence _ _) f).
    exact (transportf P h p).


End StructureIdentity.