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

& produces dependent tuples instead of ordinary ones if the constituents are named #3198

Open
chandradeepdey opened this issue Jan 29, 2024 · 2 comments

Comments

@chandradeepdey
Copy link
Contributor

chandradeepdey commented Jan 29, 2024

let this_is_a_pair (a: nat) (b: nat) : nat * nat = a, b

let this_is_a_pair' (a: nat) (b: nat) : a': nat * b': nat = a, b

let this_is_a_pair'' (a: nat) (b: nat) : nat & nat = a, b

[@@expect_failure]
let this_is_not_a_pair (a: nat) (b: nat) : a': nat & b' : nat = a, b

let this_is_a_dpair (a: nat) (b: nat) : a': nat & b' : nat = (|a, b|)
@mtzguido
Copy link
Member

This is intentional :). & has always been the syntax for dependent tuples and, since around 2019 or so I think, it was extended to also represent normal pairs when there is no name for the left component. You can always use * or tuple2 to refer to normal tuples.

See also PR #2816 for a quirk with refinements, which we should probably revive.

@chandradeepdey
Copy link
Contributor Author

Ah, thanks!

Btw, what is the rationale behind having separate “independent” tuples? Why can’t every tuple be a dependent tuple?

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

2 participants