I know in OCaml the syntax
let x = val in exp
means x
has the value v
when in expression exp
.
But what does something like
let add_left_red := eval red in add_left in (* reduce add_left, but leave goal alone *)
idtac add_left_red.
I assume it does this:
- gives the identifier
add_left_red
the output ofeval red
- then that
add_left_red
is that value inadd_left
- AND in
idtac add_left_red
Is that what it does?
Fyi I also have no idea what that line does. Especially cuz googling eval
and red
gave nothing useful.
Tacticidtac ident string natural *
Leaves the proof unchanged and prints the given tokens. Strings and naturals are printed literally. If ident is an Ltac variable, its contents are printed; if not, it is an error.
What do those composoble blocks do?
Context whole script
Fixpoint add_left (n m : nat) : nat :=
match n with
| O => m
| S p => S (add_left p m)
end.
Lemma demo_1 :
forall (n : nat),
add_left n O = n.
Proof.
intros. (* goal : add_left n O = n *)
let add_left_red := eval red in add_left in (* reduce add_left, but leave goal alone *)
idtac add_left_red. (* print the result *)
(* Print eval. gives error *)
Print red.
Print add_left_red.
admit.
Abort.