Notation "phi --> psi" := (Impl phi psi) (right associativity, at level 55).
Notation "∀ v ; phi" := (All v phi) (at level 56, right associativity).
Notation "⊥" := (Fal).
Notation "¬ phi" := (phi --> ⊥) (at level 20).
Section fixb. Variable b : logic.
Fixpoint impl (A : list (form b)) phi :=
match A with
| [] => phi
| psi :: A => Impl psi (impl A phi)
end.
End fixb.
Notation "A ==> phi" := (impl A phi) (right associativity, at level 55).
(** ** Enumerability *)
Fixpoint L_term n : list term :=
match n with
| 0 => [t_e]
| S n => L_term n ++ [V n; P n] ++ [ t_f b t | (b,t) ∈ (L_T bool n × L_term n) ]
end.
Instance enumT_term : enumT term.
Fixpoint L_form {b} n : list (form b) :=
match n with
| 0 => []
| S n => L_form n
++ [Q]
++ [ Pr s t | (s,t) ∈ (L_T term n × L_T term n) ]
++ [ phi1 --> phi2 | (phi1, phi2) ∈ (L_form n × L_form n) ]
++ [ ∀ n; phi | (n,phi) ∈ (L_T nat n × L_form n) ]
++ match b with
frag => []
| full => [Fal]
end
end.
Instance enumT_form {b} : enumT (form b).
Proof with (try eapply cum_ge'; eauto; omega).
exists L_form.
- eauto.
- intros phi. induction phi.
+ destruct (el_T t) as [m1], (el_T t0) as [m2]. exists (1 + m1 + m2). cbn.
in_app 3. in_collect (t, t0)...
+ exists 1. cbn; eauto.
+ exists 1; cbn; firstorder.
+ destruct IHphi1 as [m1], IHphi2 as [m2]. exists (1 + m1 + m2). cbn.
in_app 4. in_collect (phi1, phi2)...
+ destruct IHphi as [m1], (el_T n) as [m2]. exists (1 + m1 + m2). cbn -[L_T].
in_app 5. in_collect (n, phi)...
Qed.
Instance dec_term : eq_dec term.
Instance dec_logic : eq_dec logic.

(* Specifications: *)
Lemma dec_form {b1 b2} phi1 phi2 : dec (eq_dep logic form b1 phi1 b2 phi2).
Instance eq_dec_form {b : logic} phi1 phi2 : dec (phi1 = phi2 :> form b).