`iLawfulOrdDouble` is refuted by NaN and gives a proof of `⊥`
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend
Research direction
Read lib/base/Haskell/Law/Ord/Def.agda around iLawfulOrdDouble and compare it with the change in issue #290 that removed iLawfulEqDouble. Reproduce the provided DoubleFalse.agda example with Agda 2.8.0.2 and the stated command. Done means importing Haskell.Law no longer lets the supplied proofs derive ⊥, while any replacement instance has valid equality and ordering laws.
Written by the indexing model from the issue text.
Description
The postulated instance iLawfulOrdDouble : IsLawfulOrd Double asserts reflexivity of <= and, through its IsLawfulEq superclass, lawful == for every Double. Agda reduces both nan <= nan and nan == nan to False, so importing Haskell.Law is enough to prove ⊥:
module DoubleFalse where
open import Haskell.Prelude
open import Haskell.Law -- the umbrella module users import
nan : Double
nan = primFloatDiv 0.0 0.0
nan≠nan : (nan == nan) ≡ False
nan≠nan = refl
nan≰nan : (nan <= nan) ≡ False
nan≰nan = refl
bot₁ : ⊥
bot₁ with () ← trans (sym (reflexivity nan)) nan≰nan
bot₂ : ⊥
bot₂ = IsLawfulEq.nequality (IsLawfulOrd.super iLawfulOrdDouble) nan nan refl refl
Save as DoubleFalse.agda, then run with Agda 2.8.0.2:
git clone https://github.com/agda/agda2hs.git agda2hs
git -C agda2hs checkout 1accbe6aedc2660781c83d9ab7eaf87a75e8c76c
agda --no-libraries --erasure --no-projection-like -i . -i agda2hs/lib/base DoubleFalse.agda
Agda exits successfully without the witness adding postulates. GHC 9.10.3 also gives False for both comparisons on NaN. Tested on Linux x86-64.
#290 removed the iLawfulEqDouble postulate because floating-point equality is not lawful, but iLawfulOrdDouble still provides the order laws and, through super, a lawful Eq. Removing this instance too would block these proofs. A replacement instance for a restricted representation should have its equality and ordering laws proved.
- Dominant language
- Agda
- Stars
- 211
- Forks
- 51
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from agda/agda2hs
-
Refine the fix of #142Possibly taken @jespercockx claimed this 1 day ago. Openenhancement
agda/agda2hs#494 · 1 assignee ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 8/100
Maintainers usually reply within 1 day
-
bug library
Difficulty 4/5 3-5 days Newbie friendliness 49/100
agda/agda2hs#487 · 3 comments ·
Maintainers usually reply within 1 day
-
Skipping compilation for up-to-date files results in mis-compilationPossibly taken @jespercockx claimed this 1 day ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
agda/agda2hs#486 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Compile reexport of individual itemsPossibly taken @wasabi315 claimed this 10 days ago. Openenhancement
agda/agda2hs#484 · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
keiyoushi/extensions-source#21067 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Natvs/Nt.Automaton#33 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
hummingbot/hummingbot-api#256 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
volcano-sh/volcano#6322 ·
Maintainers usually reply within 1 day