{-# OPTIONS --cubical --safe #-}

module CubicalExt.Axiom.ExcludedMiddle where

open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels using (isPropΠ; isPropImplicitΠ)
open import Cubical.HITs.PropositionalTruncation using (∥_∥₁; squash₁)
open import Cubical.Relation.Nullary using (Dec)

private variable
   : Level
  A : Type 
  B : A  Type 

isPropImplicit : { : Level}  Type   Type 
isPropImplicit A = {x y : A}  x  y

EM : ( : Level)  Type (ℓ-suc )
EM  = {P : Type }   isPropImplicit P   Dec P

instance
  isPropΠn :  H : {x : A}  isPropImplicit (B x)   isPropImplicit ((x : A)  B x)
  isPropΠn  H  = isPropΠ  _ _ _  H) _ _

  isPropImpliciΠn :  H : {x : A}  isPropImplicit (B x)   isPropImplicit ({x : A}  B x)
  isPropImpliciΠn  H  = isPropImplicitΠ  _ _ _  H) _ _

  isPropImplicitPropTrunc : isPropImplicit  A ∥₁
  isPropImplicitPropTrunc = squash₁ _ _