safe-agda.lagda.rst 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ..
  2. ::
  3. module language.safe-agda where
  4. .. _safe-agda:
  5. *********
  6. Safe Agda
  7. *********
  8. By using the option ``--safe`` (as a pragma option, or on the
  9. command-line), a user can specify that Agda should ensure that
  10. features leading to possible inconsistencies should be disabled.
  11. Here is a list of the features ``--safe`` is incompatible with:
  12. * ``postulate``; can be used to assume any axiom.
  13. * :option:`--allow-unsolved-metas`; forces Agda to accept unfinished
  14. proofs.
  15. * :option:`--allow-incomplete-matches`; forces Agda to accept
  16. unfinished proofs.
  17. * :option:`--no-positivity-check`; makes it possible to write
  18. non-terminating programs by structural "induction" on non strictly
  19. positive datatypes.
  20. * :option:`--no-termination-check`; gives loopy programs any type.
  21. * :option:`--type-in-type` and :option:`--omega-in-omega`; allow the
  22. user to encode the Girard-Hurken paradox.
  23. * :option:`--injective-type-constructors`; together with excluded
  24. middle leads to an inconsistency via Chung-Kil Hur's construction.
  25. * :option:`--guardedness` together with :option:`--sized-types`;
  26. currently can be used to define a type which is both inductive and
  27. coinductive, which leads to an inconsistency. This might be fixed in
  28. the future.
  29. * :option:`--experimental-irrelevance` and
  30. :option:`--irrelevant-projections`; enables potentially unsound
  31. irrelevance features (irrelevant levels, irrelevant data matching,
  32. and projection of irrelevant record fields, respectively).
  33. * :option:`--rewriting`; turns any equation into one that holds
  34. definitionally. It can at the very least break convergence.
  35. * :option:`--cubical` together with :option:`--with-K`; the univalence
  36. axiom is provable using cubical constructions, which falsifies the K
  37. axiom.
  38. * The ``primEraseEquality`` primitive together with
  39. :option:`--without-K`; using ``primEraseEquality``, one can derive
  40. the K axiom.
  41. * :option:`--allow-exec`; allows system calls during type checking.
  42. The option ``--safe`` is coinfective (see
  43. :ref:`consistency-checking-options`); if a module is declared safe,
  44. then all its imported modules must also be declared safe.
  45. .. NOTE::
  46. The :option:`--guardedness` and :option:`--sized-types` options are
  47. both on by default. However, unless they have been set explicitly
  48. by the user, setting the ``--safe`` option will turn them both
  49. off. That is to say that
  50. .. code-block:: agda
  51. {-# OPTIONS --safe #-}
  52. will correspond to ``--safe``, :option:`--no-guardedness`, and
  53. :option:`--no-sized-types`. When both
  54. .. code-block:: agda
  55. {-# OPTIONS --safe --guardedness #-}
  56. and
  57. .. code-block:: agda
  58. {-# OPTIONS --guardedness --safe #-}
  59. will turn on ``--safe``, :option:`--guardedness`, and
  60. :option:`--no-sized-types`.
  61. Setting both :option:`--sized-types` and :option:`--guardedness`
  62. whilst demanding that the module is ``--safe`` will lead to an
  63. error as combining these options currently is inconsistent.