mirror of
https://github.com/achlipala/frap.git
synced 2024-12-01 00:26:18 +00:00
Small improvements to IntroToProofScripting
This commit is contained in:
parent
256995f1dd
commit
76970fb98e
2 changed files with 8 additions and 9 deletions
|
@ -373,7 +373,7 @@ Ltac completer :=
|
||||||
| [ |- _ /\ _ ] => constructor
|
| [ |- _ /\ _ ] => constructor
|
||||||
| [ |- forall x, _ ] => intro
|
| [ |- forall x, _ ] => intro
|
||||||
| [ |- _ -> _ ] => intro
|
| [ |- _ -> _ ] => intro
|
||||||
(* Interestingly, these last two rules are redundant.
|
(* Interestingly, the last rule is redundant with the second-last.
|
||||||
* See CPDT for details.... *)
|
* See CPDT for details.... *)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -859,21 +859,23 @@ Section t7'.
|
||||||
Qed.
|
Qed.
|
||||||
End t7'.
|
End t7'.
|
||||||
|
|
||||||
|
(* One more example of working with existentials: *)
|
||||||
|
|
||||||
Theorem t8 : exists p : nat * nat, fst p = 3.
|
Theorem t8 : exists p : nat * nat, fst p = 3.
|
||||||
Proof.
|
Proof.
|
||||||
econstructor.
|
econstructor.
|
||||||
instantiate (1 := (3, 2)).
|
instantiate (1 := (3, 2)).
|
||||||
|
(* ^-- We use [instantiate] to plug in a value for one of the "question-mark
|
||||||
|
* variables" in the conclusion. The [1 :=] part says "first such variable
|
||||||
|
* mentioned in the conclusion, counting from right to left." *)
|
||||||
equality.
|
equality.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
(* A way that plays better with automation: *)
|
(* A way that plays better with automation: *)
|
||||||
|
|
||||||
Ltac equate x y :=
|
|
||||||
let dummy := constr:(eq_refl x : x = y) in idtac.
|
|
||||||
|
|
||||||
Theorem t9 : exists p : nat * nat, fst p = 3.
|
Theorem t9 : exists p : nat * nat, fst p = 3.
|
||||||
Proof.
|
Proof.
|
||||||
econstructor; match goal with
|
econstructor; match goal with
|
||||||
| [ |- fst ?x = 3 ] => equate x (3, 2)
|
| [ |- fst ?x = 3 ] => unify x (3, 2)
|
||||||
end; equality.
|
end; equality.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
|
@ -545,12 +545,9 @@ Qed.
|
||||||
|
|
||||||
(* A way that plays better with automation: *)
|
(* A way that plays better with automation: *)
|
||||||
|
|
||||||
Ltac equate x y :=
|
|
||||||
let dummy := constr:(eq_refl x : x = y) in idtac.
|
|
||||||
|
|
||||||
Theorem t9 : exists p : nat * nat, fst p = 3.
|
Theorem t9 : exists p : nat * nat, fst p = 3.
|
||||||
Proof.
|
Proof.
|
||||||
econstructor; match goal with
|
econstructor; match goal with
|
||||||
| [ |- fst ?x = 3 ] => equate x (3, 2)
|
| [ |- fst ?x = 3 ] => unify x (3, 2)
|
||||||
end; equality.
|
end; equality.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
Loading…
Reference in a new issue