Skip to content

Commit e00111c

Browse files
authored
[Refractor] contradiction over ⊥-elim in Data.*.Relation.Binary.Lex.* (#2671)
* [Refractor] contradiction over ⊥-elim in * Modification * remove of useless import and replacing tt with _ * add open import Data.Empty using (⊥; ⊥-elim)
1 parent 699da8b commit e00111c

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

src/Data/List/Relation/Binary/Lex/Core.agda

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
module Data.List.Relation.Binary.Lex.Core where
1010

11-
open import Data.Empty using (⊥; ⊥-elim)
12-
open import Data.Unit.Base using (⊤; tt)
11+
open import Data.Empty using (⊥)
12+
open import Data.Unit.Base using (⊤)
1313
open import Data.Product.Base using (_×_; _,_; proj₁; proj₂; uncurry)
1414
open import Data.List.Base using (List; []; _∷_)
1515
open import Function.Base using (_∘_; flip; id)
1616
open import Level using (Level; _⊔_)
17-
open import Relation.Nullary.Negation using (¬_)
17+
open import Relation.Nullary.Negation.Core using (¬_)
1818
open import Relation.Binary.Core using (Rel)
1919
open import Data.List.Relation.Binary.Pointwise.Base
2020
using (Pointwise; []; _∷_; head; tail)

src/Data/List/Relation/Binary/Lex/Strict.agda

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
module Data.List.Relation.Binary.Lex.Strict where
1313

14-
open import Data.Empty using (⊥)
15-
open import Data.Unit.Base using (⊤; tt)
1614
open import Function.Base using (_∘_; id)
1715
open import Data.Product.Base using (_,_)
1816
open import Data.Sum.Base using (inj₁; inj₂)
@@ -146,7 +144,7 @@ module _ {a ℓ₁ ℓ₂} {A : Set a} where
146144

147145
≤-reflexive : (_≈_ : Rel A ℓ₁) (_≺_ : Rel A ℓ₂)
148146
Pointwise _≈_ ⇒ Lex-≤ _≈_ _≺_
149-
≤-reflexive _≈_ _≺_ [] = base tt
147+
≤-reflexive _≈_ _≺_ [] = base _
150148
≤-reflexive _≈_ _≺_ (x≈y ∷ xs≈ys) =
151149
next x≈y (≤-reflexive _≈_ _≺_ xs≈ys)
152150

@@ -168,7 +166,7 @@ module _ {a ℓ₁ ℓ₂} {A : Set a} where
168166
-- the following lemma.
169167

170168
≤-total : Symmetric _≈_ Trichotomous _≈_ _≺_ Total _≤_
171-
≤-total _ _ [] [] = inj₁ (base tt)
169+
≤-total _ _ [] [] = inj₁ (base _)
172170
≤-total _ _ [] (x ∷ xs) = inj₁ halt
173171
≤-total _ _ (x ∷ xs) [] = inj₂ halt
174172
≤-total sym tri (x ∷ xs) (y ∷ ys) with tri x y
@@ -179,7 +177,7 @@ module _ {a ℓ₁ ℓ₂} {A : Set a} where
179177
... | inj₂ ys≲xs = inj₂ (next (sym x≈y) ys≲xs)
180178

181179
≤-decidable : Decidable _≈_ Decidable _≺_ Decidable _≤_
182-
≤-decidable = Core.decidable (yes tt)
180+
≤-decidable = Core.decidable (yes _)
183181

184182
≤-respects₂ : IsEquivalence _≈_ _≺_ Respects₂ _≈_
185183
_≤_ Respects₂ _≋_

src/Data/Vec/Relation/Binary/Lex/Core.agda

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
module Data.Vec.Relation.Binary.Lex.Core {a} {A : Set a} where
1010

11-
open import Data.Empty using (⊥; ⊥-elim)
1211
open import Data.Nat.Base using (ℕ; suc)
1312
import Data.Nat.Properties as ℕ using (_≟_; ≡-irrelevant)
1413
open import Data.Product.Base using (_×_; _,_; proj₁; proj₂; uncurry)
@@ -27,7 +26,7 @@ open import Relation.Binary.PropositionalEquality.Core as ≡
2726
using (_≡_; refl; cong)
2827
import Relation.Nullary as Nullary
2928
open import Relation.Nullary.Decidable as Dec using (Dec; yes; no; _×-dec_; _⊎-dec_)
30-
open import Relation.Nullary.Negation
29+
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
3130

3231
private
3332
variable
@@ -114,9 +113,9 @@ module _ {P : Set} {_≈_ : Rel A ℓ₁} {_≺_ : Rel A ℓ₂} where
114113

115114
antisym : {n} Antisymmetric (_≋_ {n}) (_<ₗₑₓ_)
116115
antisym (base _) (base _) = []
117-
antisym (this x≺y m≡n) (this y≺x n≡m) = ⊥-elim (≺-asym x≺y y≺x)
118-
antisym (this x≺y m≡n) (next y≈x ys<xs) = ⊥-elim (≺-irrefl (≈-sym y≈x) x≺y)
119-
antisym (next x≈y xs<ys) (this y≺x m≡n) = ⊥-elim (≺-irrefl (≈-sym x≈y) y≺x)
116+
antisym (this x≺y m≡n) (this y≺x n≡m) = contradiction y≺x (≺-asym x≺y)
117+
antisym (this x≺y m≡n) (next y≈x ys<xs) = contradiction x≺y (≺-irrefl (≈-sym y≈x))
118+
antisym (next x≈y xs<ys) (this y≺x m≡n) = contradiction y≺x (≺-irrefl (≈-sym x≈y))
120119
antisym (next x≈y xs<ys) (next y≈x ys<xs) = x≈y ∷ (antisym xs<ys ys<xs)
121120

122121
module _ (≈-equiv : IsPartialEquivalence _≈_) (open IsPartialEquivalence ≈-equiv) where

src/Data/Vec/Relation/Binary/Lex/Strict.agda

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ open import Data.Vec.Relation.Binary.Pointwise.Inductive as Pointwise
2323
using (Pointwise; []; _∷_; head; tail)
2424
open import Function.Base using (id; _on_; _∘_)
2525
open import Induction.WellFounded
26-
open import Relation.Nullary using (yes; no; ¬_)
26+
open import Level using (Level; _⊔_)
2727
open import Relation.Binary.Core using (REL; Rel; _⇒_)
2828
open import Relation.Binary.Bundles
2929
using (Poset; StrictPartialOrder; DecPoset; DecStrictPartialOrder
@@ -39,7 +39,8 @@ open import Relation.Binary.Definitions
3939
open import Relation.Binary.Consequences using (asym⇒irr)
4040
open import Relation.Binary.Construct.On as On using (wellFounded)
4141
open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl)
42-
open import Level using (Level; _⊔_)
42+
open import Relation.Nullary.Decidable.Core using (yes; no)
43+
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
4344

4445
private
4546
variable
@@ -139,7 +140,7 @@ module _ {_≈_ : Rel A ℓ₁} {_≺_ : Rel A ℓ₂} where
139140
where
140141

141142
<-wellFounded : {n} WellFounded (_<_ {n})
142-
<-wellFounded {0} [] = acc λ ys<[] ⊥-elim (xs≮[] ys<[])
143+
<-wellFounded {0} [] = acc λ ys<[] contradiction ys<[] xs≮[]
143144

144145
<-wellFounded {suc n} xs = Subrelation.wellFounded <⇒uncons-Lex uncons-Lex-wellFounded xs
145146
where

0 commit comments

Comments
 (0)