I want to proof the factor function correctness in Use proof of if expression = true in then part coq
Require Import ZArith Znumtheory.
Local Open Scope Z_scope.
Require Coq.Program.Tactics.
Require Coq.Program.Wf.
Lemma divgt0 ( a b : Z ) ( agt0 : 0 < a ) ( bgt1 : 1 < b ) (dvd : (b|a) ) : 0<a/b.
Proof.
apply Zdivide_Zdiv_lt_pos.
auto.
auto.
auto.
Qed.
Program Fixpoint factor ( a b : Z ) ( agt0 : 0 < a ) ( bgt1 : 1 < b ) {measure (Z.abs_nat a)} :=
if Zdivide_dec b a
then 1+factor (a/b) b (divgt0 a b agt0 bgt1 _) bgt1
else 0.
Next Obligation.
assert ( 0 < a / b < a ).
apply Zdivide_Zdiv_lt_pos.
auto.
auto.
auto.
apply Zabs_nat_lt.
omega.
Qed.
Lemma factor_div ( a b : Z ) ( agt0 : 0 < a ) ( bgt1 : 1 < b ) : (b ^ (factor a b agt0 bgt1) | a).
Proof.
unfold factor.
after unfold I expected see a if and destruct its condition , but now I see this :
1 subgoal
a, b : Z
agt0 : 0 < a
bgt1 : 1 < b
______________________________________(1/1)
(b
^ factor_func
(existT (fun a0 : Z => {b0 : Z & {_ : 0 < a0 & 1 < b0}}) a
(existT (fun b0 : Z => {_ : 0 < a & 1 < b0}) b
(existT (fun _ : 0 < a => 1 < b) agt0 bgt1))) | a)
How I can complete the proof?