fact
stringlengths
2
32.6k
type
stringclasses
10 values
library
stringclasses
5 values
imports
stringclasses
205 values
filename
stringclasses
216 values
symbolic_name
stringlengths
1
67
index_level
int64
0
10.5k
x y := EdgeSet.add y (EdgeSet.singleton x).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
EdgeSet_pair
800
x y z := EdgeSet.add z (EdgeSet_pair x y).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
EdgeSet_triple
801
(gc : GoodConstraint.t) : EdgeSet.elt := match gc with | GoodConstraint.gc_le l z l' => (vtn l, z, vtn l') | GoodConstraint.gc_lt_set_level k s => (lzero, Z.of_nat (S k), vtn (VariableLevel.level s)) | GoodConstraint.gc_le_set_var k n => (lzero, Z.of_nat k, vtn (VariableLevel.lvar n)) | GoodConstraint.gc_le_level_set s k => (vtn (VariableLevel.level s), (- Z.of_nat k)%Z, lzero) | GoodConstraint.gc_le_var_set n k => (vtn (VariableLevel.lvar n), (- Z.of_nat k)%Z, lzero) end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
edge_of_constraint
802
g : (edge_of_level g)..s = lzero. Proof. destruct g; reflexivity. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
source_edge_of_level
803
g : (edge_of_level g)..t = vtn g. Proof. destruct g; reflexivity. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
target_edge_of_level
804
(l : Level.t) : option VariableLevel.t := match l with | Level.lzero => None | Level.level s => Some (VariableLevel.level s) | Level.lvar n => Some (VariableLevel.lvar n) end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
variable_of_level
805
l : option EdgeSet.elt := match variable_of_level l with | None => None | Some ll => Some (edge_of_level ll) end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
option_edge_of_level
806
VSet.fold (fun l E => match variable_of_level l with | None => E | Some ll => EdgeSet.add (edge_of_level ll) E end).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
add_level_edges
807
ctrs := GoodConstraintSet.fold (fun ctr => EdgeSet.add (edge_of_constraint ctr)) ctrs.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
add_cstrs
808
e x g : EdgeSet.In e (add_cstrs x g) <-> (exists c, edge_of_constraint c = e /\ GoodConstraintSet.In c x) \/ EdgeSet.In e g. Proof. rewrite /add_cstrs GoodConstraintSet.fold_spec. transitivity ((exists c, edge_of_constraint c = e /\ In c (GoodConstraintSet.elements x)) \/ EdgeSet.In e g). - induction (GoodConstraintSet.elements x) in g |- *; simpl. intuition auto. now destruct H0 as [c [_ F]]. rewrite IHl. rewrite EdgeSet.add_spec. split. * intros [[c [eq inl]]|?]. subst e. left. repeat eexists; tea. now right. destruct H as [->|ing]; [left|right]; auto. exists a; firstorder auto. * intros [[c [eq [->|inl]]]|?]; auto. left; exists c; auto. - setoid_rewrite (GoodConstraintSetFact.elements_iff x). now setoid_rewrite InA_In_eq. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
add_cstrs_spec
809
Proper (Logic.eq ==> EdgeSet.Equal ==> EdgeSet.Equal)%signature add_cstrs. Proof. intros s s' eq x y H. intros e. rewrite /add_cstrs. rewrite !GoodConstraintSet.fold_spec. subst s'. induction (GoodConstraintSet.elements s) in x, y, H, e |- *; cbn; auto. apply IHl. now rewrite H. Qed.
Instance
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
add_cstrs_proper
810
Proper (GoodConstraintSet.Equal ==> EdgeSet.Equal ==> EdgeSet.Equal)%signature add_cstrs. Proof. intros s s' eq x y H. red in H. intros e. rewrite !add_cstrs_spec. rewrite H. firstorder auto. Qed.
Instance
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
add_cstrs_proper'
811
(uctx : VSet.t * GoodConstraintSet.t) : t := let init_edges := add_level_edges uctx.1 EdgeSet.empty in let edges := add_cstrs uctx.2 init_edges in (uctx.1, edges, lzero).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
make_graph
812
uctx e : EdgeSet.In e (wGraph.E (make_graph uctx)) <-> (exists l, VSet.In (vtn l) uctx.1 /\ e = edge_of_level l) \/ (GoodConstraintSet.Exists (fun gc => e = edge_of_constraint gc) uctx.2). Proof. unfold make_graph. unfold wGraph.E. simpl. assert (XX: forall E, EdgeSet.In e (GoodConstraintSet.fold (fun ctr => EdgeSet.add (edge_of_constraint ctr)) uctx.2 E) <-> (exists gc, In gc (GoodConstraintSet.elements uctx.2) /\ e = edge_of_constraint gc) \/ EdgeSet.In e E). { intro E. rewrite GoodConstraintSet.fold_spec. induction (GoodConstraintSet.elements uctx.2) in E |- *. - cbn. firstorder. - simpl. etransitivity. apply IHl. clear IHl. split. + intros [[gc H]|H]. left. exists gc. intuition. apply EdgeSet.add_spec in H. destruct H as [H|H]. left. exists a. intuition. right; tas. + intros [[gc [[H1|H1] H2]]|H]. right. apply EdgeSet.add_spec. left; now subst. left. exists gc. split; tas. right. apply EdgeSet.add_spec. right; tas. } etransitivity. apply XX. clear XX. etransitivity. apply or_comm. etransitivity. apply or_iff_compat_l. 2: apply or_iff_compat_r. - apply iff_ex; intro gc. apply and_iff_compat_r. symmetry. etransitivity. apply GoodConstraintSetFact.elements_iff. apply InA_In_eq. - transitivity ((exists l, In (vtn l) (VSet.elements uctx.1) /\ e = edge_of_level l) \/ EdgeSet.In e EdgeSet.empty). 2:{ split. intros [[l [H1 H2]]|H]. exists l. split; tas. apply InA_In_eq, VSetFact.elements_iff in H1; tas. now apply EdgeSetFact.empty_iff in H. intros [l [H1 H2]]. left. exists l. split. apply InA_In_eq, VSetFact.elements_1; tas. tas. } unfold add_level_edges; rewrite VSet.fold_spec. generalize EdgeSet.empty. induction (VSet.elements uctx.1). + cbn. intro E; firstorder. + intro E. etransitivity. apply IHl. split. * intro HH. destruct HH as [[l' Hl]|HH]. left. exists l'. intuition. destruct a as [|l'|l']. right; tas. all: apply EdgeSet.add_spec in HH; destruct HH; [left|right; tas]. exists (VariableLevel.level l'); intuition. exists (VariableLevel.lvar l'); intuition. * intros [[l' [[H1|H1] H2]]|H]. right. subst a. destruct l'; apply EdgeSet.add_spec; left; tas. destruct l'; left; [exists (VariableLevel.level t0)|exists (VariableLevel.lvar n)]; intuition. right. destruct a; tas; apply EdgeSet.add_spec; right; tas. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
make_graph_E
813
(v : valuation) : labelling := fun x => match x with | lzero => 0 | Level.level l => Pos.to_nat (v.(valuation_mono) l) | Level.lvar n => (v.(valuation_poly) n) end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
labelling_of_valuation
814
(l : labelling) : valuation := {| valuation_mono := fun s => Pos.of_nat (l (vtn (VariableLevel.level s))); valuation_poly := fun n => l (vtn (VariableLevel.lvar n)) |}.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
valuation_of_labelling
815
l (Hl : correct_labelling G l) : forall x, VSet.In x uctx.1 -> labelling_of_valuation (valuation_of_labelling l) x = l x. Proof using Type. destruct x as [|s|n]; cbnr. - intros _. now apply proj1 in Hl; cbn in Hl. - intro Hs. apply Nat2Pos.id. assert (HH: EdgeSet.In (lzero, Z.of_nat 1, vtn (VariableLevel.level s)) (wGraph.E G)). { subst G. apply make_graph_E. left. exists (VariableLevel.level s). intuition. } apply (proj2 Hl) in HH; cbn in HH. lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
valuation_labelling_eq
816
v : gc_satisfies v uctx.2 <-> correct_labelling G (labelling_of_valuation v). Proof using Type. unfold gc_satisfies, correct_labelling. split; intro H. - split. reflexivity. intros e He. cbn in He. apply make_graph_E in He. destruct He as [[l [Hl He]]|[ctr [Hc He]]]; cbn. + subst e; cbn. destruct l; cbn; lia. + subst e. apply GoodConstraintSet.for_all_spec in H. 2: intros x y []; reflexivity. specialize (H _ Hc). cbn in *. destruct ctr as [[] z []|[] []| |n|n]; cbn in *; toProp H; try lia. all:try destruct t0; cbn in *; try lia. - apply GoodConstraintSet.for_all_spec. intros x y []; reflexivity. intros gc Hgc. pose proof (XX := proj2 (make_graph_E uctx (edge_of_constraint gc))). forward XX. { right. now exists gc. } specialize (H.p2 _ XX). destruct gc as [[] z []|k ?| |n|n]; intro HH; cbn in *; toProp; try lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
make_graph_spec
817
l : correct_labelling G l -> gc_satisfies (valuation_of_labelling l) uctx.2. Proof using Huctx. intro H. apply (make_graph_spec (valuation_of_labelling l)). unfold correct_labelling. intuition. rewrite !valuation_labelling_eq; tas. 3:now apply H. all: now apply make_graph_invariants. Qed.
Corollary
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
make_graph_spec'
818
gc_consistent uctx.2 <-> exists l, correct_labelling G l. Proof. split. - intros [v H]. exists (labelling_of_valuation v). apply make_graph_spec. assumption. - intros [l Hl]. exists (valuation_of_labelling l). apply make_graph_spec'. assumption. Defined.
Corollary
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
make_graph_spec2
819
`{checker_flags} uctx := match gc_of_uctx uctx with | Some uctx => is_acyclic (make_graph uctx) | None => false end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
is_consistent
820
`{checker_flags} uctx (Huctx : global_uctx_invariants uctx) : is_consistent uctx <-> consistent uctx.2. Proof. etransitivity. 2: symmetry; apply gc_consistent_iff. unfold is_consistent; cbn. case_eq (gc_of_constraints uctx.2); cbn. 2: intro; split; [discriminate|inversion 1]. intros ctrs Hctrs. pose proof (gc_of_uctx_invariants uctx (uctx.1, ctrs)) as XX. cbn in XX; rewrite Hctrs in XX; specialize (XX Logic.eq_refl Huctx). etransitivity. apply make_graph_invariants in XX. etransitivity. apply is_acyclic_spec; tas. apply acyclic_caract1; tas. symmetry; apply (make_graph_spec2 (uctx.1, ctrs)); tas. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
is_consistent_spec
821
fun G G' : universes_graph => LevelSet.Equal G.1.1 G'.1.1 /\ wGraph.EdgeSet.Equal G.1.2 G'.1.2 /\ Level.eq G.2 G'.2. Notation "'(=_g)'" := Equal_graph (at level 30). Infix "=_g" := Equal_graph (at level 30). Global Instance: RelationClasses.RewriteRelation ((=_g)) := {}. Global Instance equal_graph_equiv : RelationClasses.Equivalence ((=_g)). Proof. split; unfold Equal_graph. - intros [[vs es] s]; cbn. intuition reflexivity. - intros [[vs es] s] [[vs' es'] s']; cbn. intuition now symmetry. - intros [[vs es] s] [[vs' es'] s'] [[vs'' es''] s'']; cbn. intuition etransitivity; eauto. Qed.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
Equal_graph
822
{g g' x y} : g =_g g' -> PathOf g x y -> PathOf g' x y. Proof. intros eq; induction 1; econstructor; eauto. destruct e as [n ine]. apply eq in ine. now exists n. Defined.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
PathOf_proper
823
{g g' x y} (eq: g =_g g') (p : PathOf g x y) : weight (PathOf_proper eq p) = weight p. Proof. induction p; cbn; auto. destruct e; cbn. now rewrite IHp. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
PathOf_proper_weight
824
lt (e1 e2 : LevelExpr.t) := match e1, e2 with | (l1, k), (l2, k') => leqb_level_n (lt + (Z.of_nat k - Z.of_nat k'))%Z l1 l2 end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_n_gen
825
lt (e1 : LevelExpr.t) (u : Universe.t) := let '(e2, u) := Universe.exprs u in List.fold_left (fun b e2 => leqb_expr_n_gen lt e1 e2 || b) u (leqb_expr_n_gen lt e1 e2).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_univ_n_gen
826
lt (l1 l2 : Universe.t) := let '(e1, u1) := Universe.exprs l1 in List.fold_left (fun b e1 => leqb_expr_univ_n_gen ⎩ lt ⎭ e1 l2 && b) u1 (leqb_expr_univ_n_gen ⎩ lt ⎭ e1 l2).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_universe_n_gen
827
(u1 u2 : Universe.t) := ~~ check_univs || (u1 == u2) || leqb_universe_n_gen false u1 u2.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_leqb_universe_gen
828
(u1 u2 : Universe.t) := ~~ check_univs || (u1 == u2) || (leqb_universe_n_gen false u1 u2 && leqb_universe_n_gen false u2 u1).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_eqb_universe_gen
829
(gc : GoodConstraint.t) := ~~ check_univs || match gc with | GoodConstraint.gc_le l z l' => leqb_level_n z l l' | GoodConstraint.gc_lt_set_level k l => leqb_level_n (Z.of_nat (S k)) lzero (Level.level l) | GoodConstraint.gc_le_set_var k n => leqb_level_n (Z.of_nat k) lzero (Level.lvar n) | GoodConstraint.gc_le_level_set l k => leqb_level_n (- Z.of_nat k)%Z (Level.level l) lzero | GoodConstraint.gc_le_var_set n k => leqb_level_n (- Z.of_nat k)%Z (Level.lvar n) lzero end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_gc_constraint_gen
830
GoodConstraintSet.for_all check_gc_constraint_gen.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_gc_constraints_gen
831
ctrs := match gc_of_constraints ctrs with | Some ctrs => check_gc_constraints_gen ctrs | None => false end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_constraints_gen
832
(u1 u2 : Instance.t) : bool := forallb2 (fun l1 l2 => check_eqb_universe_gen (Universe.make' l1) (Universe.make' l2)) u1 u2.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
eqb_univ_instance_gen
833
(s1 s2 : Sort.t) := leqb_sort_n_ (fun _ => check_leqb_universe_gen) false s1 s2.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_sort_gen
834
(s1 s2 : Sort.t) := (s1 == s2) || leqb_sort_gen s1 s2.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_leqb_sort_gen
835
(s1 s2 : Sort.t) := (s1 == s2) || (leqb_sort_gen s1 s2 && leqb_sort_gen s2 s1).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_eqb_sort_gen
836
{A B : Type} (P : A -> Prop) (x : A + B) := match x with | inl x0 => P x0 | inr _ => True end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
on_inl
837
l := VSet.In l uctx.1.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
gc_level_declared
838
(l : Level.t) : gc_level_declared l -> VSet.In l (wGraph.V G). Proof using HG. intros Hl;subst. now apply HG. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
gc_level_declared_make_graph
839
e := on_Some_or_None (fun l => VSet.In l uctx.1) (LevelExpr.get_noprop e).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
gc_expr_declared
840
(u : Universe.t) := LevelExprSet.For_all gc_expr_declared u.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
gc_levels_declared
841
(s : Sort.t) := Sort.on_sort gc_levels_declared True s.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
gc_levels_declared_sort
842
v (l : VariableLevel.t) : val v (l : Level.t) = val v l. Proof using Type. destruct l; cbn; lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
val_level_of_variable_level
843
v (l : Level.t) : val v l = labelling_of_valuation v l. Proof using Type. destruct l; cbnr. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
val_labelling_of_valuation
844
v (l : Level.t) n : val v (Universe.make (l, n)) = n + labelling_of_valuation v l. Proof using Type. reflexivity. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
val_labelling_of_valuation'
845
L (l : Level.t) n (e := (l, n)) : gc_level_declared l -> correct_labelling G L -> val (valuation_of_labelling L) e = (n + (L l))%nat. Proof using HG. intros Hl [HG1 HG2]. rewrite [wGraph.s _](proj2 (proj2 HG)) in HG1. simpl in HG1. destruct l as [|l|l]; rewrite ?HG1; cbnr. pose proof (make_graph_E uctx (edge_of_level (VariableLevel.level l))).p2 as H. forward H. { left. eexists; split; try reflexivity; tas. } apply HG in H. specialize (HG2 _ H); cbn in HG2. rewrite HG1 in HG2; cbn in HG2. f_equal. clear -HG2. set (L (Level.level l)) in *; clearbody n. destruct n; try lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
val_valuation_of_labelling'
846
L (l : Level.t) : gc_level_declared l -> correct_labelling G L -> val (valuation_of_labelling L) l = (L l). Proof using HG. intros Hl HL. exact (val_valuation_of_labelling' L l 0 Hl HL). Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
val_valuation_of_labelling
847
Proper ((=_g) ==> Logic.eq ==> iff) correct_labelling. Proof using Type. intros g g' eq x ? ->. unfold correct_labelling. rewrite [wGraph.s _](proj2 (proj2 eq)). now setoid_rewrite (proj1 (proj2 eq)). Qed.
Instance
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
correct_labelling_proper
848
n (l l' : Level.t) : leq_vertices G n l l' -> gc_leq0_universe_n n uctx.2 (Universe.make' l) (Universe.make' l'). Proof using HG. intros H. unfold_univ_rel0. apply make_graph_spec in Hv; tas. eapply correct_labelling_proper in Hv; tea. 2:reflexivity. red in Hv. specialize (H _ Hv). rewrite !val_labelling_of_valuation; lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leq_universe_vertices0
849
n (l l' : Level.t) (Hl : VSet.In l (wGraph.V G)) (Hl' : VSet.In l' (wGraph.V G)) : gc_leq0_universe_n n uctx.2 (Universe.make' l) (Universe.make' l') -> leq_vertices G n l l'. Proof using HG Huctx. intros H. unfold_univ_rel0. eapply correct_labelling_proper in Hv. 2:symmetry; tea. 2:reflexivity. specialize (H _ (make_graph_spec' _ Huctx _ Hv)) as HH. eapply HG in Hl, Hl'. rewrite !Universe.val_make' in HH. rewrite <- (valuation_labelling_eq _ _ Hv l Hl). rewrite <- (valuation_labelling_eq _ _ Hv l' Hl'). pose proof (val_labelling_of_valuation (valuation_of_labelling v) l). pose proof (val_labelling_of_valuation (valuation_of_labelling v) l'). rewrite H0 H1 in HH. lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leq_universe_vertices1
850
n (l l' : Level.t) (Hl : VSet.In l (wGraph.V G)) (Hl' : VSet.In l' (wGraph.V G)) : gc_leq0_universe_n n uctx.2 (Universe.make' l) (Universe.make' l') <-> leq_vertices G n l l'. Proof using HG Huctx. split. - intros H. unfold_univ_rel0. apply leq_universe_vertices1; tas. - apply leq_universe_vertices0. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leq_universe_vertices
851
n (l l' : Level.t) := leqb_vertices G n l l'.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_level_n
852
(leqb_level_n : Z -> Level.t -> Level.t -> bool) := forall n (l l' : Level.t) (Hl : VSet.In l uctx.1) (Hl' : VSet.In l' uctx.1), leqb_level_n n l l' <-> gc_leq0_universe_n n uctx.2 (Universe.make' l) (Universe.make' l').
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_level_n_spec_gen
853
leqb_level_n_spec_gen leqb_level_n. Proof using HC HG Huctx. unfold leqb_level_n_spec_gen; intros; symmetry. etransitivity. apply leq_universe_vertices; now apply HG. etransitivity. apply leqb_vertices_correct; try exact _. 1-2:now rewrite HG; exact _. now unfold leqb_level_n. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_level_n_spec
854
(leqb_expr_n_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_n
855
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) lt e e' : gc_expr_declared e -> gc_expr_declared e' -> leqb_expr_n_gen leqb_level_n_gen lt e e' -> gc_leq0_universe_n lt uctx.2 (Universe.make e) (Universe.make e'). Proof using Type. unfold leqb_expr_n. destruct e as [l k], e' as [l' k']; try (cbn in *; discriminate); intros He He' H v Hv; cbn; eapply leqb_correct in H; eauto; specialize (H v Hv); cbn in H;lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_n_spec0_gen
856
leqb_expr_n_spec0_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_n_spec0
857
(b b' : bool) : b /\ b' -> b && b'. Proof using Type. destruct b, b'; cbnr; intuition 0. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
andb_is_true
858
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) n e e' (HHl : gc_expr_declared e) (HHl' : gc_expr_declared e') : leqb_expr_n_gen leqb_level_n_gen ⎩ n ⎭ e e' <-> gc_leq0_universe_n ⎩ n ⎭ uctx.2 (Universe.make e) (Universe.make e'). Proof using HC. split; [apply (leqb_expr_n_spec0_gen _ leqb_correct)|]; try assumption. destruct e as [l k] eqn:eqe, e' as [l' k'] eqn:eqe'; cbn; intro H; destruct HC as [v0 Hv0]; pose proof (H v0 Hv0) as H0; cbn in H0. simpl in H0 |- *. apply leqb_correct; tas. unfold_univ_rel0. specialize (H v Hv). simpl in H. cbn in H. lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_n_spec_gen
859
leqb_expr_n_spec_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_n_spec
860
(leqb_expr_univ_n_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_univ_n
861
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) n e1 u : gc_expr_declared e1 -> gc_levels_declared u -> leqb_expr_univ_n_gen leqb_level_n_gen n e1 u -> gc_leq0_universe_n n uctx.2 (Universe.make e1) u. Proof using Type. unfold leqb_expr_univ_n_gen; intros He1 Hu H. unfold_univ_rel0. rewrite val_fold_right. destruct (Universe.exprs u) as [e u'] eqn:ee;cbn in *. rewrite <- !fold_left_rev_right in H; cbn in *. red in Hu. assert (Hu': gc_expr_declared e /\ Forall gc_expr_declared u'). { split. apply Hu. apply In_to_nonempty_list. fold Universe.exprs. left. now rewrite ee. apply Forall_forall. intros e' He'. apply Hu. apply In_to_nonempty_list. fold Universe.exprs. right. now rewrite ee. } destruct Hu' as [He Hu']. apply Forall_rev in Hu'. revert Hu'. induction (List.rev u'); cbn in *; intros. - eapply leqb_expr_n_spec0_gen; eauto; tas. - apply orb_true_iff in H. destruct H as [H|H]. + eapply leqb_expr_n_spec0_gen in H; eauto. specialize (H v Hv); cbn in *. lia. now inversion Hu'. + apply IHl in H; clear IHl. lia. now inversion Hu'. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_univ_n_spec0_gen
862
leqb_expr_univ_n_spec0_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_univ_n_spec0
863
(u : Universe.t) v k : (exists e, LevelExprSet.In e u /\ Z.of_nat k <= Z.of_nat (val v e))%Z <-> (Z.of_nat k <= Z.of_nat (val v u))%Z. Proof using Type. epose proof (val_le_caract u v k). intuition auto. apply inj_le, H0. destruct H as [e [? ?]]. exists e; split; auto. lia. assert (k <= val v u)%nat. lia. destruct (H1 H2) as [e [? ?]]. exists e; split; auto. lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
val_le_caract'
864
(u : Universe.t) v k : (forall e, LevelExprSet.In e u -> (Z.of_nat (val v e) <= Z.of_nat k)%Z) <-> (Z.of_nat (val v u) <= Z.of_nat k)%Z. Proof using Type. epose proof (val_ge_caract u v k). intuition auto. apply inj_le, H0. intros e hin. specialize (H e hin). lia. assert (val v u <= k)%nat. lia. specialize (H1 H3 e H2). lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
val_ge_caract'
865
x b : (Z.of_nat x + ⎩ b ⎭)%Z = Z.of_nat (x + if b then 1%nat else 0%nat). Proof using Type. destruct b; simpl; lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
Z_of_nat_bool_to_nat
866
(x : bool) : Z.of_nat (if x then 1%nat else 0%nat) = ⎩ x ⎭. Proof using Type. destruct x; simpl; auto. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
Z_of_nat_inj_bool
867
p u := LevelExprSet.for_all p u = false.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
neg_forall
868
p u : neg_forall p u <-> LevelExprSet.exists_ (fun x => ~~ (p x)) u. Proof using Type. unfold neg_forall. split. intros nf. now apply LevelExprSet_for_all_false in nf. intros ex. apply not_true_iff_false; intro HH. eapply LevelExprSet.for_all_spec in HH. 2:proper. red in ex. eapply LevelExprSet.exists_spec in ex as [x [inx npx]]. 2:proper. specialize (HH _ inx). simpl in HH. rewrite HH in npx. simpl in npx. congruence. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
exists_neg_forall
869
G l (ei : LevelExpr.t) : Nbar.t := let '(li, bi) := ei in (lsp G l li + Some (Z.of_nat bi))%nbar.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
lsp_expr
870
(x y : Nbar.t) : bool := ~~ le_lt_dec y x.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
is_lt
871
x y : is_lt x y -> (x < y)%nbar. Proof using Type. unfold is_lt. destruct le_lt_dec. simpl. discriminate. simpl. auto. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
is_lt_spec
872
lt (l : Level.t) b (u : Universe.t) (e := (l, b)) : gc_level_declared l -> gc_levels_declared u -> gc_leq0_universe_n ⎩ lt ⎭ uctx.2 (Universe.make e) u -> exists (e' : LevelExpr.t), LevelExprSet.In e' u /\ gc_leq0_universe_n ⎩ lt ⎭ uctx.2 (Universe.make e) (Universe.make e'). Proof using HC HG Huctx. intros Hl Hu H. assert (HG1 : invariants G) by (rewrite HG; exact _). assert (HG2 : acyclic_no_loop G) by (rewrite HG; exact _). assert (Hs : wGraph.s G = lzero) by apply (proj2 (proj2 HG)). assert (Vs : VSet.In lzero (wGraph.V G)). { rewrite <-Hs. now apply source_vertex. } case_eq (lsp G l lzero). - intros lset Hlset. red in H. assert (Hinl : VSet.In l (wGraph.V G)). { red in Hl; cbn in Hl. now apply HG. } epose proof (lsp_to_s G Hinl). rewrite Hs in H0. specialize (H0 Hlset). pose proof (lsp_s G _ Hinl) as [sl [lspsl slpos]]. assert (Hl' : forall v, gc_satisfies v uctx.2 -> (val v l <= Z.to_nat (- lset))%nat). { intros v Hv. apply make_graph_spec in Hv. rewrite <- HG in Hv. eapply correct_labelling_lsp in Hlset; tea. cbn in Hlset. change (labelling_of_valuation v l) with (val v l) in Hlset. lia. } assert (Hl'' : forall v, gc_satisfies v uctx.2 -> (Z.to_nat sl <= val v l)%nat). { intros v Hv. apply make_graph_spec in Hv. rewrite <- HG in Hv. rewrite Hs in lspsl. eapply correct_labelling_lsp in lspsl; tea. cbn in lspsl. change (labelling_of_valuation v l) with (val v l) in lspsl. lia. } assert (LevelExprSet.for_all (fun ei => is_lt (lsp_expr G l ei - Some (Z.of_nat b))%nbar (Some ⎩ lt ⎭))%Z u = false) as HH. { apply not_true_iff_false; intro HH. apply LevelExprSet.for_all_spec in HH; proper. set (G' := wGraph.Subgraph1.G' G lzero l lset) in *. assert (HG'1 : invariants G'). { subst G'; apply Subgraph1.HI'; tas. } assert (HG'2 : acyclic_no_loop G'). { subst G'; apply Subgraph1.HG'; tas. } eapply (Subgraph1.correct_labelling_lsp_G' G) in Hlset as Hlab; tas. fold G' in Hlab; cbn in Hlab. set (lab := fun x => to_label (lsp G' (wGraph.s G) x)) in *. pose proof (make_graph_spec' _ Huctx lab) as Hv. forward Hv; [now rewrite <- HG|]. specialize (H _ Hv). specialize (Hl' _ Hv). specialize (Hl'' _ Hv). rewrite Universe.val_make in H. rewrite (val_valuation_of_labelling' _ l b) in H; tas. apply switch_minus in H. subst e. rewrite Z_of_nat_bool_to_nat in H. eapply val_le_caract' in H. destruct H as [ei [Hei H]]. specialize (HH ei Hei); cbn in HH. specialize (Hu ei Hei). destruct ei as [li bi]; cbn in *. assert (Vli : VSet.In li (wGraph.V G)). { now apply HG. } simpl in H. unfold is_lt in HH. match goal with | H : ~~ is_left ?X = true |- _ => destruct X as [HH'|Hlt]; [discriminate|]; clear H end. rewrite val_valuation_of_labelling in H; tas. rewrite !Nat2Z.inj_add in H. rewrite Z_of_nat_inj_bool in H. assert (Z.of_nat (lab l) = - lset). { unfold lab. epose proof (Subgraph1.lsp_G'_spec_left G _ _ Hinl Vs _ Hlset l). fold G' in H1. rewrite Hs H1. clear H1. rewrite lsp_xx. pose proof (lsp_sym _ Hlset). destruct (lsp_s G l Hinl) as [sl' [lspsl' w]]. rewrite Hs in lspsl'. rewrite lspsl' in H1 |- *. simpl in H1. cbn -[to_label]. rewrite Z_of_to_label_pos //; lia. } rewrite H1 in H. destruct (lsp_s G' li) as [ni [Hni nipos]]. { cbn. now apply HG. } generalize (Subgraph1.lsp_G'_spec_left G lzero l Hinl Vs _ Hlset li). fold G'. simpl in Hni. rewrite <-Hs, Hni. destruct (lsp_s G li Vli) as [sli [lspsli wsli]]. rewrite lspsli. rewrite Hs in Hni, lspsli, lspsl. assert (⎩ lt ⎭ <= - Z.of_nat b + lset + Z.of_nat bi + Z.of_nat (lab li)) by lia. destruct (lsp G l li) as [lli|] eqn:elli. 2:{ exfalso. generalize (lsp_codistance G l lzero li). now rewrite elli Hlset lspsli. } simpl in Hlt. assert (lli + Z.of_nat bi - Z.of_nat b < - Z.of_nat b + lset + Z.of_nat bi + Z.of_nat (lab li)) by lia. assert (lli < lset + Z.of_nat (lab li)) by lia. unfold lab in H. rewrite Hs in H. rewrite Hni in H. rewrite Z_of_to_label_pos in H; try lia. intros hmax. symmetry in hmax. apply eq_max in hmax as [[= eq]|eq]. subst ni. unfold lab in H4. rewrite Hs Hni in H4. rewrite Z_of_to_label_pos in H4; try lia. pose proof (lsp_codistance G l lzero li). rewrite Hlset lspsli elli in H5. simpl in H5. lia. simpl in eq. noconf eq. lia. } apply LevelExprSet_for_all_false in HH. apply LevelExprSet.exists_spec in HH; proper. unfold LevelExprSet.Exists in *. destruct HH as [[li bi] [He' HH]]. unfold is_lt in HH. rewrite negb_involutive in HH. eexists; split; tea. match goal with | H : ssrbool.is_left ?X = true |- _ => destruct X as [HH'|HH']; try discriminate; clear H end. cbn in HH'. rewrite Hs in lspsl. case_eq (lsp G l li). 2: intros X; rewrite X in HH'; destruct bi, b; contradiction. intros nl Hnl v Hv; rewrite Hnl in HH'. simpl in HH'. rewrite (val_labelling_of_valuation' v li bi); cbn. specialize (Hl' _ Hv). specialize (Hl'' _ Hv). pose proof Hv as Hv'. apply make_graph_spec in Hv; tas. rewrite <- HG in Hv. apply (correct_labelling_lsp _ Hnl) in Hv. cbn in Hv. apply switch_minus. rewrite !Nat2Z.inj_add. enough (Z.of_nat b + Z.of_nat (val v l) + ⎩ lt ⎭ - Z.of_nat bi <= Z.of_nat (labelling_of_valuation v li)) by lia. etransitivity; [|eassumption]. assert (Z.of_nat (val v l) = Z.of_nat (labelling_of_valuation v l)). reflexivity. rewrite H1. lia. - intros HlSet. subst e. assert (Hl' : VSet.In l (wGraph.V G)). { red in Hl; cbn in Hl; now apply HG. } assert (LevelExprSet.for_all (fun ei => match ei with | (li, bi) => le_lt_dec (Some (Z.of_nat bi) + Some (match b with 0%nat => 1%Z | _ => (- (Z.pred (Z.of_nat b)))%Z end) + lsp G l li) (Some ⎩ lt ⎭)%Z end)%nbar u = false) as HH. { apply not_true_iff_false; intro HH. destruct (lsp_s G _ Hl') as [nl [Hnl nlpos]]; cbn in Hnl. assert (exists K : Z, (nl <= K)%Z /\ LevelExprSet.For_all (fun ei => match ei with | (li, bi) => match lsp G (wGraph.s G) li with | None => True | Some ni => ((Z.of_nat bi) + ni < K)%Z end end) u) as XX. { exists (LevelExprSet.fold (fun ei K => match ei with | (li, bi) => match lsp G (wGraph.s G) li with | None => K | Some ni => Z.max K (Z.succ (Z.of_nat bi) + ni) end end) u nl). clear -Hu HG HG1 HG2. split. - rewrite LevelExprSet.fold_spec. rewrite <- fold_left_rev_right. induction (List.rev (LevelExprSet.elements u)). reflexivity. cbn. destruct a as [li bi]; tas. destruct (lsp G (wGraph.s G) li); tas; lia. - intros [li bi] Hei; trivial. specialize (Hu _ Hei); cbn in Hu. destruct (lsp_s G li) as [ni' [Hni' ni'pos]]. { now apply HG. } rewrite Hni'. rewrite LevelExprSet.fold_spec. rewrite <- fold_left_rev_right. apply LevelExprSetFact.elements_1, InA_In_eq, in_rev in Hei. change (In (li, bi) (@List.rev LevelExprSet.elt (LevelExprSet.elements u))) in Hei. induction (List.rev (LevelExprSet.elements u)); inv Hei. + subst a; cbn. rewrite Hni'. lia. + specialize (IHl H). cbn. destruct a as [li' bi']. destruct (lsp G (wGraph.s G) li'); lia. } destruct XX as [K [HK1 HK2]]. assert (Hs' : VSet.In lzero (wGraph.V G)). { rewrite <- Hs; apply HG1. } set (G' := wGraph.G' G lzero l K) in *. assert (lsG : l <> wGraph.s G). intros eq. { rewrite eq in HlSet, Hnl. congruence. } assert (HG'1 : invariants G'). { subst G'; apply HI'; tas. } assert (HG'2 : acyclic_no_loop G'). { subst G'; apply HG'; tas. } apply correct_labelling_lsp_G' with (K:=K) in HlSet as Hlab; tas. fold G' in Hlab; cbn in Hlab. set (lab := fun x => to_label (lsp G' (wGraph.s G) x)) in *. pose proof (make_graph_spec' _ Huctx lab) as Hv. forward Hv; [now rewrite <- HG|]. specialize (H _ Hv); clear Hv. rewrite Universe.val_make in H. rewrite val_valuation_of_labelling' in H; tas. apply switch_minus in H. rewrite Z_of_nat_bool_to_nat in H. apply val_le_caract' in H. destruct H as [ei [Hei H]]. apply LevelExprSet.for_all_spec in HH; proper. specialize (HH _ Hei); cbn in HH. specialize (Hu _ Hei). destruct ei as [li bi]; cbn in H. rewrite val_valuation_of_labelling in H; tas. match goal with | H : is_left ?X = true |- _ => destruct X as [HH'|HH']; try discriminate; clear H end. assert (lab l = to_label (Some K)) as XX. { subst lab; cbn. subst G'. rewrite -> Hs in *. rewrite lsp_G'_spec_left; tas. rewrite Hnl. unfold lsp. rewrite acyclic_lsp0_xx; tas. simpl. assert (Z.max nl (K + 0) = K). lia. now rewrite H0. } rewrite XX in H. destruct (lsp_s G li) as [ni [Hni nipos]]. { now apply HG. } specialize (HK2 _ Hei); cbn in HK2. rewrite Hni in HK2. case_eq (lsp G l li). - intros ki Hki. rewrite Hki in HH'; cbn in HH'. destruct (Z.leb_spec ni (K + ki)). assert (lab li = to_label (Some (K + ki)%Z)) as XX'. { subst lab; cbn. subst G'. rewrite -> Hs in *. rewrite lsp_G'_spec_left; tas. rewrite Hki. rewrite Hni; cbn. assert (Z.max ni (K + ki) = K + ki)%Z as ->. lia. reflexivity. } rewrite XX' in H. rewrite !Nat2Z.inj_add in H. rewrite !Z_of_to_label in H. destruct (Z.leb_spec 0 K); [|lia]. destruct (Z.leb_spec 0 (K + ki)); [|]. rewrite Z_of_nat_inj_bool in H. destruct b; cbn in *; lia. destruct b, lt; cbn in *; lia. assert (lab li = to_label (Some ni)) as XX'. { subst lab; cbn. subst G'. rewrite -> Hs in *. rewrite lsp_G'_spec_left; tas. rewrite Hki Hni; simpl. enough (Z.max ni (K + ki) = ni)%Z as ->; auto. lia. } rewrite XX' in H. rewrite !Nat2Z.inj_add !Z_of_to_label Z_of_nat_inj_bool in H. destruct (Z.leb_spec 0 K); [|lia]. destruct (Z.leb_spec 0 ni); [|lia]. destruct b, lt; cbn in *; lia. - intro Hki. assert (lab li = to_label (Some ni)) as XX'. { subst lab; cbn. subst G'. rewrite -> Hs in *. rewrite lsp_G'_spec_left; tas. now rewrite Hki Hni. } rewrite XX' in H. rewrite !Nat2Z.inj_add !Z_of_to_label Z_of_nat_inj_bool in H. destruct (Z.leb_spec 0 K); [|lia]. destruct (Z.leb_spec 0 ni); [|lia]. destruct b, lt; cbn in *; lia. } apply LevelExprSet_for_all_false in HH. apply LevelExprSet.exists_spec in HH; proper. destruct HH as [[li bi] [He' HH]]. eexists; split; tea. match goal with | H : ~~ is_left ?X = true |- _ => destruct X as [HH'|HH']; try discriminate; clear H end. cbn in HH'. case_eq (lsp G l li). 2: intros X; rewrite X in HH'; destruct bi, b; contradiction. intros nl Hnl v Hv; rewrite Hnl in HH'. apply make_graph_spec in Hv; tas. rewrite <- HG in Hv. apply (correct_labelling_lsp _ Hnl) in Hv. rewrite !val_labelling_of_valuation'. destruct b, lt; cbn in *; lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
gc_leq0_universe_n_sup
873
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) lt e1 (u : Universe.t) (He1 : gc_expr_declared e1) (Hu : gc_levels_declared u) : leqb_expr_univ_n_gen leqb_level_n_gen ⎩ lt ⎭ e1 u <-> gc_leq0_universe_n ⎩ lt ⎭ uctx.2 (Universe.make e1) u. Proof using HC HG Huctx. split; [eapply leqb_expr_univ_n_spec0_gen; eauto|]. unfold leqb_expr_univ_n_gen; intro HH. case_eq (Universe.exprs u). intros e u' ee. assert (Hu': gc_expr_declared e /\ Forall gc_expr_declared u'). { split. apply Hu. apply In_to_nonempty_list. fold Universe.exprs. left. now rewrite ee. apply Forall_forall. intros e' He'. apply Hu. apply In_to_nonempty_list. fold Universe.exprs. right. now rewrite ee. } destruct e1 as [l1 b1]. apply gc_leq0_universe_n_sup in HH; tas. destruct HH as [e' [He' HH]]. eapply leqb_expr_n_spec_gen in HH; eauto; tas. apply In_to_nonempty_list in He'. fold Universe.exprs in He'; rewrite ee in He'; cbn in He'. rewrite <- !fold_left_rev_right. clear -He' HH. destruct He' as [H|H]; [subst|]. * induction (List.rev u'); tas;cbn -[leqb_expr_n]. now rewrite IHl orb_true_r. * apply In_rev in H. induction (List.rev u'); cbn -[leqb_expr_n]; invs H. unfold leqb_expr_n_gen in HH. now rewrite HH. now rewrite IHl; auto; rewrite orb_true_r. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_univ_n_spec_gen
874
leqb_expr_univ_n_spec_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_expr_univ_n_spec
875
(leqb_universe_n_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_universe_n
876
{A} (l : list A) : fold_right (fun _ => xpred0) false l = false. Proof using Type. induction l; simpl; auto. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
fold_right_xpred0
877
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) lt (u1 u2 : Universe.t) (Hu1 : gc_levels_declared u1) (Hu2 : gc_levels_declared u2) : leqb_universe_n_gen leqb_level_n_gen lt u1 u2 -> gc_leq0_universe_n ⎩ lt ⎭ uctx.2 u1 u2. Proof using Type. unfold leqb_universe_n_gen. intros H. unfold_univ_rel0. unfold val, Universe.Evaluable. destruct (Universe.exprs u1) as [e1 u1'] eqn:Hu1'. rewrite <- fold_left_rev_right in *; cbn in *. assert (Hu': gc_expr_declared e1 /\ Forall gc_expr_declared u1'). { split. apply Hu1. apply In_to_nonempty_list. fold Universe.exprs. left. now rewrite Hu1'. apply Forall_forall. intros e' He'. apply Hu1. apply In_to_nonempty_list. fold Universe.exprs. right. now rewrite Hu1'. } destruct Hu' as [? Hu']. apply Forall_rev in Hu'. revert Hu'. induction (List.rev u1'); cbn in *; intros. + eapply leqb_expr_univ_n_spec0_gen in H; eauto. specialize (H v Hv); cbn in H. assumption. + set (z := (fold_right (fun e x => Nat.max (val v e) x) (val v e1) l)) in *. toProp as [H HH]. eapply leqb_expr_univ_n_spec0_gen in H; eauto. specialize (H v Hv). cbn in H. destruct (Nat.max_dec (val v a) z) as [ee|ee]; rewrite ee. * assumption. * apply IHl; tas. now inversion Hu'. * now inversion Hu'. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_universe_n_spec0_gen
878
leqb_universe_n_spec0_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_universe_n_spec0
879
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) lt (l1 l2 : Universe.t) (Hu1 : gc_levels_declared l1) (Hu2 : gc_levels_declared l2) : leqb_universe_n_gen leqb_level_n_gen lt l1 l2 <-> gc_leq0_universe_n ⎩ lt ⎭ uctx.2 l1 l2. Proof using HC HG Huctx. split; [eapply leqb_universe_n_spec0_gen; eauto |]. unfold leqb_universe_n_gen; intro HH. unfold Universe.exprs. case_eq (to_nonempty_list l1); intros e1 uu1 Huu1. rewrite (fold_left_andb_forallb (fun e => _)). pose proof (to_nonempty_list_spec' l1) as X; rewrite Huu1 in X; cbn in X. rewrite X. apply forallb_Forall. apply Forall_forall. intros ei Hei. apply InA_In_eq, LevelExprSetFact.elements_2 in Hei. specialize (Hu1 _ Hei). eapply leqb_expr_univ_n_spec_gen; eauto; tas. intros v Hv. specialize (HH v Hv). simpl in HH |- *. transitivity (Z.of_nat (val v l1)); eauto. eapply (val_ge_caract' l1 v (val v l1)).p2. lia. auto. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_universe_n_spec_gen
880
leqb_universe_n_spec_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_universe_n_spec
881
(check_leqb_universe_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_leqb_universe
882
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) (u1 u2 : Universe.t) (Hu1 : gc_levels_declared u1) (Hu2 : gc_levels_declared u2) : check_leqb_universe_gen leqb_level_n_gen u1 u2 <-> gc_leq_universe uctx.2 u1 u2. Proof using HC HG Huctx. unfold check_leqb_universe_gen, gc_leq_universe, gc_leq_universe_n, leqb_universe_n_gen, gc_leq0_universe_n. destruct check_univs; [|split; trivial]. split; cbn. - move/orP => [|]. + rewrite univ_expr_eqb_true_iff. intros <- v Hv. lia. + now eapply (leqb_universe_n_spec0_gen _ _ false). - intros H; eapply (leqb_universe_n_spec_gen _ _ false) in H; tas. unfold leqb_universe_n_gen in H. rewrite H. now rewrite orb_true_r. Unshelve. all:eauto. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_leqb_universe_spec_gen
883
check_leqb_universe_spec_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_leqb_universe_spec
884
(check_eqb_universe_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_eqb_universe
885
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) (l1 l2 : Universe.t) (Hu1 : gc_levels_declared l1) (Hu2 : gc_levels_declared l2) : check_eqb_universe_gen leqb_level_n_gen l1 l2 <-> gc_eq_universe uctx.2 l1 l2. Proof using HC HG Huctx. unfold check_eqb_universe_gen, gc_eq_universe. destruct check_univs; [|split; trivial]. split; cbn. - move/orP => [ | /andP [Hle Hge]]. + rewrite univ_expr_eqb_true_iff. now intros <- v Hv. + eapply leqb_universe_n_spec0_gen in Hle, Hge; eauto. unfold_univ_rel0. specialize (Hle v Hv); specialize (Hge v Hv). simpl in *. lia. - intros H. toProp; right. toProp; eapply leqb_universe_n_spec_gen; tas; intros v Hv; specialize (H v Hv). rewrite H. cbn; lia. rewrite H. cbn; lia. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_eqb_universe_spec_gen
886
check_eqb_universe_spec_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_eqb_universe_spec
887
{A} l : fold_left (B:=A) (fun _ : bool => xpred0) l false = false. Proof using Type. induction l; simpl; eauto. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
fold_left_false
888
(check_gc_constraint_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_gc_constraint
889
(check_gc_constraints_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_gc_constraints
890
(check_constraints_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_constraints
891
(vset : VSet.t) gc := match gc with | GoodConstraint.gc_le l _ l' => VSet.In (VariableLevel.to_noprop l) vset /\ VSet.In (VariableLevel.to_noprop l') vset | GoodConstraint.gc_lt_set_level _ n | GoodConstraint.gc_le_level_set n _ => VSet.In (Level.level n) vset | GoodConstraint.gc_le_set_var _ n | GoodConstraint.gc_le_var_set n _ => VSet.In (Level.lvar n) vset end.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
gc_levels_declared'
892
(vset : VSet.t) gcs := GoodConstraintSet.For_all (gc_levels_declared' vset) gcs.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
gcs_levels_declared
893
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) gc (Hu1 : gc_levels_declared' uctx.1 gc) : check_gc_constraint_gen leqb_level_n_gen gc -> if check_univs then forall v, gc_satisfies v uctx.2 -> gc_satisfies0 v gc else True. Proof using Huctx. unfold check_gc_constraint_gen. destruct check_univs; [cbn|trivial]. destruct gc as [l z l'|k l|k n|l k|n k]. - intros HH v Hv; eapply leqb_correct in HH; eauto. specialize (HH v Hv). cbn in *. toProp. pose proof (val_level_of_variable_level v l). pose proof (val_level_of_variable_level v l'). destruct l, l'; cbn in *; lia. all: now inversion Hu1. - intros HH v Hv; eapply leqb_correct in HH; eauto. specialize (HH v Hv). cbn -[Z.of_nat] in HH. unfold gc_satisfies0. toProp. cbn in *. lia. now inversion Huctx. - intros HH v Hv; apply leqb_correct in HH. specialize (HH v Hv). cbn in HH. unfold gc_satisfies0. toProp. lia. now inversion Huctx. now inversion Hu1. - intros HH v Hv; apply leqb_correct in HH. specialize (HH v Hv). cbn in HH. unfold gc_satisfies0. toProp. lia. now inversion Hu1. now inversion Huctx. - intros HH v Hv; apply leqb_correct in HH. specialize (HH v Hv). cbn in HH. unfold gc_satisfies0. toProp. lia. now inversion Hu1. now inversion Huctx. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_gc_constraint_spec_gen
894
check_gc_constraint_spec_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_gc_constraint_spec
895
leqb_level_n_gen (leqb_correct : leqb_level_n_spec_gen leqb_level_n_gen) ctrs (Hu1 : gcs_levels_declared uctx.1 ctrs) : check_gc_constraints_gen leqb_level_n_gen ctrs -> if check_univs then forall v, gc_satisfies v uctx.2 -> gc_satisfies v ctrs else True. Proof using Huctx. rewrite /gcs_levels_declared in Hu1. pose proof check_gc_constraint_spec_gen as XX. unfold check_gc_constraints_gen. destruct check_univs; [cbn|trivial]. intros HH v Hv. apply GoodConstraintSet.for_all_spec. now intros x y []. apply GoodConstraintSet.for_all_spec in HH. 2: now intros x y []. intros gc Hgc. specialize (HH gc Hgc). eapply XX; try eassumption. now apply Hu1. Qed.
Lemma
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_gc_constraints_spec_gen
896
check_gc_constraints_spec_gen _ leqb_level_n_spec.
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
check_gc_constraints_spec
897
(eqb_univ_instance_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
eqb_univ_instance
898
(leqb_sort_gen leqb_level_n).
Definition
common
Require Import ssreflect ssrbool OrderedTypeAlt MSetAVL MSetFacts MSetProperties MSetDecide Morphisms. From MetaCoq.Utils Require Import utils wGraph. From MetaCoq.Common Require Import config Universes. From Equations.Prop Require Import DepElim. From Equations Require Import Equations. Import ConstraintType. Import MCMonadNotation. Import VariableLevel GoodConstraint. Module Import wGraph := WeightedGraph Level LevelSet. Import NonEmptySetFacts. Import Nbar Datatypes. Require Import SetoidTactics. From MetaCoq.Utils Require Import MCUtils.
common\theories\uGraph.v
leqb_sort
899