{-# OPTIONS --safe #-}
module Cubical.Data.Cardinal.Base where
open import Cubical.HITs.SetTruncation as ∥₂
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Data.Empty
open import Cubical.Data.Sigma
open import Cubical.Data.Sum
open import Cubical.Data.Unit
private
variable
ℓ ℓ' : Level
Card : Type (ℓ-suc ℓ)
Card {ℓ} = ∥ hSet ℓ ∥₂
isSetCard : isSet (Card {ℓ})
isSetCard = isSetSetTrunc
card : hSet ℓ → Card {ℓ}
card = ∣_∣₂
𝟘 : Card {ℓ}
𝟘 = card (⊥* , isProp→isSet isProp⊥*)
𝟙 : Card {ℓ}
𝟙 = card (Unit* , isSetUnit*)
_+_ : Card {ℓ} → Card {ℓ'} → Card {ℓ-max ℓ ℓ'}
_+_ = ∥₂.rec2 isSetCard λ (A , isSetA) (B , isSetB)
→ card ((A ⊎ B) , isSet⊎ isSetA isSetB)
_·_ : Card {ℓ} → Card {ℓ'} → Card {ℓ-max ℓ ℓ'}
_·_ = ∥₂.rec2 isSetCard λ (A , isSetA) (B , isSetB)
→ card ((A × B) , isSet× isSetA isSetB)
_^_ : Card {ℓ} → Card {ℓ'} → Card {ℓ-max ℓ ℓ'}
_^_ = ∥₂.rec2 isSetCard λ (A , isSetA) (B , _)
→ card ((B → A) , isSet→ isSetA)