{-# OPTIONS --without-K #-}
module logic where
open import preliminaries
open import prop
open import proptrunc
open import propisset
open import propua
true : {i : L} β Prp i
true = β π , π-isProp β
false : {i : L} β Prp i
false = β π , π-isProp β
holdsβequal-true : {i : L} {p : Prp i} β p holds β p β‘ true
holdsβequal-true {i} {p} h = Prp-β‘ (prop-ua (holdsIsProp p) (holdsIsProp true) (Ξ» _ β zero) (Ξ» _ β h))
equal-trueβholds : {i : L} {p : Prp i} β p β‘ true β p holds
equal-trueβholds {i} {p} e = transport (Ξ» X β X) (sym a) zero
where
a : p holds β‘ π
a = ap _holds e
infixr 42 _β_
infixr 41 _β¨_
infixr 40 _β§_
_β§_ _β¨_ _β_ : {i : L} β Prp i β Prp i β Prp i
p β§ q = β p holds Γ q holds , isProp-closed-under-Ξ£ (holdsIsProp p) (Ξ» _ β holdsIsProp q) β
p β q = β (p holds β q holds) , isProp-exponential-ideal (Ξ» _ β holdsIsProp q) β
p β¨ q = β β₯ p holds + q holds β₯ , β₯β₯-isProp β
βΜ βΜ : {i j : L} β {X : U i} β (X β Prp j) β Prp (i β j)
βΜ p = β (β x β p x holds) , isProp-exponential-ideal (Ξ» x β holdsIsProp(p x)) β
βΜ p = β β₯(Ξ£ \x β p x holds)β₯ , β₯β₯-isProp β
true-intro : {i : L} β true {i} holds
true-intro = zero
β§-intro : {i : L} {p q : Prp i} β p holds β q holds β p β§ q holds
β§-intro = _,_
β¨-intro-L : {i : L} {p q : Prp i} β p holds β p β¨ q holds
β¨-intro-L h = β£ inl h β£
β¨-intro-R : {i : L} {p q : Prp i} β q holds β p β¨ q holds
β¨-intro-R k = β£ inr k β£
β-intro : {i : L} {p q : Prp i} β (p holds β q holds) β p β q holds
β-intro = Ξ» f β f
βΜ-intro : {i j : L} {X : U i} {p : X β Prp j} (x : X) β p x holds β βΜ p holds
βΜ-intro x h = β£ x , h β£
βΜ-intro : {i j : L} {X : U i} {p : X β Prp j} β ((x : X) β p x holds) β βΜ p holds
βΜ-intro = Ξ» f β f
β§-elim-L : {i : L} {p q : Prp i} β p β§ q holds β p holds
β§-elim-L = prβ
β§-elim-R : {i : L} {p q : Prp i} β p β§ q holds β q holds
β§-elim-R = prβ
false-elim : {i j : L} {p : Prp i} β false {j} holds β p holds
false-elim = Ξ»()
β¨-elim : {i : L} {p q r : Prp i} β (p holds β r holds) β (q holds β r holds)
β p β¨ q holds β r holds
β¨-elim {i} {p} {q} {r} f g = β₯β₯-rec (holdsIsProp r) (+-rec f g)
β-elim : {i : L} {p q : Prp i} β (p holds β q holds) β p holds β q holds
β-elim = Ξ» f β f
βΜ-elim : {i j : L} {X : U i} {p : X β Prp j} {r : Prp (i β j)} β ((x : X) β p x holds β r holds)
β βΜ p holds β r holds
βΜ-elim {i} {j} {X} {p} {r} f = β₯β₯-rec (holdsIsProp r) (Ξ£-rec f)
βΜ-elim : {i j : L} {X : U i} {p : X β Prp j} β βΜ p holds β (x : X) β p x holds
βΜ-elim = Ξ» f β f
_β·_ : {i j : Level} β Prp i β Prp j β U (i β j)
p β· q = (p holds β q holds) Γ (q holds β p holds)
infix 32 _β·_
false-charac : {i : L} β (false {i}) β· βΜ \r β r
false-charac {i} = (a , b)
where
a : false holds β (βΜ \r β r) holds
a = false-elim {lsuc i} {i} {(βΜ \r β r)}
b : (βΜ \r β r) holds β false holds
b Ο = Ο false
β§-charac : {i : L} (p q : Prp i) β p β§ q β· βΜ \r β (p β q β r) β r
β§-charac {i} p q = (a , b)
where
a : p β§ q holds β (βΜ \r β (p β q β r) β r) holds
a pq = Ξ» r pqr β pqr (β§-elim-L {i} {p} {q} pq) (β§-elim-R {i} {p} {q} pq)
b : (βΜ \r β (p β q β r) β r) holds β p β§ q holds
b Ο = β§-intro {i} {p} {q} (Ο p (Ξ» x y β x)) (Ο q (Ξ» x y β y))
β¨-charac : {i : L} (p q : Prp i) β (p β¨ q) β· βΜ \r β (p β r) β (q β r) β r
β¨-charac {i} p q = (a , b)
where
a : p β¨ q holds β (βΜ \r β (p β r) β (q β r) β r) holds
a pq = Ξ» r pr qr β β¨-elim {i} {p} {q} {r} pr qr pq
b : (βΜ \r β (p β r) β (q β r) β r) holds β p β¨ q holds
b Ο = decrease (Ξ» r f β Ο r (Ξ» x β f (inl x)) (Ξ» y β f (inr y)))
βΜ-charac : {i : L} {X : U i} (p : X β Prp i) β (βΜ p) β· βΜ \r β (βΜ \x β p x β r) β r
βΜ-charac {i} {X} p = (a , b)
where
a : (βΜ p) holds β (βΜ \r β (βΜ \x β (p x β r)) β r) holds
a ep = Ξ» r f β βΜ-elim {i} {i} {X} {p} {r} (Ξ» x px β f x px) ep
b : (βΜ \r β (βΜ \x β (p x β r)) β r) holds β (βΜ p) holds
b Ο = decrease (Ξ» r f β Ο r (Ξ» x px β f (x , px)))