Datasets:
AI4M
/

text
stringlengths
0
3.34M
/- Copyright (c) 2022 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang ! This file was ported from Lean 3 source module category_theory.sites.surjective ! leanprover-community/mathlib commit 70fd9563a21e7b963887c9360bd29b2393e6225a ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.CategoryTheory.Sites.Subsheaf import Mathbin.CategoryTheory.Sites.CompatibleSheafification /-! # Locally surjective morphisms ## Main definitions - `is_locally_surjective` : A morphism of presheaves valued in a concrete category is locally surjective with respect to a grothendieck topology if every section in the target is locally in the set-theoretic image, i.e. the image sheaf coincides with the target. ## Main results - `to_sheafify_is_locally_surjective` : `to_sheafify` is locally surjective. -/ universe v u w v' u' w' open Opposite CategoryTheory CategoryTheory.GrothendieckTopology namespace CategoryTheory variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) attribute [local instance] concrete_category.has_coe_to_sort concrete_category.has_coe_to_fun variable {A : Type u'} [Category.{v'} A] [ConcreteCategory.{w'} A] /-- Given `f : F ⟶ G`, a morphism between presieves, and `s : G.obj (op U)`, this is the sieve of `U` consisting of the `i : V ⟶ U` such that `s` restricted along `i` is in the image of `f`. -/ @[simps (config := lemmasOnly)] def imageSieve {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : Sieve U where arrows V i := ∃ t : F.obj (op V), f.app _ t = G.map i.op s downward_closed' := by rintro V W i ⟨t, ht⟩ j refine' ⟨F.map j.op t, _⟩ rw [op_comp, G.map_comp, comp_apply, ← ht, elementwise_of f.naturality] #align category_theory.image_sieve CategoryTheory.imageSieve theorem imageSieve_eq_sieveOfSection {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : imageSieve f s = (imagePresheaf (whiskerRight f (forget A))).sieveOfSection s := rfl #align category_theory.image_sieve_eq_sieve_of_section CategoryTheory.imageSieve_eq_sieveOfSection theorem imageSieve_whisker_forget {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : imageSieve (whiskerRight f (forget A)) s = imageSieve f s := rfl #align category_theory.image_sieve_whisker_forget CategoryTheory.imageSieve_whisker_forget theorem imageSieve_app {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : F.obj (op U)) : imageSieve f (f.app _ s) = ⊤ := by ext (V i) simp only [sieve.top_apply, iff_true_iff, image_sieve_apply] have := elementwise_of (f.naturality i.op) exact ⟨F.map i.op s, this s⟩ #align category_theory.image_sieve_app CategoryTheory.imageSieve_app /-- A morphism of presheaves `f : F ⟶ G` is locally surjective with respect to a grothendieck topology if every section of `G` is locally in the image of `f`. -/ def IsLocallySurjective {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : Prop := ∀ (U : C) (s : G.obj (op U)), imageSieve f s ∈ J U #align category_theory.is_locally_surjective CategoryTheory.IsLocallySurjective theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : IsLocallySurjective J f ↔ (imagePresheaf (whiskerRight f (forget A))).sheafify J = ⊤ := by simp only [subpresheaf.ext_iff, Function.funext_iff, Set.ext_iff, top_subpresheaf_obj, Set.top_eq_univ, Set.mem_univ, iff_true_iff] exact ⟨fun H U => H (unop U), fun H U => H (op U)⟩ #align category_theory.is_locally_surjective_iff_image_presheaf_sheafify_eq_top CategoryTheory.isLocallySurjective_iff_imagePresheaf_sheafify_eq_top theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top' {F G : Cᵒᵖ ⥤ Type w} (f : F ⟶ G) : IsLocallySurjective J f ↔ (imagePresheaf f).sheafify J = ⊤ := by simp only [subpresheaf.ext_iff, Function.funext_iff, Set.ext_iff, top_subpresheaf_obj, Set.top_eq_univ, Set.mem_univ, iff_true_iff] exact ⟨fun H U => H (unop U), fun H U => H (op U)⟩ #align category_theory.is_locally_surjective_iff_image_presheaf_sheafify_eq_top' CategoryTheory.isLocallySurjective_iff_imagePresheaf_sheafify_eq_top' theorem isLocallySurjective_iff_isIso {F G : Sheaf J (Type w)} (f : F ⟶ G) : IsLocallySurjective J f.1 ↔ IsIso (imageSheafι f) := by rw [image_sheaf_ι, is_locally_surjective_iff_image_presheaf_sheafify_eq_top', subpresheaf.eq_top_iff_is_iso] exact ⟨fun h => @is_iso_of_reflects_iso _ _ (image_sheaf_ι f) (Sheaf_to_presheaf J _) h _, fun h => @functor.map_is_iso _ _ (Sheaf_to_presheaf J _) _ h⟩ #align category_theory.is_locally_surjective_iff_is_iso CategoryTheory.isLocallySurjective_iff_isIso theorem isLocallySurjective_iff_whisker_forget {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : IsLocallySurjective J f ↔ IsLocallySurjective J (whiskerRight f (forget A)) := by simpa only [is_locally_surjective_iff_image_presheaf_sheafify_eq_top] #align category_theory.is_locally_surjective_iff_whisker_forget CategoryTheory.isLocallySurjective_iff_whisker_forget theorem isLocallySurjective_of_surjective {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) (H : ∀ U, Function.Surjective (f.app U)) : IsLocallySurjective J f := by intro U s obtain ⟨t, rfl⟩ := H _ s rw [image_sieve_app] exact J.top_mem _ #align category_theory.is_locally_surjective_of_surjective CategoryTheory.isLocallySurjective_of_surjective theorem isLocallySurjective_of_iso {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsIso f] : IsLocallySurjective J f := by apply is_locally_surjective_of_surjective intro U apply Function.Bijective.surjective rw [← is_iso_iff_bijective] infer_instance #align category_theory.is_locally_surjective_of_iso CategoryTheory.isLocallySurjective_of_iso theorem IsLocallySurjective.comp {F₁ F₂ F₃ : Cᵒᵖ ⥤ A} {f₁ : F₁ ⟶ F₂} {f₂ : F₂ ⟶ F₃} (h₁ : IsLocallySurjective J f₁) (h₂ : IsLocallySurjective J f₂) : IsLocallySurjective J (f₁ ≫ f₂) := by intro U s have : (sieve.bind (image_sieve f₂ s) fun _ _ h => image_sieve f₁ h.some) ≤ image_sieve (f₁ ≫ f₂) s := by rintro V i ⟨W, i, j, H, ⟨t', ht'⟩, rfl⟩ refine' ⟨t', _⟩ rw [op_comp, F₃.map_comp, nat_trans.comp_app, comp_apply, comp_apply, ht', elementwise_of f₂.naturality, H.some_spec] apply J.superset_covering this apply J.bind_covering · apply h₂ · intros apply h₁ #align category_theory.is_locally_surjective.comp CategoryTheory.IsLocallySurjective.comp section variable (F : Cᵒᵖ ⥤ Type max u v) /-- The image of `F` in `J.sheafify F` is isomorphic to the sheafification. -/ noncomputable def sheafificationIsoImagePresheaf : J.sheafify F ≅ ((imagePresheaf (J.toSheafify F)).sheafify J).toPresheaf where Hom := J.sheafifyLift (toImagePresheafSheafify J _) ((isSheaf_iff_isSheaf_of_type J _).mpr <| Subpresheaf.sheafify_isSheaf _ <| (isSheaf_iff_isSheaf_of_type J _).mp <| sheafify_isSheaf J _) inv := Subpresheaf.ι _ hom_inv_id' := J.sheafify_hom_ext _ _ (J.sheafify_isSheaf _) (by simp [to_image_presheaf_sheafify]) inv_hom_id' := by rw [← cancel_mono (subpresheaf.ι _), category.id_comp, category.assoc] refine' Eq.trans _ (category.comp_id _) congr 1 exact J.sheafify_hom_ext _ _ (J.sheafify_is_sheaf _) (by simp [to_image_presheaf_sheafify]) infer_instance #align category_theory.sheafification_iso_image_presheaf CategoryTheory.sheafificationIsoImagePresheaf -- We need to sheafify variable {B : Type w} [Category.{max u v} B] [ConcreteCategory.{max u v} B] [∀ X : C, Limits.HasColimitsOfShape (J.cover X)ᵒᵖ B] [∀ (P : Cᵒᵖ ⥤ B) (X : C) (S : J.cover X), Limits.HasMultiequalizer (S.index P)] [∀ (X : C) (W : J.cover X) (P : Cᵒᵖ ⥤ B), Limits.PreservesLimit (W.index P).multicospan (forget B)] [∀ X : C, Limits.PreservesColimitsOfShape (J.cover X)ᵒᵖ (forget B)] [∀ (α β : Type max u v) (fst snd : β → α), Limits.HasLimitsOfShape (Limits.WalkingMulticospan fst snd) B] theorem toSheafify_isLocallySurjective (F : Cᵒᵖ ⥤ B) : IsLocallySurjective J (J.toSheafify F) := by rw [is_locally_surjective_iff_whisker_forget, ← to_sheafify_comp_sheafify_comp_iso_inv] apply is_locally_surjective.comp · rw [is_locally_surjective_iff_image_presheaf_sheafify_eq_top, subpresheaf.eq_top_iff_is_iso] exact is_iso.of_iso_inv (sheafification_iso_image_presheaf J (F ⋙ forget B)) · exact is_locally_surjective_of_iso _ _ #align category_theory.to_sheafify_is_locally_surjective CategoryTheory.toSheafify_isLocallySurjective end end CategoryTheory
%% Copyright (C) 2014, 2016, 2018-2019 Colin B. Macdonald %% Copyright (C) 2016 Lagu %% %% This file is part of OctSymPy. %% %% OctSymPy is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published %% by the Free Software Foundation; either version 3 of the License, %% or (at your option) any later version. %% %% This software is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied warranty %% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See %% the GNU General Public License for more details. %% %% You should have received a copy of the GNU General Public %% License along with this software; see the file COPYING. %% If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- %% @documentencoding UTF-8 %% @defmethod @@sym imag (@var{z}) %% Imaginary part of a symbolic expression. %% %% Examples: %% @example %% @group %% syms z %% imag(z) %% @result{} ans = (sym) im(z) %% @end group %% %% @group %% syms x real %% imag(x) %% @result{} ans = (sym) 0 %% imag(1i*x) %% @result{} ans = (sym) x %% @end group %% %% @group %% imag([x sym(pi) + 6i 7 3i]) %% @result{} ans = (sym) [0 6 0 3] (1×4 matrix) %% @end group %% @end example %% %% @seealso{@@sym/real, @@sym/conj, @@sym/ctranspose} %% @end defmethod function y = imag(z) if (nargin ~= 1) print_usage (); end y = elementwise_op ('im', z); end %!assert (isequal (imag (sym (4) + 3i),3)) %!test %! syms x y real %! z = x + 1i*y; %! assert (isequal (imag (z),y)) %!test %! syms x y real %! Z = [4 x + 1i*y; 1i*y 4 + 3i]; %! assert (isequal (imag (Z),[0 y; y 3])) %!test %! syms x real %! d = exp (x*i); %! assert (isequal (imag (d), sin (x))) %!test %! % round trip %! syms x %! d = 3 - 5i; %! f = imag (x); %! A = imag (d); %! h = function_handle (f); %! B = h (d); %! assert (A, B)
lemma bigoI [intro]: assumes "eventually (\<lambda>x. (norm (f x)) \<le> c * (norm (g x))) F" shows "f \<in> O[F](g)"
{-# LANGUAGE FlexibleContexts #-} module PlotGreensFunctionR2S1 where import Data.Array.Repa as R import Data.Complex import Data.List as L import FokkerPlanck.MonteCarlo import Image.IO import System.Directory import System.Environment import System.FilePath import Text.Printf import Utils.Array {-# INLINE reduceContrast #-} reduceContrast :: (R.Source s Double) => Int -> Array s DIM3 Double -> Array D DIM3 Double reduceContrast idx arr = let x = L.head . L.drop idx . L.reverse . L.sort . R.toList $ arr in R.map (\y -> if y >= x then x else y) arr main = do args@(numPointStr:numOrientationStr:sigmaStr:taoStr:lenStr:initStr:numTrailStr:numThreadStr:_) <- getArgs print args let numPoint = read numPointStr :: Int numOrientation = read numOrientationStr :: Int sigma = read sigmaStr :: Double tao = read taoStr :: Double len = read lenStr :: Int numTrail = read numTrailStr :: Int numThread = read numThreadStr :: Int arr <- solveMonteCarloR2S1 numThread numTrail numPoint numPoint numOrientation sigma tao numPoint "" let arr' = computeS . -- reduceContrast 10 . R.extend (Z :. (1 :: Int) :. All :. All) . R.sumS . rotate3D $ arr folderPath = "output/app/PlotGreensFunctionR2S1" createDirectoryIfMissing True folderPath plotImageRepa (folderPath </> printf "GreensR2S1.png") . ImageRepa 8 $ arr'
\subsection{Buying or owning} production of other commodities. house produces rentable space eg if you own house, you have rentable space each period. depreciation? 1 for something like rent, maybe 0.01 for long term asset
From iris.program_logic Require Export weakestpre total_weakestpre. From iris.heap_lang Require Export lang. From iris.proofmode Require Export tactics. From iris.heap_lang Require Import proofmode notation. Set Default Proof Using "Type". Section ListAllEven. Context `{heapG Σ}. Inductive mylist : Set := | mynil : mylist | mycons : Z → mylist → mylist. Fixpoint is_mylist (v : val) (xs : mylist) : iProp Σ := match xs with | mynil => ⌜v = InjLV #()⌝ | mycons n xs' => ∃(tail : loc) (vtail : val), ⌜v = InjRV (#n,#tail)⌝ ∗ tail ↦ vtail ∗ is_mylist vtail xs' end%I. Fixpoint all_even (xs : mylist) : bool := match xs with | mynil => true | mycons n xs' => andb (bool_decide (Z.rem n 2 = 0)) (all_even xs') end. Definition all_even_loop : val := rec: "all_even_loop" "xs" "state" := match: "xs" with InjL "unit" => Skip | InjR "cons" => let: "current" := (Fst "cons") `rem` #2 = #0 in "state" <- !"state" && "current";; "all_even_loop" !(Snd "cons") "state" end. Definition all_even_prog : val := λ: "xs", let: "state" := ref #true in all_even_loop "xs" "state";; !"state". (* Lemma val_eq_helper a b: *) (* a = b ↔ #a = #b. *) (* Proof. *) (* split; intros H0. *) (* - by rewrite H0. *) (* - by inversion H0. *) (* Qed. *) Lemma all_even_loop_wp v xs l (b : bool): [[{ l ↦ #b ∗ is_mylist v xs }]] all_even_loop v #l [[{ RET #(); l ↦ #(all_even xs && b) ∗ is_mylist v xs }]]. Proof. iIntros (Φ) "[Hl Hxs] HΦ". iInduction xs as [|n xs'] "IH" forall (v b Φ); simpl; wp_rec; wp_let. - iDestruct "Hxs" as "%"; subst. wp_match. wp_lam. (* iApply ("HΦ" with "[Hl]"). iFrame. done. *) (* by iApply ("HΦ" with "[$Hl]"). *) iApply ("HΦ" with "[$Hl //]"). - iDestruct "Hxs" as (tail vtail ->) "(Hltail & Hxtail)". wp_load. destruct b; (wp_if_true || wp_if_false); wp_store; wp_proj; wp_load; wp_apply ("IH" with "Hl Hxtail"); iIntros "[Hl Hxtail]"; iApply "HΦ"; iSplitL "Hl"; try (iExists tail, vtail; by iFrame). + (* b = true *) replace (bool_decide (n `rem` 2 = 0) && all_even xs' && true) with (all_even xs' && bool_decide (#(n `rem` 2) = #0)). done. replace (bool_decide (#(n `rem` 2) = #0)) with (bool_decide (n `rem` 2 = 0)). ring. (* apply bool_decide_iff. apply val_eq_helper. *) apply bool_decide_iff. split; intros H0. by rewrite H0. by inversion H0. + (* b = false *) by replace (all_even xs' && false) with (bool_decide (n `rem` 2 = 0) && all_even xs' && false) by ring. Qed. Lemma all_even_prog_wp v xs: [[{ is_mylist v xs }]] all_even_prog v [[{ RET #(all_even xs); is_mylist v xs }]]. Proof. iIntros (Φ) "Hxs HΦ". wp_lam. wp_alloc s as "Hs". wp_let. wp_apply (all_even_loop_wp with "[$Hs $Hxs]"). iIntros "[Hs Hxs]". wp_seq. replace (all_even xs && true) with (all_even xs) by ring. wp_load. by iApply "HΦ". Qed. Check all_even_prog_wp. End ListAllEven.
\chapter*{BIBLIOGRAPHIC-DOCUMENTALISTIC INFORMATION AND ABSTRACT} \thispagestyle{fancy} \addcontentsline{toc}{chapter}{BIBLIOGRAPHIC-DOCUMENTALISTIC INFORMATION AND ABSTRACT} % \begin{table}[h!] \begin{tabularx}{\textwidth}{@{}>{\bfseries}p{3.5cm}@{} @{}>{\bfseries}p{12.5cm}@{}} % UDC & 620.9:627.8(043.2) \\ Author: & Jan Pribošek \\ Supervisor:& Assist. Prof. Andrej Kryžanowski, Ph. D. \\ Title: & Calculation of energy parameters of the hydroelectric power plant \\ Document type: & Graduation - Thesis - university program \\ Notes: & {\totalpages} p., {\totalfigures} fig., {\totaltables} tab., {\totalequations} eq. \\ Keywords: & Energy parameters of hydroelectric power plant, river flow, flow in arbitrarily formed river channel % \end{tabularx} \end{table} \textbf{Abstract} % FIXME: finish this %In this thesis I have developed software for calculating energy parameters for the hydroelectric power plant. In the first part of the thesis, I have described the theoretical fundamentals and implemented algorithms for %creating consumption curve, hydrogram and duration curve out of given data for river channels of any geometry, as well as calculating produced electricity. In the second part of the thesis, I provided an example that proves correctness of the software calculations. In this thesis I have developed software for calculation of energy parameters of hydroelectric power plants. In the first part, the thesis provides an overview of the theoretical fundamentals. On this basis, the numerical algorithm was developed and implemented, which allows the estimation of the consumption curve, hydrograph, duration curve and the produced electricity for river channel of any geometry. Finally, the accuracy of the software calculations was verified with an example, calculated manually.
lemma (in sigma_algebra) sets_Collect_countable_Ex': assumes "\<And>i. i \<in> I \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" assumes "countable I" shows "{x\<in>\<Omega>. \<exists>i\<in>I. P i x} \<in> M"
[STATEMENT] lemma point_ordinate_zero [simp]: "ordinate 0 = 0" [PROOF STATE] proof (prove) goal (1 subgoal): 1. ordinate 0 = 0 [PROOF STEP] by (simp add: point_zero_def)
(*<*) theory sol06_2 imports "~~/src/HOL/IMP/Small_Step" "~~/src/HOL/IMP/Compiler" begin (*>*) text {* \ExerciseSheet{6}{18.~11.~2014} *} text {* \Exercise{Deskip} Define a recursive function *} (*<*)(*kill*) definition "deskseq c1 c2 = (if c1=SKIP then c2 else if c2=SKIP then c1 else c1;;c2)" definition "deskif b c1 c2 = (if c1=SKIP & c2=SKIP then SKIP else IF b THEN c1 ELSE c2)" (*>*) fun deskip :: "com \<Rightarrow> com" (*<*)(*keep*)where(*>*) (*<*) "deskip (c1;;c2) = deskseq (deskip c1) (deskip c2)" | "deskip (IF b THEN c1 ELSE c2) = deskif b (deskip c1) (deskip c2)" | "deskip (WHILE b DO c) = WHILE b DO deskip c" | "deskip c = c" (*>*) text{* that eliminates as many @{const SKIP}s as possible from a command. For example: @{prop[display]"deskip (SKIP;; WHILE b DO (x::=a;; SKIP)) = WHILE b DO x::=a"} Prove its correctness by induction on @{text c}: *} lemma "deskip c \<sim> c" (*<*) proof(induction c) case (Seq c1 c2) thus ?case by (auto simp add: deskseq_def) (metis Skip Big_Step.SkipE big_step.Seq)+ next case (If b c1 c2) thus ?case by (auto simp add: deskif_def) (metis big_step.IfFalse big_step.IfTrue Skip) next case While thus ?case by (simp add: sim_while_cong) qed auto (*>*) text{* Remember lemma @{thm[source]sim_while_cong} for the @{text WHILE} case. *} (*<*) end (*>*)
#find how many different letters are there #counting same letters just once function find_yes(group_ans) #remove spaces group_ans_no_spaces = replace(group_ans, " " => "") #get size of array with unique occurrences in the string number_of_y = length(unique(group_ans_no_spaces)) return number_of_y end f = open("input_day6","r") temp_s = "" sum_y = 0 #note that I modified my inputs to have an empty line at the end for lines in readlines(f) #if not empty line concatenate de string with space if lines != "" global temp_s = temp_s*" "*lines else #println(temp_s) n = find_yes(temp_s) global sum_y += n global temp_s = "" end end println(sum_y)
[STATEMENT] lemma sort_eq_Nil_iff [simp]: "sort xs = [] \<longleftrightarrow> xs = []" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (sort xs = []) = (xs = []) [PROOF STEP] by (metis set_empty set_sort)
lemmas tendsto_mult_right_zero = bounded_bilinear.tendsto_right_zero [OF bounded_bilinear_mult]
/- Copyright (c) 2021 OpenAI. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kunhao Zheng, Stanislas Polu, David Renshaw, OpenAI GPT-f -/ import mathzoo.imports.miniF2F open_locale nat rat real big_operators topological_space theorem algebra_others_exirrpowirrrat : ∃ a b, irrational a ∧ irrational b ∧ ¬ irrational (a^b) := begin let sqrt_2 := real.sqrt 2, by_cases irrational (sqrt_2^sqrt_2), { have h': ¬ irrational ((sqrt_2^sqrt_2)^sqrt_2), { intro h, rw ← (real.rpow_mul (real.sqrt_nonneg 2) (real.sqrt 2) (real.sqrt 2)) at h, have zlet : 0 ≤ (2 : ℝ), by norm_num, rw ← (real.sqrt_mul zlet 2) at h, rw real.sqrt_mul_self zlet at h, have x : (real.sqrt 2)^(2 : ℕ) = (real.sqrt 2)^(2 : ℝ), by norm_cast, rw ← x at h, rw real.sq_sqrt zlet at h, have tnotira : ¬ irrational 2, { convert rat.not_irrational 2, norm_cast, }, exact tnotira h, }, exact ⟨(sqrt_2^sqrt_2), sqrt_2, h, irrational_sqrt_two, h'⟩, }, { exact ⟨sqrt_2, sqrt_2, irrational_sqrt_two, irrational_sqrt_two, h⟩, } end
lemma homotopic_loops: "homotopic_loops s p q \<longleftrightarrow> (\<exists>h. continuous_on ({0..1::real} \<times> {0..1}) h \<and> image h ({0..1} \<times> {0..1}) \<subseteq> s \<and> (\<forall>x \<in> {0..1}. h(0,x) = p x) \<and> (\<forall>x \<in> {0..1}. h(1,x) = q x) \<and> (\<forall>t \<in> {0..1}. pathfinish(h \<circ> Pair t) = pathstart(h \<circ> Pair t)))"
State Before: α : Type u β : Type v γ : Type w f : α → β s : Computation α ⊢ bind s (pure ∘ f) = map f s State After: case bisim α : Type u β : Type v γ : Type w f : α → β s : Computation α ⊢ IsBisimulation fun c₁ c₂ => c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s case r α : Type u β : Type v γ : Type w f : α → β s : Computation α ⊢ bind s (pure ∘ f) = map f s ∨ ∃ s_1, bind s (pure ∘ f) = bind s_1 (pure ∘ f) ∧ map f s = map f s_1 Tactic: apply eq_of_bisim fun c₁ c₂ => c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s State Before: case bisim α : Type u β : Type v γ : Type w f : α → β s : Computation α ⊢ IsBisimulation fun c₁ c₂ => c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s State After: case bisim α : Type u β : Type v γ : Type w f : α → β s : Computation α c₁ c₂ : Computation β h : c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s ⊢ BisimO (fun c₁ c₂ => c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s) (destruct c₁) (destruct c₂) Tactic: intro c₁ c₂ h State Before: case bisim α : Type u β : Type v γ : Type w f : α → β s : Computation α c₁ c₂ : Computation β h : c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s ⊢ BisimO (fun c₁ c₂ => c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s) (destruct c₁) (destruct c₂) State After: no goals Tactic: exact match c₁, c₂, h with | _, c₂, Or.inl (Eq.refl _) => by cases' destruct c₂ with b cb <;> simp | _, _, Or.inr ⟨s, rfl, rfl⟩ => by apply recOn s <;> intro s <;> simp exact Or.inr ⟨s, rfl, rfl⟩ State Before: α : Type u β : Type v γ : Type w f : α → β s : Computation α c₁ c₂✝ : Computation β h : c₁ = c₂✝ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂✝ = map f s c₂ : Computation β ⊢ BisimO (fun c₁ c₂ => c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s) (destruct c₂) (destruct c₂) State After: no goals Tactic: cases' destruct c₂ with b cb <;> simp State Before: α : Type u β : Type v γ : Type w f : α → β s✝ : Computation α c₁ c₂ : Computation β h : c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s s : Computation α ⊢ BisimO (fun c₁ c₂ => c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s) (destruct (bind s (pure ∘ f))) (destruct (map f s)) State After: case h2 α : Type u β : Type v γ : Type w f : α → β s✝¹ : Computation α c₁ c₂ : Computation β h : c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s s✝ s : Computation α ⊢ bind s (pure ∘ f) = map f s ∨ ∃ s_1, bind s (pure ∘ f) = bind s_1 (pure ∘ f) ∧ map f s = map f s_1 Tactic: apply recOn s <;> intro s <;> simp State Before: case h2 α : Type u β : Type v γ : Type w f : α → β s✝¹ : Computation α c₁ c₂ : Computation β h : c₁ = c₂ ∨ ∃ s, c₁ = bind s (pure ∘ f) ∧ c₂ = map f s s✝ s : Computation α ⊢ bind s (pure ∘ f) = map f s ∨ ∃ s_1, bind s (pure ∘ f) = bind s_1 (pure ∘ f) ∧ map f s = map f s_1 State After: no goals Tactic: exact Or.inr ⟨s, rfl, rfl⟩ State Before: case r α : Type u β : Type v γ : Type w f : α → β s : Computation α ⊢ bind s (pure ∘ f) = map f s ∨ ∃ s_1, bind s (pure ∘ f) = bind s_1 (pure ∘ f) ∧ map f s = map f s_1 State After: no goals Tactic: exact Or.inr ⟨s, rfl, rfl⟩
module TerminationNoArgs where loop : Set loop = loop
/- Copyright (c) 2018 Luca Gerolla. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Luca Gerolla, Kevin Buzzard Results on homotopy composition, inverse, reparametrisation for fundamental group. -/ import analysis.topology.continuity import analysis.topology.topological_space import analysis.topology.infinite_sum import analysis.topology.topological_structures import analysis.topology.uniform_space import analysis.real import data.real.basic tactic.norm_num import data.set.basic import Topology.Material.pasting_lemma import Topology.Material.path import Topology.Material.real_results import Topology.Material.homotopy open set filter lattice classical namespace homotopy_results open path open homotopy variables {α : Type*} [topological_space α ] variables {β : Type*} [topological_space β ] { x y z w : β } variable s : I01 noncomputable theory local attribute [instance] classical.prop_decidable local notation `I` := @set.univ I01 ----------------------------------------------------- --- Extra Result needed later -- Now in Mathlib lemma frontier_lt_subset_eq [topological_space α] [decidable_linear_order α] [t : ordered_topology α] [topological_space β] {f g : β → α} (hf : continuous f) (hg : continuous g) : frontier {b | f b < g b} ⊆ {b | f b = g b} := begin unfold frontier, have h₁ : interior {b : β | f b < g b} = {b : β | f b < g b}, exact interior_eq_iff_open.2 (is_open_lt hf hg), rw h₁, have h₂ : closure {b : β | f b < g b} ⊆ closure {b : β | f b ≤ g b}, refine closure_mono _ , rw set.set_of_subset_set_of, intros x h, exact le_of_lt h, have h₃ : closure {b : β | f b ≤ g b} = {b : β | f b ≤ g b}, exact closure_eq_iff_is_closed.2 (is_closed_le hf hg), rw h₃ at h₂ , have g₁ : closure {b : β | f b < g b} \ {b : β | f b < g b} ⊆ {b : β | f b ≤ g b} \ {b : β | f b < g b}, {unfold has_sdiff.sdiff set.diff, intros a Ha, simp at Ha, simp, cases Ha with a₁ a₂ , have h₄ : a ∈ {b : β | f b ≤ g b}, exact set.mem_of_mem_of_subset a₁ h₂, rw mem_set_of_eq at h₄, exact ⟨ h₄, a₂ ⟩ , }, have g₂ : {b : β | f b ≤ g b} \ {b : β | f b < g b} ⊆ {b : β | f b = g b}, unfold has_sdiff.sdiff set.diff, intros a Ha, simp at Ha, rw mem_set_of_eq, exact le_antisymm Ha.1 Ha.2, exact set.subset.trans g₁ g₂, end lemma mem_frontier_lt [topological_space α] [decidable_linear_order α] [t : ordered_topology α] [topological_space β] {f g : β → α} (hf : continuous f) (hg : continuous g) { s : β } : s ∈ frontier {b | f b < g b} → s ∈ {b | f b = g b} := begin intro h, exact set.mem_of_mem_of_subset h (frontier_lt_subset_eq hf hg), end --------------------------------------------------------- ---- Other Homotopy results (for fundamental group proof) ---- Reparametrisation of path and homotopies -- (Formalise paragraph 2 pg 27 of AT, https://pi.math.cornell.edu/~hatcher/AT/AT.pdf ) structure repar_I01 := (to_fun : I01 → I01 ) (at_zero : to_fun 0 = 0 ) (at_one : to_fun 1 = 1 ) (cont : continuous to_fun ) @[simp] lemma repar_I01_at_zero ( φ : repar_I01) : φ.to_fun 0 = 0 := φ.2 @[simp] lemma repar_I01_at_one ( φ : repar_I01) : φ.to_fun 1 = 1 := φ.3 -- Reparametrised path f ( φ (t) ) def repar_path ( f : path x y)( φ : repar_I01 ) : path x y := { to_fun := λ t , f.to_fun ( φ.to_fun t) , at_zero := by simp, at_one := by simp, cont := continuous.comp φ.cont f.cont } -- Function of the homotopy associated to the reparametrisation φ def rep_hom (φ : repar_I01) : I01 × I01 → I01 := λ st, ⟨ ((1 : ℝ ) - st.1.1)*(φ.to_fun st.2).1 + st.1.1 * st.2.1, begin unfold I01, rw mem_set_of_eq, split, { suffices H1 : 0 ≤ (1 - (st.fst).val) * (φ.to_fun (st.snd)).val , suffices H2 : 0 ≤ (st.fst).val * (st.snd).val, exact add_le_add H1 H2, refine mul_nonneg _ _, exact st.1.2.1, exact st.2.2.1, refine mul_nonneg _ _, show 0 ≤ 1 - (st.fst).val , refine sub_nonneg.2 _ , exact st.1.2.2, exact (φ.to_fun (st.snd)).2.1, }, rw (@mul_comm _ _ (1 - (st.fst).val) (φ.to_fun (st.snd)).val), simp [@mul_add ℝ _ ((φ.to_fun (st.snd)).val ) (1:ℝ ) (- st.fst.val) ], rw mul_comm ((φ.to_fun (st.snd)).val ) ((st.fst).val), have H : ((st.fst).val * (st.snd).val + -((st.fst).val * (φ.to_fun (st.snd)).val)) = (st.fst).val * ((st.snd).val - ((φ.to_fun (st.snd)).val)), simp [mul_add], rw H, have H2 : (st.fst).val ≤ 1, exact st.1.2.2, let C := 0 < ((st.snd).val - (φ.to_fun (st.snd)).val) , by_cases C, have C1 : 0 < ((st.snd).val - (φ.to_fun (st.snd)).val), exact h, have H3 : (st.fst).val * ((st.snd).val - (φ.to_fun (st.snd)).val) ≤ 1 * ((st.snd).val - (φ.to_fun (st.snd)).val), rw one_mul, refine (@le_div_iff _ _ (st.fst).val ((st.snd).val - (φ.to_fun (st.snd)).val) ((st.snd).val - (φ.to_fun (st.snd)).val) C1).1 _, have h2 : ((st.snd).val - (φ.to_fun (st.snd)).val) / ((st.snd).val - (φ.to_fun (st.snd)).val) = 1, refine div_self _, exact ne_of_gt C1, rw h2, exact st.1.2.2, rw one_mul at H3, have G1 : (φ.to_fun (st.snd)).val + (st.fst).val * ((st.snd).val - (φ.to_fun (st.snd)).val) ≤ (φ.to_fun (st.snd)).val + ((st.snd).val - (φ.to_fun (st.snd)).val), refine add_le_add _ H3, refine le_of_eq _, refl, suffices G2 : (φ.to_fun (st.snd)).val + ((st.snd).val - (φ.to_fun (st.snd)).val) ≤ 1, exact le_trans G1 G2, simp [st.2.2.2], ----- have C0 : ¬ 0 < ((st.snd).val - (φ.to_fun (st.snd)).val), exact h, have C1 : ((st.snd).val - (φ.to_fun (st.snd)).val) ≤ 0, exact not_lt.1 C0, have H3 : (st.fst).val * ((st.snd).val - (φ.to_fun (st.snd)).val) ≤ 0, exact mul_nonpos_of_nonneg_of_nonpos (st.1.2.1) C1, have G1 : (φ.to_fun (st.snd)).val + (st.fst).val * ((st.snd).val - (φ.to_fun (st.snd)).val) ≤ (φ.to_fun (st.snd)).val , refine le_neg_add_iff_add_le.1 _, simpa , have G2 : (φ.to_fun (st.snd)).val ≤ 1, exact (φ.to_fun (st.snd)).2.2, exact le_trans G1 G2, --( 1-s )φ t + s t = -- φ t + s (t - φ t) ≤ -- φ t + (t - φ t) = -- t ≤ 1 end ⟩ @[simp] lemma rep_hom_at_zero (φ : repar_I01) ( y : I01 ) : rep_hom φ (0, y) = φ.to_fun y := begin unfold rep_hom, simp, apply subtype.eq, simp [mul_comm, mul_zero], show y.val * 0 + (φ.to_fun y).val * (1 + -0) = (φ.to_fun y).val, simp [mul_zero, mul_add, add_zero] end @[simp] lemma rep_hom_at_one (φ : repar_I01) ( y : I01) : rep_hom φ (1, y) = y := begin unfold rep_hom, apply subtype.eq, simp [-sub_eq_add_neg], show 1 * y.val + (1 - 1) * (φ.to_fun y).val = y.val, simp end @[simp] lemma rep_hom_pt_at_zero (φ : repar_I01) ( s : I01) : rep_hom φ (s, 0) = 0 := begin unfold rep_hom, simp, apply subtype.eq, simp, show s.val * 0+ (1 + -s.val) * 0 = 0, simp, end @[simp] lemma rep_hom_pt_at_one (φ : repar_I01) ( s : I01) : rep_hom φ (s, 1) = 1 := begin unfold rep_hom, simp, apply subtype.eq, simp, show s.val * 1 + (1 + -s.val) * 1 = 1, simp end lemma cont_rep_hom (φ : repar_I01) : continuous (rep_hom φ ) := begin unfold rep_hom, refine continuous_subtype_mk _ _, refine @continuous_add _ _ _ _ _ _ (λ st: I01×I01 , (1 - (st.fst).val) * (φ.to_fun (st.snd)).val ) _ _ _, { refine continuous_mul _ _, refine continuous_add _ _, exact continuous_const, show continuous (( λ x : ℝ , - x ) ∘ (λ (st : ↥I01 × ↥I01), (st.fst).val) ), refine continuous.comp (continuous.comp continuous_fst continuous_subtype_val) (continuous_neg continuous_id), exact continuous.comp (continuous.comp continuous_snd φ.cont) continuous_subtype_val }, refine continuous_mul _ (continuous.comp continuous_snd continuous_subtype_val) , exact continuous.comp continuous_fst continuous_subtype_val, end -- Define homotopy from f φ to f , for any repar φ def hom_repar_path_to_path {α : Type*} [topological_space α ] {x y : α } ( f : path x y)( φ : repar_I01 ) : path_homotopy (repar_path f φ ) f := { to_fun := λ st, f.to_fun ( (rep_hom φ) st), path_s := begin intro s, unfold is_path, split, simp, split, simp, show continuous ( (λ (st : I01×I01), f.to_fun (rep_hom φ st )) ∘ ( λ t : I01, ((s, t) : I01 × I01) ) ), refine continuous.comp _ (continuous.comp (cont_rep_hom φ ) f.cont ), exact continuous.prod_mk continuous_const continuous_id end, at_zero := by simp, at_one := by simp, cont := continuous.comp (cont_rep_hom φ ) f.cont } -- Prove f φ ≈ f (they are homotopic) theorem repar_path_is_homeq {α : Type*} [topological_space α ] {x y : α } ( f : path x y)( φ : repar_I01 ) : is_homotopic_to (repar_path f φ ) f := begin unfold is_homotopic_to, exact nonempty.intro (hom_repar_path_to_path f φ ), end ----------------------------- -- Homotopy of path inverses ------ a ≈ b → a⁻¹ ≈ b⁻¹ def f_path_inv { a b : path x y } ( F : path_homotopy a b ) : I01 × I01 → β := λ st, F.to_fun (st.1 , par_inv st.2) lemma f_path_inv_start_pt { a b : path x y } ( F : path_homotopy a b ) : ∀ (s : I01), f_path_inv F (s, 0) = y := begin unfold f_path_inv, simp end lemma f_path_inv_end_pt { a b : path x y } ( F : path_homotopy a b ) : ∀ (s : I01), f_path_inv F (s, 1) = x := begin unfold f_path_inv, simp end lemma f_path_inv_at_zero { a b : path x y } ( F : path_homotopy a b ) : ∀ (y_1 : I01), f_path_inv F (0, y_1) = (inv_of_path a).to_fun y_1 := begin intro y, unfold f_path_inv inv_of_path, simp, end lemma f_path_inv_at_one { a b : path x y } ( F : path_homotopy a b ) : ∀ (y_1 : I01), f_path_inv F (1, y_1) = (inv_of_path b).to_fun y_1 := begin intro y, unfold f_path_inv inv_of_path, simp, end lemma f_path_inv_cont { a b : path x y } ( F : path_homotopy a b ) : continuous (f_path_inv F) := begin unfold f_path_inv, refine continuous.comp _ F.cont, refine continuous.prod_mk continuous_fst _, exact continuous.comp continuous_snd continuous_par_inv end noncomputable def path_homotopy_of_inv_path {α } [topological_space α] {x y : α} { a b : path x y } ( F : path_homotopy a b ) : path_homotopy (inv_of_path a) (inv_of_path b) := path_homotopy.mk' (f_path_inv F) (f_path_inv_start_pt F) (f_path_inv_end_pt F) (f_path_inv_at_zero F) (f_path_inv_at_one F) (f_path_inv_cont F) --------------------------------- --------------------------------- -- Homotopy on composition of paths ------ a₁ ≈ b₁ , a₂ ≈ b₂ → a₁ ⬝ a₂ ≈ b₁ ⬝ b₂ -- needed to prove multiplication is well definied in fundamental group -- Define (continuous) shift function to employ results on I01 × I01 from path_homotopy_comp def shift_order ( α : Type* ) (β : Type*) [topological_space α] [topological_space β ] : α × β → β × α := λ ab, (ab.2, ab.1) theorem continuous_shift_order {α β } [topological_space α] [topological_space β ] : continuous (shift_order α β ) := begin unfold shift_order, exact continuous.prod_mk continuous_snd continuous_fst end local notation `shift` := shift_order _ _ @[simp] lemma shift_cond_start { a₁ b₁ : path x y} { a₂ b₂ : path y z} { F : path_homotopy a₁ b₁ } { G : path_homotopy a₂ b₂ } : paste cover_prod_I01 (λ (st : ↥(set.prod T1 univ)), F.to_fun (shift ↑st)) (λ (st : ↥(set.prod T2 univ)), G.to_fun (shift ↑st))(shift (s, 0)) = x := begin unfold shift_order paste, rw dif_pos, simp, simp, exact help_T1, end @[simp] lemma shift_cond_end { a₁ b₁ : path x y} { a₂ b₂ : path y z} { F : path_homotopy a₁ b₁ } { G : path_homotopy a₂ b₂ } : paste cover_prod_I01 (λ (st : ↥(set.prod T1 univ)), F.to_fun (shift ↑st)) (λ (st : ↥(set.prod T2 univ)), G.to_fun (shift ↑st))(shift (s, 1)) = z := begin unfold shift_order paste, rw dif_neg, simp, simp, exact help_02, end --- -- Define (continuous ) reparametrisations to shift domain and construct a homotopy : a₁ ⬝ a₂ ≈ b₁ ⬝ b₂ ----- by pasting homotopies a₁ ≈ b₁ , a₂ ≈ b₂ def repar_shift_a : set.prod T1 I → I01 × I01 := λ st, shift ( par zero_lt_half ⟨ st.1.1, (mem_prod.1 st.2).1⟩ , st.1.2 ) def repar_shift_b : set.prod T2 I → I01 × I01 := λ st, shift ( par half_lt_one ⟨ st.1.1, (mem_prod.1 st.2).1 ⟩ , st.1.2 ) lemma cont_r_shift_a : continuous repar_shift_a := begin unfold repar_shift_a, refine continuous.comp _ continuous_shift_order, refine continuous.prod_mk _ _, refine continuous.comp _ (continuous_par _ ), refine continuous_subtype_mk _ _, exact continuous.comp continuous_subtype_val continuous_fst, exact continuous.comp continuous_subtype_val continuous_snd, end lemma cont_r_shift_b : continuous repar_shift_b := begin unfold repar_shift_b, refine continuous.comp _ continuous_shift_order, refine continuous.prod_mk _ _, refine continuous.comp _ (continuous_par _ ), refine continuous_subtype_mk _ _, exact continuous.comp continuous_subtype_val continuous_fst, exact continuous.comp continuous_subtype_val continuous_snd, end -- Define the function of homotopy a₁ ⬝ a₂ ≈ b₁ ⬝ b₂ and prove lemmas to use with path_homotopy.mk' def f_path_comp { a₁ b₁ : path x y} { a₂ b₂ : path y z} ( F : path_homotopy a₁ b₁ ) ( G : path_homotopy a₂ b₂ ) := λ st, ( paste cover_prod_I01 ( λ st, F.to_fun (repar_shift_a st) ) ( λ st, G.to_fun (repar_shift_b st) ) ) ( shift st) lemma f_path_comp_start_pt { a₁ b₁ : path x y} { a₂ b₂ : path y z} ( F : path_homotopy a₁ b₁ ) ( G : path_homotopy a₂ b₂ ) : ∀ (s : I01), f_path_comp F G (s, 0) = x := begin intro s, unfold f_path_comp, unfold repar_shift_a repar_shift_b shift_order paste, rw dif_pos, show F.to_fun (s, par zero_lt_half ⟨0, help_T1⟩) = x, simp, simp, exact help_T1, end lemma f_path_comp_end_pt { a₁ b₁ : path x y} { a₂ b₂ : path y z} ( F : path_homotopy a₁ b₁ ) ( G : path_homotopy a₂ b₂ ) : ∀ (s : I01), f_path_comp F G (s, 1) = z := begin intro s, unfold f_path_comp, unfold repar_shift_a repar_shift_b shift_order paste, rw dif_neg, simp, show G.to_fun (s, par half_lt_one ⟨1, help_T2⟩) = z, simp, simp [help_02], end lemma f_path_comp_at_zero { a₁ b₁ : path x y} { a₂ b₂ : path y z} ( F : path_homotopy a₁ b₁ ) ( G : path_homotopy a₂ b₂ ) : ∀ (y : I01), f_path_comp F G (0, y) = (comp_of_path a₁ a₂).to_fun y := begin intro s, unfold f_path_comp comp_of_path fa_path fb_path fgen_path paste, simp, split_ifs, unfold repar_shift_a, unfold shift_order, simpa, { by_contradiction, unfold shift_order at h, simp at h, cc, }, { by_contradiction, unfold shift_order at h, simp at h, cc, }, unfold repar_shift_b, unfold shift_order, simpa, end lemma f_path_comp_at_one { a₁ b₁ : path x y} { a₂ b₂ : path y z} ( F : path_homotopy a₁ b₁ ) ( G : path_homotopy a₂ b₂ ) : ∀ (y : I01), f_path_comp F G (1, y) = (comp_of_path b₁ b₂).to_fun y := begin intro s, unfold f_path_comp comp_of_path fa_path fb_path fgen_path paste, simp, split_ifs, unfold repar_shift_a, unfold shift_order, simpa, { by_contradiction, unfold shift_order at h, simp at h, cc, }, { by_contradiction, unfold shift_order at h, simp at h, cc, }, unfold repar_shift_b, unfold shift_order, simpa, end lemma f_path_comp_cont { a₁ b₁ : path x y} { a₂ b₂ : path y z} ( F : path_homotopy a₁ b₁ ) ( G : path_homotopy a₂ b₂ ) : continuous (f_path_comp F G) := begin unfold f_path_comp, refine continuous.comp continuous_shift_order _, refine cont_of_paste prod_T1_is_closed prod_T2_is_closed _ _ _, {unfold match_of_fun, intros w B1 B2, have Int : w ∈ set.inter (set.prod T1 I) (set.prod T2 I), exact ⟨ B1 , B2 ⟩ , rwa [prod_inter_T] at Int, have V : w.1.1 = 1/2, rwa [set.prod, mem_set_of_eq] at Int, rwa [mem_set_of_eq] at Int, exact Int.1, cases w, have xeq : w_fst = ⟨ 1/2 , help_01 ⟩ , apply subtype.eq, rw V, simp [xeq, -one_div_eq_inv], unfold repar_shift_a repar_shift_b shift_order, simp [-one_div_eq_inv], show F.to_fun (w_snd, par zero_lt_half ⟨⟨1 / 2, help_01⟩, help_half_T1⟩) = G.to_fun (w_snd, par half_lt_one ⟨⟨1 / 2, help_01⟩, help_half_T2⟩) , rw [eqn_1, eqn_2], simp, } , exact continuous.comp cont_r_shift_a F.cont, exact continuous.comp cont_r_shift_b G.cont, end -- Prove that we have the homotopy a₁ ⬝ a₂ ≈ b₁ ⬝ b₂ noncomputable def path_homotopy_of_comp_path { a₁ b₁ : path x y} { a₂ b₂ : path y z} ( F : path_homotopy a₁ b₁ ) ( G : path_homotopy a₂ b₂ ) : path_homotopy (comp_of_path a₁ a₂) (comp_of_path b₁ b₂) := begin refine path_homotopy.mk' (f_path_comp F G ) _ _ _ _ _, exact f_path_comp_start_pt F G, exact f_path_comp_end_pt F G, exact f_path_comp_at_zero F G , exact f_path_comp_at_one F G, exact f_path_comp_cont F G, end ---------------------------------------------------- local attribute [instance] classical.prop_decidable ------------------------------------------ -- Homotopy of composition with inverse ------ a⁻¹ ⬝ a ≈ c₀ -- continuity lemma employed later lemma cont_help_1 : continuous (λ (a : ↥I01 × ↥I01), 1 - (a.fst).val ) := begin have h : continuous ( λ (r : ℝ ), 1 - r ), conv in ( (1:ℝ)-_) begin rw help_inv, end, by exact continuous.comp (real.continuous_mul_const (-1) ) (real.continuous_add_const 1), exact continuous.comp (continuous.comp continuous_fst continuous_subtype_val) h, end /- To prove for a path f that f⁻¹ ⬝ f ≈ c₀ (constant loop at given basepoint), need 2 continuous function that are (2) piecewise-linear applied as reparamatrization of path φ(s) (similar to above), such that the composition (f⁻¹ ⬝ f) φ(1) = c₀ and (f⁻¹ ⬝ f) φ(0) = f⁻¹ ⬝ f - as depicted in AT pg 27. -/ -- "Reparametrisation" to shrink path f⁻¹ def par_aux_a : I01 × I01 → I01 := λ st, if ((1 : ℝ ) - st.1.1) < st.2.1 then st.1 else par_inv st.2 lemma continuous_par_aux_a : continuous par_aux_a := begin unfold par_aux_a, refine continuous_if _ continuous_fst (continuous.comp continuous_snd continuous_par_inv) , intros st F, have H : frontier {a : ↥I01 × ↥I01 | 1 - (a.fst).val < (a.snd).val} ⊆ {a : ↥I01 × ↥I01 | 1 - (a.fst).val = (a.snd).val }, exact frontier_lt_subset_eq cont_help_1 (continuous.comp continuous_snd continuous_subtype_val), have h : st ∈ {a : ↥I01 × ↥I01 | 1 - (a.fst).val = (a.snd).val}, exact set.mem_of_mem_of_subset F H , rw [ mem_set_of_eq] at h, unfold par_inv, refine subtype.eq _, show (st.fst).val = 1 -(st.snd).val, have H4 : (st.snd).val = 1 - (st.fst).val, exact eq.symm h, simp [H4], end def repar_stop_a : set.prod T1 I → I01 := λ st, par_aux_a ( shift ( par zero_lt_half ⟨ st.1.1, (mem_prod.1 st.2).1⟩ , st.1.2 ) ) lemma cont_r_stop_a : continuous repar_stop_a := begin unfold repar_stop_a, refine continuous.comp _ continuous_par_aux_a, refine continuous.comp _ continuous_shift_order, refine continuous.prod_mk _ (continuous.comp continuous_subtype_val continuous_snd), refine continuous.comp _ (continuous_par _ ), refine continuous_subtype_mk _ _, exact continuous.comp continuous_subtype_val continuous_fst, end -- This will be the actual function that will make up the left part of the homotopy (see f_inv_comp) def fa_inv_comp (f : path x y) : set.prod T1 I → β := λ st, f.to_fun ( repar_stop_a st ) lemma cont_fa_inv_comp (f : path x y) : continuous (fa_inv_comp f) := begin unfold fa_inv_comp, exact continuous.comp cont_r_stop_a f.cont, end -------------- -- "Reparametrisation" to shrink path f def par_aux_b : I01 × I01 → I01 := λ st, if st.2.1 < st.1.1 then st.1 else st.2 lemma continuous_par_aux_b : continuous par_aux_b := begin unfold par_aux_b, refine continuous_if _ continuous_fst continuous_snd , {intros st F, have H : frontier {a : ↥I01 × ↥I01 | (a.snd).val < (a.fst).val} ⊆ {a : ↥I01 × ↥I01 | (a.snd).val = (a.fst).val}, exact frontier_lt_subset_eq (continuous.comp continuous_snd continuous_subtype_val) (continuous.comp continuous_fst continuous_subtype_val) , have h : st ∈ {a : ↥I01 × ↥I01 | (a.snd).val = (a.fst).val}, exact set.mem_of_mem_of_subset F H , rw [ mem_set_of_eq] at h, apply eq.symm, exact subtype.eq h, }, end def repar_stop_b : set.prod T2 I → I01 := λ st, par_aux_b ( shift ( par half_lt_one ⟨ st.1.1, (mem_prod.1 st.2).1⟩ , st.1.2 ) ) lemma cont_r_stop_b : continuous repar_stop_b := begin unfold repar_stop_b, refine continuous.comp _ continuous_par_aux_b, refine continuous.comp _ continuous_shift_order, refine continuous.prod_mk _ (continuous.comp continuous_subtype_val continuous_snd), refine continuous.comp _ (continuous_par _ ), refine continuous_subtype_mk _ _, exact continuous.comp continuous_subtype_val continuous_fst, end def fb_inv_comp (f : path x y) : set.prod T2 I → β := λ st, f.to_fun ( repar_stop_b st ) lemma cont_fb_inv_comp (f : path x y) : continuous (fb_inv_comp f) := begin unfold fb_inv_comp, exact continuous.comp cont_r_stop_b f.cont, end ---- Combine the two reparametrisation ---- Set up function and lemmas for path_homotopy.mk' def f_inv_comp (f : path x y) : I01 × I01 → β := λ st, ( paste cover_prod_I01 ( λ st, (fa_inv_comp f ) st ) ( λ st, (fb_inv_comp f ) st ) ) (shift st) lemma f_inv_comp_start_pt (f : path x y) : ∀ (s : I01), f_inv_comp f (s, 0) = y := begin intro s, unfold f_inv_comp fa_inv_comp fb_inv_comp, unfold repar_stop_a repar_stop_b shift_order par_aux_a par_aux_b paste, simp [-sub_eq_add_neg], rw [dif_pos ], have H : ite (1 - s.val < (par zero_lt_half ⟨0, help_T1⟩).val) s (par_inv (par zero_lt_half ⟨0, help_T1⟩)) = (1 : I01), split_ifs, have H2 : s.val + (0 : I01).val = s.val, show s.val + (0:ℝ ) = s.val, exact add_zero s.val, have H3 : s.val ≤ (1:I01).val, exact s.2.2, have H4 : 1 - (0:I01).val = 1, exact sub_zero 1, rw [ eqn_start ] at h, rw [sub_lt] at h, have H5 : 1 < s.val, rw H4 at h, exact h, by_contradiction, have G : s.val < s.val, exact lt_of_le_of_lt H3 h, simp [lt_iff_le_and_ne] at G, trivial, simp, show f.to_fun (ite (1 - s.val < (par zero_lt_half ⟨0, help_T1⟩).val) s (par_inv (par zero_lt_half ⟨0, help_T1⟩))) = y, rw [H], exact f.at_one, simp, exact help_T1, end lemma f_inv_comp_end_pt (f : path x y) : ∀ (s : I01), f_inv_comp f (s, 1) = y := begin intro s, unfold f_inv_comp, unfold paste, rw dif_neg, unfold fb_inv_comp repar_stop_b shift_order par_aux_b, simp [-sub_eq_add_neg], have H : ite ((par half_lt_one ⟨1, help_T2⟩).val < s.val) s (par half_lt_one ⟨1, help_T2⟩) = 1, split_ifs, { by_contradiction, rw eqn_end at h, have H2 : s.val ≤ (1:I01).val, exact s.2.2, have G : s.val < s.val, exact lt_of_le_of_lt H2 h, simp [lt_iff_le_and_ne] at G, trivial, }, exact eqn_end, show f.to_fun (ite ((par half_lt_one ⟨1, help_T2⟩).val < s.val) s (par half_lt_one ⟨1, help_T2⟩ )) = y, rw H, exact f.at_one, unfold shift_order, simp [help_02], end lemma f_inv_comp_at_zero (f : path x y) : ∀ (y_1 : I01), f_inv_comp f (0, y_1) = (comp_of_path (inv_of_path f) f).to_fun y_1 := begin intro t, unfold f_inv_comp fa_inv_comp fb_inv_comp repar_stop_a repar_stop_b, unfold paste, unfold shift_order, split_ifs, unfold shift_order at h, simp at h, unfold par_inv comp_of_path paste, simp [h], unfold fa_path par_aux_a inv_of_path, simp [-sub_eq_add_neg], show f.to_fun (ite (1 - 0< (par zero_lt_half ⟨t, _⟩).val) 0 (par_inv (par zero_lt_half ⟨t, _⟩))) = f.to_fun (par_inv (par zero_lt_half ⟨t, _⟩)), simp, rw if_neg, refl, refine not_lt.2 _, exact (par zero_lt_half ⟨t, _⟩).2.2, unfold shift_order at h, simp at h, unfold comp_of_path paste fb_path, unfold par_aux_b, rw if_neg, simpa [h], refine not_lt.2 _, simp, exact (par half_lt_one ⟨t, _⟩).2.1, end lemma f_inv_comp_at_one (f : path x y) : ∀ (y_1 : I01), f_inv_comp f (1, y_1) = (loop_const y).to_fun y_1 := begin intro t, unfold f_inv_comp fa_inv_comp fb_inv_comp repar_stop_a repar_stop_b, unfold paste, unfold shift_order, split_ifs, unfold shift_order at h, simp at h, unfold loop_const, unfold par_aux_a, split_ifs with h₂ , exact f.at_one, simp [not_lt, -sub_eq_add_neg] at h₂ , have H : (par zero_lt_half ⟨t, _⟩).val ≤ 1 - 1, exact h₂ , rw [sub_self] at H, have h₃ : (par zero_lt_half ⟨t, h⟩).val = 0, -- exact le_antisymm H ((par zero_lt_half ⟨t, h⟩).2.1), have H2 : (par zero_lt_half ⟨t, h⟩) = (0: I01), exact subtype.eq h₃ , show f.to_fun (par_inv (par zero_lt_half ⟨t, h⟩)) = y, rw H2, simp, unfold shift_order at h, simp at h, unfold par_aux_b, unfold loop_const, split_ifs with h₂, exact f.at_one, simp [not_lt, -sub_eq_add_neg] at h₂, have H : (par half_lt_one ⟨t, _⟩).val = (1:I01).val, apply eq.symm, exact le_antisymm h₂ (par half_lt_one ⟨t, _⟩).2.2, have H2 : (par half_lt_one ⟨t, _⟩) = (1: I01), exact subtype.eq H, simp [H2], end lemma f_inv_comp_cont (f : path x y) : continuous (f_inv_comp f) := begin unfold f_inv_comp, refine continuous.comp continuous_shift_order _, refine cont_of_paste prod_T1_is_closed prod_T2_is_closed _ (cont_fa_inv_comp f) (cont_fb_inv_comp f), { unfold match_of_fun, intros w B1 B2, have Int : w ∈ set.inter (set.prod T1 I) (set.prod T2 I), exact ⟨ B1 , B2 ⟩ , rwa [prod_inter_T] at Int, have V : w.1.1 = 1/2, rwa [set.prod, mem_set_of_eq] at Int, rwa [mem_set_of_eq] at Int, exact Int.1, cases w, have xeq : w_fst = ⟨ 1/2 , help_01 ⟩ , apply subtype.eq, rw V, -- simp [xeq, -one_div_eq_inv], unfold fa_inv_comp fb_inv_comp, unfold repar_stop_a repar_stop_b shift_order par_aux_a par_aux_b, simp [-sub_eq_add_neg,-one_div_eq_inv], show f.to_fun (ite (1 - w_snd.val < (par zero_lt_half ⟨⟨1 / 2, help_01⟩, help_half_T1⟩).val) w_snd (par_inv (par zero_lt_half ⟨⟨1 / 2, help_01⟩, help_half_T1⟩))) = f.to_fun (ite ((par half_lt_one ⟨⟨1 / 2, help_01⟩, help_half_T2⟩).val < w_snd.val) w_snd (par half_lt_one ⟨⟨1 / 2, help_01⟩, help_half_T2 ⟩)), rw [eqn_1, eqn_2, eqn_2_par_inv], rw sub_lt, show f.to_fun (ite (1 - (1:ℝ ) < w_snd.val) w_snd 0) = f.to_fun (ite ((0:ℝ) < w_snd.val) w_snd 0), rw sub_self, }, end noncomputable def hom_inv_comp_to_const (f : path x y) : path_homotopy (comp_of_path (inv_of_path f) f) (loop_const y) := path_homotopy.mk' (f_inv_comp f) (f_inv_comp_start_pt f) (f_inv_comp_end_pt f) (f_inv_comp_at_zero f) (f_inv_comp_at_one f) (f_inv_comp_cont f) ---------------------------------------------------------------------- -- Homotopy of three paths (associativity) ------ (f ⬝ g) ⬝ h ≈ f ⬝ ( g ⬝ h) /- For this define a (3) piecewise linear function φ (repar_I01), whose corresponding homotopy will serve for associativity proof. -/ --- Reparametrisation on [1/2, 1] ( 2 piecewise linear funtion : [1/2, 1] → [1/4, 1] ) lemma help_p3_aux₁ (s : T2) : (s.val).val - 1 / 4 ∈ I01 := begin unfold I01, rw mem_set_of_eq, split, refine le_sub_iff_add_le.2 _, rw [add_comm, add_zero], refine le_trans _ s.2.1, {norm_num}, rw sub_le_iff_le_add, refine le_trans s.2.2 _, norm_num, end lemma help_p3_aux₂ ( s : T2) : 2 * (s.val).val - 1 ∈ I01 := begin unfold I01, rw mem_set_of_eq, split, have h₁ : 1/2 ≤ (s.val).val, exact s.2.1, refine le_sub_iff_add_le.2 _, rw [add_comm, add_zero], have H : (2 : ℝ) > 0, {norm_num}, rw mul_comm, refine (div_le_iff H).1 _, exact h₁, have h₂ : (s.val).val ≤ (1:ℝ ), exact s.2.2, have H2 : 2*(s.val).val ≤ 2 * 1, have HH : 0 < (2 : ℝ), {norm_num}, refine (@mul_le_mul_left _ _ s.1.1 1 2 HH ).2 _, exact h₂, rw [mul_one] at H2, norm_num [H2], end def p3_aux : T2 → I01 := λ s, if s.1.1 < (3/4: ℝ ) then ⟨ s.1.1 - 1/4 , help_p3_aux₁ s ⟩ else ⟨ ( 2 : ℝ )*s.1.1 - (1: ℝ) , help_p3_aux₂ s ⟩ lemma help_cont_p3_aux₁ : continuous (λ (s : ↥T2), (s.val).val - 1 / 4) := continuous.comp (continuous.comp continuous_subtype_val continuous_subtype_val) (real.continuous_sub_const (1/4) ) lemma help_cont_p3_aux₂ : continuous (λ (s : ↥T2), 2 * (s.val).val - 1) := continuous.comp (continuous.comp continuous_subtype_val continuous_subtype_val) (real.continuous_linear 2 (-1) ) lemma cont_p3_aux : continuous p3_aux := begin unfold p3_aux, refine continuous_if _ _ _, intros x h, have h₂ := mem_frontier_lt (continuous.comp continuous_subtype_val continuous_subtype_val) (continuous_const) h, simp at h₂ , refine subtype.eq _, norm_num [h₂ ], exact continuous_subtype_mk _ help_cont_p3_aux₁, refine continuous_subtype_mk _ help_cont_p3_aux₂, end ----------------------------- -- Reparametrisation on [0, 1/2] lemma help_p3_T1_aux (x : T1) : 1 / 2 * (x.val).val ∈ I01 := begin unfold I01, rw mem_set_of_eq, split, refine mul_nonneg _ x.2.1, {norm_num}, --norm_num [x.2.2], have h : x.val.val ≤ 1/2 , exact x.2.2, have h₂ : 1 / 2 * (x.val).val ≤ (1/2 : ℝ )* (1/2:ℝ ), have g₁ : (1/ 2 : ℝ) ≤ 1/2, refine @le_of_eq _ _ (1/2:ℝ ) (1/2:ℝ ) (refl (1/2:ℝ )), refine mul_le_mul g₁ h x.2.1 _ , {norm_num}, refine le_trans h₂ _ , norm_num, end def p3_T1_aux : T1 → I01 := λ x, ⟨ (1/2:ℝ ) * x.1.1 , help_p3_T1_aux x ⟩ lemma cont_p3_T1_aux : continuous p3_T1_aux := begin unfold p3_T1_aux, refine continuous_subtype_mk _ ( continuous.comp (continuous.comp continuous_subtype_val continuous_subtype_val) (real.continuous_mul_const (1/2)) ) , end -- -- Define the 3 p.w.l function φ needed for the homotopy noncomputable def p3 : repar_I01 := { to_fun := paste cover_I01 p3_T1_aux p3_aux, at_zero := begin unfold paste, rw dif_pos, unfold p3_T1_aux, dsimp, refine subtype.eq _, exact help_T1, dsimp, exact mul_zero _, end, at_one := begin unfold paste, rw dif_neg, unfold p3_aux, rw if_neg, refine subtype.eq _, exact help_02, dsimp, show 2 * (1:ℝ) + -1 = 1, {norm_num}, dsimp, rw not_lt, show 3 / 4 ≤ ( 1:ℝ ), norm_num, end, cont := begin refine cont_of_paste T1_is_closed T2_is_closed _ cont_p3_T1_aux cont_p3_aux , unfold match_of_fun, intros x B1 B2, have Int : x ∈ set.inter T1 T2, exact ⟨ B1 , B2 ⟩ , rwa [inter_T] at Int, have V : x.val = 1/2, rwa [mem_set_of_eq] at Int, unfold p3_aux p3_T1_aux, dsimp, rw if_pos, rw subtype.ext , dsimp, {rw V, norm_num}, rw V, norm_num, end, } ----------- ---- Following section is to implement this and prove that -- hom_repar_path_to_path (( f ⬝ g ) ⬝ h) φ is indeed a homotopy f ⬝ (g ⬝ h) ≈ ( f ⬝ g ) ⬝ h section variables {f : path x y} {g : path y z} {h : path z w} -- To prove associativity need to show equality with the reparametrisation of path -- i.e (( f ⬝ g ) ⬝ h) φ = (f ⬝ (g ⬝ h)), so that can use previous results regarding repar_I01 -- This will involve proving 9 subgoals for the different values (t : I01) can take lemma contr_T1 {x : I01} ( h₁ : x ∈ T1 ) (h₂ : x ∉ T1) : false := by cc -- 1 lemma step_assoc_1 {t : {x // x ∈ I01}} { h_1 : t ∈ T1 } { h_2 : p3.to_fun t ∈ T1} {h_3 : par zero_lt_half ⟨p3.to_fun t, h_2 ⟩ ∈ T1} : f.to_fun (par zero_lt_half ⟨t, h_1⟩) = f.to_fun (par zero_lt_half ⟨par zero_lt_half ⟨p3.to_fun t, h_2⟩, h_3⟩) := begin congr, unfold p3, dsimp, unfold paste, simp [dif_pos h_1], unfold p3_T1_aux, dsimp, unfold par, dsimp, simp [subtype.ext], have a₁ : (2:ℝ )⁻¹ ≠ 0, {norm_num}, rw [mul_comm 2⁻¹ t.val ], rw [mul_div_assoc , div_self a₁, mul_one], end -- 2 lemma p3_ineq_T1 {t : {x // x ∈ I01}} (h_1 : t ∈ T1 ) : p3.to_fun t ∈ {x : I01 | 0 ≤ x.val ∧ x.val ≤ 1 / 4 } := begin rw mem_set_of_eq, split, unfold p3, dsimp, unfold paste p3_T1_aux, simp [h_1, -one_div_eq_inv], refine mul_nonneg _ t.2.1 , {norm_num}, unfold p3, dsimp, unfold paste p3_T1_aux, simp [h_1, -one_div_eq_inv], have h₂ : (1/4 : ℝ) = (1/2)*(1/2), {norm_num}, rw h₂, unfold T1 T at h_1, have h₃ := h_1.2, refine mul_le_mul _ h₃ t.2.1 _ , exact le_of_eq (refl (1/2)), {norm_num}, end lemma par_T1_ineq₁ {s : {x // x ∈ I01}} {h_1 : s ∈ T1 } (h : s ∈ {x : ↥I01 | 0 ≤ x.val ∧ x.val ≤ 1 / 4 } ) : par zero_lt_half ⟨ s , h_1 ⟩ ∈ T1 := begin unfold T1 T, rw mem_set_of_eq, split, { unfold par, dsimp [-sub_eq_add_neg], rw sub_zero, rw sub_zero, refine (le_div_iff _ ).2 _, {norm_num}, rw [mul_comm, mul_zero], exact s.2.1, }, unfold par, dsimp [-sub_eq_add_neg], rw sub_zero, rw sub_zero, refine (le_div_iff _ ).1 _ ,{norm_num}, have h₂ : 1 / 2 / (1 / 2)⁻¹ = (1/4 : ℝ ), {norm_num}, rw h₂, exact h.2, end lemma help_step_assoc_2 {t : {x // x ∈ I01}} (h_1 : t ∈ T1 ) { h_2 : p3.to_fun t ∈ T1} (h_3 : par zero_lt_half ⟨p3.to_fun t, h_2⟩ ∉ T1) : par zero_lt_half ⟨p3.to_fun t, h_2⟩ ∈ T2 := T2_of_not_T1 h_3 lemma step_assoc_2 {t : {x // x ∈ I01}} { h_1 : t ∈ T1 } { h_2 : p3.to_fun t ∈ T1} (h_3 : par zero_lt_half ⟨p3.to_fun t, h_2⟩ ∉ T1) : f.to_fun (par zero_lt_half ⟨t, h_1⟩) = g.to_fun (par half_lt_one ⟨par zero_lt_half ⟨p3.to_fun t, h_2⟩, help_step_assoc_2 h_1 h_3 ⟩) := begin by_contradiction, unfold T1 T at h_2, rw [mem_set_of_eq] at h_2, unfold T1 T at h_3, rw [mem_set_of_eq] at h_3, simp [-one_div_eq_inv] at h_3, have H := h_3 (par zero_lt_half ⟨p3.to_fun t, h_2⟩).2.1, have G : par zero_lt_half ⟨p3.to_fun t, h_2⟩ ∈ T1, exact par_T1_ineq₁ (p3_ineq_T1 h_1), cc, end --3 lemma step_assoc_3 {t : {x // x ∈ I01}} ( h_1 : t ∈ T1 ) ( h_2 : p3.to_fun t ∉ T1) : f.to_fun (par zero_lt_half ⟨t, h_1⟩) = h.to_fun (par half_lt_one ⟨p3.to_fun t, T2_of_not_T1 h_2 ⟩) := begin by_contradiction, -- as p3.to_fun t ∈ {x : ↥I01 | 0 ≤ x.val ∧ x.val ≤ 1 / 4 } ⊆ T1 have h₁ : p3.to_fun t ∈ {x : ↥I01 | 0 ≤ x.val ∧ x.val ≤ 1 / 4 }, exact p3_ineq_T1 h_1, suffices g₁ : p3.to_fun t ∈ T1, cc, refine mem_of_mem_of_subset h₁ _, unfold T1 T, intros x H , refine ⟨ H.1, le_trans H.2 _ ⟩ , {norm_num} end --4 lemma p3_not_T1 {t : {x // x ∈ I01}} (h : t ∉ T1 ) : 1/4 < (p3.to_fun t ).val := begin have h₁ : 1/2 < t.val, { unfold T1 T at h, by_contradiction, rw [not_lt] at a, suffices a₁ : t ∈ {x : ↥I01 | 0 ≤ x.val ∧ x.val ≤ 1 / 2}, cc, exact ⟨ t.2.1, a ⟩ , }, unfold p3, dsimp, unfold paste, simp [h, -one_div_eq_inv], unfold p3_aux, split_ifs, { refine lt_sub_iff_add_lt.2 _, have a₁ : 1 / 4 + 1 / 4 = (1/2:ℝ ), {norm_num}, rw a₁ , exact h₁ }, simp at h_1, have a₁ : 5 / 4 < 2 * t.val, { have H : 5 / 4 = (5 /3 )*(3/4:ℝ ), {norm_num}, rw H, refine mul_lt_mul _ h_1 _ _, {norm_num}, {norm_num}, norm_num }, norm_num [a₁ ] , end lemma p3_impl₁ {t : {x // x ∈ I01}} (h : (p3.to_fun t ).val ≤ 1/4 ) : t ∈ T1 := begin by_contradiction, have h₂ : 1/4 < (p3.to_fun t ).val, exact p3_not_T1 a, suffices g₁ : ¬ (p3.to_fun t).val ≤ 1 / 4, cc, exact (le_not_le_of_lt h₂).2 , end lemma par_impl_T1 {t : {x // x ∈ I01}} {h_3 : p3.to_fun t ∈ T1} (h_4 : par zero_lt_half ⟨p3.to_fun t, h_3⟩ ∈ T1) : (p3.to_fun t ).val ≤ 1/4 := begin unfold par T1 T at h_4, rw mem_set_of_eq at h_4, cases h_4 with h₁ h₂ , simp [-one_div_eq_inv] at h₂, have H : (0: ℝ )<(1 / 2) , {norm_num}, have H2 : 1 / 4 = (1/2:ℝ )* (1/2), {norm_num}, rw H2, exact (div_le_iff H).1 h₂ , end lemma step_assoc_4 {t : {x // x ∈ I01}} ( h_1 : t ∉ T1 ) ( h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∈ T1) ( h_3 : p3.to_fun t ∈ T1) (h_4 : par zero_lt_half ⟨p3.to_fun t, h_3⟩ ∈ T1) : g.to_fun (par zero_lt_half ⟨par half_lt_one ⟨t, _⟩, h_2⟩) = f.to_fun (par zero_lt_half ⟨par zero_lt_half ⟨p3.to_fun t, h_3⟩, h_4⟩) := begin by_cases H : t.val = (1/2), { unfold p3, dsimp, unfold paste p3_aux, simp [h_1, -one_div_eq_inv, -sub_eq_add_neg], have h₁ : t.val < 3 / 4, rw H, {norm_num}, simp [h₁, -one_div_eq_inv, -sub_eq_add_neg, H ], have a₁ : 1 / 2 - 1 / 4 = (1/4 : ℝ ), {norm_num}, simp [-one_div_eq_inv, -sub_eq_add_neg, a₁], unfold par, simp [-sub_eq_add_neg, -one_div_eq_inv, sub_zero, H], show g.to_fun ⟨((↑t - 1 / 2) / (1 - 1 / 2)) / (1 / 2), _⟩ = f.to_fun ⟨1 / 4 / (1 / 2) / (1 / 2), _⟩, have a₃ : ↑t = (1/2:ℝ ), exact H, simp [a₃, -one_div_eq_inv ], simp [div_div_eq_div_mul, -one_div_eq_inv] , norm_num , show g.to_fun 0 = f.to_fun 1, simp [ f.at_one, g.at_zero], }, by_contradiction, suffices G : t ∈ T1, cc, exact p3_impl₁ (par_impl_T1 h_4), end -- 5 set_option trace.simplify.rewrite true --set_option pp.implicit true lemma p3_image_not_T1 (t : {x // x ∈ I01}) (h_1 : t ∉ T1) (a_1 : 3 / 4 < t.val) : p3.to_fun t ∉ T1 := begin unfold T1 T, rw mem_set_of_eq, simp [-one_div_eq_inv], intro H, unfold p3, dsimp, unfold paste p3_aux, simp [h_1, -one_div_eq_inv, -sub_eq_add_neg], have h : ¬ t.val < 3/4, refine not_lt_of_ge (le_of_lt a_1), simp [h, -one_div_eq_inv, -sub_eq_add_neg], have a₁ : 1 + 1 / 2 = (3/4:ℝ )*2 , {norm_num}, rw mul_comm, simp [-one_div_eq_inv, a₁ ],refine mul_lt_mul a_1 (le_of_eq (refl(2:ℝ ))) _ t.2.1, {norm_num} end lemma step_assoc_5 {t : {x // x ∈ I01}} ( h_1 : t ∉ T1 ) ( h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∈ T1) ( h_3 : p3.to_fun t ∈ T1) (h_4 : par zero_lt_half ⟨p3.to_fun t, h_3⟩ ∉ T1) : g.to_fun (par zero_lt_half ⟨par half_lt_one ⟨t, T2_of_not_T1 h_1⟩, h_2⟩) = g.to_fun (par half_lt_one ⟨par zero_lt_half ⟨p3.to_fun t, h_3⟩, T2_of_not_T1 h_4 ⟩) := begin unfold p3, dsimp, unfold paste, simp [dif_neg h_1], unfold p3_aux, by_cases a : t.val = 3/4 , { have a₂ : ¬ t.val < 3/4, exact not_lt_of_ge (ge_of_eq a), simp [a₂], unfold par, dsimp [-one_div_eq_inv, -sub_eq_add_neg], simp [sub_zero, -one_div_eq_inv, -sub_eq_add_neg], have g₂ : ↑t = t.val, trivial, {norm_num [ g₂ ,a]}, }, have l₁ : t.val ≤ 3/4, { by_contradiction, rw not_le at a_1, suffices G : p3.to_fun t ∉ T1, exact contr_T1 h_3 G, exact p3_image_not_T1 t h_1 a_1, }, have l₂ : t.val < 3 / 4, exact lt_of_le_of_ne l₁ a , simp [l₂ , -one_div_eq_inv, -sub_eq_add_neg], unfold par, dsimp [-one_div_eq_inv, -sub_eq_add_neg], simp [-sub_eq_add_neg, -one_div_eq_inv, sub_zero], have g₁ : (1 - 1 / 2) = (1/2:ℝ ), {norm_num}, have g₂ : ↑t = t.val, trivial, simp [g₁ , g₂ , -one_div_eq_inv, -sub_eq_add_neg] , suffices G1 : ((t.val - 1 / 4) / (1 / 2) - 1 / 2) = (t.val - 1 / 2) / (1 / 2), apply congr_arg, apply subtype.eq, show (t.val - 1 / 2) / (1 / 2) / (1 / 2) = ((t.val - 1 / 4) / (1 / 2) - 1 / 2) / (1 / 2), rw G1, show ((t.val - 1 / 4) / (1 / 2)) - (1 / 2) = (t.val - 1 / 2) / (1 / 2), have h₁ : ((t.val - 1 / 4) / (1 / 2)) - (1 / 2) = ((t.val - 1 / 4) / (1 / 2)) - (1 / 4 ) / (1/2:ℝ ), have h₂ : - (1 / 2 : ℝ ) = - (1 / 4 ) / (1/2:ℝ ), {norm_num}, have h₃ : (1 / 2 : ℝ ) = (1 / 4 ) / (1/2:ℝ ), {norm_num}, simpa [h₂, -one_div_eq_inv, -sub_eq_add_neg], rw [h₁, div_sub_div_same], have H2 : (t.val - 1 / 4 - 1 / 4) = (t.val - 1 / 2) , {norm_num}, simp [-one_div_eq_inv, -sub_eq_add_neg, H2], end -- 6 local attribute [instance] classical.prop_decidable lemma help_step_assoc_6₁ {t : {x // x ∈ I01}} {h_1 : t ∉ T1} (h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∈ T1) : t.val ≤ 3/4 := begin by_contradiction, rw not_le at a, unfold T1 T at h_2, cases h_2 with g₁ g₂ , have G1 : 1/2 < (par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩).val, unfold par, dsimp [-one_div_eq_inv, -sub_eq_add_neg], have a₁ : ↑t = t.val, trivial, have a₂ : (1 - 1 / 2) = (1/2:ℝ ), {norm_num}, rw [a₁, a₂ ], refine (lt_div_iff _).2 _, {norm_num}, have h₁ : 1 / 2 * (1 / 2) ≤ (3/4:ℝ ) - 1/2, {norm_num}, have h₂ : (3/4:ℝ ) - 1/2 < t.val -1/2, refine lt_sub_iff_add_lt.2 _ , have a₂ : 3 / 4 - 1 / 2 + 1 / 2 = (3/4:ℝ ), {norm_num}, rw a₂ , exact a, exact lt_of_le_of_lt h₁ h₂ , have NG1 : ¬ 1/2 < (par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩).val, exact not_lt_of_le g₂ , cc, end lemma T1_of_p3₁ {t : {x // x ∈ I01}} (h_1 : t ∉ T1) (l₂ : t.val < 3 / 4) : p3.to_fun t ∈ T1 := begin unfold p3, dsimp, unfold paste, simp [h_1], unfold p3_aux, simp [l₂, -sub_eq_add_neg, -one_div_eq_inv] , have a₁ : t ∈ T2, exact T2_of_not_T1 h_1, unfold T1 T, dsimp [-sub_eq_add_neg], split, refine sub_nonneg.2 _ , refine le_trans _ a₁.1 , {norm_num}, norm_num [l₂, -one_div_eq_inv, le_of_lt l₂ ], end ---h_2 : par half_lt_one ⟨t, _⟩ ∈ T1 lemma step_assoc_6 {t : {x // x ∈ I01}} ( h_1 : t ∉ T1 ) ( h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∈ T1) (h_3 : p3.to_fun t ∉ T1) : g.to_fun (par zero_lt_half ⟨par half_lt_one ⟨t, _⟩, h_2⟩) = h.to_fun (par half_lt_one ⟨p3.to_fun t, T2_of_not_T1 h_3 ⟩) := begin unfold p3, dsimp, unfold paste, simp [h_1], unfold p3_aux, by_cases a : t.val = 3/4, { have a₂ : ¬ t.val < 3/4, exact not_lt_of_ge (ge_of_eq a), simp [a₂, -sub_eq_add_neg, -one_div_eq_inv], unfold par, dsimp [-one_div_eq_inv, -sub_eq_add_neg], have g₂ : ↑t = t.val, trivial, simp [g₂ , a, subtype.ext], {norm_num, show g.to_fun 1 = h.to_fun 0, simp, }, }, have a₁ : t.val ≤ 3/4, exact help_step_assoc_6₁ h_2, have l₂ : t.val < 3/4, exact lt_of_le_of_ne a₁ a, by_contradiction, suffices g : p3.to_fun t ∈ T1, exact contr_T1 g h_3 , exact T1_of_p3₁ h_1 l₂ , end -- 7 lemma help_step_assoc_7₁ {t : {x // x ∈ I01}} {h_1 : t ∉ T1} (h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∉ T1) : 3/4 < t.val := begin unfold T1 T at h_2, simp [(par half_lt_one ⟨t, _⟩).2.1, -one_div_eq_inv] at h_2, unfold par at h_2, dsimp [-one_div_eq_inv, -sub_eq_add_neg] at h_2, have a₁ : ↑t = t.val, trivial, have a₂ : (1 - 1 / 2) = (1/2:ℝ ), {norm_num}, rw [a₁, a₂] at h_2, have H : 1 / 2 * (1 / 2) < (t.val - 1 / 2), refine (lt_div_iff _).1 h_2, {norm_num}, rw lt_sub_iff_add_lt at H, have g₁ : 1 / 2 * (1 / 2) + 1 / 2 = (3/4:ℝ ), {norm_num}, rw g₁ at H, exact H, end lemma p3_in_T1 {t : {x // x ∈ I01}} ( h_1 : t ∉ T1 ) (h_3 : p3.to_fun t ∈ T1) : t.val ≤ 3/4 := begin by_contradiction, rw not_le at a, unfold p3 at h_3, dsimp at h_3, unfold paste at h_3, simp [h_1] at h_3, unfold p3_aux at h_3, have a₂ : ¬ t.val < 3/4, exact not_lt_of_gt a, simp [a₂ , -one_div_eq_inv, -sub_eq_add_neg] at h_3, unfold T1 T at h_3, --simp at h_3, have g₁ : 2 * t.val - 1 ≤ 1/2, exact h_3.2, have g₂ : t.val ≤ 3/4, rw sub_le_iff_le_add at g₁ , have aux₁ : 1 / 2 + 1 = (3/2:ℝ ), {norm_num}, rw aux₁ at g₁, rw mul_comm at g₁ , have aux₂ : t.val ≤ (3 / 2 ) / 2, refine le_div_of_mul_le _ g₁ ,{norm_num}, have aux₃ : 3 / 2 / 2 = (3/4:ℝ), {norm_num}, rw aux₃ at aux₂ , exact aux₂, have g₃ : ¬ 3 / 4 < t.val, exact not_lt_of_ge g₂, cc, end lemma step_assoc_7 {t : {x // x ∈ I01}} ( h_1 : t ∉ T1 ) (h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∉ T1) ( h_3 : p3.to_fun t ∈ T1) (h_4 : par zero_lt_half ⟨p3.to_fun t, h_3⟩ ∈ T1) : h.to_fun (par half_lt_one ⟨par half_lt_one ⟨t, T2_of_not_T1 h_1⟩, T2_of_not_T1 h_2⟩) = f.to_fun (par zero_lt_half ⟨par zero_lt_half ⟨p3.to_fun t, h_3⟩, h_4⟩) := begin by_contradiction, have g₁ : 3/4 < t.val, exact help_step_assoc_7₁ h_2, have g₂ : ¬ 3/4 < t.val, exact not_lt_of_ge (p3_in_T1 h_1 h_3), cc, end -- 8 lemma help_step_assoc_8₁ {t : {x // x ∈ I01}} ( h_1 : t ∉ T1 ) (h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∉ T1) : 3/4 < t.val := begin unfold T1 T at h_2, simp [-one_div_eq_inv] at h_2, have h₁ := h_2 (par half_lt_one ⟨t, _⟩).2.1, unfold par at h₁,dsimp [-one_div_eq_inv, -sub_eq_add_neg] at h₁, have g₁ : (1 - 1 / 2) = (1/2:ℝ ), {norm_num}, have a₁ : ↑t = t.val, trivial, rw [g₁, a₁] at h₁, have h₂ : 1 / 2 * (1 / 2) < (t.val - 1 / 2), refine (lt_div_iff _).1 h₁ , {norm_num}, rw lt_sub_iff_add_lt at h₂, have a₂ : 1 / 2 * (1 / 2) + 1 / 2 = (3/4:ℝ ), {norm_num}, rw a₂ at h₂, exact h₂, end lemma step_assoc_8 {t : {x // x ∈ I01}} ( h_1 : t ∉ T1 ) (h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∉ T1) ( h_3 : p3.to_fun t ∈ T1) (h_4 : par zero_lt_half ⟨p3.to_fun t, h_3⟩ ∉ T1) : h.to_fun (par half_lt_one ⟨par half_lt_one ⟨t, T2_of_not_T1 h_1⟩, T2_of_not_T1 h_2 ⟩) = g.to_fun (par half_lt_one ⟨par zero_lt_half ⟨p3.to_fun t, h_3⟩, T2_of_not_T1 h_4 ⟩) := begin have g₁ : ¬ 3/4 < t.val, exact not_lt_of_ge (p3_in_T1 h_1 h_3) , have g₂ : 3/4 < t.val, exact help_step_assoc_8₁ h_1 h_2, cc, end -- 9 lemma step_assoc_9 {t : {x // x ∈ I01}} ( h_1 : t ∉ T1 ) (h_2 : par half_lt_one ⟨t, T2_of_not_T1 h_1 ⟩ ∉ T1) ( h_3 : p3.to_fun t ∉ T1) : h.to_fun (par half_lt_one ⟨par half_lt_one ⟨t, T2_of_not_T1 h_1⟩, T2_of_not_T1 h_2⟩) = h.to_fun (par half_lt_one ⟨p3.to_fun t, T2_of_not_T1 h_3⟩) := begin unfold p3, dsimp, unfold paste, simp [dif_neg h_1], have a₁ : ¬ t.val < 3/4, exact not_lt_of_gt (help_step_assoc_8₁ h_1 h_2), unfold p3_aux, simp [a₁, -one_div_eq_inv, -sub_eq_add_neg], unfold par, dsimp [-one_div_eq_inv, -sub_eq_add_neg], have a₂ : ↑t = t.val, trivial, have g₁ : (1 - 1 / 2) = (1/2:ℝ ), {norm_num}, simp [a₂, g₁, -one_div_eq_inv, -sub_eq_add_neg], suffices H : ((t.val - 1 / 2) / (1 / 2) - 1 / 2) = (2 * t.val - 1 - 1 / 2), apply congr_arg, apply subtype.eq, show ((t.val - 1 / 2) / (1 / 2) - 1 / 2) / (1 / 2) = (2 * t.val - 1 - 1 / 2) / (1 / 2), rw H, have a₃ : (t.val - 1 / 2) / (1 / 2) = (t.val ) / (1 / 2) - ( 1 / 2) / (1 / 2), apply eq.symm, refine div_sub_div_same t.val (1/2:ℝ) (1/2:ℝ), rw div_self at a₃, rw a₃ , rw div_eq_inv_mul, have a₄ : (1 / 2 : ℝ )⁻¹ = 2, {norm_num}, rw a₄, {norm_num}, end -- Homotopy for associativity noncomputable def hom_comp_f_g_h ( f : path x y) ( g : path y z) ( h : path z w) : path_homotopy ( comp_of_path f (comp_of_path g h)) (comp_of_path (comp_of_path f g) h ) := begin have h₁ : ( comp_of_path f (comp_of_path g h)) = repar_path (comp_of_path (comp_of_path f g) h ) p3, { unfold repar_path, dsimp, refine path_equal.2 _ , dsimp, unfold comp_of_path, dsimp, unfold paste fa_path fb_path fgen_path, dsimp, unfold paste, funext, unfold paste, split_ifs, exact step_assoc_1, exact step_assoc_2 h_3, exact step_assoc_3 h_1 h_2, exact step_assoc_4 h_1 h_2 h_3 h_4, exact step_assoc_5 h_1 h_2 h_3 h_4, exact step_assoc_6 h_1 h_2 h_3, exact step_assoc_7 h_1 h_2 h_3 h_4, exact step_assoc_8 h_1 h_2 h_3 h_4, exact step_assoc_9 h_1 h_2 h_3, }, rw h₁ , exact hom_repar_path_to_path (comp_of_path (comp_of_path f g) h ) p3, end end end homotopy_results
module Algebra (Adjoin (..) ,FreeGroup (..) ,Group (..) ,Z2 ,plugIn ,Algebra ,represent ,cutoff ,module N ) where import Algebra.Adjoin import Algebra.Group import Algebra.FreeGroup import Algebra.Z2 import Numeric.LinearAlgebra as N type Algebra = Adjoin Z2 FreeGroup {--type Algegra' = [(Z2,Vector Z,FreeGroup)] plush :: (Z2,Vector Z,FreeGroup) -> Algebra' -> Algebra' plush e [] = [e] plush e1@(z1,v1,g1) (e2@(z2,v2,g2):ls) = if v1 == v2 && g1 == g2 then (if z1+z2 == 0 then (0,N.fromList $ map (\_ -> 0) $ N.tolist v1,mempty) else (z1+z2,v1,g1)):ls else e2:(plush e1 ls) instance Num Algebra' where l1 + l2 = map (\e -> plush e l2) l1 l1 * l2 = sum $ map (\(z1,v1,g1) -> map (\(z2,v2,g2) -> (z1*z2,v1+v2,g1<>g2)) l2) l1 abs = map (\(z,v,g) -> (abs z,v,g)) signum = map (\(z,v,g) -> (signum z,v,g)) -- fromInteger x = [(fromInteger x, -} cutoff :: R cutoff = 0.0000000001 plugIn :: (Eq f,Fractional f) => (Char -> Adjoin f FreeGroup) -> Adjoin f FreeGroup -> Adjoin f FreeGroup plugIn f = adjPlugIn (groupPlugIn f) represent :: [Char] -> Algebra -> Maybe [Vector Z] represent [] _ = Nothing represent elems expr = do { chain <- pairPlusChain expr ; vectors <- mapM (\(_,g) -> toPseudoVector g) chain ; return $ map (\l -> (length elems) |> [toEnum $ maybe 0 id $ lookup (elems !! i) l | i <- [0..]]) vectors }
(** STG in COQ by Maciej Piróg, University of Wrocław, 2010 *) (** This library contains proofs of equivalence of semantics created by merging and splitting some rules of the DCPS semantics. In the paper it is done a little different, since it was easier (but less readable) to do it in Coq before switching to an abstract machine. *) Require Export Sem05. (** * Defunctionalized Continuation Passing Style Semantics 2 *) Reserved Notation "($ x $ a $ b $ g $ e $ s ^\\ c $ d $ h $ f )" (at level 70, no associativity). Inductive DCPS2 : action -> heapB -> expr -> env -> vars -> stack -> heapB -> expr -> env -> vars -> Prop := | D2_Halt : forall Gamma w sigma ps, ($ A $ Gamma $ w $ sigma $ ps $ nil ^\\ Gamma $ w $ sigma $ ps) | D2_Con : forall Gamma Delta C pi w sigma rho qs Ss, ($ A $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^\\ Delta $ w $ rho $ qs) -> ($ E $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^\\ Delta $ w $ rho $ qs) | D2_Accum : forall Gamma Delta x xm sigma_xm qn w rs sigma rho Ss, xm <> nil -> env_map sigma xm = Some sigma_xm -> ($ E $ Gamma $ App x nil $ sigma $ sigma_xm ++ qn $ Ss ^\\ Delta $ w $ rho $ rs) -> ($ E $ Gamma $ App x xm $ sigma $ qn $ Ss ^\\ Delta $ w $ rho $ rs) | D2_App1 : forall Gamma tau p x pn m e sigma , env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m > length pn -> ($ E $ Gamma $ App x nil $ sigma $ pn $ nil ^\\ Gamma $ App x nil $ sigma $ pn) | D2_App2_5 : forall Gamma Delta m e x tau p pn w rs sigma rho Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m <= length pn -> ($ E $ Gamma $ e $ zip_var_list m (firstn m pn) ++ shift m tau $ skipn m pn $ Ss ^\\ Delta $ w $ rho $ rs) -> ($ E $ Gamma $ App x nil $ sigma $ pn $ Ss ^\\ Delta $ w $ rho $ rs) | D2A_App4 : forall Delta rho C xs p Theta w nu qs Ss, ($ E $ setB Delta p (Lf_n 0 (Constr C xs), trim rho xs) $ Constr C xs $ rho $ nil $ Ss ^\\ Theta $ w $ nu $ qs) -> ($ A $ Delta $ Constr C xs $ rho $ nil $ S_upd (Atom p) nil :: Ss ^\\ Theta $ w $ nu $ qs) | D2E_App4_5 : forall Gamma Theta x p w e tau sigma nu rs qs Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_u e, tau) -> ($ E $ Gamma $ e $ tau $ nil $ S_upd (Atom p) rs :: Ss ^\\ Theta $ w $ nu $ qs) -> ($ E $ Gamma $ App x nil $ sigma $ rs $ Ss ^\\ Theta $ w $ nu $ qs) | D2A_App5 : forall EA Delta Theta x p pn y q qk f n w sigma rho nu mu qs Ss, env_find sigma x = Some (Atom p) -> env_find rho y = Some (Atom q) -> Delta q = Some (Lf_n n f, mu) -> length qk < n -> ($ E $ setB Delta p (Lf_n (n - length qk) f, trim (zip_var_list (length qk) qk ++ shift (length qk) mu) (fv (Lf_n (n - length qk) f))) $ App y nil $ rho $ qk ++ pn $ Ss ^\\ Theta $ w $ nu $ qs) -> ($ EA $ Delta $ App y nil $ rho $ qk $ S_upd (Atom p) pn :: Ss ^\\ Theta $ w $ nu $ qs) | D2_Let : forall Gamma Delta sigma rho lfs e w (ats : list nat) rs qs Ss, length ats = length lfs -> (forall a : nat, In a ats -> Gamma a = None) -> ($ E $ allocB Gamma ats (map (fun lf => (lf, trim (zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma) (fv lf))) lfs) $ e $ zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma $ rs $ Ss ^\\ Delta $ w $ rho $ qs) -> ($ E $ Gamma $ Letrec lfs e $ sigma $ rs $ Ss ^\\ Delta $ w $ rho $ qs) | D2E_Case_of : forall Gamma Theta e als w rs qs sigma nu Ss, ($ E $ Gamma $ e $ sigma $ nil $ S_alt als sigma qs :: Ss ^\\ Theta $ w $ nu $ rs) -> ($ E $ Gamma $ Case e als $ sigma $ qs $ Ss ^\\ Theta $ w $ nu $ rs) | D2A_Case_of : forall Delta Theta b e0 als ys w c c0 rho_ys rs qs sigma rho nu Ss, length ys = b -> env_map rho ys = Some rho_ys -> select_case als c = Some (Alt c0 b e0) -> ($ E $ Delta $ e0 $ zip_var_list b rho_ys ++ shift b sigma $ qs $ Ss ^\\ Theta $ w $ nu $ rs) -> ($ A $ Delta $ Constr c ys $ rho $ nil $ S_alt als sigma qs :: Ss ^\\ Theta $ w $ nu $ rs) where "($ x $ a $ b $ g $ e $ s ^\\ c $ d $ h $ f )" := (DCPS2 x a b g e s c d h f). Hint Constructors DCPS2. Lemma DCPS2_complete : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\ Delta $ f $ rho $ qn) -> ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\ Delta $ f $ rho $ qn). Proof with isa; eauto. intros. induction H... destruct Ss. (* nil *) inversion H2; subst... (* cons *) inversion IHDCPS; subst... Qed. Lemma DCPS2_sound : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\ Delta $ f $ rho $ qn) -> ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\ Delta $ f $ rho $ qn). Proof with isa; eauto. intros. induction H... destruct EA... Qed. (** * Defunctionalized Continuation Passing Style Semantics 3 *) Reserved Notation "($ x $ a $ b $ g $ e $ s ^\\\ c $ d $ h $ f )" (at level 70, no associativity). Inductive DCPS3 : action -> heapB -> expr -> env -> vars -> stack -> heapB -> expr -> env -> vars -> Prop := | D3_Halt : forall Gamma w sigma ps, ($ A $ Gamma $ w $ sigma $ ps $ nil ^\\\ Gamma $ w $ sigma $ ps) | D3_Con : forall Gamma Delta C pi w sigma rho qs Ss, ($ A $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^\\\ Delta $ w $ rho $ qs) -> ($ E $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^\\\ Delta $ w $ rho $ qs) | D3_Accum : forall Gamma Delta x xm sigma_xm qn w rs sigma rho Ss, xm <> nil -> env_map sigma xm = Some sigma_xm -> ($ E $ Gamma $ App x nil $ sigma $ sigma_xm ++ qn $ Ss ^\\\ Delta $ w $ rho $ rs) -> ($ E $ Gamma $ App x xm $ sigma $ qn $ Ss ^\\\ Delta $ w $ rho $ rs) | D3_App1 : forall Gamma tau p x pn m e sigma , env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m > length pn -> ($ E $ Gamma $ App x nil $ sigma $ pn $ nil ^\\\ Gamma $ App x nil $ sigma $ pn) | D3_App2_5 : forall Gamma Delta m e x tau p pn w rs sigma rho Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m <= length pn -> ($ E $ Gamma $ e $ zip_var_list m (firstn m pn) ++ shift m tau $ skipn m pn $ Ss ^\\\ Delta $ w $ rho $ rs) -> ($ E $ Gamma $ App x nil $ sigma $ pn $ Ss ^\\\ Delta $ w $ rho $ rs) | D3A_App4 : forall Delta rho C xs p Theta w nu qs Ss, ($ E $ setB Delta p (Lf_n 0 (Constr C xs), trim rho xs) $ Constr C xs $ rho $ nil $ Ss ^\\\ Theta $ w $ nu $ qs) -> ($ A $ Delta $ Constr C xs $ rho $ nil $ S_upd (Atom p) nil :: Ss ^\\\ Theta $ w $ nu $ qs) | D3E_App4_5 : forall Gamma Theta x p w e tau sigma nu rs qs Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_u e, tau) -> ($ E $ Gamma $ e $ tau $ nil $ S_upd (Atom p) rs :: Ss ^\\\ Theta $ w $ nu $ qs) -> ($ E $ Gamma $ App x nil $ sigma $ rs $ Ss ^\\\ Theta $ w $ nu $ qs) | D3A_App5 : forall EA Delta Theta x p pn y q qk f n w sigma rho nu mu qs Ss, env_find sigma x = Some (Atom p) -> env_find rho y = Some (Atom q) -> Delta q = Some (Lf_n n f, mu) -> length qk < n -> ($ E $ setB Delta p (Lf_n (n - length qk) f, trim (zip_var_list (length qk) qk ++ shift (length qk) mu) (fv (Lf_n (n - length qk) f))) $ App y nil $ rho $ qk ++ pn $ Ss ^\\\ Theta $ w $ nu $ qs) -> ($ EA $ Delta $ App y nil $ rho $ qk $ S_upd (Atom p) pn :: Ss ^\\\ Theta $ w $ nu $ qs) | D3_Let : forall Gamma Delta sigma rho lfs e w (ats : list nat) rs qs Ss, length ats = length lfs -> (forall a : nat, In a ats -> Gamma a = None) -> ($ E $ allocB Gamma ats (map (fun lf => (lf, trim (zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma) (fv lf))) lfs) $ e $ zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma $ rs $ Ss ^\\\ Delta $ w $ rho $ qs) -> ($ E $ Gamma $ Letrec lfs e $ sigma $ rs $ Ss ^\\\ Delta $ w $ rho $ qs) | D3E_Case_of : forall Gamma Theta e als w rs qs sigma nu Ss, ($ E $ Gamma $ e $ sigma $ nil $ S_alt als sigma qs :: Ss ^\\\ Theta $ w $ nu $ rs) -> ($ E $ Gamma $ Case e als $ sigma $ qs $ Ss ^\\\ Theta $ w $ nu $ rs) | D3A_Case_of : forall Delta Theta b e0 als ys w c c0 rho_ys rs qs sigma rho nu Ss, length ys = b -> env_map rho ys = Some rho_ys -> select_case als c = Some (Alt c0 b e0) -> ($ E $ Delta $ e0 $ zip_var_list b rho_ys ++ shift b sigma $ qs $ Ss ^\\\ Theta $ w $ nu $ rs) -> ($ A $ Delta $ Constr c ys $ rho $ nil $ S_alt als sigma qs :: Ss ^\\\ Theta $ w $ nu $ rs) where "($ x $ a $ b $ g $ e $ s ^\\\ c $ d $ h $ f )" := (DCPS3 x a b g e s c d h f). Hint Constructors DCPS3. Lemma DCPS3_complete : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\ Delta $ f $ rho $ qn) -> ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\\ Delta $ f $ rho $ qn). Proof. intros. induction H; eauto. Qed. Lemma DCPS3_sound : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\\ Delta $ f $ rho $ qn) -> ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\ Delta $ f $ rho $ qn). Proof. intros. induction H; eauto. Qed. (** * Defunctionalized Continuation Passing Style Semantics 3 N *) Reserved Notation "($ x $ a $ b $ g $ e $ s ^^\\\ c $ d $ h $ f ^^ n )" (at level 70, no associativity). Inductive DCPS3N : action -> heapB -> expr -> env -> vars -> stack -> heapB -> expr -> env -> vars -> nat -> Prop := | D3N_Halt : forall Gamma w sigma ps, ($ A $ Gamma $ w $ sigma $ ps $ nil ^^\\\ Gamma $ w $ sigma $ ps ^^ 0) | D3N_Con : forall Gamma Delta C pi w sigma rho qs Ss N, ($ A $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^^\\\ Delta $ w $ rho $ qs ^^ N) -> ($ E $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^^\\\ Delta $ w $ rho $ qs ^^ S N) | D3N_Accum : forall Gamma Delta x xm sigma_xm qn w rs sigma rho Ss N, xm <> nil -> env_map sigma xm = Some sigma_xm -> ($ E $ Gamma $ App x nil $ sigma $ sigma_xm ++ qn $ Ss ^^\\\ Delta $ w $ rho $ rs ^^ N) -> ($ E $ Gamma $ App x xm $ sigma $ qn $ Ss ^^\\\ Delta $ w $ rho $ rs ^^ S N) | D3N_App1 : forall Gamma tau p x pn m e sigma, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m > length pn -> ($ E $ Gamma $ App x nil $ sigma $ pn $ nil ^^\\\ Gamma $ App x nil $ sigma $ pn ^^ 0) | D3N_App2_5 : forall Gamma Delta m e x tau p pn w rs sigma rho Ss N, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m <= length pn -> ($ E $ Gamma $ e $ zip_var_list m (firstn m pn) ++ shift m tau $ skipn m pn $ Ss ^^\\\ Delta $ w $ rho $ rs ^^ N) -> ($ E $ Gamma $ App x nil $ sigma $ pn $ Ss ^^\\\ Delta $ w $ rho $ rs ^^ S N) | D3NA_App4 : forall Delta rho C xs p Theta w nu qs Ss N, ($ E $ setB Delta p (Lf_n 0 (Constr C xs), trim rho xs) $ Constr C xs $ rho $ nil $ Ss ^^\\\ Theta $ w $ nu $ qs ^^ N) -> ($ A $ Delta $ Constr C xs $ rho $ nil $ S_upd (Atom p) nil :: Ss ^^\\\ Theta $ w $ nu $ qs ^^ S N) | D3NE_App4_5 : forall Gamma Theta x p w e tau sigma nu rs qs Ss N, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_u e, tau) -> ($ E $ Gamma $ e $ tau $ nil $ S_upd (Atom p) rs :: Ss ^^\\\ Theta $ w $ nu $ qs ^^ N) -> ($ E $ Gamma $ App x nil $ sigma $ rs $ Ss ^^\\\ Theta $ w $ nu $ qs ^^ S N) | D3NA_App5 : forall EA Delta Theta x p pn y q qk f n w sigma rho nu mu qs Ss N, env_find sigma x = Some (Atom p) -> env_find rho y = Some (Atom q) -> Delta q = Some (Lf_n n f, mu) -> length qk < n -> ($ E $ setB Delta p (Lf_n (n - length qk) f, trim (zip_var_list (length qk) qk ++ shift (length qk) mu) (fv (Lf_n (n - length qk) f))) $ App y nil $ rho $ qk ++ pn $ Ss ^^\\\ Theta $ w $ nu $ qs ^^ N) -> ($ EA $ Delta $ App y nil $ rho $ qk $ S_upd (Atom p) pn :: Ss ^^\\\ Theta $ w $ nu $ qs ^^ S N) | D3N_Let : forall Gamma Delta sigma rho lfs e w (ats : list nat) rs qs Ss N, length ats = length lfs -> (forall a : nat, In a ats -> Gamma a = None) -> ($ E $ allocB Gamma ats (map (fun lf => (lf, trim (zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma) (fv lf))) lfs) $ e $ zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma $ rs $ Ss ^^\\\ Delta $ w $ rho $ qs ^^ N) -> ($ E $ Gamma $ Letrec lfs e $ sigma $ rs $ Ss ^^\\\ Delta $ w $ rho $ qs ^^ S N) | D3NE_Case_of : forall Gamma Theta e als w rs qs sigma nu Ss N, ($ E $ Gamma $ e $ sigma $ nil $ S_alt als sigma qs :: Ss ^^\\\ Theta $ w $ nu $ rs ^^ N) -> ($ E $ Gamma $ Case e als $ sigma $ qs $ Ss ^^\\\ Theta $ w $ nu $ rs ^^ S N) | D3NA_Case_of : forall Delta Theta b e0 als ys w c c0 rho_ys rs qs sigma rho nu Ss N, length ys = b -> env_map rho ys = Some rho_ys -> select_case als c = Some (Alt c0 b e0) -> ($ E $ Delta $ e0 $ zip_var_list b rho_ys ++ shift b sigma $ qs $ Ss ^^\\\ Theta $ w $ nu $ rs ^^ N) -> ($ A $ Delta $ Constr c ys $ rho $ nil $ S_alt als sigma qs :: Ss ^^\\\ Theta $ w $ nu $ rs ^^ S N) where "($ x $ a $ b $ g $ e $ s ^^\\\ c $ d $ h $ f ^^ n )" := (DCPS3N x a b g e s c d h f n). Hint Constructors DCPS3N. Lemma DCPS3N_complete : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\\ Delta $ f $ rho $ qn) -> exists N, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^^\\\ Delta $ f $ rho $ qn ^^ N). Proof with eauto. intros. induction H; try eauto; destruct IHDCPS3 as [N]; exists (S N); try constructor... Qed. Lemma DCPS3N_sound : forall EA N Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^^\\\ Delta $ f $ rho $ qn ^^ N) -> ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\\ Delta $ f $ rho $ qn). Proof with isa; eauto. intros. induction H... Qed. (** * Defunctionalized Continuation Passing Style Semantics 4 *) Reserved Notation "($ x $ a $ b $ g $ e $ s ^\\/ c $ d $ h $ f )" (at level 70, no associativity). Inductive DCPS4 : action -> heapB -> expr -> env -> vars -> stack -> heapB -> expr -> env -> vars -> Prop := | D4_Halt : forall Gamma w sigma ps, ($ A $ Gamma $ w $ sigma $ ps $ nil ^\\/ Gamma $ w $ sigma $ ps) | D4_Con : forall Gamma Delta C pi w sigma rho qs Ss, ($ A $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^\\/ Delta $ w $ rho $ qs) -> ($ E $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^\\/ Delta $ w $ rho $ qs) | D4_Accum : forall Gamma Delta x xm sigma_xm qn w rs sigma rho Ss, xm <> nil -> env_map sigma xm = Some sigma_xm -> ($ E $ Gamma $ App x nil $ sigma $ sigma_xm ++ qn $ Ss ^\\/ Delta $ w $ rho $ rs) -> ($ E $ Gamma $ App x xm $ sigma $ qn $ Ss ^\\/ Delta $ w $ rho $ rs) | D4_App1 : forall Gamma tau p x pn m e sigma , env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m > length pn -> ($ E $ Gamma $ App x nil $ sigma $ pn $ nil ^\\/ Gamma $ App x nil $ sigma $ pn) | D4_App2_5 : forall Gamma Delta m e x tau p pn w rs sigma rho Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m <= length pn -> ($ E $ Gamma $ e $ zip_var_list m (firstn m pn) ++ shift m tau $ skipn m pn $ Ss ^\\/ Delta $ w $ rho $ rs) -> ($ E $ Gamma $ App x nil $ sigma $ pn $ Ss ^\\/ Delta $ w $ rho $ rs) | D4A_App4 : forall Delta rho C xs p Theta w nu qs Ss, ($ E $ setB Delta p (Lf_n 0 (Constr C xs), trim rho xs) $ Constr C xs $ rho $ nil $ Ss ^\\/ Theta $ w $ nu $ qs) -> ($ A $ Delta $ Constr C xs $ rho $ nil $ S_upd (Atom p) nil :: Ss ^\\/ Theta $ w $ nu $ qs) | D4E_App4_5 : forall Gamma Theta x p w e tau sigma nu rs qs Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_u e, tau) -> ($ E $ Gamma $ e $ tau $ nil $ S_upd (Atom p) rs :: Ss ^\\/ Theta $ w $ nu $ qs) -> ($ E $ Gamma $ App x nil $ sigma $ rs $ Ss ^\\/ Theta $ w $ nu $ qs) | D4A_App5 : forall Delta Theta x p pn y q qk f n w sigma rho nu mu qs Ss, env_find sigma x = Some (Atom p) -> env_find rho y = Some (Atom q) -> Delta q = Some (Lf_n n f, mu) -> length qk < n -> ($ E $ setB Delta p (Lf_n (n - length qk) f, trim (zip_var_list (length qk) qk ++ shift (length qk) mu) (fv (Lf_n (n - length qk) f))) $ App y nil $ rho $ qk ++ pn $ Ss ^\\/ Theta $ w $ nu $ qs) -> ($ E $ Delta $ App y nil $ rho $ qk $ S_upd (Atom p) pn :: Ss ^\\/ Theta $ w $ nu $ qs) | D4_Let : forall Gamma Delta sigma rho lfs e w (ats : list nat) rs qs Ss, length ats = length lfs -> (forall a : nat, In a ats -> Gamma a = None) -> ($ E $ allocB Gamma ats (map (fun lf => (lf, trim (zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma) (fv lf))) lfs) $ e $ zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma $ rs $ Ss ^\\/ Delta $ w $ rho $ qs) -> ($ E $ Gamma $ Letrec lfs e $ sigma $ rs $ Ss ^\\/ Delta $ w $ rho $ qs) | D4E_Case_of : forall Gamma Theta e als w rs qs sigma nu Ss, ($ E $ Gamma $ e $ sigma $ nil $ S_alt als sigma qs :: Ss ^\\/ Theta $ w $ nu $ rs) -> ($ E $ Gamma $ Case e als $ sigma $ qs $ Ss ^\\/ Theta $ w $ nu $ rs) | D4A_Case_of : forall Delta Theta b e0 als ys w c c0 rho_ys rs qs sigma rho nu Ss, length ys = b -> env_map rho ys = Some rho_ys -> select_case als c = Some (Alt c0 b e0) -> ($ E $ Delta $ e0 $ zip_var_list b rho_ys ++ shift b sigma $ qs $ Ss ^\\/ Theta $ w $ nu $ rs) -> ($ A $ Delta $ Constr c ys $ rho $ nil $ S_alt als sigma qs :: Ss ^\\/ Theta $ w $ nu $ rs) where "($ x $ a $ b $ g $ e $ s ^\\/ c $ d $ h $ f )" := (DCPS4 x a b g e s c d h f). Hint Constructors DCPS4. Lemma DCPS4_complete : forall N Gamma e sigma pn Ss Delta f rho qn, ($ E $ Gamma $ e $ sigma $ pn $ Ss ^^\\\ Delta $ f $ rho $ qn ^^ N) -> ($ E $ Gamma $ e $ sigma $ pn $ Ss ^\\/ Delta $ f $ rho $ qn). Proof with eauto. intro N. induction N using lt_wf_ind; isa. inversion H0; subst... inversion H0; subst... constructor. inversion H7; subst... Qed. Lemma DCPS4_sound : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\/ Delta $ f $ rho $ qn) -> ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\\ Delta $ f $ rho $ qn). Proof. intros. induction H; eauto. Qed. (** * Defunctionalized Continuation Passing Style Semantics 5 *) Reserved Notation "($ x $ a $ b $ g $ e $ s ^\/ c $ d $ h $ f )" (at level 70, no associativity). Inductive DCPS5 : action -> heapB -> expr -> env -> vars -> stack -> heapB -> expr -> env -> vars -> Prop := | D5_Halt : forall Gamma w sigma ps, ($ A $ Gamma $ w $ sigma $ ps $ nil ^\/ Gamma $ w $ sigma $ ps) | D5_Con : forall Gamma Delta C pi w sigma rho qs Ss, ($ A $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^\/ Delta $ w $ rho $ qs) -> ($ E $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^\/ Delta $ w $ rho $ qs) | D5_Accum : forall Gamma Delta x xm sigma_xm qn w rs sigma rho Ss, xm <> nil -> env_map sigma xm = Some sigma_xm -> ($ E $ Gamma $ App x nil $ sigma $ sigma_xm ++ qn $ Ss ^\/ Delta $ w $ rho $ rs) -> ($ E $ Gamma $ App x xm $ sigma $ qn $ Ss ^\/ Delta $ w $ rho $ rs) | D5_App1 : forall Gamma tau p x pn m e sigma , env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m > length pn -> ($ E $ Gamma $ App x nil $ sigma $ pn $ nil ^\/ Gamma $ App x nil $ sigma $ pn) | D5_App2_5 : forall Gamma Delta m e x tau p pn w rs sigma rho Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m <= length pn -> ($ E $ Gamma $ e $ zip_var_list m (firstn m pn) ++ shift m tau $ skipn m pn $ Ss ^\/ Delta $ w $ rho $ rs) -> ($ E $ Gamma $ App x nil $ sigma $ pn $ Ss ^\/ Delta $ w $ rho $ rs) | D5A_App4 : forall Delta rho C xs p Theta w nu qs Ss, ($ A $ setB Delta p (Lf_n 0 (Constr C xs), trim rho xs) $ Constr C xs $ rho $ nil $ Ss ^\/ Theta $ w $ nu $ qs) -> ($ A $ Delta $ Constr C xs $ rho $ nil $ S_upd (Atom p) nil :: Ss ^\/ Theta $ w $ nu $ qs) | D5E_App4_5 : forall Gamma Theta x p w e tau sigma nu rs qs Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_u e, tau) -> ($ E $ Gamma $ e $ tau $ nil $ S_upd (Atom p) rs :: Ss ^\/ Theta $ w $ nu $ qs) -> ($ E $ Gamma $ App x nil $ sigma $ rs $ Ss ^\/ Theta $ w $ nu $ qs) | D5A_App5 : forall Delta Theta x p pn y q qk f n w sigma rho nu mu qs Ss, env_find sigma x = Some (Atom p) -> env_find rho y = Some (Atom q) -> Delta q = Some (Lf_n n f, mu) -> length qk < n -> ($ E $ setB Delta p (Lf_n (n - length qk) f, trim (zip_var_list (length qk) qk ++ shift (length qk) mu) (fv (Lf_n (n - length qk) f))) $ App y nil $ rho $ qk ++ pn $ Ss ^\/ Theta $ w $ nu $ qs) -> ($ E $ Delta $ App y nil $ rho $ qk $ S_upd (Atom p) pn :: Ss ^\/ Theta $ w $ nu $ qs) | D5_Let : forall Gamma Delta sigma rho lfs e w (ats : list nat) rs qs Ss, length ats = length lfs -> (forall a : nat, In a ats -> Gamma a = None) -> ($ E $ allocB Gamma ats (map (fun lf => (lf, trim (zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma) (fv lf))) lfs) $ e $ zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma $ rs $ Ss ^\/ Delta $ w $ rho $ qs) -> ($ E $ Gamma $ Letrec lfs e $ sigma $ rs $ Ss ^\/ Delta $ w $ rho $ qs) | D5E_Case_of : forall Gamma Theta e als w rs qs sigma nu Ss, ($ E $ Gamma $ e $ sigma $ nil $ S_alt als sigma qs :: Ss ^\/ Theta $ w $ nu $ rs) -> ($ E $ Gamma $ Case e als $ sigma $ qs $ Ss ^\/ Theta $ w $ nu $ rs) | D5A_Case_of : forall Delta Theta b e0 als ys w c c0 rho_ys rs qs sigma rho nu Ss, length ys = b -> env_map rho ys = Some rho_ys -> select_case als c = Some (Alt c0 b e0) -> ($ E $ Delta $ e0 $ zip_var_list b rho_ys ++ shift b sigma $ qs $ Ss ^\/ Theta $ w $ nu $ rs) -> ($ A $ Delta $ Constr c ys $ rho $ nil $ S_alt als sigma qs :: Ss ^\/ Theta $ w $ nu $ rs) where "($ x $ a $ b $ g $ e $ s ^\/ c $ d $ h $ f )" := (DCPS5 x a b g e s c d h f). Hint Constructors DCPS5. Lemma DCPS5_complete : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\/ Delta $ f $ rho $ qn) -> ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\/ Delta $ f $ rho $ qn). Proof with eauto. intros. induction H... inversion IHDCPS4; subst... Qed. Lemma DCPS5_sound : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\/ Delta $ f $ rho $ qn) -> ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\\/ Delta $ f $ rho $ qn). Proof. intros. induction H; eauto. Qed. (** * The STG Almost-Machine *) Inductive instruction := Eval | Enter | ReturnCon. Reserved Notation "($ x $ a $ b $ g $ e $ s ^^^ c $ d $ h $ f )" (at level 70, no associativity). Inductive ASTG : instruction -> heapB -> expr -> env -> vars -> stack -> heapB -> expr -> env -> vars -> Prop := | ASTG_Halt : forall Gamma w sigma ps, ($ ReturnCon $ Gamma $ w $ sigma $ ps $ nil ^^^ Gamma $ w $ sigma $ ps) | ASTG_Con : forall Gamma Delta C pi w sigma rho qs Ss, ($ ReturnCon $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^^^ Delta $ w $ rho $ qs) -> ($ Eval $ Gamma $ Constr C pi $ sigma $ nil $ Ss ^^^ Delta $ w $ rho $ qs) | ASTG_Accum : forall Gamma Delta x xm sigma_xm qn w rs sigma rho Ss, (* We abandon xm <> nil *) env_map sigma xm = Some sigma_xm -> ($ Enter $ Gamma $ App x nil $ sigma $ sigma_xm ++ qn $ Ss ^^^ Delta $ w $ rho $ rs) -> ($ Eval $ Gamma $ App x xm $ sigma $ qn $ Ss ^^^ Delta $ w $ rho $ rs) | ASTG_App1 : forall Gamma tau p x pn m e sigma , env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m > length pn -> ($ Enter $ Gamma $ App x nil $ sigma $ pn $ nil ^^^ Gamma $ App x nil $ sigma $ pn) | ASTG_App2_5 : forall Gamma Delta m e x tau p pn w rs sigma rho Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_n m e, tau) -> m <= length pn -> ($ Eval $ Gamma $ e $ zip_var_list m (firstn m pn) ++ shift m tau $ skipn m pn $ Ss ^^^ Delta $ w $ rho $ rs) -> ($ Enter $ Gamma $ App x nil $ sigma $ pn $ Ss ^^^ Delta $ w $ rho $ rs) | ASTGA_App4 : forall Delta rho C xs p Theta w nu qs Ss, ($ ReturnCon $ setB Delta p (Lf_n 0 (Constr C xs), trim rho xs) $ Constr C xs $ rho $ nil $ Ss ^^^ Theta $ w $ nu $ qs) -> ($ ReturnCon $ Delta $ Constr C xs $ rho $ nil $ S_upd (Atom p) nil :: Ss ^^^ Theta $ w $ nu $ qs) | ASTGE_App4_5 : forall Gamma Theta x p w e tau sigma nu rs qs Ss, env_find sigma x = Some (Atom p) -> Gamma p = Some (Lf_u e, tau) -> ($ Eval $ Gamma $ e $ tau $ nil $ S_upd (Atom p) rs :: Ss ^^^ Theta $ w $ nu $ qs) -> ($ Enter $ Gamma $ App x nil $ sigma $ rs $ Ss ^^^ Theta $ w $ nu $ qs) | ASTGA_App5 : forall Delta Theta x p pn y q qk f n w sigma rho nu mu qs Ss, env_find sigma x = Some (Atom p) -> env_find rho y = Some (Atom q) -> Delta q = Some (Lf_n n f, mu) -> length qk < n -> ($ Enter $ setB Delta p (Lf_n (n - length qk) f, trim (zip_var_list (length qk) qk ++ shift (length qk) mu) (fv (Lf_n (n - length qk) f))) $ App y nil $ rho $ qk ++ pn $ Ss ^^^ Theta $ w $ nu $ qs) -> ($ Enter $ Delta $ App y nil $ rho $ qk $ S_upd (Atom p) pn :: Ss ^^^ Theta $ w $ nu $ qs) | ASTG_Let : forall Gamma Delta sigma rho lfs e w (ats : list nat) rs qs Ss, length ats = length lfs -> (forall a : nat, In a ats -> Gamma a = None) -> ($ Eval $ allocB Gamma ats (map (fun lf => (lf, trim (zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma) (fv lf))) lfs) $ e $ zip_var_list (length lfs) (map Atom ats) ++ shift (length lfs) sigma $ rs $ Ss ^^^ Delta $ w $ rho $ qs) -> ($ Eval $ Gamma $ Letrec lfs e $ sigma $ rs $ Ss ^^^ Delta $ w $ rho $ qs) | ASTGE_Case_of : forall Gamma Theta e als w rs qs sigma nu Ss, ($ Eval $ Gamma $ e $ sigma $ nil $ S_alt als sigma qs :: Ss ^^^ Theta $ w $ nu $ rs) -> ($ Eval $ Gamma $ Case e als $ sigma $ qs $ Ss ^^^ Theta $ w $ nu $ rs) | ASTGA_Case_of : forall Delta Theta b e0 als ys w c c0 rho_ys rs qs sigma rho nu Ss, length ys = b -> env_map rho ys = Some rho_ys -> select_case als c = Some (Alt c0 b e0) -> ($ Eval $ Delta $ e0 $ zip_var_list b rho_ys ++ shift b sigma $ qs $ Ss ^^^ Theta $ w $ nu $ rs) -> ($ ReturnCon $ Delta $ Constr c ys $ rho $ nil $ S_alt als sigma qs :: Ss ^^^ Theta $ w $ nu $ rs) where "($ x $ a $ b $ g $ e $ s ^^^ c $ d $ h $ f )" := (ASTG x a b g e s c d h f). Hint Constructors ASTG. Definition action_to_instruction (a : action) (e : expr) : instruction := match a with | A => ReturnCon | E => match e with | App _ nil => Enter | _ => Eval end end. Lemma ASTG_complete_aux : forall EA Gamma e sigma pn Ss Delta f rho qn, ($ EA $ Gamma $ e $ sigma $ pn $ Ss ^\/ Delta $ f $ rho $ qn) -> ($ action_to_instruction EA e $ Gamma $ e $ sigma $ pn $ Ss ^^^ Delta $ f $ rho $ qn). Proof with isa. intros. induction H... (* Case *) destruct xm... case H... econstructor; eauto. (* Case *) econstructor; eauto. (* Case *) destruct e; econstructor; eauto. destruct v0; eauto. apply ASTG_Accum with (sigma_xm := nil); eauto. (* Case *) destruct e; econstructor 7; eauto. destruct v0; eauto. apply ASTG_Accum with (sigma_xm := nil); eauto. (* Case *) econstructor 8; eauto. (* Case *) destruct e; econstructor; eauto. destruct v0; eauto. apply ASTG_Accum with (sigma_xm := nil); eauto. (* Case *) destruct e; econstructor; eauto. destruct v0; eauto. apply ASTG_Accum with (sigma_xm := nil); eauto. (* Case *) destruct e0; econstructor; eauto. destruct v0; eauto. apply ASTG_Accum with (sigma_xm := nil); eauto. Qed. Lemma ASTG_complete : forall Gamma e sigma pn Ss Delta f rho qn, ($ E $ Gamma $ e $ sigma $ pn $ Ss ^\/ Delta $ f $ rho $ qn) -> ($ Eval $ Gamma $ e $ sigma $ pn $ Ss ^^^ Delta $ f $ rho $ qn). Proof with isa. intros. destruct e. (* Case *) destruct v0. (* Subcase *) apply ASTG_Accum with (sigma_xm := nil)... fold (action_to_instruction E (App v nil)). apply ASTG_complete_aux... (* Subcase *) fold (action_to_instruction E (App v (v0 :: v1))). apply ASTG_complete_aux... (* Case *) fold (action_to_instruction E (Constr c v)). apply ASTG_complete_aux... (* Case *) fold (action_to_instruction E (Letrec l e)). apply ASTG_complete_aux... (* Case *) fold (action_to_instruction E (Case e l)). apply ASTG_complete_aux... Qed. Definition instruction_to_action (i : instruction) : action := match i with | ReturnCon => A | _ => E end. Lemma ASTG_sound_aux : forall REE Gamma e sigma pn Ss Delta f rho qn, ($ REE $ Gamma $ e $ sigma $ pn $ Ss ^^^ Delta $ f $ rho $ qn) -> ($ instruction_to_action REE $ Gamma $ e $ sigma $ pn $ Ss ^\/ Delta $ f $ rho $ qn). Proof with isa. intros. induction H... (* Case *) destruct xm. (* Subcase *) simpl in H. inversion H; subst... (* Subcase *) eapply D5_Accum; eauto. discriminate. (* Case *) eapply D5_App1; eauto. (* Case *) eapply D5_App2_5; eauto. (* Case *) eapply D5E_App4_5; eauto. (* Case *) eapply D5A_App5; eauto. (* Case *) econstructor; eauto. (* Case *) econstructor; eauto. Qed. Lemma ASTG_sound : forall Gamma e sigma pn Ss Delta f rho qn, ($ Eval $ Gamma $ e $ sigma $ pn $ Ss ^^^ Delta $ f $ rho $ qn) -> ($ E $ Gamma $ e $ sigma $ pn $ Ss ^\/ Delta $ f $ rho $ qn). Proof with isa. intros. fold (instruction_to_action Eval). apply ASTG_sound_aux... Qed.
module Prelude.Number where open import Agda.Builtin.FromNat public open import Agda.Builtin.FromNeg public NoNumConstraint : ∀ {a} {A : Set a} → Number A → Set a NoNumConstraint Num = ∀ {n} → Number.Constraint Num n NoNegConstraint : ∀ {a} {A : Set a} → Negative A → Set a NoNegConstraint Neg = ∀ {n} → Negative.Constraint Neg n
import ring_theory.ideal.operations section induction namespace submodule universes u v variables {R : Type u} {M : Type v} {F : Type*} {G : Type*} variables [comm_semiring R] [add_comm_monoid M] [module R M] variables {I J : ideal R} {N P Q : submodule R M} -- TODO : add other if needed end submodule end induction section factorial variables {A : Type*} [comm_ring A] {I : ideal A} lemma factorial_is_unit {n : ℕ} (hn_fac : is_unit ((n-1).factorial : A)) {m : ℕ} (hmn : m < n) : is_unit (m.factorial : A) := begin apply is_unit_of_dvd_unit _ hn_fac, obtain ⟨c, hc⟩ := nat.factorial_dvd_factorial (nat.le_pred_of_lt hmn), use (c : A), rw [← nat.cast_mul, hc], end lemma factorial.is_unit [algebra ℚ A] (n : ℕ) : is_unit (n.factorial : A) := begin rw [← map_nat_cast (algebra_map ℚ A)], apply is_unit.map, exact is_unit_iff_ne_zero.mpr (nat.cast_ne_zero.mpr (nat.factorial_ne_zero n)), end end factorial section inverse namespace ring lemma inverse_pow_mul_eq_iff_eq_mul {M₀ : Type*} [comm_monoid_with_zero M₀] {a : M₀} (b c : M₀) (ha : is_unit a) {k : ℕ} : (ring.inverse a)^k * b = c ↔ b = a^k * c := by rw [ring.inverse_pow, ring.inverse_mul_eq_iff_eq_mul _ _ _ (is_unit.pow _ ha)] end ring end inverse lemma ideal.mem_pow_eq_zero {A : Type*} [comm_ring A] {I : ideal A} (n m : ℕ) (hnI : I^n = 0) (hmn : n ≤ m) {x : A} (hx : x ∈ I) : x ^ m = 0 := begin have hxn : x^n = 0, { rw [ideal.zero_eq_bot] at hnI, rw [← ideal.mem_bot, ← hnI], exact ideal.pow_mem_pow hx n }, obtain ⟨c, hc⟩ := nat.exists_eq_add_of_le hmn, rw [hc, pow_add, hxn, zero_mul] end
[GOAL] x x✝ : PEmpty ⊢ PEmpty [PROOFSTEP] cases x [GOAL] x y z : PEmpty ⊢ x * y * z = x * (y * z) [PROOFSTEP] cases x
! ! getinf_el.f ! ! ! Created by Xingshi on 1/26/08. ! Copyright 2008 __MyCompanyName__. All rights reserved. ! subroutine getinf_el_3d(finf, x, xna, nn, nsd, ne, nen, ien, maxconn) implicit none integer :: ninf, nn, nsd, ne, nen, maxconn ! fluid variable from main integer ien(nen,ne) ! transfer matrix connectted local information to global integer inf(maxconn) ! subroutine variable to store the index of element which contains the solid node real(8) x(nsd), xna(nsd, nn) ! x - coordinates of solid node xna - coordinates of fluid nodes in global view real(8) xn(nsd,nen) integer nnum real(8) length_max(nsd) ! the minimun rectangular to contian the element real(8) length_min(nsd) real(8) xna_p1(nsd) ! coordinates of two neighbour points in the element real(8) xna_p2(nsd) real(8) xna_p3(nsd) real(8) vector_0(nsd) real(8) vector_1(nsd) real(8) vector_2(nsd) real(8) dot00 real(8) dot01 real(8) dot02 real(8) dot11 real(8) dot12 real(8) invDenom real(8) sign_1 real(8) sign_2 real(8) vector_fe1(nsd) real(8) vector_fe2(nsd) real(8) vector_p(nsd) real(8) sign_fe integer finf ! the final result we want to get integer ie ! loop variables integer inl integer isd integer i ninf = 0 ! write(*,*) 'nen', nen ! write(*,*) '1000 el in get ', xna(:,124) do ie = 1, ne do inl = 1, nen nnum=ien(inl,ie) ! write(*,*) 'nnum= ', nnum ! write(*,*) 'ie= ',ie ! write(*,*) 'inl= ',inl do isd = 1, nsd ! write(*,*) '485 x', xna(1,485) xn(isd, inl) = xna(isd, nnum) ! write(*,*) 'ne=',ie, 'nnum=', xna(2,nnum) end do end do do isd = 1, nsd length_max(isd) = maxval(xn(isd,1:nen)) length_min(isd) = minval(xn(isd,1:nen)) ! write(*,*) 'xna = ', xn(isd,1), xn(isd,2), xn(isd,3), xn(isd,4) end do if (nsd==2) then if (x(1)>length_min(1) .and. x(1)<length_max(1) .and. & x(2)>length_min(2) .and. x(2)<length_max(2)) then ninf = ninf +1 inf(ninf) = ie !write(*,*) 'finf',ie ! write(*,*) 'x-y ', length_min(2), length_max(2) end if end if if (nsd==3) then if (x(1)>length_min(1) .and. x(1)<length_max(1) & .and. x(2)>length_min(2) .and. x(2)<length_max(2) .and. & x(3)>length_min(3) .and. x(3)<length_max(3)) then ninf = ninf +1 inf(ninf) = ie end if end if !write(*,*) 'x min' ,length_min(1) ! write(*,*) 'x max' , length_max(1) ! write(*,*) 'x 4 nodal4', xn(1,1), xn(1,2), xn(1,3), xn(1,4) ! write(*,*) 'ie= ', ie end do ! write(*,*) 'ninf= ', ninf ! write(*,*) 'inf= ' , inf(1) if(ninf == 0) goto 2000 if (nsd==2 .and. nen==3) then do i= 1, ninf xna_p1(1:nsd) = xna(1:nsd, ien(1,inf(i))) xna_p2(1:nsd) = xna(1:nsd, ien(2,inf(i))) xna_p3(1:nsd) = xna(1:nsd, ien(3,inf(i))) vector_0(1:nsd) = xna_p3(1:nsd)-xna_p1(1:nsd) vector_1(1:nsd) = xna_p2(1:nsd)-xna_p1(1:nsd) vector_2(1:nsd) = x(1:nsd)-xna_p1(1:nsd) dot00=vector_0(1)*vector_0(1)+vector_0(2)*vector_0(2) dot01=vector_0(1)*vector_1(1)+vector_0(2)*vector_1(2) dot02=vector_0(1)*vector_2(1)+vector_0(2)*vector_2(2) dot11=vector_1(1)*vector_1(1)+vector_1(2)*vector_1(2) dot12=vector_1(1)*vector_2(1)+vector_1(2)*vector_2(2) invDenom=1/(dot00*dot11-dot01*dot01) sign_1=(dot11*dot02-dot01*dot12)*invDenom sign_2=(dot00*dot12-dot01*dot02)*invDenom if(sign_1>0.0 .and. sign_2>0.0 .and. (sign_1+sign_2)<1.0) then finf = inf(i) goto 2000 end if end do end if if (nsd==2 .and. nen==4) then ! write(*,*) 'I am in the right loop' ! write(*,*) 'get x=' ,x(:) do i= 1, ninf ! write(*,*) 'xna= ',i, xna(1:nsd,ien(1:nen,inf(i))) vector_fe1(1:nsd)=xna(1:nsd,ien(2,inf(i)))-xna(1:nsd,ien(1,inf(i))) vector_fe2(1:nsd)=xna(1:nsd,ien(3,inf(i)))-xna(1:nsd,ien(1,inf(i))) vector_p(1:nsd)=x(1:nsd)-xna(1:nsd,ien(1,inf(i))) sign_1=vector_fe1(1)*vector_fe2(2)-vector_fe1(2)*vector_fe2(1) sign_2=vector_fe1(1)*vector_p(2)-vector_fe1(2)*vector_p(1) sign_fe=sign_2*sign_1 ! write(*,*) '1-2', sign_1, sign_2 if (sign_fe<0) then go to 2100 end if !1-2 vector_fe1(1:nsd)=xna(1:nsd,ien(3,inf(i)))-xna(1:nsd,ien(2,inf(i))) vector_fe2(1:nsd)=xna(1:nsd,ien(4,inf(i)))-xna(1:nsd,ien(2,inf(i))) vector_p(1:nsd)=x(1:nsd)-xna(1:nsd,ien(2,inf(i))) sign_1=vector_fe1(1)*vector_fe2(2)-vector_fe1(2)*vector_fe2(1) sign_2=vector_fe1(1)*vector_p(2)-vector_fe1(2)*vector_p(1) sign_fe=sign_2*sign_1 ! write(*,*) '2-3', sign_1, sign_2 if (sign_fe<0) then go to 2100 end if !2-3 vector_fe1(1:nsd)=xna(1:nsd,ien(4,inf(i)))-xna(1:nsd,ien(3,inf(i))) vector_fe2(1:nsd)=xna(1:nsd,ien(1,inf(i)))-xna(1:nsd,ien(3,inf(i))) vector_p(1:nsd)=x(1:nsd)-xna(1:nsd,ien(3,inf(i))) sign_1=vector_fe1(1)*vector_fe2(2)-vector_fe1(2)*vector_fe2(1) sign_2=vector_fe1(1)*vector_p(2)-vector_fe1(2)*vector_p(1) sign_fe=sign_2*sign_1 ! write(*,*)'3-4',sign_1,sign_2 if (sign_fe<0) then go to 2100 end if !3-4 vector_fe1(1:nsd)=xna(1:nsd,ien(1,inf(i)))-xna(1:nsd,ien(4,inf(i))) vector_fe2(1:nsd)=xna(1:nsd,ien(2,inf(i)))-xna(1:nsd,ien(4,inf(i))) vector_p(1:nsd)=x(1:nsd)-xna(1:nsd,ien(4,inf(i))) sign_1=vector_fe1(1)*vector_fe2(2)-vector_fe1(2)*vector_fe2(1) sign_2=vector_fe1(1)*vector_p(2)-vector_fe1(2)*vector_p(1) sign_fe=sign_2*sign_1 ! write(*,*) '4-1',sign_1,sign_2 if (sign_fe<0) then go to 2100 end if !4-1 finf=inf(i) go to 2000 2100 continue end do end if if (nsd==3) then ! write(*,*) 'i am here' call search_3d(finf, x, xna, nn, nsd, ne, nen, ien, inf, ninf,maxconn) ! call search_3d for 3d !cases end if 2000 continue ! write (*,*) 'Find the elemet in fluid domain as:', finf return end
Formal statement is: lemma isolated_singularity_at_powr[singularity_intros]: assumes "isolated_singularity_at f z" "\<forall>\<^sub>F w in (at z). f w\<noteq>0" shows "isolated_singularity_at (\<lambda>w. (f w) powr (of_int n)) z" Informal statement is: If $f$ has an isolated singularity at $z$ and $f$ is nonzero in a neighborhood of $z$, then $f^n$ has an isolated singularity at $z$.
module Oscar.Level where open import Agda.Primitive public using () renaming (Level to Ł̂; lzero to Ø̂; lsuc to ↑̂_; _⊔_ to _+̂_) open import Agda.Primitive public using () renaming (Level to Ł̂; lzero to lzero; lsuc to lsuc; _⊔_ to _⊔_) 𝑶 : ∀ a → Set (lsuc a) 𝑶 a = Set a open import Agda.Primitive public using () renaming ( Level to Ł ; lzero to ∅̂ ; lsuc to ↑̂_ ; _⊔_ to _∙̂_ ) infix 0 Ø_ Ø_ : ∀ 𝔬 → Set (↑̂ 𝔬) Ø_ 𝔬 = Set 𝔬 Ø₀ = Ø ∅̂
{-# OPTIONS --rewriting #-} data _==_ {A : Set} (a : A) : A → Set where idp : a == a {-# BUILTIN REWRITE _==_ #-} ap : {A B : Set} (f : A → B) {x y : A} → x == y → f x == f y ap f idp = idp postulate Circle : Set base : Circle loop : base == base module _ (A : Set) (base* : A) (loop* : base* == base*) where postulate Circle-rec : Circle → A Circle-base-β : Circle-rec base == base* {-# REWRITE Circle-base-β #-} postulate Circle-loop-β : ap Circle-rec loop == loop* {-# REWRITE Circle-loop-β #-} test : (x : Circle) → ap (Circle-rec (Circle → Circle) (λ y → y) idp x) loop == idp test x = idp {- An internal error has occurred. Please report this as a bug. Location of the error: src/full/Agda/TypeChecking/Rewriting/NonLinMatch.hs:178 -}
(* Title: HOL/Lifting_Set.thy Author: Brian Huffman and Ondrej Kuncar *) section \<open>Setup for Lifting/Transfer for the set type\<close> theory Lifting_Set imports Lifting begin subsection \<open>Relator and predicator properties\<close> lemma rel_setD1: "\<lbrakk> rel_set R A B; x \<in> A \<rbrakk> \<Longrightarrow> \<exists>y \<in> B. R x y" and rel_setD2: "\<lbrakk> rel_set R A B; y \<in> B \<rbrakk> \<Longrightarrow> \<exists>x \<in> A. R x y" by (simp_all add: rel_set_def) lemma rel_set_conversep [simp]: "rel_set A\<inverse>\<inverse> = (rel_set A)\<inverse>\<inverse>" unfolding rel_set_def by auto lemma rel_set_eq [relator_eq]: "rel_set (op =) = (op =)" unfolding rel_set_def fun_eq_iff by auto lemma rel_set_mono[relator_mono]: assumes "A \<le> B" shows "rel_set A \<le> rel_set B" using assms unfolding rel_set_def by blast lemma rel_set_OO[relator_distr]: "rel_set R OO rel_set S = rel_set (R OO S)" apply (rule sym) apply (intro ext) subgoal for X Z apply (rule iffI) apply (rule relcomppI [where b="{y. (\<exists>x\<in>X. R x y) \<and> (\<exists>z\<in>Z. S y z)}"]) apply (simp add: rel_set_def, fast)+ done done lemma Domainp_set[relator_domain]: "Domainp (rel_set T) = (\<lambda>A. Ball A (Domainp T))" unfolding rel_set_def Domainp_iff[abs_def] apply (intro ext) apply (rule iffI) apply blast subgoal for A by (rule exI [where x="{y. \<exists>x\<in>A. T x y}"]) fast done lemma left_total_rel_set[transfer_rule]: "left_total A \<Longrightarrow> left_total (rel_set A)" unfolding left_total_def rel_set_def apply safe subgoal for X by (rule exI [where x="{y. \<exists>x\<in>X. A x y}"]) fast done lemma left_unique_rel_set[transfer_rule]: "left_unique A \<Longrightarrow> left_unique (rel_set A)" unfolding left_unique_def rel_set_def by fast lemma right_total_rel_set [transfer_rule]: "right_total A \<Longrightarrow> right_total (rel_set A)" using left_total_rel_set[of "A\<inverse>\<inverse>"] by simp lemma right_unique_rel_set [transfer_rule]: "right_unique A \<Longrightarrow> right_unique (rel_set A)" unfolding right_unique_def rel_set_def by fast lemma bi_total_rel_set [transfer_rule]: "bi_total A \<Longrightarrow> bi_total (rel_set A)" by(simp add: bi_total_alt_def left_total_rel_set right_total_rel_set) lemma bi_unique_rel_set [transfer_rule]: "bi_unique A \<Longrightarrow> bi_unique (rel_set A)" unfolding bi_unique_def rel_set_def by fast lemma set_relator_eq_onp [relator_eq_onp]: "rel_set (eq_onp P) = eq_onp (\<lambda>A. Ball A P)" unfolding fun_eq_iff rel_set_def eq_onp_def Ball_def by fast lemma bi_unique_rel_set_lemma: assumes "bi_unique R" and "rel_set R X Y" obtains f where "Y = image f X" and "inj_on f X" and "\<forall>x\<in>X. R x (f x)" proof define f where "f x = (THE y. R x y)" for x { fix x assume "x \<in> X" with \<open>rel_set R X Y\<close> \<open>bi_unique R\<close> have "R x (f x)" by (simp add: bi_unique_def rel_set_def f_def) (metis theI) with assms \<open>x \<in> X\<close> have "R x (f x)" "\<forall>x'\<in>X. R x' (f x) \<longrightarrow> x = x'" "\<forall>y\<in>Y. R x y \<longrightarrow> y = f x" "f x \<in> Y" by (fastforce simp add: bi_unique_def rel_set_def)+ } note * = this moreover { fix y assume "y \<in> Y" with \<open>rel_set R X Y\<close> *(3) \<open>y \<in> Y\<close> have "\<exists>x\<in>X. y = f x" by (fastforce simp: rel_set_def) } ultimately show "\<forall>x\<in>X. R x (f x)" "Y = image f X" "inj_on f X" by (auto simp: inj_on_def image_iff) qed subsection \<open>Quotient theorem for the Lifting package\<close> lemma Quotient_set[quot_map]: assumes "Quotient R Abs Rep T" shows "Quotient (rel_set R) (image Abs) (image Rep) (rel_set T)" using assms unfolding Quotient_alt_def4 apply (simp add: rel_set_OO[symmetric]) apply (simp add: rel_set_def) apply fast done subsection \<open>Transfer rules for the Transfer package\<close> subsubsection \<open>Unconditional transfer rules\<close> context includes lifting_syntax begin lemma empty_transfer [transfer_rule]: "(rel_set A) {} {}" unfolding rel_set_def by simp lemma insert_transfer [transfer_rule]: "(A ===> rel_set A ===> rel_set A) insert insert" unfolding rel_fun_def rel_set_def by auto lemma union_transfer [transfer_rule]: "(rel_set A ===> rel_set A ===> rel_set A) union union" unfolding rel_fun_def rel_set_def by auto lemma Union_transfer [transfer_rule]: "(rel_set (rel_set A) ===> rel_set A) Union Union" unfolding rel_fun_def rel_set_def by simp fast lemma image_transfer [transfer_rule]: "((A ===> B) ===> rel_set A ===> rel_set B) image image" unfolding rel_fun_def rel_set_def by simp fast lemma UNION_transfer [transfer_rule]: "(rel_set A ===> (A ===> rel_set B) ===> rel_set B) UNION UNION" by transfer_prover lemma Ball_transfer [transfer_rule]: "(rel_set A ===> (A ===> op =) ===> op =) Ball Ball" unfolding rel_set_def rel_fun_def by fast lemma Bex_transfer [transfer_rule]: "(rel_set A ===> (A ===> op =) ===> op =) Bex Bex" unfolding rel_set_def rel_fun_def by fast lemma Pow_transfer [transfer_rule]: "(rel_set A ===> rel_set (rel_set A)) Pow Pow" apply (rule rel_funI) apply (rule rel_setI) subgoal for X Y X' apply (rule rev_bexI [where x="{y\<in>Y. \<exists>x\<in>X'. A x y}"]) apply clarsimp apply (simp add: rel_set_def) apply fast done subgoal for X Y Y' apply (rule rev_bexI [where x="{x\<in>X. \<exists>y\<in>Y'. A x y}"]) apply clarsimp apply (simp add: rel_set_def) apply fast done done lemma rel_set_transfer [transfer_rule]: "((A ===> B ===> op =) ===> rel_set A ===> rel_set B ===> op =) rel_set rel_set" unfolding rel_fun_def rel_set_def by fast lemma bind_transfer [transfer_rule]: "(rel_set A ===> (A ===> rel_set B) ===> rel_set B) Set.bind Set.bind" unfolding bind_UNION [abs_def] by transfer_prover lemma INF_parametric [transfer_rule]: "(rel_set A ===> (A ===> HOL.eq) ===> HOL.eq) INFIMUM INFIMUM" by transfer_prover lemma SUP_parametric [transfer_rule]: "(rel_set R ===> (R ===> HOL.eq) ===> HOL.eq) SUPREMUM SUPREMUM" by transfer_prover subsubsection \<open>Rules requiring bi-unique, bi-total or right-total relations\<close> lemma member_transfer [transfer_rule]: assumes "bi_unique A" shows "(A ===> rel_set A ===> op =) (op \<in>) (op \<in>)" using assms unfolding rel_fun_def rel_set_def bi_unique_def by fast lemma right_total_Collect_transfer[transfer_rule]: assumes "right_total A" shows "((A ===> op =) ===> rel_set A) (\<lambda>P. Collect (\<lambda>x. P x \<and> Domainp A x)) Collect" using assms unfolding right_total_def rel_set_def rel_fun_def Domainp_iff by fast lemma Collect_transfer [transfer_rule]: assumes "bi_total A" shows "((A ===> op =) ===> rel_set A) Collect Collect" using assms unfolding rel_fun_def rel_set_def bi_total_def by fast lemma inter_transfer [transfer_rule]: assumes "bi_unique A" shows "(rel_set A ===> rel_set A ===> rel_set A) inter inter" using assms unfolding rel_fun_def rel_set_def bi_unique_def by fast lemma Diff_transfer [transfer_rule]: assumes "bi_unique A" shows "(rel_set A ===> rel_set A ===> rel_set A) (op -) (op -)" using assms unfolding rel_fun_def rel_set_def bi_unique_def unfolding Ball_def Bex_def Diff_eq by (safe, simp, metis, simp, metis) lemma subset_transfer [transfer_rule]: assumes [transfer_rule]: "bi_unique A" shows "(rel_set A ===> rel_set A ===> op =) (op \<subseteq>) (op \<subseteq>)" unfolding subset_eq [abs_def] by transfer_prover declare right_total_UNIV_transfer[transfer_rule] lemma UNIV_transfer [transfer_rule]: assumes "bi_total A" shows "(rel_set A) UNIV UNIV" using assms unfolding rel_set_def bi_total_def by simp lemma right_total_Compl_transfer [transfer_rule]: assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "right_total A" shows "(rel_set A ===> rel_set A) (\<lambda>S. uminus S \<inter> Collect (Domainp A)) uminus" unfolding Compl_eq [abs_def] by (subst Collect_conj_eq[symmetric]) transfer_prover lemma Compl_transfer [transfer_rule]: assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "bi_total A" shows "(rel_set A ===> rel_set A) uminus uminus" unfolding Compl_eq [abs_def] by transfer_prover lemma right_total_Inter_transfer [transfer_rule]: assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "right_total A" shows "(rel_set (rel_set A) ===> rel_set A) (\<lambda>S. \<Inter>S \<inter> Collect (Domainp A)) Inter" unfolding Inter_eq[abs_def] by (subst Collect_conj_eq[symmetric]) transfer_prover lemma Inter_transfer [transfer_rule]: assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "bi_total A" shows "(rel_set (rel_set A) ===> rel_set A) Inter Inter" unfolding Inter_eq [abs_def] by transfer_prover lemma filter_transfer [transfer_rule]: assumes [transfer_rule]: "bi_unique A" shows "((A ===> op=) ===> rel_set A ===> rel_set A) Set.filter Set.filter" unfolding Set.filter_def[abs_def] rel_fun_def rel_set_def by blast lemma finite_transfer [transfer_rule]: "bi_unique A \<Longrightarrow> (rel_set A ===> op =) finite finite" by (rule rel_funI, erule (1) bi_unique_rel_set_lemma) (auto dest: finite_imageD) lemma card_transfer [transfer_rule]: "bi_unique A \<Longrightarrow> (rel_set A ===> op =) card card" by (rule rel_funI, erule (1) bi_unique_rel_set_lemma) (simp add: card_image) lemma vimage_parametric [transfer_rule]: assumes [transfer_rule]: "bi_total A" "bi_unique B" shows "((A ===> B) ===> rel_set B ===> rel_set A) vimage vimage" unfolding vimage_def[abs_def] by transfer_prover lemma Image_parametric [transfer_rule]: assumes "bi_unique A" shows "(rel_set (rel_prod A B) ===> rel_set A ===> rel_set B) op `` op ``" by (intro rel_funI rel_setI) (force dest: rel_setD1 bi_uniqueDr[OF assms], force dest: rel_setD2 bi_uniqueDl[OF assms]) end lemma (in comm_monoid_set) F_parametric [transfer_rule]: fixes A :: "'b \<Rightarrow> 'c \<Rightarrow> bool" assumes "bi_unique A" shows "rel_fun (rel_fun A (op =)) (rel_fun (rel_set A) (op =)) F F" proof (rule rel_funI)+ fix f :: "'b \<Rightarrow> 'a" and g S T assume "rel_fun A (op =) f g" "rel_set A S T" with \<open>bi_unique A\<close> obtain i where "bij_betw i S T" "\<And>x. x \<in> S \<Longrightarrow> f x = g (i x)" by (auto elim: bi_unique_rel_set_lemma simp: rel_fun_def bij_betw_def) then show "F f S = F g T" by (simp add: reindex_bij_betw) qed lemmas sum_parametric = sum.F_parametric lemmas prod_parametric = prod.F_parametric lemma rel_set_UNION: assumes [transfer_rule]: "rel_set Q A B" "rel_fun Q (rel_set R) f g" shows "rel_set R (UNION A f) (UNION B g)" by transfer_prover end
(* * Copyright 2014, NICTA * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. * * @TAG(NICTA_BSD) *) theory jiraver345 imports "CParser.CTranslation" begin external_file "jiraver345.c" install_C_file "jiraver345.c" context jiraver345 begin thm good_body_def thm bad_body_def lemma "\<Gamma> \<turnstile> \<lbrace> \<acute>p = Ptr 0 \<rbrace> \<acute>ret__int :== CALL good(\<acute>p) \<lbrace> \<acute>ret__int = 0 \<rbrace>" apply vcg apply simp done lemma "\<Gamma> \<turnstile> \<lbrace> True \<rbrace> \<acute>ret__int :== CALL bad(Ptr 0) \<lbrace> \<acute>ret__int = 0 \<rbrace>" apply vcg apply simp done end end
A : Set A = ? B : Set B = ?
The song garnered mainly positive reviews from critics . Craig Lytle of Allmusic noted that Houston 's voice " sailed " through the song . Christopher John Farley of TIME commented Houston " particularly held her own " , with a " masterly balance of pop , zip , and soulful melancholy " . Steve Knopper of Newsday wrote : " It 's lower @-@ key and the singer , who also stars in the film , doesn 't feel compelled to perform constant vocal feats . " A writer for Boston Herald noted that the song was " understated " . Similarly , Larry Flick of Billboard commented that the song should have been released as the follow @-@ up to " Exhale ( Shoop Shoop ) " . " Paired with Babyface , Houston is positively luminous on [ this ] heartbreak ballad , performing with a perfect blend of theatrical melodrama and guttural soul , " he added . Deborah Wilker of South Florida Sun @-@ Sentinel was mixed in her review commenting that the song was a " predictably histrionic follow @-@ up " to " Exhale ( Shoop Shoop ) " . But , Nick Krewen of The Spectator was even less enthusiastic , writing " [ ... ] the two guaranteed [ Whitney Houston ] hits – ' Exhale ( Shoop Shoop ) ' and ' Why Does It Hurt So Bad ' – don 't really offer anything new . " Similarly , Cary Darling of Rome News @-@ Tribune gave a negative review . She noted that " [ the ] ballad ' Why Does It Hurt So Bad ' is [ more ] standard Whitney @-@ fare " .
/- Copyright (c) 2022 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang ! This file was ported from Lean 3 source module algebraic_geometry.morphisms.basic ! leanprover-community/mathlib commit 434e2fd21c1900747afc6d13d8be7f4eedba7218 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.AlgebraicGeometry.AffineScheme import Mathbin.AlgebraicGeometry.Pullbacks import Mathbin.CategoryTheory.MorphismProperty /-! # Properties of morphisms between Schemes We provide the basic framework for talking about properties of morphisms between Schemes. A `morphism_property Scheme` is a predicate on morphisms between schemes, and an `affine_target_morphism_property` is a predicate on morphisms into affine schemes. Given a `P : affine_target_morphism_property`, we may construct a `morphism_property` called `target_affine_locally P` that holds for `f : X ⟶ Y` whenever `P` holds for the restriction of `f` on every affine open subset of `Y`. ## Main definitions - `algebraic_geometry.affine_target_morphism_property.is_local`: We say that `P.is_local` if `P` satisfies the assumptions of the affine communication lemma (`algebraic_geometry.of_affine_open_cover`). That is, 1. `P` respects isomorphisms. 2. If `P` holds for `f : X ⟶ Y`, then `P` holds for `f ∣_ Y.basic_open r` for any global section `r`. 3. If `P` holds for `f ∣_ Y.basic_open r` for all `r` in a spanning set of the global sections, then `P` holds for `f`. - `algebraic_geometry.property_is_local_at_target`: We say that `property_is_local_at_target P` for `P : morphism_property Scheme` if 1. `P` respects isomorphisms. 2. If `P` holds for `f : X ⟶ Y`, then `P` holds for `f ∣_ U` for any `U`. 3. If `P` holds for `f ∣_ U` for an open cover `U` of `Y`, then `P` holds for `f`. ## Main results - `algebraic_geometry.affine_target_morphism_property.is_local.affine_open_cover_tfae`: If `P.is_local`, then `target_affine_locally P f` iff there exists an affine cover `{ Uᵢ }` of `Y` such that `P` holds for `f ∣_ Uᵢ`. - `algebraic_geometry.affine_target_morphism_property.is_local_of_open_cover_imply`: If the existance of an affine cover `{ Uᵢ }` of `Y` such that `P` holds for `f ∣_ Uᵢ` implies `target_affine_locally P f`, then `P.is_local`. - `algebraic_geometry.affine_target_morphism_property.is_local.affine_target_iff`: If `Y` is affine and `f : X ⟶ Y`, then `target_affine_locally P f ↔ P f` provided `P.is_local`. - `algebraic_geometry.affine_target_morphism_property.is_local.target_affine_locally_is_local` : If `P.is_local`, then `property_is_local_at_target (target_affine_locally P)`. - `algebraic_geometry.property_is_local_at_target.open_cover_tfae`: If `property_is_local_at_target P`, then `P f` iff there exists an open cover `{ Uᵢ }` of `Y` such that `P` holds for `f ∣_ Uᵢ`. These results should not be used directly, and should be ported to each property that is local. -/ universe u open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite noncomputable section namespace AlgebraicGeometry /-- An `affine_target_morphism_property` is a class of morphisms from an arbitrary scheme into an affine scheme. -/ def AffineTargetMorphismProperty := ∀ ⦃X Y : Scheme⦄ (f : X ⟶ Y) [IsAffine Y], Prop #align algebraic_geometry.affine_target_morphism_property AlgebraicGeometry.AffineTargetMorphismProperty /-- `is_iso` as a `morphism_property`. -/ protected def Scheme.isIso : MorphismProperty Scheme := @IsIso Scheme _ #align algebraic_geometry.Scheme.is_iso AlgebraicGeometry.Scheme.isIso /-- `is_iso` as an `affine_morphism_property`. -/ protected def Scheme.affineTargetIsIso : AffineTargetMorphismProperty := fun X Y f H => IsIso f #align algebraic_geometry.Scheme.affine_target_is_iso AlgebraicGeometry.Scheme.affineTargetIsIso instance : Inhabited AffineTargetMorphismProperty := ⟨Scheme.affineTargetIsIso⟩ /-- A `affine_target_morphism_property` can be extended to a `morphism_property` such that it *never* holds when the target is not affine -/ def AffineTargetMorphismProperty.toProperty (P : AffineTargetMorphismProperty) : MorphismProperty Scheme := fun X Y f => ∃ h, @P f h #align algebraic_geometry.affine_target_morphism_property.to_property AlgebraicGeometry.AffineTargetMorphismProperty.toProperty theorem AffineTargetMorphismProperty.toProperty_apply (P : AffineTargetMorphismProperty) {X Y : Scheme} (f : X ⟶ Y) [IsAffine Y] : P.toProperty f ↔ P f := by delta affine_target_morphism_property.to_property simp [*] #align algebraic_geometry.affine_target_morphism_property.to_property_apply AlgebraicGeometry.AffineTargetMorphismProperty.toProperty_apply theorem affine_cancel_left_isIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso) {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso f] [IsAffine Z] : P (f ≫ g) ↔ P g := by rw [← P.to_property_apply, ← P.to_property_apply, hP.cancel_left_is_iso] #align algebraic_geometry.affine_cancel_left_is_iso AlgebraicGeometry.affine_cancel_left_isIso theorem affine_cancel_right_isIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso) {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso g] [IsAffine Z] [IsAffine Y] : P (f ≫ g) ↔ P f := by rw [← P.to_property_apply, ← P.to_property_apply, hP.cancel_right_is_iso] #align algebraic_geometry.affine_cancel_right_is_iso AlgebraicGeometry.affine_cancel_right_isIso theorem AffineTargetMorphismProperty.respectsIso_mk {P : AffineTargetMorphismProperty} (h₁ : ∀ {X Y Z} (e : X ≅ Y) (f : Y ⟶ Z) [IsAffine Z], P f → P (e.hom ≫ f)) (h₂ : ∀ {X Y Z} (e : Y ≅ Z) (f : X ⟶ Y) [h : IsAffine Y], P f → @P (f ≫ e.hom) (is_affine_of_iso e.inv)) : P.toProperty.RespectsIso := by constructor · rintro X Y Z e f ⟨a, h⟩ exact ⟨a, h₁ e f h⟩ · rintro X Y Z e f ⟨a, h⟩ exact ⟨is_affine_of_iso e.inv, h₂ e f h⟩ #align algebraic_geometry.affine_target_morphism_property.respects_iso_mk AlgebraicGeometry.AffineTargetMorphismProperty.respectsIso_mk /-- For a `P : affine_target_morphism_property`, `target_affine_locally P` holds for `f : X ⟶ Y` whenever `P` holds for the restriction of `f` on every affine open subset of `Y`. -/ def targetAffineLocally (P : AffineTargetMorphismProperty) : MorphismProperty Scheme := fun {X Y : Scheme} (f : X ⟶ Y) => ∀ U : Y.affineOpens, @P (f ∣_ U) U.Prop #align algebraic_geometry.target_affine_locally AlgebraicGeometry.targetAffineLocally theorem IsAffineOpen.map_isIso {X Y : Scheme} {U : Opens Y.carrier} (hU : IsAffineOpen U) (f : X ⟶ Y) [IsIso f] : IsAffineOpen ((Opens.map f.1.base).obj U) := haveI : is_affine _ := hU is_affine_of_iso (f ∣_ U) #align algebraic_geometry.is_affine_open.map_is_iso AlgebraicGeometry.IsAffineOpen.map_isIso theorem targetAffineLocally_respectsIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso) : (targetAffineLocally P).RespectsIso := by constructor · introv H U rw [morphism_restrict_comp, affine_cancel_left_is_iso hP] exact H U · introv H rintro ⟨U, hU : is_affine_open U⟩ dsimp haveI : is_affine _ := hU haveI : is_affine _ := hU.map_is_iso e.hom rw [morphism_restrict_comp, affine_cancel_right_is_iso hP] exact H ⟨(opens.map e.hom.val.base).obj U, hU.map_is_iso e.hom⟩ #align algebraic_geometry.target_affine_locally_respects_iso AlgebraicGeometry.targetAffineLocally_respectsIso /-- We say that `P : affine_target_morphism_property` is a local property if 1. `P` respects isomorphisms. 2. If `P` holds for `f : X ⟶ Y`, then `P` holds for `f ∣_ Y.basic_open r` for any global section `r`. 3. If `P` holds for `f ∣_ Y.basic_open r` for all `r` in a spanning set of the global sections, then `P` holds for `f`. -/ structure AffineTargetMorphismProperty.IsLocal (P : AffineTargetMorphismProperty) : Prop where RespectsIso : P.toProperty.RespectsIso toBasicOpen : ∀ {X Y : Scheme} [IsAffine Y] (f : X ⟶ Y) (r : Y.Presheaf.obj <| op ⊤), P f → @P (f ∣_ Y.basic_open r) ((top_is_affine_open Y).basicOpen_is_affine _) ofBasicOpenCover : ∀ {X Y : Scheme} [IsAffine Y] (f : X ⟶ Y) (s : Finset (Y.Presheaf.obj <| op ⊤)) (hs : Ideal.span (s : Set (Y.Presheaf.obj <| op ⊤)) = ⊤), (∀ r : s, @P (f ∣_ Y.basic_open r.1) ((top_is_affine_open Y).basicOpen_is_affine _)) → P f #align algebraic_geometry.affine_target_morphism_property.is_local AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal theorem targetAffineLocallyOfOpenCover {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme} (f : X ⟶ Y) (𝒰 : Y.OpenCover) [∀ i, IsAffine (𝒰.obj i)] (h𝒰 : ∀ i, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) : targetAffineLocally P f := by classical let S i := (⟨⟨Set.range (𝒰.map i).1.base, (𝒰.is_open i).base_open.open_range⟩, range_is_affine_open_of_open_immersion (𝒰.map i)⟩ : Y.affine_opens) intro U apply of_affine_open_cover U (Set.range S) · intro U r h haveI : is_affine _ := U.2 have := hP.2 (f ∣_ U.1) replace this := this (Y.presheaf.map (eq_to_hom U.1.openEmbedding_obj_top).op r) h rw [← P.to_property_apply] at this⊢ exact (hP.1.arrow_mk_iso_iff (morphism_restrict_restrict_basic_open f _ r)).mp this · intro U s hs H haveI : is_affine _ := U.2 apply hP.3 (f ∣_ U.1) (s.image (Y.presheaf.map (eq_to_hom U.1.openEmbedding_obj_top).op)) · apply_fun Ideal.comap (Y.presheaf.map (eq_to_hom U.1.openEmbedding_obj_top.symm).op) at hs rw [Ideal.comap_top] at hs rw [← hs] simp only [eq_to_hom_op, eq_to_hom_map, Finset.coe_image] have : ∀ {R S : CommRingCat} (e : S = R) (s : Set S), Ideal.span (eq_to_hom e '' s) = Ideal.comap (eq_to_hom e.symm) (Ideal.span s) := by intros subst e simpa apply this · rintro ⟨r, hr⟩ obtain ⟨r, hr', rfl⟩ := finset.mem_image.mp hr simp_rw [← P.to_property_apply] at H⊢ exact (hP.1.arrow_mk_iso_iff (morphism_restrict_restrict_basic_open f _ r)).mpr (H ⟨r, hr'⟩) · rw [Set.eq_univ_iff_forall] simp only [Set.mem_unionᵢ] intro x exact ⟨⟨_, ⟨𝒰.f x, rfl⟩⟩, 𝒰.covers x⟩ · rintro ⟨_, i, rfl⟩ simp_rw [← P.to_property_apply] at h𝒰⊢ exact (hP.1.arrow_mk_iso_iff (morphism_restrict_opens_range f _)).mpr (h𝒰 i) #align algebraic_geometry.target_affine_locally_of_open_cover AlgebraicGeometry.targetAffineLocallyOfOpenCover theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_tFAE {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) : TFAE [targetAffineLocally P f, ∃ (𝒰 : Scheme.OpenCover.{u} Y)(_ : ∀ i, IsAffine (𝒰.obj i)), ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullback_cover f).obj i ⟶ 𝒰.obj i), ∀ (𝒰 : Scheme.OpenCover.{u} Y) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J), P (pullback.snd : (𝒰.pullback_cover f).obj i ⟶ 𝒰.obj i), ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g], P (pullback.snd : pullback f g ⟶ U), ∃ (ι : Type u)(U : ι → Opens Y.carrier)(hU : supᵢ U = ⊤)(hU' : ∀ i, IsAffineOpen (U i)), ∀ i, @P (f ∣_ U i) (hU' i)] := by tfae_have 1 → 4 · intro H U g h₁ h₂ skip replace H := H ⟨⟨_, h₂.base_open.open_range⟩, range_is_affine_open_of_open_immersion g⟩ rw [← P.to_property_apply] at H⊢ rwa [← hP.1.arrow_mk_iso_iff (morphism_restrict_opens_range f _)] tfae_have 4 → 3 · intro H 𝒰 h𝒰 i skip apply H tfae_have 3 → 2 · exact fun H => ⟨Y.affine_cover, inferInstance, H Y.affine_cover⟩ tfae_have 2 → 1 · rintro ⟨𝒰, h𝒰, H⟩ exact target_affine_locally_of_open_cover hP f 𝒰 H tfae_have 5 → 2 · rintro ⟨ι, U, hU, hU', H⟩ refine' ⟨Y.open_cover_of_supr_eq_top U hU, hU', _⟩ intro i specialize H i rw [← P.to_property_apply, ← hP.1.arrow_mk_iso_iff (morphism_restrict_opens_range f _)] rw [← P.to_property_apply] at H convert H all_goals ext1; exact Subtype.range_coe tfae_have 1 → 5 · intro H refine' ⟨Y.carrier, fun x => (Y.affine_cover.map x).opensRange, _, fun i => range_is_affine_open_of_open_immersion _, _⟩ · rw [eq_top_iff] intro x _ erw [opens.mem_supr] exact ⟨x, Y.affine_cover.covers x⟩ · intro i exact H ⟨_, range_is_affine_open_of_open_immersion _⟩ tfae_finish #align algebraic_geometry.affine_target_morphism_property.is_local.affine_open_cover_tfae AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.affine_openCover_tFAE theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty) (hP : P.toProperty.RespectsIso) (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y), (∃ (𝒰 : Scheme.OpenCover.{u} Y)(_ : ∀ i, IsAffine (𝒰.obj i)), ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullback_cover f).obj i ⟶ 𝒰.obj i)) → ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g], P (pullback.snd : pullback f g ⟶ U)) : P.IsLocal := by refine' ⟨hP, _, _⟩ · introv h skip haveI : is_affine _ := (top_is_affine_open Y).basicOpen_is_affine r delta morphism_restrict rw [affine_cancel_left_is_iso hP] refine' @H f ⟨Scheme.open_cover_of_is_iso (𝟙 Y), _, _⟩ (Y.of_restrict _) _inst _ · intro i dsimp infer_instance · intro i dsimp rwa [← category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_is_iso hP] · introv hs hs' skip replace hs := ((top_is_affine_open Y).basicOpen_union_eq_self_iff _).mpr hs have := H f ⟨Y.open_cover_of_supr_eq_top _ hs, _, _⟩ (𝟙 _) rwa [← category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_is_iso hP] at this · intro i exact (top_is_affine_open Y).basicOpen_is_affine _ · rintro (i : s) specialize hs' i haveI : is_affine _ := (top_is_affine_open Y).basicOpen_is_affine i.1 delta morphism_restrict at hs' rwa [affine_cancel_left_is_iso hP] at hs' #align algebraic_geometry.affine_target_morphism_property.is_local_of_open_cover_imply AlgebraicGeometry.AffineTargetMorphismProperty.isLocalOfOpenCoverImply theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_iff {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} Y) [h𝒰 : ∀ i, IsAffine (𝒰.obj i)] : targetAffineLocally P f ↔ ∀ i, @P (pullback.snd : pullback f (𝒰.map i) ⟶ _) (h𝒰 i) := ⟨fun H => let h := ((hP.affine_openCover_tFAE f).out 0 2).mp H h 𝒰, fun H => let h := ((hP.affine_openCover_tFAE f).out 1 0).mp h ⟨𝒰, inferInstance, H⟩⟩ #align algebraic_geometry.affine_target_morphism_property.is_local.affine_open_cover_iff AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.affine_openCover_iff theorem AffineTargetMorphismProperty.IsLocal.affine_target_iff {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) [IsAffine Y] : targetAffineLocally P f ↔ P f := by rw [hP.affine_open_cover_iff f _] swap; · exact Scheme.open_cover_of_is_iso (𝟙 Y) swap; · intro dsimp infer_instance trans P (pullback.snd : pullback f (𝟙 _) ⟶ _) · exact ⟨fun H => H PUnit.unit, fun H _ => H⟩ rw [← category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_is_iso hP.1] #align algebraic_geometry.affine_target_morphism_property.is_local.affine_target_iff AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.affine_target_iff /-- We say that `P : morphism_property Scheme` is local at the target if 1. `P` respects isomorphisms. 2. If `P` holds for `f : X ⟶ Y`, then `P` holds for `f ∣_ U` for any `U`. 3. If `P` holds for `f ∣_ U` for an open cover `U` of `Y`, then `P` holds for `f`. -/ structure PropertyIsLocalAtTarget (P : MorphismProperty Scheme) : Prop where RespectsIso : P.RespectsIso restrict : ∀ {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier), P f → P (f ∣_ U) of_open_cover : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} Y), (∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) → P f #align algebraic_geometry.property_is_local_at_target AlgebraicGeometry.PropertyIsLocalAtTarget theorem AffineTargetMorphismProperty.IsLocal.targetAffineLocallyIsLocal {P : AffineTargetMorphismProperty} (hP : P.IsLocal) : PropertyIsLocalAtTarget (targetAffineLocally P) := by constructor · exact target_affine_locally_respects_iso hP.1 · intro X Y f U H V rw [← P.to_property_apply, hP.1.arrow_mk_iso_iff (morphism_restrict_restrict f _ _)] convert H ⟨_, is_affine_open.image_is_open_immersion V.2 (Y.of_restrict _)⟩ rw [← P.to_property_apply] rfl · rintro X Y f 𝒰 h𝒰 rw [(hP.affine_open_cover_tfae f).out 0 1] refine' ⟨𝒰.bind fun _ => Scheme.affine_cover _, _, _⟩ · intro i dsimp [Scheme.open_cover.bind] infer_instance · intro i specialize h𝒰 i.1 rw [(hP.affine_open_cover_tfae (pullback.snd : pullback f (𝒰.map i.fst) ⟶ _)).out 0 2] at h𝒰 specialize h𝒰 (Scheme.affine_cover _) i.2 let e : pullback f ((𝒰.obj i.fst).affineCover.map i.snd ≫ 𝒰.map i.fst) ⟶ pullback (pullback.snd : pullback f (𝒰.map i.fst) ⟶ _) ((𝒰.obj i.fst).affineCover.map i.snd) := by refine' (pullback_symmetry _ _).Hom ≫ _ refine' (pullback_right_pullback_fst_iso _ _ _).inv ≫ _ refine' (pullback_symmetry _ _).Hom ≫ _ refine' pullback.map _ _ _ _ (pullback_symmetry _ _).Hom (𝟙 _) (𝟙 _) _ _ <;> simp only [category.comp_id, category.id_comp, pullback_symmetry_hom_comp_snd] rw [← affine_cancel_left_is_iso hP.1 e] at h𝒰 convert h𝒰 simp #align algebraic_geometry.affine_target_morphism_property.is_local.target_affine_locally_is_local AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.targetAffineLocallyIsLocal theorem PropertyIsLocalAtTarget.openCover_tFAE {P : MorphismProperty Scheme} (hP : PropertyIsLocalAtTarget P) {X Y : Scheme.{u}} (f : X ⟶ Y) : TFAE [P f, ∃ 𝒰 : Scheme.OpenCover.{u} Y, ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i), ∀ (𝒰 : Scheme.OpenCover.{u} Y) (i : 𝒰.J), P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i), ∀ U : Opens Y.carrier, P (f ∣_ U), ∀ {U : Scheme} (g : U ⟶ Y) [IsOpenImmersion g], P (pullback.snd : pullback f g ⟶ U), ∃ (ι : Type u)(U : ι → Opens Y.carrier)(hU : supᵢ U = ⊤), ∀ i, P (f ∣_ U i)] := by tfae_have 2 → 1 · rintro ⟨𝒰, H⟩ exact hP.3 f 𝒰 H tfae_have 1 → 4 · intro H U exact hP.2 f U H tfae_have 4 → 3 · intro H 𝒰 i rw [← hP.1.arrow_mk_iso_iff (morphism_restrict_opens_range f _)] exact H (𝒰.map i).opensRange tfae_have 3 → 2 · exact fun H => ⟨Y.affine_cover, H Y.affine_cover⟩ tfae_have 4 → 5 · intro H U g hg skip rw [← hP.1.arrow_mk_iso_iff (morphism_restrict_opens_range f _)] apply H tfae_have 5 → 4 · intro H U erw [hP.1.cancel_left_isIso] apply H tfae_have 4 → 6 · intro H exact ⟨PUnit, fun _ => ⊤, csupᵢ_const, fun _ => H _⟩ tfae_have 6 → 2 · rintro ⟨ι, U, hU, H⟩ refine' ⟨Y.open_cover_of_supr_eq_top U hU, _⟩ intro i rw [← hP.1.arrow_mk_iso_iff (morphism_restrict_opens_range f _)] convert H i all_goals ext1; exact Subtype.range_coe tfae_finish #align algebraic_geometry.property_is_local_at_target.open_cover_tfae AlgebraicGeometry.PropertyIsLocalAtTarget.openCover_tFAE theorem PropertyIsLocalAtTarget.openCover_iff {P : MorphismProperty Scheme} (hP : PropertyIsLocalAtTarget P) {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} Y) : P f ↔ ∀ i, P (pullback.snd : pullback f (𝒰.map i) ⟶ _) := ⟨fun H => let h := ((hP.openCover_tFAE f).out 0 2).mp H h 𝒰, fun H => let h := ((hP.openCover_tFAE f).out 1 0).mp h ⟨𝒰, H⟩⟩ #align algebraic_geometry.property_is_local_at_target.open_cover_iff AlgebraicGeometry.PropertyIsLocalAtTarget.openCover_iff namespace AffineTargetMorphismProperty /-- A `P : affine_target_morphism_property` is stable under base change if `P` holds for `Y ⟶ S` implies that `P` holds for `X ×ₛ Y ⟶ X` with `X` and `S` affine schemes. -/ def StableUnderBaseChange (P : AffineTargetMorphismProperty) : Prop := ∀ ⦃X Y S : Scheme⦄ [IsAffine S] [IsAffine X] (f : X ⟶ S) (g : Y ⟶ S), P g → P (pullback.fst : pullback f g ⟶ X) #align algebraic_geometry.affine_target_morphism_property.stable_under_base_change AlgebraicGeometry.AffineTargetMorphismProperty.StableUnderBaseChange theorem IsLocal.targetAffineLocallyPullbackFstOfRightOfStableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal) (hP' : P.StableUnderBaseChange) {X Y S : Scheme} (f : X ⟶ S) (g : Y ⟶ S) [IsAffine S] (H : P g) : targetAffineLocally P (pullback.fst : pullback f g ⟶ X) := by rw [(hP.affine_open_cover_tfae (pullback.fst : pullback f g ⟶ X)).out 0 1] use X.affine_cover, inferInstance intro i let e := pullback_symmetry _ _ ≪≫ pullback_right_pullback_fst_iso f g (X.affine_cover.map i) have : e.hom ≫ pullback.fst = pullback.snd := by simp rw [← this, affine_cancel_left_is_iso hP.1] apply hP' <;> assumption #align algebraic_geometry.affine_target_morphism_property.is_local.target_affine_locally_pullback_fst_of_right_of_stable_under_base_change AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.targetAffineLocallyPullbackFstOfRightOfStableUnderBaseChange theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal) (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange := MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso) (by intro X Y S f g H rw [(hP.target_affine_locally_is_local.open_cover_tfae (pullback.fst : pullback f g ⟶ X)).out 0 1] use S.affine_cover.pullback_cover f intro i rw [(hP.affine_open_cover_tfae g).out 0 3] at H let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affine_cover.pullback_cover f).map i) ≅ _ := by refine' pullback_symmetry _ _ ≪≫ pullback_right_pullback_fst_iso f g _ ≪≫ _ ≪≫ (pullback_right_pullback_fst_iso (S.affine_cover.map i) g (pullback.snd : pullback f (S.affine_cover.map i) ⟶ _)).symm exact as_iso (pullback.map _ _ _ _ (𝟙 _) (𝟙 _) (𝟙 _) (by simpa using pullback.condition) (by simp)) have : e.hom ≫ pullback.fst = pullback.snd := by simp rw [← this, (target_affine_locally_respects_iso hP.1).cancel_left_isIso] apply hP.target_affine_locally_pullback_fst_of_right_of_stable_under_base_change hP' rw [← pullback_symmetry_hom_comp_snd, affine_cancel_left_is_iso hP.1] apply H) #align algebraic_geometry.affine_target_morphism_property.is_local.stable_under_base_change AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.stableUnderBaseChange end AffineTargetMorphismProperty /-- The `affine_target_morphism_property` associated to `(target_affine_locally P).diagonal`. See `diagonal_target_affine_locally_eq_target_affine_locally`. -/ def AffineTargetMorphismProperty.diagonal (P : AffineTargetMorphismProperty) : AffineTargetMorphismProperty := fun X Y f hf => ∀ {U₁ U₂ : Scheme} (f₁ : U₁ ⟶ X) (f₂ : U₂ ⟶ X) [IsAffine U₁] [IsAffine U₂] [IsOpenImmersion f₁] [IsOpenImmersion f₂], P (pullback.map_desc f₁ f₂ f) #align algebraic_geometry.affine_target_morphism_property.diagonal AlgebraicGeometry.AffineTargetMorphismProperty.diagonal theorem AffineTargetMorphismProperty.diagonal_respectsIso (P : AffineTargetMorphismProperty) (hP : P.toProperty.RespectsIso) : P.diagonal.toProperty.RespectsIso := by delta affine_target_morphism_property.diagonal apply affine_target_morphism_property.respects_iso_mk · introv H _ _ skip rw [pullback.map_desc_comp, affine_cancel_left_is_iso hP, affine_cancel_right_is_iso hP] apply H · introv H _ _ skip rw [pullback.map_desc_comp, affine_cancel_right_is_iso hP] apply H #align algebraic_geometry.affine_target_morphism_property.diagonal_respects_iso AlgebraicGeometry.AffineTargetMorphismProperty.diagonal_respectsIso theorem diagonalTargetAffineLocallyOfOpenCover (P : AffineTargetMorphismProperty) (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} Y) [∀ i, IsAffine (𝒰.obj i)] (𝒰' : ∀ i, Scheme.OpenCover.{u} (pullback f (𝒰.map i))) [∀ i j, IsAffine ((𝒰' i).obj j)] (h𝒰' : ∀ i j k, P (pullback.mapDesc ((𝒰' i).map j) ((𝒰' i).map k) pullback.snd)) : (targetAffineLocally P).diagonal f := by refine' (hP.affine_open_cover_iff _ _).mpr _ · exact (Scheme.pullback.open_cover_of_base 𝒰 f f).bind fun i => Scheme.Pullback.openCoverOfLeftRight.{u, u} (𝒰' i) (𝒰' i) pullback.snd pullback.snd · intro i dsimp at * infer_instance · rintro ⟨i, j, k⟩ dsimp convert(affine_cancel_left_is_iso hP.1 (pullback_diagonal_map_iso _ _ ((𝒰' i).map j) ((𝒰' i).map k)).inv pullback.snd).mp _ pick_goal 3 · convert h𝒰' i j k apply pullback.hom_ext <;> simp all_goals apply pullback.hom_ext <;> simp only [category.assoc, pullback.lift_fst, pullback.lift_snd, pullback.lift_fst_assoc, pullback.lift_snd_assoc] #align algebraic_geometry.diagonal_target_affine_locally_of_open_cover AlgebraicGeometry.diagonalTargetAffineLocallyOfOpenCover theorem AffineTargetMorphismProperty.diagonalOfTargetAffineLocally (P : AffineTargetMorphismProperty) (hP : P.IsLocal) {X Y U : Scheme.{u}} (f : X ⟶ Y) (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g] (H : (targetAffineLocally P).diagonal f) : P.diagonal (pullback.snd : pullback f g ⟶ _) := by rintro U V f₁ f₂ _ _ _ _ skip replace H := ((hP.affine_open_cover_tfae (pullback.diagonal f)).out 0 3).mp H let g₁ := pullback.map (f₁ ≫ pullback.snd) (f₂ ≫ pullback.snd) f f (f₁ ≫ pullback.fst) (f₂ ≫ pullback.fst) g (by rw [category.assoc, category.assoc, pullback.condition]) (by rw [category.assoc, category.assoc, pullback.condition]) let g₂ : pullback f₁ f₂ ⟶ pullback f g := pullback.fst ≫ f₁ specialize H g₁ rw [← affine_cancel_left_is_iso hP.1 (pullback_diagonal_map_iso f _ f₁ f₂).Hom] convert H · apply pullback.hom_ext <;> simp only [category.assoc, pullback.lift_fst, pullback.lift_snd, pullback.lift_fst_assoc, pullback.lift_snd_assoc, category.comp_id, pullback_diagonal_map_iso_hom_fst, pullback_diagonal_map_iso_hom_snd] #align algebraic_geometry.affine_target_morphism_property.diagonal_of_target_affine_locally AlgebraicGeometry.AffineTargetMorphismProperty.diagonalOfTargetAffineLocally theorem AffineTargetMorphismProperty.IsLocal.diagonal_affine_openCover_tFAE {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) : TFAE [(targetAffineLocally P).diagonal f, ∃ (𝒰 : Scheme.OpenCover.{u} Y)(_ : ∀ i, IsAffine (𝒰.obj i)), ∀ i : 𝒰.J, P.diagonal (pullback.snd : pullback f (𝒰.map i) ⟶ _), ∀ (𝒰 : Scheme.OpenCover.{u} Y) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J), P.diagonal (pullback.snd : pullback f (𝒰.map i) ⟶ _), ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g], P.diagonal (pullback.snd : pullback f g ⟶ _), ∃ (𝒰 : Scheme.OpenCover.{u} Y)(_ : ∀ i, IsAffine (𝒰.obj i))(𝒰' : ∀ i, Scheme.OpenCover.{u} (pullback f (𝒰.map i)))(_ : ∀ i j, IsAffine ((𝒰' i).obj j)), ∀ i j k, P (pullback.map_desc ((𝒰' i).map j) ((𝒰' i).map k) pullback.snd)] := by tfae_have 1 → 4 · introv H hU hg _ _ skip apply P.diagonal_of_target_affine_locally <;> assumption tfae_have 4 → 3 · introv H h𝒰 skip apply H tfae_have 3 → 2 · exact fun H => ⟨Y.affine_cover, inferInstance, H Y.affine_cover⟩ tfae_have 2 → 5 · rintro ⟨𝒰, h𝒰, H⟩ skip refine' ⟨𝒰, inferInstance, fun _ => Scheme.affine_cover _, inferInstance, _⟩ intro i j k apply H tfae_have 5 → 1 · rintro ⟨𝒰, _, 𝒰', _, H⟩ exact diagonal_target_affine_locally_of_open_cover P hP f 𝒰 𝒰' H tfae_finish #align algebraic_geometry.affine_target_morphism_property.is_local.diagonal_affine_open_cover_tfae AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.diagonal_affine_openCover_tFAE theorem AffineTargetMorphismProperty.IsLocal.diagonal {P : AffineTargetMorphismProperty} (hP : P.IsLocal) : P.diagonal.IsLocal := AffineTargetMorphismProperty.isLocalOfOpenCoverImply P.diagonal (P.diagonal_respectsIso hP.1) fun _ _ f => ((hP.diagonal_affine_openCover_tFAE f).out 1 3).mp #align algebraic_geometry.affine_target_morphism_property.is_local.diagonal AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.diagonal theorem diagonal_targetAffineLocally_eq_targetAffineLocally (P : AffineTargetMorphismProperty) (hP : P.IsLocal) : (targetAffineLocally P).diagonal = targetAffineLocally P.diagonal := by ext (_ _ f) exact ((hP.diagonal_affine_open_cover_tfae f).out 0 1).trans ((hP.diagonal.affine_open_cover_tfae f).out 1 0) #align algebraic_geometry.diagonal_target_affine_locally_eq_target_affine_locally AlgebraicGeometry.diagonal_targetAffineLocally_eq_targetAffineLocally theorem universallyIsLocalAtTarget (P : MorphismProperty Scheme) (hP : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} Y), (∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) → P f) : PropertyIsLocalAtTarget P.universally := by refine' ⟨P.universally_respects_iso, fun X Y f U => P.universally_stable_under_base_change (is_pullback_morphism_restrict f U).flip, _⟩ intro X Y f 𝒰 h X' Y' i₁ i₂ f' H apply hP _ (𝒰.pullback_cover i₂) intro i dsimp apply h i (pullback.lift (pullback.fst ≫ i₁) (pullback.snd ≫ pullback.snd) _) pullback.snd swap · rw [category.assoc, category.assoc, ← pullback.condition, ← pullback.condition_assoc, H.w] refine' (is_pullback.of_right _ (pullback.lift_snd _ _ _) (is_pullback.of_has_pullback _ _)).flip rw [pullback.lift_fst, ← pullback.condition] exact (is_pullback.of_has_pullback _ _).paste_horiz H.flip #align algebraic_geometry.universally_is_local_at_target AlgebraicGeometry.universallyIsLocalAtTarget theorem universallyIsLocalAtTargetOfMorphismRestrict (P : MorphismProperty Scheme) (hP₁ : P.RespectsIso) (hP₂ : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y) {ι : Type u} (U : ι → Opens Y.carrier) (hU : supᵢ U = ⊤), (∀ i, P (f ∣_ U i)) → P f) : PropertyIsLocalAtTarget P.universally := universallyIsLocalAtTarget P (by intro X Y f 𝒰 h𝒰 apply hP₂ f (fun i : 𝒰.J => (𝒰.map i).opensRange) 𝒰.supr_opens_range simp_rw [hP₁.arrow_mk_iso_iff (morphism_restrict_opens_range f _)] exact h𝒰) #align algebraic_geometry.universally_is_local_at_target_of_morphism_restrict AlgebraicGeometry.universallyIsLocalAtTargetOfMorphismRestrict /-- `topologically P` holds for a morphism if the underlying topological map satisfies `P`. -/ def MorphismProperty.topologically (P : ∀ {α β : Type u} [TopologicalSpace α] [TopologicalSpace β] (f : α → β), Prop) : MorphismProperty Scheme.{u} := fun X Y f => P f.1.base #align algebraic_geometry.morphism_property.topologically AlgebraicGeometry.MorphismProperty.topologically end AlgebraicGeometry
lemmas continuous_scaleR [continuous_intros] = bounded_bilinear.continuous [OF bounded_bilinear_scaleR]
lemma complex_mod_cnj [simp]: "cmod (cnj z) = cmod z"
{-# LANGUAGE DataKinds, TypeFamilies #-} {-# OPTIONS_GHC -Wno-missing-export-lists #-} -- | Scalar-based implementation of fully connected neutral network -- for classification of MNIST digits. Sports 2 hidden layers. module HordeAd.Tool.MnistFcnnScalar where import Prelude import Control.Exception (assert) import Data.Proxy (Proxy) import qualified Data.Strict.Vector as Data.Vector import qualified Data.Vector.Generic as V import GHC.Exts (inline) import Numeric.LinearAlgebra (Vector) import HordeAd.Core.DualNumber import HordeAd.Core.Engine import HordeAd.Core.PairOfVectors (DualNumberVariables, var0) import HordeAd.Tool.MnistData -- | Compute the output of a neuron, without applying activation function, -- from trainable inputs in @xs@ and parameters (the bias and weights) -- at @variables@ starting at @offset@. Useful for neurons in the middle -- of the network, receiving inputs from other neurons. sumTrainableInputs :: forall d r m. DualMonad d r m => Data.Vector.Vector (DualNumber d r) -> Int -> DualNumberVariables d r -> m (DualNumber d r) sumTrainableInputs xs offset variables = do let bias = var0 variables offset f :: DualNumber d r -> Int -> DualNumber d r -> DualNumber d r f !acc i u = let v = var0 variables (offset + 1 + i) in acc + u * v returnLet $ V.ifoldl' f bias xs -- | Compute the output of a neuron, without applying activation function, -- from constant data in @xs@ and parameters (the bias and weights) -- at @variables@ starting at @offset@. Useful for neurons at the bottom -- of the network, tasked with ingesting the data. sumConstantData :: forall d r m. DualMonad d r m => Vector r -> Int -> DualNumberVariables d r -> m (DualNumber d r) sumConstantData xs offset variables = do let bias = var0 variables offset f :: DualNumber d r -> Int -> r -> DualNumber d r f !acc i r = let v = var0 variables (offset + 1 + i) in acc + scale r v returnLet $ V.ifoldl' f bias xs hiddenLayerMnist :: forall d r m. DualMonad d r m => (DualNumber d r -> m (DualNumber d r)) -> Vector r -> DualNumberVariables d r -> Int -> m (Data.Vector.Vector (DualNumber d r)) hiddenLayerMnist factivation input variables width = do let nWeightsAndBias = V.length input + 1 f :: Int -> m (DualNumber d r) f i = do outSum <- sumConstantData input (i * nWeightsAndBias) variables factivation outSum V.generateM width f middleLayerMnist :: forall d r m. DualMonad d r m => (DualNumber d r -> m (DualNumber d r)) -> Data.Vector.Vector (DualNumber d r) -> Int -> DualNumberVariables d r -> Int -> m (Data.Vector.Vector (DualNumber d r)) middleLayerMnist factivation hiddenVec offset variables width = do let nWeightsAndBias = V.length hiddenVec + 1 f :: Int -> m (DualNumber d r) f i = do outSum <- sumTrainableInputs hiddenVec (offset + i * nWeightsAndBias) variables factivation outSum V.generateM width f outputLayerMnist :: forall d r m. DualMonad d r m => (Data.Vector.Vector (DualNumber d r) -> m (Data.Vector.Vector (DualNumber d r))) -> Data.Vector.Vector (DualNumber d r) -> Int -> DualNumberVariables d r -> Int -> m (Data.Vector.Vector (DualNumber d r)) outputLayerMnist factivation hiddenVec offset variables width = do let nWeightsAndBias = V.length hiddenVec + 1 f :: Int -> m (DualNumber d r) f i = sumTrainableInputs hiddenVec (offset + i * nWeightsAndBias) variables vOfSums <- V.generateM width f factivation vOfSums fcnnMnistLen0 :: Int -> Int -> Int fcnnMnistLen0 widthHidden widthHidden2 = widthHidden * (sizeMnistGlyph + 1) + widthHidden2 * (widthHidden + 1) + sizeMnistLabel * (widthHidden2 + 1) -- | Fully connected neural network for the MNIST digit classification task. -- There are two hidden layers and both use the same activation function. -- The output layer uses a different activation function. -- The widths of the hidden layers are @widthHidden@ and @widthHidden2@ -- and from these, the @fcnnMnistLen2@ function computes the number -- of scalar dual number parameters (variables) to be given to the program. fcnnMnist0 :: forall d r m. DualMonad d r m => (DualNumber d r -> m (DualNumber d r)) -> (Data.Vector.Vector (DualNumber d r) -> m (Data.Vector.Vector (DualNumber d r))) -> Int -> Int -> Vector r -> DualNumberVariables d r -> m (Data.Vector.Vector (DualNumber d r)) fcnnMnist0 factivationHidden factivationOutput widthHidden widthHidden2 input variables = do let !_A = assert (sizeMnistGlyph == V.length input) () layer1 <- inline hiddenLayerMnist factivationHidden input variables widthHidden let offsetMiddle = widthHidden * (sizeMnistGlyph + 1) layer2 <- inline middleLayerMnist factivationHidden layer1 offsetMiddle variables widthHidden2 let offsetOutput = offsetMiddle + widthHidden2 * (widthHidden + 1) inline outputLayerMnist factivationOutput layer2 offsetOutput variables sizeMnistLabel -- | The neural network applied to concrete activation functions -- and composed with the appropriate loss function. fcnnMnistLoss0 :: DualMonad d r m => Int -> Int -> MnistData r -> DualNumberVariables d r -> m (DualNumber d r) fcnnMnistLoss0 widthHidden widthHidden2 (input, target) variables = do result <- inline fcnnMnist0 logisticAct softMaxAct widthHidden widthHidden2 input variables lossCrossEntropy target result -- | A function testing the neural network given testing set of inputs -- and the trained parameters. -- -- The proxy argument is needed only for the (spurious) SPECIALIZE pragma, -- becuase I can't write @SPECIALIZE fcnnMnistTest0 \@Double@. fcnnMnistTest0 :: forall r. IsScalar 'DModeGradient r => Proxy r -> Int -> Int -> [MnistData r] -> Domain0 r -> r fcnnMnistTest0 _ widthHidden widthHidden2 inputs params0 = let matchesLabels :: MnistData r -> Bool matchesLabels (glyph, label) = let nn = inline (fcnnMnist0 @'DModeGradient) logisticAct softMaxAct widthHidden widthHidden2 glyph value = V.map (\(D r _) -> r) $ primalValueGeneral nn (params0, V.empty, V.empty, V.empty) in V.maxIndex value == V.maxIndex label in fromIntegral (length (filter matchesLabels inputs)) / fromIntegral (length inputs) {-# SPECIALIZE fcnnMnistTest0 :: Proxy Double -> Int -> Int -> [MnistData Double] -> Domain0 Double -> Double #-}
Formal statement is: lemma Im_complex_of_real [simp]: "Im (complex_of_real z) = 0" Informal statement is: The imaginary part of a real number is zero.
function [transprob, termprob] = remove_hhmm_end_state(A) % REMOVE_END_STATE Infer transition and termination probabilities from automaton with an end state % [transprob, termprob] = remove_end_state(A) % % A(i,k,j) = Pr( i->j | Qps=k), where i in 1:Q, j in 1:(Q+1), and Q+1 is the end state % This implements the equation in footnote 3 of my NIPS 01 paper, % transprob(i,k,j) = \tilde{A}_k(i,j) % termprob(k,j) = \tau_k(j) % % For the top level, the k index is missing. Q = size(A,1); toplevel = (ndims(A)==2); if toplevel Qk = 1; A = reshape(A, [Q 1 Q+1]); else Qk = size(A, 2); end transprob = A(:, :, 1:Q); term = A(:,:,Q+1)'; % term(k,j) = P(Qj -> end | k) termprob = term; %termprob = zeros(Qk, Q, 2); %termprob(:,:,2) = term; %termprob(:,:,1) = 1-term; for k=1:Qk for i=1:Q for j=1:Q denom = (1-termprob(k,i)); denom = denom + (denom==0)*eps; transprob(i,k,j) = transprob(i,k,j) / denom; end end end if toplevel termprob = squeeze(termprob); transprob = squeeze(transprob); end
theory Exercise3 imports Exercise2 begin fun deskip :: "com \<Rightarrow> com" where "deskip (SKIP) = (SKIP)" | "deskip (x ::= a) = (x ::= a)" | "deskip (c1 ;; c2) = (if ((skip_ua c1) \<and> (skip_ua c2)) then (SKIP) else if (skip_ua c1) then (deskip c2) else if (skip_ua c2) then (deskip c1) else ((deskip c1) ;; (deskip c2)))" | "deskip (IF b THEN c1 ELSE c2) = (if ((skip_ua c1) \<and> (skip_ua c2)) then (SKIP) else (IF b THEN (deskip c1) ELSE (deskip c2)))" | "deskip (WHILE b DO c) = (WHILE b DO (deskip c))" lemma "(deskip c = SKIP) \<longleftrightarrow> (skip_ua c)" proof assume "deskip c = SKIP" thus "skip_ua c" proof induction case (Seq c1 c2) hence "((skip_ua c1) \<and> (skip_ua c2))" by (metis com.distinct(3) deskip.simps(3)) thus ?case by simp next case (If b c1 c2) hence "((skip_ua c1) \<and> (skip_ua c2))" by (metis com.distinct(5) deskip.simps(4)) thus ?case by simp qed auto next assume "skip_ua c" thus "deskip c = SKIP" proof (induction c) case (Seq c1 c2) hence "((skip_ua c1) \<and> (skip_ua c2))" by simp thus ?case by simp next case (If b c1 c2) hence "((skip_ua c1) \<and> (skip_ua c2))" by simp thus ?case by simp qed auto qed value "deskip (SKIP;; WHILE b DO ((x ::= a);; SKIP))" theorem deskip_equiv: "deskip c \<sim> c" proof induction case (Seq c1 c2) have "(skip_ua c1 \<and> skip_ua c2) \<or> (skip_ua c1 \<and> \<not> skip_ua c2) \<or> (\<not> skip_ua c1 \<and> skip_ua c2) \<or> (\<not> skip_ua c1 \<and> \<not> skip_ua c2)" by auto thus ?case proof (elim disjE) assume assm: "skip_ua c1 \<and> skip_ua c2" hence skipped: "deskip (c1 ;; c2) = SKIP" by simp have "c1 \<sim> SKIP \<and> c2 \<sim> SKIP" using assm skip_ua_impl_equiv by presburger hence "SKIP \<sim> (c1 ;; c2)" using Exercise2.seq assm skip_ua_impl_equiv by presburger thus ?case using skipped by presburger next assume assm: "skip_ua c1 \<and> \<not> skip_ua c2" hence "deskip (c1 ;; c2) = deskip c2" by simp hence rdct: "deskip (c1 ;; c2) \<sim> c2" using `deskip c2 \<sim> c2` by simp have "c1 \<sim> SKIP" using assm skip_ua_impl_equiv by presburger hence "c2 \<sim> (c1 ;; c2)" by auto thus ?case using rdct by simp next assume assm: "\<not> skip_ua c1 \<and> skip_ua c2" hence "deskip (c1 ;; c2) = deskip c1" by simp hence rdct: "deskip (c1 ;; c2) \<sim> c1" using `deskip c1 \<sim> c1` by simp have "c2 \<sim> SKIP" using assm skip_ua_impl_equiv by presburger hence "c1 \<sim> (c1 ;; c2)" by auto thus ?case using rdct by simp next assume assm: "\<not> skip_ua c1 \<and> \<not> skip_ua c2" have expn: "deskip (c1 ;; c2) = ((deskip c1) ;; (deskip c2))" using assm deskip.simps(3) by presburger have "((deskip c1) ;; (deskip c2)) \<sim> (c1 ;; c2)" using `deskip c1 \<sim> c1` `deskip c2 \<sim> c2` by auto thus ?case using expn by presburger qed next case (If b c1 c2) have "((skip_ua c1) \<and> (skip_ua c2)) \<or> \<not> ((skip_ua c1) \<and> (skip_ua c2))" by simp thus ?case proof assume assm: "(skip_ua c1) \<and> (skip_ua c2)" hence isskip: "deskip (IF b THEN c1 ELSE c2) = SKIP" by simp have "c1 \<sim> SKIP \<and> c2 \<sim> SKIP" using assm skip_ua_impl_equiv by presburger hence "SKIP \<sim> (IF b THEN c1 ELSE c2)" by blast thus ?thesis using isskip by simp next assume assm: "\<not> ((skip_ua c1) \<and> (skip_ua c2))" hence "deskip (IF b THEN c1 ELSE c2) = (IF b THEN (deskip c1) ELSE (deskip c2))" by simp thus ?thesis using `deskip c1 \<sim> c1` `deskip c2 \<sim> c2` by auto qed next case (While b c) have "deskip (WHILE b DO c) = (WHILE b DO (deskip c))" by simp thus ?case using `deskip c \<sim> c` using while_equiv by presburger qed simp+ end
import cv2 import numpy as np import torch def get_frames(filepath, max_frames=1e7, verbose=1000): vidcap = cv2.VideoCapture(filepath) success,image = vidcap.read() count = 0 data = [] while success and count < max_frames: # save frame as JPEG file success, image = vidcap.read() data.append(image / 255) count += 1 if verbose != -1 and count%verbose==0: print("Loading video %s: %.2f%%" % (filepath, count * 100 / max_frames)) data = np.array(data) data = torch.as_tensor(data) return data.permute(0, 3, 1, 2) def decompose(file_path, save_path, batch_size=64): import os vidcap = cv2.VideoCapture(file_path) success,preimage = vidcap.read() count = 0 fake_count = 0 while success: # save frame as JPEG file success = vidcap.grab() if count%1==0 and count > 59950: success,image = vidcap.read() image = torch.from_numpy(np.transpose((image / 255), (2, 0, 1))).unsqueeze(0) torch.save(image, os.path.join(save_path, 'frame' + str(fake_count))) fake_count += 1 print(fake_count) count += 1
[GOAL] f g : CircleDeg1Lift x : ℝ ⊢ ↑f (1 + x) = 1 + ↑f x [PROOFSTEP] rw [add_comm, map_add_one, add_comm 1] [GOAL] f✝ g✝ f g : CircleDeg1Lift x : ℝ ⊢ OrderHom.toFun (OrderHom.comp f.toOrderHom g.toOrderHom) (x + 1) = OrderHom.toFun (OrderHom.comp f.toOrderHom g.toOrderHom) x + 1 [PROOFSTEP] simp [map_add_one] [GOAL] f✝ g : CircleDeg1Lift f : CircleDeg1Liftˣ x : ℝ ⊢ ↑↑f⁻¹ (↑↑f x) = x [PROOFSTEP] simp only [← mul_apply, f.inv_mul, coe_one, id] [GOAL] f✝ g : CircleDeg1Lift f : CircleDeg1Liftˣ x : ℝ ⊢ ↑↑f (↑↑f⁻¹ x) = x [PROOFSTEP] simp only [← mul_apply, f.mul_inv, coe_one, id] [GOAL] f✝ g : CircleDeg1Lift f : CircleDeg1Liftˣ a✝ b✝ : ℝ h : ↑{ toFun := ↑↑f, invFun := ↑↑f⁻¹, left_inv := (_ : ∀ (x : ℝ), ↑↑f⁻¹ (↑↑f x) = x), right_inv := (_ : ∀ (x : ℝ), ↑↑f (↑↑f⁻¹ x) = x) } a✝ ≤ ↑{ toFun := ↑↑f, invFun := ↑↑f⁻¹, left_inv := (_ : ∀ (x : ℝ), ↑↑f⁻¹ (↑↑f x) = x), right_inv := (_ : ∀ (x : ℝ), ↑↑f (↑↑f⁻¹ x) = x) } b✝ ⊢ a✝ ≤ b✝ [PROOFSTEP] simpa using mono (↑f⁻¹) h [GOAL] f✝ g f : CircleDeg1Lift h : Bijective ↑f x y : ℝ hxy : x ≤ y ⊢ ↑f (↑(Equiv.ofBijective (↑f) h).symm x) ≤ ↑f (↑(Equiv.ofBijective (↑f) h).symm y) [PROOFSTEP] simp only [Equiv.ofBijective_apply_symm_apply f h, hxy] [GOAL] f✝ g f : CircleDeg1Lift h : Bijective ↑f x : ℝ ⊢ ↑f (OrderHom.toFun { toFun := ↑(Equiv.ofBijective (↑f) h).symm, monotone' := (_ : ∀ (x y : ℝ), x ≤ y → ↑(Equiv.ofBijective (↑f) h).symm x ≤ ↑(Equiv.ofBijective (↑f) h).symm y) } (x + 1)) = ↑f (OrderHom.toFun { toFun := ↑(Equiv.ofBijective (↑f) h).symm, monotone' := (_ : ∀ (x y : ℝ), x ≤ y → ↑(Equiv.ofBijective (↑f) h).symm x ≤ ↑(Equiv.ofBijective (↑f) h).symm y) } x + 1) [PROOFSTEP] simp only [Equiv.ofBijective_apply_symm_apply f, f.map_add_one] [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ ↑(f ^ (n + 1)) = (↑f)^[n + 1] [PROOFSTEP] ext x [GOAL] case h f g : CircleDeg1Lift n : ℕ x : ℝ ⊢ ↑(f ^ (n + 1)) x = (↑f)^[n + 1] x [PROOFSTEP] simp [coe_pow n, pow_succ'] [GOAL] f g : CircleDeg1Lift x : ℝ n : ℤ ⊢ ↑translate (↑Multiplicative.ofAdd x) ^ n = ↑translate (↑Multiplicative.ofAdd (↑n * x)) [PROOFSTEP] simp only [← zsmul_eq_mul, ofAdd_zsmul, MonoidHom.map_zpow] [GOAL] f g : CircleDeg1Lift x : ℝ n : ℕ ⊢ (↑↑(↑translate (↑Multiplicative.ofAdd x)))^[n] = ↑↑(↑translate (↑Multiplicative.ofAdd (↑n * x))) [PROOFSTEP] rw [← coe_pow, ← Units.val_pow_eq_pow_val, translate_pow] [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ Function.Commute ↑f fun x => ↑n + x [PROOFSTEP] simpa only [nsmul_one, add_left_iterate] using Function.Commute.iterate_right f.map_one_add n [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ Function.Commute ↑f fun x => x + ↑n [PROOFSTEP] simp only [add_comm _ (n : ℝ), f.commute_nat_add n] [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ Function.Commute ↑f fun x => x - ↑n [PROOFSTEP] simpa only [sub_eq_add_neg] using (f.commute_add_nat n).inverses_right (Equiv.addRight _).right_inv (Equiv.addRight _).left_inv [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ Function.Commute ↑f fun x => x + ↑-[n+1] [PROOFSTEP] simpa [sub_eq_add_neg] using f.commute_sub_nat (n + 1) [GOAL] f g : CircleDeg1Lift n : ℤ ⊢ Function.Commute ↑f fun x => ↑n + x [PROOFSTEP] simpa only [add_comm _ (n : ℝ)] using f.commute_add_int n [GOAL] f g : CircleDeg1Lift n : ℤ ⊢ Function.Commute ↑f fun x => x - ↑n [PROOFSTEP] simpa only [sub_eq_add_neg] using (f.commute_add_int n).inverses_right (Equiv.addRight _).right_inv (Equiv.addRight _).left_inv [GOAL] f g : CircleDeg1Lift n : ℤ ⊢ ↑f ↑n = ↑f 0 + ↑n [PROOFSTEP] rw [← f.map_add_int, zero_add] [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ ↑f (fract x) - fract x = ↑f x - x [PROOFSTEP] rw [Int.fract, f.map_sub_int, sub_sub_sub_cancel_right] [GOAL] f✝ g✝ f g : CircleDeg1Lift x : ℝ ⊢ OrderHom.toFun { toFun := fun x => max (↑f x) (↑g x), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → max (↑f x) (↑g x) ≤ max (↑f y) (↑g y)) } (x + 1) = OrderHom.toFun { toFun := fun x => max (↑f x) (↑g x), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → max (↑f x) (↑g x) ≤ max (↑f y) (↑g y)) } x + 1 [PROOFSTEP] simp [max_add_add_right] [GOAL] f✝ g✝ f g : CircleDeg1Lift x : ℝ ⊢ OrderHom.toFun { toFun := fun x => min (↑f x) (↑g x), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → min (↑f x) (↑g x) ≤ min (↑f y) (↑g y)) } (x + 1) = OrderHom.toFun { toFun := fun x => min (↑f x) (↑g x), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → min (↑f x) (↑g x) ≤ min (↑f y) (↑g y)) } x + 1 [PROOFSTEP] simp [min_add_add_right] [GOAL] f✝ g✝ f g : CircleDeg1Lift h : f ≤ g n : ℕ x : ℝ ⊢ ↑(f ^ n) x ≤ ↑(g ^ n) x [PROOFSTEP] simp only [coe_pow, iterate_mono h n x] [GOAL] f g : CircleDeg1Lift ⊢ dist (↑f 0 + ↑g 0) (↑f (↑g 0)) < 1 [PROOFSTEP] rw [dist_comm, Real.dist_eq, abs_lt, lt_sub_iff_add_lt', sub_lt_iff_lt_add', ← sub_eq_add_neg] [GOAL] f g : CircleDeg1Lift ⊢ ↑f 0 + ↑g 0 - 1 < ↑f (↑g 0) ∧ ↑f (↑g 0) < ↑f 0 + ↑g 0 + 1 [PROOFSTEP] exact ⟨f.lt_map_map_zero g, f.map_map_zero_lt g⟩ [GOAL] f✝ g f g₁ g₂ : CircleDeg1Lift h : Semiconj ↑f ↑g₁ ↑g₂ ⊢ dist (↑g₁ 0) (↑f (↑g₁ 0) - ↑f 0) + dist (↑f (↑g₁ 0) - ↑f 0) (↑g₂ 0) = dist (↑f 0 + ↑g₁ 0) (↑f (↑g₁ 0)) + dist (↑g₂ 0 + ↑f 0) (↑g₂ (↑f 0)) [PROOFSTEP] simp only [h.eq, Real.dist_eq, sub_sub, add_comm (f 0), sub_sub_eq_add_sub, abs_sub_comm (g₂ (f 0))] [GOAL] f g : CircleDeg1Lift ⊢ Tendsto (fun x => x - 1) atTop atTop [PROOFSTEP] simpa [sub_eq_add_neg] using tendsto_atTop_add_const_right _ _ tendsto_id [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ h : ↑f x ≤ x + ↑m n : ℕ ⊢ (↑f)^[n] x ≤ x + ↑n * ↑m [PROOFSTEP] simpa only [nsmul_eq_mul, add_right_iterate] using (f.commute_add_int m).iterate_le_of_map_le f.monotone (monotone_id.add_const (m : ℝ)) h n [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ h : x + ↑m ≤ ↑f x n : ℕ ⊢ x + ↑n * ↑m ≤ (↑f)^[n] x [PROOFSTEP] simpa only [nsmul_eq_mul, add_right_iterate] using (f.commute_add_int m).symm.iterate_le_of_map_le (monotone_id.add_const (m : ℝ)) f.monotone h n [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ h : ↑f x = x + ↑m n : ℕ ⊢ (↑f)^[n] x = x + ↑n * ↑m [PROOFSTEP] simpa only [nsmul_eq_mul, add_right_iterate] using (f.commute_add_int m).iterate_eq_of_map_eq n h [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ n : ℕ hn : 0 < n ⊢ (↑f)^[n] x ≤ x + ↑n * ↑m ↔ ↑f x ≤ x + ↑m [PROOFSTEP] simpa only [nsmul_eq_mul, add_right_iterate] using (f.commute_add_int m).iterate_pos_le_iff_map_le f.monotone (strictMono_id.add_const (m : ℝ)) hn [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ n : ℕ hn : 0 < n ⊢ (↑f)^[n] x < x + ↑n * ↑m ↔ ↑f x < x + ↑m [PROOFSTEP] simpa only [nsmul_eq_mul, add_right_iterate] using (f.commute_add_int m).iterate_pos_lt_iff_map_lt f.monotone (strictMono_id.add_const (m : ℝ)) hn [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ n : ℕ hn : 0 < n ⊢ (↑f)^[n] x = x + ↑n * ↑m ↔ ↑f x = x + ↑m [PROOFSTEP] simpa only [nsmul_eq_mul, add_right_iterate] using (f.commute_add_int m).iterate_pos_eq_iff_map_eq f.monotone (strictMono_id.add_const (m : ℝ)) hn [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ n : ℕ hn : 0 < n ⊢ x + ↑n * ↑m ≤ (↑f)^[n] x ↔ x + ↑m ≤ ↑f x [PROOFSTEP] simpa only [not_lt] using not_congr (f.iterate_pos_lt_iff hn) [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ n : ℕ hn : 0 < n ⊢ x + ↑n * ↑m < (↑f)^[n] x ↔ x + ↑m < ↑f x [PROOFSTEP] simpa only [not_le] using not_congr (f.iterate_pos_le_iff hn) [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ ↑n * ⌊↑f 0⌋ ≤ ⌊(↑f)^[n] 0⌋ [PROOFSTEP] rw [le_floor, Int.cast_mul, Int.cast_ofNat, ← zero_add ((n : ℝ) * _)] [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ 0 + ↑n * ↑⌊↑f 0⌋ ≤ (↑f)^[n] 0 [PROOFSTEP] apply le_iterate_of_add_int_le_map [GOAL] case h f g : CircleDeg1Lift n : ℕ ⊢ 0 + ↑⌊↑f 0⌋ ≤ ↑f 0 [PROOFSTEP] simp [floor_le] [GOAL] f g : CircleDeg1Lift τ' : ℝ h : Tendsto (fun n => (↑f)^[n] 0 / ↑n) atTop (𝓝 τ') ⊢ Tendsto (transnumAuxSeq f) atTop (𝓝 τ') [PROOFSTEP] simpa [(· ∘ ·), transnumAuxSeq_def, coe_pow] using h.comp (Nat.tendsto_pow_atTop_atTop_of_one_lt one_lt_two) [GOAL] f g : CircleDeg1Lift τ' : ℝ h : Tendsto (fun n => (↑f)^[n + 1] 0 / (↑n + 1)) atTop (𝓝 τ') ⊢ Tendsto (fun n => (↑f)^[n + 1] 0 / ↑(n + 1)) atTop (𝓝 τ') [PROOFSTEP] exact_mod_cast h [GOAL] f g : CircleDeg1Lift ⊢ transnumAuxSeq f 0 = ↑f 0 [PROOFSTEP] simp [transnumAuxSeq] [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) < 1 / 2 / 2 ^ n [PROOFSTEP] have : 0 < (2 ^ (n + 1) : ℝ) := pow_pos zero_lt_two _ [GOAL] f g : CircleDeg1Lift n : ℕ this : 0 < 2 ^ (n + 1) ⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) < 1 / 2 / 2 ^ n [PROOFSTEP] rw [div_div, ← pow_succ, ← abs_of_pos this] [GOAL] f g : CircleDeg1Lift n : ℕ this : 0 < 2 ^ (n + 1) ⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) < 1 / |2 ^ (n + 1)| [PROOFSTEP] replace := abs_pos.2 (ne_of_gt this) [GOAL] f g : CircleDeg1Lift n : ℕ this : 0 < |2 ^ (n + 1)| ⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) < 1 / |2 ^ (n + 1)| [PROOFSTEP] convert (div_lt_div_right this).2 ((f ^ 2 ^ n).dist_map_map_zero_lt (f ^ 2 ^ n)) using 1 [GOAL] case h.e'_3 f g : CircleDeg1Lift n : ℕ this : 0 < |2 ^ (n + 1)| ⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) = dist (↑(f ^ 2 ^ n) 0 + ↑(f ^ 2 ^ n) 0) (↑(f ^ 2 ^ n) (↑(f ^ 2 ^ n) 0)) / |2 ^ (n + 1)| [PROOFSTEP] simp_rw [transnumAuxSeq, Real.dist_eq] [GOAL] case h.e'_3 f g : CircleDeg1Lift n : ℕ this : 0 < |2 ^ (n + 1)| ⊢ |↑(f ^ 2 ^ n) 0 / 2 ^ n - ↑(f ^ 2 ^ (n + 1)) 0 / 2 ^ (n + 1)| = |↑(f ^ 2 ^ n) 0 + ↑(f ^ 2 ^ n) 0 - ↑(f ^ 2 ^ n) (↑(f ^ 2 ^ n) 0)| / |2 ^ (n + 1)| [PROOFSTEP] rw [← abs_div, sub_div, pow_succ', pow_succ, ← two_mul, mul_div_mul_left _ _ (two_ne_zero' ℝ), pow_mul, sq, mul_apply] [GOAL] f g : CircleDeg1Lift x : ℕ → ℝ C : ℝ H : ∀ (n : ℕ), dist (↑(f ^ n) 0) (x n) ≤ C ⊢ Tendsto (fun n => x (2 ^ n) / 2 ^ n) atTop (𝓝 (τ f)) [PROOFSTEP] refine' f.tendsto_translationNumber_aux.congr_dist (squeeze_zero (fun _ => dist_nonneg) _ _) [GOAL] case refine'_1 f g : CircleDeg1Lift x : ℕ → ℝ C : ℝ H : ∀ (n : ℕ), dist (↑(f ^ n) 0) (x n) ≤ C ⊢ ℕ → ℝ [PROOFSTEP] exact fun n => C / 2 ^ n [GOAL] case refine'_2 f g : CircleDeg1Lift x : ℕ → ℝ C : ℝ H : ∀ (n : ℕ), dist (↑(f ^ n) 0) (x n) ≤ C ⊢ ∀ (t : ℕ), dist (transnumAuxSeq f t) (x (2 ^ t) / 2 ^ t) ≤ C / 2 ^ t [PROOFSTEP] intro n [GOAL] case refine'_2 f g : CircleDeg1Lift x : ℕ → ℝ C : ℝ H : ∀ (n : ℕ), dist (↑(f ^ n) 0) (x n) ≤ C n : ℕ ⊢ dist (transnumAuxSeq f n) (x (2 ^ n) / 2 ^ n) ≤ C / 2 ^ n [PROOFSTEP] have : 0 < (2 ^ n : ℝ) := pow_pos zero_lt_two _ [GOAL] case refine'_2 f g : CircleDeg1Lift x : ℕ → ℝ C : ℝ H : ∀ (n : ℕ), dist (↑(f ^ n) 0) (x n) ≤ C n : ℕ this : 0 < 2 ^ n ⊢ dist (transnumAuxSeq f n) (x (2 ^ n) / 2 ^ n) ≤ C / 2 ^ n [PROOFSTEP] convert (div_le_div_right this).2 (H (2 ^ n)) using 1 [GOAL] case h.e'_3 f g : CircleDeg1Lift x : ℕ → ℝ C : ℝ H : ∀ (n : ℕ), dist (↑(f ^ n) 0) (x n) ≤ C n : ℕ this : 0 < 2 ^ n ⊢ dist (transnumAuxSeq f n) (x (2 ^ n) / 2 ^ n) = dist (↑(f ^ 2 ^ n) 0) (x (2 ^ n)) / 2 ^ n [PROOFSTEP] rw [transnumAuxSeq, Real.dist_eq, ← sub_div, abs_div, abs_of_pos this, Real.dist_eq] [GOAL] case refine'_3 f g : CircleDeg1Lift x : ℕ → ℝ C : ℝ H : ∀ (n : ℕ), dist (↑(f ^ n) 0) (x n) ≤ C ⊢ Tendsto (fun n => C / 2 ^ n) atTop (𝓝 0) [PROOFSTEP] exact mul_zero C ▸ tendsto_const_nhds.mul <| tendsto_inv_atTop_zero.comp <| tendsto_pow_atTop_atTop_of_one_lt one_lt_two [GOAL] f g : CircleDeg1Lift ⊢ Tendsto (fun n => (↑1)^[n] 0 / ↑n) atTop (𝓝 0) [PROOFSTEP] simp [tendsto_const_nhds] [GOAL] f✝ g✝ f g : CircleDeg1Lift h : Commute f g ⊢ τ (f * g) = τ f + τ g [PROOFSTEP] refine tendsto_nhds_unique ?_ (f.tendsto_translationNumber_aux.add g.tendsto_translationNumber_aux) [GOAL] f✝ g✝ f g : CircleDeg1Lift h : Commute f g ⊢ Tendsto (fun x => transnumAuxSeq f x + transnumAuxSeq g x) atTop (𝓝 (τ (f * g))) [PROOFSTEP] simp only [transnumAuxSeq, ← add_div] [GOAL] f✝ g✝ f g : CircleDeg1Lift h : Commute f g ⊢ Tendsto (fun x => (↑(f ^ 2 ^ x) 0 + ↑(g ^ 2 ^ x) 0) / 2 ^ x) atTop (𝓝 (τ (f * g))) [PROOFSTEP] refine (f * g).tendsto_translationNumber_of_dist_bounded_aux (fun n ↦ (f ^ n) 0 + (g ^ n) 0) 1 fun n ↦ ?_ [GOAL] f✝ g✝ f g : CircleDeg1Lift h : Commute f g n : ℕ ⊢ dist (↑((f * g) ^ n) 0) ((fun n => ↑(f ^ n) 0 + ↑(g ^ n) 0) n) ≤ 1 [PROOFSTEP] rw [h.mul_pow, dist_comm] [GOAL] f✝ g✝ f g : CircleDeg1Lift h : Commute f g n : ℕ ⊢ dist ((fun n => ↑(f ^ n) 0 + ↑(g ^ n) 0) n) (↑(f ^ n * g ^ n) 0) ≤ 1 [PROOFSTEP] exact le_of_lt ((f ^ n).dist_map_map_zero_lt (g ^ n)) [GOAL] f✝ g : CircleDeg1Lift f : CircleDeg1Liftˣ ⊢ τ ↑f⁻¹ + τ ↑f = 0 [PROOFSTEP] simp [← translationNumber_mul_of_commute (Commute.refl _).units_inv_left] [GOAL] f g : CircleDeg1Lift ⊢ τ (f ^ 0) = ↑0 * τ f [PROOFSTEP] simp [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ τ (f ^ (n + 1)) = ↑(n + 1) * τ f [PROOFSTEP] rw [pow_succ', translationNumber_mul_of_commute (Commute.pow_self f n), translationNumber_pow n, Nat.cast_add_one, add_mul, one_mul] [GOAL] f✝ g : CircleDeg1Lift f : CircleDeg1Liftˣ n : ℕ ⊢ τ ↑(f ^ ↑n) = ↑↑n * τ ↑f [PROOFSTEP] simp [translationNumber_pow f n] [GOAL] f✝ g : CircleDeg1Lift f : CircleDeg1Liftˣ n : ℕ ⊢ τ ↑(f ^ -[n+1]) = ↑-[n+1] * τ ↑f [PROOFSTEP] simp [GOAL] f✝ g : CircleDeg1Lift f : CircleDeg1Liftˣ n : ℕ ⊢ -((↑n + 1) * τ ↑f) = (-1 + -↑n) * τ ↑f [PROOFSTEP] ring [GOAL] f g : CircleDeg1Lift ⊢ Tendsto (fun n => ↑(f ^ (n + 1)) 0 / (↑n + 1)) atTop (𝓝 (τ f)) [PROOFSTEP] refine' tendsto_iff_dist_tendsto_zero.2 <| squeeze_zero (fun _ => dist_nonneg) (fun n => _) ((tendsto_const_div_atTop_nhds_0_nat 1).comp (tendsto_add_atTop_nat 1)) [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ dist (↑(f ^ (n + 1)) 0 / (↑n + 1)) (τ f) ≤ ((fun n => 1 / ↑n) ∘ fun a => a + 1) n [PROOFSTEP] dsimp [GOAL] f g : CircleDeg1Lift n : ℕ ⊢ dist (↑(f ^ (n + 1)) 0 / (↑n + 1)) (τ f) ≤ 1 / ↑(n + 1) [PROOFSTEP] have : (0 : ℝ) < n + 1 := n.cast_add_one_pos [GOAL] f g : CircleDeg1Lift n : ℕ this : 0 < ↑n + 1 ⊢ dist (↑(f ^ (n + 1)) 0 / (↑n + 1)) (τ f) ≤ 1 / ↑(n + 1) [PROOFSTEP] rw [Real.dist_eq, div_sub' _ _ _ (ne_of_gt this), abs_div, ← Real.dist_eq, abs_of_pos this, Nat.cast_add_one, div_le_div_right this, ← Nat.cast_add_one] [GOAL] f g : CircleDeg1Lift n : ℕ this : 0 < ↑n + 1 ⊢ dist (↑(f ^ (n + 1)) 0) (↑(n + 1) * τ f) ≤ 1 [PROOFSTEP] apply dist_pow_map_zero_mul_translationNumber_le [GOAL] f g : CircleDeg1Lift ⊢ Tendsto (fun n => ↑(f ^ (n + 1)) 0 / ↑(n + 1)) atTop (𝓝 (τ f)) [PROOFSTEP] exact_mod_cast f.tendsto_translation_number₀' [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ Tendsto (fun n => (↑(f ^ n) x - x) / ↑n) atTop (𝓝 (τ f)) [PROOFSTEP] rw [← translationNumber_conj_eq' (translate <| Multiplicative.ofAdd x)] [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ Tendsto (fun n => (↑(f ^ n) x - x) / ↑n) atTop (𝓝 (τ (↑(↑translate (↑Multiplicative.ofAdd x))⁻¹ * f * ↑(↑translate (↑Multiplicative.ofAdd x))))) [PROOFSTEP] refine (tendsto_translation_number₀ _).congr fun n ↦ ?_ [GOAL] f g : CircleDeg1Lift x : ℝ n : ℕ ⊢ ↑((↑(↑translate (↑Multiplicative.ofAdd x))⁻¹ * f * ↑(↑translate (↑Multiplicative.ofAdd x))) ^ n) 0 / ↑n = (↑(f ^ n) x - x) / ↑n [PROOFSTEP] simp [sub_eq_neg_add, Units.conj_pow'] [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ Tendsto (fun n => (↑(f ^ (n + 1)) x - x) / (↑n + 1)) atTop (𝓝 (τ f)) [PROOFSTEP] exact_mod_cast (tendsto_add_atTop_iff_nat 1).2 (f.tendsto_translationNumber x) [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ Tendsto (fun n => (↑↑(↑translate (↑Multiplicative.ofAdd x)))^[n + 1] 0 / (↑n + 1)) atTop (𝓝 x) [PROOFSTEP] simp only [translate_iterate, translate_apply, add_zero, Nat.cast_succ, mul_div_cancel_left (G₀ := ℝ) _ (Nat.cast_add_one_ne_zero _), tendsto_const_nhds] [GOAL] f g : CircleDeg1Lift x : ℝ m : ℤ h : x + ↑m ≤ ↑f x n : ℕ ⊢ x + ↑m * (↑n + 1) ≤ ↑(f ^ (n + 1)) x [PROOFSTEP] simp only [coe_pow, mul_comm (m : ℝ), ← Nat.cast_add_one, f.le_iterate_of_add_int_le_map h] [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ ↑f x < x + ↑⌊τ f⌋ + 1 [PROOFSTEP] rw [add_assoc] [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ ↑f x < x + (↑⌊τ f⌋ + 1) [PROOFSTEP] norm_cast [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ ↑f x < x + ↑(⌊τ f⌋ + 1) [PROOFSTEP] refine' map_lt_of_translationNumber_lt_int _ _ _ [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ τ f < ↑(⌊τ f⌋ + 1) [PROOFSTEP] push_cast [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ τ f < ↑⌊τ f⌋ + 1 [PROOFSTEP] exact lt_floor_add_one _ [GOAL] f g : CircleDeg1Lift x : ℝ ⊢ x + ↑⌊τ f⌋ + 1 ≤ x + τ f + 1 [PROOFSTEP] gcongr [GOAL] case bc.bc f g : CircleDeg1Lift x : ℝ ⊢ ↑⌊τ f⌋ ≤ τ f [PROOFSTEP] apply floor_le [GOAL] f g : CircleDeg1Lift x : ℝ n : ℕ m : ℤ h : ↑(f ^ n) x = x + ↑m hn : 0 < n ⊢ τ f = ↑m / ↑n [PROOFSTEP] have := (f ^ n).translationNumber_of_eq_add_int h [GOAL] f g : CircleDeg1Lift x : ℝ n : ℕ m : ℤ h : ↑(f ^ n) x = x + ↑m hn : 0 < n this : τ (f ^ n) = ↑m ⊢ τ f = ↑m / ↑n [PROOFSTEP] rwa [translationNumber_pow, mul_comm, ← eq_div_iff] at this [GOAL] f g : CircleDeg1Lift x : ℝ n : ℕ m : ℤ h : ↑(f ^ n) x = x + ↑m hn : 0 < n this : τ f * ↑n = ↑m ⊢ ↑n ≠ 0 [PROOFSTEP] exact Nat.cast_ne_zero.2 (ne_of_gt hn) [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), ↑f x < x + z ⊢ τ f < z [PROOFSTEP] obtain ⟨x, -, hx⟩ : ∃ x ∈ Icc (0 : ℝ) 1, ∀ y ∈ Icc (0 : ℝ) 1, f y - y ≤ f x - x := isCompact_Icc.exists_forall_ge (nonempty_Icc.2 zero_le_one) (hf.sub continuous_id).continuousOn [GOAL] case intro.intro f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), ↑f x < x + z x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f y - y ≤ ↑f x - x ⊢ τ f < z [PROOFSTEP] refine' lt_of_le_of_lt _ (sub_lt_iff_lt_add'.2 <| hz x) [GOAL] case intro.intro f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), ↑f x < x + z x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f y - y ≤ ↑f x - x ⊢ τ f ≤ ↑f x - x [PROOFSTEP] apply translationNumber_le_of_le_add [GOAL] case intro.intro.hz f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), ↑f x < x + z x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f y - y ≤ ↑f x - x ⊢ ∀ (x_1 : ℝ), ↑f x_1 ≤ x_1 + (↑f x - x) [PROOFSTEP] simp only [← sub_le_iff_le_add'] [GOAL] case intro.intro.hz f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), ↑f x < x + z x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f y - y ≤ ↑f x - x ⊢ ∀ (x_1 : ℝ), ↑f x_1 - x_1 ≤ ↑f x - x [PROOFSTEP] exact f.forall_map_sub_of_Icc (fun a => a ≤ f x - x) hx [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), x + z < ↑f x ⊢ z < τ f [PROOFSTEP] obtain ⟨x, -, hx⟩ : ∃ x ∈ Icc (0 : ℝ) 1, ∀ y ∈ Icc (0 : ℝ) 1, f x - x ≤ f y - y [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), x + z < ↑f x ⊢ ∃ x, x ∈ Icc 0 1 ∧ ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f x - x ≤ ↑f y - y case intro.intro f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), x + z < ↑f x x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f x - x ≤ ↑f y - y ⊢ z < τ f [PROOFSTEP] exact isCompact_Icc.exists_forall_le (nonempty_Icc.2 zero_le_one) (hf.sub continuous_id).continuousOn [GOAL] case intro.intro f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), x + z < ↑f x x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f x - x ≤ ↑f y - y ⊢ z < τ f [PROOFSTEP] refine' lt_of_lt_of_le (lt_sub_iff_add_lt'.2 <| hz x) _ [GOAL] case intro.intro f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), x + z < ↑f x x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f x - x ≤ ↑f y - y ⊢ ↑f x - x ≤ τ f [PROOFSTEP] apply le_translationNumber_of_add_le [GOAL] case intro.intro.hz f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), x + z < ↑f x x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f x - x ≤ ↑f y - y ⊢ ∀ (x_1 : ℝ), x_1 + (↑f x - x) ≤ ↑f x_1 [PROOFSTEP] simp only [← le_sub_iff_add_le'] [GOAL] case intro.intro.hz f g : CircleDeg1Lift hf : Continuous ↑f z : ℝ hz : ∀ (x : ℝ), x + z < ↑f x x : ℝ hx : ∀ (y : ℝ), y ∈ Icc 0 1 → ↑f x - x ≤ ↑f y - y ⊢ ∀ (x_1 : ℝ), ↑f x - x ≤ ↑f x_1 - x_1 [PROOFSTEP] exact f.forall_map_sub_of_Icc _ hx [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f ⊢ ∃ x, ↑f x = x + τ f [PROOFSTEP] obtain ⟨a, ha⟩ : ∃ x, f x ≤ x + τ f := by by_contra' H exact lt_irrefl _ (f.lt_translationNumber_of_forall_add_lt hf H) [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f ⊢ ∃ x, ↑f x ≤ x + τ f [PROOFSTEP] by_contra' H [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f H : ∀ (x : ℝ), x + τ f < ↑f x ⊢ False [PROOFSTEP] exact lt_irrefl _ (f.lt_translationNumber_of_forall_add_lt hf H) [GOAL] case intro f g : CircleDeg1Lift hf : Continuous ↑f a : ℝ ha : ↑f a ≤ a + τ f ⊢ ∃ x, ↑f x = x + τ f [PROOFSTEP] obtain ⟨b, hb⟩ : ∃ x, x + τ f ≤ f x := by by_contra' H exact lt_irrefl _ (f.translationNumber_lt_of_forall_lt_add hf H) [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f a : ℝ ha : ↑f a ≤ a + τ f ⊢ ∃ x, x + τ f ≤ ↑f x [PROOFSTEP] by_contra' H [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f a : ℝ ha : ↑f a ≤ a + τ f H : ∀ (x : ℝ), ↑f x < x + τ f ⊢ False [PROOFSTEP] exact lt_irrefl _ (f.translationNumber_lt_of_forall_lt_add hf H) [GOAL] case intro.intro f g : CircleDeg1Lift hf : Continuous ↑f a : ℝ ha : ↑f a ≤ a + τ f b : ℝ hb : b + τ f ≤ ↑f b ⊢ ∃ x, ↑f x = x + τ f [PROOFSTEP] exact intermediate_value_univ₂ hf (continuous_id.add continuous_const) ha hb [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ ⊢ τ f = ↑m ↔ ∃ x, ↑f x = x + ↑m [PROOFSTEP] constructor [GOAL] case mp f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ ⊢ τ f = ↑m → ∃ x, ↑f x = x + ↑m [PROOFSTEP] intro h [GOAL] case mp f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ h : τ f = ↑m ⊢ ∃ x, ↑f x = x + ↑m [PROOFSTEP] simp only [← h] [GOAL] case mp f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ h : τ f = ↑m ⊢ ∃ x, ↑f x = x + τ f [PROOFSTEP] exact f.exists_eq_add_translationNumber hf [GOAL] case mpr f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ ⊢ (∃ x, ↑f x = x + ↑m) → τ f = ↑m [PROOFSTEP] rintro ⟨x, hx⟩ [GOAL] case mpr.intro f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ x : ℝ hx : ↑f x = x + ↑m ⊢ τ f = ↑m [PROOFSTEP] exact f.translationNumber_of_eq_add_int hx [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f n : ℕ ⊢ Continuous ↑(f ^ n) [PROOFSTEP] rw [coe_pow] [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f n : ℕ ⊢ Continuous (↑f)^[n] [PROOFSTEP] exact hf.iterate n [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ n : ℕ hn : 0 < n ⊢ τ f = ↑m / ↑n ↔ ∃ x, ↑(f ^ n) x = x + ↑m [PROOFSTEP] rw [eq_div_iff, mul_comm, ← translationNumber_pow] <;> [skip; exact ne_of_gt (Nat.cast_pos.2 hn)] [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ n : ℕ hn : 0 < n ⊢ τ f = ↑m / ↑n ↔ ∃ x, ↑(f ^ n) x = x + ↑m [PROOFSTEP] rw [eq_div_iff, mul_comm, ← translationNumber_pow] [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ n : ℕ hn : 0 < n ⊢ τ (f ^ n) = ↑m ↔ ∃ x, ↑(f ^ n) x = x + ↑m [PROOFSTEP] skip [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ n : ℕ hn : 0 < n ⊢ ↑n ≠ 0 [PROOFSTEP] exact ne_of_gt (Nat.cast_pos.2 hn) [GOAL] f g : CircleDeg1Lift hf : Continuous ↑f m : ℤ n : ℕ hn : 0 < n ⊢ τ (f ^ n) = ↑m ↔ ∃ x, ↑(f ^ n) x = x + ↑m [PROOFSTEP] exact (f ^ n).translationNumber_eq_int_iff (f.continuous_pow hf n) [GOAL] f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) ⊢ ∃ F, ∀ (g : G), Semiconj ↑F ↑(↑f₁ g) ↑(↑f₂ g) [PROOFSTEP] have : ∀ x, BddAbove (range fun g => f₂ g⁻¹ (f₁ g x)) := by refine' fun x => ⟨x + 2, _⟩ rintro _ ⟨g, rfl⟩ have : τ (f₂ g⁻¹) = -τ (f₂ g) := by rw [← MonoidHom.coe_toHomUnits, MonoidHom.map_inv, translationNumber_units_inv, MonoidHom.coe_toHomUnits] calc f₂ g⁻¹ (f₁ g x) ≤ f₂ g⁻¹ (x + τ (f₁ g) + 1) := mono _ (map_lt_add_translationNumber_add_one _ _).le _ = f₂ g⁻¹ (x + τ (f₂ g)) + 1 := by rw [h, map_add_one] _ ≤ x + τ (f₂ g) + τ (f₂ g⁻¹) + 1 + 1 := (add_le_add_right (map_lt_add_translationNumber_add_one _ _).le _) _ = x + 2 := by simp [this, add_assoc, one_add_one_eq_two] -- We have a theorem about actions by `OrderIso`, so we introduce auxiliary maps -- to `ℝ ≃o ℝ`. [GOAL] f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) ⊢ ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) [PROOFSTEP] refine' fun x => ⟨x + 2, _⟩ [GOAL] f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) x : ℝ ⊢ x + 2 ∈ upperBounds (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) [PROOFSTEP] rintro _ ⟨g, rfl⟩ [GOAL] case intro f g✝ : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) x : ℝ g : G ⊢ (fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) g ≤ x + 2 [PROOFSTEP] have : τ (f₂ g⁻¹) = -τ (f₂ g) := by rw [← MonoidHom.coe_toHomUnits, MonoidHom.map_inv, translationNumber_units_inv, MonoidHom.coe_toHomUnits] [GOAL] f g✝ : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) x : ℝ g : G ⊢ τ (↑f₂ g⁻¹) = -τ (↑f₂ g) [PROOFSTEP] rw [← MonoidHom.coe_toHomUnits, MonoidHom.map_inv, translationNumber_units_inv, MonoidHom.coe_toHomUnits] [GOAL] case intro f g✝ : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) x : ℝ g : G this : τ (↑f₂ g⁻¹) = -τ (↑f₂ g) ⊢ (fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) g ≤ x + 2 [PROOFSTEP] calc f₂ g⁻¹ (f₁ g x) ≤ f₂ g⁻¹ (x + τ (f₁ g) + 1) := mono _ (map_lt_add_translationNumber_add_one _ _).le _ = f₂ g⁻¹ (x + τ (f₂ g)) + 1 := by rw [h, map_add_one] _ ≤ x + τ (f₂ g) + τ (f₂ g⁻¹) + 1 + 1 := (add_le_add_right (map_lt_add_translationNumber_add_one _ _).le _) _ = x + 2 := by simp [this, add_assoc, one_add_one_eq_two] -- We have a theorem about actions by `OrderIso`, so we introduce auxiliary maps -- to `ℝ ≃o ℝ`. [GOAL] f g✝ : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) x : ℝ g : G this : τ (↑f₂ g⁻¹) = -τ (↑f₂ g) ⊢ ↑(↑f₂ g⁻¹) (x + τ (↑f₁ g) + 1) = ↑(↑f₂ g⁻¹) (x + τ (↑f₂ g)) + 1 [PROOFSTEP] rw [h, map_add_one] [GOAL] f g✝ : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) x : ℝ g : G this : τ (↑f₂ g⁻¹) = -τ (↑f₂ g) ⊢ x + τ (↑f₂ g) + τ (↑f₂ g⁻¹) + 1 + 1 = x + 2 [PROOFSTEP] simp [this, add_assoc, one_add_one_eq_two] -- We have a theorem about actions by `OrderIso`, so we introduce auxiliary maps -- to `ℝ ≃o ℝ`. [GOAL] f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) ⊢ ∃ F, ∀ (g : G), Semiconj ↑F ↑(↑f₁ g) ↑(↑f₂ g) [PROOFSTEP] set F₁ := toOrderIso.comp f₁.toHomUnits [GOAL] f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) ⊢ ∃ F, ∀ (g : G), Semiconj ↑F ↑(↑f₁ g) ↑(↑f₂ g) [PROOFSTEP] set F₂ := toOrderIso.comp f₂.toHomUnits [GOAL] f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) ⊢ ∃ F, ∀ (g : G), Semiconj ↑F ↑(↑f₁ g) ↑(↑f₂ g) [PROOFSTEP] have hF₁ : ∀ g, ⇑(F₁ g) = f₁ g := fun _ => rfl [GOAL] f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) ⊢ ∃ F, ∀ (g : G), Semiconj ↑F ↑(↑f₁ g) ↑(↑f₂ g) [PROOFSTEP] have hF₂ : ∀ g, ⇑(F₂ g) = f₂ g := fun _ => rfl [GOAL] f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) hF₂ : ∀ (g : G), ↑(↑F₂ g) = ↑(↑f₂ g) ⊢ ∃ F, ∀ (g : G), Semiconj ↑F ↑(↑f₁ g) ↑(↑f₂ g) [PROOFSTEP] refine' ⟨⟨⟨_, fun x y hxy => _⟩, fun x => _⟩, csSup_div_semiconj F₂ F₁ fun x => _⟩ [GOAL] case refine'_1 f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) hF₂ : ∀ (g : G), ↑(↑F₂ g) = ↑(↑f₂ g) x y : ℝ hxy : x ≤ y ⊢ sSup (range fun g' => ↑(↑F₂ g')⁻¹ (↑(↑F₁ g') x)) ≤ sSup (range fun g' => ↑(↑F₂ g')⁻¹ (↑(↑F₁ g') y)) [PROOFSTEP] simp only [hF₁, hF₂, ← map_inv, coe_mk] [GOAL] case refine'_2 f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) hF₂ : ∀ (g : G), ↑(↑F₂ g) = ↑(↑f₂ g) x : ℝ ⊢ OrderHom.toFun { toFun := fun x => sSup (range fun g' => ↑(↑F₂ g')⁻¹ (↑(↑F₁ g') x)), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → sSup (range fun g' => ↑(↑F₂ g')⁻¹ (↑(↑F₁ g') x)) ≤ sSup (range fun g' => ↑(↑F₂ g')⁻¹ (↑(↑F₁ g') y))) } (x + 1) = OrderHom.toFun { toFun := fun x => sSup (range fun g' => ↑(↑F₂ g')⁻¹ (↑(↑F₁ g') x)), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → sSup (range fun g' => ↑(↑F₂ g')⁻¹ (↑(↑F₁ g') x)) ≤ sSup (range fun g' => ↑(↑F₂ g')⁻¹ (↑(↑F₁ g') y))) } x + 1 [PROOFSTEP] simp only [hF₁, hF₂, ← map_inv, coe_mk] [GOAL] case refine'_3 f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) hF₂ : ∀ (g : G), ↑(↑F₂ g) = ↑(↑f₂ g) x : ℝ ⊢ BddAbove (range fun g => ↑(↑F₂ g)⁻¹ (↑(↑F₁ g) x)) [PROOFSTEP] simp only [hF₁, hF₂, ← map_inv, coe_mk] [GOAL] case refine'_1 f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) hF₂ : ∀ (g : G), ↑(↑F₂ g) = ↑(↑f₂ g) x y : ℝ hxy : x ≤ y ⊢ sSup (range fun g' => ↑(↑f₂ g'⁻¹) (↑(↑f₁ g') x)) ≤ sSup (range fun g' => ↑(↑f₂ g'⁻¹) (↑(↑f₁ g') y)) [PROOFSTEP] exact ciSup_mono (this y) fun g => mono _ (mono _ hxy) [GOAL] case refine'_2 f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) hF₂ : ∀ (g : G), ↑(↑F₂ g) = ↑(↑f₂ g) x : ℝ ⊢ sSup (range fun g' => ↑(↑f₂ g'⁻¹) (↑(↑f₁ g') (x + 1))) = sSup (range fun g' => ↑(↑f₂ g'⁻¹) (↑(↑f₁ g') x)) + 1 [PROOFSTEP] simp only [map_add_one] [GOAL] case refine'_2 f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) hF₂ : ∀ (g : G), ↑(↑F₂ g) = ↑(↑f₂ g) x : ℝ ⊢ sSup (range fun g' => ↑(↑f₂ g'⁻¹) (↑(↑f₁ g') x) + 1) = sSup (range fun g' => ↑(↑f₂ g'⁻¹) (↑(↑f₁ g') x)) + 1 [PROOFSTEP] exact (Monotone.map_ciSup_of_continuousAt (continuousAt_id.add continuousAt_const) (monotone_id.add_const (1 : ℝ)) (this x)).symm [GOAL] case refine'_3 f g : CircleDeg1Lift G : Type u_1 inst✝ : Group G f₁ f₂ : G →* CircleDeg1Lift h : ∀ (g : G), τ (↑f₁ g) = τ (↑f₂ g) this : ∀ (x : ℝ), BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) F₁ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₁) F₂ : G →* ℝ ≃o ℝ := MonoidHom.comp toOrderIso (MonoidHom.toHomUnits f₂) hF₁ : ∀ (g : G), ↑(↑F₁ g) = ↑(↑f₁ g) hF₂ : ∀ (g : G), ↑(↑F₂ g) = ↑(↑f₂ g) x : ℝ ⊢ BddAbove (range fun g => ↑(↑f₂ g⁻¹) (↑(↑f₁ g) x)) [PROOFSTEP] exact this x [GOAL] f g : CircleDeg1Lift f₁ f₂ : CircleDeg1Liftˣ h : τ ↑f₁ = τ ↑f₂ n : Multiplicative ℤ ⊢ τ (↑(MonoidHom.comp (Units.coeHom CircleDeg1Lift) (↑(zpowersHom CircleDeg1Liftˣ) f₁)) n) = τ (↑(MonoidHom.comp (Units.coeHom CircleDeg1Lift) (↑(zpowersHom CircleDeg1Liftˣ) f₂)) n) [PROOFSTEP] simp [h] [GOAL] f g : CircleDeg1Lift f₁ f₂ : CircleDeg1Liftˣ h : τ ↑f₁ = τ ↑f₂ this : ∀ (n : Multiplicative ℤ), τ (↑(MonoidHom.comp (Units.coeHom CircleDeg1Lift) (↑(zpowersHom CircleDeg1Liftˣ) f₁)) n) = τ (↑(MonoidHom.comp (Units.coeHom CircleDeg1Lift) (↑(zpowersHom CircleDeg1Liftˣ) f₂)) n) F : CircleDeg1Lift hF : ∀ (g : Multiplicative ℤ), Semiconj ↑F ↑(↑(MonoidHom.comp (Units.coeHom CircleDeg1Lift) (↑(zpowersHom CircleDeg1Liftˣ) f₁)) g) ↑(↑(MonoidHom.comp (Units.coeHom CircleDeg1Lift) (↑(zpowersHom CircleDeg1Liftˣ) f₂)) g) ⊢ Semiconj ↑F ↑↑f₁ ↑↑f₂ [PROOFSTEP] simpa using hF (Multiplicative.ofAdd 1) [GOAL] f g f₁ f₂ : CircleDeg1Lift h₁ : IsUnit f₁ h₂ : IsUnit f₂ h : τ f₁ = τ f₂ ⊢ ∃ F, Semiconj ↑F ↑f₁ ↑f₂ [PROOFSTEP] rcases h₁, h₂ with ⟨⟨f₁, rfl⟩, ⟨f₂, rfl⟩⟩ [GOAL] case intro.intro f g : CircleDeg1Lift f₁ f₂ : CircleDeg1Liftˣ h : τ ↑f₁ = τ ↑f₂ ⊢ ∃ F, Semiconj ↑F ↑↑f₁ ↑↑f₂ [PROOFSTEP] exact units_semiconj_of_translationNumber_eq h
An exhibition exploring five centuries of fashion and adornment at Chatsworth. Hamish Bowles, International Editor-at-Large at American Vogue, will curate this landmark show with creative direction and design by Patrick Kinmonth and Antonio Monfreda, the duo behind some of the most memorable fashion exhibitions of recent years. House Style will demonstrate the power of fashion and bring to life the captivating individuals from the Cavendish family, including Bess of Hardwick, one of the most powerful women of the 16th century; the 18th century “Empress of Fashion” Georgiana, Duchess of Devonshire; and Adele Astaire, the sister and dance partner of Fred Astaire. Deborah Devonshire and Nancy Mitford, two of the Mitford sisters; model Stella Tennant and John F Kennedy’s sister ‘Kick’ Kennedy will also be central to the show.
%\documentclass{acm_proc_article-sp} \documentclass{sig-alternate-2013} \usepackage{balance} \usepackage{syntax} \usepackage{graphics} \usepackage[textsize=footnotesize,bordercolor=black!20]{todonotes} \usepackage{microtype} \usepackage[T1]{fontenc} \usepackage[scaled]{beramono} \usepackage{listings} \usepackage{url} \newcommand{\claim}[1]{#1} \newfont{\mycrnotice}{ptmr8t at 7pt} \newfont{\myconfname}{ptmri8t at 7pt} \let\crnotice\mycrnotice% \let\confname\myconfname% \permission{This work is licensed under the Creative Commons Attribution-ShareAlike~3.0 Unported License (CC BY-SA 3.0). To view a copy of the license, visit http://creativecommons.org/licenses/by-sa/3.0/. \\} \conferenceinfo{DChanges 2013,}{September 10th, 2013, Florence, Italy.} \copyrightetc{ceur-ws.org \the\acmcopyr} \crdata{Volume 1008, http://ceur-ws.org/Vol-1008/paper2.pdf } \clubpenalty=10000 \widowpenalty = 10000 \newcommand{\matt}[1]{\todo[inline,color=yellow!8]{#1}} \newcommand{\jason}[1]{\todo[inline,color=green!8]{#1}} \definecolor{javared}{rgb}{0.6,0,0} % for strings \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc \newcommand\Small{\fontsize{8}{8.0}\selectfont} \newcommand*\LSTfont{\Small\ttfamily\SetTracking{encoding=*}{-60}\lsstyle} \lstset{language=Java, %basicstyle=\ttfamily, %% JED: Kill these lines if you want black&white keywordstyle=\color{javapurple}\bfseries, stringstyle=\color{javared}, commentstyle=\color{javagreen}, morecomment=[s][\color{javadocblue}]{/**}{*/}, morecomment=[l][\bfseries\color{javared}]{>-\ }, morecomment=[l][\color{javared}]{-\ }, morecomment=[l][\color{javagreen}]{+\ }, tabsize=4, showspaces=false, showstringspaces=false} \lstnewenvironment{java}[1][] {\lstset{#1, frame=single, captionpos=b, basicstyle=\LSTfont, escapeinside={$}{$}}} %% basicstyle=\scriptsize\ttfamily}} %% basicstyle=\footnotesize\ttfamily}} {} \newcommand{\metavar}{$\square$} %\newcommand{\metavar}{$\bullet$} %\newcommand{\metavar}{\rule{1em}{1em}} \begin{document} \title{Identifying change patterns in software history} % % You need the command \numberofauthors to handle the 'placement % and alignment' of the authors beneath the title. % % For aesthetic reasons, we recommend 'three authors at a time' % i.e. three 'name/affiliation blocks' be placed beneath the title. % % NOTE: You are NOT restricted in how many 'rows' of % "name/affiliations" may appear. We just ask that you restrict % the number of 'columns' to three. % % Because of the available 'opening page real-estate' % we ask you to refrain from putting more than six authors % (two rows with three columns) beneath the article title. % More than six makes the first-page appear very cluttered indeed. % % Use the \alignauthor commands to handle the names % and affiliations for an 'aesthetic maximum' of six authors. % Add names, affiliations, addresses for % the seventh etc. author(s) as the argument for the % \additionalauthors command. % These 'additional authors' will be output/set for you % without further effort on your part as the last section in % the body of your article BEFORE References or any Appendices. \numberofauthors{2} % in this sample file, there are a *total* % of EIGHT authors. SIX appear on the 'first-page' (for formatting % reasons) and the remaining two appear in the \additionalauthors section. % \author{ % You can go ahead and credit any number of authors here, % e.g. one 'row of three' or two rows (consisting of one row of three % and a second row of one, two or three). % % The command \alignauthor (no curly braces needed) should % precede each author name, affiliation/snail-mail address and % e-mail address. Additionally, tag each line of % affiliation/address with \affaddr, and tag the % e-mail address with \email. % % 1st. author \alignauthor Jason Dagit\\ \affaddr{Galois, Inc}\\ \affaddr{Portland, OR}\\ \email{[email protected]} % 2nd. author \alignauthor Matthew Sottile\\ \affaddr{Galois, Inc}\\ \affaddr{Portland, OR}\\ \email{[email protected]} } \date{4 July 2013} % Just remember to make sure that the TOTAL number of authors % is the number that will appear on the first page PLUS the % number that will appear in the \additionalauthors section. \maketitle \begin{abstract} %% Submitted abstract %%Traditional algorithms for detecting differences in source code focus on %%differences between lines. As such, little can be learned about abstract %%changes that occur over time within a project. Structural differencing on the %%program parse tree reveals changes at the syntactic level within code, which %%allows us to further process the differences to understand their meaning. We %%propose that clustering of changes by some metric of similarity, followed by %%pattern extraction via antiunification will allow us to identify patterns of %%change within a software project from the sequence of changes contained %%within a Version Control System (VCS). Tree similarity metrics such as a tree %%edit distance can be used to cluster changes in order to identify groupings %%that may represent a single class of change (e.g., adding a %%parameter to a function call). By applying antiunification within each cluster %%we are able to generalize from families of concrete changes to patterns of %%structural change. Studying patterns of change at the structural level, %%instead of line-by-line, allows us to gain insight into the evolution of %%software. Traditional algorithms for detecting differences in source code focus on differences between lines. As such, little can be learned about abstract changes that occur over time within a project. Structural differencing on the program's abstract syntax tree reveals changes at the syntactic level within code, which allows us to further process the differences to understand their meaning. We propose that grouping of changes by some metric of similarity, followed by pattern extraction via antiunification will allow us to identify patterns of change within a software project from the sequence of changes contained within a Version Control System (VCS). Tree similarity metrics such as a tree edit distance can be used to group changes in order to identify groupings that may represent a single class of change (e.g., adding a parameter to a function call). By applying antiunification within each group we are able to generalize from families of concrete changes to patterns of structural change. Studying patterns of change at the structural level, instead of line-by-line, allows us to gain insight into the evolution of software. \end{abstract} % TODO: edit categories % A category with the (minimum) three required fields %%\category{H.4}{Information Systems Applications}{Miscellaneous} %A category including the fourth, optional field follows... %%\category{D.2.8}{Software Engineering}{Metrics}[complexity measures, performance measures] %\terms{Theory} % TODO: changeme \keywords{version control, structural differencing, antiunification, software evolution} \input{intro} \input{methods} \input{experiment} \input{conclusion} %\end{document} % This is where a 'short' article might terminate %ACKNOWLEDGMENTS are optional % % The following two commands are all you need in the % initial runs of your .tex file to % produce the bibliography for the citations in your paper. \balance \bibliographystyle{abbrv} \bibliography{sigproc} % sigproc.bib is the name of the Bibliography in this case % You must have a proper ".bib" file % and remember to run: % latex bibtex latex latex % to resolve all references % % ACM needs 'a single self-contained file'! % %% %APPENDICES are optional %% %\balancecolumns %% \appendix %% %Appendix A %% \section{Headings in Appendices} %% The rules about hierarchical headings discussed above for %% the body of the article are different in the appendices. %% In the \textbf{appendix} environment, the command %% \textbf{section} is used to %% indicate the start of each Appendix, with alphabetic order %% designation (i.e. the first is A, the second B, etc.) and %% a title (if you include one). So, if you need %% hierarchical structure %% \textit{within} an Appendix, start with \textbf{subsection} as the %% highest level. Here is an outline of the body of this %% document in Appendix-appropriate form: %% \subsection{Introduction} %% \subsection{The Body of the Paper} %% \subsubsection{Type Changes and Special Characters} %% \subsubsection{Math Equations} %% \paragraph{Inline (In-text) Equations} %% \paragraph{Display Equations} %% \subsubsection{Citations} %% \subsubsection{Tables} %% \subsubsection{Figures} %% \subsubsection{Theorem-like Constructs} %% \subsubsection*{A Caveat for the \TeX\ Expert} %% \subsection{Conclusions} %% \subsection{Acknowledgments} %% \subsection{Additional Authors} %% This section is inserted by \LaTeX; you do not insert it. %% You just add the names and information in the %% \texttt{{\char'134}additionalauthors} command at the start %% of the document. %% \subsection{References} %% Generated by bibtex from your ~.bib file. Run latex, %% then bibtex, then latex twice (to resolve references) %% to create the ~.bbl file. Insert that ~.bbl file into %% the .tex source file and comment out %% the command \texttt{{\char'134}thebibliography}. %% % This next section command marks the start of %% % Appendix B, and does not continue the present hierarchy %% \section{More Help for the Hardy} %% The acm\_proc\_article-sp document class file itself is chock-full of succinct %% and helpful comments. If you consider yourself a moderately %% experienced to expert user of \LaTeX, you may find reading %% it useful but please remember not to change it. %% \balancecolumns %% % That's all folks! \end{document}
[STATEMENT] lemma ir_runs2sigs_upd_resp_some [simp]: "\<lbrakk> runz Rb = Some (Resp, [A, B], []); finite (dom runz) \<rbrakk> \<Longrightarrow> ir_runs2sigs (runz(Rb \<mapsto> (Resp, [A, B], [aKey Kab, aNum Ts, aNum Ta]))) = (ir_runs2sigs runz)( Running [A, B] (Kab, Ts, Ta) := Suc (card (ir_running runz A B Kab Ts Ta)))" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>runz Rb = Some (Resp, [A, B], []); finite (dom runz)\<rbrakk> \<Longrightarrow> ir_runs2sigs (runz(Rb \<mapsto> (Resp, [A, B], [aKey Kab, aNum Ts, aNum Ta]))) = (ir_runs2sigs runz)(Running [A, B] (Kab, Ts, Ta) := Suc (card (ir_running runz A B Kab Ts Ta))) [PROOF STEP] by (intro ext ir_runs2sigs_upd_resp_some_raw)
module Selective.Examples.TestAO where open import Selective.ActorMonad open import Prelude open import Selective.Libraries.Call2 open import Selective.Libraries.ActiveObjects open import Debug open import Data.Nat.Show using (show) ℕ-ReplyMessage : MessageType ℕ-ReplyMessage = ValueType UniqueTag ∷ [ ValueType ℕ ]ˡ ℕ-Reply : InboxShape ℕ-Reply = [ ℕ-ReplyMessage ]ˡ ℕ×ℕ→ℕ-Message : MessageType ℕ×ℕ→ℕ-Message = ValueType UniqueTag ∷ ReferenceType ℕ-Reply ∷ ValueType ℕ ∷ [ ValueType ℕ ]ˡ Calculate : InboxShape Calculate = [ ℕ×ℕ→ℕ-Message ]ˡ CalculateProtocol : ChannelInitiation CalculateProtocol = record { request = Calculate ; response = record { channel-shape = ℕ-Reply ; all-tagged = (HasTag _) ∷ [] } ; request-tagged = [ HasTag+Ref _ ]ᵃ } ℕ×ℕ→ℕ-ci : ChannelInitiation ℕ×ℕ→ℕ-ci = record { request = Calculate ; response = record { channel-shape = ℕ-Reply ; all-tagged = (HasTag _) ∷ [] } ; request-tagged = (HasTag+Ref _) ∷ [] } add-method-header = ResponseMethod ℕ×ℕ→ℕ-ci multiply-method-header = ResponseMethod ℕ×ℕ→ℕ-ci calculator-methods : List ActiveMethod calculator-methods = add-method-header ∷ multiply-method-header ∷ [] calculator-inbox = methods-shape calculator-methods calculator-state-vars : ⊤₁ → TypingContext calculator-state-vars _ = [] add : (active-method calculator-inbox ⊤₁ calculator-state-vars add-method-header) add _ (_ sent Msg Z (n ∷ m ∷ [])) v = return₁ (record { new-state = _ ; reply = SendM Z [ lift (n + m)]ᵃ }) add _ (_ sent Msg (S ()) _) _ multiply : (active-method calculator-inbox ⊤₁ (λ _ → []) multiply-method-header) multiply _ (_ sent Msg Z (n ∷ m ∷ [])) v = return₁ (record { new-state = _ ; reply = SendM Z [ lift (n * m)]ᵃ }) multiply _ (_ sent Msg (S ()) _) _ calculator : ActiveObject calculator = record { state-type = ⊤₁ ; vars = calculator-state-vars ; methods = calculator-methods ; extra-messages = [] ; handlers = add ∷ multiply ∷ [] } calculator-actor = run-active-object calculator _ TestBox : InboxShape TestBox = ℕ-Reply -- import Selective.Examples.CalculatorProtocol as CP -- calculator-test-actor = CP.calculator-test-actor calculator-actor calculator-test-actor : ∀{i} → ∞ActorM i TestBox (Lift (lsuc lzero) ℕ) [] (λ _ → []) calculator-test-actor = do spawn∞ calculator-actor Msg Z (_ ∷ n ∷ []) ← call CalculateProtocol (record { var = Z ; chosen-field = Z ; fields = lift 32 ∷ [ lift 10 ]ᵃ ; session = record { can-request = [ Z ]ᵐ -- Pick add method ; response-session = record { can-receive = [ Z ]ᵐ ; tag = 0 } } }) where Msg (S ()) _ Msg Z (_ ∷ m ∷ []) ← debug (show n) (call CalculateProtocol (record { var = Z ; chosen-field = Z ; fields = lift n ∷ [ lift 10 ]ᵃ ; session = record { can-request = [ S Z ]ᵐ -- Pick multiply method ; response-session = record { can-receive = [ Z ]ᵐ ; tag = 1 } } })) where Msg (S ()) _ debug (show m) (strengthen []) return m
State Before: R : Type u_2 V : Type u_1 V' : Type ?u.135249 P : Type ?u.135252 P' : Type ?u.135255 inst✝⁷ : Ring R inst✝⁶ : Invertible 2 inst✝⁵ : AddCommGroup V inst✝⁴ : Module R V inst✝³ : AddTorsor V P inst✝² : AddCommGroup V' inst✝¹ : Module R V' inst✝ : AddTorsor V' P' x✝ y z : P x : V ⊢ midpoint R (-x) x = 0 State After: no goals Tactic: simpa using midpoint_self_neg R (-x)
{-# LANGUAGE TupleSections #-} {-| Copyright: This file is part of the package zxcvbn-hs. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at: https://code.devalot.com/sthenauth/zxcvbn-hs No part of this package, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file. License: MIT -} module Text.Password.Strength.Internal.Keyboard ( -- * Keyboard Pattern Matching KeyboardPattern, keyboardToken, keyboardPattern, keyboardEstimate ) where -------------------------------------------------------------------------------- -- Library Imports: import Control.Lens (Lens, (^.), _3) import Data.Foldable (foldl') import Numeric.SpecFunctions (choose) -------------------------------------------------------------------------------- -- Project Imports: import Text.Password.Strength.Internal.Adjacency import Text.Password.Strength.Internal.Token import Text.Password.Strength.Internal.Math (variations') -------------------------------------------------------------------------------- -- | Information about a found pattern. newtype KeyboardPattern = KeyboardPattern (Int, Int, Token, AdjacencyScore) deriving (Show) -------------------------------------------------------------------------------- -- | Allow other code to access the token used in a pattern. keyboardToken :: Lens KeyboardPattern KeyboardPattern Token Token keyboardToken f (KeyboardPattern t) = KeyboardPattern <$> _3 f t -------------------------------------------------------------------------------- -- | Helper function to check if a token forms a keyboard pattern. keyboardPattern :: AdjacencyTable -> Token -> Maybe KeyboardPattern keyboardPattern graph token = KeyboardPattern . (graph ^. totalChars, graph ^. averageNeighbors, token,) . foldl' scoreSequence mempty <$> findSequence (token ^. tokenChars) graph -------------------------------------------------------------------------------- -- | Estimate the number of guesses needed for a keyboard pattern to -- be cracked. keyboardEstimate :: KeyboardPattern -> Integer keyboardEstimate (KeyboardPattern (s, d, _, a)) = e3 * e2 (a ^. primaryLayer) (a ^. secondaryLayer) where -- Equation 3, section 4, page 163 (8/18) -- -- Deviations from the paper or other implementations: -- -- * There's a typo in the paper: min(T, i - i) -- but should be: min(T, i - 1) -- -- * Another typo, i should start at 2 and not 1. -- -- * The other implementations don't seem to divide the outer -- sum by two but the equation clearly does. e3 :: Integer e3 = max 1 . (`div` 2) . sum $ do i <- [2 .. (a ^. patternLength)] j <- [1 .. min (a ^. totalTurns) (i - 1)] pure $ floor (choose (i - 1) (j - 1)) * toInteger s * (toInteger d ^ j) -- Modified version of equation 2 for primary layer vs. secondary. e2 :: Int -> Int -> Integer e2 = variations'
[STATEMENT] lemma horizontal_chop_empty_right :"\<forall>v. \<exists> u. (v=v\<parallel>u)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<forall>v. \<exists>u. v=v\<parallel>u [PROOF STEP] using hchop_def real_int.chop_singleton_right [PROOF STATE] proof (prove) using this: ?v=?u\<parallel>?w \<equiv> R_Chop(ext ?v,ext ?u,ext ?w) \<and> lan ?v = lan ?u \<and> lan ?v = lan ?w \<and> own ?v = own ?u \<and> own ?v = own ?w \<and> more ?v = more ?w \<and> more ?v = more ?u \<forall>r. \<exists>s. R_Chop(r,r,s) goal (1 subgoal): 1. \<forall>v. \<exists>u. v=v\<parallel>u [PROOF STEP] by (metis (no_types, opaque_lifting) select_convs)
Require Export PredMonad.Ordered4.Monad. Import OTNotations. (*** *** Monads with State Effects ***) (* State effects = get and put *) Class MonadStateOps `(MOps:MonadOps) `(St:OType) : Type := { getM : M @t@ St ; putM : St -o> M @t@ OTunit }. Class MonadState `{MonadStateOps} : Prop := { monad_state_monad :> Monad MOps; monad_state_get : forall `{A:OType} (m : M @t@ A), bindM @o@ getM @o@ (mkOTerm _ (fun _ => m)) =o= m ; monad_state_get_put : forall `{A:OType} (f : St -o> OTunit -o> M @t@ A), bindM @o@ getM @o@ (mkOTerm (St -o> M @t@ A) (fun s => bindM @o@ (putM @o@ s) @o@ (f @o@ s))) =o= bindM @o@ getM @o@ (mkOTerm (St -o> M @t@ A) (fun s => f @o@ s @o@ tt)) ; monad_state_put_get : forall `{A:OType} s (f : OTunit -o> St -o> M @t@ A), bindM @o@ (putM @o@ s) @o@ (mkOTerm (OTunit -o> M @t@ A) (fun u => bindM @o@ getM @o@ (f @o@ u))) =o= bindM @o@ (putM @o@ s) @o@ (mkOTerm (OTunit -o> M @t@ A) (fun u => f @o@ u @o@ s)) ; monad_state_put_put : forall `{A:OType} s1 s2 (f : OTunit -o> OTunit -o> M @t@ A), bindM @o@ (putM @o@ s1) @o@ (mkOTerm (OTunit -o> M @t@ A) (fun u => bindM @o@ (putM @o@ s2) @o@ (f @o@ u))) =o= bindM @o@ (putM @o@ s2) @o@ (f @o@ tt) }. (*** *** The State Monad Transformer ***) Instance StateT `(St:OType) `(MOps:MonadOps) : OTypeF (fun `(A:OType) => Pfun St (M @t@ (St *o* A))) (fun `(A:OType) => OTarrow_R St (M @t@ (St *o* A))) := fun `(A:OType) => St -o> M @t@ (St *o* A). Set Printing All. Typeclasses eauto := debug. Instance StateT_MonadOps `(St:OType) `(MOps:MonadOps) : MonadOps (StateT St MOps) := {returnM := fun `(A:OType) => mkOTerm (A -o> St -o> M @t@ (St *o* A)) (fun x s => returnM @o@ (s, x)); bindM := fun A B m f => fun s => do s_x <- m s; f (snd s_x) (fst s_x); lrM := fun {A} _ => LR_Op_fun }. (* The Monad instance for StateT *) Global Instance StateT_Monad : Monad (StateT). Proof. constructor; intros; unfold StateT, returnM, bindM, lrM, StateT_MonadOps. - auto with typeclass_instances. - prove_lr_proper. - prove_lr_proper. - intros R1 R2 subR; apply LRFun_Proper_subrelation; apply monad_proper_lrM; apply LRPair_Proper_subrelation; try assumption; reflexivity. - prove_lr. - transitivity (fun s => do s_x <- m s; returnM s_x). + split; build_lr_fun; apply monad_proper_bind; prove_lr. + prove_lr; autorewrite with LR; prove_lr. - prove_lr. Qed. Global Instance StateT_MonadStateOps : MonadStateOps S StateT := { getM := fun s => returnM (s, s) ; putM := fun s _ => returnM (s, tt) }. Global Instance StateT_MonadState : MonadState S StateT. Proof. constructor; intros; unfold StateT, returnM, bindM, lrM, getM, putM, StateT_MonadOps, StateT_MonadStateOps. - auto with typeclass_instances. - prove_lr_proper. - prove_lr_proper. - prove_lr. - prove_lr. - prove_lr. - prove_lr. Qed. End StateT.
*----------------------------------------------------------------------* subroutine file_list2arr2(fl_list,fl_arr,nfiles) *----------------------------------------------------------------------* * set up an array of pointers that point to the entries of the * list on fl_list * new version with a real pointer array *----------------------------------------------------------------------* implicit none include 'stdunit.h' include 'def_filinf.h' include 'def_file_list.h' include 'def_file_array.h' type(file_list), intent(in), target :: & fl_list integer, intent(in) :: & nfiles type(file_array), intent(out) :: & fl_arr(nfiles) type(file_list), pointer :: & current integer :: & ifile current => fl_list do ifile = 1, nfiles if (.not.associated(current%fhand)) & call quit(1,'file_list2arr2', & 'unallocated file handle on list') fl_arr(ifile)%fhand => current%fhand if (ifile.lt.nfiles.and..not.(associated(current%next))) & call quit(1,'file_list2arr2','unexpected end of list') current => current%next end do return end
import algebra.star.pi lemma function.star_sum_elim {I J α : Type*} (x : I → α) (y : J → α) [has_star α] : star (sum.elim x y) = sum.elim (star x) (star y) := by { ext x, cases x; simp }
lemma complex_is_Int_iff: "z \<in> \<int> \<longleftrightarrow> Im z = 0 \<and> (\<exists>i. Re z = of_int i)"
(* Title: HOL/Library/RBT_Set.thy Author: Ondrej Kuncar *) section \<open>Implementation of sets using RBT trees\<close> theory RBT_Set imports RBT Product_Lexorder begin (* Users should be aware that by including this file all code equations outside of List.thy using 'a list as an implementation of sets cannot be used for code generation. If such equations are not needed, they can be deleted from the code generator. Otherwise, a user has to provide their own equations using RBT trees. *) section \<open>Definition of code datatype constructors\<close> definition Set :: "('a::linorder, unit) rbt \<Rightarrow> 'a set" where "Set t = {x . RBT.lookup t x = Some ()}" definition Coset :: "('a::linorder, unit) rbt \<Rightarrow> 'a set" where [simp]: "Coset t = - Set t" section \<open>Deletion of already existing code equations\<close> lemma [code, code del]: "Set.empty = Set.empty" .. lemma [code, code del]: "Set.is_empty = Set.is_empty" .. lemma [code, code del]: "uminus_set_inst.uminus_set = uminus_set_inst.uminus_set" .. lemma [code, code del]: "Set.member = Set.member" .. lemma [code, code del]: "Set.insert = Set.insert" .. lemma [code, code del]: "Set.remove = Set.remove" .. lemma [code, code del]: "UNIV = UNIV" .. lemma [code, code del]: "Set.filter = Set.filter" .. lemma [code, code del]: "image = image" .. lemma [code, code del]: "Set.subset_eq = Set.subset_eq" .. lemma [code, code del]: "Ball = Ball" .. lemma [code, code del]: "Bex = Bex" .. lemma [code, code del]: "can_select = can_select" .. lemma [code, code del]: "Set.union = Set.union" .. lemma [code, code del]: "minus_set_inst.minus_set = minus_set_inst.minus_set" .. lemma [code, code del]: "Set.inter = Set.inter" .. lemma [code, code del]: "card = card" .. lemma [code, code del]: "the_elem = the_elem" .. lemma [code, code del]: "Pow = Pow" .. lemma [code, code del]: "sum = sum" .. lemma [code, code del]: "prod = prod" .. lemma [code, code del]: "Product_Type.product = Product_Type.product" .. lemma [code, code del]: "Id_on = Id_on" .. lemma [code, code del]: "Image = Image" .. lemma [code, code del]: "trancl = trancl" .. lemma [code, code del]: "relcomp = relcomp" .. lemma [code, code del]: "wf = wf" .. lemma [code, code del]: "Min = Min" .. lemma [code, code del]: "Inf_fin = Inf_fin" .. lemma [code, code del]: "INFIMUM = INFIMUM" .. lemma [code, code del]: "Max = Max" .. lemma [code, code del]: "Sup_fin = Sup_fin" .. lemma [code, code del]: "SUPREMUM = SUPREMUM" .. lemma [code, code del]: "(Inf :: 'a set set \<Rightarrow> 'a set) = Inf" .. lemma [code, code del]: "(Sup :: 'a set set \<Rightarrow> 'a set) = Sup" .. lemma [code, code del]: "sorted_list_of_set = sorted_list_of_set" .. lemma [code, code del]: "List.map_project = List.map_project" .. lemma [code, code del]: "List.Bleast = List.Bleast" .. section \<open>Lemmas\<close> subsection \<open>Auxiliary lemmas\<close> lemma Set_set_keys: "Set x = dom (RBT.lookup x)" by (auto simp: Set_def) lemma finite_Set [simp, intro!]: "finite (Set x)" by (simp add: Set_set_keys) lemma set_keys: "Set t = set(RBT.keys t)" by (simp add: Set_set_keys lookup_keys) subsection \<open>fold and filter\<close> lemma finite_fold_rbt_fold_eq: assumes "comp_fun_commute f" shows "Finite_Set.fold f A (set (RBT.entries t)) = RBT.fold (curry f) t A" proof - have *: "remdups (RBT.entries t) = RBT.entries t" using distinct_entries distinct_map by (auto intro: distinct_remdups_id) show ?thesis using assms by (auto simp: fold_def_alt comp_fun_commute.fold_set_fold_remdups *) qed definition fold_keys :: "('a :: linorder \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> ('a, _) rbt \<Rightarrow> 'b \<Rightarrow> 'b" where [code_unfold]:"fold_keys f t A = RBT.fold (\<lambda>k _ t. f k t) t A" lemma fold_keys_def_alt: "fold_keys f t s = List.fold f (RBT.keys t) s" by (auto simp: fold_map o_def split_def fold_def_alt keys_def_alt fold_keys_def) lemma finite_fold_fold_keys: assumes "comp_fun_commute f" shows "Finite_Set.fold f A (Set t) = fold_keys f t A" using assms proof - interpret comp_fun_commute f by fact have "set (RBT.keys t) = fst ` (set (RBT.entries t))" by (auto simp: fst_eq_Domain keys_entries) moreover have "inj_on fst (set (RBT.entries t))" using distinct_entries distinct_map by auto ultimately show ?thesis by (auto simp add: set_keys fold_keys_def curry_def fold_image finite_fold_rbt_fold_eq comp_comp_fun_commute) qed definition rbt_filter :: "('a :: linorder \<Rightarrow> bool) \<Rightarrow> ('a, 'b) rbt \<Rightarrow> 'a set" where "rbt_filter P t = RBT.fold (\<lambda>k _ A'. if P k then Set.insert k A' else A') t {}" lemma Set_filter_rbt_filter: "Set.filter P (Set t) = rbt_filter P t" by (simp add: fold_keys_def Set_filter_fold rbt_filter_def finite_fold_fold_keys[OF comp_fun_commute_filter_fold]) subsection \<open>foldi and Ball\<close> lemma Ball_False: "RBT_Impl.fold (\<lambda>k v s. s \<and> P k) t False = False" by (induction t) auto lemma rbt_foldi_fold_conj: "RBT_Impl.foldi (\<lambda>s. s = True) (\<lambda>k v s. s \<and> P k) t val = RBT_Impl.fold (\<lambda>k v s. s \<and> P k) t val" proof (induction t arbitrary: val) case (Branch c t1) then show ?case by (cases "RBT_Impl.fold (\<lambda>k v s. s \<and> P k) t1 True") (simp_all add: Ball_False) qed simp lemma foldi_fold_conj: "RBT.foldi (\<lambda>s. s = True) (\<lambda>k v s. s \<and> P k) t val = fold_keys (\<lambda>k s. s \<and> P k) t val" unfolding fold_keys_def including rbt.lifting by transfer (rule rbt_foldi_fold_conj) subsection \<open>foldi and Bex\<close> lemma Bex_True: "RBT_Impl.fold (\<lambda>k v s. s \<or> P k) t True = True" by (induction t) auto lemma rbt_foldi_fold_disj: "RBT_Impl.foldi (\<lambda>s. s = False) (\<lambda>k v s. s \<or> P k) t val = RBT_Impl.fold (\<lambda>k v s. s \<or> P k) t val" proof (induction t arbitrary: val) case (Branch c t1) then show ?case by (cases "RBT_Impl.fold (\<lambda>k v s. s \<or> P k) t1 False") (simp_all add: Bex_True) qed simp lemma foldi_fold_disj: "RBT.foldi (\<lambda>s. s = False) (\<lambda>k v s. s \<or> P k) t val = fold_keys (\<lambda>k s. s \<or> P k) t val" unfolding fold_keys_def including rbt.lifting by transfer (rule rbt_foldi_fold_disj) subsection \<open>folding over non empty trees and selecting the minimal and maximal element\<close> (** concrete **) (* The concrete part is here because it's probably not general enough to be moved to RBT_Impl *) definition rbt_fold1_keys :: "('a \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> ('a::linorder, 'b) RBT_Impl.rbt \<Rightarrow> 'a" where "rbt_fold1_keys f t = List.fold f (tl(RBT_Impl.keys t)) (hd(RBT_Impl.keys t))" (* minimum *) definition rbt_min :: "('a::linorder, unit) RBT_Impl.rbt \<Rightarrow> 'a" where "rbt_min t = rbt_fold1_keys min t" lemma key_le_right: "rbt_sorted (Branch c lt k v rt) \<Longrightarrow> (\<And>x. x \<in>set (RBT_Impl.keys rt) \<Longrightarrow> k \<le> x)" by (auto simp: rbt_greater_prop less_imp_le) lemma left_le_key: "rbt_sorted (Branch c lt k v rt) \<Longrightarrow> (\<And>x. x \<in>set (RBT_Impl.keys lt) \<Longrightarrow> x \<le> k)" by (auto simp: rbt_less_prop less_imp_le) lemma fold_min_triv: fixes k :: "_ :: linorder" shows "(\<forall>x\<in>set xs. k \<le> x) \<Longrightarrow> List.fold min xs k = k" by (induct xs) (auto simp add: min_def) lemma rbt_min_simps: "is_rbt (Branch c RBT_Impl.Empty k v rt) \<Longrightarrow> rbt_min (Branch c RBT_Impl.Empty k v rt) = k" by (auto intro: fold_min_triv dest: key_le_right is_rbt_rbt_sorted simp: rbt_fold1_keys_def rbt_min_def) fun rbt_min_opt where "rbt_min_opt (Branch c RBT_Impl.Empty k v rt) = k" | "rbt_min_opt (Branch c (Branch lc llc lk lv lrt) k v rt) = rbt_min_opt (Branch lc llc lk lv lrt)" lemma rbt_min_opt_Branch: "t1 \<noteq> rbt.Empty \<Longrightarrow> rbt_min_opt (Branch c t1 k () t2) = rbt_min_opt t1" by (cases t1) auto lemma rbt_min_opt_induct [case_names empty left_empty left_non_empty]: fixes t :: "('a :: linorder, unit) RBT_Impl.rbt" assumes "P rbt.Empty" assumes "\<And>color t1 a b t2. P t1 \<Longrightarrow> P t2 \<Longrightarrow> t1 = rbt.Empty \<Longrightarrow> P (Branch color t1 a b t2)" assumes "\<And>color t1 a b t2. P t1 \<Longrightarrow> P t2 \<Longrightarrow> t1 \<noteq> rbt.Empty \<Longrightarrow> P (Branch color t1 a b t2)" shows "P t" using assms proof (induct t) case Empty then show ?case by simp next case (Branch x1 t1 x3 x4 t2) then show ?case by (cases "t1 = rbt.Empty") simp_all qed lemma rbt_min_opt_in_set: fixes t :: "('a :: linorder, unit) RBT_Impl.rbt" assumes "t \<noteq> rbt.Empty" shows "rbt_min_opt t \<in> set (RBT_Impl.keys t)" using assms by (induction t rule: rbt_min_opt.induct) (auto) lemma rbt_min_opt_is_min: fixes t :: "('a :: linorder, unit) RBT_Impl.rbt" assumes "rbt_sorted t" assumes "t \<noteq> rbt.Empty" shows "\<And>y. y \<in> set (RBT_Impl.keys t) \<Longrightarrow> y \<ge> rbt_min_opt t" using assms proof (induction t rule: rbt_min_opt_induct) case empty then show ?case by simp next case left_empty then show ?case by (auto intro: key_le_right simp del: rbt_sorted.simps) next case (left_non_empty c t1 k v t2 y) then consider "y = k" | "y \<in> set (RBT_Impl.keys t1)" | "y \<in> set (RBT_Impl.keys t2)" by auto then show ?case proof cases case 1 with left_non_empty show ?thesis by (auto simp add: rbt_min_opt_Branch intro: left_le_key rbt_min_opt_in_set) next case 2 with left_non_empty show ?thesis by (auto simp add: rbt_min_opt_Branch) next case y: 3 have "rbt_min_opt t1 \<le> k" using left_non_empty by (simp add: left_le_key rbt_min_opt_in_set) moreover have "k \<le> y" using left_non_empty y by (simp add: key_le_right) ultimately show ?thesis using left_non_empty y by (simp add: rbt_min_opt_Branch) qed qed lemma rbt_min_eq_rbt_min_opt: assumes "t \<noteq> RBT_Impl.Empty" assumes "is_rbt t" shows "rbt_min t = rbt_min_opt t" proof - from assms have "hd (RBT_Impl.keys t) # tl (RBT_Impl.keys t) = RBT_Impl.keys t" by (cases t) simp_all with assms show ?thesis by (simp add: rbt_min_def rbt_fold1_keys_def rbt_min_opt_is_min Min.set_eq_fold [symmetric] Min_eqI rbt_min_opt_in_set) qed (* maximum *) definition rbt_max :: "('a::linorder, unit) RBT_Impl.rbt \<Rightarrow> 'a" where "rbt_max t = rbt_fold1_keys max t" lemma fold_max_triv: fixes k :: "_ :: linorder" shows "(\<forall>x\<in>set xs. x \<le> k) \<Longrightarrow> List.fold max xs k = k" by (induct xs) (auto simp add: max_def) lemma fold_max_rev_eq: fixes xs :: "('a :: linorder) list" assumes "xs \<noteq> []" shows "List.fold max (tl xs) (hd xs) = List.fold max (tl (rev xs)) (hd (rev xs))" using assms by (simp add: Max.set_eq_fold [symmetric]) lemma rbt_max_simps: assumes "is_rbt (Branch c lt k v RBT_Impl.Empty)" shows "rbt_max (Branch c lt k v RBT_Impl.Empty) = k" proof - have "List.fold max (tl (rev(RBT_Impl.keys lt @ [k]))) (hd (rev(RBT_Impl.keys lt @ [k]))) = k" using assms by (auto intro!: fold_max_triv dest!: left_le_key is_rbt_rbt_sorted) then show ?thesis by (auto simp add: rbt_max_def rbt_fold1_keys_def fold_max_rev_eq) qed fun rbt_max_opt where "rbt_max_opt (Branch c lt k v RBT_Impl.Empty) = k" | "rbt_max_opt (Branch c lt k v (Branch rc rlc rk rv rrt)) = rbt_max_opt (Branch rc rlc rk rv rrt)" lemma rbt_max_opt_Branch: "t2 \<noteq> rbt.Empty \<Longrightarrow> rbt_max_opt (Branch c t1 k () t2) = rbt_max_opt t2" by (cases t2) auto lemma rbt_max_opt_induct [case_names empty right_empty right_non_empty]: fixes t :: "('a :: linorder, unit) RBT_Impl.rbt" assumes "P rbt.Empty" assumes "\<And>color t1 a b t2. P t1 \<Longrightarrow> P t2 \<Longrightarrow> t2 = rbt.Empty \<Longrightarrow> P (Branch color t1 a b t2)" assumes "\<And>color t1 a b t2. P t1 \<Longrightarrow> P t2 \<Longrightarrow> t2 \<noteq> rbt.Empty \<Longrightarrow> P (Branch color t1 a b t2)" shows "P t" using assms proof (induct t) case Empty then show ?case by simp next case (Branch x1 t1 x3 x4 t2) then show ?case by (cases "t2 = rbt.Empty") simp_all qed lemma rbt_max_opt_in_set: fixes t :: "('a :: linorder, unit) RBT_Impl.rbt" assumes "t \<noteq> rbt.Empty" shows "rbt_max_opt t \<in> set (RBT_Impl.keys t)" using assms by (induction t rule: rbt_max_opt.induct) (auto) lemma rbt_max_opt_is_max: fixes t :: "('a :: linorder, unit) RBT_Impl.rbt" assumes "rbt_sorted t" assumes "t \<noteq> rbt.Empty" shows "\<And>y. y \<in> set (RBT_Impl.keys t) \<Longrightarrow> y \<le> rbt_max_opt t" using assms proof (induction t rule: rbt_max_opt_induct) case empty then show ?case by simp next case right_empty then show ?case by (auto intro: left_le_key simp del: rbt_sorted.simps) next case (right_non_empty c t1 k v t2 y) then consider "y = k" | "y \<in> set (RBT_Impl.keys t2)" | "y \<in> set (RBT_Impl.keys t1)" by auto then show ?case proof cases case 1 with right_non_empty show ?thesis by (auto simp add: rbt_max_opt_Branch intro: key_le_right rbt_max_opt_in_set) next case 2 with right_non_empty show ?thesis by (auto simp add: rbt_max_opt_Branch) next case y: 3 have "rbt_max_opt t2 \<ge> k" using right_non_empty by (simp add: key_le_right rbt_max_opt_in_set) moreover have "y \<le> k" using right_non_empty y by (simp add: left_le_key) ultimately show ?thesis using right_non_empty by (simp add: rbt_max_opt_Branch) qed qed lemma rbt_max_eq_rbt_max_opt: assumes "t \<noteq> RBT_Impl.Empty" assumes "is_rbt t" shows "rbt_max t = rbt_max_opt t" proof - from assms have "hd (RBT_Impl.keys t) # tl (RBT_Impl.keys t) = RBT_Impl.keys t" by (cases t) simp_all with assms show ?thesis by (simp add: rbt_max_def rbt_fold1_keys_def rbt_max_opt_is_max Max.set_eq_fold [symmetric] Max_eqI rbt_max_opt_in_set) qed (** abstract **) context includes rbt.lifting begin lift_definition fold1_keys :: "('a \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> ('a::linorder, 'b) rbt \<Rightarrow> 'a" is rbt_fold1_keys . lemma fold1_keys_def_alt: "fold1_keys f t = List.fold f (tl (RBT.keys t)) (hd (RBT.keys t))" by transfer (simp add: rbt_fold1_keys_def) lemma finite_fold1_fold1_keys: assumes "semilattice f" assumes "\<not> RBT.is_empty t" shows "semilattice_set.F f (Set t) = fold1_keys f t" proof - from \<open>semilattice f\<close> interpret semilattice_set f by (rule semilattice_set.intro) show ?thesis using assms by (auto simp: fold1_keys_def_alt set_keys fold_def_alt non_empty_keys set_eq_fold [symmetric]) qed (* minimum *) lift_definition r_min :: "('a :: linorder, unit) rbt \<Rightarrow> 'a" is rbt_min . lift_definition r_min_opt :: "('a :: linorder, unit) rbt \<Rightarrow> 'a" is rbt_min_opt . lemma r_min_alt_def: "r_min t = fold1_keys min t" by transfer (simp add: rbt_min_def) lemma r_min_eq_r_min_opt: assumes "\<not> (RBT.is_empty t)" shows "r_min t = r_min_opt t" using assms unfolding is_empty_empty by transfer (auto intro: rbt_min_eq_rbt_min_opt) lemma fold_keys_min_top_eq: fixes t :: "('a::{linorder,bounded_lattice_top}, unit) rbt" assumes "\<not> (RBT.is_empty t)" shows "fold_keys min t top = fold1_keys min t" proof - have *: "\<And>t. RBT_Impl.keys t \<noteq> [] \<Longrightarrow> List.fold min (RBT_Impl.keys t) top = List.fold min (hd (RBT_Impl.keys t) # tl (RBT_Impl.keys t)) top" by (simp add: hd_Cons_tl[symmetric]) have **: "List.fold min (x # xs) top = List.fold min xs x" for x :: 'a and xs by (simp add: inf_min[symmetric]) show ?thesis using assms unfolding fold_keys_def_alt fold1_keys_def_alt is_empty_empty apply transfer apply (case_tac t) apply simp apply (subst *) apply simp apply (subst **) apply simp done qed (* maximum *) lift_definition r_max :: "('a :: linorder, unit) rbt \<Rightarrow> 'a" is rbt_max . lift_definition r_max_opt :: "('a :: linorder, unit) rbt \<Rightarrow> 'a" is rbt_max_opt . lemma r_max_alt_def: "r_max t = fold1_keys max t" by transfer (simp add: rbt_max_def) lemma r_max_eq_r_max_opt: assumes "\<not> (RBT.is_empty t)" shows "r_max t = r_max_opt t" using assms unfolding is_empty_empty by transfer (auto intro: rbt_max_eq_rbt_max_opt) lemma fold_keys_max_bot_eq: fixes t :: "('a::{linorder,bounded_lattice_bot}, unit) rbt" assumes "\<not> (RBT.is_empty t)" shows "fold_keys max t bot = fold1_keys max t" proof - have *: "\<And>t. RBT_Impl.keys t \<noteq> [] \<Longrightarrow> List.fold max (RBT_Impl.keys t) bot = List.fold max (hd(RBT_Impl.keys t) # tl(RBT_Impl.keys t)) bot" by (simp add: hd_Cons_tl[symmetric]) have **: "List.fold max (x # xs) bot = List.fold max xs x" for x :: 'a and xs by (simp add: sup_max[symmetric]) show ?thesis using assms unfolding fold_keys_def_alt fold1_keys_def_alt is_empty_empty apply transfer apply (case_tac t) apply simp apply (subst *) apply simp apply (subst **) apply simp done qed end section \<open>Code equations\<close> code_datatype Set Coset declare list.set[code] (* needed? *) lemma empty_Set [code]: "Set.empty = Set RBT.empty" by (auto simp: Set_def) lemma UNIV_Coset [code]: "UNIV = Coset RBT.empty" by (auto simp: Set_def) lemma is_empty_Set [code]: "Set.is_empty (Set t) = RBT.is_empty t" unfolding Set.is_empty_def by (auto simp: fun_eq_iff Set_def intro: lookup_empty_empty[THEN iffD1]) lemma compl_code [code]: "- Set xs = Coset xs" "- Coset xs = Set xs" by (simp_all add: Set_def) lemma member_code [code]: "x \<in> (Set t) = (RBT.lookup t x = Some ())" "x \<in> (Coset t) = (RBT.lookup t x = None)" by (simp_all add: Set_def) lemma insert_code [code]: "Set.insert x (Set t) = Set (RBT.insert x () t)" "Set.insert x (Coset t) = Coset (RBT.delete x t)" by (auto simp: Set_def) lemma remove_code [code]: "Set.remove x (Set t) = Set (RBT.delete x t)" "Set.remove x (Coset t) = Coset (RBT.insert x () t)" by (auto simp: Set_def) lemma union_Set [code]: "Set t \<union> A = fold_keys Set.insert t A" proof - interpret comp_fun_idem Set.insert by (fact comp_fun_idem_insert) from finite_fold_fold_keys[OF \<open>comp_fun_commute Set.insert\<close>] show ?thesis by (auto simp add: union_fold_insert) qed lemma inter_Set [code]: "A \<inter> Set t = rbt_filter (\<lambda>k. k \<in> A) t" by (simp add: inter_Set_filter Set_filter_rbt_filter) lemma minus_Set [code]: "A - Set t = fold_keys Set.remove t A" proof - interpret comp_fun_idem Set.remove by (fact comp_fun_idem_remove) from finite_fold_fold_keys[OF \<open>comp_fun_commute Set.remove\<close>] show ?thesis by (auto simp add: minus_fold_remove) qed lemma union_Coset [code]: "Coset t \<union> A = - rbt_filter (\<lambda>k. k \<notin> A) t" proof - have *: "\<And>A B. (-A \<union> B) = -(-B \<inter> A)" by blast show ?thesis by (simp del: boolean_algebra_class.compl_inf add: * inter_Set) qed lemma union_Set_Set [code]: "Set t1 \<union> Set t2 = Set (RBT.union t1 t2)" by (auto simp add: lookup_union map_add_Some_iff Set_def) lemma inter_Coset [code]: "A \<inter> Coset t = fold_keys Set.remove t A" by (simp add: Diff_eq [symmetric] minus_Set) lemma inter_Coset_Coset [code]: "Coset t1 \<inter> Coset t2 = Coset (RBT.union t1 t2)" by (auto simp add: lookup_union map_add_Some_iff Set_def) lemma minus_Coset [code]: "A - Coset t = rbt_filter (\<lambda>k. k \<in> A) t" by (simp add: inter_Set[simplified Int_commute]) lemma filter_Set [code]: "Set.filter P (Set t) = (rbt_filter P t)" by (auto simp add: Set_filter_rbt_filter) lemma image_Set [code]: "image f (Set t) = fold_keys (\<lambda>k A. Set.insert (f k) A) t {}" proof - have "comp_fun_commute (\<lambda>k. Set.insert (f k))" by standard auto then show ?thesis by (auto simp add: image_fold_insert intro!: finite_fold_fold_keys) qed lemma Ball_Set [code]: "Ball (Set t) P \<longleftrightarrow> RBT.foldi (\<lambda>s. s = True) (\<lambda>k v s. s \<and> P k) t True" proof - have "comp_fun_commute (\<lambda>k s. s \<and> P k)" by standard auto then show ?thesis by (simp add: foldi_fold_conj[symmetric] Ball_fold finite_fold_fold_keys) qed lemma Bex_Set [code]: "Bex (Set t) P \<longleftrightarrow> RBT.foldi (\<lambda>s. s = False) (\<lambda>k v s. s \<or> P k) t False" proof - have "comp_fun_commute (\<lambda>k s. s \<or> P k)" by standard auto then show ?thesis by (simp add: foldi_fold_disj[symmetric] Bex_fold finite_fold_fold_keys) qed lemma subset_code [code]: "Set t \<le> B \<longleftrightarrow> (\<forall>x\<in>Set t. x \<in> B)" "A \<le> Coset t \<longleftrightarrow> (\<forall>y\<in>Set t. y \<notin> A)" by auto lemma subset_Coset_empty_Set_empty [code]: "Coset t1 \<le> Set t2 \<longleftrightarrow> (case (RBT.impl_of t1, RBT.impl_of t2) of (rbt.Empty, rbt.Empty) => False | (_, _) => Code.abort (STR ''non_empty_trees'') (\<lambda>_. Coset t1 \<le> Set t2))" proof - have *: "\<And>t. RBT.impl_of t = rbt.Empty \<Longrightarrow> t = RBT rbt.Empty" by (subst(asm) RBT_inverse[symmetric]) (auto simp: impl_of_inject) have **: "eq_onp is_rbt rbt.Empty rbt.Empty" unfolding eq_onp_def by simp show ?thesis by (auto simp: Set_def lookup.abs_eq[OF **] dest!: * split: rbt.split) qed text \<open>A frequent case -- avoid intermediate sets\<close> lemma [code_unfold]: "Set t1 \<subseteq> Set t2 \<longleftrightarrow> RBT.foldi (\<lambda>s. s = True) (\<lambda>k v s. s \<and> k \<in> Set t2) t1 True" by (simp add: subset_code Ball_Set) lemma card_Set [code]: "card (Set t) = fold_keys (\<lambda>_ n. n + 1) t 0" by (auto simp add: card.eq_fold intro: finite_fold_fold_keys comp_fun_commute_const) lemma sum_Set [code]: "sum f (Set xs) = fold_keys (plus o f) xs 0" proof - have "comp_fun_commute (\<lambda>x. op + (f x))" by standard (auto simp: ac_simps) then show ?thesis by (auto simp add: sum.eq_fold finite_fold_fold_keys o_def) qed lemma the_elem_set [code]: fixes t :: "('a :: linorder, unit) rbt" shows "the_elem (Set t) = (case RBT.impl_of t of (Branch RBT_Impl.B RBT_Impl.Empty x () RBT_Impl.Empty) \<Rightarrow> x | _ \<Rightarrow> Code.abort (STR ''not_a_singleton_tree'') (\<lambda>_. the_elem (Set t)))" proof - { fix x :: "'a :: linorder" let ?t = "Branch RBT_Impl.B RBT_Impl.Empty x () RBT_Impl.Empty" have *:"?t \<in> {t. is_rbt t}" unfolding is_rbt_def by auto then have **:"eq_onp is_rbt ?t ?t" unfolding eq_onp_def by auto have "RBT.impl_of t = ?t \<Longrightarrow> the_elem (Set t) = x" by (subst(asm) RBT_inverse[symmetric, OF *]) (auto simp: Set_def the_elem_def lookup.abs_eq[OF **] impl_of_inject) } then show ?thesis by(auto split: rbt.split unit.split color.split) qed lemma Pow_Set [code]: "Pow (Set t) = fold_keys (\<lambda>x A. A \<union> Set.insert x ` A) t {{}}" by (simp add: Pow_fold finite_fold_fold_keys[OF comp_fun_commute_Pow_fold]) lemma product_Set [code]: "Product_Type.product (Set t1) (Set t2) = fold_keys (\<lambda>x A. fold_keys (\<lambda>y. Set.insert (x, y)) t2 A) t1 {}" proof - have *: "comp_fun_commute (\<lambda>y. Set.insert (x, y))" for x by standard auto show ?thesis using finite_fold_fold_keys[OF comp_fun_commute_product_fold, of "Set t2" "{}" "t1"] by (simp add: product_fold Product_Type.product_def finite_fold_fold_keys[OF *]) qed lemma Id_on_Set [code]: "Id_on (Set t) = fold_keys (\<lambda>x. Set.insert (x, x)) t {}" proof - have "comp_fun_commute (\<lambda>x. Set.insert (x, x))" by standard auto then show ?thesis by (auto simp add: Id_on_fold intro!: finite_fold_fold_keys) qed lemma Image_Set [code]: "(Set t) `` S = fold_keys (\<lambda>(x,y) A. if x \<in> S then Set.insert y A else A) t {}" by (auto simp add: Image_fold finite_fold_fold_keys[OF comp_fun_commute_Image_fold]) lemma trancl_set_ntrancl [code]: "trancl (Set t) = ntrancl (card (Set t) - 1) (Set t)" by (simp add: finite_trancl_ntranl) lemma relcomp_Set[code]: "(Set t1) O (Set t2) = fold_keys (\<lambda>(x,y) A. fold_keys (\<lambda>(w,z) A'. if y = w then Set.insert (x,z) A' else A') t2 A) t1 {}" proof - interpret comp_fun_idem Set.insert by (fact comp_fun_idem_insert) have *: "\<And>x y. comp_fun_commute (\<lambda>(w, z) A'. if y = w then Set.insert (x, z) A' else A')" by standard (auto simp add: fun_eq_iff) show ?thesis using finite_fold_fold_keys[OF comp_fun_commute_relcomp_fold, of "Set t2" "{}" t1] by (simp add: relcomp_fold finite_fold_fold_keys[OF *]) qed lemma wf_set [code]: "wf (Set t) = acyclic (Set t)" by (simp add: wf_iff_acyclic_if_finite) lemma Min_fin_set_fold [code]: "Min (Set t) = (if RBT.is_empty t then Code.abort (STR ''not_non_empty_tree'') (\<lambda>_. Min (Set t)) else r_min_opt t)" proof - have *: "semilattice (min :: 'a \<Rightarrow> 'a \<Rightarrow> 'a)" .. with finite_fold1_fold1_keys [OF *, folded Min_def] show ?thesis by (simp add: r_min_alt_def r_min_eq_r_min_opt [symmetric]) qed lemma Inf_fin_set_fold [code]: "Inf_fin (Set t) = Min (Set t)" by (simp add: inf_min Inf_fin_def Min_def) lemma Inf_Set_fold: fixes t :: "('a :: {linorder, complete_lattice}, unit) rbt" shows "Inf (Set t) = (if RBT.is_empty t then top else r_min_opt t)" proof - have "comp_fun_commute (min :: 'a \<Rightarrow> 'a \<Rightarrow> 'a)" by standard (simp add: fun_eq_iff ac_simps) then have "t \<noteq> RBT.empty \<Longrightarrow> Finite_Set.fold min top (Set t) = fold1_keys min t" by (simp add: finite_fold_fold_keys fold_keys_min_top_eq) then show ?thesis by (auto simp add: Inf_fold_inf inf_min empty_Set[symmetric] r_min_eq_r_min_opt[symmetric] r_min_alt_def) qed definition Inf' :: "'a :: {linorder, complete_lattice} set \<Rightarrow> 'a" where [code del]: "Inf' x = Inf x" declare Inf'_def[symmetric, code_unfold] declare Inf_Set_fold[folded Inf'_def, code] lemma INF_Set_fold [code]: fixes f :: "_ \<Rightarrow> 'a::complete_lattice" shows "INFIMUM (Set t) f = fold_keys (inf \<circ> f) t top" proof - have "comp_fun_commute ((inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a) \<circ> f)" by standard (auto simp add: fun_eq_iff ac_simps) then show ?thesis by (auto simp: INF_fold_inf finite_fold_fold_keys) qed lemma Max_fin_set_fold [code]: "Max (Set t) = (if RBT.is_empty t then Code.abort (STR ''not_non_empty_tree'') (\<lambda>_. Max (Set t)) else r_max_opt t)" proof - have *: "semilattice (max :: 'a \<Rightarrow> 'a \<Rightarrow> 'a)" .. with finite_fold1_fold1_keys [OF *, folded Max_def] show ?thesis by (simp add: r_max_alt_def r_max_eq_r_max_opt [symmetric]) qed lemma Sup_fin_set_fold [code]: "Sup_fin (Set t) = Max (Set t)" by (simp add: sup_max Sup_fin_def Max_def) lemma Sup_Set_fold: fixes t :: "('a :: {linorder, complete_lattice}, unit) rbt" shows "Sup (Set t) = (if RBT.is_empty t then bot else r_max_opt t)" proof - have "comp_fun_commute (max :: 'a \<Rightarrow> 'a \<Rightarrow> 'a)" by standard (simp add: fun_eq_iff ac_simps) then have "t \<noteq> RBT.empty \<Longrightarrow> Finite_Set.fold max bot (Set t) = fold1_keys max t" by (simp add: finite_fold_fold_keys fold_keys_max_bot_eq) then show ?thesis by (auto simp add: Sup_fold_sup sup_max empty_Set[symmetric] r_max_eq_r_max_opt[symmetric] r_max_alt_def) qed definition Sup' :: "'a :: {linorder,complete_lattice} set \<Rightarrow> 'a" where [code del]: "Sup' x = Sup x" declare Sup'_def[symmetric, code_unfold] declare Sup_Set_fold[folded Sup'_def, code] lemma SUP_Set_fold [code]: fixes f :: "_ \<Rightarrow> 'a::complete_lattice" shows "SUPREMUM (Set t) f = fold_keys (sup \<circ> f) t bot" proof - have "comp_fun_commute ((sup :: 'a \<Rightarrow> 'a \<Rightarrow> 'a) \<circ> f)" by standard (auto simp add: fun_eq_iff ac_simps) then show ?thesis by (auto simp: SUP_fold_sup finite_fold_fold_keys) qed lemma sorted_list_set[code]: "sorted_list_of_set (Set t) = RBT.keys t" by (auto simp add: set_keys intro: sorted_distinct_set_unique) lemma Bleast_code [code]: "Bleast (Set t) P = (case List.filter P (RBT.keys t) of x # xs \<Rightarrow> x | [] \<Rightarrow> abort_Bleast (Set t) P)" proof (cases "List.filter P (RBT.keys t)") case Nil thus ?thesis by (simp add: Bleast_def abort_Bleast_def) next case (Cons x ys) have "(LEAST x. x \<in> Set t \<and> P x) = x" proof (rule Least_equality) show "x \<in> Set t \<and> P x" using Cons[symmetric] by (auto simp add: set_keys Cons_eq_filter_iff) next fix y assume "y \<in> Set t \<and> P y" then show "x \<le> y" using Cons[symmetric] by(auto simp add: set_keys Cons_eq_filter_iff) (metis sorted_Cons sorted_append sorted_keys) qed thus ?thesis using Cons by (simp add: Bleast_def) qed hide_const (open) RBT_Set.Set RBT_Set.Coset end
! ! tests bug 2554037 regarding include path ! - this should run correctly without giving an include path ! include "bug-2554037.h" end
abstract type Mortality{R,W} <: CellRule{R,W} end struct LinearMortality{R,W,D,T} <: Mortality{R,W} proportion::D threshold::T end LinearMortality{R,W}(d::D; threshold::T = 0.01) where {R,W,D,T} = LinearMortality{R,W}(d, threshold) function DynamicGrids.applyrule(data, rule::LinearMortality, N, I) # potentially type asset N is occupancy, later N > zero(N) || return zero(N) N > rule.threshold || return zero(N) new = @fastmath N - rule.proportion * N new > zero(N) && return new return zero(N) end LinearMortality(layernames::T, decay::DT; threshold::TT = 0.01) where {T,DT,TT} = begin rules = Ruleset() for sym in layernames rules += LinearMortality{sym}(decay, threshold = threshold) end return rules end
/- Copyright (c) 2022 Moritz Doll. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll ! This file was ported from Lean 3 source module analysis.locally_convex.weak_dual ! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.Topology.Algebra.Module.WeakDual import Mathbin.Analysis.Normed.Field.Basic import Mathbin.Analysis.LocallyConvex.WithSeminorms /-! # Weak Dual in Topological Vector Spaces We prove that the weak topology induced by a bilinear form `B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜` is locally convex and we explicit give a neighborhood basis in terms of the family of seminorms `λ x, ‖B x y‖` for `y : F`. ## Main definitions * `linear_map.to_seminorm`: turn a linear form `f : E →ₗ[𝕜] 𝕜` into a seminorm `λ x, ‖f x‖`. * `linear_map.to_seminorm_family`: turn a bilinear form `B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜` into a map `F → seminorm 𝕜 E`. ## Main statements * `linear_map.has_basis_weak_bilin`: the seminorm balls of `B.to_seminorm_family` form a neighborhood basis of `0` in the weak topology. * `linear_map.to_seminorm_family.with_seminorms`: the topology of a weak space is induced by the family of seminorm `B.to_seminorm_family`. * `weak_bilin.locally_convex_space`: a spaced endowed with a weak topology is locally convex. ## References * [Bourbaki, *Topological Vector Spaces*][bourbaki1987] ## Tags weak dual, seminorm -/ variable {𝕜 E F ι : Type _} open Topology section BilinForm namespace LinearMap variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] /-- Construct a seminorm from a linear form `f : E →ₗ[𝕜] 𝕜` over a normed field `𝕜` by `λ x, ‖f x‖` -/ def toSeminorm (f : E →ₗ[𝕜] 𝕜) : Seminorm 𝕜 E := (normSeminorm 𝕜 𝕜).comp f #align linear_map.to_seminorm LinearMap.toSeminorm theorem coe_toSeminorm {f : E →ₗ[𝕜] 𝕜} : ⇑f.toSeminorm = fun x => ‖f x‖ := rfl #align linear_map.coe_to_seminorm LinearMap.coe_toSeminorm @[simp] theorem toSeminorm_apply {f : E →ₗ[𝕜] 𝕜} {x : E} : f.toSeminorm x = ‖f x‖ := rfl #align linear_map.to_seminorm_apply LinearMap.toSeminorm_apply theorem toSeminorm_ball_zero {f : E →ₗ[𝕜] 𝕜} {r : ℝ} : Seminorm.ball f.toSeminorm 0 r = { x : E | ‖f x‖ < r } := by simp only [Seminorm.ball_zero_eq, to_seminorm_apply] #align linear_map.to_seminorm_ball_zero LinearMap.toSeminorm_ball_zero theorem toSeminorm_comp (f : F →ₗ[𝕜] 𝕜) (g : E →ₗ[𝕜] F) : f.toSeminorm.comp g = (f.comp g).toSeminorm := by ext simp only [Seminorm.comp_apply, to_seminorm_apply, coe_comp] #align linear_map.to_seminorm_comp LinearMap.toSeminorm_comp /-- Construct a family of seminorms from a bilinear form. -/ def toSeminormFamily (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : SeminormFamily 𝕜 E F := fun y => (B.flip y).toSeminorm #align linear_map.to_seminorm_family LinearMap.toSeminormFamily @[simp] theorem toSeminormFamily_apply {B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜} {x y} : (B.toSeminormFamily y) x = ‖B x y‖ := rfl #align linear_map.to_seminorm_family_apply LinearMap.toSeminormFamily_apply end LinearMap end BilinForm section Topology variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] variable [Nonempty ι] variable {B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜} theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basis_sets id := by let p := B.to_seminorm_family rw [nhds_induced, nhds_pi] simp only [map_zero, LinearMap.zero_apply] have h := @Metric.nhds_basis_ball 𝕜 _ 0 have h' := Filter.hasBasis_pi fun i : F => h have h'' := Filter.HasBasis.comap (fun x y => B x y) h' refine' h''.to_has_basis _ _ · rintro (U : Set F × (F → ℝ)) hU cases' hU with hU₁ hU₂ simp only [id.def] let U' := hU₁.to_finset by_cases hU₃ : U.fst.nonempty · have hU₃' : U'.nonempty := hU₁.to_finset_nonempty.mpr hU₃ refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basis_sets_mem _ <| (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_to_finset.mp hy, fun x hx y hy => _⟩ simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff] rw [Seminorm.mem_ball_zero] at hx rw [← LinearMap.toSeminormFamily_apply] have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy have hp : p y ≤ U'.sup p := Finset.le_sup hyU' refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _) exact Finset.inf'_le _ hyU' rw [set.not_nonempty_iff_eq_empty.mp hU₃] simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff] exact Exists.intro ((p 0).ball 0 1) (p.basis_sets_singleton_mem 0 one_pos) rintro U (hU : U ∈ p.basis_sets) rw [SeminormFamily.basisSets_iff] at hU rcases hU with ⟨s, r, hr, hU⟩ rw [hU] refine' ⟨(s, fun _ => r), ⟨by simp only [s.finite_to_set], fun y hy => hr⟩, fun x hx => _⟩ simp only [Set.mem_preimage, Set.mem_pi, Finset.mem_coe, mem_ball_zero_iff] at hx simp only [id.def, Seminorm.mem_ball, sub_zero] refine' Seminorm.finset_sup_apply_lt hr fun y hy => _ rw [LinearMap.toSeminormFamily_apply] exact hx y hy #align linear_map.has_basis_weak_bilin LinearMap.hasBasis_weakBilin theorem LinearMap.weakBilinWithSeminorms (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) : WithSeminorms (LinearMap.toSeminormFamily B : F → Seminorm 𝕜 (WeakBilin B)) := SeminormFamily.withSeminormsOfHasBasis _ B.hasBasis_weakBilin #align linear_map.weak_bilin_with_seminorms LinearMap.weakBilinWithSeminorms end Topology section LocallyConvex variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] variable [Nonempty ι] [NormedSpace ℝ 𝕜] [Module ℝ E] [IsScalarTower ℝ 𝕜 E] instance {B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜} : LocallyConvexSpace ℝ (WeakBilin B) := B.weakBilinWithSeminorms.toLocallyConvexSpace end LocallyConvex
(* QuickChick Prelude *) Set Warnings "-extraction-opaque-accessed,-extraction". Set Warnings "-notation-overridden,-parsing". Require Import String List. Open Scope string. From QuickChick Require Import QuickChick Tactics. From mathcomp Require Import ssreflect ssrfun ssrbool ssrnat eqtype seq. Import QcDefaultNotation. Open Scope qc_scope. Set Bullet Behavior "Strict Subproofs". (* End prelude *) Require Export Poly. Theorem silly1 : forall (n m o p : nat), n = m -> [n;o] = [n;p] -> [n;o] = [m;p]. Admitted. (* Leo: OUT-OF-SCOPE *) Theorem silly2 : forall (n m o p : nat), n = m -> (forall (q r : nat), q = r -> [q;o] = [r;p]) -> [n;o] = [m;p]. Admitted. (* Higher-order *) Theorem silly3_firsttry : forall (n : nat), n = 5 -> (* true = beq_nat n 5 -> *) beq_nat (S (S n)) 7 = true. Admitted. (* (*N*) QuickChick silly3_firsttry. *) Theorem rev_exercise1 : forall (l l' : list nat), l = rev l' -> l' = rev l. Admitted. (* (*N*) QuickChick rev_exercise1. *) Theorem trans_eq : forall (X:Type) (n m o : X), n = m -> m = o -> n = o. Admitted. (* (*N*) QuickChick trans_eq. *) Example trans_eq_example' : forall (a b c d e f : nat), [a;b] = [c;d] -> [c;d] = [e;f] -> [a;b] = [e;f]. Admitted. (* Leo: OUT-OF-SCOPE *) Example trans_eq_exercise : forall (n m o p : nat), m = (minustwo o) -> (n + p) = m -> (n + p) = (minustwo o). Admitted. (* Leo: OUT-OF-SCOPE *) Theorem S_injective : forall (n m : nat), S n = S m -> n = m. Admitted. (* Leo: OUT-OF-SCOPE *) Theorem beq_nat_0_l : forall n, 0 = n -> n = 0. Admitted. (* (*N*) QuickChick beq_nat_0_l. *) Theorem inversion_ex4 : forall (n : nat), S n = O -> 2 + 2 = 5. Admitted. (* Leo: OUT-OF-SCOPE *) Theorem f_equal : forall (A B : Type) (f: A -> B) (x y: A), x = y -> f x = f y. Admitted. (* Leo: CoArb Weirdness *) Theorem plus_n_n_injective : forall n m, n + n = m + m -> n = m. Admitted. (* Leo: OUT-OF-SCOPE *) Theorem double_injective : forall n m, double n = double m -> n = m. Admitted. (* Leo: OUT-OF-SCOPE *) Theorem beq_id_true : forall (x y : id), x = y -> x = y. Admitted. (* (*N*) QuickChick beq_id_true. *) (* Leo: Theorem nth_error_after_last: forall (n : nat) (X : Type) (l : list X), *) Theorem nth_error_after_last: forall (X : Type) (l : list X) (n : nat), length l = n -> nth_error l n = None. Admitted. (* (*N*) QuickChick nth_error_after_last. *) Definition square n := n * n. Lemma square_mult : forall n m, square (n * m) = square n * square m. Admitted. (* QuickChick square_mult *) Definition foo (x: nat) := 5. Fact silly_fact_1 : forall m, foo m + 1 = foo (m + 1) + 1. Admitted. (* QuickChick silly_fact_1. *) Definition bar x := match x with | O => 5 | S _ => 5 end. Fact silly_fact_2 : forall m, bar m + 1 = bar (m + 1) + 1. Admitted. (* QuickChick silly_fact_2. *) Definition sillyfun (n : nat) : bool := if beq_nat n 3 then false else if beq_nat n 5 then false else false. Theorem sillyfun_false : forall (n : nat), sillyfun n = false. Admitted. (* QuickChick sillyfun_false. *) Definition sillyfun1 (n : nat) : bool := if beq_nat n 3 then true else if beq_nat n 5 then true else false. Theorem sillyfun1_odd : forall (n : nat), sillyfun1 n = true -> oddb n = true. Admitted. (* Leo: OUT-OF-SCOPE *) Theorem bool_fn_applied_thrice : forall (f : bool -> bool) (b : bool), f (f (f b)) = f b. Admitted. (* Coarbitrary *) Theorem beq_nat_sym : forall (n m : nat), beq_nat n m = beq_nat m n. Admitted. (* QuickChick beq_nat_sym. *) Theorem beq_nat_trans : forall n m p, beq_nat n m = true -> beq_nat m p = true -> beq_nat n p = true. Admitted. (* Leo: OUT-OF-SCOPE *) Theorem filter_exercise : forall (X : Type) (test : X -> bool) (x : X) (l lf : list X), filter test l = x :: lf -> test x = true. Admitted.
%% Copyright (C) 2015 Carnë Draug %% Copyright (C) 2016, 2018-2019, 2022 Colin B. Macdonald %% %% This file is part of OctSymPy. %% %% OctSymPy is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published %% by the Free Software Foundation; either version 3 of the License, %% or (at your option) any later version. %% %% This software is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied warranty %% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See %% the GNU General Public License for more details. %% %% You should have received a copy of the GNU General Public %% License along with this software; see the file COPYING. %% If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- %% @documentencoding UTF-8 %% @deffn Constant eulergamma () %% Return Euler--Mascheroni constant. %% %% @example %% @group %% eulergamma %% @result{} (sym) γ %% %% vpa (eulergamma ()) %% @result{} (sym) 0.57721566490153286060651209008240 %% @end group %% @end example %% %% @seealso{catalan} %% @end deffn %% Author: Carnë Draug %% Keywords: symbolic, constants function g = eulergamma () if (nargin ~= 0) print_usage (); end g = pycall_sympy__ ('return sympy.S.EulerGamma,'); end %!error catalan (sym(1)) %!assert (double (eulergamma ()) > 0.577215664901) %!assert (double (eulergamma ()) < 0.577215664902)
State Before: f : ℂ →ₗᵢ[ℝ] ℂ h₂ : ∀ (z : ℂ), (↑f z).re = z.re z : ℂ ⊢ (↑f z).im = z.im ∨ (↑f z).im = -z.im State After: f : ℂ →ₗᵢ[ℝ] ℂ h₂ : ∀ (z : ℂ), (↑f z).re = z.re z : ℂ h₁ : ‖↑f z‖ = ‖z‖ ⊢ (↑f z).im = z.im ∨ (↑f z).im = -z.im Tactic: have h₁ := f.norm_map z State Before: f : ℂ →ₗᵢ[ℝ] ℂ h₂ : ∀ (z : ℂ), (↑f z).re = z.re z : ℂ h₁ : ‖↑f z‖ = ‖z‖ ⊢ (↑f z).im = z.im ∨ (↑f z).im = -z.im State After: f : ℂ →ₗᵢ[ℝ] ℂ h₂ : ∀ (z : ℂ), (↑f z).re = z.re z : ℂ h₁ : Real.sqrt (↑normSq (↑f z)) = Real.sqrt (↑normSq z) ⊢ (↑f z).im = z.im ∨ (↑f z).im = -z.im Tactic: simp only [Complex.abs_def, norm_eq_abs] at h₁ State Before: f : ℂ →ₗᵢ[ℝ] ℂ h₂ : ∀ (z : ℂ), (↑f z).re = z.re z : ℂ h₁ : Real.sqrt (↑normSq (↑f z)) = Real.sqrt (↑normSq z) ⊢ (↑f z).im = z.im ∨ (↑f z).im = -z.im State After: no goals Tactic: rwa [Real.sqrt_inj (normSq_nonneg _) (normSq_nonneg _), normSq_apply (f z), normSq_apply z, h₂, add_left_cancel_iff, mul_self_eq_mul_self_iff] at h₁
func $fact ( var %n i32, var %p1 a64, var %p2 a64) i32 { var %r1 i32 var %r2 i32 var %r3 i32 if (ne i32 i32 (dread i32 %n, constval i32 1)) { # Not correct, but for parse and dump test. intrinsiccallassigned JSOP_ADD ( dread a64 %p1, dread a64 %p2, dread i32 %n) { dassign %r1 1 dassign %r2 2 dassign %r3 3 } return (constval i32 0) } }
example (p q r : Prop) (hp : p) (hq : q) (hr : r) : p ∧ ((p ∧ q) ∧ r) ∧ (q ∧ r ∧ p) := by repeat { any_goals { split <|> assumption} }
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Michael Howes ! This file was ported from Lean 3 source module group_theory.abelianization ! leanprover-community/mathlib commit 34ee86e6a59d911a8e4f89b68793ee7577ae79c7 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.Data.Finite.Card import Mathbin.GroupTheory.Commutator import Mathbin.GroupTheory.Finiteness /-! # The abelianization of a group > THIS FILE IS SYNCHRONIZED WITH MATHLIB4. > Any changes to this file require a corresponding PR to mathlib4. This file defines the commutator and the abelianization of a group. It furthermore prepares for the result that the abelianization is left adjoint to the forgetful functor from abelian groups to groups, which can be found in `algebra/category/Group/adjunctions`. ## Main definitions * `commutator`: defines the commutator of a group `G` as a subgroup of `G`. * `abelianization`: defines the abelianization of a group `G` as the quotient of a group by its commutator subgroup. * `abelianization.map`: lifts a group homomorphism to a homomorphism between the abelianizations * `mul_equiv.abelianization_congr`: Equivalent groups have equivalent abelianizations -/ universe u v w -- Let G be a group. variable (G : Type u) [Group G] #print commutator /- /-- The commutator subgroup of a group G is the normal subgroup generated by the commutators [p,q]=`p*q*p⁻¹*q⁻¹`. -/ def commutator : Subgroup G := ⁅(⊤ : Subgroup G), ⊤⁆deriving Subgroup.Normal #align commutator commutator -/ /- warning: commutator_def -> commutator_def is a dubious translation: lean 3 declaration is forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], Eq.{succ u1} (Subgroup.{u1} G _inst_1) (commutator.{u1} G _inst_1) (Bracket.bracket.{u1, u1} (Subgroup.{u1} G _inst_1) (Subgroup.{u1} G _inst_1) (Subgroup.commutator.{u1} G _inst_1) (Top.top.{u1} (Subgroup.{u1} G _inst_1) (Subgroup.hasTop.{u1} G _inst_1)) (Top.top.{u1} (Subgroup.{u1} G _inst_1) (Subgroup.hasTop.{u1} G _inst_1))) but is expected to have type forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], Eq.{succ u1} (Subgroup.{u1} G _inst_1) (commutator.{u1} G _inst_1) (Bracket.bracket.{u1, u1} (Subgroup.{u1} G _inst_1) (Subgroup.{u1} G _inst_1) (Subgroup.commutator.{u1} G _inst_1) (Top.top.{u1} (Subgroup.{u1} G _inst_1) (Subgroup.instTopSubgroup.{u1} G _inst_1)) (Top.top.{u1} (Subgroup.{u1} G _inst_1) (Subgroup.instTopSubgroup.{u1} G _inst_1))) Case conversion may be inaccurate. Consider using '#align commutator_def commutator_defₓ'. -/ theorem commutator_def : commutator G = ⁅(⊤ : Subgroup G), ⊤⁆ := rfl #align commutator_def commutator_def #print commutator_eq_closure /- theorem commutator_eq_closure : commutator G = Subgroup.closure (commutatorSet G) := by simp [commutator, Subgroup.commutator_def, commutatorSet] #align commutator_eq_closure commutator_eq_closure -/ #print commutator_eq_normalClosure /- theorem commutator_eq_normalClosure : commutator G = Subgroup.normalClosure (commutatorSet G) := by simp [commutator, Subgroup.commutator_def', commutatorSet] #align commutator_eq_normal_closure commutator_eq_normalClosure -/ #print commutator_characteristic /- instance commutator_characteristic : (commutator G).Characteristic := Subgroup.commutator_characteristic ⊤ ⊤ #align commutator_characteristic commutator_characteristic -/ instance [Finite (commutatorSet G)] : Group.Fg (commutator G) := by rw [commutator_eq_closure] apply Group.closure_finite_fg #print rank_commutator_le_card /- theorem rank_commutator_le_card [Finite (commutatorSet G)] : Group.rank (commutator G) ≤ Nat.card (commutatorSet G) := by rw [Subgroup.rank_congr (commutator_eq_closure G)] apply Subgroup.rank_closure_finite_le_nat_card #align rank_commutator_le_card rank_commutator_le_card -/ /- warning: commutator_centralizer_commutator_le_center -> commutator_centralizer_commutator_le_center is a dubious translation: lean 3 declaration is forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], LE.le.{u1} (Subgroup.{u1} G _inst_1) (Preorder.toLE.{u1} (Subgroup.{u1} G _inst_1) (PartialOrder.toPreorder.{u1} (Subgroup.{u1} G _inst_1) (SetLike.partialOrder.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)))) (Bracket.bracket.{u1, u1} (Subgroup.{u1} G _inst_1) (Subgroup.{u1} G _inst_1) (Subgroup.commutator.{u1} G _inst_1) (Subgroup.centralizer.{u1} G _inst_1 (commutator.{u1} G _inst_1)) (Subgroup.centralizer.{u1} G _inst_1 (commutator.{u1} G _inst_1))) (Subgroup.center.{u1} G _inst_1) but is expected to have type forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], LE.le.{u1} (Subgroup.{u1} G _inst_1) (Preorder.toLE.{u1} (Subgroup.{u1} G _inst_1) (PartialOrder.toPreorder.{u1} (Subgroup.{u1} G _inst_1) (CompleteSemilatticeInf.toPartialOrder.{u1} (Subgroup.{u1} G _inst_1) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Subgroup.{u1} G _inst_1) (Subgroup.instCompleteLatticeSubgroup.{u1} G _inst_1))))) (Bracket.bracket.{u1, u1} (Subgroup.{u1} G _inst_1) (Subgroup.{u1} G _inst_1) (Subgroup.commutator.{u1} G _inst_1) (Subgroup.centralizer.{u1} G _inst_1 (commutator.{u1} G _inst_1)) (Subgroup.centralizer.{u1} G _inst_1 (commutator.{u1} G _inst_1))) (Subgroup.center.{u1} G _inst_1) Case conversion may be inaccurate. Consider using '#align commutator_centralizer_commutator_le_center commutator_centralizer_commutator_le_centerₓ'. -/ theorem commutator_centralizer_commutator_le_center : ⁅(commutator G).centralizer, (commutator G).centralizer⁆ ≤ Subgroup.center G := by rw [← Subgroup.centralizer_top, ← Subgroup.commutator_eq_bot_iff_le_centralizer] suffices ⁅⁅⊤, (commutator G).centralizer⁆, (commutator G).centralizer⁆ = ⊥ by refine' Subgroup.commutator_commutator_eq_bot_of_rotate _ this rwa [Subgroup.commutator_comm (commutator G).centralizer] rw [Subgroup.commutator_comm, Subgroup.commutator_eq_bot_iff_le_centralizer] exact Set.centralizer_subset (Subgroup.commutator_mono le_top le_top) #align commutator_centralizer_commutator_le_center commutator_centralizer_commutator_le_center #print Abelianization /- /-- The abelianization of G is the quotient of G by its commutator subgroup. -/ def Abelianization : Type u := G ⧸ commutator G #align abelianization Abelianization -/ namespace Abelianization attribute [local instance] QuotientGroup.leftRel instance : CommGroup (Abelianization G) := { QuotientGroup.Quotient.group _ with mul_comm := fun x y => Quotient.inductionOn₂' x y fun a b => Quotient.sound' <| QuotientGroup.leftRel_apply.mpr <| Subgroup.subset_closure ⟨b⁻¹, Subgroup.mem_top b⁻¹, a⁻¹, Subgroup.mem_top a⁻¹, by group⟩ } instance : Inhabited (Abelianization G) := ⟨1⟩ instance [Fintype G] [DecidablePred (· ∈ commutator G)] : Fintype (Abelianization G) := QuotientGroup.fintype (commutator G) instance [Finite G] : Finite (Abelianization G) := Quotient.finite _ variable {G} #print Abelianization.of /- /-- `of` is the canonical projection from G to its abelianization. -/ def of : G →* Abelianization G where toFun := QuotientGroup.mk map_one' := rfl map_mul' x y := rfl #align abelianization.of Abelianization.of -/ /- warning: abelianization.mk_eq_of -> Abelianization.mk_eq_of is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} (Quot.{succ u1} G (Setoid.r.{succ u1} G (QuotientGroup.leftRel.{u1} G _inst_1 (commutator.{u1} G _inst_1)))) (Quot.mk.{succ u1} G (Setoid.r.{succ u1} G (QuotientGroup.leftRel.{u1} G _inst_1 (commutator.{u1} G _inst_1))) a) (coeFn.{succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (fun (_x : MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) => G -> (Abelianization.{u1} G _inst_1)) (MonoidHom.hasCoeToFun.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (Abelianization.of.{u1} G _inst_1) a) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} (Quot.{succ u1} G (Setoid.r.{succ u1} G (QuotientGroup.leftRel.{u1} G _inst_1 (commutator.{u1} G _inst_1)))) (Quot.mk.{succ u1} G (Setoid.r.{succ u1} G (QuotientGroup.leftRel.{u1} G _inst_1 (commutator.{u1} G _inst_1))) a) (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (_x : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) _x) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) a) Case conversion may be inaccurate. Consider using '#align abelianization.mk_eq_of Abelianization.mk_eq_ofₓ'. -/ @[simp] theorem mk_eq_of (a : G) : Quot.mk _ a = of a := rfl #align abelianization.mk_eq_of Abelianization.mk_eq_of section lift -- So far we have built Gᵃᵇ and proved it's an abelian group. -- Furthremore we defined the canonical projection `of : G → Gᵃᵇ` -- Let `A` be an abelian group and let `f` be a group homomorphism from `G` to `A`. variable {A : Type v} [CommGroup A] (f : G →* A) /- warning: abelianization.commutator_subset_ker -> Abelianization.commutator_subset_ker is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {A : Type.{u2}} [_inst_2 : CommGroup.{u2} A] (f : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))), LE.le.{u1} (Subgroup.{u1} G _inst_1) (Preorder.toLE.{u1} (Subgroup.{u1} G _inst_1) (PartialOrder.toPreorder.{u1} (Subgroup.{u1} G _inst_1) (SetLike.partialOrder.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)))) (commutator.{u1} G _inst_1) (MonoidHom.ker.{u1, u2} G _inst_1 A (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))) f) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {A : Type.{u2}} [_inst_2 : CommGroup.{u2} A] (f : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))), LE.le.{u1} (Subgroup.{u1} G _inst_1) (Preorder.toLE.{u1} (Subgroup.{u1} G _inst_1) (PartialOrder.toPreorder.{u1} (Subgroup.{u1} G _inst_1) (CompleteSemilatticeInf.toPartialOrder.{u1} (Subgroup.{u1} G _inst_1) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Subgroup.{u1} G _inst_1) (Subgroup.instCompleteLatticeSubgroup.{u1} G _inst_1))))) (commutator.{u1} G _inst_1) (MonoidHom.ker.{u1, u2} G _inst_1 A (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))) f) Case conversion may be inaccurate. Consider using '#align abelianization.commutator_subset_ker Abelianization.commutator_subset_kerₓ'. -/ theorem commutator_subset_ker : commutator G ≤ f.ker := by rw [commutator_eq_closure, Subgroup.closure_le] rintro x ⟨p, q, rfl⟩ simp [MonoidHom.mem_ker, mul_right_comm (f p) (f q), commutatorElement_def] #align abelianization.commutator_subset_ker Abelianization.commutator_subset_ker #print Abelianization.lift /- /-- If `f : G → A` is a group homomorphism to an abelian group, then `lift f` is the unique map from the abelianization of a `G` to `A` that factors through `f`. -/ def lift : (G →* A) ≃ (Abelianization G →* A) where toFun f := QuotientGroup.lift _ f fun x h => f.mem_ker.2 <| commutator_subset_ker _ h invFun F := F.comp of left_inv f := MonoidHom.ext fun x => rfl right_inv F := MonoidHom.ext fun x => QuotientGroup.induction_on x fun z => rfl #align abelianization.lift Abelianization.lift -/ /- warning: abelianization.lift.of -> Abelianization.lift.of is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {A : Type.{u2}} [_inst_2 : CommGroup.{u2} A] (f : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (x : G), Eq.{succ u2} A (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (fun (_x : MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => (Abelianization.{u1} G _inst_1) -> A) (MonoidHom.hasCoeToFun.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (coeFn.{max 1 (succ u2) (succ u1), max (succ u2) (succ u1)} (Equiv.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (fun (_x : Equiv.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) => (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) -> (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (Equiv.hasCoeToFun.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (Abelianization.lift.{u1, u2} G _inst_1 A _inst_2) f) (coeFn.{succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (fun (_x : MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) => G -> (Abelianization.{u1} G _inst_1)) (MonoidHom.hasCoeToFun.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (Abelianization.of.{u1} G _inst_1) x)) (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (fun (_x : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => G -> A) (MonoidHom.hasCoeToFun.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) f x) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {A : Type.{u2}} [_inst_2 : CommGroup.{u2} A] (f : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (x : G), Eq.{succ u2} ((fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => A) (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (a : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) a) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) x)) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} ((fun ([email protected]._hyg.808 : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) f) (Abelianization.{u1} G _inst_1) (fun (_x : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} ((fun ([email protected]._hyg.808 : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) f) (Abelianization.{u1} G _inst_1) A (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} A (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} ((fun ([email protected]._hyg.808 : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) f) (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))) (MonoidHom.monoidHomClass.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))))) (FunLike.coe.{max (succ u2) (succ u1), max (succ u2) (succ u1), max (succ u2) (succ u1)} (Equiv.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (fun (_x : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => (fun ([email protected]._hyg.808 : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) _x) (Equiv.instFunLikeEquiv.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (Abelianization.lift.{u1, u2} G _inst_1 A _inst_2) f) (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (_x : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) _x) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) x)) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) G (fun (_x : G) => (fun ([email protected]._hyg.2391 : G) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) G A (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} A (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))) (MonoidHom.monoidHomClass.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))))) f x) Case conversion may be inaccurate. Consider using '#align abelianization.lift.of Abelianization.lift.ofₓ'. -/ @[simp] theorem lift.of (x : G) : lift f (of x) = f x := rfl #align abelianization.lift.of Abelianization.lift.of /- warning: abelianization.lift.unique -> Abelianization.lift.unique is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {A : Type.{u2}} [_inst_2 : CommGroup.{u2} A] (f : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (φ : MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))), (forall (x : G), Eq.{succ u2} A (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (fun (_x : MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => (Abelianization.{u1} G _inst_1) -> A) (MonoidHom.hasCoeToFun.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) φ (coeFn.{succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (fun (_x : MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) => G -> (Abelianization.{u1} G _inst_1)) (MonoidHom.hasCoeToFun.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (Abelianization.of.{u1} G _inst_1) x)) (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (fun (_x : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => G -> A) (MonoidHom.hasCoeToFun.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) f x)) -> (forall {x : Abelianization.{u1} G _inst_1}, Eq.{succ u2} A (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (fun (_x : MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => (Abelianization.{u1} G _inst_1) -> A) (MonoidHom.hasCoeToFun.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) φ x) (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (fun (_x : MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => (Abelianization.{u1} G _inst_1) -> A) (MonoidHom.hasCoeToFun.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (coeFn.{max 1 (succ u2) (succ u1), max (succ u2) (succ u1)} (Equiv.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (fun (_x : Equiv.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) => (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) -> (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (Equiv.hasCoeToFun.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (Abelianization.lift.{u1, u2} G _inst_1 A _inst_2) f) x)) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {A : Type.{u2}} [_inst_2 : CommGroup.{u2} A] (f : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (φ : MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))), (forall (x : G), Eq.{succ u2} ((fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => A) (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (a : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) a) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) x)) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (Abelianization.{u1} G _inst_1) (fun (_x : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (Abelianization.{u1} G _inst_1) A (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} A (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))) (MonoidHom.monoidHomClass.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))))) φ (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (_x : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) _x) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) x)) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) G (fun (_x : G) => (fun ([email protected]._hyg.2391 : G) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) G A (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} A (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))) (MonoidHom.monoidHomClass.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))))) f x)) -> (forall {x : Abelianization.{u1} G _inst_1}, Eq.{succ u2} ((fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => A) x) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (Abelianization.{u1} G _inst_1) (fun (_x : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (Abelianization.{u1} G _inst_1) A (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} A (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))) (MonoidHom.monoidHomClass.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))))) φ x) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} ((fun ([email protected]._hyg.808 : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) f) (Abelianization.{u1} G _inst_1) (fun (_x : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} ((fun ([email protected]._hyg.808 : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) f) (Abelianization.{u1} G _inst_1) A (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} A (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} ((fun ([email protected]._hyg.808 : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) f) (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))) (MonoidHom.monoidHomClass.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))))) (FunLike.coe.{max (succ u2) (succ u1), max (succ u2) (succ u1), max (succ u2) (succ u1)} (Equiv.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (fun (_x : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => (fun ([email protected]._hyg.808 : MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) => MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) _x) (Equiv.instFunLikeEquiv.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (MonoidHom.{u1, u2} G A (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2))))) (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) A (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} A (DivInvMonoid.toMonoid.{u2} A (Group.toDivInvMonoid.{u2} A (CommGroup.toGroup.{u2} A _inst_2)))))) (Abelianization.lift.{u1, u2} G _inst_1 A _inst_2) f) x)) Case conversion may be inaccurate. Consider using '#align abelianization.lift.unique Abelianization.lift.uniqueₓ'. -/ theorem lift.unique (φ : Abelianization G →* A) -- hφ : φ agrees with f on the image of G in Gᵃᵇ (hφ : ∀ x : G, φ (of x) = f x) {x : Abelianization G} : φ x = lift f x := QuotientGroup.induction_on x hφ #align abelianization.lift.unique Abelianization.lift.unique #print Abelianization.lift_of /- @[simp] theorem lift_of : lift of = MonoidHom.id (Abelianization G) := lift.apply_symm_apply <| MonoidHom.id _ #align abelianization.lift_of Abelianization.lift_of -/ end lift variable {A : Type v} [Monoid A] #print Abelianization.hom_ext /- /-- See note [partially-applied ext lemmas]. -/ @[ext] theorem hom_ext (φ ψ : Abelianization G →* A) (h : φ.comp of = ψ.comp of) : φ = ψ := MonoidHom.ext fun x => QuotientGroup.induction_on x <| MonoidHom.congr_fun h #align abelianization.hom_ext Abelianization.hom_ext -/ section Map variable {H : Type v} [Group H] (f : G →* H) #print Abelianization.map /- /-- The map operation of the `abelianization` functor -/ def map : Abelianization G →* Abelianization H := lift (of.comp f) #align abelianization.map Abelianization.map -/ /- warning: abelianization.map_of -> Abelianization.map_of is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_3 : Group.{u2} H] (f : MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) (x : G), Eq.{succ u2} (Abelianization.{u2} H _inst_3) (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (fun (_x : MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) => (Abelianization.{u1} G _inst_1) -> (Abelianization.{u2} H _inst_3)) (MonoidHom.hasCoeToFun.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.map.{u1, u2} G _inst_1 H _inst_3 f) (coeFn.{succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (fun (_x : MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) => G -> (Abelianization.{u1} G _inst_1)) (MonoidHom.hasCoeToFun.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (Abelianization.of.{u1} G _inst_1) x)) (coeFn.{succ u2, succ u2} (MonoidHom.{u2, u2} H (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (fun (_x : MonoidHom.{u2, u2} H (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) => H -> (Abelianization.{u2} H _inst_3)) (MonoidHom.hasCoeToFun.{u2, u2} H (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.of.{u2} H _inst_3) (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) (fun (_x : MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) => G -> H) (MonoidHom.hasCoeToFun.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) f x)) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_3 : Group.{u2} H] (f : MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) (x : G), Eq.{succ u2} ((fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => Abelianization.{u2} H _inst_3) (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (a : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) a) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) x)) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (fun (_x : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => Abelianization.{u2} H _inst_3) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (MonoidHom.monoidHomClass.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))))) (Abelianization.map.{u1, u2} G _inst_1 H _inst_3 f) (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (_x : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) _x) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) x)) (FunLike.coe.{succ u2, succ u2, succ u2} (MonoidHom.{u2, u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3)))))) ((fun ([email protected]._hyg.2391 : G) => H) x) (fun (_x : (fun ([email protected]._hyg.2391 : G) => H) x) => (fun ([email protected]._hyg.2391 : (fun ([email protected]._hyg.2391 : G) => H) x) => Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) _x) (MulHomClass.toFunLike.{u2, u2, u2} (MonoidHom.{u2, u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3)))))) ((fun ([email protected]._hyg.2391 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (MulOneClass.toMul.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3)))) (MulOneClass.toMul.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3)))))) (MonoidHomClass.toMulHomClass.{u2, u2, u2} (MonoidHom.{u2, u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3)))))) ((fun ([email protected]._hyg.2391 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3))))) (MonoidHom.monoidHomClass.{u2, u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3)))))))) (Abelianization.of.{u2} ((fun ([email protected]._hyg.2391 : G) => H) x) _inst_3) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) G (fun (_x : G) => (fun ([email protected]._hyg.2391 : G) => H) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3))) (MonoidHom.monoidHomClass.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))))) f x)) Case conversion may be inaccurate. Consider using '#align abelianization.map_of Abelianization.map_ofₓ'. -/ @[simp] theorem map_of (x : G) : map f (of x) = of (f x) := rfl #align abelianization.map_of Abelianization.map_of #print Abelianization.map_id /- @[simp] theorem map_id : map (MonoidHom.id G) = MonoidHom.id (Abelianization G) := hom_ext _ _ rfl #align abelianization.map_id Abelianization.map_id -/ #print Abelianization.map_comp /- @[simp] theorem map_comp {I : Type w} [Group I] (g : H →* I) : (map g).comp (map f) = map (g.comp f) := hom_ext _ _ rfl #align abelianization.map_comp Abelianization.map_comp -/ /- warning: abelianization.map_map_apply -> Abelianization.map_map_apply is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_3 : Group.{u2} H] (f : MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) {I : Type.{u3}} [_inst_4 : Group.{u3} I] {g : MonoidHom.{u2, u3} H I (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3))) (Monoid.toMulOneClass.{u3} I (DivInvMonoid.toMonoid.{u3} I (Group.toDivInvMonoid.{u3} I _inst_4)))} {x : Abelianization.{u1} G _inst_1}, Eq.{succ u3} (Abelianization.{u3} I _inst_4) (coeFn.{max (succ u3) (succ u2), max (succ u2) (succ u3)} (MonoidHom.{u2, u3} (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (fun (_x : MonoidHom.{u2, u3} (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) => (Abelianization.{u2} H _inst_3) -> (Abelianization.{u3} I _inst_4)) (MonoidHom.hasCoeToFun.{u2, u3} (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (Abelianization.map.{u2, u3} H _inst_3 I _inst_4 g) (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (fun (_x : MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) => (Abelianization.{u1} G _inst_1) -> (Abelianization.{u2} H _inst_3)) (MonoidHom.hasCoeToFun.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.map.{u1, u2} G _inst_1 H _inst_3 f) x)) (coeFn.{max (succ u3) (succ u1), max (succ u1) (succ u3)} (MonoidHom.{u1, u3} (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (fun (_x : MonoidHom.{u1, u3} (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) => (Abelianization.{u1} G _inst_1) -> (Abelianization.{u3} I _inst_4)) (MonoidHom.hasCoeToFun.{u1, u3} (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (Abelianization.map.{u1, u3} G _inst_1 I _inst_4 (MonoidHom.comp.{u1, u2, u3} G H I (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3))) (Monoid.toMulOneClass.{u3} I (DivInvMonoid.toMonoid.{u3} I (Group.toDivInvMonoid.{u3} I _inst_4))) g f)) x) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_3 : Group.{u2} H] (f : MonoidHom.{u1, u2} G H (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3)))) {I : Type.{u3}} [_inst_4 : Group.{u3} I] {g : MonoidHom.{u2, u3} H I (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3))) (Monoid.toMulOneClass.{u3} I (DivInvMonoid.toMonoid.{u3} I (Group.toDivInvMonoid.{u3} I _inst_4)))} {x : Abelianization.{u1} G _inst_1}, Eq.{succ u3} ((fun ([email protected]._hyg.2391 : Abelianization.{u2} H _inst_3) => Abelianization.{u3} I _inst_4) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (fun (a : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => Abelianization.{u2} H _inst_3) a) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (MonoidHom.monoidHomClass.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))))) (Abelianization.map.{u1, u2} G _inst_1 H _inst_3 f) x)) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (MonoidHom.{u2, u3} (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (Abelianization.{u2} H _inst_3) (fun (_x : Abelianization.{u2} H _inst_3) => (fun ([email protected]._hyg.2391 : Abelianization.{u2} H _inst_3) => Abelianization.{u3} I _inst_4) _x) (MulHomClass.toFunLike.{max u2 u3, u2, u3} (MonoidHom.{u2, u3} (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (MulOneClass.toMul.{u3} (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (MonoidHomClass.toMulHomClass.{max u2 u3, u2, u3} (MonoidHom.{u2, u3} (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4))))) (MonoidHom.monoidHomClass.{u2, u3} (Abelianization.{u2} H _inst_3) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))))) (Abelianization.map.{u2, u3} H _inst_3 I _inst_4 g) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (fun (_x : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => Abelianization.{u2} H _inst_3) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidHom.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3))))) (MonoidHom.monoidHomClass.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_3) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_3) (Abelianization.commGroup.{u2} H _inst_3)))))))) (Abelianization.map.{u1, u2} G _inst_1 H _inst_3 f) x)) (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (MonoidHom.{u1, u3} (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (Abelianization.{u1} G _inst_1) (fun (_x : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.2391 : Abelianization.{u1} G _inst_1) => Abelianization.{u3} I _inst_4) _x) (MulHomClass.toFunLike.{max u1 u3, u1, u3} (MonoidHom.{u1, u3} (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u3} (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (MonoidHomClass.toMulHomClass.{max u1 u3, u1, u3} (MonoidHom.{u1, u3} (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4))))) (MonoidHom.monoidHomClass.{u1, u3} (Abelianization.{u1} G _inst_1) (Abelianization.{u3} I _inst_4) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u3} (Abelianization.{u3} I _inst_4) (DivInvMonoid.toMonoid.{u3} (Abelianization.{u3} I _inst_4) (Group.toDivInvMonoid.{u3} (Abelianization.{u3} I _inst_4) (CommGroup.toGroup.{u3} (Abelianization.{u3} I _inst_4) (Abelianization.commGroup.{u3} I _inst_4)))))))) (Abelianization.map.{u1, u3} G _inst_1 I _inst_4 (MonoidHom.comp.{u1, u2, u3} G H I (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_3))) (Monoid.toMulOneClass.{u3} I (DivInvMonoid.toMonoid.{u3} I (Group.toDivInvMonoid.{u3} I _inst_4))) g f)) x) Case conversion may be inaccurate. Consider using '#align abelianization.map_map_apply Abelianization.map_map_applyₓ'. -/ @[simp] theorem map_map_apply {I : Type w} [Group I] {g : H →* I} {x : Abelianization G} : map g (map f x) = map (g.comp f) x := MonoidHom.congr_fun (map_comp _ _) x #align abelianization.map_map_apply Abelianization.map_map_apply end Map end Abelianization section AbelianizationCongr variable {G} {H : Type v} [Group H] (e : G ≃* H) /- warning: mul_equiv.abelianization_congr -> MulEquiv.abelianizationCongr is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_2 : Group.{u2} H], (MulEquiv.{u1, u2} G H (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) -> (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_2 : Group.{u2} H], (MulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) -> (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) Case conversion may be inaccurate. Consider using '#align mul_equiv.abelianization_congr MulEquiv.abelianizationCongrₓ'. -/ /-- Equivalent groups have equivalent abelianizations -/ def MulEquiv.abelianizationCongr : Abelianization G ≃* Abelianization H where toFun := Abelianization.map e.toMonoidHom invFun := Abelianization.map e.symm.toMonoidHom left_inv := by rintro ⟨a⟩ simp right_inv := by rintro ⟨a⟩ simp map_mul' := MonoidHom.map_mul _ #align mul_equiv.abelianization_congr MulEquiv.abelianizationCongr /- warning: abelianization_congr_of -> abelianizationCongr_of is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_2 : Group.{u2} H] (e : MulEquiv.{u1, u2} G H (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) (x : G), Eq.{succ u2} (Abelianization.{u2} H _inst_2) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) (fun (_x : MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) => (Abelianization.{u1} G _inst_1) -> (Abelianization.{u2} H _inst_2)) (MulEquiv.hasCoeToFun.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) (MulEquiv.abelianizationCongr.{u1, u2} G _inst_1 H _inst_2 e) (coeFn.{succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (fun (_x : MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) => G -> (Abelianization.{u1} G _inst_1)) (MonoidHom.hasCoeToFun.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (Abelianization.of.{u1} G _inst_1) x)) (coeFn.{succ u2, succ u2} (MonoidHom.{u2, u2} H (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (fun (_x : MonoidHom.{u2, u2} H (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) => H -> (Abelianization.{u2} H _inst_2)) (MonoidHom.hasCoeToFun.{u2, u2} H (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (Abelianization.of.{u2} H _inst_2) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (MulEquiv.{u1, u2} G H (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) (fun (_x : MulEquiv.{u1, u2} G H (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) => G -> H) (MulEquiv.hasCoeToFun.{u1, u2} G H (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) e x)) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_2 : Group.{u2} H] (e : MulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) (x : G), Eq.{succ u2} ((fun ([email protected]._hyg.19 : Abelianization.{u1} G _inst_1) => Abelianization.{u2} H _inst_2) (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (a : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) a) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) x)) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) (Abelianization.{u1} G _inst_1) (fun (_x : Abelianization.{u1} G _inst_1) => (fun ([email protected]._hyg.19 : Abelianization.{u1} G _inst_1) => Abelianization.{u2} H _inst_2) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (EquivLike.toEmbeddingLike.{max (succ u1) (succ u2), succ u1, succ u2} (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulEquivClass.toEquivLike.{max u1 u2, u1, u2} (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2))))))) (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (MulEquiv.instMulEquivClassMulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))))))) (MulEquiv.abelianizationCongr.{u1, u2} G _inst_1 H _inst_2 e) (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (fun (_x : G) => (fun ([email protected]._hyg.2391 : G) => Abelianization.{u1} G _inst_1) _x) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))) (MonoidHom.monoidHomClass.{u1, u1} G (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))))) (Abelianization.of.{u1} G _inst_1) x)) (FunLike.coe.{succ u2, succ u2, succ u2} (MonoidHom.{u2, u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2)))))) ((fun ([email protected]._hyg.19 : G) => H) x) (fun (_x : (fun ([email protected]._hyg.19 : G) => H) x) => (fun ([email protected]._hyg.2391 : (fun ([email protected]._hyg.19 : G) => H) x) => Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) _x) (MulHomClass.toFunLike.{u2, u2, u2} (MonoidHom.{u2, u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2)))))) ((fun ([email protected]._hyg.19 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (MulOneClass.toMul.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2)))) (MulOneClass.toMul.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2)))))) (MonoidHomClass.toMulHomClass.{u2, u2, u2} (MonoidHom.{u2, u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2)))))) ((fun ([email protected]._hyg.19 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2))))) (MonoidHom.monoidHomClass.{u2, u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Monoid.toMulOneClass.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (DivInvMonoid.toMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) (Group.toDivInvMonoid.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2))) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (Abelianization.commGroup.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2)))))))) (Abelianization.of.{u2} ((fun ([email protected]._hyg.19 : G) => H) x) _inst_2) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) G (fun (_x : G) => (fun ([email protected]._hyg.19 : G) => H) _x) (EmbeddingLike.toFunLike.{max (succ u1) (succ u2), succ u1, succ u2} (MulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) G H (EquivLike.toEmbeddingLike.{max (succ u1) (succ u2), succ u1, succ u2} (MulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) G H (MulEquivClass.toEquivLike.{max u1 u2, u1, u2} (MulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2)))) (MulEquiv.instMulEquivClassMulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2)))))))) e x)) Case conversion may be inaccurate. Consider using '#align abelianization_congr_of abelianizationCongr_ofₓ'. -/ @[simp] theorem abelianizationCongr_of (x : G) : e.abelianizationCongr (Abelianization.of x) = Abelianization.of (e x) := rfl #align abelianization_congr_of abelianizationCongr_of /- warning: abelianization_congr_refl -> abelianizationCongr_refl is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G], Eq.{succ u1} (MulEquiv.{u1, u1} (Abelianization.{u1} G _inst_1) (Abelianization.{u1} G _inst_1) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))))) (MulEquiv.abelianizationCongr.{u1, u1} G _inst_1 G _inst_1 (MulEquiv.refl.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))) (MulEquiv.refl.{u1} (Abelianization.{u1} G _inst_1) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))))) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G], Eq.{succ u1} (MulEquiv.{u1, u1} (Abelianization.{u1} G _inst_1) (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))))) (MulEquiv.abelianizationCongr.{u1, u1} G _inst_1 G _inst_1 (MulEquiv.refl.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))) (MulEquiv.refl.{u1} (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))))) Case conversion may be inaccurate. Consider using '#align abelianization_congr_refl abelianizationCongr_reflₓ'. -/ @[simp] theorem abelianizationCongr_refl : (MulEquiv.refl G).abelianizationCongr = MulEquiv.refl (Abelianization G) := MulEquiv.toMonoidHom_injective Abelianization.lift_of #align abelianization_congr_refl abelianizationCongr_refl /- warning: abelianization_congr_symm -> abelianizationCongr_symm is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_2 : Group.{u2} H] (e : MulEquiv.{u1, u2} G H (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))), Eq.{max (succ u2) (succ u1)} (MulEquiv.{u2, u1} (Abelianization.{u2} H _inst_2) (Abelianization.{u1} G _inst_1) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))))) (MulEquiv.symm.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (MulEquiv.abelianizationCongr.{u1, u2} G _inst_1 H _inst_2 e)) (MulEquiv.abelianizationCongr.{u2, u1} H _inst_2 G _inst_1 (MulEquiv.symm.{u1, u2} G H (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2)))) e)) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_2 : Group.{u2} H] (e : MulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))), Eq.{max (succ u1) (succ u2)} (MulEquiv.{u2, u1} (Abelianization.{u2} H _inst_2) (Abelianization.{u1} G _inst_1) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1))))))) (MulEquiv.symm.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (MulEquiv.abelianizationCongr.{u1, u2} G _inst_1 H _inst_2 e)) (MulEquiv.abelianizationCongr.{u2, u1} H _inst_2 G _inst_1 (MulEquiv.symm.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2)))) e)) Case conversion may be inaccurate. Consider using '#align abelianization_congr_symm abelianizationCongr_symmₓ'. -/ @[simp] theorem abelianizationCongr_symm : e.abelianizationCongr.symm = e.symm.abelianizationCongr := rfl #align abelianization_congr_symm abelianizationCongr_symm /- warning: abelianization_congr_trans -> abelianizationCongr_trans is a dubious translation: lean 3 declaration is forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_2 : Group.{u2} H] (e : MulEquiv.{u1, u2} G H (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) {I : Type.{u2}} [_inst_3 : Group.{u2} I] (e₂ : MulEquiv.{u2, u2} H I (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2)))) (MulOneClass.toHasMul.{u2} I (Monoid.toMulOneClass.{u2} I (DivInvMonoid.toMonoid.{u2} I (Group.toDivInvMonoid.{u2} I _inst_3))))), Eq.{max (succ u1) (succ u2)} (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} I _inst_3) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} I _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} I _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} I _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} I _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} I _inst_3) (Abelianization.commGroup.{u2} I _inst_3))))))) (MulEquiv.trans.{u1, u2, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (Abelianization.{u2} I _inst_3) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (MulOneClass.toHasMul.{u2} (Abelianization.{u2} I _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} I _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} I _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} I _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} I _inst_3) (Abelianization.commGroup.{u2} I _inst_3)))))) (MulEquiv.abelianizationCongr.{u1, u2} G _inst_1 H _inst_2 e) (MulEquiv.abelianizationCongr.{u2, u2} H _inst_2 I _inst_3 e₂)) (MulEquiv.abelianizationCongr.{u1, u2} G _inst_1 I _inst_3 (MulEquiv.trans.{u1, u2, u2} G H I (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toHasMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2)))) (MulOneClass.toHasMul.{u2} I (Monoid.toMulOneClass.{u2} I (DivInvMonoid.toMonoid.{u2} I (Group.toDivInvMonoid.{u2} I _inst_3)))) e e₂)) but is expected to have type forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] {H : Type.{u2}} [_inst_2 : Group.{u2} H] (e : MulEquiv.{u1, u2} G H (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2))))) {I : Type.{u2}} [_inst_3 : Group.{u2} I] (e₂ : MulEquiv.{u2, u2} H I (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2)))) (MulOneClass.toMul.{u2} I (Monoid.toMulOneClass.{u2} I (DivInvMonoid.toMonoid.{u2} I (Group.toDivInvMonoid.{u2} I _inst_3))))), Eq.{max (succ u1) (succ u2)} (MulEquiv.{u1, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} I _inst_3) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} I _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} I _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} I _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} I _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} I _inst_3) (Abelianization.commGroup.{u2} I _inst_3))))))) (MulEquiv.trans.{u1, u2, u2} (Abelianization.{u1} G _inst_1) (Abelianization.{u2} H _inst_2) (Abelianization.{u2} I _inst_3) (MulOneClass.toMul.{u1} (Abelianization.{u1} G _inst_1) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} G _inst_1) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} G _inst_1) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} G _inst_1) (CommGroup.toGroup.{u1} (Abelianization.{u1} G _inst_1) (Abelianization.commGroup.{u1} G _inst_1)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} H _inst_2) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} H _inst_2) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} H _inst_2) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} H _inst_2) (CommGroup.toGroup.{u2} (Abelianization.{u2} H _inst_2) (Abelianization.commGroup.{u2} H _inst_2)))))) (MulOneClass.toMul.{u2} (Abelianization.{u2} I _inst_3) (Monoid.toMulOneClass.{u2} (Abelianization.{u2} I _inst_3) (DivInvMonoid.toMonoid.{u2} (Abelianization.{u2} I _inst_3) (Group.toDivInvMonoid.{u2} (Abelianization.{u2} I _inst_3) (CommGroup.toGroup.{u2} (Abelianization.{u2} I _inst_3) (Abelianization.commGroup.{u2} I _inst_3)))))) (MulEquiv.abelianizationCongr.{u1, u2} G _inst_1 H _inst_2 e) (MulEquiv.abelianizationCongr.{u2, u2} H _inst_2 I _inst_3 e₂)) (MulEquiv.abelianizationCongr.{u1, u2} G _inst_1 I _inst_3 (MulEquiv.trans.{u1, u2, u2} G H I (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MulOneClass.toMul.{u2} H (Monoid.toMulOneClass.{u2} H (DivInvMonoid.toMonoid.{u2} H (Group.toDivInvMonoid.{u2} H _inst_2)))) (MulOneClass.toMul.{u2} I (Monoid.toMulOneClass.{u2} I (DivInvMonoid.toMonoid.{u2} I (Group.toDivInvMonoid.{u2} I _inst_3)))) e e₂)) Case conversion may be inaccurate. Consider using '#align abelianization_congr_trans abelianizationCongr_transₓ'. -/ @[simp] theorem abelianizationCongr_trans {I : Type v} [Group I] (e₂ : H ≃* I) : e.abelianizationCongr.trans e₂.abelianizationCongr = (e.trans e₂).abelianizationCongr := MulEquiv.toMonoidHom_injective (Abelianization.hom_ext _ _ rfl) #align abelianization_congr_trans abelianizationCongr_trans end AbelianizationCongr /- warning: abelianization.equiv_of_comm -> Abelianization.equivOfComm is a dubious translation: lean 3 declaration is forall {H : Type.{u1}} [_inst_2 : CommGroup.{u1} H], MulEquiv.{u1, u1} H (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (MulOneClass.toHasMul.{u1} H (Monoid.toMulOneClass.{u1} H (DivInvMonoid.toMonoid.{u1} H (Group.toDivInvMonoid.{u1} H (CommGroup.toGroup.{u1} H _inst_2))))) (MulOneClass.toHasMul.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (CommGroup.toGroup.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (Abelianization.commGroup.{u1} H (CommGroup.toGroup.{u1} H _inst_2))))))) but is expected to have type forall {H : Type.{u1}} [_inst_2 : CommGroup.{u1} H], MulEquiv.{u1, u1} H (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (MulOneClass.toMul.{u1} H (Monoid.toMulOneClass.{u1} H (DivInvMonoid.toMonoid.{u1} H (Group.toDivInvMonoid.{u1} H (CommGroup.toGroup.{u1} H _inst_2))))) (MulOneClass.toMul.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (Monoid.toMulOneClass.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (DivInvMonoid.toMonoid.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (Group.toDivInvMonoid.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (CommGroup.toGroup.{u1} (Abelianization.{u1} H (CommGroup.toGroup.{u1} H _inst_2)) (Abelianization.commGroup.{u1} H (CommGroup.toGroup.{u1} H _inst_2))))))) Case conversion may be inaccurate. Consider using '#align abelianization.equiv_of_comm Abelianization.equivOfCommₓ'. -/ /-- An Abelian group is equivalent to its own abelianization. -/ @[simps] def Abelianization.equivOfComm {H : Type _} [CommGroup H] : H ≃* Abelianization H := { Abelianization.of with toFun := Abelianization.of invFun := Abelianization.lift (MonoidHom.id H) left_inv := fun a => rfl right_inv := by rintro ⟨a⟩ rfl } #align abelianization.equiv_of_comm Abelianization.equivOfComm section commutatorRepresentatives open Subgroup #print commutatorRepresentatives /- /-- Representatives `(g₁, g₂) : G × G` of commutator_set `⁅g₁, g₂⁆ ∈ G`. -/ def commutatorRepresentatives : Set (G × G) := Set.range fun g : commutatorSet G => (g.2.some, g.2.choose_spec.some) #align commutator_representatives commutatorRepresentatives -/ instance [Finite (commutatorSet G)] : Finite (commutatorRepresentatives G) := Set.finite_coe_iff.mpr (Set.finite_range _) #print closureCommutatorRepresentatives /- /-- Subgroup generated by representatives `g₁ g₂ : G` of commutators `⁅g₁, g₂⁆ ∈ G`. -/ def closureCommutatorRepresentatives : Subgroup G := closure (Prod.fst '' commutatorRepresentatives G ∪ Prod.snd '' commutatorRepresentatives G) #align closure_commutator_representatives closureCommutatorRepresentatives -/ /- warning: closure_commutator_representatives_fg -> closureCommutatorRepresentatives_fg is a dubious translation: lean 3 declaration is forall (G : Type.{u1}) [_inst_1 : Group.{u1} G] [_inst_2 : Finite.{succ u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} G) Type.{u1} (Set.hasCoeToSort.{u1} G) (commutatorSet.{u1} G _inst_1))], Group.Fg.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)) but is expected to have type forall (G : Type.{u1}) [_inst_1 : Group.{u1} G] [_inst_2 : Finite.{succ u1} (Set.Elem.{u1} G (commutatorSet.{u1} G _inst_1))], Group.Fg.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)) Case conversion may be inaccurate. Consider using '#align closure_commutator_representatives_fg closureCommutatorRepresentatives_fgₓ'. -/ instance closureCommutatorRepresentatives_fg [Finite (commutatorSet G)] : Group.Fg (closureCommutatorRepresentatives G) := Group.closure_finite_fg _ #align closure_commutator_representatives_fg closureCommutatorRepresentatives_fg /- warning: rank_closure_commutator_representations_le -> rank_closureCommutatorRepresentatives_le is a dubious translation: lean 3 declaration is forall (G : Type.{u1}) [_inst_1 : Group.{u1} G] [_inst_2 : Finite.{succ u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} G) Type.{u1} (Set.hasCoeToSort.{u1} G) (commutatorSet.{u1} G _inst_1))], LE.le.{0} Nat Nat.hasLe (Group.rank.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)) (closureCommutatorRepresentatives_fg.{u1} G _inst_1 _inst_2)) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (Nat.card.{u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} G) Type.{u1} (Set.hasCoeToSort.{u1} G) (commutatorSet.{u1} G _inst_1)))) but is expected to have type forall (G : Type.{u1}) [_inst_1 : Group.{u1} G] [_inst_2 : Finite.{succ u1} (Set.Elem.{u1} G (commutatorSet.{u1} G _inst_1))], LE.le.{0} Nat instLENat (Group.rank.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)) (closureCommutatorRepresentatives_fg.{u1} G _inst_1 _inst_2)) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (Nat.card.{u1} (Set.Elem.{u1} G (commutatorSet.{u1} G _inst_1)))) Case conversion may be inaccurate. Consider using '#align rank_closure_commutator_representations_le rank_closureCommutatorRepresentatives_leₓ'. -/ theorem rank_closureCommutatorRepresentatives_le [Finite (commutatorSet G)] : Group.rank (closureCommutatorRepresentatives G) ≤ 2 * Nat.card (commutatorSet G) := by rw [two_mul] exact (Subgroup.rank_closure_finite_le_nat_card _).trans ((Set.card_union_le _ _).trans (add_le_add ((Finite.card_image_le _).trans (Finite.card_range_le _)) ((Finite.card_image_le _).trans (Finite.card_range_le _)))) #align rank_closure_commutator_representations_le rank_closureCommutatorRepresentatives_le /- warning: image_commutator_set_closure_commutator_representatives -> image_commutatorSet_closureCommutatorRepresentatives is a dubious translation: lean 3 declaration is forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], Eq.{succ u1} (Set.{u1} G) (Set.image.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) G (coeFn.{succ u1, succ u1} (MonoidHom.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) G (Monoid.toMulOneClass.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (DivInvMonoid.toMonoid.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Group.toDivInvMonoid.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (fun (_x : MonoidHom.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) G (Monoid.toMulOneClass.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (DivInvMonoid.toMonoid.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Group.toDivInvMonoid.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) => (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) -> G) (MonoidHom.hasCoeToFun.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) G (Monoid.toMulOneClass.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (DivInvMonoid.toMonoid.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Group.toDivInvMonoid.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))))) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (Subgroup.subtype.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (commutatorSet.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)))) (commutatorSet.{u1} G _inst_1) but is expected to have type forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], Eq.{succ u1} (Set.{u1} G) (Set.image.{u1, u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) G (FunLike.coe.{succ u1, succ u1, succ u1} (MonoidHom.{u1, u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) G (Submonoid.toMulOneClass.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Subgroup.toSubmonoid.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (fun (_x : Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) => (fun ([email protected]._hyg.2391 : Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) => G) _x) (MulHomClass.toFunLike.{u1, u1, u1} (MonoidHom.{u1, u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) G (Submonoid.toMulOneClass.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Subgroup.toSubmonoid.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) G (MulOneClass.toMul.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Submonoid.toMulOneClass.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Subgroup.toSubmonoid.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)))) (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (MonoidHomClass.toMulHomClass.{u1, u1, u1} (MonoidHom.{u1, u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) G (Submonoid.toMulOneClass.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Subgroup.toSubmonoid.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))) (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) G (Submonoid.toMulOneClass.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Subgroup.toSubmonoid.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (MonoidHom.monoidHomClass.{u1, u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) G (Submonoid.toMulOneClass.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))) (Subgroup.toSubmonoid.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))) (Subgroup.subtype.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (commutatorSet.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)))) (commutatorSet.{u1} G _inst_1) Case conversion may be inaccurate. Consider using '#align image_commutator_set_closure_commutator_representatives image_commutatorSet_closureCommutatorRepresentativesₓ'. -/ theorem image_commutatorSet_closureCommutatorRepresentatives : (closureCommutatorRepresentatives G).Subtype '' commutatorSet (closureCommutatorRepresentatives G) = commutatorSet G := by apply Set.Subset.antisymm · rintro - ⟨-, ⟨g₁, g₂, rfl⟩, rfl⟩ exact ⟨g₁, g₂, rfl⟩ · exact fun g hg => ⟨_, ⟨⟨_, subset_closure (Or.inl ⟨_, ⟨⟨g, hg⟩, rfl⟩, rfl⟩)⟩, ⟨_, subset_closure (Or.inr ⟨_, ⟨⟨g, hg⟩, rfl⟩, rfl⟩)⟩, rfl⟩, hg.some_spec.some_spec⟩ #align image_commutator_set_closure_commutator_representatives image_commutatorSet_closureCommutatorRepresentatives /- warning: card_commutator_set_closure_commutator_representatives -> card_commutatorSet_closureCommutatorRepresentatives is a dubious translation: lean 3 declaration is forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], Eq.{1} Nat (Nat.card.{u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1))) Type.{u1} (Set.hasCoeToSort.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1))) (commutatorSet.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))))) (Nat.card.{u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} G) Type.{u1} (Set.hasCoeToSort.{u1} G) (commutatorSet.{u1} G _inst_1))) but is expected to have type forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], Eq.{1} Nat (Nat.card.{u1} (Set.Elem.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (commutatorSet.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))))) (Nat.card.{u1} (Set.Elem.{u1} G (commutatorSet.{u1} G _inst_1))) Case conversion may be inaccurate. Consider using '#align card_commutator_set_closure_commutator_representatives card_commutatorSet_closureCommutatorRepresentativesₓ'. -/ theorem card_commutatorSet_closureCommutatorRepresentatives : Nat.card (commutatorSet (closureCommutatorRepresentatives G)) = Nat.card (commutatorSet G) := by rw [← image_commutatorSet_closureCommutatorRepresentatives G] exact Nat.card_congr (Equiv.Set.image _ _ (subtype_injective _)) #align card_commutator_set_closure_commutator_representatives card_commutatorSet_closureCommutatorRepresentatives /- warning: card_commutator_closure_commutator_representatives -> card_commutator_closureCommutatorRepresentatives is a dubious translation: lean 3 declaration is forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], Eq.{1} Nat (Nat.card.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.setLike.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)))) (commutator.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (closureCommutatorRepresentatives.{u1} G _inst_1)) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))))) (Nat.card.{u1} (coeSort.{succ u1, succ (succ u1)} (Subgroup.{u1} G _inst_1) Type.{u1} (SetLike.hasCoeToSort.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.setLike.{u1} G _inst_1)) (commutator.{u1} G _inst_1))) but is expected to have type forall (G : Type.{u1}) [_inst_1 : Group.{u1} G], Eq.{1} Nat (Nat.card.{u1} (Subtype.{succ u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (fun (x : Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) => Membership.mem.{u1, u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.instSetLikeSubgroup.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)))) x (commutator.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (closureCommutatorRepresentatives.{u1} G _inst_1))) (Subgroup.toGroup.{u1} G _inst_1 (closureCommutatorRepresentatives.{u1} G _inst_1)))))) (Nat.card.{u1} (Subtype.{succ u1} G (fun (x : G) => Membership.mem.{u1, u1} G (Subgroup.{u1} G _inst_1) (SetLike.instMembership.{u1, u1} (Subgroup.{u1} G _inst_1) G (Subgroup.instSetLikeSubgroup.{u1} G _inst_1)) x (commutator.{u1} G _inst_1)))) Case conversion may be inaccurate. Consider using '#align card_commutator_closure_commutator_representatives card_commutator_closureCommutatorRepresentativesₓ'. -/ theorem card_commutator_closureCommutatorRepresentatives : Nat.card (commutator (closureCommutatorRepresentatives G)) = Nat.card (commutator G) := by rw [commutator_eq_closure G, ← image_commutatorSet_closureCommutatorRepresentatives, ← MonoidHom.map_closure, ← commutator_eq_closure] exact Nat.card_congr (Equiv.Set.image _ _ (subtype_injective _)) #align card_commutator_closure_commutator_representatives card_commutator_closureCommutatorRepresentatives instance [Finite (commutatorSet G)] : Finite (commutatorSet (closureCommutatorRepresentatives G)) := by apply Nat.finite_of_card_ne_zero rw [card_commutatorSet_closureCommutatorRepresentatives] exact finite.card_pos.ne' end commutatorRepresentatives
{- Copyright 2019 Lisandra Silva Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -} open import Prelude open import Relation.Binary.HeterogeneousEquality using (_≅_) renaming (cong to ≅-cong; refl to ≅-refl) open import StateMachineModel module Examples.SMCounter where data MyEvent : Set where inc : MyEvent inc2 : MyEvent data MyEnabled : MyEvent → ℕ → Set where tt : ∀ {e} {n} → MyEnabled e n MyEventSet : EventSet {Event = MyEvent} MyEventSet inc = ⊤ MyEventSet inc2 = ⊤ MyAction : {preSt : ℕ} {ev : MyEvent} → MyEnabled ev preSt → ℕ MyAction {preSt} {inc} enEv = suc preSt MyAction {preSt} {inc2} enEv = suc (suc preSt) data MyWeakFairness : EventSet → Set where w0 : MyWeakFairness MyEventSet -- Another way of modelling the WeakFairness MyWeakFairness2 : EventSet {Event = MyEvent} → Set MyWeakFairness2 MyEventSet = ⊤ MyStateMachine : StateMachine ℕ MyEvent MyStateMachine = record { initial = 2 ≡_ ; enabled = MyEnabled ; action = MyAction } mySystem : System ℕ MyEvent mySystem = record { stateMachine = MyStateMachine ; weakFairness = MyWeakFairness } myInvariant : Invariant MyStateMachine (2 ≤_) myInvariant (init x) = ≤-reflexive x myInvariant (step {ps} {inc} rs enEv) = ≤-stepsˡ 1 (myInvariant rs) myInvariant (step {ps} {inc2} rs enEv) = ≤-stepsˡ 2 (myInvariant rs) open LeadsTo ℕ MyEvent mySystem -- A state equals to n leads to a state equals to (1 + n) or equals to (2 + n) progressDumb : ∀ {n : ℕ} → (n ≡_) l-t ((1 + n ≡_) ∪ (2 + n ≡_)) progressDumb = viaEvSet MyEventSet w0 ( λ { inc ⊤ → hoare λ { refl enEv → inj₁ refl} ; inc2 ⊤ → hoare λ { refl enEv → inj₂ refl} }) ( λ { inc ⊥ → ⊥-elim (⊥ tt) ; inc2 ⊥ → ⊥-elim (⊥ tt)} ) λ rs n≡s → inc , tt , tt n<m+n : ∀ {n m} → 0 < m → n < m + n n<m+n {zero} {suc m} x = s≤s z≤n n<m+n {suc n} {suc m} x = s≤s (m≤n+m (suc n) m) progress-< : ∀ n → (n ≡_) l-t (n <_) progress-< n = viaTrans progressDumb (viaInv (λ { rs (inj₁ refl) → s≤s ≤-refl ; rs (inj₂ refl) → s≤s (m≤n+m n 1)})) {- A predicate on states, parameterized by m (target). The d parameter is the "distance" from the target m from state s. QUESTION : We are generalizing Z to be of a given type, however in myWFR we are using it knowing that is ℕ because we apply _≡_ and _+_ -} F : ∀ {m} → ℕ → Z → Set F {m} d s = m ≡ d + s wfr-1 : ∀ {m} → (s : Z) → (m ≤ s) ⊎ ∃[ x ] F {m} x s wfr-1 {m} s with m ≤? s ... | yes yy = inj₁ yy ... | no s<m = inj₂ (m ∸ s , sym (m∸n+n≡m (≰⇒≥ s<m)) ) progress-1st : ∀ {n m} → (n ≡_) l-t ( (m ≤_) ∪ [∃ x ∶ F {m} x ] ) progress-1st {n} {m} = viaInv (λ {s} rs n≡s → wfr-1 s) -- A state which distance to m is 0 (if we are in the state m) -- leads to a state greater than m progress-d0 : ∀ {m} → F {m} 0 l-t ( (m ≤_) ∪ [∃ x ⇒ _< 0 ∶ F {m} x ] ) progress-d0 {m} = viaInv (λ { {s} rs refl → inj₁ ≤-refl }) progress-d1 : ∀ {m} → F {m} 1 l-t ((m ≤_) ∪ [∃ x ⇒ _< 1 ∶ F {m} x ] ) progress-d1 {m} = viaEvSet MyEventSet w0 (λ { inc ⊤ → hoare (λ { refl _ → inj₁ ≤-refl }) ; inc2 ⊤ → hoare (λ { refl _ → inj₁ (≤-step ≤-refl) }) }) (λ { inc ⊥ → ⊥-elim (⊥ tt) ; inc2 ⊥ → ⊥-elim (⊥ tt) }) λ _ _ → inc , tt , tt progress-d2 : ∀ {m w} → F {m} (2 + w) l-t ( (m ≤_) ∪ [∃ x ⇒ _< (2 + w) ∶ F {m} x ] ) progress-d2 {m} {w} = viaEvSet MyEventSet w0 (λ { inc ⊤ → hoare λ { {ps} refl _ → inj₂ (suc w , ≤-refl , cong suc (sym (+-suc w ps)) )} ; inc2 ⊤ → hoare λ { {ps} refl _ → inj₂ (w , ≤-step ≤-refl , sym (trans (+-suc w (suc ps)) (cong suc (+-suc w ps)))) } }) (λ { inc ⊥ → ⊥-elim (⊥ tt) ; inc2 ⊥ → ⊥-elim (⊥ tt) }) λ _ _ → inc , tt , tt progress-2nd : ∀ {m w} → F {m} w l-t ((m ≤_) ∪ [∃ x ⇒ _< w ∶ F {m} x ] ) progress-2nd {m} {zero} = progress-d0 progress-2nd {m} {suc zero} = progress-d1 progress-2nd {m} {suc (suc w)} = progress-d2 -- A state equals to n leads to a state greater or equal to m, ∀ m. -- In other words, from n we can go to every possible state m steps -- away from n progress : ∀ {n m : ℕ} → (n ≡_) l-t (m ≤_) progress {n} {m} = viaWFR (F {m}) progress-1st λ w → progress-2nd
/- Copyright (c) 2020 Chrisil Ouseph. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chrisil Ouseph -/ import topology.instances.complex tactic /-! # Path-Connectedness This file defines path-connectedness for pairs of points of a topological space, path components as well as path-connected subsets of a space and path-connected spaces. We build an interface for these definitions and prove basic related theorems, including pointwise path-connectedness is an equivalence relation and path-connectedness implies connectedness but not vice-versa (deleted comb space). We also show some side-lemmas like connectedness of a dense subset implies that of the entire set, continuity on restricted domains and an alternate characterisation of connectedness. ## Important definitions and classes * `are_path_connected` : path-connectedness of pairs of points * `is_pre_path_connected`, `is_path_connected` : path-connected sets (the latter being non-empty) * `pre_path_connected_space`, `path_connected_space` : path-connected spaces (similar to previous) * `path_component` : path_components of a space ## Implementation notes Path-connectedness for sets and points has been implemented as `Prop`, while path-connected spaces have been defined as classes. ## References * J. R. Munkres : *Topology* : https://www.pearson.com/us/higher-education/product/Munkres-Topology-2nd-Edition/9780131816299.html * K. Conrad : *Spaces that are Connected but not Path-Connected* : https://kconrad.math.uconn.edu/blurbs/topology/connnotpathconn.pdf The theorem `continuous_on_if` uses a lemma proved under `continuous_if` in *topology\basic.lean*. The interface for path-connectedness as well as several of the other proofs have been inspired from *topology\subset_properties.lean*. -/ open set variables {α : Type*} {β : Type*} variables [topological_space α] [topological_space β] variables {A B : set α} variables a b c : A local notation `I01` := Icc (0 : ℝ) 1 /-- If a dense subset is preconnected, then so is the entire set -/ theorem is_preconnected.dense_subset (hAB : A ⊆ B) (hBcA : B ⊆ closure A) (hA : is_preconnected A) : is_preconnected B := λ C D hCo hDo hcov ⟨p, hpB, hpC⟩ ⟨q, hqB, hqD⟩, let ⟨x, hxC, hxA⟩ := mem_closure_iff.mp (hBcA hpB) C hCo hpC in let ⟨y, hyC, hyD⟩ := mem_closure_iff.mp (hBcA hqB) D hDo hqD in let ⟨w, hwA, hwCD⟩ := hA C D hCo hDo (trans hAB hcov) ⟨x, hxA, hxC⟩ ⟨y, hyD, hyC⟩ in ⟨w, hAB hwA, hwCD⟩ /-- Continuity on restricted domains -/ theorem continuous_on_if {D : set α} {p : α → Prop} {f g : α → β} {h : ∀ a, decidable (p a)} (hp : ∀ a ∈ frontier {a | p a} ∩ D, f a = g a) (hf : continuous_on f $ closure {x | p x} ∩ D) (hg : continuous_on g $ closure {x | ¬p x} ∩ D) : continuous_on (λ a, @ite (p a) (h a) β (f a) (g a)) D := begin rw continuous_on_iff_is_closed, intros s hs, obtain ⟨sf, hsfc, hsf⟩ := (continuous_on_iff_is_closed.mp hf) s hs, obtain ⟨sg, hsgc, hsg⟩ := (continuous_on_iff_is_closed.mp hg) s hs, refine ⟨sf ∩ closure {a : α | p a} ∪ sg ∩ closure {a : α | ¬p a}, _, _⟩, { simp only [is_closed_closure, is_closed_union, is_closed_inter, *] }, suffices heq : (λ a, ite (p a) (f a) (g a)) ⁻¹' s ∩ D = ((f ⁻¹' s ∩ closure {a | p a}) ∪ (g ⁻¹' s ∩ closure {a | ¬ p a})) ∩ D, { rw [heq, union_inter_distrib_right, union_inter_distrib_right], assoc_rw [hsf, hsg] }, ext a, classical, by_cases hf : a ∈ frontier {a | p a} ∩ D, { have hac := hf.left.left, have hai : a ∈ closure {a | ¬ p a} := (@closure_compl _ _ p).symm ▸ mem_compl hf.left.right, by_cases hpa : p a; { simp [hpa, hp a hf, hac, hai, iff_def]; exact and.intro }}, rw [inter_comm, inter_comm _ D], refine and_congr_right (λ had, _), replace hf := not_and'.mp hf had, by_cases hpa : p a, { have hc : a ∈ closure {a | p a} := subset_closure hpa, have hnc : a ∉ closure {a | ¬ p a}, { show a ∉ closure {a | p a}ᶜ, simpa [closure_compl, frontier, hc] using hf }, simp [hpa, hc, hnc] }, have hc : a ∈ closure {a | ¬ p a} := subset_closure hpa, have hnc : a ∉ closure {a | p a}, { change a ∈ closure {a | p a}ᶜ at hc, simp [closure_compl] at hc, simpa [frontier, hc] using hf }, simp [hpa, hc, hnc], end /-- Two points in a set `A` are path-connected if there exists a path in `A` between them. -/ def are_path_connected (a b : A) := ∃ f : ℝ → α, (∀ x ≤ 0, f x = a) ∧ (∀ x, 1 ≤ x → f x = b) ∧ range f ⊆ A ∧ continuous f theorem are_path_connected.refl : are_path_connected a a := ⟨(λ _, a), (λ _ _, rfl), (λ _ _, rfl), (λ _ ⟨_, hx⟩, hx ▸ a.2), continuous_const⟩ theorem are_path_connected.symm : are_path_connected a b → are_path_connected b a := λ ⟨f, h0, h1, hr, hc⟩, ⟨λ x, f (1-x), λ _ _, h1 _ (by linarith), λ _ _, h0 _ (by linarith), λ y ⟨x, hy⟩, hr ⟨1-x, hy⟩, continuous.comp hc $ continuous.sub continuous_const continuous_id⟩ theorem are_path_connected.trans : are_path_connected a b → are_path_connected b c → are_path_connected a c := begin rintro ⟨f, hf0, hf1, hfr, hfc⟩ ⟨g, hg0, hg1, hgr, hgc⟩, refine ⟨λ x, ite (x ≤ 1/2) (f (2*x)) (g (2*x - 1)), λ x hx, _, λ x hx, _, _, _⟩, { rw ←hf0 (2*x) (by linarith), exact if_pos (by linarith) }, { rw ←hg1 (2*x-1) (by linarith), exact if_neg (by linarith) }, { rintro y ⟨x, rfl⟩, by_cases h0 : x ≤ 1/2, exact hfr ⟨2*x, (if_pos h0).symm⟩, exact hgr ⟨2*x - 1, (if_neg h0).symm⟩ }, refine continuous_if (λ x hx, _) _ _, { have h : x = 1/2 := (frontier_le_subset_eq continuous_id continuous_const) hx, norm_num [h, hg0, hf1] }, { exact continuous.comp hfc (continuous.mul continuous_const continuous_id) }, refine continuous.comp hgc (continuous.add _ continuous_const), exact continuous.mul continuous_const continuous_id, end instance : is_equiv A are_path_connected := {refl:= are_path_connected.refl, trans:= are_path_connected.trans, symm:= are_path_connected.symm} theorem are_path_connected.mono {a b : A} {B} (hAB : A ⊆ B) : are_path_connected a b → are_path_connected ⟨a.1, hAB a.2⟩ ⟨b.1, hAB b.2⟩ := λ ⟨p, hp0, hp1, hpr, hpc⟩, ⟨p, hp0, hp1, trans hpr hAB, hpc⟩ /-- A weaker characterisation of `are_path_connected` for ease of proving concrete examples -/ theorem are_path_connected_iff {a b : A} : are_path_connected a b ↔ ∃ f : ℝ → α, f 0 = a ∧ f 1 = b ∧ f '' I01 ⊆ A ∧ continuous_on f I01 := begin split; rintro ⟨p, h0, h1, hr, hc⟩, { use [p, h0 0 (le_refl 0), h1 1 (le_refl 1), trans (image_subset_range _ _) hr, continuous.continuous_on hc] }, refine ⟨λ x, ite (x ≤ 0) a (ite (x ≥ 1) b (p x)),λ _ hx, if_pos hx, λ _ hx, trans (if_neg (by linarith)) (if_pos hx), _, _⟩, { rintro y ⟨x, rfl⟩, by_cases hx0 : x ≤ 0, {convert a.2, exact if_pos hx0}, by_cases hx1 : x ≥ 1, {convert b.2, exact trans (if_neg hx0) (if_pos hx1)}, refine hr ⟨x, _, symm $ trans (if_neg hx0) (if_neg hx1)⟩, exact Ioo_subset_Icc_self ⟨lt_of_not_ge hx0, lt_of_not_ge hx1⟩ }, rw continuous_iff_continuous_on_univ, refine continuous_on_if (λ x hx, _) continuous_on_const _, { have : x = 0 := (frontier_le_subset_eq continuous_id continuous_const) hx.left, rw [this, if_neg (not_le_of_gt zero_lt_one), h0] }, refine continuous_on_if (λ x hx, _) continuous_on_const _, { have : 1 = x := (frontier_le_subset_eq continuous_const continuous_id) hx.left, cc }, push_neg, show continuous_on p (closure (Iio 1) ∩ (closure (Ioi 0) ∩ univ)), rwa [inter_univ, closure_Iio, closure_Ioi, inter_comm], end /-- A set is pre-path-connected if each pair of points in it is path-connected. -/ def is_pre_path_connected (A : set α) := ∀ a b, @are_path_connected _ _ A a b theorem is_pre_path_connected_empty : is_pre_path_connected (∅ : set α) := λ x, x.2.elim theorem is_pre_path_connected_sUnion (x : α) {c : set (set α)} (H1 : ∀ s ∈ c, x ∈ s) (H2 : ∀ s ∈ c, is_pre_path_connected s) : is_pre_path_connected (⋃₀ c) := have H : ∀ y ∈ ⋃₀ c, ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ is_pre_path_connected t, from λ y ⟨s, hs, hy⟩, ⟨s, subset_sUnion_of_mem hs, H1 s hs, hy, H2 s hs⟩, λ a b, let ⟨sa, hsa, hxsa, hasa, hsap⟩ := H a a.2 in let ⟨sb, hsb, hxsb, hbsb, hsbp⟩ := H b b.2 in let hxa := are_path_connected.mono hsa (hsap ⟨x, hxsa⟩ ⟨a, hasa⟩) in let hxb := are_path_connected.mono hsb (hsbp ⟨x, hxsb⟩ ⟨b, hbsb⟩) in trans (symm hxa) hxb theorem is_pre_path_connected_Union {γ : Type*} (x : α) {p : γ → set α} (hx : ∀ g, x ∈ p g) (hp : ∀ g, is_pre_path_connected (p g)) : is_pre_path_connected (⋃ i, p i) := λ ⟨a, ha⟩ ⟨b, hb⟩, let ⟨ga, hga⟩ := mem_Union.mp ha in let ⟨gb, hgb⟩ := mem_Union.mp hb in trans (are_path_connected.mono (subset_Union _ _) (hp ga ⟨a, hga⟩ ⟨x, hx ga⟩)) (are_path_connected.mono (subset_Union _ _) (hp gb ⟨x, hx gb⟩ ⟨b, hgb⟩)) theorem is_pre_path_connected.union (x : α) {s t : set α} (hxs : x ∈ s) (hxt : x ∈ t) (hs : is_pre_path_connected s) (ht : is_pre_path_connected t) : is_pre_path_connected (s ∪ t) := sUnion_pair s t ▸ is_pre_path_connected_sUnion x (by rintro r (rfl | rfl | h); assumption) (by rintro r (rfl | rfl | h); assumption) theorem is_pre_path_connected.image {s : set α} (H : is_pre_path_connected s) (f : α → β) (hf : continuous_on f s) : is_pre_path_connected (f '' s) := λ ⟨fx, x, hx, hfx⟩ ⟨fy, y, hy, hfy⟩, let ⟨p, hp0, hp1, hpr, hpc⟩ := H ⟨x, hx⟩ ⟨y, hy⟩ in let hpi := (trans (image_subset_range p I01) hpr) in are_path_connected_iff.mpr ⟨λ x, f (p x), by simp [hp0 0 (le_refl 0), hfx], by simp [hp1 1 (le_refl 1), hfy], symm (image_comp f p I01) ▸ image_subset f hpi, continuous_on.comp hf (continuous.continuous_on hpc) (image_subset_iff.mp hpi)⟩ theorem is_pre_path_connected.is_pre_connected (h : is_pre_path_connected A) : is_preconnected A := begin have hw := @is_preconnected_univ ℝ _ _, dsimp [is_preconnected] at hw ⊢, contrapose! hw, obtain ⟨U, V, hUo, hVo, hcov, ⟨x, ⟨hxa, hxu⟩⟩, ⟨y, ⟨hya, hyu⟩⟩, hi⟩ := hw, obtain ⟨f, h0, h1, hr, hc⟩ := h ⟨x, hxa⟩ ⟨y, hya⟩, refine ⟨f ⁻¹' U, f ⁻¹' V, hc U hUo, hc V hVo, _, ⟨0, _⟩, ⟨1, _⟩, _⟩, { rw ←preimage_union, refine trans (trans _ (preimage_mono hr)) (preimage_mono hcov), rw preimage_range }, { rwa [univ_inter, mem_preimage, h0 0 (le_refl 0)] }, { rwa [univ_inter, mem_preimage, h1 1 (le_refl 1)] }, contrapose! hi, rw [univ_inter, ←preimage_inter] at hi, cases hi with z hz, use [f z, hr ⟨z, rfl⟩, hz], end /-- A set is path-connected if it is nonempty and pre-path-connected. -/ def is_path_connected (A : set α) := A.nonempty ∧ is_pre_path_connected A theorem is_path_connected.nonempty (h : is_path_connected A) : A.nonempty := h.left theorem is_path_connected.is_pre_path_connected (h : is_path_connected A) : is_pre_path_connected A := h.right theorem is_path_connected_singleton {a} : is_path_connected ({a} : set α) := ⟨⟨a, rfl⟩, λ ⟨x, hx⟩ ⟨y, hy⟩, by convert are_path_connected.refl ⟨a, mem_singleton a⟩⟩ lemma is_path_connected_iff : is_path_connected A ↔ (∃ x : A, ∀ y : A, are_path_connected x y) := ⟨λ ⟨⟨w, hw⟩, ha⟩, ⟨⟨w, hw⟩, λ x, ha ⟨w, hw⟩ x⟩, λ ⟨⟨w, hw⟩, ha⟩, ⟨⟨w, hw⟩, λ x y, trans (symm (ha x)) (ha y)⟩⟩ theorem is_path_connected.is_connected (h : is_path_connected A): is_connected A := ⟨h.left, is_pre_path_connected.is_pre_connected h.right⟩ theorem is_path_connected.union {s t : set α} (hst : (s ∩ t).nonempty) (hs : is_path_connected s) (ht : is_path_connected t) : is_path_connected (s ∪ t) := let ⟨x, hxs, hxt⟩ := hst in ⟨⟨x, or.inl hxs⟩, is_pre_path_connected.union x hxs hxt hs.right ht.right⟩ theorem is_path_connected.image {s : set α} (H : is_path_connected s) (f : α → β) (hf : continuous_on f s) : is_path_connected (f '' s) := let ⟨x, hx⟩ := H.1 in ⟨⟨f x, mem_image_of_mem f hx⟩, is_pre_path_connected.image H.2 f hf⟩ /-- The path component of a point is the maximal path connected set containing this point. -/ def path_component (x) := ⋃₀ {s : set α | is_pre_path_connected s ∧ x ∈ s} theorem mem_path_component {x : α} : x ∈ path_component x := mem_sUnion_of_mem (mem_singleton x) ⟨is_path_connected_singleton.right, mem_singleton x⟩ theorem is_path_connected_path_component {x : α} : is_path_connected (path_component x) := ⟨⟨x, mem_path_component⟩, is_pre_path_connected_sUnion x (λ _, and.right) (λ _, and.left)⟩ theorem subset_path_component {x : α} {A : set α} (ha : is_pre_path_connected A) (hx : x ∈ A) : A ⊆ path_component x := λ z hz, mem_sUnion_of_mem hz ⟨ha, hx⟩ theorem path_component.subset_connected_component (x : α) : path_component x ⊆ connected_component x := subset_connected_component (is_pre_path_connected.is_pre_connected is_path_connected_path_component.right) mem_path_component /-- A path connected space is one where all points are path connected. -/ class pre_path_connected_space (α : Type*) [topological_space α] : Prop := (is_pre_path_connected_univ [] : is_pre_path_connected (univ : set α)) section prio set_option default_priority 100 -- see Note [default priority] /-- A path connected space is a nonempty one where all points are path connected. -/ class path_connected_space (α : Type*) [topological_space α] extends pre_path_connected_space α : Prop := (to_nonempty : nonempty α) end prio lemma subtype.pre_path_connected_space (hA : is_pre_path_connected A) : pre_path_connected_space A := ⟨λ a b, let ⟨p, hp0, hp1, hpr, hpc⟩ := hA a b in ⟨(λ x, ⟨p x, hpr $ mem_range_self _⟩), λ x hx, by simp [hp0 x hx], λ x hx, by simp [hp1 x hx], subset_univ _, continuous_subtype_mk _ hpc⟩⟩ theorem is_pre_path_connected_univ [h : pre_path_connected_space α] : is_pre_path_connected (univ : set α) := h.1 lemma subtype.path_connected_space (hA : is_path_connected A) : path_connected_space A := { is_pre_path_connected_univ := (subtype.pre_path_connected_space hA.right).1, to_nonempty := hA.nonempty.to_subtype } theorem exists_path [pre_path_connected_space α] (a b) : ∃ f : ℝ → α, (∀ x ≤ 0, f x = a) ∧ (∀ x, 1 ≤ x → f x = b) ∧ continuous f := let ⟨p, hp0, hp1, _, hpc⟩ := is_pre_path_connected_univ ⟨a, mem_univ a⟩ ⟨b, mem_univ b⟩ in ⟨p, hp0, hp1, hpc⟩ theorem exists_path' [pre_path_connected_space α] (a b) : ∃ f : ℝ → α, f 0 = a ∧ f 1 = b ∧ continuous_on f I01 := let ⟨p, hp0, hp1, _, hpc⟩ := are_path_connected_iff.mp (is_pre_path_connected_univ ⟨a, mem_univ a⟩ ⟨b, mem_univ b⟩) in ⟨p, hp0, hp1, hpc⟩ -- This section proves a classic counterexample which is connected but not path-connected. section comb_space open complex metric /-- The horizontal closed line segment between (x₁, y) and (x₂, y) -/ def hor_Icc (y x1 x2 : ℝ) : set ℂ := {z | z.im = y ∧ z.re ∈ Icc x1 x2} /-- The vertical closed line segment between (x, y₁) and (x, y₂) -/ def ver_Icc (x y1 y2 : ℝ) : set ℂ := {z | z.re = x ∧ z.im ∈ Icc y1 y2} /-- The comb space without the zero bristle in ℂ -/ def partial_comb := (⋃ (n : ℕ), ver_Icc (1/n.succ) 0 1) ∪ hor_Icc 0 0 1 /-- The deleted comb space in ℂ -/ def deleted_comb := partial_comb ∪ {I} example : is_connected deleted_comb := begin refine ⟨⟨0, or.inl $ or.inr ⟨rfl, zero_re ▸ (left_mem_Icc.mpr zero_le_one)⟩⟩, is_preconnected.dense_subset (subset_union_left _ _) (union_subset subset_closure $ singleton_subset_iff.mpr $ metric.mem_closure_iff.mpr $ λ e hep, _) (is_pre_path_connected.is_pre_connected _)⟩, { cases exists_nat_one_div_lt hep with n hn, use [⟨1/(n+1), 1⟩, or.inl $ mem_Union.mpr ⟨n, rfl, right_mem_Icc.mpr zero_le_one⟩], rwa [mk_eq_add_mul_I, of_real_one, one_mul, dist_comm, dist_eq, add_sub_cancel, abs_of_real, abs_of_pos], apply one_div_pos_of_pos, exact_mod_cast nat.succ_pos n }, have mul_I01 : ∀ {a b}, a ∈ I01 → b ∈ I01 → a * b ∈ I01 := λ a b ⟨ha0, ha1⟩ ⟨hb0, hb1⟩, ⟨zero_mul (0:ℝ) ▸ mul_le_mul ha0 hb0 (le_refl 0) ha0, one_mul (1:ℝ) ▸ mul_le_mul ha1 hb1 hb0 (zero_le_one)⟩, unfold partial_comb, rw Union_union, refine is_pre_path_connected_Union 0 (λ _, or.inr ⟨rfl, left_mem_Icc.mpr zero_le_one⟩) (λ n, is_pre_path_connected.union ⟨1/n.succ, 0⟩ ⟨rfl, left_mem_Icc.mpr zero_le_one⟩ ⟨rfl, _⟩ _ _); try {apply is_path_connected.is_pre_path_connected ∘ is_path_connected_iff.mpr}, split, { norm_num, norm_cast, linarith }, { rw div_le_iff; norm_num, norm_cast, linarith }, { refine ⟨⟨⟨1/n.succ, 0⟩, ⟨rfl, left_mem_Icc.mpr zero_le_one⟩⟩, _⟩, rintro ⟨y, hyr, hyi⟩, refine are_path_connected_iff.mpr ⟨λ x, ⟨y.re, y.im * x⟩ , _⟩, rw [mul_zero, mul_one], refine ⟨congr_arg coe hyr, eta y, _, continuous.continuous_on _⟩, { rintro _ ⟨x, hx, rfl⟩, exact ⟨hyr, mul_I01 hyi hx⟩ }, rw @funext _ _ (λ x, (⟨y.re, y.im * x⟩ : ℂ)) _ (λ x, mk_eq_add_mul_I (y.re) (y.im * x)), refine continuous.add continuous_const (continuous.mul _ continuous_const), exact continuous.comp continuous_of_real (continuous.mul continuous_const continuous_id) }, refine ⟨⟨0, rfl, left_mem_Icc.mpr zero_le_one⟩, _⟩, rintro ⟨y, hyi, hyr⟩, refine are_path_connected_iff.mpr ⟨λ x, y * x , _⟩, norm_cast, refine ⟨mul_zero y, mul_one y, _, _⟩, { rintro _ ⟨x, hx, rfl⟩, use [by norm_num [hyi], by norm_num [mul_I01 hyr hx]] }, exact continuous.continuous_on (continuous.mul continuous_const continuous_of_real), end /-- The set of reciprocals of the natural numbers in ℝ is totally disconnected. -/ theorem is_totally_disconnected_nat_reciprocals : is_totally_disconnected {t : ℝ | ∃ n : ℕ, t = 1/n} := begin intros s hsk hs, constructor, rintro ⟨x, hx⟩ ⟨r, hr⟩, rw subtype.mk_eq_mk, by_contra hw, replace hw := lt_or_gt_of_ne hw, wlog := hw using x r, obtain ⟨x, rfl⟩ := hsk hx, obtain ⟨_ | r, rfl⟩ := hsk hr, { norm_num at hw, norm_cast at hw, linarith }, have hhqr : (1:ℝ)/r.succ.succ < 1/r.succ, { refine one_div_lt_one_div_of_lt (by exact_mod_cast nat.succ_pos _) _, exact_mod_cast lt_add_one _ }, by_cases hx1 : x = 1, { rw hx1 at hw, replace hw := lt_of_one_div_lt_one_div (by norm_num) hw, norm_num at hw, norm_cast at hw, linarith }, have hhql : (1:ℝ)/x ≤ 1/r.succ.succ, { obtain _ | _ | x := x, { norm_num, norm_cast, linarith }, { contradiction }, { refine one_div_le_one_div_of_le (by exact_mod_cast nat.succ_pos _) _, replace hw := lt_of_one_div_lt_one_div (by exact_mod_cast nat.succ_pos _) hw, norm_num at hw ⊢, norm_cast at hw ⊢, linarith }}, obtain ⟨q, hql, hqr⟩ := exists_rat_btwn hhqr, obtain ⟨w, _, hww⟩ := hs (Iio q) (Ioi q) is_open_Iio is_open_Ioi (λ w hw, _) ⟨1/x, hx, lt_of_le_of_lt hhql hql⟩ ⟨1/r.succ, hr, hqr⟩, { change w < q ∧ w > q at hww, cases hww, linarith }, obtain ⟨_ | w, rfl⟩ := hsk hw, { exact or.inl (lt_trans (by norm_num; norm_cast; linarith) hql) }, by_cases hwp : (1:ℝ)/w.succ ≥ 1/r.succ, { exact or.inr (lt_of_lt_of_le hqr hwp) }, suffices heq : (1:ℝ)/w.succ ≤ 1/r.succ.succ, { exact or.inl (lt_of_le_of_lt heq hql) }, refine one_div_le_one_div_of_le (by exact_mod_cast nat.succ_pos _) _, replace hw := lt_of_one_div_lt_one_div (by exact_mod_cast nat.succ_pos _) (not_le.mp hwp), norm_num at hw ⊢, norm_cast at hw ⊢, linarith end example : ¬ is_pre_path_connected deleted_comb := begin let V := ball I (1/2), have hV : ∀ x ∈ V, x ∈ deleted_comb → x = I ∨ x.im ∈ I01 ∧ ∃ n : ℕ, x.re = 1/n.succ, { rintro z hzv (⟨⟨_, ⟨n, rfl⟩, ⟨hfr, hfi⟩⟩ | ⟨hfi, hfr0, hfr1⟩⟩ | hc), { exact or.inr ⟨hfi, n, hfr⟩ }, { change abs (z - I) < 1/2 at hzv, replace hzv := lt_of_le_of_lt (abs_im_le_abs _) hzv, rw [sub_im, hfi] at hzv, norm_num at hzv }, exact or.inl (mem_singleton_iff.mp hc) }, intros hw, obtain ⟨f, hf0, hf1, hfr, hfc⟩ := hw ⟨I, singleton_subset_iff.mp $ subset_union_of_subset_right subset.rfl _⟩ ⟨0, or.inl $ or.inr ⟨rfl, zero_re ▸ (left_mem_Icc.mpr zero_le_one)⟩⟩, let A := f ⁻¹' {I}, suffices hA : is_open A, { cases is_clopen_iff.mp ⟨hA, continuous_iff_is_closed.mp hfc _ is_closed_singleton⟩ with h h, { exact (subset.antisymm_iff.mp h).left (hf0 0 (le_refl 0)) }, have hw1 : (1:ℝ) ∈ A := h.symm ▸ mem_univ 1, rw [mem_preimage, hf1 1 (le_refl 1), mem_singleton_iff] at hw1, injections, linarith }, rw is_open_iff, intros x hx, change f x = I at hx, obtain ⟨d, hdp, hd⟩ := (continuous_iff.mp hfc) x (1/2) (by norm_num), rw hx at hd, use [d, hdp], intros z hz, obtain hzp | ⟨hi, n, hr⟩ := hV (f z) (hd z hz) (hfr ⟨z, rfl⟩), { assumption }, suffices hs : subsingleton (re ∘ f '' ball x d), { cases hs with hs, specialize hs ⟨(f z).re, z, hz, rfl⟩ ⟨0, x, mem_ball_self hdp, by norm_num [hx]⟩, rw subtype.mk_eq_mk.mp hs at hr, replace hr := eq_zero_of_one_div_eq_zero hr.symm, norm_cast at hr }, apply is_totally_disconnected_nat_reciprocals, { rintro s ⟨r, hr, rfl⟩, obtain hsp | ⟨hsi, m, hsr⟩ := hV (f r) (hd r hr) (hfr ⟨r, rfl⟩), { use 0, norm_num [hsp] }, use m.succ, norm_num [hsr] }, refine is_preconnected.image _ _ (continuous.continuous_on (continuous.comp continuous_re hfc)), exact (real.ball_eq_Ioo x d).symm ▸ is_preconnected_Ioo, end end comb_space example (A : set ℝ) : is_pre_path_connected A ↔ is_preconnected A := begin refine ⟨is_pre_path_connected.is_pre_connected, λ h a b, _⟩, wlog := le_total a b using a b; try {exact symm this}, refine are_path_connected_iff.mpr ⟨λ x, a + (b - a) * x, by norm_num, by norm_num, trans _ $ (is_preconnected_iff_forall_Icc_subset.mp h) a b a.2 b.2 case, continuous_on_const.add $ continuous_on_const.mul continuous_on_id⟩, rintro _ ⟨x, hx, rfl⟩, use [(le_add_iff_nonneg_right _).mpr $ mul_nonneg (sub_nonneg.mpr case) hx.1, le_sub_iff_add_le'.mp $ mul_le_of_le_one_right (sub_nonneg.mpr case) hx.2], end /--A set is `preconnected` iff continuous functions from it to a discrete two-space are constant.-/ theorem is_preconnected_iff_continuous_const : is_preconnected A ↔ ∀ f : α → ({0,1} : set ℝ), continuous_on f A → subsingleton (f '' A) := begin split, { intros hA f hfc, split, rintro ⟨_, ⟨x, hx, rfl⟩⟩ ⟨_, ⟨y, hy, rfl⟩⟩, obtain hw := is_totally_disconnected_nat_reciprocals _ _ (is_preconnected.image hA (λ x, (f x).1) (continuous_subtype_coe.comp_continuous_on hfc)), { exact subtype.mk_eq_mk.mpr (subtype.eq $ subtype.mk_eq_mk.mp $ hw ⟨f x, x, hx, rfl⟩ ⟨f y, y, hy, rfl⟩) }, rintro _ ⟨w, hw, rfl⟩, cases (f w).2 with h h, { use 0, norm_num [h] }, use 1, norm_num [mem_singleton_iff.mp h] }, intro h, classical, by_contra hw, unfold is_preconnected at hw, push_neg at hw, rcases hw with ⟨U, V, huo, hvo, hc, ⟨x, hxa, hxu⟩, ⟨y, hya, hyv⟩, he⟩, obtain hw := h (λ x, if x ∈ U then ⟨0, or.inl rfl⟩ else ⟨1, or.inr $ mem_singleton 1⟩) _, { specialize hw ⟨⟨0, or.inl rfl⟩, x, hxa, if_pos hxu⟩ ⟨⟨1, or.inr $ mem_singleton 1⟩, y, hya, if_neg (λ hw, he ⟨y, hya, hw, hyv⟩)⟩, injections, linarith }, rw continuous_on_iff, intros a haa T hto h01, split_ifs at h01 with hau hnau, { rw [if_preimage, preimage_const, if_pos h01, inter_univ], use [U, huo, hau, trans (inter_subset_left U A) (subset_union_left U _)] }, rw [if_preimage, union_comm, preimage_const, if_pos h01, inter_univ], use [V, hvo, or.resolve_left (hc haa) hau, subset_union_of_subset_left (λ w ⟨hwv, hwa⟩ hwu, he ⟨w, hwa, hwu, hwv⟩) _], end
[STATEMENT] lemma Nonce_isnt_MPair [iff]: "~ is_MPair (Nonce n)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<not> is_MPair (Nonce n) [PROOF STEP] by simp
/- ----------------------------------------------------------- Negligible functions. TO-DO connect with security parameter, (or not, as in Nowak), and refactor proofs/improve variable naming ----------------------------------------------------------- -/ import analysis.special_functions.exp_log import analysis.special_functions.pow import data.nat.basic import data.real.basic /- A function f : ℤ≥1 → ℝ is called negligible if for all c ∈ ℝ>0 there exists n₀ ∈ ℤ≥1 such that n₀ ≤ n → |f(n)| < 1/n^c -/ def negligible (f : ℕ → ℝ) := ∀ c > 0, ∃ n₀, ∀ n, n₀ ≤ n → abs (f n) < 1 / (n : ℝ)^c def negligible' (f : ℕ → ℝ) := ∀ (c : ℝ), ∃ (n₀ : ℕ), ∀ (n : ℕ), 0 < c → n₀ ≤ n → abs (f n) < 1 / n^c lemma negl_equiv (f : ℕ → ℝ) : negligible f ↔ negligible' f := begin split, {-- Forward direction intros h c, have arch := exists_nat_gt c, cases arch with k hk, let k₀ := max k 1, have k_leq_k₀ : k ≤ k₀ := le_max_left k 1, have kr_leq_k₀r : (k:ℝ) ≤ k₀ := nat.cast_le.mpr k_leq_k₀, have k₀_pos : 0 < k₀ := by {apply le_max_right k 1}, have a := h k₀ k₀_pos, cases a with n' hn₀, let n₀ := max n' 1, have n₀_pos : 0 < n₀ := by apply le_max_right n' 1, have n'_leq_n₀ : n' ≤ n₀ := le_max_left n' 1, use n₀, intros n c_pos hn, have hnnn : n' ≤ n := by linarith, have b : (n : ℝ)^c ≤ (n : ℝ)^(k₀ : ℝ) := begin apply real.rpow_le_rpow_of_exponent_le, norm_cast, linarith, linarith, end, have daf : (n : ℝ)^(k₀ : ℝ) = (n : ℝ)^k₀ := (n : ℝ).rpow_nat_cast k₀, rw daf at b, have d : 1 / (n : ℝ)^k₀ ≤ 1 / n^c := begin apply one_div_le_one_div_of_le, { -- Proving 0 < (n:ℝ) ^ c apply real.rpow_pos_of_pos, norm_cast, linarith, }, {exact b}, end, have goal : abs (f n) < 1 / n^c := calc abs(f n) < 1 / (n : ℝ)^k₀ : hn₀ n hnnn ... ≤ 1 / n^c : d, exact goal, }, {-- Reverse direction intros h c hc, cases h c with n₀ hn₀, use n₀, intros n hn, have goal := hn₀ n (nat.cast_pos.mpr hc) hn, rw (n : ℝ).rpow_nat_cast c at goal, exact goal, }, end lemma zero_negl : negligible (λn, 0) := begin intros c hc, use 1, intros n hn, norm_num, apply one_div_pos.mpr, apply pow_pos, have h : 0 < n := by linarith, exact nat.cast_pos.mpr h, end lemma negl_add_negl_negl {f g : ℕ → ℝ} : negligible f → negligible g → negligible (f + g) := begin intros hf hg, intros c hc, have hc1 : (c+1) > 0 := nat.lt.step hc, have hf2 := hf (c+1) hc1, have hg2 := hg (c+1) hc1, cases hf2 with nf hnf, cases hg2 with ng hng, let n₀ := max (max nf ng) 2, use n₀, intros n hn, let nr := (n:ℝ), have n_eq_nr : (n:ℝ) = nr := by refl, have tn : max nf ng ≤ n₀ := le_max_left (max nf ng) 2, have t2n₀ : 2 ≤ n₀ := le_max_right (max nf ng) 2, have t2n : 2 ≤ n := by linarith, have t2nr : 2 ≤ nr := begin have j := nat.cast_le.mpr t2n, rw n_eq_nr at j, norm_num at j, exact j, exact real.nontrivial, end, have tnr_pos : 0 < nr := by linarith, have t2na : (1 / nr) * (1/nr^c) ≤ (1 / (2 : ℝ)) * (1 / nr^c) := begin have ht2 : 0 < (1 / nr^c) := by {apply one_div_pos.mpr, exact pow_pos tnr_pos c}, apply (mul_le_mul_right ht2).mpr, apply one_div_le_one_div_of_le, exact zero_lt_two, exact t2nr, end, have tnr2 : 1 / nr^(c + 1) ≤ (1 / (2 : ℝ)) * (1 / nr^c) := calc 1 / nr ^ (c + 1) = (1 / nr)^(c + 1) : by rw one_div_pow ... = (1 / nr) * (1 / nr)^c : pow_succ (1 / nr) c ... = (1 / nr) * (1 / nr^c) : by rw one_div_pow ... ≤ (1 / (2 : ℝ)) * (1 / nr^c) : t2na, have tnf : nf ≤ n := calc nf ≤ n₀ : le_of_max_le_left tn ... ≤ n : hn, have tfn := hnf n tnf, have tf : abs (f n) < (1 / (2 : ℝ)) * (1 / nr^c) := by linarith, have tng : ng ≤ n := calc ng ≤ n₀ : le_of_max_le_right tn ... ≤ n : hn, have tgn := hng n tng, have tg : abs (g n) < (1/(2:ℝ)) * (1/nr^c) := by linarith, have goal : abs ((f + g) n) < 1 / nr ^ c := calc abs ((f + g) n) = abs (f n + g n) : by rw pi.add_apply f g n ... ≤ abs (f n) + abs (g n) : abs_add (f n) (g n) ... < (1/(2:ℝ)) * (1/nr^c) + abs (g n): by linarith ... < (1/(2:ℝ)) * (1/nr^c) + (1/(2:ℝ)) * (1/nr^c) : by linarith ... = 1/nr^c : by ring_nf, exact goal, end lemma bounded_negl_negl {f g : ℕ → ℝ} (hg : negligible g): (∀ n, abs (f n) ≤ abs (g n)) → negligible f := begin intro h, intros c hc, have hh := hg c hc, cases hh with n₀ hn₀, use n₀, intros n hn, have goal : abs (f n) < 1 / (n : ℝ) ^ c := calc abs (f n) ≤ abs (g n) : h n ... < 1 / (n : ℝ)^c: hn₀ n hn, exact goal, end lemma nat_mul_negl_negl {f : ℕ → ℝ} (m : ℕ): negligible f → negligible (λn, m * (f n)) := begin intros hf, induction m with k hk, { -- Base case norm_num, exact zero_negl, }, { -- Inductive step norm_num, have d : (λn, ((k : ℝ) + 1) * (f n)) = (λn, (k : ℝ) * (f n)) + (λn, f n) := by repeat {ring_nf}, rw d, apply negl_add_negl_negl, exact hk, exact hf, }, end lemma const_mul_negl_negl {f : ℕ → ℝ} (m : ℝ) : negligible f → negligible (λn, m * (f n)) := begin intro hf, -- Use Archimedian property to get arch : ℕ with abs m < arch have arch := exists_nat_gt (abs m), cases arch with k hk, apply bounded_negl_negl, { -- Demonstrate a negligible function kf have kf_negl := nat_mul_negl_negl k hf, exact kf_negl, }, { -- Show kf bounds mf from above intro n, have h : abs m ≤ abs (k : ℝ) := calc abs m ≤ (k : ℝ) : le_of_lt hk ... = abs (k : ℝ) : (nat.abs_cast k).symm, have goal : abs (m * f n) ≤ abs ((k : ℝ) * f n) := calc abs (m * f n) = abs m * abs (f n) : by rw abs_mul ... ≤ abs (k : ℝ) * abs (f n) : mul_mono_nonneg (abs_nonneg (f n)) h ... = abs ((k : ℝ) * f n) : by rw <- abs_mul, exact goal, }, end theorem neg_exp_negl : negligible ((λn, (1 : ℝ) / 2^n) : ℕ → ℝ) := by sorry -- Need to prove lim n^c/2^n = 0 by induction on c using L'Hopital's rule to apply inductive -- hypothesis /- begin let m := 2, have hm : 0 < 2 := zero_lt_two, have c2_negl := c2_mul_neg_exp_is_negl 2 hm, have r : (λ (n : ℕ), 16 * (1 / (2 ^ n * 16)): ℕ → ℝ) = ((λn, (1:ℝ)/2^n): ℕ → ℝ) := begin funext, have h : (1:ℝ) / 2^n / 16 = (1:ℝ) / (2^n * 16) := div_div_eq_div_mul 1 (2^n) 16, rw <- h, ring_nf, end, have goal := const_mul_negl_is_negl 16 c2_negl, norm_num at goal, rw <-r, exact goal, end -/
/** * * @file qwrapper_zlag2c.c * * PLASMA core_blas quark wrapper * PLASMA is a software package provided by Univ. of Tennessee, * Univ. of California Berkeley and Univ. of Colorado Denver * * @version 2.6.0 * @author Mathieu Faverge * @date 2010-11-15 * @precisions mixed zc -> ds * **/ #include <lapacke.h> #include "common.h" /***************************************************************************//** * **/ void QUARK_CORE_zlag2c(Quark *quark, Quark_Task_Flags *task_flags, int m, int n, int nb, const PLASMA_Complex64_t *A, int lda, PLASMA_Complex32_t *B, int ldb, PLASMA_sequence *sequence, PLASMA_request *request) { DAG_CORE_LAG2C; QUARK_Insert_Task(quark, CORE_zlag2c_quark, task_flags, sizeof(int), &m, VALUE, sizeof(int), &n, VALUE, sizeof(PLASMA_Complex64_t)*nb*nb, A, INPUT, sizeof(int), &lda, VALUE, sizeof(PLASMA_Complex32_t)*nb*nb, B, OUTPUT, sizeof(int), &ldb, VALUE, sizeof(PLASMA_sequence*), &sequence, VALUE, sizeof(PLASMA_request*), &request, VALUE, 0); } /***************************************************************************//** * **/ #if defined(PLASMA_HAVE_WEAK) #pragma weak CORE_zlag2c_quark = PCORE_zlag2c_quark #define CORE_zlag2c_quark PCORE_zlag2c_quark #endif void CORE_zlag2c_quark(Quark *quark) { int m; int n; PLASMA_Complex64_t *A; int lda; PLASMA_Complex32_t *B; int ldb; PLASMA_sequence *sequence; PLASMA_request *request; int info; quark_unpack_args_8(quark, m, n, A, lda, B, ldb, sequence, request); info = LAPACKE_zlag2c_work(LAPACK_COL_MAJOR, m, n, A, lda, B, ldb); if (sequence->status == PLASMA_SUCCESS && info != 0) plasma_sequence_flush(quark, sequence, request, info); } /***************************************************************************//** * **/ void QUARK_CORE_clag2z(Quark *quark, Quark_Task_Flags *task_flags, int m, int n, int nb, const PLASMA_Complex32_t *A, int lda, PLASMA_Complex64_t *B, int ldb) { QUARK_Insert_Task(quark, CORE_clag2z_quark, task_flags, sizeof(int), &m, VALUE, sizeof(int), &n, VALUE, sizeof(PLASMA_Complex32_t)*nb*nb, A, INPUT, sizeof(int), &lda, VALUE, sizeof(PLASMA_Complex64_t)*nb*nb, B, INOUT, sizeof(int), &ldb, VALUE, 0); } /***************************************************************************//** * **/ #if defined(PLASMA_HAVE_WEAK) #pragma weak CORE_clag2z_quark = PCORE_clag2z_quark #define CORE_clag2z_quark PCORE_clag2z_quark #endif void CORE_clag2z_quark(Quark *quark) { int m; int n; PLASMA_Complex32_t *A; int lda; PLASMA_Complex64_t *B; int ldb; quark_unpack_args_6(quark, m, n, A, lda, B, ldb); LAPACKE_clag2z_work(LAPACK_COL_MAJOR, m, n, A, lda, B, ldb); }
// Copyright (c) 2014-2020 Andrey Upadyshev <[email protected]> // // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "http_client.h" #include "../http_helpers.h" #include <ppconsul/helpers.h> #include <algorithm> #include <tuple> #include <cassert> #include <cstdlib> #include <stdexcept> #if !defined PPCONSUL_USE_BOOST_REGEX #include <regex> #else #include <boost/regex.hpp> #endif #if (LIBCURL_VERSION_MAJOR < 7) #error "Where did you get such an ancient libcurl?" #endif // CURLOPT_SSL_VERIFYSTATUS was added in libcurl 7.41.0 // https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYSTATUS.html #if (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR < 41) #define PPCONSUL_DISABLE_SSL_VERIFYSTATUS #endif namespace ppconsul { namespace curl { using namespace ppconsul::http::impl; namespace { struct CurlInitializer { CurlInitializer() { m_initialized = 0 == curl_global_init(CURL_GLOBAL_DEFAULT | CURL_GLOBAL_SSL); } ~CurlInitializer() { curl_global_cleanup(); } CurlInitializer(const CurlInitializer&) = delete; CurlInitializer& operator= (const CurlInitializer&) = delete; explicit operator bool() const { return m_initialized; } private: bool m_initialized; }; #if !defined PPCONSUL_USE_BOOST_REGEX using std::regex; using std::regex_match; using std::cmatch; #else using boost::regex; using boost::regex_match; using boost::cmatch; #endif const regex g_statusLineRegex(R"***(HTTP\/1\.1 +(\d\d\d) +(.*)\r\n)***"); const regex g_consulHeaderLineRegex(R"***(([^:]+): +(.+)\r\n)***"); inline bool parseStatus(http::Status& status, const char *buf, size_t size) { cmatch match; if (!regex_match(buf, buf + size, match, g_statusLineRegex)) return false; status = http::Status(std::atol(match[1].str().c_str()), match[2].str()); return true; } void throwCurlError(CURLcode code, const char *err) { if (code == CURLE_ABORTED_BY_CALLBACK) throw ppconsul::OperationAborted(); else throw std::runtime_error(std::string(err) + " (" + std::to_string(code) + ")"); } enum { Buffer_Size = 16384 }; using ReadContext = std::pair<const std::string *, size_t>; size_t headerStatusCallback(char *ptr, size_t size_, size_t nitems, void *outputStatus) { const auto size = size_ * nitems; parseStatus(*static_cast<http::Status *>(outputStatus), ptr, size); return size; } size_t headerCallback(char *ptr, size_t size_, size_t nitems, void *outputResponse_) { const auto size = size_ * nitems; auto outputResponse = reinterpret_cast<CurlHttpClient::GetResponse *>(outputResponse_); if (parseStatus(std::get<0>(*outputResponse), ptr, size)) return size; // Parse headers cmatch match; if (!regex_match(const_cast<const char *>(ptr), const_cast<const char *>(ptr) +size, match, g_consulHeaderLineRegex)) return size; ResponseHeaders& headers = std::get<1>(*outputResponse); if (0 == match[1].compare(Index_Header_Name)) headers.m_index = uint64_headerValue(match[2].str().c_str()); else if (0 == match[1].compare(LastContact_Headers_Name)) headers.m_lastContact = std::chrono::milliseconds(uint64_headerValue(match[2].str().c_str())); else if (0 == match[1].compare(KnownLeader_Header_Name)) headers.m_knownLeader = bool_headerValue(match[2].str().c_str()); return size; } size_t writeCallback(char *ptr, size_t size_, size_t nitems, void *outputStr) { const auto size = size_ * nitems; static_cast<std::string *>(outputStr)->append(ptr, size); return size; } size_t readCallback(char *buffer, size_t size_, size_t nitems, void *readContext) { const auto ctx = static_cast<ReadContext *>(readContext); const auto remainingSize = ctx->first->size() - ctx->second; if (!remainingSize) return 0; auto size = (std::min)(size_ * nitems, remainingSize); memcpy(buffer, ctx->first->data() + ctx->second, size); ctx->second += size; return size; } #if (LIBCURL_VERSION_NUM >= 0x073200) int progressCallback(void *clientPtr, curl_off_t, curl_off_t, curl_off_t, curl_off_t) #else // old-style progress callback for curl <= 7.31.0 int progressCallback(void *clientPtr, double, double, double, double) #endif { const auto* client = static_cast<const CurlHttpClient*>(clientPtr); return client->stopped(); } } CurlHttpClientFactory::CurlHttpClientFactory() { static const CurlInitializer g_initialized; if (!g_initialized) throw std::runtime_error("CURL was not successfully initialized"); } std::unique_ptr<CurlHttpClient> CurlHttpClientFactory::operator() (const std::string& endpoint, const ppconsul::http::TlsConfig& tlsConfig, std::function<bool()> cancellationCallback) const { return std::unique_ptr<CurlHttpClient>(new CurlHttpClient(endpoint, tlsConfig, cancellationCallback)); } CurlHttpClient::CurlHttpClient(const std::string& endpoint, const ppconsul::http::TlsConfig& tlsConfig, const std::function<bool()>& cancellationCallback) : m_cancellationCallback(cancellationCallback) , m_endpoint(endpoint) { m_handle.reset(curl_easy_init()); if (!m_handle) throw std::runtime_error("CURL handle creation failed"); if (auto err = curl_easy_setopt(handle(), CURLOPT_ERRORBUFFER, m_errBuffer)) throwCurlError(err, ""); if (m_cancellationCallback) { setopt(CURLOPT_NOPROGRESS, 0l); #if (LIBCURL_VERSION_NUM >= 0x073200) setopt(CURLOPT_XFERINFOFUNCTION, &progressCallback); setopt(CURLOPT_XFERINFODATA, this); #else setopt(CURLOPT_PROGRESSFUNCTION, &progressCallback); setopt(CURLOPT_PROGRESSDATA, this); #endif } else { setopt(CURLOPT_NOPROGRESS, 1l); } // TODO: CURLOPT_NOSIGNAL? setopt(CURLOPT_WRITEFUNCTION, &writeCallback); setopt(CURLOPT_READFUNCTION, &readCallback); setupTls(tlsConfig); } void CurlHttpClient::setupTls(const ppconsul::http::TlsConfig& tlsConfig) { if (!tlsConfig.cert.empty()) setopt(CURLOPT_SSLCERT, tlsConfig.cert.c_str()); if (!tlsConfig.certType.empty()) setopt(CURLOPT_CAPATH, tlsConfig.certType.c_str()); if (!tlsConfig.key.empty()) setopt(CURLOPT_SSLKEY, tlsConfig.key.c_str()); if (!tlsConfig.keyType.empty()) setopt(CURLOPT_CAPATH, tlsConfig.certType.c_str()); if (!tlsConfig.caPath.empty()) setopt(CURLOPT_CAPATH, tlsConfig.caPath.c_str()); if (!tlsConfig.caInfo.empty()) setopt(CURLOPT_CAINFO, tlsConfig.caInfo.c_str()); if (tlsConfig.keyPass && *tlsConfig.keyPass) setopt(CURLOPT_KEYPASSWD, tlsConfig.keyPass); setopt(CURLOPT_SSL_VERIFYPEER, tlsConfig.verifyPeer ? 1 : 0); setopt(CURLOPT_SSL_VERIFYHOST, tlsConfig.verifyHost ? 2 : 0); if (tlsConfig.verifyStatus) { #ifdef PPCONSUL_DISABLE_SSL_VERIFYSTATUS throw std::runtime_error("Ppconsul was built without support for CURLOPT_SSL_VERIFYSTATUS"); #else setopt(CURLOPT_SSL_VERIFYSTATUS, 1); #endif } } CurlHttpClient::~CurlHttpClient() = default; CurlHttpClient::GetResponse CurlHttpClient::get(const std::string& path, const std::string& query) { GetResponse r; std::get<2>(r).reserve(Buffer_Size); setopt(CURLOPT_HEADERFUNCTION, &headerCallback); setopt(CURLOPT_CUSTOMREQUEST, nullptr); setopt(CURLOPT_URL, makeUrl(path, query).c_str()); setopt(CURLOPT_WRITEDATA, &std::get<2>(r)); setopt(CURLOPT_HEADERDATA, &r); setopt(CURLOPT_HTTPGET, 1l); perform(); return r; } std::pair<http::Status, std::string> CurlHttpClient::put(const std::string& path, const std::string& query, const std::string& data) { ReadContext ctx(&data, 0u); std::pair<http::Status, std::string> r; r.second.reserve(Buffer_Size); setopt(CURLOPT_HEADERFUNCTION, &headerStatusCallback); setopt(CURLOPT_CUSTOMREQUEST, nullptr); setopt(CURLOPT_URL, makeUrl(path, query).c_str()); setopt(CURLOPT_WRITEDATA, &r.second); setopt(CURLOPT_HEADERDATA, &r.first); setopt(CURLOPT_UPLOAD, 1l); setopt(CURLOPT_PUT, 1l); setopt(CURLOPT_INFILESIZE_LARGE, static_cast<curl_off_t>(data.size())); setopt(CURLOPT_READDATA, &ctx); perform(); return r; } std::pair<http::Status, std::string> CurlHttpClient::del(const std::string& path, const std::string& query) { std::pair<http::Status, std::string> r; r.second.reserve(Buffer_Size); setopt(CURLOPT_HEADERFUNCTION, &headerStatusCallback); setopt(CURLOPT_URL, makeUrl(path, query).c_str()); setopt(CURLOPT_WRITEDATA, &r.second); setopt(CURLOPT_HEADERDATA, &r.first); setopt(CURLOPT_HTTPGET, 1l); setopt(CURLOPT_CUSTOMREQUEST, "DELETE"); perform(); return r; } template<class Opt, class T> inline void CurlHttpClient::setopt(Opt opt, const T& t) { const auto err = curl_easy_setopt(handle(), opt, t); if (err) throwCurlError(err, m_errBuffer); } inline void CurlHttpClient::perform() { const auto err = curl_easy_perform(handle()); if (err) throwCurlError(err, m_errBuffer); } }}
module RecordDef where data ⊤ : Set where tt : ⊤ data ⊤' (x : ⊤) : Set where tt : ⊤' x record R {y : ⊤} (y' : ⊤' y) : Set record R {z} _ where postulate r : R {tt} tt
function pce_ode_hermite_test01 ( ) %*****************************************************************************80 % %% PCE_ODE_HERMITE_TEST01 runs a test problem with PCE_ODE_HERMITE. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 18 March 2012 % % Author: % % John Burkardt % fprintf ( 1, '\n' ); fprintf ( 1, 'PCE_ODE_HERMITE_TEST01:\n' ); fprintf ( 1, ' Call PCE_ODE_HERMITE to compute a polynomial chaos expansion\n' ); fprintf ( 1, ' for the ODE:\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' u'' = - alpha * u,\n' ); fprintf ( 1, ' u(0) = 1.\n' ); ti = 0.0; tf = 2.0; nt = 200; ui = 1.0; np = 4; alpha_mu = 0.0; alpha_sigma = 1.0; fprintf ( 1, '\n' ); fprintf ( 1, ' Initial time TI = %g\n', ti ); fprintf ( 1, ' Final time TF = %g\n', tf ); fprintf ( 1, ' Number of time steps NT = %d\n', nt ); fprintf ( 1, ' Initial condition UI = %g\n', ui ); fprintf ( 1, ' Expansion degree NP = %d\n', np ); fprintf ( 1, ' E(ALPHA) ALPHA_MU = %g\n', alpha_mu ); fprintf ( 1, ' STD(ALPHA) ALPHA_SIGMA = %g\n', alpha_sigma ); [ t, u ] = pce_ode_hermite ( ti, tf, nt, ui, np, alpha_mu, alpha_sigma ); % % Evaluate the exact expected value function. % uex = ui * exp ( t.^2 / 2 ); % % Compare the first computed component against the exact expected value. % fprintf ( 1, '\n' ); fprintf ( 1, ' i T(i) E(U(T(i))) U(T(i),0)\n' ); fprintf ( 1, '\n' ); for i = 0 : 10 : nt fprintf ( 1, ' %4d %6.3f %14.6g %14.6g %14.6g\n', ... i, t(i+1), uex(i+1), u(i+1,1), abs ( uex(i+1) - u(i+1,1) ) ); end % % Plot the first computed component against the exact expected value function. % figure ( 1 ) plot ( t, u(:,1), t, uex ) grid on xlabel ( '<--- T --->' ) ylabel ( '<--- U --->' ) title ( 'PCE Expected Value Versus Exact Expected Value' ) filename = 'expected_value_plot.png'; print ( '-dpng', filename ); fprintf ( 1, '\n' ); fprintf ( 1, ' Expected value comparison plotted in "%s".\n', filename ); return end
[STATEMENT] lemma fps_inverse_fps_X_plus1': assumes "inverse (1::'a::{ring_1,inverse}) = 1" shows "inverse (1 + fps_X) = Abs_fps (\<lambda>n. (- (1::'a)) ^ n)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. inverse (1 + fps_X) = Abs_fps ((^) (- (1::'a))) [PROOF STEP] using assms fps_lr_inverse_fps_X_plus1(2) [PROOF STATE] proof (prove) using this: inverse (1::'a) = (1::'a) fps_right_inverse (1 + fps_X) (1::?'a) = Abs_fps ((^) (- (1::?'a))) goal (1 subgoal): 1. inverse (1 + fps_X) = Abs_fps ((^) (- (1::'a))) [PROOF STEP] by (simp add: fps_inverse_def)
(* * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) * * SPDX-License-Identifier: BSD-2-Clause *) theory dc_20081211 imports "CParser.CTranslation" begin external_file "dc_20081211.c" install_C_file "dc_20081211.c" declare [[show_types]] context dc_20081211_global_addresses begin thm \<Gamma>_def end context setHardwareASID_modifies begin thm \<Gamma>_def thm setHardwareASID_modifies end context dc_20081211 begin term "\<Gamma>" thm setHardwareASID_modifies thm test_body_def thm test_modifies lemma test_modifies: "\<forall>s. \<Gamma> \<turnstile>\<^bsub>/UNIV\<^esub> {s} Call test_'proc {t. t may_only_modify_globals s in [x]}" (* fails: apply(vcg spec=modifies) perhaps because there already is a test_modifies already in scope *) oops end end
import cv2 as cv import numpy as np import json import random camera = cv.VideoCapture(0, cv.CAP_DSHOW) #Distance function def getDistance(focal_length, real_width, width_in_frame): distance = (real_width * focal_length) / width_in_frame return distance #Draw circle if contour is a circle def isCircle(img, contour): approx = cv.approxPolyDP(contour, 0.01 * cv.arcLength(contour, True), True) (coord_x, coord_y), radius = cv.minEnclosingCircle(contour) center = (int(coord_x), int(coord_y)) contour_area = cv.contourArea(contour) x, y, w, h = cv.boundingRect(contour) aspect_ratio = w/h percentage = str(random.randint(20, 100)) if 1.0 >= contour_area / (radius**2 * 3.14) >= .6 and 1.4 >= aspect_ratio >= .6 and contour_area > 200: cv.circle(img, center, int(radius), (0, 255, 0) , 3) cv.putText(img, f"Powercell %{percentage}", (x, y - 10), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2) def getContours(mask): global contours contours = cv.findContours(mask, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE) if len(contours) == 2: contours = contours[0] else: contours = contours[1] return contours def createMask(img): #blue values hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV) lower = np.array([20, 100, 100]) upper = np.array([30, 255, 255]) mask = cv.inRange(hsv, lower, upper) return mask #Call functions and process feed while True: ret, frame = camera.read() for contour in getContours(createMask(frame)): isCircle(frame, contour) cv.imshow('display', frame) key = cv.waitKey(1) if key == 27: break camera.release() cv.destroyAllWindows()
function figure2dot(filename, varargin) %FIGURE2DOT Save figure in Graphviz (.dot) file. % FIGURE2DOT(filename) saves the current figure as dot-file. % % FIGURE2DOT(filename, 'object', HGOBJECT) constructs the graph representation % of the specified object (default: gcf) % % You can visualize the constructed DOT file using: % - [GraphViz](http://www.graphviz.org) on your computer % - [WebGraphViz](http://www.webgraphviz.com) online % - [Gravizo](http://www.gravizo.com) for your markdown files % - and a lot of other software such as OmniGraffle % % See also: matlab2tikz, cleanfigure, uiinspect, inspect ipp = m2tInputParser(); ipp = ipp.addRequired(ipp, 'filename', @ischar); ipp = ipp.addParamValue(ipp, 'object', gcf, @ishghandle); ipp = ipp.parse(ipp, filename, varargin{:}); args = ipp.Results; filehandle = fopen(args.filename, 'w'); finally_fclose_filehandle = onCleanup(@() fclose(filehandle)); % start printing fprintf(filehandle, 'digraph simple_hierarchy {\n\n'); fprintf(filehandle, 'node[shape=box];\n\n'); % define the root node node_number = 0; p = get(args.object, 'Parent'); % define root element type = get(p, 'Type'); fprintf(filehandle, 'N%d [label="%s"]\n\n', node_number, type); % start recursion plot_children(filehandle, p, node_number); % finish off fprintf(filehandle, '}'); % ---------------------------------------------------------------------------- function plot_children(fh, h, parent_node) children = allchild(h); for h = children(:)' if shouldSkip(h), continue, end; node_number = node_number + 1; label = {}; label = addHGProperty(label, h, 'Type', ''); try hClass = class(handle(h)); label = addProperty(label, 'Class', hClass); catch % don't do anything end label = addProperty(label, 'Handle', sprintf('%g', double(h))); label = addHGProperty(label, h, 'Title', ''); label = addHGProperty(label, h, 'Axes', []); label = addHGProperty(label, h, 'String', ''); label = addHGProperty(label, h, 'Tag', ''); label = addHGProperty(label, h, 'DisplayName', ''); label = addHGProperty(label, h, 'Visible', 'on'); label = addHGProperty(label, h, 'HandleVisibility', 'on'); % print node fprintf(fh, 'N%d [label="%s"]\n', ... node_number, m2tstrjoin(label, '\n')); % connect to the child fprintf(fh, 'N%d -> N%d;\n\n', parent_node, node_number); % recurse plot_children(fh, h, node_number); end end end % ============================================================================== function bool = shouldSkip(h) % returns TRUE for objects that can be skipped objType = get(h, 'Type'); bool = ismember(lower(objType), guitypes()); end % ============================================================================== function label = addHGProperty(label, h, propName, default) % get a HG property and assign it to a GraphViz node label if ~exist('default','var') || isempty(default) shouldOmit = @isempty; elseif isa(default, 'function_handle') shouldOmit = default; else shouldOmit = @(v) isequal(v,default); end if isprop(h, propName) propValue = get(h, propName); if numel(propValue) == 1 && ishghandle(propValue) && isprop(propValue, 'String') % dereference Titles, labels, ... propValue = get(propValue, 'String'); elseif ishghandle(propValue) % dereference other HG objects to their raw handle value (double) propValue = double(propValue); elseif iscell(propValue) propValue = ['{' m2tstrjoin(propValue,',') '}']; end if ~shouldOmit(propValue) label = addProperty(label, propName, propValue); end end end function label = addProperty(label, propName, propValue) % add a property to a GraphViz node label if isnumeric(propValue) propValue = num2str(propValue); elseif iscell(propValue) propValue = m2tstrjoin(propValue,sprintf('\n')); end label = [label, sprintf('%s: %s', propName, propValue)]; end % ==============================================================================
import Data.Either import Data.List import Data.Maybe import Data.String import Data.Binary import Data.Binary.Digit import System.File significant: List Nat -> String -> List Nat significant l s = (\(i,c) => if c == '1' then i + 1 else i) <$> zip l (unpack s) gamma : Nat -> List Nat -> Nat gamma s l = toNat $ reverse $ (\i => if i + i > s then I else O) <$> l epsilon : Nat -> List Nat -> Nat epsilon s l = toNat $ reverse $ (\i => if i + i > s then O else I) <$> l run : String -> IO () run s = do let lines = lines $ trim $ s let s = foldl significant (replicate 12 0) $ lines let gamma = gamma (length lines) s let epsilon = epsilon (length lines) s putStrLn $ show $ gamma * epsilon main : IO () main = do Right s <- readFile "input.txt" | Left err => putStrLn $ show err run s
function xval = r8vec_even_select ( xlo, xhi, n, ival ) %*****************************************************************************80 % %% R8VEC_EVEN_SELECT returns the I-th of N evenly spaced values in [ XLO, XHI ]. % % Formula: % % XVAL = ( (N-IVAL) * XLO + (IVAL-1) * XHI ) / dble ( N - 1 ) % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 29 November 2004 % % Author: % % John Burkardt % % Parameters: % % Input, real XLO, XHI, the low and high values. % % Input, integer N, the number of values. % % Input, integer IVAL, the index of the desired point. % IVAL is normally between 1 and N, but may be any % integer value. % % Output, real XVAL, the IVAL-th of N evenly spaced values % between XLO and XHI. % % Unless N = 1, X(1) = XLO and X(N) = XHI. % % If N = 1, then X(1) = 0.5*(XLO+XHI). % if ( n == 1 ) xval = 0.5 * ( xlo + xhi ); else xval = ( ( n - ival ) * xlo ... + ( ival - 1 ) * xhi ) ... / ( n - 1 ); end return end
lemma continuous_on_prod [continuous_intros]: fixes f :: "'a \<Rightarrow> _ \<Rightarrow> 'c::{real_normed_algebra,comm_ring_1}" shows "(\<And>i. i \<in> S \<Longrightarrow> continuous_on s (f i)) \<Longrightarrow> continuous_on s (\<lambda>x. \<Prod>i\<in>S. f i x)"
lemma complex_mod_rcis [simp]: "cmod (rcis r a) = \<bar>r\<bar>"
[STATEMENT] lemma two_step_zero [simp]: "two_step 0 = 0" [PROOF STATE] proof (prove) goal (1 subgoal): 1. two_step 0 = 0 [PROOF STEP] by (simp add: two_step_def)
(* Title: CoW_Graph_Lemma.Graph_Lemma Author: Štěpán Holub, Charles University Author: Štěpán Starosta, CTU in Prague *) theory Graph_Lemma imports Combinatorics_Words.Submonoids begin chapter \<open>Graph Lemma\<close> text\<open>The Graph Lemma is an important tool for gaining information about systems of word equations. It yields an upper bound on the rank of the solution, that is, on the number of factors into all images of unknowns can be factorized. The most straightforward application is showing that a system of equations admits periodic solutions only, which in particular holds for any nontrivial equation over two words. The name refers to a graph whose vertices are the unknowns of the system, and edges connect front letters of the left- and right- hand sides of equations. The bound mentioned above is then the number of connected components of the graph. We formalize the algebraic proof from @{cite Berstel1979} \<close> text\<open>Let @{term C} be a set of generators, and $b$ its distinguished element. We define the set of all products that do not start with $b$.\<close> inductive_set no_head :: "'a list set \<Rightarrow> 'a list \<Rightarrow> 'a list set" for C b where emp_in_no_head[simp]: "\<epsilon> \<in> no_head C b" | "u \<in> C \<Longrightarrow> u \<noteq> b \<Longrightarrow> u \<in> no_head C b" | "u \<noteq> \<epsilon> \<Longrightarrow> u \<in> no_head C b \<Longrightarrow> v \<in> \<langle>C\<rangle> \<Longrightarrow> u \<cdot> v \<in> no_head C b" text\<open>The set is a submonoid of @{term "\<langle>C\<rangle>"}\<close> lemma no_head_sub: "no_head C b \<subseteq> \<langle>C\<rangle>" proof fix u assume "u \<in> no_head C b" show "u \<in> \<langle>C\<rangle>" proof (induction rule: no_head.induct[OF \<open>u \<in> no_head C b\<close>], auto) case (3 u v) then show "u \<cdot> v \<in> \<langle>C\<rangle>" using hull_closed by blast qed qed lemma no_head_closed: "\<langle>no_head C b\<rangle> = no_head C b" proof(intro equalityI) show "no_head C b \<subseteq> \<langle>no_head C b\<rangle>" by (simp add: genset_sub) next show "\<langle>no_head C b\<rangle> \<subseteq> no_head C b" proof fix x assume "x \<in> \<langle>no_head C b\<rangle>" thus "x \<in> no_head C b" proof (induction rule: hull.induct, simp) case (prod_cl w1 w2) then show "w1 \<cdot> w2 \<in> no_head C b" using no_head.intros(3)[OF _ \<open>w1 \<in> no_head C b\<close>] in_mono[OF no_head_sub, of w2] by fastforce qed qed qed text\<open>We are interested mainly in the situation when @{term C} is a code.\<close> context code begin text\<open>We characterize the set @{term no_head} in terms of the decomposition of its (nonempty) elements: the first factor is not b\<close> lemma no_head_hd: assumes "u \<in> no_head \<C> b" and "u \<noteq> \<epsilon>" shows "hd (Dec \<C> u) \<noteq> b" using \<open>u \<noteq> \<epsilon>\<close> proof(induct rule: no_head.induct[OF \<open>u \<in> no_head \<C> b\<close>], simp) case (2 u) then show ?case using code_el_dec by auto next case (3 u v) have "Dec \<C> u \<noteq> \<epsilon>" and "u \<in> \<langle>\<C>\<rangle>" and "v \<in> \<langle>\<C>\<rangle>" using dec_nemp no_head_sub "3.hyps" by blast+ show "hd (Dec \<C> u \<cdot> v) \<noteq> b" using "3.hyps"(3)[OF \<open>u \<noteq> \<epsilon>\<close>] hd_append2[OF \<open>Dec \<C> u \<noteq> \<epsilon>\<close>, of "Dec \<C> v"] unfolding code_dec_morph[OF \<open> u \<in> \<langle>\<C>\<rangle>\<close> \<open>v \<in> \<langle>\<C>\<rangle>\<close>] by simp qed lemma b_not_in_no_head: assumes "b \<in> \<C>" shows "b \<notin> no_head \<C> b" using \<open>b \<in> \<C>\<close> code_el_dec emp_not_in_code no_head_hd by fastforce lemma hd_no_head: assumes "u \<in> \<langle>\<C>\<rangle>" and "hd (Dec \<C> u) \<noteq> b" shows "u \<in> no_head \<C> b" proof(cases "u \<noteq> \<epsilon>") assume "u \<noteq> \<epsilon>" have "Dec \<C> u \<noteq> \<epsilon>" using dec_nemp'[OF \<open>u \<noteq> \<epsilon>\<close> \<open>u \<in> \<langle>\<C>\<rangle>\<close>]. have "u = hd (Dec \<C> u) \<cdot> concat (tl (Dec \<C> u))" using concat.simps(2)[of "hd (Dec \<C> u)" "tl(Dec \<C> u)"] unfolding hd_Cons_tl[OF \<open>Dec \<C> u \<noteq> \<epsilon>\<close>] decI[OF \<open>u \<in> \<langle>\<C>\<rangle>\<close>]. have "hd (Dec \<C> u) # tl (Dec \<C> u) \<in> lists \<C>" and "hd (Dec \<C> u) \<in> \<C>" using \<open>Dec \<C> u \<noteq> \<epsilon>\<close> \<open>u \<in> \<langle>\<C>\<rangle>\<close> dec_dom' lists_hd by auto blast have "concat (tl (decompose \<C> u)) \<in> \<langle>\<C>\<rangle>" using concat_tl[of "hd (Dec \<C> u)" "tl(Dec \<C> u)" \<C>, OF \<open>hd (Dec \<C> u) # tl (Dec \<C> u) \<in> lists \<C>\<close>]. have "hd (Dec \<C> u) \<noteq> \<epsilon>" and "hd (Dec \<C> u) \<in> no_head \<C> b" using no_head.intros(2)[OF \<open>hd (Dec \<C> u) \<in> \<C>\<close> \<open>hd (Dec \<C> u) \<noteq> b\<close>] \<open>hd (Dec \<C> u) \<in> \<C>\<close> emp_not_in_code by auto from no_head.intros(3)[OF this \<open>concat (tl (decompose \<C> u)) \<in> \<langle>\<C>\<rangle>\<close> ] show "u \<in> no_head \<C> b" unfolding sym[OF \<open>u = hd (Dec \<C> u) \<cdot> concat (tl (Dec \<C> u))\<close>]. qed simp corollary "no_head \<C> b = {u \<in> \<langle>\<C>\<rangle>. u = \<epsilon> \<or> hd (Dec \<C> u) \<noteq> b}" proof(intro equalityI subsetI, standard) fix x assume "x \<in> no_head \<C> b" thus "x \<in> \<langle>\<C>\<rangle> \<and> (x = \<epsilon> \<or> hd (Dec \<C> x) \<noteq> b)" using no_head_hd no_head_sub by blast next fix x assume "x \<in> {u \<in> \<langle>\<C>\<rangle>. u = \<epsilon> \<or> hd (Dec \<C> u) \<noteq> b}" thus "x \<in> no_head \<C> b" using hd_no_head no_head.simps by blast qed end text\<open>The set @{term no_head} is generated by the following set.\<close> inductive_set no_head_gen :: "'a list set \<Rightarrow> 'a list \<Rightarrow> 'a list set" for C b where "u \<in> C \<Longrightarrow> u \<noteq> b \<Longrightarrow> u \<in> no_head_gen C b" | "u \<in> no_head_gen C b \<Longrightarrow> u \<cdot> b \<in> no_head_gen C b" lemma no_head_gen_set: "no_head_gen C b = {z \<cdot> b\<^sup>@k |z k. z \<in> C \<and> z \<noteq> b}" proof(intro equalityI subsetI) fix x assume "x \<in> no_head_gen C b" hence "\<exists> z k. z \<in> C \<and> z \<noteq> b \<and> x = z \<cdot> b\<^sup>@k" proof (rule no_head_gen.induct) fix u assume "u \<in> C" and "u \<noteq> b" show "\<exists>z k. z \<in> C \<and> z \<noteq> b \<and> u = z \<cdot> b\<^sup>@k" using \<open>u \<in> C\<close> \<open>u \<noteq> b\<close> pow_zero by blast next fix u assume "u \<in> no_head_gen C b" and "\<exists>z k. z \<in> C \<and> z \<noteq> b \<and> u = z \<cdot> b\<^sup>@k" thus "\<exists>z k. z \<in> C \<and> z \<noteq> b \<and> u \<cdot> b = z \<cdot> b\<^sup>@k" using pow_Suc2_list append.assoc by metis qed thus "x \<in> {z \<cdot> b\<^sup>@k |z k. z \<in> C \<and> z \<noteq> b}" by auto next fix x assume "x \<in> {z \<cdot> b \<^sup>@ k |z k. z \<in> C \<and> z \<noteq> b}" then obtain z k where "z \<in> C" and "z \<noteq> b" and "x = z\<cdot>b\<^sup>@k" by blast then show "x \<in> no_head_gen C b" proof(induct k arbitrary: x) case 0 then show ?case by (simp add: \<open>z \<in> C\<close> \<open>z \<noteq> b\<close> no_head_gen.intros(1)) next case (Suc k) from this(1)[OF this(2) this(3), of "z \<cdot> b \<^sup>@ k", THEN no_head_gen.intros(2), unfolded rassoc, folded pow_Suc2_list[of b k] \<open>x = z\<cdot>b\<^sup>@Suc k\<close>] show ?case by blast qed qed lemma no_head_genE: assumes "u \<in> no_head_gen C b" obtains z k where "z \<in> C" and "z \<noteq> b" and "u = z \<cdot> b\<^sup>@k" proof(induct rule: no_head_gen.induct[OF assms]) case (1 u) show ?case using "1.prems"[OF "1.hyps", of 0] by simp next case (2 u) have "(z \<cdot> b\<^sup>@k) \<cdot> b = z \<cdot> b\<^sup>@(Suc k)" for z k by (simp add: power_commutes) then show ?case using "2.prems" "2.hyps"(2) by blast qed context code begin text\<open>We show that this indeed is a set of generators\<close> lemma emp_not_in_Cb: "\<epsilon> \<notin> no_head_gen \<C> b" by (simp add: emp_not_in_code no_head_gen_set) lemma no_head_sub': "b \<in> \<C> \<Longrightarrow> no_head_gen \<C> b \<subseteq> no_head \<C> b" proof fix u assume "b \<in> \<C>" "u \<in> no_head_gen \<C> b" show "u \<in> no_head \<C> b" proof (induction rule: no_head_gen.induct[OF \<open>u \<in> no_head_gen \<C> b\<close>], simp add: no_head.intros(2)) case (2 u) show "u \<cdot> b \<in> no_head \<C> b" using no_head.intros(3)[OF _ \<open>u \<in> no_head \<C> b\<close> gen_in[OF \<open>b \<in> \<C>\<close>]] "2.hyps" emp_not_in_Cb by blast qed qed lemma no_head_generates0: assumes "v \<in> \<langle>\<C>\<rangle>" shows "u \<noteq> \<epsilon> \<longrightarrow> u \<in> \<langle>no_head_gen \<C> b\<rangle> \<longrightarrow> u \<cdot> v \<in> \<langle>no_head_gen \<C> b\<rangle>" proof (induct arbitrary: u rule: hull.induct[OF \<open>v \<in> \<langle>\<C>\<rangle>\<close>], simp) case (2 w1 w2) then show ?case proof(cases "w1 = b") assume "w1 \<noteq> b" show ?thesis using "2.hyps"(1) emp_not_in_code no_head_gen.intros(1)[OF \<open>w1 \<in> \<C>\<close> \<open>w1 \<noteq> b\<close>,THEN gen_in] "2.hyps"(3)[of w1] hull_closed[of u "no_head_gen \<C> b" "w1\<cdot> w2"] by blast next assume "w1 = b" show ?thesis proof (standard, standard) assume "u \<noteq> \<epsilon>" and "u \<in> \<langle>no_head_gen \<C> b\<rangle>" hence dec_nemp: "Dec (no_head_gen \<C> b) u \<noteq> \<epsilon>" using dec_nemp' by blast from concat_butlast_last[OF this] have u_w1: "u \<cdot> w1 = concat (butlast (Dec (no_head_gen \<C> b) u)) \<cdot> (last (Dec (no_head_gen \<C> b) u) \<cdot> w1)" unfolding decI[OF \<open>u \<in> \<langle>no_head_gen \<C> b\<rangle>\<close>] by simp from dec_dom'[OF \<open>u \<in> \<langle>no_head_gen \<C> b\<rangle>\<close>] append_butlast_last_id[OF dec_nemp] have con_but: "concat (butlast (Dec (no_head_gen \<C> b) u)) \<in> \<langle>no_head_gen \<C> b\<rangle>" and last_in: "last (Dec (no_head_gen \<C> b) u) \<in> no_head_gen \<C> b" using append_in_lists_conv[of "butlast (Dec (no_head_gen \<C> b) u)" "[last (Dec (no_head_gen \<C> b) u)]" "no_head_gen \<C> b"] concat_in_hull'[of "butlast (Dec (no_head_gen \<C> b) u)" "no_head_gen \<C> b"] by auto hence "last (Dec (no_head_gen \<C> b) u) \<cdot> w1 \<in> no_head_gen \<C> b" unfolding \<open>w1 = b\<close> using no_head_gen.intros(2)[of "last (Dec (no_head_gen \<C> b) u)" \<C> b] by blast from this[THEN gen_in,THEN[2] hull_closed, OF con_but] have "u \<cdot> w1 \<in> \<langle>no_head_gen \<C> b\<rangle>" unfolding u_w1. from "2.hyps"(3)[rule_format, OF _ this, unfolded rassoc] show "u \<cdot> w1 \<cdot> w2 \<in> \<langle>no_head_gen \<C> b\<rangle>" using pref_nemp[OF \<open>u\<noteq>\<epsilon>\<close>] by blast qed qed qed theorem no_head_generates: assumes "b \<in> \<C>" shows "\<langle>no_head_gen \<C> b\<rangle> = no_head \<C> b" proof (intro equalityI) show "\<langle>no_head_gen \<C> b\<rangle> \<subseteq> no_head \<C> b" using hull_mon[OF no_head_sub'[OF \<open>b \<in> \<C>\<close>]] unfolding no_head_closed. show "no_head \<C> b \<subseteq> \<langle>no_head_gen \<C> b\<rangle>" proof (intro subsetI) fix x assume "x \<in> no_head \<C> b" show "x \<in> \<langle>no_head_gen \<C> b\<rangle>" by (induct rule: no_head.induct[OF \<open>x \<in> no_head \<C> b\<close>],auto, simp add: gen_in no_head_gen.intros(1),simp add: no_head_generates0) qed qed text\<open>Moreover, the generating set @{term no_head_gen} is a code\<close> lemma lists_no_head_sub: "b \<in> \<C> \<Longrightarrow> us \<in> lists (no_head_gen \<C> b) \<Longrightarrow> us \<in> lists \<langle>\<C>\<rangle>" using no_head_sub' no_head_sub by blast lemma ref_hd: assumes "z \<in> \<C>" and "b \<in> \<C>" and "z \<noteq> b" and "vs \<in> lists (no_head_gen \<C> b)" shows "refine \<C> ((z\<cdot>b\<^sup>@k) # vs) = [z]\<cdot>[b]\<^sup>@k \<cdot> refine \<C> vs" proof- have "refine \<C> ((z\<cdot>b\<^sup>@k) # vs) = (Dec \<C> (z\<cdot>b\<^sup>@k)) \<cdot> refine \<C> vs" using ref_pop_hd lists_no_head_sub[OF \<open>b \<in> \<C>\<close>] by simp have "[z]\<cdot>[b]\<^sup>@k \<in> lists \<C>" by (induct k, simp add: \<open>z \<in> \<C>\<close>, simp add: \<open>b \<in> \<C>\<close>) have "concat ([z]\<cdot>[b]\<^sup>@k) = z \<cdot> b\<^sup>@k" using concat_sing_pow by auto hence "Dec \<C> (z\<cdot>b\<^sup>@k) = [z]\<cdot>[b]\<^sup>@k" using code.code_unique_dec[OF code_axioms \<open>[z]\<cdot>[b]\<^sup>@k \<in> lists \<C>\<close>] by auto thus ?thesis by simp qed lemma no_head_gen_code_ind_step: assumes "vs \<in> lists (no_head_gen \<C> b)" "us \<in> lists (no_head_gen \<C> b)" "b \<in> \<C>" and eq: "[b]\<^sup>@ku \<cdot> (refine \<C> us) = [b]\<^sup>@kv \<cdot> (refine \<C> vs)" shows "ku = kv" proof- {fix ku :: nat and kv and us and vs and b assume "kv \<le> ku" "[b]\<^sup>@ku \<cdot> (refine \<C> us) = [b]\<^sup>@kv \<cdot> (refine \<C> vs)" "vs \<in> lists (no_head_gen \<C> b)" "us \<in> lists (no_head_gen \<C> b)" "b \<in> \<C>" have "concat vs \<in> no_head \<C> b" using \<open>vs \<in> lists (no_head_gen \<C> b)\<close> no_head_generates[OF \<open>b \<in> \<C>\<close>] by fastforce have "Ref \<C> vs = Dec \<C> (concat vs)" using \<open>vs \<in> lists (no_head_gen \<C> b)\<close> \<open>b \<in> \<C>\<close> code_unique_ref lists_no_head_sub by auto have "vs \<noteq> \<epsilon> \<Longrightarrow> concat vs \<noteq> \<epsilon>" using emp_not_in_Cb[of b] concat.simps(2) \<open>vs \<in> lists (no_head_gen \<C> b)\<close>[unfolded lists.simps[of vs]] pref_nemp by auto have "[b]\<^sup>@(ku - kv) \<cdot> (refine \<C> us) = refine \<C> vs" using \<open>kv \<le> ku\<close> eq pop_pow_cancel \<open>[b]\<^sup>@ku \<cdot> (refine \<C> us) = [b]\<^sup>@kv \<cdot> (refine \<C> vs) \<close>by blast hence "ku - kv \<noteq> 0 \<Longrightarrow> hd (refine \<C> vs) = b \<and> vs \<noteq> \<epsilon>" using hd_append2[of "[b]\<^sup>@(ku - kv)" "refine \<C> us"] \<open>[b]\<^sup>@(ku - kv) \<cdot> (refine \<C> us) = refine \<C> vs\<close> hd_sing_power[of "ku - kv" b] append_is_Nil_conv[of "[b]\<^sup>@(ku - kv)" "refine \<C> us"] sing_pow_empty[of b "ku - kv"] dec_emp[of \<C>] by auto hence "ku = kv" using \<open>kv \<le> ku\<close> no_head_hd[OF \<open>concat vs \<in> no_head \<C> b\<close>] \<open>vs \<noteq> \<epsilon> \<Longrightarrow> concat vs \<noteq> \<epsilon>\<close> unfolding \<open>Ref \<C> vs = Dec \<C> (concat vs)\<close> by auto} thus ?thesis using assms nat_le_linear[of ku kv] by metis qed lemma no_head_gen_code': "b \<in> \<C> \<Longrightarrow> xs \<in> lists (no_head_gen \<C> b) \<Longrightarrow> ys \<in> lists (no_head_gen \<C> b) \<Longrightarrow> concat xs = concat ys \<Longrightarrow> xs = ys" proof (induct xs ys rule: list_induct2', simp, simp add: emp_not_in_Cb, simp add: emp_not_in_Cb) case (4 hx xs hy ys) then show ?case proof- have "hx # xs \<in> lists \<langle>\<C>\<rangle>" and "hy # ys \<in> lists \<langle>\<C>\<rangle>" using \<open>b \<in> \<C>\<close> \<open>hx # xs \<in> lists (no_head_gen \<C> b)\<close> \<open>hy # ys \<in> lists (no_head_gen \<C> b)\<close> lists_no_head_sub by blast+ have eq: "refine \<C> (hx#xs) = refine \<C> (hy#ys)" using \<open>concat (hx # xs) = concat (hy # ys)\<close> \<open>hx # xs \<in> lists \<langle>\<C>\<rangle>\<close> \<open>hy # ys \<in> lists \<langle>\<C>\<rangle>\<close> using code_unique_ref by presburger have "hx \<in> (no_head_gen \<C> b)" and "hy \<in> (no_head_gen \<C> b)" using \<open>hx # xs \<in> lists (no_head_gen \<C> b)\<close> \<open>hy # ys \<in> lists (no_head_gen \<C> b)\<close> by auto+ then obtain zx zy kx ky where "hx = zx \<cdot> b\<^sup>@kx" and "hy = zy \<cdot> b\<^sup>@ky" "zx \<noteq> b" "zy \<noteq> b" "zx \<in> \<C>" "zy \<in> \<C>" using no_head_genE by metis have r1: "refine \<C> (hx#xs) = [zx] \<cdot> [b]\<^sup>@kx \<cdot> refine \<C> xs" using \<open>hx = zx \<cdot> b\<^sup>@kx\<close> \<open>zx \<in> \<C>\<close> \<open>zx \<noteq> b\<close> ref_hd \<open>b \<in> \<C>\<close> by auto have r2: "refine \<C> (hy#ys) = [zy] \<cdot> [b]\<^sup>@ky \<cdot> refine \<C> ys" using \<open>hy = zy \<cdot> b\<^sup>@ky\<close> \<open>zy \<in> \<C>\<close> \<open>zy \<noteq> b\<close> ref_hd \<open>b \<in> \<C>\<close> by auto hence "zx = zy" using r1 r2 eq by auto hence "[b]\<^sup>@kx \<cdot> refine \<C> xs = [b]\<^sup>@ky \<cdot> refine \<C> ys" using eq r1 r2 by auto hence "kx = ky" using no_head_gen_code_ind_step \<open>b \<in> \<C>\<close> \<open>hx # xs \<in> lists (no_head_gen \<C> b)\<close> \<open>hy # ys \<in> lists (no_head_gen \<C> b)\<close> listsE by metis hence "hx = hy" by (simp add: \<open>hx = zx \<cdot> b\<^sup>@kx\<close> \<open>hy = zy \<cdot> b\<^sup>@ky\<close> \<open>zx = zy\<close>) hence "xs = ys" using "4.hyps" using \<open>hx # xs \<in> lists (no_head_gen \<C> b)\<close> \<open>hy # ys \<in> lists (no_head_gen \<C> b)\<close> \<open>concat (hx # xs) = concat (hy # ys)\<close> \<open>b \<in> \<C>\<close> by auto thus ?thesis by (simp add: \<open>hx = hy\<close>) qed qed end theorem no_head_gen_code: assumes "code C" and "b \<in> C" shows "code {z \<cdot> b\<^sup>@k | z k. z \<in> C \<and> z \<noteq> b}" using code.no_head_gen_code'[OF \<open>code C\<close> \<open>b \<in> C\<close>] code.intro unfolding no_head_gen_set by blast text\<open>We are now ready to prove the Graph Lemma \<close> theorem graph_lemma: "\<BB>\<^sub>F X = {hd (Dec (\<BB>\<^sub>F X) x) | x. x \<in> X \<and> x \<noteq> \<epsilon>}" proof \<comment> \<open>the core is to show that each element of the free basis must be a head\<close> show "\<BB>\<^sub>F X \<subseteq> {hd (Dec (\<BB>\<^sub>F X) x) | x. x \<in> X \<and> x \<noteq> \<epsilon>}" proof (rule ccontr) \<comment> \<open>Assume the contrary.\<close> assume "\<not> \<BB>\<^sub>F X \<subseteq> {hd (Dec \<BB>\<^sub>F X x) |x. x \<in> X \<and> x \<noteq> \<epsilon>}" \<comment> \<open>And let b be the not-head\<close> then obtain b where "b \<in> \<BB>\<^sub>F X" and nohd: "\<And> x. x \<in> X \<and> x \<noteq> \<epsilon> \<Longrightarrow> hd (Dec (\<BB>\<^sub>F X) x) \<noteq> b" by blast interpret code "\<BB>\<^sub>F X" using free_basis_code by auto \<comment> \<open>For contradiction: We have a free hull which does not contain b but contains X.\<close> let ?Cb = "no_head_gen (\<BB>\<^sub>F X) b" have "code ?Cb" using \<open>b \<in> \<BB>\<^sub>F X\<close> code_def no_head_gen_code' by blast have "b \<notin> \<langle>?Cb\<rangle>" using \<open>b \<in> \<BB>\<^sub>F X\<close> b_not_in_no_head no_head_generates by blast have "X \<subseteq> \<langle>?Cb\<rangle>" proof fix x assume "x \<in> X" hence "x \<in> \<langle>\<BB>\<^sub>F X\<rangle>" using basis_gen_hull free_hull.free_gen_in unfolding free_basis_def by blast have " x \<in> X \<and> x \<noteq> \<epsilon> \<Longrightarrow> x \<in> \<langle>?Cb\<rangle>" using hd_no_head[OF \<open>x \<in> \<langle>\<BB>\<^sub>F X\<rangle>\<close> nohd] \<open>b \<in> \<BB>\<^sub>F X\<close> no_head_generates by blast thus "x \<in> \<langle>?Cb\<rangle>" using \<open>x \<in> X\<close> by blast qed have "\<langle>X\<rangle>\<^sub>F \<subseteq> \<langle>?Cb\<rangle>" using free_hull_min[OF \<open>code ?Cb\<close> \<open>X \<subseteq> \<langle>?Cb\<rangle>\<close>]. from this[unfolded subset_eq, rule_format, of b] show False using \<open>b \<in> \<BB>\<^sub>F X\<close> \<open>b \<notin> \<langle>?Cb\<rangle>\<close> basisD simp_el_el unfolding free_basis_def by blast qed next \<comment> \<open>The opposite inclusion is easy\<close> show "{hd (Dec (\<BB>\<^sub>F X) x) | x. x \<in> X \<and> x \<noteq> \<epsilon>} \<subseteq> \<BB>\<^sub>F X" using basis_gen_hull_free dec_hd genset_sub_free by blast qed section \<open>Binary code\<close> text\<open>We illustrate the use of the Graph Lemma in an alternative proof of the fact that two non-commuting words form a code. See also @{thm no_comm_bin_code [no_vars]} in @{theory Combinatorics_Words.CoWBasic}. First, we prove a lemma which is the core of the alternative proof. \<close> lemma non_comm_hds_neq: assumes "u \<cdot> v \<noteq> v \<cdot> u" shows "hd (Dec \<BB>\<^sub>F {u,v} u) \<noteq> hd (Dec \<BB>\<^sub>F {u,v} v)" proof have "u \<noteq> \<epsilon>" and "v \<noteq> \<epsilon>" using assms by auto hence basis: "\<BB>\<^sub>F {u,v} = {hd (Dec \<BB>\<^sub>F {u,v} u),hd (Dec \<BB>\<^sub>F {u,v} v)}" using graph_lemma[of "{u,v}"] by blast assume eq: "hd (Dec \<BB>\<^sub>F {u,v} u) = hd (Dec \<BB>\<^sub>F {u,v} v)" hence "u \<in> (hd (Dec \<BB>\<^sub>F {u,v} u))*" using basis unfolding free_basis_def by (metis basis_gen_hull free_hull.simps free_hull_hull insertI1 insert_absorb2 sing_gen) moreover have "v \<in> (hd (Dec \<BB>\<^sub>F {u,v} u))*" using basis eq unfolding free_basis_def by (metis basis_gen_hull free_hull_hull genset_sub_free insert_absorb2 insert_subset sing_gen) ultimately show False using comm_root assms by blast qed theorem assumes "u \<cdot> v \<noteq> v \<cdot> u" shows "xs \<in> lists {u, v} \<Longrightarrow> ys \<in> lists {u, v} \<Longrightarrow> concat xs = concat ys \<Longrightarrow> xs = ys" proof (induct xs ys rule: list_induct2', simp) case (2 x xs) then show ?case using Nil_is_append_conv append_Nil assms by auto next case (3 y ys) then show ?case using Nil_is_append_conv append_Nil assms by auto next case (4 x xs y ys) then show ?case proof- have "u \<noteq> \<epsilon>" and "v \<noteq> \<epsilon>" using assms by force+ hence "x \<noteq> \<epsilon>" and "y \<noteq> \<epsilon>" using \<open>x # xs \<in> lists {u, v}\<close> \<open>y # ys \<in> lists {u, v}\<close> by auto have or_x: "x = u \<or> x = v" and or_y: "y = u \<or> y = v" using \<open>x # xs \<in> lists {u, v}\<close> \<open>y # ys \<in> lists {u, v}\<close> by auto have hd_z: "z \<noteq> \<epsilon> \<Longrightarrow> z # zs \<in> lists {u, v} \<Longrightarrow> hd (Dec \<BB>\<^sub>F {u,v} (concat (z#zs))) = hd (Dec \<BB>\<^sub>F {u,v} z)" for z zs proof- assume "z \<noteq> \<epsilon>" "z # zs \<in> lists {u, v}" have "z \<in> \<langle>{u,v}\<rangle>\<^sub>F" using \<open>z # zs \<in> lists {u, v}\<close> by auto moreover have "concat zs \<in> \<langle>{u,v}\<rangle>\<^sub>F" using concat_tl[OF \<open>z # zs \<in> lists {u, v}\<close>] hull_in_free_hull[of "{u,v}"] by blast ultimately have "Dec \<BB>\<^sub>F {u,v} (concat (z#zs)) = (Dec \<BB>\<^sub>F {u,v} z) \<cdot> (Dec \<BB>\<^sub>F {u,v} (concat zs))" using free_basis_dec_morph[of z "{u,v}" "concat zs"] by fastforce moreover have "Dec \<BB>\<^sub>F {u,v} z \<noteq> \<epsilon>" using \<open>z \<in> \<langle>{u, v}\<rangle>\<^sub>F\<close> basis_gen_hull_free dec_nemp'[OF \<open>z \<noteq> \<epsilon>\<close>] by blast ultimately show "hd (Dec \<BB>\<^sub>F {u,v} (concat (z#zs))) = hd (Dec \<BB>\<^sub>F {u,v} z)" using hd_append by simp qed have "hd (Dec \<BB>\<^sub>F {u,v} u) \<noteq> hd (Dec \<BB>\<^sub>F {u,v} v)" using non_comm_hds_neq[OF assms]. hence "x = y" using hd_z[OF \<open>x \<noteq> \<epsilon>\<close> \<open>x # xs \<in> lists {u, v}\<close> , unfolded \<open>concat (x # xs) = concat (y # ys)\<close> hd_z[OF \<open>y \<noteq> \<epsilon>\<close> \<open>y # ys \<in> lists {u, v}\<close>]] or_x or_y by fastforce thus ?thesis using "4.hyps" "4.prems" by auto qed qed end
module SmallStepCombined %access public export %default total data Tm : Type where C : Nat -> Tm P : Tm -> Tm -> Tm Tru : Tm Fls : Tm If : Tm -> Tm -> Tm -> Tm data Value : Tm -> Type where V_Const : (n : Nat) -> Value (C n) V_Tru : Value Tru V_Fls : Value Fls Uninhabited (Value (P _ _)) where uninhabited (V_Const _) impossible uninhabited V_Tru impossible uninhabited V_Fls impossible data Step : Tm -> Tm -> Type where ST_PlusConstConst : Step (P (C n1) (C n2)) (C (n1 + n2)) ST_Plus1 : Step t1 t1' -> Step (P t1 t2) (P t1' t2) ST_Plus2 : Value v1 -> Step t2 t2' -> Step (P v1 t2) (P v1 t2') ST_IfTrue : Step (If Tru t1 t2) t1 ST_IfFalse : Step (If Fls t1 t2) t2 ST_If : Step t1 t1' -> Step (If t1 t2 t3) (If t1' t2 t3) Uninhabited (Step (C n) _) where uninhabited ST_PlusConstConst impossible uninhabited (ST_Plus1 _) impossible uninhabited (ST_Plus2 _ _) impossible uninhabited ST_IfTrue impossible uninhabited ST_IfFalse impossible uninhabited (ST_If _) impossible Uninhabited (Step Tru _) where uninhabited ST_PlusConstConst impossible uninhabited (ST_Plus1 _) impossible uninhabited (ST_Plus2 _ _) impossible uninhabited ST_IfTrue impossible uninhabited ST_IfFalse impossible uninhabited (ST_If _) impossible Uninhabited (Step Fls _) where uninhabited ST_PlusConstConst impossible uninhabited (ST_Plus1 _) impossible uninhabited (ST_Plus2 _ _) impossible uninhabited ST_IfTrue impossible uninhabited ST_IfFalse impossible uninhabited (ST_If _) impossible infix 4 -+> (-+>) : Tm -> Tm -> Type (-+>) = Step step_deterministic : Step x y1 -> Step x y2 -> y1 = y2 step_deterministic ST_PlusConstConst ST_PlusConstConst = Refl step_deterministic (ST_Plus1 s1) (ST_Plus2 (V_Const _) _) = absurd s1 step_deterministic (ST_Plus1 s1) (ST_Plus2 V_Tru _) = absurd s1 step_deterministic (ST_Plus1 s1) (ST_Plus2 V_Fls _) = absurd s1 step_deterministic (ST_Plus2 (V_Const _) _) (ST_Plus1 s1) = absurd s1 step_deterministic (ST_Plus2 V_Tru _) (ST_Plus1 s1) = absurd s1 step_deterministic (ST_Plus2 V_Fls _) (ST_Plus1 s1) = absurd s1 step_deterministic (ST_Plus1 s1) (ST_Plus1 s2) = rewrite step_deterministic s1 s2 in Refl step_deterministic (ST_Plus2 v1 s1) (ST_Plus2 v2 s2) = rewrite step_deterministic s1 s2 in Refl step_deterministic ST_IfTrue ST_IfTrue = Refl step_deterministic ST_IfFalse ST_IfFalse = Refl step_deterministic (ST_If s1) (ST_If s2) = rewrite step_deterministic s1 s2 in Refl strong_progress : (t : Tm ** (Not (Value t), Not (t' : Tm ** t -+> t'))) strong_progress = (P Tru (C 0) ** ( \v => absurd v , \(_ ** s) => case s of ST_Plus1 s1 => absurd s1 ST_Plus2 _ s2 => absurd s2 ))
The film is often credited with making Amitabh Bachchan a " superstar " , two years after he became a star with Zanjeer ( 1973 ) . Some of the supporting actors remained etched in public memory as the characters they played in Sholay ; for example , Mac Mohan continued to be referred to as " Sambha " , even though his character had just one line . Major and minor characters continue to be used in commercials , promos , films and sitcoms . Amjad Khan acted in many villainous roles later in his career . He also played Gabbar Singh again in the 1991 spoof Ramgarh Ke Sholay , and reprised the role in commercials . The British Film Institute in 2002 wrote that fear of Gabbar Singh " is still invoked by mothers to put their children to sleep " . The 2012 film Gabbar Singh , named after the character , became the highest grossing Telugu film up to that point . Comedian Jagdeep , who played Soorma Bhopali in the film , attempted to use his Sholay success to create a spinoff . He directed and played the lead role in the 1988 film Soorma Bhopali , in which Dharmendra and Bachchan had cameos .
-------------------------------------------------------------------------------- -- This is part of Agda Inference Systems {-# OPTIONS --sized-types #-} open import Data.Nat open import Data.Vec open import Data.Fin open import Data.Product open import Data.Sum open import Data.Unit open import Data.Empty open import Relation.Nullary open import Relation.Binary.PropositionalEquality open import Size open import is-lib.SInfSys open import Examples.Lambda.Lambda module Examples.Lambda.BigStep where data Value∞ : Set where res : Value → Value∞ div : Value∞ U : Set U = Term 0 × Value∞ data BigStepRN : Set where VAL APP L-DIV R-DIV : BigStepRN data BigStepCoRN : Set where COA : BigStepCoRN coa-r : FinMetaRule U coa-r .Ctx = Term 0 coa-r .comp t = [] , ------------------------- (t , div) val-r : FinMetaRule U val-r .Ctx = Value val-r .comp v = [] , ------------------------- (term v , res v) app-r : FinMetaRule U app-r .Ctx = Term 0 × Term 1 × Term 0 × Value × Value∞ app-r .comp (t1 , t , t2 , v , v∞) = (t1 , res (lambda t)) ∷ (t2 , res v) ∷ (subst-0 t (term v) , v∞) ∷ [] , ------------------------- (app t1 t2 , v∞) l-div-r : FinMetaRule U l-div-r .Ctx = Term 0 × Term 0 l-div-r .comp (t1 , t2) = (t1 , div) ∷ [] , ------------------------- (app t1 t2 , div) r-div-r : FinMetaRule U r-div-r .Ctx = Term 0 × Term 0 × Value r-div-r .comp (t1 , t2 , v) = (t1 , res v) ∷ (t2 , div) ∷ [] , ------------------------- (app t1 t2 , div) BigStepIS : IS U BigStepIS .Names = BigStepRN BigStepIS .rules VAL = from val-r BigStepIS .rules APP = from app-r BigStepIS .rules L-DIV = from l-div-r BigStepIS .rules R-DIV = from r-div-r BigStepCOIS : IS U BigStepCOIS .Names = BigStepCoRN BigStepCOIS .rules COA = from coa-r _⇓_ : Term 0 → Value∞ → Size → Set (t ⇓ v∞) i = SFCoInd⟦ BigStepIS , BigStepCOIS ⟧ (t , v∞) i _⇓ᵢ_ : Term 0 → Value∞ → Set t ⇓ᵢ v∞ = Ind⟦ BigStepIS ∪ BigStepCOIS ⟧ (t , v∞) {- Properties -} val-not-reduce⇓ : ∀{v} → ¬ (∀{i} → ((term v) ⇓ div) i) val-not-reduce⇓ {lambda _} bs with bs val-not-reduce⇓ {lambda _} bs | (sfold (VAL , _ , () , _)) val-⇓ᵢ-≡ : ∀{v v'} → term v ⇓ᵢ res v' → v ≡ v' val-⇓ᵢ-≡ {lambda x} {lambda .x} (fold (inj₁ VAL , .(lambda x) , refl , _)) = refl val-⇓ᵢ-≡ {lambda x} {lambda x₁} (fold (inj₁ APP , _ , () , _)) val-⇓ᵢ-≡ {v} {v'} (fold (inj₂ COA , _ , () , _)) val-⇓-≡ : ∀{v v'} → (∀{i} → (term v ⇓ res v') i) → v ≡ v' val-⇓-≡ bs = val-⇓ᵢ-≡ (sfcoind-to-ind bs)
/- if R is a ring and if the multiplicative subset S consists completely of nonzerodivisors, then R→S−1R is injective [proof omitted] -/ import ring_theory.localization group_theory.submonoid universe u variables {α : Type u} [comm_ring α] (S : set α) [is_submonoid S] theorem localization.inj_of_subset_non_zero_divisors (H : S ⊆ localization.non_zero_divisors α) : function.injective (localization.of_comm_ring α S) := λ x y h, let ⟨w, hws, hw⟩ := quotient.exact h in eq.symm $ by simpa [add_neg_eq_zero] using H hws _ hw
import Lean import Lean.Meta import Lean.Parser import LeanCodePrompts.CheckParse import LeanCodePrompts.ParseJson import LeanCodePrompts.Autocorrect import LeanCodePrompts.KeywordSummary.KeywordExtraction import LeanCodePrompts.EgsTranslate open Lean Meta open Lean Elab Parser Command def fileName := "data/safe_prompts.json" /-- extract prompt pairs from JSON response to local server -/ def sentenceSimPairs (s: String) (theoremField : String := "theorem") : MetaM <| Except String (Array (String × String)) := do let json ← readJson s return do (← json.getArr?).mapM <| fun j => do let docstring ← j.getObjValAs? String "doc_string" let typeField := if fileName ∈ ["data/mathlib4-prompts.json"] then "type" else theoremField let thm ← j.getObjValAs? String typeField pure (docstring, thm) -- #eval sentenceSimPairs egSen namespace GPT def message (role content : String) : Json := Json.mkObj [("role", role), ("content", content)] def prompt (sys: String) (egs : List <| String × String)(query : String) : Json := let head := message "system" sys let egArr := egs.bind (fun (ds, thm) => [message "user" ds, message "assistant" thm]) Json.arr <| head :: egArr ++ [message "user" query] |>.toArray def sysPrompt := "You are a coding assistant who translates from natural language to Lean Theorem Prover code following examples. Follow EXACTLY the examples given." def makePrompt(query : String)(pairs: Array (String × String)) : Json:= prompt sysPrompt pairs.toList query def makeFlipPrompt(query : String)(pairs: Array (String × String)) : Json:= prompt sysPrompt (pairs.toList.map (fun (x, y) => (y, x))) query def jsonToExprStrArray (json: Json) : TermElabM (Array String) := do let outArr : Array String ← match json.getArr? with | Except.ok arr => let parsedArr : Array String ← arr.filterMapM <| fun js => match js.getObjVal? "message" with | Except.ok jsobj => match jsobj.getObjVal? "content" with | Except.ok jsstr => match jsstr.getStr? with | Except.ok str => pure (some str) | Except.error e => throwError m!"json string expected but got {js}, error: {e}" | Except.error _ => throwError m!"no content field in {jsobj}" | Except.error _ => throwError m!"no message field in {js}" pure parsedArr | Except.error e => throwError m!"json parsing error: {e}" end GPT /-- make prompt from prompt pairs -/ @[deprecated GPT.makePrompt] def makePrompt(prompt : String)(pairs: Array (String × String)) : String := pairs.foldr (fun (ds, thm) acc => -- acc ++ "/-- " ++ ds ++" -/\ntheorem" ++ thm ++ "\n" ++ "\n" s!"/-- {ds} -/ theorem {thm} := {acc}" ) s!"/-- {prompt} -/ theorem " /-- make prompt for reverse translation from prompt pairs -/ @[deprecated GPT.makeFlipPrompt] def makeFlipPrompt(statement : String)(pairs: Array (String × String)) : String := pairs.foldr (fun (ds, thm) acc => s!"theorem {thm} := /- {ds} -/ {acc}" ) s!"theorem {statement} := /- " /-- make prompt for reverse translation from prompt pairs -/ def makeFlipStatementsPrompt(statement : String)(pairs: Array (String × String)) : String := pairs.foldr (fun (ds, thm) acc => s!"{thm} := /- {ds} -/ {acc}" ) s!"{statement} := /- " def openAIKey : IO (Option String) := IO.getEnv "OPENAI_API_KEY" /--query OpenAI Codex with given prompt and parameters -/ def codexQuery(prompt: String)(n: Nat := 1) (temp : JsonNumber := ⟨2, 1⟩)(stopTokens: Array String := #[":=", "-/"]) : MetaM Json := do let key? ← openAIKey let key := match key? with | some k => k | none => panic! "OPENAI_API_KEY not set" let dataJs := Json.mkObj [("model", "code-davinci-002"), ("prompt", prompt), ("temperature", Json.num temp), ("n", n), ("max_tokens", 150), ("stop", Json.arr <| stopTokens |>.map Json.str)] let data := dataJs.pretty trace[Translate.info] "OpenAI query: {data}" let out ← IO.Process.output { cmd:= "curl", args:= #["https://api.openai.com/v1/completions", "-X", "POST", "-H", "Authorization: Bearer " ++ key, "-H", "Content-Type: application/json", "--data", data]} readJson out.stdout def gptQuery(messages: Json)(n: Nat := 1) (temp : JsonNumber := ⟨2, 1⟩)(stopTokens: Array String := #[":=", "-/"]) : MetaM Json := do let key? ← openAIKey let key := match key? with | some k => k | none => panic! "OPENAI_API_KEY not set" let dataJs := Json.mkObj [("model", "gpt-3.5-turbo"), ("messages", messages) , ("temperature", Json.num temp), ("n", n), ("max_tokens", 150), ("stop", Json.arr <| stopTokens |>.map Json.str) ] let data := dataJs.pretty trace[Translate.info] "OpenAI query: {data}" let out ← IO.Process.output { cmd:= "curl", args:= #["https://api.openai.com/v1/chat/completions", "-X", "POST", "-H", "Authorization: Bearer " ++ key, "-H", "Content-Type: application/json", "--data", data]} trace[Translate.info] "OpenAI response: {out.stdout} (stderr: {out.stderr})" readJson out.stdout def openAIQuery(prompt: String)(n: Nat := 1) (temp : JsonNumber := ⟨2, 1⟩)(stopTokens: Array String := #[":=", "-/"]) : MetaM Json := codexQuery prompt n temp stopTokens /-! Caching, polling etc to avoid repeatedly calling servers -/ initialize webCacheJson : IO.Ref (HashMap String Json) ← IO.mkRef (HashMap.empty) initialize pendingJsonQueries : IO.Ref (HashSet String) ← IO.mkRef (HashSet.empty) initialize logCache : IO.Ref (Array String) ← IO.mkRef (#[]) def mkLog{α : Type _}[ToString α](msg: α) : IO Unit := do let cache ← logCache.get logCache.set (cache.push (toString msg)) def logs (num: Nat) : IO (List String) := do let cache ← logCache.get return cache.reverse.toList.take num def showLogs (num: Nat) : IO Unit := do let cache ← logCache.get let ls := cache.reverse.toList.take num for lines in ls do for l in lines.splitOn "\n" do IO.println l def getCachedJson? (s: String) : IO (Option Json) := do let cache ← webCacheJson.get return cache.find? s def cacheJson (s: String)(js: Json) : IO Unit := do let cache ← webCacheJson.get webCacheJson.set (cache.insert s js) return () partial def pollCacheJson (s : String) : IO Json := do let cache ← webCacheJson.get match cache.find? s with | some jsBlob => return jsBlob | none => do IO.sleep 200 pollCacheJson s /-- check if there is a valid elaboration after translation, autocorrection -/ def hasElab (s: String)(limit : Option Nat := none) : TermElabM Bool := do -- (elabThmTrans s).map (fun e => e.toBool) let elab? ← polyElabThmTrans s limit match elab? with | Except.error _ => return Bool.false | Except.ok els => return !els.isEmpty /-- log to file -/ def elabLog (s: String) : IO Unit := do let logFile := System.mkFilePath ["results/elab_logs.txt"] let h ← IO.FS.Handle.mk logFile IO.FS.Mode.append Bool.false h.putStrLn s h.putStrLn "" def fixedPrompts:= #[("If $z_1, \\dots, z_n$ are complex, then $|z_1 + z_2 + \\dots + z_n|\\leq |z_1| + |z_2| + \\dots + |z_n|$.", "(n : ℕ) (f : ℕ → ℂ) :\n abs (∑ i in finset.range n, f i) ≤ ∑ i in finset.range n, abs (f i) :="), ("If x and y are in $\\mathbb{R}^n$, then $|x+y|^2 + |x-y|^2 = 2|x|^2 + 2|y|^2$.", "(n : ℕ) (x y : euclidean_space ℝ (fin n)) :\n ∥x + y∥^2 + ∥x - y∥^2 = 2*∥x∥^2 + 2*∥y∥^2 :="), ("If $x$ is an element of infinite order in $G$, prove that the elements $x^n$, $n\\in\\mathbb{Z}$ are all distinct.", "(G : Type*) [group G] (x : G) (hx : x ≠ 1) (hx_inf : ∀ n : ℕ, x ^ n ≠ 1) : ∀ m n : ℤ, m ≠ n → x ^ m ≠ x ^ n :="), ("Let $X$ be a topological space; let $A$ be a subset of $X$. Suppose that for each $x\\in A$ there is an open set $U$ containing $x$ such that $U\\subset A$. Show that $A$ is open in $X$.", "(X : Type*) [topological_space X]\n (A : set X) (hA : ∀ x ∈ A, ∃ U : set X, is_open U ∧ x ∈ U ∧ U ⊆ A):\n is_open A :=")] /-- choosing pairs to build a prompt -/ def getPromptPairs(s: String)(numSim : Nat)(numKW: Nat) (scoreBound: Float)(matchBound: Nat) : TermElabM (Array (String × String) × IO.Process.Output) := do let jsData := Json.mkObj [ ("filename", fileName), ("field", "doc_string"), ("doc_string", s), ("n", numSim), ("model_name", "all-mpnet-base-v2") ] let simJsonOut ← IO.Process.output {cmd:= "curl", args:= #["-X", "POST", "-H", "Content-type: application/json", "-d", jsData.pretty, s!"{← leanAideIP}/nearest_prompts"]} let pairs? ← sentenceSimPairs simJsonOut.stdout "theorem" -- IO.println s!"obtained sentence similarity; time : {← IO.monoMsNow}" let allPairs : Array (String × String) ← match pairs? with | Except.error e => throwError e | Except.ok pairs => pure pairs -- logInfo m!"all pairs: {allPairs}" let kwPairs := if numKW >0 then ← keywordBasedPrompts docPair s numKW scoreBound matchBound else #[] -- IO.println s!"obtained keyword pairs; time : {← IO.monoMsNow}" let allPairs := (allPairs ++ kwPairs).toList.eraseDups.toArray let pairs -- := allPairs -- ← allPairs.filterM (fun (_, s) => do isElabPrompt s ) let kwPairs ← keywordBasedPrompts docPair s return ( (pairs ++ kwPairs).toList.eraseDups.toArray, simJsonOut) /-- choosing pairs to build a prompt -/ def getPromptPairsGeneral(s: String)(numSim : Nat)(field: String := "doc_string") (theoremField : String := "theorem") : TermElabM (Array (String × String) × IO.Process.Output) := do let jsData := Json.mkObj [ ("filename", fileName), ("field", field), (field, s), ("n", numSim), ("model_name", "all-mpnet-base-v2") ] let simJsonOut ← IO.Process.output {cmd:= "curl", args:= #["-X", "POST", "-H", "Content-type: application/json", "-d", jsData.pretty, s!"{← leanAideIP}/nearest_prompts"]} let pairs? ← sentenceSimPairs simJsonOut.stdout theoremField -- IO.println s!"obtained sentence similarity; time : {← IO.monoMsNow}" let allPairs : Array (String × String) ← match pairs? with | Except.error e => throwError e | Except.ok pairs => pure pairs -- logInfo m!"all pairs: {allPairs}" return ( allPairs.toList.eraseDups.toArray, simJsonOut) /-- given string to translate, build prompt and query OpenAI; returns JSON response -/ def getCodeJson (s: String)(numSim : Nat:= 8)(numKW: Nat := 0)(includeFixed: Bool := Bool.false)(queryNum: Nat := 5)(temp : JsonNumber := ⟨2, 1⟩)(scoreBound: Float := 0.2)(matchBound: Nat := 15) : TermElabM Json := do match ← getCachedJson? s with | some js => return js | none => let pending ← pendingJsonQueries.get if pending.contains s then pollCacheJson s else let pending ← pendingJsonQueries.get pendingJsonQueries.set (pending.insert s) -- work starts here; before this was caching, polling etc let (pairs, IOOut) ← if numSim > 0 then getPromptPairs s numSim numKW scoreBound matchBound else pure (#[], ⟨0, "", ""⟩) let pairs := if includeFixed then pairs ++ fixedPrompts else pairs let pairs := pairs.filter (fun (s, _) => s.length < 100) let prompt := GPT.makePrompt s pairs trace[Translate.info] m!"prompt: \n{prompt.pretty}" -- mkLog prompt let fullJson ← gptQuery prompt queryNum temp let outJson := (fullJson.getObjVal? "choices").toOption.getD (Json.arr #[]) let pending ← pendingJsonQueries.get pendingJsonQueries.set (pending.erase s) if IOOut.exitCode = 0 then cacheJson s outJson else throwError m!"Web query error: {IOOut.stderr}" return outJson /-- Given an array of outputs, tries to elaborate them with translation and autocorrection and returns the best choice, throwing an error if nothing elaborates. -/ def arrayToExpr (output: Array String) : TermElabM Expr := do let output := output.toList.eraseDups.toArray trace[Translate.info] m!"output:\n{output}" -- mkLog output let mut elaborated : Array String := Array.empty -- translation, autocorrection and filtering by elaboration for out in output do let ployElab? ← polyElabThmTrans out match ployElab? with | Except.error _ => pure () | Except.ok es => for (_ , _, s) in es do elaborated := elaborated.push s if elaborated.isEmpty then do -- information with failed logs logWarning m!"No valid output from Codex; outputs below" for out in output do let polyOut ← polyStrThmTrans out for str in polyOut do logWarning m!"{str}" mkSyntheticSorry (mkSort levelZero) else -- grouping by trying to prove equality and selecting let groupSorted ← groupFuncStrs elaborated let topStr := groupSorted[0]![0]! let thmExc ← elabFuncTyp topStr match thmExc with | Except.ok (_, thm) => return thm | Except.error s => throwError s /-- Given an array of outputs, tries to elaborate them with translation and autocorrection and returns the best choice, throwing an error if nothing elaborates. -/ def arrayToStx (output: Array String) : TermElabM Syntax := do let output := output.toList.eraseDups.toArray trace[Translate.info] m!"output:\n{output}" -- mkLog output let mut elaborated : Array String := Array.empty -- translation, autocorrection and filtering by elaboration for out in output do let ployElab? ← polyElabThmTrans out match ployElab? with | Except.error _ => pure () | Except.ok es => for (_ , _, s) in es do elaborated := elaborated.push s if elaborated.isEmpty then do -- information with failed logs logWarning m!"No valid output from Codex; outputs below" for out in output do let polyOut ← polyStrThmTrans out for str in polyOut do logWarning m!"{str}" pure Syntax.missing else -- grouping by trying to prove equality and selecting let groupSorted ← groupFuncStrs elaborated let topStr := groupSorted[0]![0]! let thmExc ← elabFuncTyp topStr match thmExc with | Except.ok (stx, _) => return stx | Except.error s => throwError s /-- Given an array of outputs, tries to elaborate them with translation and autocorrection and optionally returns the best choice as well as all elaborated terms (used for batch processing, interactive code uses `arrayToExpr` instead) -/ def arrayToExpr? (output: Array String) : TermElabM (Option (Expr× (Array String))) := do -- IO.println s!"arrayToExpr? called with {output.size} outputs" let mut elaborated : Array String := Array.empty let mut fullElaborated : Array String := Array.empty for out in output do -- IO.println s!"elaboration called: {out}" let ployElab? ← polyElabThmTrans out match ployElab? with | Except.error _ => pure () | Except.ok es => for (expr, _, s) in es do elaborated := elaborated.push s if !expr.hasExprMVar then fullElaborated := fullElaborated.push s if elaborated.isEmpty then elabLog "No valid output from Codex; outputs below" for out in output do let polyOut ← polyStrThmTrans out for str in polyOut do elabLog s!"{str}" return none else let priority := if fullElaborated.isEmpty then elaborated else fullElaborated let groupSorted ← groupFuncStrs priority let topStr := groupSorted[0]![0]! let thmExc ← elabFuncTyp topStr match thmExc with | Except.ok (_, thm) => return some (thm, elaborated) | Except.error s => elabLog s!"Second round error : {s}" return none def greedyArrayToExpr? (output: Array String) : TermElabM (Option Expr) := do output.findSomeM? <| fun out => do let t? ← elabThmTrans? out return t?.map fun (expr, _, _) => expr /-- reverse translation from `Lean` to natural language -/ def leanToPrompt (thm: String)(numSim : Nat:= 5)(numKW: Nat := 1)(temp : JsonNumber := 0)(scoreBound: Float := 0.2)(matchBound: Nat := 15)(textField : String := "text") : TermElabM String := do let (pairs, _) ← getPromptPairs thm numSim numKW scoreBound matchBound let prompt := GPT.makeFlipPrompt thm pairs -- elabLog prompt let fullJson ← gptQuery prompt 1 temp let outJson := (fullJson.getObjVal? "choices").toOption.getD (Json.arr #[]) let out? := (outJson.getArrVal? 0).bind fun js => js.getObjVal? textField let outJson := match (out?) with | Except.error s => Json.str s!"query for translation failed: {s}" | Except.ok js => js return outJson.getStr! /-- reverse translation from `Lean` to natural language -/ @[deprecated leanToPrompt] def statementToDoc (thm: String)(numSim : Nat:= 5)(temp : JsonNumber := 0) : TermElabM String := do let (pairs, _) ← getPromptPairsGeneral thm numSim "statement" let prompt := makeFlipStatementsPrompt thm pairs -- elabLog prompt let fullJson ← openAIQuery prompt 1 temp let outJson := (fullJson.getObjVal? "choices").toOption.getD (Json.arr #[]) let out? := (outJson.getArrVal? 0).bind fun js => js.getObjVal? "text" let outJson := match (out?) with | Except.error s => Json.str s!"query for translation failed: {s}" | Except.ok js => js return outJson.getStr! def egThm := "theorem eg_thm : ∀ n: Nat, ∃ m : Nat, m > n ∧ m % 2 = 0" def egPairs := getPromptPairsGeneral egThm 5 "statement" "statement" def egPrompt := do let (pairs, _) ← egPairs return makeFlipStatementsPrompt egThm pairs -- #eval egPrompt -- #eval statementToDoc egThm 5 0 -- #eval leanToPrompt "∀ {p : ℕ} [inst : Fact (Nat.Prime p)], p = 2 ∨ p % 2 = 1" -- #eval leanToPrompt "∀ {α : Type u} {x : FreeGroup α}, x ≠ 1 → ¬IsOfFinOrder x" -- #eval leanToPrompt "{ n : ℕ } -> Even ( ( n + 1 ) * n )" /-- array of outputs extracted from OpenAI Json -/ def jsonToExprStrArray (json: Json) : TermElabM (Array String) := do let outArr : Array String ← match json.getArr? with | Except.ok arr => let parsedArr : Array String ← arr.filterMapM <| fun js => match js.getObjVal? "text" with | Except.ok jsstr => match jsstr.getStr? with | Except.ok str => pure (some str) | Except.error e => throwError m!"json string expected but got {js}, error: {e}" | Except.error _ => throwError m!"no text field" pure parsedArr | Except.error e => throwError m!"json parsing error: {e}" return outArr /-- array of outputs extracted from Json Array -/ def jsonStringToExprStrArray (jsString: String) : TermElabM (Array String) := do try let json ← readJson jsString let outArr : Array String ← match json.getArr? with | Except.ok arr => let parsedArr : Array String ← arr.filterMapM <| fun js => match js.getStr? with | Except.ok str => pure (some str) | Except.error e => throwError m!"json string expected but got {js}, error: {e}" pure parsedArr | Except.error _ => pure #[jsString] return outArr catch _ => pure #[jsString] -- #eval jsonStringToExprStrArray "simple" -- #eval jsonStringToExprStrArray "[\"simple\", \"simple2\"]" /-- given json returned by open-ai obtain the best translation -/ def jsonToExpr' (json: Json) : TermElabM Expr := do let output ← GPT.jsonToExprStrArray json arrayToExpr output /-- translation from a comment-like syntax to a theorem statement -/ elab "//-" cb:commentBody : term => do let s := cb.raw.getAtomVal let s := (s.dropRight 2).trim -- querying codex let js ← getCodeJson s -- filtering, autocorrection and selection let e ← jsonToExpr' js trace[Translate.info] m!"{e}" return e def uncurriedView(numArgs: Nat)(e: Expr) : MetaM String := match numArgs with | 0 => do return " : " ++ (← e.view) | k +1 => match e with | Expr.forallE n t _ bi => do let core := s!"{n.eraseMacroScopes} : {← t.view}" let typeString :=s!"{← t.view}" let argString := match bi with | BinderInfo.implicit => "{"++ core ++ "}" | BinderInfo.strictImplicit => "{{ "++ core ++ "}}" | BinderInfo.instImplicit => if (`inst).isPrefixOf n then s!"[{typeString}]" else s!"[{core}]" | BinderInfo.default => s!"({core})" let tail : String ← withLocalDecl `func BinderInfo.default e fun func => withLocalDecl n bi t fun arg => do let fx := mkAppN func #[arg] let newType ← inferType fx uncurriedView k newType return " " ++ argString ++ tail | _ => do return " : " ++ (← e.view) elab "uncurry2" e:term : term => do let e ← Term.elabTerm e none let e ← uncurriedView 2 e return mkStrLit e universe u def translateViewM (s: String) : TermElabM String := do let js ← getCodeJson s let output ← GPT.jsonToExprStrArray js trace[Translate.info] m!"{output}" let e? ← arrayToExpr? output match e? with | some (e, _) => do e.view | none => do let stx ← output.findSomeM? <| fun s => do let exp ← identMappedFunStx s return exp.toOption return stx.getD "False" /-- view of string in core; to be run with Snapshot.runCore -/ def translateViewCore (s: String) : CoreM String := (translateViewM s).run'.run'
(* -*- coq-prog-args: ("-top" "ModelStructure.CtxFibrancy.Overture") -*- *) Require Export ModelStructure.Overture. Axiom FibrantF : forall {A: Type} (P: A -> Type), Type. Existing Class FibrantF. Notation "'Fibrant' A" := (FibrantF (λ _:unit, A)) (at level 10) : Fib_scope. Notation "'FibrantF2' P" := (FibrantF (λ w, P w.1 w.2)) (at level 10) : Fib_scope. Notation "'FibrantF3' P" := (FibrantF (λ w, P w.1 w.2.1 w.2.2)) (at level 10) : Fib_scope. Open Scope Fib_scope. Record TypeF := { TypeF_T : Type; TypeF_F : Fibrant TypeF_T }. Arguments Build_TypeF _ {_}. Coercion TypeF_T : TypeF >-> Sortclass. Global Existing Instance TypeF_F. Axiom FibrantF_forall : ∀ {A: Type} {B: A -> Type} {C: ∀ x, B x -> Type}, FibrantF B -> FibrantF2 C -> FibrantF (λ x, ∀ y, C x y). Axiom FibrantF_sigma : ∀ {A: Type} {B: A -> Type} {C: ∀ x, B x -> Type}, FibrantF B -> FibrantF2 C -> FibrantF (λ x, ∃ y, C x y). Axiom Fibrant_Type : Fibrant Type. Axiom FibrantF_compose : forall A (B: A -> Type) {FibB: FibrantF B} A' (f: A' -> A), FibrantF (B o f). (* Axiom Fibrant_TypeF : Fibrant FType. *) Instance Fibrant_FibrantF A (B: A -> Type) {FibP: FibrantF B} : ∀ x, Fibrant (B x) := λ x, FibrantF_compose A B unit (λ _, x). Instance Fibrant_sigma A (B: A -> Type) : Fibrant A -> FibrantF B -> Fibrant (sigT B). Proof. intros. ref (@FibrantF_sigma unit (λ _, A) (λ _ x, B x) _ _). Defined. Instance FibrantF_constant A B {FibB: Fibrant B} : FibrantF (λ _:A, B) | 50 := FibrantF_compose unit (λ _, B) A (λ _, tt). Instance FibrantF2_fibrant A (B: A -> Type) (C: forall x, B x -> Type) (H: FibrantF2 C) : forall x y, Fibrant (C x y). intros x y; exact (@Fibrant_FibrantF _ _ H (x; y)). Defined. Instance FibrantF2_FibrantF A (B: A -> Type) (C: forall x, B x -> Type) (H: FibrantF2 C) : forall x, FibrantF (C x) | 50. intros x. exact (FibrantF_compose (sigT B) _ _ (λ y : B x, (x; y))). Defined. Instance FibrantF2_FibrantF_constant A B (C: A -> B -> Type) (H: FibrantF2 C) : forall x, FibrantF (C x). intros x. exact (FibrantF_compose (sigT (λ _, B)) _ _ (λ y, (x; y))). Defined. Instance FibrantF2_FibrantF'_constant A B (C: A -> B -> Type) (H: FibrantF2 C) : forall y, FibrantF (λ x, C x y) | 50. intros y. exact (FibrantF_compose _ _ _ (λ x, (x; y))). Defined. Module Export Paths. Private Inductive paths {A : Type} (a : A) : A -> Type := idpath : paths a a. Arguments idpath {A a} , [A] a. Definition paths_ind (A : Type) {FibA: Fibrant A} (a : A) (P : forall a0 : A, paths a a0 -> Type) {FibP: FibrantF2 P} (f: P a idpath) (y : A) (p : paths a y) : P y p := match p as p0 in (paths _ y0) return (P y0 p0) with | idpath => f end. Arguments paths_ind [A _] a P [_] f y p. Definition paths_rec (A : Type) {FibA: Fibrant A} (a : A) (P : A -> Type) {FibP: FibrantF P} (f : P a) (y : A) (p : paths a y) : P y := match p in (paths _ y0) return (P y0) with | idpath => f end. Axiom FibrantF_paths : forall {Δ} (A : Δ -> Type) (t t' : forall x, A x), FibrantF A -> FibrantF (fun x => paths (t x) (t' x)). (** The inverse of a path. *) Definition inverse {A : Type} {FibA: Fibrant A} {x y : A} (p : paths x y) : paths y x := @paths_rec A FibA x (fun y => paths y x) _ idpath y p. Definition paths_rec' A {FibA: Fibrant A} a y P {FibP: FibrantF P} (X : P y) (H : @paths A a y) : P a := @paths_rec A FibA y P FibP X _ (inverse H). (* ****** myrewrite plugin ****** *) (* This plugin is to avoid a flaw in the mechanism of private inductive types. *) (* When we rewrite with a path equality, Coq uses the automatically generated terms internal_paths_rew and internal_paths_rew_r.*) (* However, those terms doesn't check the fibrancy condition. *) (* Hence this plugin forces Coq to use paths_rec and paths_rec' instead. *) Declare ML Module "myrewrite2". End Paths. Arguments paths_rec [A _] a P [_] f y p. Notation "x = y :> A" := (@paths A x y) : type_scope. Notation "x = y" := (x = y :> _) : type_scope. Notation "f == g" := (forall x, f x = g x) (at level 70, no associativity) : type_scope. Tactic Notation "rew" open_constr(H) := rewrite H; auto with typeclass_instances. Tactic Notation "rewi" open_constr(H) := rewrite <- H; auto with typeclass_instances. (* This does not fail if you comment the "Declare ML Module..." line above. *) Lemma paths_rew_r_test_should_fail A {FibA: Fibrant A} a y P (X : P y) (H : a = y :> A) : P a. Proof. Fail rewrite H; assumption. Abort. Lemma paths_rew_test A {FibA: Fibrant A} a y P {FibP: FibrantF P} (X : P a) (H : a = y :> A) : P y. Proof. rewi H. Defined. Lemma paths_rew_r_test A {FibA: Fibrant A} a y P {FibP: FibrantF P} (X : P y) (H : a = y :> A) : P a. Proof. rew H. Defined. Definition Eq_to_paths {A : Type} {FibA: Fibrant A} {x y : A} (p : x ≡ y) : x = y := match p with | refl => idpath end. Definition concat {A : Type} {FibA: Fibrant A} {x y z : A} (p : x = y) (q : y = z) : x = z. Proof. ref (@paths_rec A _ y (fun z => x = z) _ (@paths_rec A _ x (fun y => x = y)_ idpath y p) z q). all: ref (FibrantF2_FibrantF _ _ (@paths A _) _ _). Defined. Arguments concat {A FibA x y z} !p !q. Delimit Scope path_scope with path. Open Scope path_scope. Notation "p @ q" := (concat p%path q%path) (at level 20) : path_scope. Notation "p ^" := (inverse p%path) (at level 3, format "p '^'") : path_scope. Notation "1" := idpath : path_scope. Definition transport {A : Type} {FibA: Fibrant A} (P : A -> Type) {FibP: FibrantF P} {x y : A} (p : x = y) (u : P x) : P y := paths_rec x P u y p. Arguments transport {A}%type_scope {FibA} P {FibP} {x y} p%path_scope u : simpl nomatch. Notation "p # x" := (transport _ p x) (right associativity, at level 65, only parsing) : path_scope. Record Contr (A: Type) {FibA: Fibrant A} := { center : A; contr : ∀ x, center = x }. (* ****** destruct_path tactic ****** *) (* auxiliary tactics *) Definition myid : forall A, A -> A := fun _ x => x. Ltac mark H := let t := type of H in change (myid _ t) in H. Ltac unmark H := let t := type of H in match t with | myid _ ?tt => change tt in H end. Hint Unfold myid : typeclass_instances. (* If p : x = y then destruct_path revert all hypothesis depending on x and y. *) (* Then, it applies paths_ind and then it reintroduce reverted hypothesis. *) Ltac destruct_path p := let t := type of p in match t with @paths _ ?x ?y => mark p; repeat match goal with | [X: context[y] |- _] => match type of X with | myid _ _ => fail 1 | _ => revert X; match goal with | |- forall (X: ?T), ?G => change (forall (X: myid _ T), G) end end end; unmark p; generalize y p; clear p y; match goal with | |- forall y p, @?P y p => let y := fresh y in let p := fresh p in intros y p; refine (paths_ind x P _ y p) end; repeat match goal with | |- forall (H: myid _ _), _ => let H := fresh H in intro H; unfold myid in H end end.
chapter \<open>Ordinals, Sequences and Ordinal Recursion\<close> theory Ordinal imports HF begin section \<open>Ordinals\<close> subsection \<open>Basic Definitions\<close> text \<open>Definition 2.1. We say that x is transitive if every element of x is a subset of x.\<close> definition Transset :: "hf \<Rightarrow> bool" where "Transset(x) \<equiv> \<forall>y. y \<^bold>\<in> x \<longrightarrow> y \<le> x" lemma Transset_sup: "Transset x \<Longrightarrow> Transset y \<Longrightarrow> Transset (x \<squnion> y)" by (auto simp: Transset_def) lemma Transset_inf: "Transset x \<Longrightarrow> Transset y \<Longrightarrow> Transset (x \<sqinter> y)" by (auto simp: Transset_def) lemma Transset_hinsert: "Transset x \<Longrightarrow> y \<le> x \<Longrightarrow> Transset (x \<triangleleft> y)" by (auto simp: Transset_def) text \<open>In HF, the ordinals are simply the natural numbers. But the definitions are the same as for transfinite ordinals.\<close> definition Ord :: "hf \<Rightarrow> bool" where "Ord(k) \<equiv> Transset(k) \<and> (\<forall>x \<^bold>\<in> k. Transset(x))" subsection \<open>Definition 2.2 (Successor).\<close> definition succ :: "hf \<Rightarrow> hf" where "succ(x) \<equiv> hinsert x x" lemma succ_iff [simp]: "x \<^bold>\<in> succ y \<longleftrightarrow> x=y \<or> x \<^bold>\<in> y" by (simp add: succ_def) lemma succ_ne_self [simp]: "i \<noteq> succ i" by (metis hmem_ne succ_iff) lemma succ_notin_self: "succ i \<^bold>\<notin> i" by (metis hmem_ne succ_iff) lemma succE [elim?]: assumes "x \<^bold>\<in> succ y" obtains "x=y" | "x \<^bold>\<in> y" by (metis assms succ_iff) lemma hmem_succ_ne: "succ x \<^bold>\<in> y \<Longrightarrow> x \<noteq> y" by (metis hmem_not_refl succ_iff) lemma hball_succ [simp]: "(\<forall>x \<^bold>\<in> succ k. P x) \<longleftrightarrow> P k \<and> (\<forall>x \<^bold>\<in> k. P x)" by (auto simp: HBall_def) lemma hbex_succ [simp]: "(\<exists>x \<^bold>\<in> succ k. P x) \<longleftrightarrow> P k \<or> (\<exists>x \<^bold>\<in> k. P x)" by (auto simp: HBex_def) lemma One_hf_eq_succ: "1 = succ 0" by (metis One_hf_def succ_def) lemma zero_hmem_one [iff]: "x \<^bold>\<in> 1 \<longleftrightarrow> x = 0" by (metis One_hf_eq_succ hmem_hempty succ_iff) lemma hball_One [simp]: "(\<forall>x\<^bold>\<in>1. P x) = P 0" by (simp add: One_hf_eq_succ) lemma hbex_One [simp]: "(\<exists>x\<^bold>\<in>1. P x) = P 0" by (simp add: One_hf_eq_succ) lemma hpair_neq_succ [simp]: "\<langle>x,y\<rangle> \<noteq> succ k" by (auto simp: succ_def hpair_def) (metis hemptyE hmem_hinsert hmem_ne) lemma hpair_neq_one [simp]: "\<langle>x,y\<rangle> \<noteq> 1" by (metis One_hf_eq_succ hpair_neq_succ) lemma one_neq_hpair [simp]: "1 \<noteq> \<langle>x,y\<rangle>" by (metis hpair_neq_one) lemma hmem_succ: "l \<^bold>\<in> k \<Longrightarrow> l \<^bold>\<in> succ k" by (metis succ_iff) text \<open>Theorem 2.3.\<close> lemma Ord_0 [iff]: "Ord 0" by (simp add: Ord_def Transset_def) lemma Ord_succ: "Ord(k) \<Longrightarrow> Ord(succ(k))" by (simp add: Ord_def Transset_def succ_def less_eq_insert2_iff HBall_def) lemma Ord_1 [iff]: "Ord 1" by (metis One_hf_def Ord_0 Ord_succ succ_def) lemma OrdmemD: "Ord(k) \<Longrightarrow> j \<^bold>\<in> k \<Longrightarrow> j \<le> k" by (simp add: Ord_def Transset_def HBall_def) lemma Ord_trans: "\<lbrakk> i\<^bold>\<in>j; j\<^bold>\<in>k; Ord(k) \<rbrakk> \<Longrightarrow> i\<^bold>\<in>k" by (blast dest: OrdmemD) lemma hmem_0_Ord: assumes k: "Ord(k)" and knz: "k \<noteq> 0" shows "0 \<^bold>\<in> k" by (metis foundation [OF knz] Ord_trans hempty_iff hinter_iff k) lemma Ord_in_Ord: "\<lbrakk> Ord(k); m \<^bold>\<in> k \<rbrakk> \<Longrightarrow> Ord(m)" by (auto simp: Ord_def Transset_def) subsection \<open>Induction, Linearity, etc.\<close> lemma Ord_induct [consumes 1, case_names step]: assumes k: "Ord(k)" and step: "\<And>x.\<lbrakk> Ord(x); \<And>y. y \<^bold>\<in> x \<Longrightarrow> P(y) \<rbrakk> \<Longrightarrow> P(x)" shows "P(k)" proof - have "\<forall>m \<^bold>\<in> k. Ord(m) \<longrightarrow> P(m)" proof (induct k rule: hf_induct) case 0 thus ?case by simp next case (hinsert a b) thus ?case by (auto intro: Ord_in_Ord step) qed thus ?thesis using k by (auto intro: Ord_in_Ord step) qed text \<open>Theorem 2.4 (Comparability of ordinals).\<close> lemma Ord_linear: "Ord(k) \<Longrightarrow> Ord(l) \<Longrightarrow> k\<^bold>\<in>l \<or> k=l \<or> l\<^bold>\<in>k" proof (induct k arbitrary: l rule: Ord_induct) case (step k) note step_k = step show ?case using \<open>Ord(l)\<close> proof (induct l rule: Ord_induct) case (step l) thus ?case using step_k by (metis Ord_trans hf_equalityI) qed qed text \<open>The trichotomy law for ordinals\<close> lemma Ord_linear_lt: assumes o: "Ord(k)" "Ord(l)" obtains (lt) "k\<^bold>\<in>l" | (eq) "k=l" | (gt) "l\<^bold>\<in>k" by (metis Ord_linear o) lemma Ord_linear2: assumes o: "Ord(k)" "Ord(l)" obtains (lt) "k\<^bold>\<in>l" | (ge) "l \<le> k" by (metis Ord_linear OrdmemD order_eq_refl o) lemma Ord_linear_le: assumes o: "Ord(k)" "Ord(l)" obtains (le) "k \<le> l" | (ge) "l \<le> k" by (metis Ord_linear2 OrdmemD o) lemma hunion_less_iff [simp]: "\<lbrakk>Ord i; Ord j\<rbrakk> \<Longrightarrow> i \<squnion> j < k \<longleftrightarrow> i<k \<and> j<k" by (metis Ord_linear_le le_iff_sup sup.order_iff sup.strict_boundedE) text \<open>Theorem 2.5\<close> lemma Ord_mem_iff_lt: "Ord(k) \<Longrightarrow> Ord(l) \<Longrightarrow> k\<^bold>\<in>l \<longleftrightarrow> k < l" by (metis Ord_linear OrdmemD hmem_not_refl less_hf_def less_le_not_le) lemma le_succE: "succ i \<le> succ j \<Longrightarrow> i \<le> j" by (simp add: less_eq_hf_def) (metis hmem_not_sym) lemma le_succ_iff: "Ord i \<Longrightarrow> Ord j \<Longrightarrow> succ i \<le> succ j \<longleftrightarrow> i \<le> j" by (metis Ord_linear_le Ord_succ le_succE order_antisym) lemma succ_inject_iff [iff]: "succ i = succ j \<longleftrightarrow> i = j" by (metis succ_def hmem_hinsert hmem_not_sym) lemma mem_succ_iff [simp]: "Ord j \<Longrightarrow> succ i \<^bold>\<in> succ j \<longleftrightarrow> i \<^bold>\<in> j" by (metis Ord_in_Ord Ord_mem_iff_lt Ord_succ succ_def less_eq_insert1_iff less_hf_def succ_iff) lemma Ord_mem_succ_cases: assumes "Ord(k)" "l \<^bold>\<in> k" shows "succ l = k \<or> succ l \<^bold>\<in> k" by (metis assms mem_succ_iff succ_iff) subsection \<open>Supremum and Infimum\<close> lemma Ord_Union [intro,simp]: "\<lbrakk> \<And>i. i\<^bold>\<in>A \<Longrightarrow> Ord(i) \<rbrakk> \<Longrightarrow> Ord(\<Squnion> A)" by (auto simp: Ord_def Transset_def) blast lemma Ord_Inter [intro,simp]: "\<lbrakk> \<And>i. i\<^bold>\<in>A \<Longrightarrow> Ord(i) \<rbrakk> \<Longrightarrow> Ord(\<Sqinter> A)" apply (case_tac "A=0", auto simp: Ord_def Transset_def) apply (force simp add: hf_ext)+ done text \<open>Theorem 2.7. Every set x of ordinals is ordered by the binary relation <. Moreover if x = 0 then x has a smallest and a largest element.\<close> lemma hmem_Sup_Ords: "\<lbrakk>A\<noteq>0; \<And>i. i\<^bold>\<in>A \<Longrightarrow> Ord(i)\<rbrakk> \<Longrightarrow> \<Squnion>A \<^bold>\<in> A" proof (induction A rule: hf_induct) case 0 thus ?case by simp next case (hinsert x A) show ?case proof (cases A rule: hf_cases) case 0 thus ?thesis by simp next case (hinsert y A') hence UA: "\<Squnion>A \<^bold>\<in> A" by (metis hinsert.IH(2) hinsert.prems(2) hinsert_nonempty hmem_hinsert) hence "\<Squnion>A \<le> x \<or> x \<le> \<Squnion>A" by (metis Ord_linear2 OrdmemD hinsert.prems(2) hmem_hinsert) thus ?thesis by (metis HUnion_hinsert UA le_iff_sup less_eq_insert1_iff order_refl sup.commute) qed qed lemma hmem_Inf_Ords: "\<lbrakk>A\<noteq>0; \<And>i. i\<^bold>\<in>A \<Longrightarrow> Ord(i)\<rbrakk> \<Longrightarrow> \<Sqinter>A \<^bold>\<in> A" proof (induction A rule: hf_induct) case 0 thus ?case by simp next case (hinsert x A) show ?case proof (cases A rule: hf_cases) case 0 thus ?thesis by auto next case (hinsert y A') hence IA: "\<Sqinter>A \<^bold>\<in> A" by (metis hinsert.IH(2) hinsert.prems(2) hinsert_nonempty hmem_hinsert) hence "\<Sqinter>A \<le> x \<or> x \<le> \<Sqinter>A" by (metis Ord_linear2 OrdmemD hinsert.prems(2) hmem_hinsert) thus ?thesis by (metis HInter_hinsert IA hmem_hempty hmem_hinsert inf_absorb2 le_iff_inf) qed qed lemma Ord_pred: "\<lbrakk>Ord(k); k \<noteq> 0\<rbrakk> \<Longrightarrow> succ(\<Squnion>k) = k" by (metis (full_types) HUnion_iff Ord_in_Ord Ord_mem_succ_cases hmem_Sup_Ords hmem_ne succ_iff) lemma Ord_cases [cases type: hf, case_names 0 succ]: assumes Ok: "Ord(k)" obtains "k = 0" | l where "Ord l" "succ l = k" by (metis Ok Ord_in_Ord Ord_pred succ_iff) lemma Ord_induct2 [consumes 1, case_names 0 succ, induct type: hf]: assumes k: "Ord(k)" and P: "P 0" "\<And>k. Ord k \<Longrightarrow> P k \<Longrightarrow> P (succ k)" shows "P k" using k proof (induction k rule: Ord_induct) case (step k) thus ?case by (metis Ord_cases P hmem_succ_self) qed lemma Ord_succ_iff [iff]: "Ord (succ k) = Ord k" by (metis Ord_in_Ord Ord_succ less_eq_insert1_iff order_refl succ_def) lemma Ord_Sup_succ_eq [simp]: "Ord k \<Longrightarrow> \<Squnion>(succ k) = k" by (metis Ord_pred Ord_succ_iff succ_inject_iff hinsert_nonempty succ_def) lemma Ord_lt_succ_iff_le: "Ord k \<Longrightarrow> Ord l \<Longrightarrow> k < succ l \<longleftrightarrow> k \<le> l" by (metis Ord_mem_iff_lt Ord_succ_iff less_le_not_le order_eq_iff succ_iff) lemma zero_in_Ord: "Ord k \<Longrightarrow> k=0 \<or> 0 \<^bold>\<in> k" by (induct k) auto lemma hpair_neq_Ord: "Ord k \<Longrightarrow> \<langle>x,y\<rangle> \<noteq> k" by (cases k) auto lemma hpair_neq_Ord': assumes k: "Ord k" shows "k \<noteq> \<langle>x,y\<rangle>" by (metis k hpair_neq_Ord) lemma Not_Ord_hpair [iff]: "\<not> Ord \<langle>x,y\<rangle>" by (metis hpair_neq_Ord) lemma is_hpair [simp]: "is_hpair \<langle>x,y\<rangle>" by (force simp add: is_hpair_def) lemma Ord_not_hpair: "Ord x \<Longrightarrow> \<not> is_hpair x" by (metis Not_Ord_hpair is_hpair_def) lemma zero_in_succ [simp,intro]: "Ord i \<Longrightarrow> 0 \<^bold>\<in> succ i" by (metis succ_iff zero_in_Ord) subsection \<open>Converting Between Ordinals and Natural Numbers\<close> fun ord_of :: "nat \<Rightarrow> hf" where "ord_of 0 = 0" | "ord_of (Suc k) = succ (ord_of k)" lemma Ord_ord_of [simp]: "Ord (ord_of k)" by (induct k, auto) lemma ord_of_inject [iff]: "ord_of i = ord_of j \<longleftrightarrow> i=j" proof (induct i arbitrary: j) case 0 show ?case by (metis Zero_neq_Suc hempty_iff hmem_succ_self ord_of.elims) next case (Suc i) show ?case by (cases j) (auto simp: Suc) qed lemma ord_of_minus_1: "n > 0 \<Longrightarrow> ord_of n = succ (ord_of (n - 1))" by (metis Suc_diff_1 ord_of.simps(2)) definition nat_of_ord :: "hf \<Rightarrow> nat" where "nat_of_ord x = (THE n. x = ord_of n)" lemma nat_of_ord_ord_of [simp]: "nat_of_ord (ord_of n) = n" by (auto simp: nat_of_ord_def) lemma nat_of_ord_0 [simp]: "nat_of_ord 0 = 0" by (metis (mono_tags) nat_of_ord_ord_of ord_of.simps(1)) lemma ord_of_nat_of_ord [simp]: "Ord x \<Longrightarrow> ord_of (nat_of_ord x) = x" apply (erule Ord_induct2, simp) apply (metis nat_of_ord_ord_of ord_of.simps(2)) done lemma nat_of_ord_inject: "Ord x \<Longrightarrow> Ord y \<Longrightarrow> nat_of_ord x = nat_of_ord y \<longleftrightarrow> x = y" by (metis ord_of_nat_of_ord) lemma nat_of_ord_succ [simp]: "Ord x \<Longrightarrow> nat_of_ord (succ x) = Suc (nat_of_ord x)" by (metis nat_of_ord_ord_of ord_of.simps(2) ord_of_nat_of_ord) lemma inj_ord_of: "inj_on ord_of A" by (simp add: inj_on_def) lemma hfset_ord_of: "hfset (ord_of n) = ord_of ` {0..<n}" by (induct n) (auto simp: hfset_hinsert succ_def) lemma bij_betw_ord_of: "bij_betw ord_of {0..<n} (hfset (ord_of n))" by (simp add: bij_betw_def inj_ord_of hfset_ord_of) lemma bij_betw_ord_ofI: "bij_betw h A {0..<n} \<Longrightarrow> bij_betw (ord_of \<circ> h) A (hfset (ord_of n))" by (blast intro: bij_betw_ord_of bij_betw_trans) section \<open>Sequences and Ordinal Recursion\<close> text \<open>Definition 3.2 (Sequence).\<close> definition Seq :: "hf \<Rightarrow> hf \<Rightarrow> bool" where "Seq s k \<longleftrightarrow> hrelation s \<and> hfunction s \<and> k \<le> hdomain s" lemma Seq_0 [iff]: "Seq 0 0" by (auto simp: Seq_def hrelation_def hfunction_def) lemma Seq_succ_D: "Seq s (succ k) \<Longrightarrow> Seq s k" by (simp add: Seq_def succ_def) lemma Seq_Ord_D: "Seq s k \<Longrightarrow> l \<^bold>\<in> k \<Longrightarrow> Ord k \<Longrightarrow> Seq s l" by (auto simp: Seq_def intro: Ord_trans) lemma Seq_restr: "Seq s (succ k) \<Longrightarrow> Seq (hrestrict s k) k" by (simp add: Seq_def hfunction_restr succ_def) lemma Seq_Ord_restr: "\<lbrakk>Seq s k; l \<^bold>\<in> k; Ord k\<rbrakk> \<Longrightarrow> Seq (hrestrict s l) l" by (auto simp: Seq_def hfunction_restr intro: Ord_trans) lemma Seq_ins: "\<lbrakk>Seq s k; k \<^bold>\<notin> hdomain s\<rbrakk> \<Longrightarrow> Seq (s \<triangleleft> \<langle>k, y\<rangle>) (succ k)" by (auto simp: Seq_def hrelation_def succ_def hfunction_def hdomainI) definition insf :: "hf \<Rightarrow> hf \<Rightarrow> hf \<Rightarrow> hf" where "insf s k y \<equiv> nonrestrict s \<lbrace>k\<rbrace> \<triangleleft> \<langle>k, y\<rangle>" lemma hfunction_insf: "hfunction s \<Longrightarrow> hfunction (insf s k y)" by (auto simp: insf_def hfunction_def nonrestrict_def hmem_not_refl) lemma Seq_succ_iff: "Seq s (succ k) \<longleftrightarrow> Seq s k \<and> (\<exists>y. \<langle>k, y\<rangle> \<^bold>\<in> s)" apply (auto simp: Seq_def hdomain_def) apply (metis hfst_conv, blast) done lemma nonrestrictD: "a \<^bold>\<in> nonrestrict s X \<Longrightarrow> a \<^bold>\<in> s" by (auto simp: nonrestrict_def) lemma hpair_in_nonrestrict_iff [simp]: "\<langle>a,b\<rangle> \<^bold>\<in> nonrestrict s X \<longleftrightarrow> \<langle>a,b\<rangle> \<^bold>\<in> s \<and> \<not> a \<^bold>\<in> X" by (auto simp: nonrestrict_def) lemma app_nonrestrict_Seq: "Seq s k \<Longrightarrow> z \<^bold>\<notin> X \<Longrightarrow> app (nonrestrict s X) z = app s z" by (auto simp: Seq_def nonrestrict_def app_def HBall_def) (metis) lemma app_insf_Seq: "Seq s k \<Longrightarrow> app (insf s k y) k = y" by (metis Seq_def hfunction_insf app_equality hmem_hinsert insf_def) lemma app_insf2_Seq: "Seq s k \<Longrightarrow> k' \<noteq> k \<Longrightarrow> app (insf s k y) k' = app s k'" by (simp add: app_nonrestrict_Seq insf_def app_ins2) lemma app_insf_Seq_if: "Seq s k \<Longrightarrow> app (insf s k y) k' = (if k' = k then y else app s k')" by (metis app_insf2_Seq app_insf_Seq) lemma Seq_imp_eq_app: "\<lbrakk>Seq s d; \<langle>x,y\<rangle> \<^bold>\<in> s\<rbrakk> \<Longrightarrow> app s x = y" by (metis Seq_def app_equality) lemma Seq_iff_app: "\<lbrakk>Seq s d; x \<^bold>\<in> d\<rbrakk> \<Longrightarrow> \<langle>x,y\<rangle> \<^bold>\<in> s \<longleftrightarrow> app s x = y" by (auto simp: Seq_def hdomain_def app_equality) lemma Exists_iff_app: "Seq s d \<Longrightarrow> x \<^bold>\<in> d \<Longrightarrow> (\<exists>y. \<langle>x, y\<rangle> \<^bold>\<in> s \<and> P y) = P (app s x)" by (metis Seq_iff_app) definition ord_rec_Seq :: "hf \<Rightarrow> (hf \<Rightarrow> hf) \<Rightarrow> hf \<Rightarrow> hf \<Rightarrow> hf \<Rightarrow> bool" where "ord_rec_Seq T G s k y \<longleftrightarrow> (Seq s k \<and> y = G (app s (\<Squnion>k)) \<and> app s 0 = T \<and> (\<forall>n. succ n \<^bold>\<in> k \<longrightarrow> app s (succ n) = G (app s n)))" lemma Seq_succ_insf: assumes s: "Seq s (succ k)" shows "\<exists> y. s = insf s k y" proof - obtain y where y: "\<langle>k, y\<rangle> \<^bold>\<in> s" by (metis Seq_succ_iff s) hence yuniq: "\<forall> y'. \<langle>k, y'\<rangle> \<^bold>\<in> s \<longrightarrow> y' = y" using s by (simp add: Seq_def hfunction_def) { fix z assume z: "z \<^bold>\<in> s" then obtain u v where uv: "z = \<langle>u, v\<rangle>" using s by (metis Seq_def hrelation_def is_hpair_def) hence "z \<^bold>\<in> insf s k y" by (metis hemptyE hmem_hinsert hpair_in_nonrestrict_iff insf_def yuniq z) } note left2right = this show ?thesis proof show "s = insf s k y" by (rule hf_equalityI) (metis hmem_hinsert insf_def left2right nonrestrictD y) qed qed lemma ord_rec_Seq_succ_iff: assumes k: "Ord k" and knz: "k \<noteq> 0" shows "ord_rec_Seq T G s (succ k) z \<longleftrightarrow> (\<exists> s' y. ord_rec_Seq T G s' k y \<and> z = G y \<and> s = insf s' k y)" proof assume os: "ord_rec_Seq T G s (succ k) z" show "\<exists>s' y. ord_rec_Seq T G s' k y \<and> z = G y \<and> s = insf s' k y" apply (rule_tac x=s in exI) using os k knz apply (auto simp: Seq_insf ord_rec_Seq_def app_insf_Seq app_insf2_Seq hmem_succ_ne hmem_ne hmem_Sup_ne Seq_succ_iff hmem_0_Ord) apply (metis Ord_pred) apply (metis Ord_pred Seq_succ_iff Seq_succ_insf app_insf_Seq) done next assume ok: "\<exists>s' y. ord_rec_Seq T G s' k y \<and> z = G y \<and> s = insf s' k y" thus "ord_rec_Seq T G s (succ k) z" using ok k knz by (auto simp: ord_rec_Seq_def app_insf_Seq_if hmem_ne hmem_succ_ne Seq_insf) qed lemma ord_rec_Seq_functional: "Ord k \<Longrightarrow> k \<noteq> 0 \<Longrightarrow> ord_rec_Seq T G s k y \<Longrightarrow> ord_rec_Seq T G s' k y' \<Longrightarrow> y' = y" proof (induct k arbitrary: y y' s s' rule: Ord_induct2) case 0 thus ?case by (simp add: ord_rec_Seq_def) next case (succ k) show ?case proof (cases "k=0") case True thus ?thesis using succ by (auto simp: ord_rec_Seq_def) next case False thus ?thesis using succ by (auto simp: ord_rec_Seq_succ_iff) qed qed definition ord_recp :: "hf \<Rightarrow> (hf \<Rightarrow> hf) \<Rightarrow> (hf \<Rightarrow> hf) \<Rightarrow> hf \<Rightarrow> hf \<Rightarrow> bool" where "ord_recp T G H x y = (if x=0 then y = T else if Ord(x) then \<exists> s. ord_rec_Seq T G s x y else y = H x)" lemma ord_recp_functional: "ord_recp T G H x y \<Longrightarrow> ord_recp T G H x y' \<Longrightarrow> y' = y" by (auto simp: ord_recp_def ord_rec_Seq_functional split: if_split_asm) lemma ord_recp_succ_iff: assumes k: "Ord k" shows "ord_recp T G H (succ k) z \<longleftrightarrow> (\<exists>y. z = G y \<and> ord_recp T G H k y)" proof (cases "k=0") case True thus ?thesis by (simp add: ord_recp_def ord_rec_Seq_def) (metis Seq_0 Seq_insf app_insf_Seq) next case False thus ?thesis using k by (auto simp: ord_recp_def ord_rec_Seq_succ_iff) qed definition ord_rec :: "hf \<Rightarrow> (hf \<Rightarrow> hf) \<Rightarrow> (hf \<Rightarrow> hf) \<Rightarrow> hf \<Rightarrow> hf" where "ord_rec T G H x = (THE y. ord_recp T G H x y)" lemma ord_rec_0 [simp]: "ord_rec T G H 0 = T" by (simp add: ord_recp_def ord_rec_def) lemma ord_recp_total: "\<exists>y. ord_recp T G H x y" proof (cases "Ord x") case True thus ?thesis proof (induct x rule: Ord_induct2) case 0 thus ?case by (simp add: ord_recp_def) next case (succ x) thus ?case by (metis ord_recp_succ_iff) qed next case False thus ?thesis by (auto simp: ord_recp_def) qed lemma ord_rec_succ [simp]: assumes k: "Ord k" shows "ord_rec T G H (succ k) = G (ord_rec T G H k)" proof - from ord_recp_total [of T G H k] obtain y where "ord_recp T G H k y" by auto thus ?thesis using k apply (simp add: ord_rec_def ord_recp_succ_iff) apply (rule theI2) apply (auto dest: ord_recp_functional) done qed lemma ord_rec_non [simp]: "\<not> Ord x \<Longrightarrow> ord_rec T G H x = H x" by (metis Ord_0 ord_rec_def ord_recp_def the_equality) end
State Before: α : Type u_1 inst✝ : PseudoMetricSpace α f : ℕ → α a : α h : Summable fun n => dist (f n) (f (Nat.succ n)) ha : Tendsto f atTop (𝓝 a) ⊢ dist (f 0) a ≤ ∑' (n : ℕ), dist (f n) (f (Nat.succ n)) State After: no goals Tactic: simpa only [zero_add] using dist_le_tsum_dist_of_tendsto h ha 0
### A Pluto.jl notebook ### # v0.11.2 using Markdown using InteractiveUtils # ╔═╡ 72047c34-de27-11ea-130a-e3b966b70dc3 # ╔═╡ f46abde2-db15-11ea-29fd-3d503b825cf1 area = sqrt(6*(6 - 4)*(6 - 5)*(6 - 3)) # ╔═╡ 6e954fd6-db16-11ea-2d62-8f66f6de8fdb function classic_triangle_area(base, height) return (base*height)/2 end # ╔═╡ beb7c8b0-db16-11ea-0656-85d886a2faf3 classic_triangle_area(4.0, 3.0) # ╔═╡ Cell order: # ╠═f46abde2-db15-11ea-29fd-3d503b825cf1 # ╠═6e954fd6-db16-11ea-2d62-8f66f6de8fdb # ╠═beb7c8b0-db16-11ea-0656-85d886a2faf3 # ╠═72047c34-de27-11ea-130a-e3b966b70dc3
{-# OPTIONS --without-K #-} module hott.topology.spaces.s1 where open import hott.core -- The universe where we work. 𝒰 = Type₀ module Definition where private data SInternal : 𝒰 where pointInternal : SInternal S₁ : 𝒰 S₁ = SInternal point : S₁ point = pointInternal postulate loop : point ≡ point -- the induction principle for s₁ ind-S₁ : {ℓ : Level}{B : S₁ → Type ℓ} → (b : B point) → (b ≡ b) → (x : S₁) → B x ind-S₁ b x pointInternal = b open Definition
http://www.tuxedomoon.org the motherload of images, soundclips, video samples, concert and sales info, in english and italian. http://www.berlinwerk.de/tuxedomoon Excellent organization of discography and pertinent links. http://www.crammed.be Official recordings on review and for sale. Concert info. And all things crammed. http://www.ninerain.com Official site of Steven Brown's group NINERAIN. http://www.neoacustica.spb.ru In english and russian, this site is an independent record company based in St. Petersburg with lots of interesting spin-offs from the Tuxedomoon members. Not only are the range of products impressive, but their packaging is a beautiful thing to behold. The new NINERAIN cd (with Steven Brown), the new MICRODOT cd (Luc Van Leishut & Bruce Gedildug) and a double live album from TUXEDOMOON's recent concerts in Russia are each one in it's way, a fabregé egg. [email protected] for TUXEDOMOON & NINERAIN concert bookings. Early version of a menu graphic for the DVD. Version original d'un menu pour le DVD.
theory Proof_1_7 imports HandDryer VCTheoryLemmas Extra begin theorem proof_1_7: "VC7 inv1 s0 hands_value" apply(simp only: VC7_def inv1_def R1_def dryer_def) apply(rule impI; rule conjI) proof - print_state assume VC: " ((toEnvP s0 \<and> (\<forall>s1 s2. substate s1 s2 \<and> substate s2 s0 \<and> toEnvP s1 \<and> toEnvP s2 \<and> toEnvNum s1 s2 = hands \<and> getVarBool s1 hands = OFF \<and> getVarBool s1 (Suc (Suc 0)) = OFF \<and> getVarBool s2 hands = ON \<longrightarrow> (\<exists>s4. toEnvP s4 \<and> substate s2 s4 \<and> substate s4 s0 \<and> toEnvNum s2 s4 \<le> hands \<and> getVarBool s4 (Suc (Suc 0)) = ON \<and> (\<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s4 \<and> s3 \<noteq> s4 \<longrightarrow> getVarBool s3 hands = ON)))) \<and> extraInv s0) \<and> env (setVarAny s0 hands_value) hands_value \<and> getPstate (setVarAny s0 hands_value) Ctrl = drying \<and> getVarBool (setVarAny s0 hands_value) hands \<noteq> ON \<and> \<not> 10 \<le> ltimeEnv (setVarAny s0 hands_value) Ctrl" show " toEnvP (toEnv (setVarAny s0 hands_value)) \<and> (\<forall>s1 s2. substate s1 s2 \<and> substate s2 (toEnv (setVarAny s0 hands_value)) \<and> toEnvP s1 \<and> toEnvP s2 \<and> toEnvNum s1 s2 = hands \<and> getVarBool s1 hands = OFF \<and> getVarBool s1 (Suc (Suc 0)) = OFF \<and> getVarBool s2 hands = ON \<longrightarrow> (\<exists>s4. toEnvP s4 \<and> substate s2 s4 \<and> substate s4 (toEnv (setVarAny s0 hands_value)) \<and> toEnvNum s2 s4 \<le> hands \<and> getVarBool s4 (Suc (Suc 0)) = ON \<and> (\<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s4 \<and> s3 \<noteq> s4 \<longrightarrow> getVarBool s3 hands = ON)))" apply(rule conjI) apply(simp) proof(rule allI; rule allI; rule impI) fix s1 s2 assume req_prems: " substate s1 s2 \<and> substate s2 (toEnv (setVarAny s0 hands_value)) \<and> toEnvP s1 \<and> toEnvP s2 \<and> toEnvNum s1 s2 = hands \<and> getVarBool s1 hands = OFF \<and> getVarBool s1 (Suc (Suc 0)) = OFF \<and> getVarBool s2 hands = ON " show " \<exists>s4. toEnvP s4 \<and> substate s2 s4 \<and> substate s4 (toEnv (setVarAny s0 hands_value)) \<and> toEnvNum s2 s4 \<le> hands \<and> getVarBool s4 (Suc (Suc 0)) = ON \<and> (\<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s4 \<and> s3 \<noteq> s4 \<longrightarrow> getVarBool s3 hands = ON)" proof cases assume 1: "s2 = (toEnv (setVarAny s0 hands_value))" have " (toEnvP s2 \<and> substate s2 s2 \<and> substate s2 (toEnv (setVarAny s0 hands_value)) \<and> toEnvNum s2 s2 \<le> hands \<and> getVarBool s2 (Suc (Suc 0)) = ON) \<and> (\<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s2 \<and> s3 \<noteq> s2 \<longrightarrow> getVarBool s3 hands = ON)" proof from 1 VC req_prems show "toEnvP s2 \<and> substate s2 s2 \<and> substate s2 (toEnv (setVarAny s0 hands_value)) \<and> toEnvNum s2 s2 \<le> hands \<and> getVarBool s2 (Suc (Suc 0)) = ON" by auto next from substate_asym show " \<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s2 \<and> s3 \<noteq> s2 \<longrightarrow> getVarBool s3 hands = ON" by auto qed thus ?thesis by blast next assume 1: "s2 \<noteq> (toEnv (setVarAny s0 hands_value))" with req_prems have 2: "substate s2 s0" by (simp split: if_splits) from VC req_prems 2 obtain "\<exists>s4. toEnvP s4 \<and> substate s2 s4 \<and> substate s4 s0 \<and> toEnvNum s2 s4 \<le> hands \<and> getVarBool s4 (Suc (Suc 0)) = ON \<and> (\<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s4 \<and> s3 \<noteq> s4 \<longrightarrow> getVarBool s3 hands = ON)"by auto then obtain s4 where 3: "toEnvP s4 \<and> substate s2 s4 \<and> substate s4 s0 \<and> toEnvNum s2 s4 \<le> hands \<and> getVarBool s4 (Suc (Suc 0)) = ON \<and> (\<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s4 \<and> s3 \<noteq> s4 \<longrightarrow> getVarBool s3 hands = ON)" .. have "toEnvP s4 \<and> substate s2 s4 \<and> substate s4 (toEnv (setVarAny s0 hands_value)) \<and> toEnvNum s2 s4 \<le> hands \<and> getVarBool s4 (Suc (Suc 0)) = ON \<and> (\<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s4 \<and> s3 \<noteq> s4 \<longrightarrow> getVarBool s3 hands = ON)" using 3 by auto thus ?thesis .. qed qed next assume VC: "((toEnvP s0 \<and> (\<forall>s1 s2. substate s1 s2 \<and> substate s2 s0 \<and> toEnvP s1 \<and> toEnvP s2 \<and> toEnvNum s1 s2 = hands \<and> getVarBool s1 hands = OFF \<and> getVarBool s1 (Suc (Suc 0)) = OFF \<and> getVarBool s2 hands = ON \<longrightarrow> (\<exists>s4. toEnvP s4 \<and> substate s2 s4 \<and> substate s4 s0 \<and> toEnvNum s2 s4 \<le> hands \<and> getVarBool s4 (Suc (Suc 0)) = ON \<and> (\<forall>s3. toEnvP s3 \<and> substate s2 s3 \<and> substate s3 s4 \<and> s3 \<noteq> s4 \<longrightarrow> getVarBool s3 hands = ON)))) \<and> extraInv s0) \<and> env (setVarAny s0 hands_value) hands_value \<and> getPstate (setVarAny s0 hands_value) Ctrl = drying \<and> getVarBool (setVarAny s0 hands_value) hands \<noteq> ON \<and> \<not> 10 \<le> ltimeEnv (setVarAny s0 hands_value) Ctrl" with extra7 show "extraInv (toEnv (setVarAny s0 hands_value))" by (auto simp add: VC7_def) qed end
structure X := ( a : Type ) definition x : X := { a := unit } definition y : X := { a := unit } lemma t : x^.a = unit := begin dsimp [ y ], dsimp [ x ], refl end
% !TeX root = ../../main.tex % !TEX spellcheck = en_GB \section{Design} \label{ch:Design} \fxnote{Detailed diagram. Discussion of issues and thoughts on how they have been solved/will influence the system.} \FloatBarrier
lemmas continuous_on_of_real [continuous_intros] = bounded_linear.continuous_on [OF bounded_linear_of_real]
import data.nat.prime open nat theorem exists_infinite_primes : ∀ n : ℕ, ∃ p, p ≥ n ∧ prime p := λ n, let p := min_fac (fact n + 1) in have fp : fact n > 0 := fact_pos n, have f1 : fact n + 1 ≠ 1, from ne_of_gt $ succ_lt_succ $ fact_pos n, have pp : prime p, from min_fac_prime f1, have w : n ≤ p, from le_of_not_ge $ λ h, have h₁ : p ∣ fact n, from dvd_fact (min_fac_pos (fact n + 1)) h, have h₂ : p ∣ 1, from (nat.dvd_add_iff_right h₁).2 (min_fac_dvd (fact n + 1)), pp.not_dvd_one h₂, ⟨p, w, pp⟩
State Before: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q ⊢ (a ^ q + b ^ q) ^ (1 / q) ≤ (a ^ p + b ^ p) ^ (1 / p) State After: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) ⊢ (a ^ q + b ^ q) ^ (1 / q) ≤ (a ^ p + b ^ p) ^ (1 / p) Tactic: have h_rpow : ∀ a : ℝ≥0, a ^ q = (a ^ p) ^ (q / p) := fun a => by rw [← NNReal.rpow_mul, _root_.div_eq_inv_mul, ← mul_assoc, _root_.mul_inv_cancel hp_pos.ne.symm, one_mul] State Before: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) ⊢ (a ^ q + b ^ q) ^ (1 / q) ≤ (a ^ p + b ^ p) ^ (1 / p) State After: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) h_rpow_add_rpow_le_add : ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (1 / (q / p)) ≤ a ^ p + b ^ p ⊢ (a ^ q + b ^ q) ^ (1 / q) ≤ (a ^ p + b ^ p) ^ (1 / p) Tactic: have h_rpow_add_rpow_le_add : ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (1 / (q / p)) ≤ a ^ p + b ^ p := by refine' rpow_add_rpow_le_add (a ^ p) (b ^ p) _ rwa [one_le_div hp_pos] State Before: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) h_rpow_add_rpow_le_add : ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (1 / (q / p)) ≤ a ^ p + b ^ p ⊢ (a ^ q + b ^ q) ^ (1 / q) ≤ (a ^ p + b ^ p) ^ (1 / p) State After: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) h_rpow_add_rpow_le_add : ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (1 / (q / p)) ≤ a ^ p + b ^ p ⊢ ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (p / q) ≤ a ^ p + b ^ p Tactic: rw [h_rpow a, h_rpow b, NNReal.le_rpow_one_div_iff hp_pos, ← NNReal.rpow_mul, mul_comm, mul_one_div] State Before: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) h_rpow_add_rpow_le_add : ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (1 / (q / p)) ≤ a ^ p + b ^ p ⊢ ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (p / q) ≤ a ^ p + b ^ p State After: no goals Tactic: rwa [one_div_div] at h_rpow_add_rpow_le_add State Before: ι : Type u s : Finset ι p q : ℝ a✝ b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q a : ℝ≥0 ⊢ a ^ q = (a ^ p) ^ (q / p) State After: no goals Tactic: rw [← NNReal.rpow_mul, _root_.div_eq_inv_mul, ← mul_assoc, _root_.mul_inv_cancel hp_pos.ne.symm, one_mul] State Before: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) ⊢ ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (1 / (q / p)) ≤ a ^ p + b ^ p State After: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) ⊢ 1 ≤ q / p Tactic: refine' rpow_add_rpow_le_add (a ^ p) (b ^ p) _ State Before: ι : Type u s : Finset ι p q : ℝ a b : ℝ≥0 hp_pos : 0 < p hpq : p ≤ q h_rpow : ∀ (a : ℝ≥0), a ^ q = (a ^ p) ^ (q / p) ⊢ 1 ≤ q / p State After: no goals Tactic: rwa [one_le_div hp_pos]
------------------------------------------------------------------------------ -- Fair properties ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Program.ABP.Fair.PropertiesI where open import Common.FOL.Relation.Binary.EqReasoning open import FOTC.Base open import FOTC.Base.List open import FOTC.Base.List.PropertiesI open import FOTC.Data.List open import FOTC.Data.List.PropertiesI open import FOTC.Data.Stream.Type open import FOTC.Program.ABP.Fair.Type open import FOTC.Program.ABP.Terms ------------------------------------------------------------------------------ -- Because a greatest post-fixed point is a fixed-point, then the Fair -- predicate is also a pre-fixed point of the functional FairF, i.e. -- -- FairF Fair ≤ Fair (see FOTC.Program.ABP.Fair). Fair-in : ∀ {os} → ∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ Fair os' → Fair os Fair-in h = Fair-coind A h' h where A : D → Set A os = ∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ Fair os' h' : ∀ {os} → A os → ∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ A os' h' (ft , os' , FTft , prf , Fos') = ft , os' , FTft , prf , Fair-out Fos' head-tail-Fair : ∀ {os} → Fair os → os ≡ T ∷ tail₁ os ∨ os ≡ F ∷ tail₁ os head-tail-Fair {os} Fos with Fair-out Fos ... | .(T ∷ []) , os' , f*tnil , h , Fos' = inj₁ prf₃ where prf₁ : os ≡ T ∷ [] ++ os' prf₁ = os ≡⟨ h ⟩ (T ∷ []) ++ os' ≡⟨ ++-∷ T [] os' ⟩ T ∷ [] ++ os' ∎ prf₂ : tail₁ os ≡ [] ++ os' prf₂ = tail₁ os ≡⟨ tailCong prf₁ ⟩ tail₁ (T ∷ [] ++ os') ≡⟨ tail-∷ T ([] ++ os') ⟩ [] ++ os' ∎ prf₃ : os ≡ T ∷ tail₁ os prf₃ = os ≡⟨ prf₁ ⟩ T ∷ [] ++ os' ≡⟨ ∷-rightCong (sym prf₂) ⟩ T ∷ tail₁ os ∎ ... | .(F ∷ ft) , os' , f*tcons {ft} FTft , h , Fos' = inj₂ prf₃ where prf₁ : os ≡ F ∷ ft ++ os' prf₁ = os ≡⟨ h ⟩ (F ∷ ft) ++ os' ≡⟨ ++-∷ F ft os' ⟩ F ∷ ft ++ os' ∎ prf₂ : tail₁ os ≡ ft ++ os' prf₂ = tail₁ os ≡⟨ tailCong prf₁ ⟩ tail₁ (F ∷ ft ++ os') ≡⟨ tail-∷ F (ft ++ os') ⟩ ft ++ os' ∎ prf₃ : os ≡ F ∷ tail₁ os prf₃ = os ≡⟨ prf₁ ⟩ F ∷ ft ++ os' ≡⟨ ∷-rightCong (sym prf₂) ⟩ F ∷ tail₁ os ∎ tail-Fair : ∀ {os} → Fair os → Fair (tail₁ os) tail-Fair {os} Fos with Fair-out Fos ... | .(T ∷ []) , os' , f*tnil , h , Fos' = subst Fair (sym prf₂) Fos' where prf₁ : os ≡ T ∷ os' prf₁ = os ≡⟨ h ⟩ (T ∷ []) ++ os' ≡⟨ ++-∷ T [] os' ⟩ T ∷ [] ++ os' ≡⟨ ∷-rightCong (++-leftIdentity os') ⟩ T ∷ os' ∎ prf₂ : tail₁ os ≡ os' prf₂ = tail₁ os ≡⟨ tailCong prf₁ ⟩ tail₁ (T ∷ os') ≡⟨ tail-∷ T os' ⟩ os' ∎ ... | .(F ∷ ft) , os' , f*tcons {ft} FTft , h , Fos' = subst Fair (sym prf₂) (Fair-in (ft , os' , FTft , refl , Fos')) where prf₁ : os ≡ F ∷ ft ++ os' prf₁ = os ≡⟨ h ⟩ (F ∷ ft) ++ os' ≡⟨ ++-∷ F ft os' ⟩ F ∷ ft ++ os' ∎ prf₂ : tail₁ os ≡ ft ++ os' prf₂ = tail₁ os ≡⟨ tailCong prf₁ ⟩ tail₁ (F ∷ ft ++ os') ≡⟨ tail-∷ F (ft ++ os') ⟩ ft ++ os' ∎ Fair→Stream : ∀ {os} → Fair os → Stream os Fair→Stream Fos = Stream-coind A h Fos where A : D → Set A xs = Fair xs h : ∀ {os} → A os → ∃[ o' ] ∃[ os' ] os ≡ o' ∷ os' ∧ A os' h {os} As with head-tail-Fair As ... | inj₁ prf = T , tail₁ os , prf , tail-Fair As ... | inj₂ prf = F , tail₁ os , prf , tail-Fair As F*T→List : ∀ {xs} → F*T xs → List xs F*T→List f*tnil = lcons T lnil F*T→List (f*tcons {ft} FTft) = lcons F (F*T→List FTft)
import divisibility1 import data.nat.prime import data.int.gcd import data.nat.modeq import data.int.modeq import data.zmod.basic lemma int_dvd_cancel ( a b c: ℤ ) (h: int.gcd a b =1): a ∣ b*c → a ∣ c:= begin intro h1, rw ← int.nat_abs_dvd_abs_iff at *, rw int.nat_abs_mul at h1, apply nat.coprime.dvd_of_dvd_mul_left, apply h, assumption, end lemma luc_cancel_2 (k: ℕ ) (b: ℤ) (x: 2 ∣ k) (x1: k%3 ≠ 0 ): (luc (k): ℤ ) ∣ 2* b → (luc k :ℤ) ∣ b:= begin have h1: nat.coprime (luc k) 2, {apply nat.coprime.symm, rw nat.prime.coprime_iff_not_dvd, {rw nat.dvd_iff_mod_eq_zero, rw luc_even, assumption}, {exact nat.prime_two}}, {apply int_dvd_cancel, assumption} end lemma fib_2k (k: ℕ ): fib(2*k) = fib k * luc k:= begin have h1: 2* fib (2*k) = 2*(fib k * luc k), {rw [show 2*k =k+k, by ring], rw fib_luc1, ring}, {linarith} end lemma even_or_odd (n: ℕ ): ∃ (w: ℕ ), n=2*w ∨ n=2*w+1:= begin induction n with d hd, {use 0, simp}, {cases hd with w hd, cases hd with hx hy, {use w, right, simp *}, {use (w+1), left, rw hy, ring}} end lemma neg_1_pow_even (k: ℕ ) (h: 2 ∣ k): (-1: ℤ )^k=1:= begin cases h with u v, rw v, rw pow_mul, simp end lemma neg_1_pow_odd (u: ℕ ) : (-1: ℤ )^(2*u+1)=-1:= begin rw pow_add, rw neg_1_pow_even, {ring}, {use u} end lemma luc_2k (k: ℕ )(h: 2 ∣ k) : (luc k)^2 = luc(2*k)+2:= begin apply int.coe_nat_inj, push_cast, rw ← fib_luc3, rw neg_1_pow_even _ h, ring end lemma mod_luc (k: ℕ ) (h: 2 ∣ k ∧ (k%3) ≠ 0) : ∀ (m: ℕ), luc(k) ∣ luc(m+2*k) + luc(m):= begin intro m, cases h with hx hy, rw ← int.coe_nat_dvd, apply luc_cancel_2 _ _ hx hy, norm_cast, rw mul_add, rw fib_luc2 m (2*k), nth_rewrite 3 mul_comm, rw add_assoc, rw ← add_mul, rw fib_2k, rw ← luc_2k _ hx, rw nat.pow_two, rw ← mul_assoc, nth_rewrite 3 mul_comm, rw ← mul_assoc, rw ← add_mul, simp end lemma mod_luc_sub (k m: ℕ ) (h1 : 2 ∣ k) (h2: (k%3)≠ 0) (h3: 2*k ≥ m):(luc k:ℤ ) ∣ (luc (2*k-m) + (-1: ℤ)^m * luc m:ℤ ):= begin have h4: (luc k:ℤ ) ∣ 2*(luc (2*k-m) + (-1: ℤ)^m * luc m:ℤ ), {rw mul_add, rw fib_luc2_sub (2*k-m) m, rw nat.sub_add_cancel h3, rw fib_2k, rw add_assoc, nth_rewrite 7 mul_comm, nth_rewrite 3 mul_assoc, nth_rewrite 3 mul_assoc, rw ← mul_add, nth_rewrite 5 mul_comm, rw ← mul_add, norm_cast, rw ← luc_2k k h1,rw nat.pow_two, push_cast, use ((-1:ℤ)^(m+1)*5*fib k * fib m + (-1: ℤ )^m * luc m * luc k),ring}, apply luc_cancel_2 _ _ h1 h2 h4 end lemma mod_fun_gen (a k r s v: ℕ ) (f: ℕ → ℕ ) (h0: s≥ 1)(h: ∀ (m:ℕ ), (a: ℤ) ∣ f(m+k) + (-1: ℤ )^r*f(m) ) : (a: ℤ ) ∣ f(v+s*k) + (-1: ℤ )^(s*(r+1)-1)* f(v):= begin have h3: ∃ (u:ℕ ), s=u+1, {use s-1, omega}, cases h3 with u h3, rw h3, clear h0 h3 s, induction u with s hs, {simp * at *}, {have h5:= h (v+(s+1)*k), have h6:= dvd_mul_of_dvd_right (hs) ((-1)^(r+1)), have h7:= dvd_add h5 h6, rw nat.succ_eq_add_one, cases h7 with x h8, use x, rw ← h8, rw add_mul, rw one_mul, rw eq_comm, rw add_assoc, conv_lhs{congr, skip, rw pow_add _ r 1, ring}, rw mul_assoc, rw ← pow_add, rw neg_eq_neg_one_mul, rw mul_left_comm, have h9: (-1:ℤ ) ^ ((s + 2) * (r + 1) -1) = (-1:ℤ ) * (-1) ^ ((s + 1) * (r + 1) - 1 + r), {nth_rewrite_rhs 0 [show (-1:ℤ ) = (-1)^1, from rfl], rw ← pow_add, have h10: (s + 2) * (r + 1) - 1 = 1 + ((s + 1) * (r + 1) - 1 + r), {apply int.coe_nat_inj, rw [show 2=1+1, from rfl], repeat {rw add_mul}, rw one_mul,push_cast, simp, ring}, rw h10}, rw h9,nth_rewrite 1 mul_comm, rw add_assoc} end lemma mod_fib (k: ℕ ) (h: 2 ∣ k ∧ (k%3) ≠ 0) : ∀ (m:ℕ), luc(k) ∣ fib(m+2*k) + fib(m):= begin intro m, cases h with hx hy, rw ← int.coe_nat_dvd, apply luc_cancel_2 _ _ hx hy, norm_cast, rw mul_add, rw fib_luc1 m (2*k), nth_rewrite 3 mul_comm, rw add_assoc, rw mul_comm k 2, rw fib_2k, nth_rewrite 1 add_comm, rw mul_comm, rw ← add_assoc, rw ← add_mul, rw ← luc_2k _ hx, rw nat.pow_two, use (luc k * fib m + luc m * (fib k)), ring end lemma mod_fib_sub (k m: ℕ ) (h1 : 2 ∣ k) (h2: (k%3)≠ 0) (h3: 2*k ≥ m):(luc k:ℤ ) ∣ (fib (2*k-m) + (-1: ℤ)^(m+1) * fib m:ℤ ):= begin have h4: (luc k:ℤ ) ∣ 2*(fib (2*k-m) + (-1: ℤ)^(m+1) * fib m:ℤ ), {rw mul_add, rw fib_luc1_sub (2*k-m) m, rw nat.sub_add_cancel h3, rw fib_2k, rw add_assoc, nth_rewrite 6 mul_comm, nth_rewrite 1 mul_assoc, nth_rewrite 2 mul_assoc, rw ← mul_add, nth_rewrite 6 mul_comm, rw ← add_mul, norm_cast, rw ← luc_2k k h1,rw nat.pow_two, push_cast, use ((-1:ℤ)^(m)*fib k * luc m + (-1: ℤ )^(m+1) * luc k * fib m),ring}, apply luc_cancel_2 _ _ h1 h2 h4 end lemma luc_mod_8 (m : ℕ ): luc (m+12)%8 =luc m %8 := begin rw [show m+12=11+m+1, by ring], rw fib_luc_rec_2, rw [show fib (11+1)=144, from rfl], rw [show fib 11=89, from rfl], rw nat.add_mod, rw nat.mul_mod, rw [show 144%8 =0, from rfl], nth_rewrite 1 nat.mul_mod, rw [show 89%8 =1, from rfl], simp end lemma luc_mod_8_gen (m:ℕ ): luc(m)%8 = luc(m%12)%8:= begin cases div_algo m 12, rw h, clear h, rw add_comm, induction w with d hd, {simp}, {rw nat.succ_eq_add_one, rw mul_add, rw← add_assoc, rw mul_one, rw luc_mod_8, rw hd, simp} end
import combinatorics.simple_graph.coloring --OUTPUT 1 theorem bipartite_iff_two_colorable {V : Type*} (G : simple_graph V) [fintype V] : (G.colorable 2) ↔ (∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B)) := begin split, { assume h1 : G.colorable 2, have h2 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h3 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h4 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h5 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h6 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h7 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h8 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h9 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h10 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h11 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h12 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h13 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h14 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h15 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h16 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h17 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h18 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h19 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h20 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h21 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h22 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h23 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h24 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h25 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h26 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h27 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h28 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h29 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h30 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h31 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h32 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h33 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h34 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h35 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h36 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h37 : ∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B), from by { have h38 : ∃ (A B : Type*) ( end --Needs more than 2000 tokens! /- FEW SHOT PROMPTS TO CODEX(START) /--`theorem` Power Set is Closed under Intersection Let $S$ be a set. Let $\powerset S$ be the power set of $S$. Then: :$\forall A, B \in \powerset S: A \cap B \in \powerset S$ `proof` Let $A, B \in \powerset S$. Then by the definition of power set, $A \subseteq S$ and $B \subseteq S$. From Intersection is Subset we have that $A \cap B \subseteq A$. It follows from Subset Relation is Transitive that $A \cap B \subseteq S$. Thus $A \cap B \in \powerset S$ and closure is proved. {{qed}} -/ theorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S := begin assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S), have h1 : (A ⊆ S) ∧ (B ⊆ S), from by {split,apply set.subset_of_mem_powerset,exact hA,apply set.subset_of_mem_powerset,exact hB}, have h2 : (A ∩ B) ⊆ A, from by apply set.inter_subset_left, have h3 : (A ∩ B) ⊆ S, from by {apply set.subset.trans h2 h1.left}, show (A ∩ B) ∈ 𝒫 S, from by {apply set.mem_powerset h3}, end /--`theorem` Square of Sum :$\forall x, y \in \R: \paren {x + y}^2 = x^2 + 2 x y + y^2$ `proof` Follows from the distribution of multiplication over addition: {{begin-eqn}} {{eqn | l = \left({x + y}\right)^2 | r = \left({x + y}\right) \cdot \left({x + y}\right) }} {{eqn | r = x \cdot \left({x + y}\right) + y \cdot \left({x + y}\right) | c = Real Multiplication Distributes over Addition }} {{eqn | r = x \cdot x + x \cdot y + y \cdot x + y \cdot y | c = Real Multiplication Distributes over Addition }} {{eqn | r = x^2 + 2xy + y^2 | c = }} {{end-eqn}} {{qed}} -/ theorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := begin calc (x + y)^2 = (x+y)*(x+y) : by rw sq ... = x*(x+y) + y*(x+y) : by rw add_mul ... = x*x + x*y + y*x + y*y : by {rw [mul_comm x (x+y),mul_comm y (x+y)], rw [add_mul,add_mul], ring} ... = x^2 + 2*x*y + y^2 : by {repeat {rw ← sq}, rw mul_comm y x, ring} end /--`theorem` Identity of Group is Unique Let $\struct {G, \circ}$ be a group. Then there is a unique identity element $e \in G$. `proof` From Group has Latin Square Property, there exists a unique $x \in G$ such that: :$a x = b$ and there exists a unique $y \in G$ such that: :$y a = b$ Setting $b = a$, this becomes: There exists a unique $x \in G$ such that: :$a x = a$ and there exists a unique $y \in G$ such that: :$y a = a$ These $x$ and $y$ are both $e$, by definition of identity element. {{qed}} -/ theorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a := begin have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by { assume a b : G, use a⁻¹ * b, obviously, }, have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by { assume a b : G, use b * a⁻¹, obviously, }, have h3 : ∀ a : G, ∃! x : G, a * x = a, from assume a : G, h1 a a, have h4 : ∀ a : G, ∃! y : G, y * a = a, from assume a : G, h2 a a, have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from assume a :G, exists_unique.unique (h3 a) (classical.some_spec (exists_unique.exists (h3 a))) (mul_one a), have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from assume a : G, exists_unique.unique (h4 a) (classical.some_spec (exists_unique.exists (h4 a))) (one_mul a), show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by { use (1 : G), have h7 : ∀ e : G, (∀ a : G, e * a = a ∧ a * e = a) → e = 1, from by { assume (e : G) (hident : ∀ a : G, e * a = a ∧ a * e = a), have h8 : ∀ a : G, e = classical.some (h3 a).exists, from assume (a : G), exists_unique.unique (h3 a) (hident a).right (classical.some_spec (exists_unique.exists (h3 a))), have h9 : ∀ a : G, e = classical.some (h4 a).exists, from assume (a : G), exists_unique.unique (h4 a) (hident a).left (classical.some_spec (exists_unique.exists (h4 a))), show e = (1 : G), from eq.trans (h9 e) (h6 _), }, exact ⟨by obviously, h7⟩, } end /--`theorem` Bipartite Graph is two colorable Let $G$ be a graph. Then $G$ is 2-colorable if and only if $G$ is bipartite. `proof` Let $G$ be a 2-colorable graph, which means we can color every vertex either red or blue, and no edge will have both endpoints colored the same color. Let $A$ denote the subset of vertices colored red, and let $B$ denote the subset of vertices colored blue. Since all vertices of $A$ are red, there are no edges within $A$, and similarly for $B$. This implies that every edge has one endpoint in $A$ and the other in $B$, which means $G$ is bipartite. Conversely, suppose $G$ is bipartite, that is, we can partition the vertices into two subsets $V_{1}, V_{2}$ every edge has one endpoint in $V_{1}$ and the other in $V_{2}$. Then coloring every vertex of $V_{1}$ red and every vertex of $V_{2}$ blue yields a valid coloring, so $G$ is 2-colorable. QED -/ theorem bipartite_iff_two_colorable {V : Type*} (G : simple_graph V) [fintype V] : (G.colorable 2) ↔ (∃ (A B : Type*) (h : (A ⊕ B) = V), G ≤ cast (congr_arg _ h) (complete_bipartite_graph A B)) := FEW SHOT PROMPTS TO CODEX(END)-/
------------------------------------------------------------------------------ -- Testing the translation of 11-ary predicates symbols ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module P11 where postulate D : Set P : D → D → D → D → D → D → D → D → D → D → D → Set postulate P-refl : ∀ {x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ x₁₀ x₁₁} → P x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ x₁₀ x₁₁ → P x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ x₁₀ x₁₁ {-# ATP prove P-refl #-}