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

Define boole? #1472

Closed
semorrison opened this issue Sep 23, 2019 · 15 comments
Closed

Define boole? #1472

semorrison opened this issue Sep 23, 2019 · 15 comments
Labels
feature-request This issue is a feature request, either for mathematics, tactics, or CI

Comments

@semorrison
Copy link
Collaborator

semorrison commented Sep 23, 2019

Per discussions at

I would want such a definition to be reducible or even an abbreviation, to avoid compelling people to use it:

abbreviation boole {A : Type u} [has_zero A] [has_one A] (b : bool) : A := if b then 1 else 0

example {P : Prop} [decidable P] : ℕ := boole P

It's not super important, but has come up several times recently so I thought I'd record it here.

@semorrison
Copy link
Collaborator Author

If anyone implements this, it might be worth grepping for if.*then 1 else 0 and ite.* 1 0 and seeing if any occurrences are clearer when using boole instead.

@jcommelin
Copy link
Member

Would it make sense to even stack a dirichlet delta on top of this?

@fpvandoorn
Copy link
Member

The name for this in math (or maybe only physics?) is the Kronecker Delta function, right?

@jcommelin
Copy link
Member

Oops... my bad

@rwbarton
Copy link
Collaborator

This is also the Iverson bracket, though I definitely don't suggest using that notation!
I'm not sure I understand the proposed name boole, though I also don't have another name in mind.

@digama0
Copy link
Member

digama0 commented Sep 25, 2019

I think Boole gets the credit for considering propositions as a ring with 0 and 1, but I forget exactly where I've heard this name before. Mathematica?

@semorrison
Copy link
Collaborator Author

semorrison commented Sep 26, 2019 via email

@digama0
Copy link
Member

digama0 commented Sep 26, 2019

I definitely recommend against using the Iverson bracket notation. Besides the fact that brackets are way overloaded already, this is not even common notation in math. I think that {\bf 1}_P (x) is a more common way to notate this, but I would suggest using no notation for it and just using the named function.

@avigad
Copy link
Collaborator

avigad commented Sep 26, 2019

The function x -> if P x then 1 else 0 is often called the "indicator function" for P. Would it help to define indicator P and then take this particular one to be indicator (eq x)?

@rwbarton
Copy link
Collaborator

Oh yes, I also meant to suggest a name based on "characteristic function" or "indicator function", though "characteristic" is too overloaded I think.

@urkud
Copy link
Member

urkud commented Dec 30, 2019

I'm not sure what will be better:

  • Should it take s : set α, α → Prop or α → bool as an argument?
  • Should it use as the codomain or should it take the codomain as an argument?
  • If it takes to codomain as an argument, should it be an explicit argument?

BTW, do we have statements like (∀ x, decidable (x ∈ s)) → (∀ x, decidable (x ∈ t)) → ∀ x, decidable (x ∈ (s ∪ t)) and similarly for other operations?

@rwbarton
Copy link
Collaborator

Related: integrals over subsets #1875.

@urkud
Copy link
Member

urkud commented Jan 21, 2020

We have indicator in data/indicator_function #1875. Should we close this issue?

@bryangingechen bryangingechen added the feature-request This issue is a feature request, either for mathematics, tactics, or CI label Mar 30, 2020
@jalex-stark
Copy link
Collaborator

We have indicator in data/indicator_function #1875. Should we close this issue?

I suppose there's still the task of propagating the use of indicator out to places where ite is currently used.

@urkud
Copy link
Member

urkud commented Oct 4, 2020

@jalex-stark I don't think that it makes sense to have a tracking issue without a list of places where ite should be replaced with indicator. Feel free to open a new issue with an itemized list of such places (or just replace ite with indicator here and there).

@urkud urkud closed this as completed Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue is a feature request, either for mathematics, tactics, or CI
Projects
None yet
Development

No branches or pull requests

9 participants