4

Let A and B be Types, and f : A -> B and g : B -> A be functions inverse to each other. In other words A and B are isomorphic types.

  1. Is it true that one cannot prove that A <> B?
  2. Can I safely add the axiom that A = B?
  3. Is this axiom compatible with the other axioms of the standard library of Coq? And, if yes, why isn't it in the standard library?
Bob
  • 1,713
  • 10
  • 23

1 Answers1

4

These kind of questions are the domain of predilection of homotopy type theory but here is a tentative synthetic answer to your questions.

In CIC (± the ideal theory underlying Coq), we say that two types A and B are equivalent if there is a function f : A -> B with left inverse g : B -> A (that is f o g = id_B) and right inverse h : B -> A (that is h o f = id_B). You can use an isomorphism from A to B to show that they are equivalent. Homotopy type theory is concerned with the addition of an axiom to CIC (or rather MLTT) called univalence that roughly states that equivalence between types and equality coincide (to be more precise, there is a map id_to_equiv : A = B -> equiv A B and univalence says that this map is itself an equivalence). Univalence is compatible with CIC in the sense that there exist models of CIC that validate this axiom.

So to answer your questions:

  1. Yes, one cannot prove A <> B in CIC because any such proof would contradict univalence (hence no model of CIC + univalence could exist)
  2. You won't be able to prove False since it is a special case of univalence that does have models, however the computational content of Coq will be partially lost (as it is always the case with the addition of any axiom).
  3. Univalence is compatible with some axioms of the standard library of Coq (excluded-middle for instance) but not with others (Uniqueness of identity proofs, a.k.a. UIP, univalence states that there are 2 proofs of Bool = Bool). Concerning the absence of univalence from the standard library, it stems from the fact that the standard library defines equality in Prop, which is incompatible with the existence of multiple witnesses of identity. However the axiom that you mention might be formulated in a way that's compatible with UIP (there have been some work by Bauer and Winterhalter on a so called cardinal model of type theory). Whether it is compatible with the other axioms from the standard library would have to be checked.
kyo dralliam
  • 1,197
  • 5
  • 6
  • 1
    I understand that there are two different isomorphisms between `Bool` and itself. But this does not imply that when I apply the axiom I mention I obtain two different proofs (this would mean that my axiom is injective). – Bob Jun 26 '21 at 15:55
  • 1
    Indeed that's where the axiom you propose departs from univalence, and the cardinal model (where a type is interpreted as a set up to bijection) validates your axiom. Providing a computational content to this axiom is not entirely natural though: what should be the behavior of the eliminator of identity (J) on an equality `{blue, red} = {green, orange}` ? – kyo dralliam Jun 27 '21 at 09:59
  • My concern is not about the computational content of this axiom, but about its logical consistency in concert with with other axioms of the standard library. – Bob Jun 27 '21 at 10:17
  • 1
    Your answer is interesting, but about a stronger axiom. Therefore the incompatibility with UIP might not apply to my axiom, right? – Bob Jun 27 '21 at 10:18
  • 2
    As he said, the cardinal model even validates isomorphism reflection (meaning that types in bijection can be considered convertible), and UIP. As to why it's not in the standard library it's probably because it's not standard. If instead of types you have propositions, then that would propext and this you can find in the library. – Théo Winterhalter Jun 28 '21 at 08:10
  • @ThéoWinterhalter That answers positively my question! Did you publish this result? – Bob Jun 28 '21 at 08:39
  • @ThéoWinterhalter However, am I right to assume that the cardinal model does not validate the univalence axiom? – Bob Jun 28 '21 at 08:48
  • We should publish a note at some point. For now, I present to cardinal model in my thesis but I do not talk about the isomorphism reflection I think. The cardinal model does not indeed validate univalence. – Théo Winterhalter Jun 28 '21 at 09:19
  • 1
    @ThéoWinterhalter This deserves more than a note but a publication in an international conference or journal! You should also consider adding the isomorphism reflection axiom to the standard library. This is perfectly reasonable because, with your model, you prove that it is compatible with other axioms from the standard library. This would not only increase the visibility of your result, but it would help users trying to formalize classical mathematics in Coq instead of joining the growing Lean community. – Bob Jun 28 '21 at 09:56