Skip to content

Commit

Permalink
add parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-lamiaux committed Dec 28, 2024
1 parent 44286d8 commit d89551e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Tutorial_intro_patterns.v
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ Abort.
*)

Goal forall P Q, P /\ Q -> Q /\ P.
intros P Q x. destruct H as [H1 H2]. split
intros P Q H. destruct H as [H1 H2]. split.
+ assumption.
+ assumption.
Qed.

Goal forall P Q, P \/ Q -> Q \/ P.
Proof.
intros P Q x. destruct H as [H1 | H2].
intros P Q H. destruct H as [H1 | H2].
+ right. assumption.
+ left. assumption.
Qed.
Expand Down Expand Up @@ -237,18 +237,18 @@ Goal forall P Q R, (P \/ Q) /\ R -> P /\ R \/ Q /\ R.
+ right. split; assumption.
Qed.

Goal forall P Q R, P /\ Q /\ R -> R /\ Q /\ P.
Goal forall P Q R, P /\ (Q /\ R) -> R /\ (Q /\ P).
intros P Q R [p [q r]].
Abort.

(** Actually, the latter pattern is common enough that there is a specific intro-pattern for it.
When the goal is of the form [X Op1 Y ... Opk W] where all the binary operation
When the goal is of the form [X Op1 (Y ... Opk W)] where all the binary operation
have one constructor with two arguments like [/\], then it is possible to
introduce the variables with [intros (p & q & r & h)] rather than by having to
destruct recursively with [intros [p [q [r h]]] ].
*)

Goal forall P Q R H, P /\ Q /\ R /\ H -> H /\ R /\ Q /\ P.
Goal forall P Q R H, P /\ (Q /\ (R /\ H)) -> H /\ (R /\ (Q /\ P)).
Proof.
intros * (p & q & r & h).
Abort.
Expand Down

0 comments on commit d89551e

Please sign in to comment.