| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- An explanation about the `Axiom` modules. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
module README.Axiom where |
| 8 |
|
| 9 |
open import Level using (Level) |
| 10 |
|
| 11 |
private variable ℓ : Level |
| 12 |
|
| 13 |
------------------------------------------------------------------------ |
| 14 |
-- Introduction |
| 15 |
|
| 16 |
-- Several rules that are used without thought in written mathematics |
| 17 |
-- cannot be proved in Agda. The modules in the `Axiom` folder |
| 18 |
-- provide types expressing some of these rules that users may want to |
| 19 |
-- use even when they're not provable in Agda. |
| 20 |
|
| 21 |
------------------------------------------------------------------------ |
| 22 |
-- Example: law of excluded middle |
| 23 |
|
| 24 |
-- In classical logic the law of excluded middle states that for any |
| 25 |
-- proposition `P` either `P` or `¬P` must hold. This is impossible |
| 26 |
-- to prove in Agda because Agda is a constructive system and so any |
| 27 |
-- proof of the excluded middle would have to build a term of either |
| 28 |
-- type `P` or `¬P`. This is clearly impossible without any knowledge |
| 29 |
-- of what proposition `P` is. |
| 30 |
|
| 31 |
-- The types for which `P` or `¬P` holds is called `Dec P` in the |
| 32 |
-- standard library (short for `Decidable`). |
| 33 |
|
| 34 |
open import Relation.Nullary.Decidable using (Dec) |
| 35 |
|
| 36 |
-- The type of the proof of saying that excluded middle holds for |
| 37 |
-- all types at universe level ℓ is therefore: |
| 38 |
-- |
| 39 |
-- ExcludedMiddle ℓ = ∀ {P : Set ℓ} → Dec P |
| 40 |
-- |
| 41 |
-- and this type is exactly the one found in `Axiom.ExcludedMiddle`: |
| 42 |
|
| 43 |
open import Axiom.ExcludedMiddle |
| 44 |
|
| 45 |
-- There are two different ways that the axiom can be introduced into |
| 46 |
-- your Agda development. The first option is to postulate it: |
| 47 |
|
| 48 |
postulate excludedMiddle : ExcludedMiddle ℓ |
| 49 |
|
| 50 |
-- This has the advantage that it only needs to be postulated once |
| 51 |
-- and it can then be imported into many different modules as with any |
| 52 |
-- other proof. The downside is that the resulting Agda code will no |
| 53 |
-- longer type check under the --safe flag. |
| 54 |
|
| 55 |
-- The second approach is to pass it as a module parameter: |
| 56 |
|
| 57 |
module Proof (excludedMiddle : ExcludedMiddle ℓ) where |
| 58 |
|
| 59 |
-- The advantage of this approach is that the resulting Agda |
| 60 |
-- development can still be type checked under the --safe flag. |
| 61 |
-- Intuitively the reason for this is that when postulating it |
| 62 |
-- you are telling Agda that excluded middle does hold (which is clearly |
| 63 |
-- untrue as discussed above). In contrast when passing it as a module |
| 64 |
-- parameter you are telling Agda that **if** excluded middle was true |
| 65 |
-- then the following proofs would hold, which is logically valid. |
| 66 |
|
| 67 |
-- The disadvantage of this approach is that it is now necessary to |
| 68 |
-- include the excluded middle assumption as a parameter in every module |
| 69 |
-- that you want to use it in. Additionally the modules can never |
| 70 |
-- be fully instantiated (without postulating excluded middle). |
| 71 |
|
| 72 |
------------------------------------------------------------------------ |
| 73 |
-- Other axioms |
| 74 |
|
| 75 |
-- Double negation elimination |
| 76 |
-- (∀ P → ¬ ¬ P → P) |
| 77 |
|
| 78 |
import Axiom.DoubleNegationElimination |
| 79 |
|
| 80 |
-- Function extensionality |
| 81 |
-- (∀ f g → (∀ x → f x ≡ g x) → f ≡ g) |
| 82 |
|
| 83 |
import Axiom.Extensionality.Propositional |
| 84 |
import Axiom.Extensionality.Heterogeneous |
| 85 |
|
| 86 |
-- Uniqueness of identity proofs (UIP) |
| 87 |
-- (∀ x y (p q : x ≡ y) → p ≡ q) |
| 88 |
|
| 89 |
import Axiom.UniquenessOfIdentityProofs |