Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to duplicate a hypothesis in Coq?

Tags:

coq

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
like image 557
Necto Avatar asked Dec 07 '14 15:12

Necto


People also ask

How do you prove simple goals in Coq?

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.

How do you prove A and B in Coq?

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.

How do you write a hypothesis for an exam?

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

What is a Coq script?

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.


2 Answers

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.

like image 105
Arthur Azevedo De Amorim Avatar answered Oct 17 '22 03:10

Arthur Azevedo De Amorim


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.
like image 1
gallais Avatar answered Oct 17 '22 02:10

gallais