Section Dickson.
Variable A B : Set.
Variable lt : Rel A.
Variable R : Rel B.
Variable wfgt : well_founded lt.
Variable declt : DecRel A lt.
Variable wR : WR B R.
Definition leq (a b : A) := ~ lt b a.
Definition GBarlR := GRBar (A * B) (ProdRel A B leq R).
Definition sndL := map (fun p : A * B => snd p).
Definition MinD :=
Min (A * B) (fun p q : A * B => lt (fst p) (fst q)) (ProdRel A B leq R).
Definition prod_lt (a b : A * B) := lt (fst a) (fst b).
unfold prod_lt in |- *; apply wf_inverse_image with (B := A); auto.
Qed.
intros l; elim l; simpl in |- *; auto.
intros a H' H'0; inversion H'.
intros a l0 H' a0 H'0 H'1; inversion H'0.
simpl in H0; simpl in H1; simpl in H.
case (declt (fst a0) (fst a)); intros LtE.
change (GBarlR ((a0 :: nil) ++ (a :: nil) ++ l0)) in |- *; auto.
red in |- *; apply monGRBar; simpl in |- *; auto.
inversion H'1; auto.
red in |- *; red in |- *; apply Base.
apply FoundG.
apply FoundE.
unfold ProdRel in |- *; split; auto.
simpl in H0; simpl in H1; simpl in H.
change (GBarlR ((a0 :: nil) ++ (a :: nil) ++ l0)) in |- *; auto.
red in |- *; apply monGRBar; simpl in |- *; auto.
inversion H'1; simpl in |- *; auto.
apply H'; auto.
Qed.
intros l; elim l; auto.
intros H'; inversion H'.
intros a l0 H' H'0; inversion H'0; auto.
intros us; elim us; simpl in |- *; auto.
intros; discriminate.
intros a1 l2 H'1 H'2 H'3; inversion H'2.
apply lem0; auto.
rewrite <- H3; rewrite <- H4; auto.
inversion H'3; auto.
intros us; elim us; unfold sndL in |- *; simpl in |- *; auto.
intros; discriminate.
intros a1 l2 H'1 H'2 H'3; inversion H'2.
change (GBarlR (nil ++ (a1 :: nil) ++ l2)) in |- *.
red in |- *; apply monGRBar; simpl in |- *; auto.
apply H'; auto.
inversion H'3; auto.
Qed.
intros us H' H'0.
apply lem1aux with (l := sndL us); auto.
Qed.
intros bs H'; elim H'; auto.
intros l H'0 us H'1 H'2.
apply lem1; auto.
rewrite <- H'1; auto.
intros l H'0 H'1 us H'2 H'3; red in |- *.
apply OpenInd with (lt := prod_lt); auto.
exact WFlem1.
intros a H'4.
apply H'1 with (a := snd a); auto.
rewrite H'2; auto.
Qed.
red in |- *; apply keylem with (bs := nil (A:=B)); auto.
red in |- *; auto.
apply nmin; auto.
Qed.
End Dickson.
(* Now we transfer this result to another  representation: *)
intros.
case (le_or_lt a b).
auto.
intro.
unfold leq in H.
unfold not in H.
case (H H0).
Qed.
Definition jj : forall d : nat, mon d :=
(fix jj (d : nat) : mon d :=
match d as n return (mon n) with
| O => n_0
| S n => c_n n 0 (jj n)
end).
intros d m; elim m.
simpl in |- *; auto.
intros d0 n m0 H' H'0; inversion H'0.
Qed.

Theorem jjProp2 : jj 0 = n_0.