Open Scope Z.
Module Type ACR_DEC.
Parameter align_compatible_rec_dec:
forall {cs: compspecs},
forall t z, {align_compatible_rec cenv_cs t z} + {~ align_compatible_rec cenv_cs t z}.
End ACR_DEC.
Module align_compatible_rec_dec: ACR_DEC.
Section align_compatible_rec_dec.
Context {cs: compspecs}.
Definition dec_type := sigT (fun P: Z -> Prop => forall z: Z, {P z} + {~ P z}).
Definition dec_by_value (ch: memory_chunk): dec_type :=
existT (fun P: Z -> Prop => forall z: Z, {P z} + {~ P z}) (fun z => (Memdata.align_chunk ch | z)) (fun z => Zdivide_dec (Memdata.align_chunk ch) z (Memdata.align_chunk_pos _)).
Definition dec_False: dec_type :=
existT (fun P: Z -> Prop => forall z: Z, {P z} + {~ P z}) (fun z => False) (fun z => right (fun H => H)).
Definition dec_True: dec_type :=
existT (fun P: Z -> Prop => forall z: Z, {P z} + {~ P z}) (fun z => True) (fun z => left I).
Fixpoint cons_in_list {A} (a: A) (al' al: list A) (H: forall x, In x al' -> In x al) (bl: list {x:A| In x al'}) : list {x: A | In x al} :=
match bl with
| nil => nil
| exist x i :: bl0 =>exist _ x (H x i)  :: cons_in_list a al' al H bl0
end.
Fixpoint make_in_list {A} (al: list A) : list {x: A | In x al} :=
match al as ax return (al = ax -> list {x : A | In x ax}) with
| nil => fun _ => nil
| a::al' => fun H: al = a::al' =>
exist _ a (or_introl eq_refl) ::
eq_rect al (fun l : list A => list {x : A | In x l})
(cons_in_list a al' al (fun (x : A) (H0 : In x al') =>
eq_ind_r (fun al0 : list A => In x al0) (in_cons _ _ _ H0) H)
(make_in_list al'))
(a :: al') H
end (eq_refl _).

Lemma align_compatible_rec_dec: forall t z, {align_compatible_rec cenv_cs t z} + {~ align_compatible_rec cenv_cs t z}.
End align_compatible_rec_dec.