1
1
2
- (* DEMO FILE FOR THE LIBHYPS LIBRARY FEATURES.
2
+ (* DEMO FILE FOR THE LIBHYPS LIBRARY FEATURES. *)
3
3
4
- This acts as a documentation.
4
+ (* This acts as a documentation for LibHyps. *)
5
5
6
- You can install LibHyps with opam with
6
+ (* WARNING: You can play this file in any IDE but beware that it
7
+ contains "Undo" at many places and that your IDE may not support it.
8
+ In this case you can edit the script by commenting things instead of
9
+ playing the Undos. *)
7
10
8
- opam install coq_libhyps
9
- *)
11
+ (* You can install LibHyps with opam with:
12
+
13
+ opam install coq_libhyps *)
10
14
11
- (* (set-face-attribute 'proof-declaration-name-face nil
12
- :bold nil :foreground "white") *)
13
15
(*** Proof maintenance ** *)
14
16
Unset Printing Compact Contexts.
15
17
Require Import Arith ZArith List.
@@ -107,29 +109,31 @@ Lemma foo: forall (x:nat) (b1:bool) (y:nat) (b2:bool),
107
109
Proof .
108
110
intros.
109
111
(* BIG HYPS may clutter the goal. IDE solution. *)
110
- (* 1. Just hide it by clicking on its button, or hit "f"
111
- while cursor on its name. Persistent and simply based
112
- on hyp name. *)
112
+ (* 1. ProofGeneral: just hide it by clicking on its button, or hit
113
+ "f" while cursor on its name. Persistent and simply based on
114
+ hyp name. *)
113
115
114
116
(* 2. Big hyps ask for "non verbose forward reasoning". *)
115
- (* Since a few years: "specialize" now re-quantifies. *)
117
+ (* Since a few years coq allows "specialize" to re-quantifies
118
+ non-unified premisses. *)
116
119
specialize H3 with (1:= le_S _ _ (le_n 0)).
117
120
118
- (* More of the same: new tactic "especialize" starts a goal
119
- to instantiate a dependent premiss of a hyp, and then
120
- re-quantifies everything non instantiated. *)
121
+ (* Our tactic "especialize" starts a goal to instantiate a dependent
122
+ premiss of a hyp, and then re-quantifies everything non
123
+ instantiated. *)
121
124
Undo.
122
125
especialize H3 at 1.
123
126
{ apply le_S.
124
127
apply le_n. }
125
128
Undo 5.
126
-
129
+ (* IDEs don't like Undo, replay the next ocommand twice will resync
130
+ proofgeneral. *)
127
131
(* It accepts several (up to 7) premisses numers. *)
128
132
especialize H3 at 2,3.
129
133
Undo.
130
134
131
135
(* you can ask a goal for all premisses, in the spirit of the
132
- "exploit" tactic from CompCert. *)
136
+ "exploit" tactic from CompCert. *)
133
137
especialize H3 at *.
134
138
Undo.
135
139
@@ -179,13 +183,7 @@ Proof.
179
183
(* experimental: (setq coq-libhyps-intros t) *)
180
184
Undo 2.
181
185
Show.
182
- (* PG's "smart intros" adapts *)
183
-
184
- (* company-coq "guess names" has the same back-end. *)
185
-
186
- (* better with colors. *)
187
- (* (set-face-attribute 'proof-declaration-name-face nil :bold nil :foreground "white")
188
- (set-face-attribute 'proof-declaration-name-face nil :bold nil :foreground "orange") *)
186
+
189
187
Restart.
190
188
Show.
191
189
(* Again, better combine it with ";;". *)
@@ -201,8 +199,7 @@ Proof.
201
199
(* Long names, this is configurable (next demo), but IDE provides
202
200
easy ways to see them (highlight) and to input them:
203
201
- middle-click on hyp's name.
204
- - completion (company-coq).
205
- demo. *)
202
+ - completion (company-coq). *)
206
203
207
204
(* tactic that generate names can be easily tamed. *)
208
205
decompose [ex and or] h_ex_and_neq_and_/sng.
@@ -280,6 +277,11 @@ Proof.
280
277
Ltac rename_depth ::= constr:(3).
281
278
282
279
intros/n/g.
280
+ Undo.
281
+ (* Have shorter names: *)
282
+ Ltac rename_depth ::= constr:(2).
283
+ intros/n/g.
284
+
283
285
284
286
Abort .
285
287
0 commit comments