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

Proof by "the following are equivalent" #373

Merged
merged 5 commits into from Oct 4, 2018

Conversation

cipher1024
Copy link
Collaborator

@cipher1024 cipher1024 commented Sep 26, 2018

tactic for decomposing a proof into a set of equivalent propositions which can be proved equivalent by cyclical implications

With @jcommelin @rwbarton and @digama0.

TO CONTRIBUTORS:

Make sure you have:

  • reviewed and applied the coding style: coding, naming
  • for tactics:
  • make sure definitions and lemmas are put in the right files
  • make sure definitions and lemmas are not redundant

For reviewers: code review check list

equivalent propositions which can be proved equivalent by cyclical
implications
Copy link
Member

@PatrickMassot PatrickMassot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments. Thanks Simon, Johan, Mario and Reid!

docs/tactics.md Outdated
expression of the form `i arrow j`, where `i` and `j` are two positive
natural numbers, and `arrow` is an arrow such as `→`, `->`, `←`, `<-`,
`↔`, or `<->`. The tactic `tfae_have : i arrow j` sets up a subgoal in
which the user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the end of the sentence?

docs/tactics.md Outdated
`↔`, or `<->`. The tactic `tfae_have : i arrow j` sets up a subgoal in
which the user

The remaining tactics, `tfae_finish`, is a finishing tactic. It
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tactics -> tactic


Data structures and algorithms for finding the sets of equivalent
proposition in a set of implications.
-/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does scc stands for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strongly connected components in graph theory. I can add that to the header.

tactic/scc.lean Outdated
do `(%%p ↔ %%q) ← target >>= whnf,
cl.prove_eqv p q >>= exact

meta def interactive.check_eqv : tactic unit :=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interactive tactic but doesn't seem documented. Same remark for other tactics below.

@@ -3849,6 +3849,54 @@ def map_last {α} (f : α → α) : list α → list α
| [x] := [f x]
| (x :: xs) := x :: map_last xs

/- tfae: The Following (propositions) Are Equivalent -/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment should be a doc comment on tfae

tactic/scc.lean Outdated
p₂ ← mk_app ``iff.symm [p₀],
p ← mk_app ``iff.trans [p₂,p],
p ← mk_app ``iff.trans [p,p₁],
m ← read_ref cl,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is unnecessary

tactic/scc.lean Outdated
do (r,p₀) ← root cl e₀,
(r',p₁) ← root cl e₁,
b ← try_core $ is_def_eq r r',
pure b.is_some
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

succeeds does this

rewrite_target tfae_cons, split,
prove_eqv_target cl },
applyc ``tfae_singleton,
pure ())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like scc likes to prove everything equivalent to a "root" vertex. So why don't you use a tfae constructor of that form?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What form do you mean?

Copy link
Member

@digama0 digama0 Sep 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this:

theorem tfae_iff_forall : tfae (a :: l) ↔ ∀ b ∈ l, a ↔ b

Not sure if you always pick the root to be the first vertex or you prefer some other vertex, in which case this can be modified.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean. No, there's no determination of which one is being used. There's also no guarantee that the root is part of the list, in case you prove implications with other propositions and that they contribute to the cycles.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, you could use this:

theorem tfae_of_forall (a : Prop) (h : ∀ b ∈ l, a ↔ b) : tfae l

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, that would work. Are you preferring this approach because it will produce smaller proof terms or do you also think it will be faster?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just made the change and pushed it.

@johoelzl
Copy link
Collaborator

johoelzl commented Oct 4, 2018

looks good for me

@johoelzl johoelzl merged commit 9ec21e4 into leanprover-community:master Oct 4, 2018
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.

None yet

5 participants