Download data/lean/OAI/Probability/FreeIsing/Trees/ClusterRestriction.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.79 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Trees/ClusterRestriction.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FreeIsing/Trees/ClusterRestriction.lean
-
curl -L -o ClusterRestriction.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Trees/ClusterRestriction.lean
8.79 kB
| import OAI.Probability.FreeIsing.Estimates.CylinderAutomorphism | |
| import OAI.Probability.FreeIsing.Trees.ConnectedHull | |
| import OAI.Probability.FreeIsing.Trees.Parents | |
| import OAI.Probability.FreeIsing.Trees.Transitivity | |
| namespace OAI | |
| namespace Problem367 | |
| namespace ClusterRestriction | |
| theorem entering_prefix_edge {d : β} {r u v : TreeVertex d} | |
| (hu : Β¬ r.1 <+: u.1) (hv : r.1 <+: v.1) (hadj : treeAdj u v) : | |
| u = parentVertex r β§ v = r := by | |
| have hvr : v = r := by | |
| by_contra hne | |
| exact hu (treeAdj_preserves_prefix hv hadj.symm hne) | |
| subst v | |
| refine β¨?_, rflβ© | |
| rcases hadj with β¨c, hcβ© | β¨c, hcβ© | |
| Β· apply Subtype.ext | |
| simp [parentVertex, hc] | |
| Β· exact False.elim (hu (hc βΈ List.prefix_append r.1 [c])) | |
| theorem relation_parent_of_reachable {d : β} | |
| {R : TreeVertex d β TreeVertex d β Prop} | |
| (hR : β {u v}, R u v β treeAdj u v) | |
| {r x y : TreeVertex d} (hx : Β¬ r.1 <+: x.1) (hy : r.1 <+: y.1) | |
| (hxy : Relation.ReflTransGen R x y) : R (parentVertex r) r := by | |
| by_contra hedge | |
| have hstay : Β¬ r.1 <+: y.1 := by | |
| clear hy | |
| induction hxy with | |
| | refl => exact hx | |
| | @tail z w hpath hzw ih => | |
| intro hw | |
| obtain β¨hz, hwβ© := entering_prefix_edge ih hw (hR hzw) | |
| exact hedge (by simpa only [hz, hw] using hzw) | |
| exact hstay hy | |
| theorem prefix_step_of_reachable {d : β} | |
| {R : TreeVertex d β TreeVertex d β Prop} | |
| (hR : β {u v}, R u v β treeAdj u v) | |
| {y : TreeVertex d} | |
| (hxy : Relation.ReflTransGen R (ConnectedHull.root d) y) | |
| {n : β} (hn : n < y.1.length) : | |
| R (ConnectedHull.takeVertex y n) (ConnectedHull.takeVertex y (n + 1)) := by | |
| have hlength : n + 1 β€ y.1.length := by omega | |
| have hout : Β¬ (ConnectedHull.takeVertex y (n + 1)).1 <+: | |
| (ConnectedHull.root d).1 := by | |
| intro hpre | |
| have hle := hpre.length_le | |
| simp only [ConnectedHull.takeVertex, ConnectedHull.root, List.length_take, | |
| List.length_nil, Nat.min_eq_left hlength] at hle | |
| omega | |
| have hparent : parentVertex (ConnectedHull.takeVertex y (n + 1)) = | |
| ConnectedHull.takeVertex y n := by | |
| apply treeAdj_parent_of_length_lt (ConnectedHull.prefix_adj y hn) | |
| simp only [ConnectedHull.takeVertex, List.length_take, | |
| Nat.min_eq_left hn.le, Nat.min_eq_left hlength] | |
| omega | |
| have h := relation_parent_of_reachable hR hout (List.take_prefix (n + 1) y.1) hxy | |
| simpa only [hparent] using h | |
| theorem reachable_restrict_of_root_mem {d : β} | |
| {D : Finset (TreeVertex d)} (hD : ConnectedFinset D) | |
| (hroot : ConnectedHull.root d β D) | |
| {R : TreeVertex d β TreeVertex d β Prop} | |
| (hR : β {u v}, R u v β treeAdj u v) | |
| {y : TreeVertex d} (hy : y β D) | |
| (hxy : Relation.ReflTransGen R (ConnectedHull.root d) y) : | |
| Relation.ReflTransGen (fun u v => u β D β§ v β D β§ R u v) | |
| (ConnectedHull.root d) y := by | |
| have hpref (n : β) : ConnectedHull.takeVertex y n β D := by | |
| apply hD.prefix_mem_of_min_length_le hroot | |
| (fun w _ => by simp [ConnectedHull.root]) hy | |
| Β· exact List.take_prefix n y.1 | |
| Β· simp [ConnectedHull.root] | |
| have hpath : β n β€ y.1.length, | |
| Relation.ReflTransGen (fun u v => u β D β§ v β D β§ R u v) | |
| (ConnectedHull.root d) (ConnectedHull.takeVertex y n) := by | |
| intro n | |
| induction n with | |
| | zero => | |
| intro _ | |
| simpa only [ConnectedHull.prefix_zero] using | |
| (Relation.ReflTransGen.refl : Relation.ReflTransGen | |
| (fun u v => u β D β§ v β D β§ R u v) | |
| (ConnectedHull.root d) (ConnectedHull.root d)) | |
| | succ n ih => | |
| intro hn | |
| exact (ih (by omega)).tail | |
| β¨hpref n, hpref (n + 1), prefix_step_of_reachable hR hxy (by omega)β© | |
| simpa only [ConnectedHull.prefix_length] using hpath y.1.length le_rfl | |
| end ClusterRestriction | |
| theorem ConnectedFinset.reachable_restrict_iff {d : β} | |
| {D : Finset (TreeVertex d)} (hD : ConnectedFinset D) | |
| {R : TreeVertex d β TreeVertex d β Prop} | |
| (hR : β {u v}, R u v β treeAdj u v) | |
| {x y : TreeVertex d} (hx : x β D) (hy : y β D) : | |
| Relation.ReflTransGen R x y β | |
| Relation.ReflTransGen (fun u v => u β D β§ v β D β§ R u v) x y := by | |
| classical | |
| constructor | |
| Β· intro hxy | |
| obtain β¨g, hgβ© := exists_treeAut_to_root x | |
| let E := D.image g.toEquiv | |
| let R' : TreeVertex d β TreeVertex d β Prop := | |
| fun u v => R (g.toEquiv.symm u) (g.toEquiv.symm v) | |
| have hE : ConnectedFinset E := hD.image g | |
| have hxE : ConnectedHull.root d β E := by | |
| change (β¨[], List.IsChain.nilβ© : TreeVertex d) β D.image g.toEquiv | |
| rw [β hg] | |
| exact Finset.mem_image.mpr β¨x, hx, rflβ© | |
| have hyE : g.toEquiv y β E := Finset.mem_image.mpr β¨y, hy, rflβ© | |
| have hR' : β {u v}, R' u v β treeAdj u v := by | |
| intro u v huv | |
| have h := (g.map_adj (g.toEquiv.symm u) (g.toEquiv.symm v)).mpr (hR huv) | |
| simpa only [Equiv.apply_symm_apply] using h | |
| have hxy' : Relation.ReflTransGen R' (ConnectedHull.root d) (g.toEquiv y) := by | |
| have h := Relation.ReflTransGen.lift g.toEquiv | |
| (p := R') (fun u v huv => by simpa only [Function.onFun, R', Equiv.symm_apply_apply] using huv) | |
| x y hxy | |
| simpa only [Function.onFun, hg, ConnectedHull.root] using h | |
| have hinner := ClusterRestriction.reachable_restrict_of_root_mem hE hxE hR' hyE hxy' | |
| have hmem : β z β E, g.toEquiv.symm z β D := by | |
| intro z hz | |
| obtain β¨w, hw, rflβ© := Finset.mem_image.mp hz | |
| simpa only [Equiv.symm_apply_apply] using hw | |
| have hback := Relation.ReflTransGen.lift g.toEquiv.symm | |
| (p := fun u v => u β D β§ v β D β§ R u v) | |
| (fun u v huv => β¨hmem u huv.1, hmem v huv.2.1, huv.2.2β©) | |
| (ConnectedHull.root d) (g.toEquiv y) hinner | |
| have hgroot : g.toEquiv.symm (ConnectedHull.root d) = x := by | |
| change g.toEquiv.symm (β¨[], List.IsChain.nilβ© : TreeVertex d) = x | |
| rw [β hg, Equiv.symm_apply_apply] | |
| simpa only [Function.onFun, hgroot, Equiv.symm_apply_apply] using hback | |
| Β· exact Relation.ReflTransGen.mono (fun _ _ h => h.2.2) x y | |
| theorem ConnectedFinset.reachable_congr_on {d : β} | |
| {D : Finset (TreeVertex d)} (hD : ConnectedFinset D) | |
| {R S : TreeVertex d β TreeVertex d β Prop} | |
| (hR : β {u v}, R u v β treeAdj u v) | |
| (hS : β {u v}, S u v β treeAdj u v) | |
| (hRS : β u β D, β v β D, R u v β S u v) | |
| {x y : TreeVertex d} (hx : x β D) (hy : y β D) : | |
| Relation.ReflTransGen R x y β Relation.ReflTransGen S x y := by | |
| rw [hD.reachable_restrict_iff hR hx hy, hD.reachable_restrict_iff hS hx hy] | |
| have heq : (fun u v => u β D β§ v β D β§ R u v) = | |
| (fun u v => u β D β§ v β D β§ S u v) := by | |
| funext u v | |
| apply propext | |
| constructor | |
| Β· exact fun h => β¨h.1, h.2.1, (hRS u h.1 v h.2.1).mp h.2.2β© | |
| Β· exact fun h => β¨h.1, h.2.1, (hRS u h.1 v h.2.1).mpr h.2.2β© | |
| rw [heq] | |
| theorem ConnectedFinset.cluster_constant_iff_edges {d : β} {Ξ± : Type*} | |
| {D : Finset (TreeVertex d)} (hD : ConnectedFinset D) | |
| {R : TreeVertex d β TreeVertex d β Prop} | |
| (hR : β {u v}, R u v β treeAdj u v) (eta : TreeVertex d β Ξ±) : | |
| (β u β D, β v β D, Relation.ReflTransGen R u v β eta u = eta v) β | |
| (β u β D, β v β D, R u v β eta u = eta v) := by | |
| constructor | |
| Β· exact fun h u hu v hv huv => h u hu v hv (.single huv) | |
| Β· intro he u hu v hv huv | |
| have hp := (hD.reachable_restrict_iff hR hu hv).mp huv | |
| clear huv hv | |
| induction hp with | |
| | refl => rfl | |
| | @tail z w hp hzw ih => | |
| exact ih.trans (he z hzw.1 w hzw.2.1 hzw.2.2) | |
| theorem ConnectedFinset.cluster_constant_iff_inducedEdges {d : β} {Ξ± : Type*} | |
| {D : Finset (TreeVertex d)} (hD : ConnectedFinset D) | |
| {R : TreeVertex d β TreeVertex d β Prop} | |
| (hR : β {u v}, R u v β treeAdj u v) (hRsymm : β {u v}, R u v β R v u) | |
| (eta : TreeVertex d β Ξ±) : | |
| (β u β D, β v β D, Relation.ReflTransGen R u v β eta u = eta v) β | |
| (β e β inducedEdges D, R e.1 e.2 β eta e.1 = eta e.2) := by | |
| classical | |
| rw [hD.cluster_constant_iff_edges hR eta] | |
| constructor | |
| Β· intro h e he hRe | |
| have hmem := Finset.mem_product.mp (Finset.mem_filter.mp he).1 | |
| exact h e.1 hmem.1 e.2 hmem.2 hRe | |
| Β· intro h u hu v hv huv | |
| have hadj := hR huv | |
| rcases treeAdj_length hadj with hlen | hlen | |
| Β· apply h (u, v) _ huv | |
| exact Finset.mem_filter.mpr β¨Finset.mem_product.mpr β¨hu, hvβ©, | |
| hadj, by change u.1.length < v.1.length; omegaβ© | |
| Β· have he : (v, u) β inducedEdges D := | |
| Finset.mem_filter.mpr β¨Finset.mem_product.mpr β¨hv, huβ©, | |
| hadj.symm, by change v.1.length < u.1.length; omegaβ© | |
| exact (h (v, u) he (hRsymm huv)).symm | |
| end Problem367 | |
| end OAI | |