-
Notifications
You must be signed in to change notification settings - Fork 252
[ refactor ] make contradiction
and friends entirely definitionally proof-irrelevant
#2802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
0db4874
1c7b74e
c4cb90f
00c0354
863d63c
757f28a
9ce9d09
3fbf7ec
680839b
4d6f4f7
9e2ee23
280492b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,17 +409,17 @@ module Antisymmetry | |
length (y ∷ ys₁) ≤⟨ length-mono-≤ ss ⟩ | ||
length zs ≤⟨ ℕ.n≤1+n (length zs) ⟩ | ||
length (z ∷ zs) ≤⟨ length-mono-≤ rs ⟩ | ||
length ys₁ ∎) $ ℕ.<-irrefl ≡.refl | ||
length ys₁ ∎) (ℕ.<-irrefl ≡.refl) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps don't roll in such pure, non-breaking style changes in to something There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a style change; it's yet another 'feature' of irrelevant function spaces: |
||
antisym (_∷ʳ_ {xs} {ys₁} y rs) (_∷_ {y} {ys₂} {z} {zs} s ss) = | ||
contradiction (begin | ||
length (z ∷ zs) ≤⟨ length-mono-≤ rs ⟩ | ||
length ys₁ ≤⟨ length-mono-≤ ss ⟩ | ||
length zs ∎) $ ℕ.<-irrefl ≡.refl | ||
length zs ∎) (ℕ.<-irrefl ≡.refl) | ||
antisym (_∷_ {x} {xs} {y} {ys₁} r rs) (_∷ʳ_ {ys₂} {zs} z ss) = | ||
contradiction (begin | ||
length (y ∷ ys₁) ≤⟨ length-mono-≤ ss ⟩ | ||
length xs ≤⟨ length-mono-≤ rs ⟩ | ||
length ys₁ ∎) $ ℕ.<-irrefl ≡.refl | ||
length ys₁ ∎) (ℕ.<-irrefl ≡.refl) | ||
|
||
open Antisymmetry public | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,18 @@ infix 3 ¬_ | |
¬_ : Set a → Set a | ||
¬ A = A → ⊥ | ||
|
||
-- Note the following use of flip: | ||
private | ||
note : (A → ¬ B) → B → ¬ A | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're going to bother to move this to the top of the file, maybe also document where the 'note' is useful in reading below? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well... for starters, Secondly, more importantly, some of the properties in this module (eg As to the best way to document this separation of concerns, suggestions welcome! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe one way to resolve this is to interpolate a v2.4 non-
rather than try to do this as part of this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And/or add some text to #2798 to emphasise the distinction? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See: #2805 |
||
note = flip | ||
|
||
------------------------------------------------------------------------ | ||
-- Relationship to sum | ||
|
||
infixr 1 _¬-⊎_ | ||
_¬-⊎_ : ¬ A → ¬ B → ¬ (A ⊎ B) | ||
_¬-⊎_ = [_,_] | ||
|
||
------------------------------------------------------------------------ | ||
-- Stability. | ||
|
||
|
@@ -42,27 +54,20 @@ DoubleNegation A = ¬ ¬ A | |
Stable : Set a → Set a | ||
Stable A = ¬ ¬ A → A | ||
|
||
------------------------------------------------------------------------ | ||
-- Relationship to sum | ||
|
||
infixr 1 _¬-⊎_ | ||
_¬-⊎_ : ¬ A → ¬ B → ¬ (A ⊎ B) | ||
_¬-⊎_ = [_,_] | ||
|
||
------------------------------------------------------------------------ | ||
-- Uses of negation | ||
|
||
contradiction-irr : .A → .(¬ A) → Whatever | ||
contradiction-irr a ¬a = ⊥-elim-irr (¬a a) | ||
contradiction : .A → .(¬ A) → Whatever | ||
contradiction a ¬a = ⊥-elim-irr (¬a a) | ||
|
||
contradiction : A → ¬ A → Whatever | ||
contradiction a ¬a = contradiction-irr a ¬a | ||
contradiction′ : .(¬ A) → .A → Whatever | ||
contradiction′ ¬a a = ⊥-elim-irr (¬a a) | ||
|
||
contradiction₂ : A ⊎ B → ¬ A → ¬ B → Whatever | ||
contradiction₂ : A ⊎ B → .(¬ A) → .(¬ B) → Whatever | ||
contradiction₂ (inj₁ a) ¬a ¬b = contradiction a ¬a | ||
contradiction₂ (inj₂ b) ¬a ¬b = contradiction b ¬b | ||
|
||
contraposition : (A → B) → ¬ B → ¬ A | ||
contraposition : (A → B) → .(¬ B) → ¬ A | ||
contraposition f ¬b a = contradiction (f a) ¬b | ||
|
||
-- Self-contradictory propositions are false by 'diagonalisation' | ||
|
@@ -72,17 +77,11 @@ contra-diagonal self a = self a a | |
|
||
-- Everything is stable in the double-negation monad. | ||
stable : ¬ ¬ Stable A | ||
stable ¬[¬¬a→a] = ¬[¬¬a→a] (contradiction (¬[¬¬a→a] ∘ const)) | ||
stable ¬[¬¬a→a] = ¬[¬¬a→a] λ ¬¬a → contradiction (¬[¬¬a→a] ∘ const) ¬¬a | ||
jamesmckinna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
-- Negated predicates are stable. | ||
negated-stable : Stable (¬ A) | ||
negated-stable ¬¬¬a a = ¬¬¬a (contradiction a) | ||
negated-stable ¬¬¬a a = ¬¬¬a λ ¬a → contradiction a ¬a | ||
|
||
¬¬-map : (A → B) → ¬ ¬ A → ¬ ¬ B | ||
¬¬-map f = contraposition (contraposition f) | ||
|
||
-- Note also the following use of flip: | ||
private | ||
note : (A → ¬ B) → B → ¬ A | ||
note = flip | ||
|
||
¬¬-map f ¬¬a = contraposition (λ ¬b → contraposition f ¬b) ¬¬a |
Uh oh!
There was an error while loading. Please reload this page.