Dataset Viewer
Auto-converted to Parquet Duplicate
fact
stringlengths
12
2.45k
type
stringclasses
9 values
library
stringclasses
1 value
imports
listlengths
1
4
filename
stringlengths
21
66
symbolic_name
stringlengths
1
42
docstring
stringclasses
1 value
veldman_theorem_vtree_upto : afs_veldman_vtree_upto. Proof. exact afs_vtree_upto_embed. Qed.
Theorem
theories
[ "Require Import base statements." ]
theories/conversions.v
veldman_theorem_vtree_upto
higman_theorem_dtree_afs : afs_higman_dtree. Proof. apply veldman_vtree_upto_afs_to_higman_dtree_afs, veldman_theorem_vtree_upto. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree." ]
theories/higman_theorems.v
higman_theorem_dtree_afs
higman_theorem_dtree_af : af_higman_dtree. Proof. apply higman_dtree_afs_to_af, higman_theorem_dtree_afs. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree." ]
theories/higman_theorems.v
higman_theorem_dtree_af
higman_theorem_atree_af : af_higman_atree. Proof. apply higman_theorem_dtree_atree_af, higman_theorem_dtree_af. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree." ]
theories/higman_theorems.v
higman_theorem_atree_af
higman_lemma_list_af : af_higman_list. Proof. apply higman_dtree_to_list, higman_theorem_dtree_af. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree." ]
theories/higman_theorems.v
higman_lemma_list_af
l : vtree X := ⟨x|∅⟩.
Let
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree." ]
theories/higman_theorems.v
l
t n : vtree X := ⟨x|vec_set (λ _ : idx (S n), l)⟩. Local Fact embed_l r : r ≤ₚ l → arity r = 0. Proof. intros [ (p & ?) | H ]%dtree_product_embed_inv. + idx invert p. + destruct r as [ n y w ]. now destruct H as (-> & _). Qed. (* The only way for t n to embed into t m is n = m *) Local Fact embed_t n m : t n ≤ₚ t m → n = m. Proof. intros [ (p & H) | (e & _) ]%dtree_product_embed_inv. + rewrite vec_prj_set in H. now apply embed_l in H. + tlia. Qed. (** If X is inhabited then (dtree_product_embed R) is never almost-full when branching is unbounded *)
Let
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree." ]
theories/higman_theorems.v
t
not_af_product_embed : af (dtree_product_embed R) → False. Proof. intros (? & ? & ? & ? & ?%embed_t)%(af_good_pair t); tlia. Qed.
Lemma
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree." ]
theories/higman_theorems.v
not_af_product_embed
kruskal_theorem_vtree_afs : afs_kruskal_vtree. Proof. apply kruskal_theorem_vtree_afs, veldman_theorem_vtree_upto. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
kruskal_theorem_vtree_afs
kruskal_theorem_vtree_af : af_kruskal_vtree. Proof. apply kruskal_vtree_afs_to_af, kruskal_theorem_vtree_afs. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
kruskal_theorem_vtree_af
kruskal_theorem_ltree_af : af_kruskal_ltree. Proof. apply kruskal_vtree_to_ltree, kruskal_theorem_vtree_af. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
kruskal_theorem_ltree_af
kruskal_theorem_ltree_afs : afs_kruskal_ltree. Proof. apply kruskal_ltree_af_to_afs, kruskal_theorem_ltree_af. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
kruskal_theorem_ltree_afs
kruskal_theorem_atree_af : af_kruskal_atree. Proof. apply kruskal_theorem_vtree_atree_af, kruskal_theorem_vtree_af. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
kruskal_theorem_atree_af
afs_vtree_homeo_embed : afs X R → afs (wft (λ _, X)) (vtree_homeo_embed R). Proof. exact (@kruskal_theorem_vtree_afs _ _ _). Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
afs_vtree_homeo_embed
af_vtree_homeo_embed : af R → af (vtree_homeo_embed R). Proof. exact (@kruskal_theorem_vtree_af _ _). Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
af_vtree_homeo_embed
afs_ltree_homeo_embed : afs X R → afs (ltree_fall (λ x _, X x)) (ltree_homeo_embed R). Proof. exact (@kruskal_theorem_ltree_afs _ _ _). Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
afs_ltree_homeo_embed
af_ltree_homeo_embed : af R → af (ltree_homeo_embed R). Proof. exact (@kruskal_theorem_ltree_af _ _). Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree ltree." ]
theories/kruskal_theorems.v
af_ltree_homeo_embed
le_pirr x y (h₁ h₂ : x ≤ y) { struct h₁ } : h₁ = h₂. Proof. destruct h₁ as [ | y h₁ ]. + apply le_inv_eq_dep with (e := eq_refl). + specialize (le_pirr _ _ h₁). (* Freeze the recursive call on h₁ *) destruct (le_inv_le_dep h₂) as [ | (? & []) ]. * exfalso; lia. * now f_equal. Qed.
Fixpoint
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics." ]
theories/le_lt_pirr.v
le_pirr
lt_pirr x y (h₁ h₂ : x < y) : h₁ = h₂ := le_pirr h₁ h₂.
Definition
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics." ]
theories/le_lt_pirr.v
lt_pirr
af_higman_list := ∀ X (R : rel₂ X), af R → af (list_embed R). (** The statement of Higman's theorem for dependent roses trees: - sons are collected in vectors at each arity - the type of nodes can vary depending on the arity - the relation on nodes can vary depending on the arity - the type of nodes of arity greater than k (fixed) should be empty hence limiting the breadth of those trees to arity k In that case, the nested product embedding is AF. *)
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
af_higman_list
af_higman_dtree := ∀ (k : nat) (X : nat → Type) (R : ∀n, rel₂ (X n)), (∀n, k ≤ n → X n → False) → (∀n, n < k → af (R n)) → af (dtree_product_embed R). (** The statement of Higman's theorem for vector based roses trees: - each node (x : X) can only be used with arity (a x : nat) - the relation R : nat → rel₂ X between nodes depends on the arity - the arity is bounded by k : a _ < k - for any arities n < k, R n restricted to (λ x, n = a x) is AF In that case, the product embedding is AF. *)
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
af_higman_dtree
af_higman_atree := ∀ (k : nat) X (a : X → nat) (R : nat → rel₂ X), (∀x, a x < k) → (∀n, n < k → af (R n)⇓(λ x, n = a x)) → af (atree_product_embed a R). (** The statement of Kruskal's theorem for vector based uniform roses trees: - the type of nodes is independent of the arity - the relation between nodes is independent of the arity In that case, the homeomorphic embedding is AF. *)
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
af_higman_atree
af_kruskal_vtree := ∀ X (R : rel₂ X), af R → af (vtree_homeo_embed R). (** The statement of Kruskal's theorem for vector based roses trees: - each node (x : X) can only be used with arity (a x : nat) - the relation between nodes does not depend on the arity In that case, the homeomorphic embedding is AF. *)
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
af_kruskal_vtree
af_kruskal_atree := ∀ X (a : X → nat) (R : rel₂ X), af R → af (atree_homeo_embed a R). (** The statement of Kruskal's theorem for list based roses trees *)
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
af_kruskal_atree
af_kruskal_ltree := ∀ X (R : rel₂ X), af R → af (ltree_homeo_embed R). (** The statement of Veldman's theorem for uniform well formed rose trees, as established in the Kruskal-Veldman project: - sons are collected in vectors - the type of nodes is independent of the arity - but the sub-type of allowed nodes depends on the arity - the relation on nodes can vary depending on the arity *)
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
af_kruskal_ltree
afs_veldman_vtree_upto := ∀ (k : nat) A (X : nat → rel₁ A) (R : nat → rel₂ A), (∀n, k ≤ n → X n = X k) → (∀n, k ≤ n → R n = R k) → (∀n, n ≤ k → afs (X n) (R n)) → afs (wft X) (vtree_upto_embed k R). (** Below are afs versions of the above statements, that is when variations on types is replaced by variations on sub-types *)
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
afs_veldman_vtree_upto
afs_higman_dtree := ∀ k U (X : nat → rel₁ U) (R : nat → rel₂ U), (∀ n x, k ≤ n → X n x → False) → (∀n, n < k → afs (X n) (R n)) → afs (wft X) (dtree_product_embed R).
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
afs_higman_dtree
afs_kruskal_vtree := ∀ U (X : rel₁ U) (R : rel₂ U), afs X R → afs (wft (λ _, X)) (vtree_homeo_embed R).
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
afs_kruskal_vtree
afs_kruskal_ltree := ∀ U (X : rel₁ U) (R : rel₂ U), afs X R → afs (ltree_fall (λ x _, X x)) (ltree_homeo_embed R). (** The statement of Vazsonyi's conjecture for vector based undecorated rose trees, of breadth bounded by k *) #[local] Notation "x ∊ v" := (@vec_in _ x _ v) (at level 70, no associativity, format "x ∊ v"). #[local] Notation "⟨ v | h ⟩ᵥ" := (btree_cons v h) (at level 0, v at level 200, format "⟨ v | h ⟩ᵥ").
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
afs_kruskal_ltree
vazsonyi_conjecture_bounded := ∀ k (R : rel₂ (btree k)), (∀ s t n (h : n < k) v, t ∊ v → R s t → R s ⟨v|h⟩ᵥ) → (∀ n v m w (hₙ : n < k) (hₘ : m < k), vec_forall2 R v w → R ⟨v|hₙ⟩ᵥ ⟨w|hₘ⟩ᵥ) → ∀f, ∃ₜ n, ∃ i j, i < j < n ∧ R (f i) (f j). (** The statement of Vazsonyi's conjecture for list based (decorated) rose trees, but the decoration is ignored as if X = unit. *)
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
vazsonyi_conjecture_bounded
vazsonyi_conjecture := ∀ X (R : rel₂ (ltree X)), (∀ s t x l, t ∈ l → R s t → R s ⟨x|l⟩ₗ) → (∀ x l y m, list_embed R l m → R ⟨x|l⟩ₗ ⟨y|m⟩ₗ) → ∀f, ∃ₜ n, ∃ i j, i < j < n ∧ R (f i) (f j).
Definition
theories
[ "From Coq\n Require Import List Utf8.", "Require Import base dtree_embed vtree_embed ltree_embed atree_embed." ]
theories/statements.v
vazsonyi_conjecture
vazsonyi_theorem_bounded : vazsonyi_conjecture_bounded. Proof. apply higman_dtree_to_vazsonyi_bounded, higman_theorem_dtree_af. Qed. (** See statements.v for the statement of the "conjecture" *)
Theorem
theories
[ "From Coq\n Require Import Arith Utf8.", "From KruskalTrees\n Require Import list_utils idx vec vtree ltree." ]
theories/vazsonyi_theorems.v
vazsonyi_theorem_bounded
vazsonyi_theorem : vazsonyi_conjecture. Proof. apply kruskal_ltree_to_vazsonyi, kruskal_theorem_ltree_af. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith Utf8.", "From KruskalTrees\n Require Import list_utils idx vec vtree ltree." ]
theories/vazsonyi_theorems.v
vazsonyi_theorem
Y := sigT X.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree.", "Require Import base dtree_embed statements." ]
theories/conversions/higman_dtree_afs_to_af.v
Y
T : nat → Y → Prop := λ n s, n = projT1 s. Local Definition dtree_vtree (t : dtree X) : vtree Y. Proof. induction t as [ n x v f ]. exact ⟨existT _ n x|vec_set f⟩. Defined. Local Fact dtree_vtree_fix n (x : X n) (v : vec _ n) : dtree_vtree ⟨x|v⟩ = ⟨existT _ n x|vec_map dtree_vtree v⟩. Proof. rewrite <- vec_set_map; auto. Qed. Local Fact dtree_vtree_inj s t : dtree_vtree s = dtree_vtree t → s = t. Proof. revert t; induction s as [ n x v IH ]; intros [ m y w ]. rewrite !dtree_vtree_fix, dtree_cons_inj. intros (? & H1 & H2); eq refl; simpl in *. apply eq_sigT_inj in H1 as (e & H1); eq refl; subst; clear e. f_equal; vec ext; apply IH. apply f_equal with (f := fun v => v⦃p⦄) in H2. now rewrite !vec_prj_map in H2. Qed. Local Fact dtree_vtree_wf t : wft T (dtree_vtree t). Proof. unfold T. induction t. rewrite dtree_vtree_fix, wft_fix; simpl; split; auto. now intro; vec rew. Qed. Local Fact dtree_vtree_surj t' : wft T t' → { t | dtree_vtree t = t' }. Proof. unfold T. induction 1 as [ n (j,x) v H1 H2 IH2 ] using wft_rect. vec reif IH2 as (w & Hw). simpl in H1; subst j. exists ⟨x|w⟩. rewrite dtree_vtree_fix; f_equal. now vec ext; vec rew. Qed. Local Fact dtree_vtree_vec_surj n (v : vec _ n) : vec_fall (wft T) v → { w | vec_map dtree_vtree w = v }. Proof. apply vec_cond_reif, dtree_vtree_surj. Qed. Local Definition vtree_dtree t' Ht' := proj1_sig (dtree_vtree_surj t' Ht'). Local Fact dtree_vtree_dtree t' Ht' : dtree_vtree (@vtree_dtree t' Ht') = t'. Proof. apply (proj2_sig (dtree_vtree_surj t' Ht')). Qed. Local Fact vtree_dtree_vtree t H : vtree_dtree (dtree_vtree t) H = t. Proof. apply dtree_vtree_inj; rewrite dtree_vtree_dtree; auto. Qed. Local Fact vtree_dtree_fix n x (w : vec (dtree X) n) H : vtree_dtree ⟨existT _ n x|vec_map dtree_vtree w⟩ H = ⟨x|w⟩. Proof. apply dtree_vtree_inj; rewrite dtree_vtree_dtree, dtree_vtree_fix; auto. Qed.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree.", "Require Import base dtree_embed statements." ]
theories/conversions/higman_dtree_afs_to_af.v
T
Y := (sigT X).
Notation
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree.", "Require Import base dtree_embed statements." ]
theories/conversions/higman_dtree_afs_to_af.v
Y
T n (y : Y) := n = projT1 y. Local Fact T_empty n x : k ≤ n → T n x → False. Proof. unfold T; intros H; destruct x as (j,x); simpl; intros; subst; revert x; apply HX; auto. Qed.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree.", "Require Import base dtree_embed statements." ]
theories/conversions/higman_dtree_afs_to_af.v
T
R' n (u v : Y) := match u, v with | existT _ _ x, existT _ _ y => exists e f, @R n x↺e y↺f end. Local Fact R'_afs n : n < k → afs (T n) (@R' n). Proof. intros Hn; apply afs_iff_af_sub_rel; generalize (HR Hn). af rel morph (fun (x : X n) (y : sig (T n)) => match proj1_sig y with | existT _ i a => exists e, x↺e = a end); unfold T. + intros ((j,x),e); simpl in *; subst; exists x, eq_refl; auto. + intros x1 x2 ((i1,y1),e1) ((i2,y2),e2); simpl. intros (<- & ?) (<- & <-); simpl in *. exists eq_refl, eq_refl; simpl; subst; auto. Qed. Hint Resolve T_empty R'_afs : core. Local Lemma higman_afs_to_higman_af_at : af (dtree_product_embed R). Proof. cut (afs (wft T) (dtree_product_embed R')). 2: { apply higman with k; eauto. } equiv with afs_iff_af_sub_rel. af rel morph (fun x y => vtree_dtree (proj1_sig x) (proj2_sig x) = y ). + intros t. induction t as [ n x v IH ]. assert (Hw : forall p, ∃ₜ t (Ht : wft _ t), vtree_dtree t Ht = vec_prj v p). 1: { intros p; destruct (IH p) as ([] & ?); eauto. } vec reif Hw as (w & Hw). idx reif Hw as (g & Hg). assert (Ht : wft T ⟨existT _ n x|w⟩). 1: { unfold T; apply wft_fix; simpl; auto. } exists (exist _ ⟨existT _ n x|w⟩ Ht); simpl. apply dtree_vtree_inj; rewrite dtree_vtree_dtree, dtree_vtree_fix. f_equal; vec ext; vec rew. rewrite <- Hg, dtree_vtree_dtree; auto. + intros x1 x2 ? ? <- <-; revert x1 x2. intros (x1 & H1) (x2 & H2); simpl. intros H; revert H H1 H2; unfold T. induction 1 as [ j b v t p H1 IH1 | j b v c w H1 H2 IH2 ]; intros G1 G2; auto. * generalize G2. apply wft_fix in G2 as [ G2 G3 ]. generalize (G3 p); intros G4. destruct dtree_vtree_vec_surj with (v := v) as (w & <-); auto. rewrite !vec_prj_map in IH1, G4. specialize (IH1 G1 G4). rewrite vtree_dtree_vtree in IH1. intros G5. destruct b as [ u b ]. simpl in G2; subst u. rewrite (vtree_dtree_fix _ G5). constructor 1 with p; auto. * generalize G1 G2. apply wft_fix in G2 as [ G3 G4 ]. apply wft_fix in G1 as [ G1 G2 ]. destruct dtree_vtree_vec_surj with (1 := G2) as (v1 & <-). destruct dtree_vtree_vec_surj with (1 := G4) as (v2 & <-). intros G5 G6. destruct b as [ u b ]; simpl in G1; subst u. destruct c as [ u c ]; simpl in G3; subst u. rewrite !vtree_dtree_fix. constructor 2. - destruct H1 as (e & g & H1); eq refl; auto. - intros p. specialize (IH2 p). specialize (G2 p). specialize (G4 p). rewrite !vec_prj_map in G2, G4. rewrite !vec_prj_map in IH2. specialize (IH2 G2 G4). rewrite !vtree_dtree_vtree in IH2. trivial. Qed.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree.", "Require Import base dtree_embed statements." ]
theories/conversions/higman_dtree_afs_to_af.v
R'
higman_dtree_afs_to_af : afs_higman_dtree → af_higman_dtree. Proof. intros ? ? ? ?; apply higman_afs_to_higman_af_at; auto. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree.", "Require Import base dtree_embed statements." ]
theories/conversions/higman_dtree_afs_to_af.v
higman_dtree_afs_to_af
Y := unary_family.
Notation
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils idx vec dtree.", "Require Import base notations dtree_embed statements." ]
theories/conversions/higman_dtree_to_list.v
Y
T := (dtree Y). Local Fixpoint dtree_list (t : T) : list X := match t with | @dtree_cons _ 0 _ _ => [] | @dtree_cons _ 1 x v => x :: dtree_list v⦃idx₀⦄ | @dtree_cons _ _ x _ => @Empty_set_rect _ x end. Local Fixpoint list_dtree l : T := match l with | [] => ⟨tt|∅⟩ | x::l => ⟨x|list_dtree l##∅⟩ end. Local Fact dtree_list_dtree l : dtree_list (list_dtree l) = l. Proof. induction l; simpl; f_equal; auto. Qed. Local Fact list_dtree_list_not_needed t : list_dtree (dtree_list t) = t. Proof. induction t as [ [ | [ | n ] ] x v IHv ]; simpl in *; try easy; f_equal. + now destruct x. + now vec invert v. + vec invert v as ? v; vec invert v. now rewrite IHv. Qed.
Notation
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils idx vec dtree.", "Require Import base notations dtree_embed statements." ]
theories/conversions/higman_dtree_to_list.v
T
Y := (unary_family X).
Notation
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils idx vec dtree.", "Require Import base notations dtree_embed statements." ]
theories/conversions/higman_dtree_to_list.v
Y
T := (dtree Y).
Notation
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils idx vec dtree.", "Require Import base notations dtree_embed statements." ]
theories/conversions/higman_dtree_to_list.v
T
RY n : rel₂ (Y n) := match n with | 1 => R | _ => ⊤₂ end. Local Lemma higman_lemma_af : af R → af (list_embed R). Proof. intros H. cut (af (dtree_product_embed RY)). + clear H. af rel morph (fun x y => dtree_list x = y). * intros l; exists (list_dtree l); rewrite dtree_list_dtree; auto. * intros r t ? ? <- <-. induction 1 as [ [|[]] x t v p H IH | [|[]] x v y w H IH ]; simpl; auto; ( (destruct x; fail) || idx invert all; auto with list_db). + apply higman_dtree with (k := 2). * intros [|[]] ?; tlia; intros []. * intros [|[]] ?; tlia; simpl; auto. Qed.
Let
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils idx vec dtree.", "Require Import base notations dtree_embed statements." ]
theories/conversions/higman_dtree_to_list.v
RY
higman_dtree_to_list : af_higman_dtree → af_higman_list. Proof. intros ? ? ? ?; apply higman_lemma_af; auto. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils idx vec dtree.", "Require Import base notations dtree_embed statements." ]
theories/conversions/higman_dtree_to_list.v
higman_dtree_to_list
X := dtree_bounded. Local Definition tt' n : n < k → X n. Proof. refine (match le_lt_dec k n as d return _ → if d then Empty_set else unit with | left _ => λ _, match _ : False with end | right _ => λ _, tt end); tlia. Defined. Local Fact X_uniq n : ∀ a b : X n, a = b. Proof. unfold X; destruct (le_lt_dec k n); intros [] []; auto. Qed. Local Fixpoint btree_dtree (t : btree k) : dtree X := match t with | btree_cons v h => ⟨tt' h|vec_map btree_dtree v⟩ end. Local Fact btree_dtree_fix n v h : btree_dtree (@btree_cons k n v h) = ⟨tt' h|vec_map btree_dtree v⟩. Proof. reflexivity. Qed. (* Hint Resolve lt_pirr : core. *) Local Fact btree_dtree_inj s t : btree_dtree s = btree_dtree t → s = t. Proof. revert t; induction s as [ n v hv IH ]; intros [ m w hw ]; simpl. rewrite dtree_cons_inj. intros (e & H1 & H2); eq refl; simpl in *. apply btree_f_equal. vec ext. apply f_equal with (f := fun v => v⦃p⦄) in H2. rewrite !vec_prj_map in H2; auto. Qed.
Notation
theories
[ "From Coq\n Require Import Arith Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree ltree btree." ]
theories/conversions/higman_dtree_to_vazsonyi_bounded.v
X
higman_dtree_to_vazsonyi_bounded : af_higman_dtree → vazsonyi_conjecture_bounded. Proof. intros Hk k R HR1 HR2 f. apply vazsonyi_conjecture_bounded_strong; eauto. Qed. Print vazsonyi_conjecture_bounded. (** Notation for binary relations/predicates *) Locate "rel₂ _". (** Inductive definition vec X n for vectors of length n over type X, with notations ∅ (for empty vector in vec X 0) and ## (for cons in vec X (S _)) *) Print vec. Locate "∅". Locate "##". (** Inductive definition of membership in vectors, denoted with ∊ *) Locate "∈ᵥ". Print vec_in. (** Inductive definition of the product relations over vectors of the same length *) Print vec_forall2. (** Inductive definition of tree of width bounded by k *) Print btree. (** The statement of Vazoni's conjecture for trees of bounded width, and a check that no assumption is used to establish it *) Check higman_dtree_to_vazsonyi_bounded. Print Assumptions higman_dtree_to_vazsonyi_bounded.
Theorem
theories
[ "From Coq\n Require Import Arith Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree ltree btree." ]
theories/conversions/higman_dtree_to_vazsonyi_bounded.v
higman_dtree_to_vazsonyi_bounded
A := (λ n x, n = a x).
Notation
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
A
atree_dtree (t : atree a) : dtree (λ n, sig (A n)) := match t with | ⟨x|v⟩ₐ => ⟨exist _ x eq_refl|vec_map atree_dtree v⟩ end.
Fixpoint
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
atree_dtree
dtree_atree (s : dtree (λ n, sig (A n))) : atree a := match s with | ⟨exist _ x e|v⟩ => ⟨x|vec_map dtree_atree v↺e⟩ₐ end.
Fixpoint
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
dtree_atree
dtree_atree_dtree t : dtree_atree (atree_dtree t) = t. Proof. induction t; simpl; f_equal. rewrite vec_map_map; now vec ext; vec rew. Qed.
Fact
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
dtree_atree_dtree
atree_dtree_atree s : atree_dtree (dtree_atree s) = s. Proof. induction s as [ ? [] ]; simpl; eq refl; f_equal. rewrite vec_map_map; now vec ext; vec rew. Qed.
Fact
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
atree_dtree_atree
va_tree_eq : vtree X → atree a → Prop := | in_va_tree_eq x (v : vec _ (a x)) w : vec_fall2 va_tree_eq v w → va_tree_eq ⟨x|v⟩ ⟨x|w⟩ₐ.
Inductive
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
va_tree_eq
va_tree_eq_surj t : { s | va_tree_eq s t }. Proof. induction t as [ x v IHv ]. vec reif IHv as [ w Hw ]. exists ⟨x|w⟩; now constructor. Qed.
Fact
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
va_tree_eq_surj
va_tree_eq_wft s t : va_tree_eq s t → wft A s. Proof. induction 1; split; auto. Qed.
Remark
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
va_tree_eq_wft
va_tree_eq_total s : wft A s → { t | va_tree_eq s t }. Proof. induction s as [ n x v IHv ]; intros (Hx & Hv)%wft_fix. specialize (fun p => IHv _ (Hv p)). vec reif IHv as [ w Hw ]. subst n. exists (atree_cons x w). now constructor. Qed. (* This is the critical inversion lemma *)
Remark
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
va_tree_eq_total
va_tree_eq_invl s t : va_tree_eq s t → match s with | @dtree_cons _ n x v => ∃ (e : n = a x) w, t = atree_cons x w↺e ∧ vec_fall2 va_tree_eq v w end. Proof. intros []; eexists eq_refl, _; simpl; eauto. Qed.
Lemma
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
va_tree_eq_invl
A := (λ n x, n = a x). Hypothesis (Hk : ∀x, a x < k) (HR : ∀n, n < k → af (R n)⇓(A n)).
Notation
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
A
Y n := sig (A n).
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
Y
T n : rel₂ (Y n) := (R n)⇓(A n). Local Fact af_dtree_T : af (dtree_product_embed T). Proof. apply higman_dtree with (k := k). + intros n Hn (x & Hx). specialize (Hk x). rewrite <- Hx in Hk; tlia. + apply HR. Qed. Local Theorem higman_dtree_atree_af_local : af (atree_product_embed a R). Proof. generalize af_dtree_T. af rel morph (λ s t, dtree_atree a s = t). + intros s; exists (atree_dtree s). apply dtree_atree_dtree. + intros s t ? ? <- <-. induction 1 as [ n [ x Hx ] v t p H IH | n [ x Hx ] v [ y Hy ] w H1 H2 IH2 ]; simpl. * eq refl. constructor 1 with p. now vec rew. * eq refl. unfold T in H1; simpl in H1. constructor 2; auto. clear H1. rewrite <- Hy; simpl. apply vec_forall2_iff_fall2. now intro; vec rew. Qed.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
T
higman_theorem_dtree_atree_af : af_higman_dtree → af_higman_atree. Proof. exact higman_dtree_atree_af_local. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
higman_theorem_dtree_atree_af
A := (λ n x, n = a x). Hypothesis (HR : af R). Local Fact af_vtree : af (vtree_homeo_embed R). Proof. apply kruskal_vtree, HR. Qed. Local Theorem kruskal_vtree_atree_af_local : af (atree_homeo_embed a R). Proof. generalize af_vtree. af rel morph (@va_tree_eq _ a). + intros t. destruct (va_tree_eq_surj t); eauto. + intros s t u v Hu Hv H. revert H u v Hu Hv. induction 1 as [ x n v t p H IH | n x v m y w H1 H2 IH2 ]; simpl; intros c d. * intros Hc (e & w & -> & Hw)%va_tree_eq_invl; eq refl. constructor 1 with p; auto. * intros (e1 & v1 & -> & Hv1)%va_tree_eq_invl (e2 & w1 & -> & Hw1)%va_tree_eq_invl; eq refl. constructor 2; auto. clear H1 H2. revert v w IH2 v1 w1 Hv1 Hw1. generalize (a x) (a y); clear x y HR. induction 1 as [ | n x v m y w H1 _ IH2 | n v m y w _ IH ]. - intros v1 w1; vec invert v1; vec invert w1; constructor. - intros v1 w1. vec invert v1 as x1 v1. vec invert w1 as y1 w1. intros []%vec_fall2_cons_inv []%vec_fall2_cons_inv. constructor 2; auto. - intros v1 w1. vec invert w1 as y1 w1. intros ? []%vec_fall2_cons_inv. constructor 3; auto. Qed.
Notation
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
A
kruskal_theorem_vtree_atree_af : af_kruskal_vtree → af_kruskal_atree. Proof. exact kruskal_vtree_atree_af_local. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/higman_kruskal_dtree_to_atree.v
kruskal_theorem_vtree_atree_af
kruskal_ltree_afs_to_af : afs_kruskal_ltree → af_kruskal_ltree. Proof. intros K X R H%af_iff_afs_True%K; apply af_iff_afs_True; revert H. apply afs_mono; auto. intros t _. induction t; apply ltree_fall_fix; auto. Qed.
Theorem
theories
[ "From Coq\n Require Import List Utf8.", "From KruskalTrees\n Require Import list_utils ltree.", "Require Import base statements." ]
theories/conversions/kruskal_ltree_afs_to_af.v
kruskal_ltree_afs_to_af
forget := (@ltree_sig_forget _ _). Hypothesis kruskal : af_kruskal_ltree.
Notation
theories
[ "From Coq\n Require Import List Utf8.", "From KruskalTrees\n Require Import list_utils ltree.", "Require Import base statements." ]
theories/conversions/kruskal_ltree_af_to_afs.v
forget
kruskal_ltree_af_to_afs : afs_kruskal_ltree. Proof. intros U X R H%afs_iff_af_sub_rel%kruskal. apply afs_iff_af_sub_rel; revert H. af rel morph (fun x y => proj1_sig y = forget x). + intros (t & Ht); simpl; revert t Ht. induction 1 as [ x l H1 H2 IH2 ] using ltree_fall_rect. Forall reif IH2 as (m & Hm). exists ⟨exist _ x H1|m⟩ₗ; simpl; f_equal. now apply Forall2_eq, Forall2_map_right. + intros t1 t2 (r1 & H1) (r2 & H2); simpl; intros -> ->. clear H1 H2. induction 1 as [ s t (x & Hx) l H1 _ IH2 | (x & Hx) l (y & Hy) m H1 H2 IH2 ]; simpl. * constructor 1 with (forget t); auto. apply in_map_iff; eauto. * constructor 2; auto. now apply list_embed_map. Qed.
Theorem
theories
[ "From Coq\n Require Import List Utf8.", "From KruskalTrees\n Require Import list_utils ltree.", "Require Import base statements." ]
theories/conversions/kruskal_ltree_af_to_afs.v
kruskal_ltree_af_to_afs
kruskal_ltree_to_vazsonyi : af_kruskal_ltree → vazsonyi_conjecture. Proof. intros H X R HR1 HR2 f. apply af_good_pair. generalize (H _ _ (@af_True X)); apply af_mono. induction 1; simpl; eauto. Qed. Print list. Print ltree. Locate "_ ∈ _". Print "∈". Print list_embed. Check kruskal_ltree_to_vazsonyi. Print Assumptions kruskal_ltree_to_vazsonyi.
Theorem
theories
[ "From Coq\n Require Import List Utf8.", "From KruskalTrees\n Require Import list_utils ltree.", "Require Import base ltree_embed statements." ]
theories/conversions/kruskal_ltree_to_vazsonyi.v
kruskal_ltree_to_vazsonyi
kruskal_vtree_afs_to_af : afs_kruskal_vtree → af_kruskal_vtree. Proof. intros K X R H%af_iff_afs_True%K. apply af_iff_afs_True; revert H. apply afs_mono; auto. intros t _; induction t; apply wft_fix; auto. Qed.
Theorem
theories
[ "From Coq \n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree.", "Require Import base statements." ]
theories/conversions/kruskal_vtree_afs_to_af.v
kruskal_vtree_afs_to_af
V := (idx k * U)%type.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/kruskal_vtree_afs_to_higman_dtree_afs.v
V
Y : V → Prop := λ '(p,x), X (idx2nat p) x.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/kruskal_vtree_afs_to_higman_dtree_afs.v
Y
T : V → V → Prop := λ '(p,x) '(q,y), p = q ∧ R (idx2nat p) x y.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/kruskal_vtree_afs_to_higman_dtree_afs.v
T
W : nat → V → Prop := λ _, Y. Local Fact af_R (p : idx k) : af (R (idx2nat p))⇓(X (idx2nat p)). Proof. apply afs_iff_af_sub_rel; apply HXR, idx2nat_lt. Qed. (* Using finite dependent sum, T is afs over Y *) Local Fact afs_YT : afs Y T. Proof. generalize (af_dep_sum _ _ af_R). intros H; apply afs_iff_af_sub_rel; revert H. af rel morph (fun x y => match x with existT _ p (exist _ x Hx) => proj1_sig y = (p,x) end). + intros ((p,x) & Hx). exists (existT _ p (exist _ x Hx)); auto. + intros (p1 & x1 & ?) (p2 & x2 & ?) (y1 & ?) (y2 & ?); simpl. intros -> -> (e & H); eq refl; simpl; auto. Qed. (** Homeomorphic embedding T is afs over wf Y trees decorated with idk k * U such that Y (p,x) := X p x T (p,x) (q,y) := p = q /\ R p x y *) Local Fact afs_embed_T1 : afs (wft W) (vtree_homeo_embed T). Proof. apply kruskal, afs_YT. Qed. (* We consider uniform vtrees such that at node (p,x), not only X p x holds but holds its arity must be p *)
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/kruskal_vtree_afs_to_higman_dtree_afs.v
W
K : ∀n, V → vec (vtree V) n → Prop := λ n '(p,x) _, n = idx2nat p ∧ X n x. Local Fact K_inc_W : ∀ n x v, @K n x v → W n x. Proof. intros ? [] _ (-> & ?); simpl; auto. Qed. Local Fact dtree_fall_K_inc_wft_W : dtree_fall K ⊆₁ wft W. Proof. apply dtree_fall_mono, K_inc_W. Qed. (** Homeomorphic embedding of T is afs over wf K dtrees decorated with pos k * U such that K n (p,x) v := n = p /\ X n x T (p,x) (q,y) := p = q /\ R p x y Over these, the homeomorphic embedding and the product (Higman) embedding match *) Hint Resolve dtree_fall_K_inc_wft_W : core. Local Fact afs_embed_T2 : afs (dtree_fall K) (vtree_homeo_embed T). Proof. apply afs_mono with (3 := afs_embed_T1); auto. Qed. (* f forgets part of the decoration ie (_,x) => x *) Local Definition f : vtree V → vtree U. Proof. induction 1 as [ n (_,x) v f ]. exact ⟨x|vec_set f⟩. Defined. Local Fact Hf n p x (v : vec _ n) : f ⟨(p,x)|v⟩ = ⟨x|vec_map f v⟩. Proof. rewrite <- vec_set_map; auto. Qed. Local Lemma kruskal_afs_to_higman_afs_at : afs (wft X) (dtree_product_embed R). Proof. generalize afs_embed_T2; equiv with afs_iff_af_sub_rel. af rel morph (fun x y => f (proj1_sig x) = proj1_sig y). + intros (t & Ht); simpl; revert t Ht. induction 1 as [ n x v Hx Hv IHv ] using wft_rect. vec reif IHv as (w & Hw). assert (n < k) as Hn. 1: { destruct (le_lt_dec k n) as [ H | ]; auto. exfalso; revert H Hx; apply Hk. } set (t := ⟨(nat2idx Hn,x)|vec_set (fun p => proj1_sig w⦃p⦄)⟩). assert (Ht : dtree_fall K t). 1: { unfold t, K; rewrite dtree_fall_fix; simpl; split. + rewrite idx2nat2idx; auto. + intros p; vec rew. apply (proj2_sig w⦃p⦄). } exists (exist _ t Ht); simpl; f_equal. now vec ext; vec rew. + intros (x1 & H1) (x2 & H2) (y1 & H3) (y2 & H4); simpl. intros <- <- H5; revert H5 H1 H2; clear H3 H4. induction 1 as [ t n [q u] v p H1 IH1 | n [q x] v m [r y] w (H0 & H1) H2 IH2 ]. * intros ? [[]]; rewrite Hf; simpl. constructor 1 with p; vec rew; auto. * intros ((H3 & H4) & H5) ((H6 & H7) & H8). rewrite !Hf; subst r; simpl. rewrite <- H6 in H3; subst m. constructor 2; subst; auto. apply vec_embed_fall2_eq in IH2. intro; vec rew; auto. Qed.
Let
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/kruskal_vtree_afs_to_higman_dtree_afs.v
K
kruskal_vtree_afs_to_higman_dtree_afs : afs_kruskal_vtree → afs_higman_dtree. Proof. intros ? ? ? ? ? ?; apply kruskal_afs_to_higman_afs_at; auto. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree vtree." ]
theories/conversions/kruskal_vtree_afs_to_higman_dtree_afs.v
kruskal_vtree_afs_to_higman_dtree_afs
forget := (@vtree_sig_forget _ _). Hypothesis kruskal : af_kruskal_vtree.
Notation
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree.", "Require Import base statements." ]
theories/conversions/kruskal_vtree_af_to_afs.v
forget
kruskal_vtree_af_to_afs : afs_kruskal_vtree. Proof. intros U X R H%afs_iff_af_sub_rel%kruskal. apply afs_iff_af_sub_rel; revert H. af rel morph (fun x y => forget x = proj1_sig y). + intros (t & Ht); revert t Ht; simpl. induction 1 as [ n x v Hx Hv IHv ] using wft_rect. vec reif IHv as (w & Hw). exists ⟨exist _ x Hx|w⟩; simpl; f_equal. now vec ext; vec rew. + intros t1 t2 (r1 & H1) (r2 & H2); simpl; intros <- <-. clear H1 H2. induction 1 as [ t n [x Hx] v p H1 IH1 | n [x Hx] v m [y Hy] w H1 H2 IH2 ]; simpl. * constructor 1 with p. now vec rew. * constructor 2; auto. now apply vec_embed_vec_map. Qed.
Theorem
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import idx vec vtree.", "Require Import base statements." ]
theories/conversions/kruskal_vtree_af_to_afs.v
kruskal_vtree_af_to_afs
kruskal_vtree_to_ltree : af_kruskal_vtree → af_kruskal_ltree. Proof. intros K X R HR; generalize (K _ _ HR); clear HR. af rel morph (fun x y => vtree_ltree x = y). + intros t; destruct (vtree_ltree_surj t); eauto. + intros t1 t2 ? ? <- <-. induction 1 as [ t n x v p H1 IH1 | n x v m y w H1 H2 IH2 ]. * rewrite vtree_ltree_fix. constructor 1 with (vtree_ltree v⦃p⦄); auto. apply in_map_iff; exists v⦃p⦄; split; auto. apply in_vec_list; eauto. * rewrite !vtree_ltree_fix. constructor 2; auto. clear x y H1 H2; revert IH2. induction 1; econstructor; eauto. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec vtree ltree.", "Require Import base statements." ]
theories/conversions/kruskal_vtree_to_ltree.v
kruskal_vtree_to_ltree
veldman_vtree_upto_afs_to_higman_dtree_afs : afs_veldman_vtree_upto → afs_higman_dtree. Proof. intros Kr k U X R H1 H2. set (X' i := if le_lt_dec k i then ⊥₁ else X i). set (R' i := if le_lt_dec k i then ⊥₂ else R i). cut (afs (wft X') (vtree_upto_embed k R')). af rel morph eq. + intros t Ht; exists t; split; auto. revert t Ht; apply wft_mono. intros n; unfold X'. destruct (le_lt_dec k n); eauto. + intros ? ? s t ? ? ? ? -> ->. rewrite -> vtree_product_upto_iff; eauto. apply vtree_upto_embed_mono. intros n Hn; unfold R'. destruct (le_lt_dec k n); now auto. + apply Kr. * intros n Hn; unfold X'. destruct (le_lt_dec k n); [ | lia ]. destruct (le_lt_dec k k); auto; lia. * intros n Hn; unfold R'. destruct (le_lt_dec k n); [ | lia ]. destruct (le_lt_dec k k); auto; lia. * intros n Hn; unfold X', R'. destruct (le_lt_dec k n); auto. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import dtree vtree." ]
theories/conversions/veldman_vtree_upto_afs_to_higman_dtree_afs.v
veldman_vtree_upto_afs_to_higman_dtree_afs
kruskal_theorem_vtree_afs : afs_veldman_vtree_upto → afs_kruskal_vtree. Proof. intros V U X R H. cut (afs (wft (fun _ => X)) (vtree_upto_embed 0 (fun _ => R))). + apply afs_mono; auto. intros ? ? ? ?; apply vtree_upto_homeo_uniform; auto. + apply afs_vtree_upto_embed; auto. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith Utf8.", "From KruskalTrees\n Require Import list_utils idx vec vtree ltree.", "Require Import base vtree_embed ltree_embed statements." ]
theories/conversions/veldman_vtree_upto_afs_to_kruskal_vtree_afs.v
kruskal_theorem_vtree_afs
atree : Type := | atree_cons x : vec atree (a x) → atree. Set Elimination Schemes. Arguments atree_cons : clear implicits.
Inductive
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree
atree_rect t : P t := match t with | ⟨x|v⟩ₐ => P_cons v (λ i, atree_rect v⦃i⦄) end.
Fixpoint
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree_rect
atree_rect_fix x v : atree_rect ⟨x|v⟩ₐ = P_cons v (λ i, atree_rect v⦃i⦄). Proof. reflexivity. Qed.
Fact
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree_rect_fix
atree_rec (P : _ → Set) := atree_rect P.
Definition
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree_rec
atree_ind (P : _ → Prop) := atree_rect P. Unset Elimination Schemes. Variable (R : nat → rel₂ X) (T : rel₂ X).
Definition
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree_ind
atree_product_embed : atree → atree → Prop := | dtree_embed_subt x v s i : s ≤ₚ v⦃i⦄ → s ≤ₚ ⟨x|v⟩ₐ | dtree_embed_root x v y w : R (a x) x y → vec_forall2 atree_product_embed v w → ⟨x|v⟩ₐ ≤ₚ ⟨y|w⟩ₐ where "s ≤ₚ t" := (atree_product_embed s t).
Inductive
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree_product_embed
atree_homeo_embed : atree → atree → Prop := | vtree_homeo_embed_subt t x v i : t ≤ₕ v⦃i⦄ → t ≤ₕ ⟨x|v⟩ₐ | vtree_homeo_embed_root x v y w : T x y → vec_embed atree_homeo_embed v w → ⟨x|v⟩ₐ ≤ₕ ⟨y|w⟩ₐ where "s ≤ₕ t" := (atree_homeo_embed s t). Set Elimination Schemes.
Inductive
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree_homeo_embed
atree_product_embed_ind : ∀ s t, s ≤ₚ t → P s t. Proof. refine (fix loop s t D { struct D } := _). destruct D as [ t x v p H1 | x v y w H1 H2 ]. + apply HT1 with (1 := H1); trivial. apply loop, H1. + apply HT2; trivial. revert v w H2; generalize (a x) (a y). clear x y H1. induction 1; eauto with vec_db. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree_product_embed_ind
atree_homeo_embed_ind : ∀ s t, s ≤ₕ t → P s t. Proof. refine (fix loop s t D { struct D } := _). destruct D as [ t x v p H1 | x v y w H1 H2 ]. + apply HT1 with (1 := H1); trivial. apply loop, H1. + apply HT2; trivial. revert v w H2; generalize (a x) (a y). clear x y H1. induction 1; eauto with vec_db. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import list_utils idx vec dtree vtree.", "Require Import base." ]
theories/embeddings/atree_embed.v
atree_homeo_embed_ind
dtree_product_embed : dtree X → dtree X → Prop := | dtree_embed_subt k x (v : vec _ k) s i : s ≤ₚ v⦃i⦄ → s ≤ₚ ⟨x|v⟩ | dtree_embed_root k x (v : vec _ k) y w : R x y → vec_fall2 dtree_product_embed v w → ⟨x|v⟩ ≤ₚ ⟨y|w⟩ where "s ≤ₚ t" := (dtree_product_embed s t).
Inductive
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree.", "Require Import base." ]
theories/embeddings/dtree_embed.v
dtree_product_embed
dtree_product_embed_inv r t : r ≤ₚ t → match t with | @dtree_cons _ m y v => (∃i, r ≤ₚ v⦃i⦄) ∨ match r with | @dtree_cons _ n x u => ∃ e : n = m, R x↺e y ∧ vec_fall2 dtree_product_embed u↺e v end end. Proof. intros []; simpl; [ left | right ]; eauto; exists eq_refl; auto. Qed.
Fact
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree.", "Require Import base." ]
theories/embeddings/dtree_embed.v
dtree_product_embed_inv
dtree_product_embed_mono (R T : ∀k, X k → X k → Prop) : (∀k, R k ⊆₂ T k) → dtree_product_embed R ⊆₂ dtree_product_embed T. Proof. induction 2; eauto. Qed.
Fact
theories
[ "From Coq\n Require Import Utf8.", "From KruskalTrees\n Require Import tactics idx vec dtree.", "Require Import base." ]
theories/embeddings/dtree_embed.v
dtree_product_embed_mono
ltree_product_embed : ltree X → ltree X → Prop := | ltree_product_embed_subt {s t x l} : t ∈ l → s ≤ₚ t → s ≤ₚ ⟨x|l⟩ₗ | ltree_product_embed_root {x l y m} : R x y → Forall2 ltree_product_embed l m → ⟨x|l⟩ₗ ≤ₚ ⟨y|m⟩ₗ where "s ≤ₚ t" := (ltree_product_embed s t). (* This is the homeomorphic embedding for Kruskal's tree theorem *)
Inductive
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils ltree.", "Require Import base." ]
theories/embeddings/ltree_embed.v
ltree_product_embed
ltree_homeo_embed : ltree X → ltree X → Prop := | homeo_embed_subt s t x l : t ∈ l → s ≤ₕ t → s ≤ₕ ⟨x|l⟩ₗ | homeo_embed_root x l y m : R x y → list_embed ltree_homeo_embed l m → ⟨x|l⟩ₗ ≤ₕ ⟨y|m⟩ₗ where "s ≤ₕ t" := (ltree_homeo_embed s t). Set Elimination Schemes. Hint Constructors ltree_product_embed ltree_homeo_embed : core.
Inductive
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils ltree.", "Require Import base." ]
theories/embeddings/ltree_embed.v
ltree_homeo_embed
ltree_product_embed_ind s t (Hst : s ≤ₚ t) { struct Hst } : P s t := match Hst with | ltree_product_embed_subt H1 H2 => HT1 H1 H2 (ltree_product_embed_ind H2) | ltree_product_embed_root H1 H2 => HT2 H1 H2 (Forall2_mono ltree_product_embed_ind H2) end.
Fixpoint
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils ltree.", "Require Import base." ]
theories/embeddings/ltree_embed.v
ltree_product_embed_ind
ltree_homeo_embed_ind s t (Hst : s ≤ₕ t) : P s t. Proof. destruct Hst as [ s t x ll H1 H2 | x ll y mm H1 H2 ]. + apply HT1 with (1 := H1); trivial. apply ltree_homeo_embed_ind, H2. + apply HT2; trivial. now apply list_embed_mono with (1 := ltree_homeo_embed_ind). Qed.
Fixpoint
theories
[ "From Coq\n Require Import Arith List Lia Utf8.", "From KruskalTrees\n Require Import tactics list_utils ltree.", "Require Import base." ]
theories/embeddings/ltree_embed.v
ltree_homeo_embed_ind
vtree_homeo_embed : vtree A → vtree A → Prop := | vtree_homeo_embed_subt t n x (v : vec _ n) i : t ≤ₕ v⦃i⦄ → t ≤ₕ ⟨x|v⟩ | vtree_homeo_embed_root n x (v : vec _ n) m y (w : vec _ m) : Rₕ x y → vec_embed vtree_homeo_embed v w → ⟨x|v⟩ ≤ₕ ⟨y|w⟩ where "s ≤ₕ t" := (vtree_homeo_embed s t). Set Elimination Schemes. Hint Constructors vtree_homeo_embed vtree_upto_embed : core.
Inductive
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree.", "Require Import base.", "Require Export dtree_embed." ]
theories/embeddings/vtree_embed.v
vtree_homeo_embed
vtree_homeo_embed_ind : ∀ s t, s ≤ₕ t → P s t. Proof. refine (fix loop s t D { struct D } := _). destruct D as [ t n x v p H1 | n x v m y w H1 H2 ]. + apply HT1 with (1 := H1); trivial. apply loop, H1. + apply HT2; trivial. clear x y H1; revert H2. induction 1; eauto with vec_db. Qed.
Theorem
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree.", "Require Import base.", "Require Export dtree_embed." ]
theories/embeddings/vtree_embed.v
vtree_homeo_embed_ind
vtree_product_upto k (R : nat → rel₂ A) : (∀ n, k ≤ n → R n ⊆₂ R k) → dtree_product_embed R ⊆₂ vtree_upto_embed k R. Proof. intros H. induction 1 as [ | n ]; eauto. destruct (le_lt_dec k n); eauto. Qed.
Fact
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree.", "Require Import base.", "Require Export dtree_embed." ]
theories/embeddings/vtree_embed.v
vtree_product_upto
vtree_product_upto_iff k (X : nat → rel₁ A) (R : nat → rel₂ A) : (∀ n x, k ≤ n → ¬ X n x) → ∀ s t, wft X s → dtree_product_embed R s t ↔ vtree_upto_embed k R s t. Proof. intros HX s t H; split; intros H1; revert H1 H. + induction 1 as [ t n x v p H1 IH1 | n x v y w H1 H2 IH2 ]; intros H; eauto. rewrite wft_fix in H; destruct H as (H3 & H4). constructor 2; auto. * destruct (le_lt_dec k n) as [ Hn | ]; auto. now apply HX in H3. * intro; apply IH2; auto. + induction 1 as [ t n x v p H1 IH1 | n x v y w H1 H2 H3 IH3 | n x v m y w H1 H2 H3 IH3 ]; intros H; eauto with dtree_db. * rewrite wft_fix in H; destruct H. constructor 2; auto. intros p; apply IH3; auto. * rewrite wft_fix in H. apply proj1, HX in H; easy. Qed.
Fact
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree.", "Require Import base.", "Require Export dtree_embed." ]
theories/embeddings/vtree_embed.v
vtree_product_upto_iff
vtree_upto_homeo k (R : nat → rel₂ A) : (∀n, n ≤ k → R n ⊆₂ Rₕ) → vtree_upto_embed k R ⊆₂ vtree_homeo_embed. Proof. intros H. induction 1 as [ | n ? ? ? ? Hn | ]; eauto. generalize (lt_le_weak _ _ Hn); intro; eauto. Qed.
Fact
theories
[ "From Coq\n Require Import Arith Lia Utf8.", "From KruskalTrees\n Require Import tactics idx vec vtree.", "Require Import base.", "Require Export dtree_embed." ]
theories/embeddings/vtree_embed.v
vtree_upto_homeo
End of preview. Expand in Data Studio

Coq-Kruskal

Structured dataset from Kruskal-Theorems — Kruskal tree theorem formalization.

102 declarations extracted from Coq source files.

Applications

  • Training language models on formal proofs
  • Fine-tuning theorem provers
  • Retrieval-augmented generation for proof assistants
  • Learning proof embeddings and representations

Source

Schema

Column Type Description
fact string Declaration body
type string Lemma, Definition, Theorem, etc.
library string Source module
imports list Required imports
filename string Source file path
symbolic_name string Identifier
Downloads last month
29

Collection including phanerozoic/Coq-Kruskal