{-# OPTIONS --without-K #-}


-- Agda-hott library.
-- Author: Mario Román

-- Circle.  The circle type is constructed by postulating a type with
-- a single element (base) and a nontrivial path (loop).

open import Base
open import Equality

module topology.Circle where

  private
    -- A private declaration of the type prevents pattern matching and
    -- allows us to postulate higher-inductive types without losing
    -- consistency.
    
    -- This technique is known as the Dan Licata's trick, and it is
    -- used in the HoTT-Agda library.
    data !S¹ : Type0 where
      !base : !S¹

   : Type0
   = !S¹
  
  base : 
  base = !base

  -- Nontrivial path on the circle.
  postulate loop : base == base

  -- Recursion principle on points
  S¹-rec : ∀{} (P :   Type ) (x : P base) (p : transport P loop x == x)  ((t : )  P t)
  S¹-rec P x p !base = x

  -- Recursion principle on paths
  postulate S¹-βrec : ∀{} (P :   Type ) (x : P base) (p : transport P loop x == x)
                       apd (S¹-rec P x p) loop == p
            
  -- Induction principle on points
  S¹-ind : ∀{} (A : Type ) (a : A) (p : a == a)  (  A)
  S¹-ind A a p !base = a

  -- Induction principle on paths
  postulate S¹-βind : ∀{} (A : Type ) (a : A) (p : a == a)
                       ap (S¹-ind A a p) loop == p