Answer the question
In order to leave comments, you need to log in
How to complete a proof in Coq?
I am trying to prove a theorem in CoqIDE.
I was given the definition of PRIFIKS
Inductive PRIFIKS {A:Type}: list A -> list A -> Prop :=
| pri_nul : forall (l : list A), PRIFIKS nil l
| pri_g : forall x:A, forall (l1 l2 : list A), PRIFIKS l1 l2 -> PRIFIKS (x::l1) (x::l2).
Theorem Dokaz1: forall A l1 l2, @PRIFIKS A l1 l2 -> exists l3, l2 = l1 ++ l3.
Theorem Dokaz1: forall A l1 l2, @PRIFIKS A l1 l2 -> exists l3, l2 = l1 ++ l3.
Proof.
intros.
destruct l1.
- exists l2.
reflexivity.
- exists [].
assert (H2: (a::l1) = [] -> PRIFIKS [] l2).
* intros.
apply pri_nul.
* assert (H3: PRIFIKS [] l2).
apply pri_nul.
Answer the question
In order to leave comments, you need to log in
With lists, you usually need to prove by induction.
Theorem Dokaz1: forall A l1 l2, @PRIFIKS A l1 l2 -> exists l3, l2 = l1 ++ l3.
proof.
intros.
induction H.
- exists l.
reflexivity.
-destruct IHPRIFIKS.
exists x0.
simpl.
rewrite H0.
reflexivity.
Qed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question