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

[Merged by Bors] - feat(library/init/logic): mark dif_ctx_congr as @[congr] #378

Closed
wants to merge 1 commit into from

Conversation

semorrison
Copy link
Contributor

mathlib still compiles, and we can simplify inside the condition of a dite:

inductive A (α : Type)
| mk : α → A

@[instance] axiom classical {α : Type} : decidable_eq α

example {α : Type} (a b : α) :
  (if h : A.mk a = A.mk b then true else false) ↔ (if h : a = b then true else false) :=
begin
  simp, -- fails
end

attribute [congr] dif_ctx_congr

example {α : Type} (a b : α) :
  (if h : A.mk a = A.mk b then true else false) ↔ (if h : a = b then true else false) :=
begin
  simp, -- succeeds
end

The example where I wanted this to work actually using the hypothesis h in the branches, and it now works fine.

@cipher1024
Copy link
Contributor

Have you tried building mathlib with it?

@bryangingechen
Copy link
Collaborator

Have you tried building mathlib with it?

The first sentence of the PR is "mathlib still compiles", right?

@cipher1024
Copy link
Contributor

Right, I should read more carefully. This looks good to me. I haven't reviewed a PR for a while. What is the new way of putting one on the build queue?

@bryangingechen
Copy link
Collaborator

You can type bors r+ or equivalently bors merge on its own line in a comment or PR review comment. The PR then gets added to the queue which you can view here (more docs on that page too).

@cipher1024
Copy link
Contributor

Nice! Thanks! So by you explaining it to me, you actually accepted the PR, right?

@bryangingechen
Copy link
Collaborator

No, I didn't put the command on its own line. Didn't want to keep all the fun for myself. 😉

@cipher1024
Copy link
Contributor

Here we go then!

@cipher1024
Copy link
Contributor

bors merge

bors bot pushed a commit that referenced this pull request Jul 3, 2020
mathlib still compiles, and we can simplify inside the condition of a `dite`:

```
inductive A (α : Type)
| mk : α → A

@[instance] axiom classical {α : Type} : decidable_eq α

example {α : Type} (a b : α) :
  (if h : A.mk a = A.mk b then true else false) ↔ (if h : a = b then true else false) :=
begin
  simp, -- fails
end

attribute [congr] dif_ctx_congr

example {α : Type} (a b : α) :
  (if h : A.mk a = A.mk b then true else false) ↔ (if h : a = b then true else false) :=
begin
  simp, -- succeeds
end
```

The example where I wanted this to work actually using the hypothesis `h` in the branches, and it now works fine.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@bors
Copy link

bors bot commented Jul 3, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(library/init/logic): mark dif_ctx_congr as @[congr] [Merged by Bors] - feat(library/init/logic): mark dif_ctx_congr as @[congr] Jul 3, 2020
@bors bors bot closed this Jul 3, 2020
@bors bors bot deleted the dif_ctx_congr branch July 3, 2020 05:17
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

Successfully merging this pull request may close these issues.

3 participants