Section SortsOfECC.
Inductive calc : Set :=
| Pos : calc
| Neg : calc.
Inductive srt_ecc : Set :=
| Sprop : calc -> srt_ecc
| Stype : calc -> nat -> srt_ecc.
Inductive axiom_ecc : srt_ecc -> srt_ecc -> Prop :=
| ax_prop : forall (c : calc) (n : nat), axiom_ecc (Sprop c) (Stype c n)
| ax_type :
forall (c : calc) (n m : nat),
n < m -> axiom_ecc (Stype c n) (Stype c m).
Inductive rules_ecc : srt_ecc -> srt_ecc -> srt_ecc -> Prop :=
| rule_prop_l : forall (c : calc) (s : srt_ecc), rules_ecc (Sprop c) s s
| rule_prop_r :
forall (c : calc) (s : srt_ecc), rules_ecc s (Sprop c) (Sprop c)
| rule_type :
forall (c1 c2 : calc) (n m p : nat),
n <= p -> m <= p -> rules_ecc (Stype c1 n) (Stype c2 m) (Stype c2 p).
Inductive univ_ecc : srt_ecc -> srt_ecc -> Prop :=
univ_type :
forall (c : calc) (n m : nat),
n <= m -> univ_ecc (Stype c n) (Stype c m).
Definition univ : relation srt_ecc := clos_refl_trans _ univ_ecc.
Hint Resolve ax_prop ax_type rule_prop_l rule_prop_r rule_type univ_type:
pts.
Hint Unfold univ: pts.
(* Inversion et Decidabilite de l'inclusion entre sortes *)
Let univ_trans : forall x y z : srt_ecc, univ x y -> univ y z -> univ x z.
Proof rt_trans srt_ecc univ_ecc.
Inductive inv_univ : srt_ecc -> srt_ecc -> Prop :=
| iu_prop : forall c : calc, inv_univ (Sprop c) (Sprop c)
| iu_type :
forall (c : calc) (n m : nat),
n <= m -> inv_univ (Stype c n) (Stype c m).
Hint Resolve iu_prop iu_type: pts.
simple induction 1; intros; auto with arith pts.
inversion_clear H1.
apply iu_type.
apply le_trans with m; auto with arith pts.
Qed.
simple induction 1.
simple induction 1; auto with arith pts.
simple destruct x; auto with arith pts.
intros.
apply H4.
apply inv_univ_trans with y.
apply H1; auto with arith pts.
apply H3; auto with arith pts.
Qed.
simple destruct c; simple destruct c';
(right; discriminate) || auto with arith pts.
Qed.
simple destruct s; simple destruct s'; intros; try (right; discriminate).
elim calc_dec with c c0; intros.
left; elim a; auto with arith pts.
right; red in |- *; intros H; apply b; injection H; auto with arith pts.
elim eq_nat_dec with n n0; intros.
elim calc_dec with c c0; intros.
left; elim a; elim a0; auto with arith pts.
right; red in |- *; intros H; apply b; injection H; auto with arith pts.
right; red in |- *; intros H; apply b; injection H; auto with arith pts.
Qed.
refine
(fun s s' : srt_ecc =>
match s, s' return (decide (univ s s')) with
| Sprop c, Sprop c' => _
| Stype c n, Stype c' n' => _
| Sprop c, Stype c0 n => right _ _
| Stype c n, Sprop c0 => right _ _
end).
case (calc_dec c c'); [ left | right ].
elim e; auto with arith pts.
red in |- *; intro; apply n.
apply univ_inv with (Sprop c) (Sprop c'); intros; auto with arith pts.
inversion_clear H0; auto with arith pts.
red in |- *; intros.
apply univ_inv with (Sprop c) (Stype c0 n); intros; auto with arith pts.
inversion_clear H0.
red in |- *; intros.
apply univ_inv with (Stype c n) (Sprop c0); intros; auto with arith pts.
inversion_clear H0.
case (calc_dec c c'); intros.
case (le_gt_dec n n'); [ left | right ].
elim e; auto with arith pts.
red in |- *; intros.
apply univ_inv with (Stype c n) (Stype c' n'); intros; auto with arith pts.
inversion_clear H0.
absurd (n <= n'); auto with arith pts.
right; red in |- *; intros; apply n0.
apply univ_inv with (Stype c n) (Stype c' n'); intros; auto with arith pts.
inversion_clear H0; auto with arith pts.
Qed.
(* Inference des axiomes et regles *)

Lemma ecc_inf_axiom :
forall s : srt_ecc, {sp : srt_ecc | ppal (axiom_ecc s) univ sp}.