@@ -29,7 +29,7 @@ open import Function.Base
29
29
open import Function.Bundles using (_⤖_; _⇔_ ; mk⤖; mk⇔)
30
30
open import Function.Consequences.Propositional using (strictlySurjective⇒surjective)
31
31
open import Relation.Nullary.Decidable as Dec using (Dec; does; _because_; yes; no; ¬?)
32
- open import Relation.Nullary.Negation using (¬_; contradiction)
32
+ open import Relation.Nullary.Negation using (¬_; contradiction; contradiction′ )
33
33
open import Relation.Nullary.Reflects using (invert)
34
34
open import Relation.Unary as U using (Pred)
35
35
open import Relation.Binary.Core using (Rel; REL; _⇒_)
@@ -400,26 +400,21 @@ module Antisymmetry
400
400
401
401
open ℕ.≤-Reasoning
402
402
403
+ private
404
+ antisym-lemma : Sublist R xs ys → ¬ Sublist S (y ∷ ys) xs
405
+ antisym-lemma {xs} {ys} {y} rs ss = ℕ.<-irrefl ≡.refl $ begin
406
+ length (y ∷ ys) ≤⟨ length-mono-≤ ss ⟩
407
+ length xs ≤⟨ length-mono-≤ rs ⟩
408
+ length ys ∎
409
+
403
410
antisym : Antisym (Sublist R) (Sublist S) (Pointwise E)
404
- antisym [] [] = []
405
- antisym (r ∷ rs) (s ∷ ss) = rs⇒e r s ∷ antisym rs ss
406
411
-- impossible cases
407
- antisym (_∷ʳ_ {xs} {ys₁} y rs) (_∷ʳ_ {ys₂} {zs} z ss) =
408
- contradiction (begin
409
- length (y ∷ ys₁) ≤⟨ length-mono-≤ ss ⟩
410
- length zs ≤⟨ ℕ.n≤1+n (length zs) ⟩
411
- length (z ∷ zs) ≤⟨ length-mono-≤ rs ⟩
412
- length ys₁ ∎) $ ℕ.<-irrefl ≡.refl
413
- antisym (_∷ʳ_ {xs} {ys₁} y rs) (_∷_ {y} {ys₂} {z} {zs} s ss) =
414
- contradiction (begin
415
- length (z ∷ zs) ≤⟨ length-mono-≤ rs ⟩
416
- length ys₁ ≤⟨ length-mono-≤ ss ⟩
417
- length zs ∎) $ ℕ.<-irrefl ≡.refl
412
+ antisym (_ ∷ʳ rs) ss = contradiction′ (antisym-lemma rs) ss
418
413
antisym (_∷_ {x} {xs} {y} {ys₁} r rs) (_∷ʳ_ {ys₂} {zs} z ss) =
419
- contradiction (begin
420
- length (y ∷ ys₁) ≤⟨ length-mono-≤ ss ⟩
421
- length xs ≤⟨ length-mono-≤ rs ⟩
422
- length ys₁ ∎) $ ℕ.<-irrefl ≡.refl
414
+ contradiction′ (antisym-lemma rs) ss
415
+ -- diagonal cases
416
+ antisym [] [] = []
417
+ antisym (r ∷ rs) (s ∷ ss) = rs⇒e r s ∷ antisym rs ss
423
418
424
419
open Antisymmetry public
425
420
0 commit comments