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

Simplified code with prob_div_mul_refl lemma #1298

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

KaiPhan
Copy link
Contributor

@KaiPhan KaiPhan commented Sep 5, 2024

Hi,

This PR follows #1293 and further simplified more theorems in probabilityTheory.

Kai Phan

@mn200
Copy link
Member

mn200 commented Sep 9, 2024

Where you are calling MATCH_MP_TAC yourlemma followed by simplification, have you tried just

    simp[yourlemma]

if the preconditions are easy for the simplifier to eliminate, it seems as if this would make the proofs simpler still.

@KaiPhan
Copy link
Contributor Author

KaiPhan commented Sep 9, 2024

I already updated code by replace MATCH_MP_TAC yourlemma to simp[yourlemma].
It worked!
Thanks for your advice.

@binghe
Copy link
Member

binghe commented Sep 9, 2024

You can do even better by replacing the tactic pattern:

 >> Know `prob p (A1 INTER B) / prob p B * prob p B = prob p (A1 INTER B)`
 >- simp[prob_div_mul_refl]
 >> Rewr'

with just simp[prob_div_mul_refl]. In this case, the simplifier will search in the subterms of the current proof goal for all possible terms having the pattern x / prob p B * prob p B where B IN events p is in assumptions (or can be easily derived from some assumptions).

Note also that my habit of first doing a Know ... >- (...) and then Rewr' (or Rewr), all using tactics from hurdUtils, is to first prove a subgoal, say P, and immediately put it into the existing proof goal (e.g. Q), to form a new proof goal P ==> Q, and Rewr' (:= DISCH_THEN (fn th => ONCE_REWRITE_TAC [th]) will use P to rewrite Q once, and the whole process does not touch the assumptions at all. Thus, when you are replacing the old subgoal proofs with the one-line simp [...], the remaining Rewr' shouldn't be omitted, even sometimes the whole proof still works (the following rewriting tactics may still strip the subgoal to achieve the same final effects.)

@mn200
Copy link
Member

mn200 commented Sep 10, 2024

Thanks for your work on this!

@mn200 mn200 merged commit 14b4197 into HOL-Theorem-Prover:develop Sep 10, 2024
4 checks passed
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