Skip to content
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

Support propositional equality #181

Open
5 of 9 tasks
HuStmpHrrr opened this issue Sep 9, 2024 · 7 comments
Open
5 of 9 tasks

Support propositional equality #181

HuStmpHrrr opened this issue Sep 9, 2024 · 7 comments
Assignees

Comments

@HuStmpHrrr
Copy link
Member

HuStmpHrrr commented Sep 9, 2024

We should add propositional equality. There are three terms:

  1. Eq A a b which is the type;
  2. refl A a is the only constructor;
  3. J is the elimination principle; check ITT for an exact formulation.

We need the following things:

@HuStmpHrrr
Copy link
Member Author

We use ext/prop-eq for this extension, and then eventually merge it to main.

@HuStmpHrrr
Copy link
Member Author

HuStmpHrrr commented Sep 15, 2024

As per
image
we do not need to change the subtyping rule at all for equality.

c.f. https://coq.inria.fr/doc/V8.18.0/refman/language/cic.html#subtyping-rules

also

Axiom x y : Set.

Definition foo : Type := x.

Axiom bar : @eq Set x y.

Fail Definition baz : @eq Type x y := bar.

This subtyping rule might be too conservative. I intend to believe that we should be able to let subtyping to apply for A in Eq A a b but we should leave this for the future.

@HuStmpHrrr
Copy link
Member Author

thinking about it twice, I think we cannot let subtyping to propagate in any inductive data types. consider just equality. If we allowed subtyping so that if A <: B, then Eq A a b <: Eq B a b, then we immediately lose canonicity of equality. because now refl A a can also be a constructor of Eq B a a, while otherwise, refl B a is the only possible constructor. Clearly, refl A a and refl B a cannot be related. we should really be careful about our intuition with the presence of subtyping.

@Ailrun
Copy link
Member

Ailrun commented Sep 18, 2024

How about contravariant subtyping for pi types? It has a similar problem: \lambda B 5 is of \Pi B \BbbN, but not directly of \Pi A \BbbN (for a subtype A of B)

@HuStmpHrrr
Copy link
Member Author

I tend to believe negative types are better off due to eta expansion. The same probably applies to products.

@Ailrun
Copy link
Member

Ailrun commented Sep 18, 2024

So you mean any positive types should not allow subtyping? Hm, that might be the case...

@Ailrun
Copy link
Member

Ailrun commented Oct 24, 2024

Soundness is not just "tedious". It requires quite a significant change in proofs. For one of simpler examples, we need to change glu_univ_elem_typ_monotone and glu_univ_elem_exp_monotone to be mutually proved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants