During a proof, I encountered an hypothesis H
. I have lemmas: H -> A
and H -> B
.
How can I duplicate H
in order to deduce two hypotheses A
and B
?
edited: More precisely, I have:
lemma l1: X -> A.
lemma l2: X -> B.
1 subgoals, subgoal 1 (ID: 42)
H: X
=========
Y
But, I want to get:
1 subgoals, subgoal 1 (ID: 42)
H1: A
H2: B
=========
Y
The following tactics prove simple goals. Generally, your aim when writing Coq proofs is to transform your goal until it can be solved using one of these tactics. If the goal is already in your context, you can use the assumption tactic to immediately prove the goal.
In this case, the proof of A /\ B begins with that formula as the goal. This can be transformed into two subgoals, A and B, followed by the proofs of A and B. Coq and its tactics use backward reasoning.
Step 1. Ask a question Writing a hypothesis begins with a research question that you want to answer. The question should be focused, specific, and researchable within the constraints of your project. Do students who attend more lectures get better exam results? Step 2. Do some preliminary research
Coq offers the possibility of loading different parts of a whole development stored in separate files. Their contents will be loaded as if they were entered from the keyboard. This means that the loaded files are text files containing sequences of commands for Coq’s toplevel. This kind of file is called a script for Coq.
If you absolutely need to use an assumption multiple times as you suggested, you can use forward-reasoning tactics such as assert
to do so without clearing it from the context, e.g.
assert (HA := l1 H).
assert (HB := l2 H).
You can also do something like assert (H' := H).
to explicitly copy H
into H'
, although you can usually resort to a more direct way for getting what you want.
Why do you think that you need to duplicate the hypothesis? If you are using it in a proof, it won't become unavailable. See this example:
Parameter A B H : Type.
Parameter lemma1 : H -> A.
Parameter lemma2 : H -> B.
Goal H -> A * B.
intro; split; [apply lemma1 | apply lemma2]; assumption.
Qed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With