Datasets:
AI4M
/

text
stringlengths
0
3.34M
from abc import ABC, abstractmethod import numpy as np import pandas as pd class AggregatorInterface(ABC): @abstractmethod def get_aggregated_response(self, response_df: pd.DataFrame) -> np.ndarray: pass
{-# OPTIONS --without-K #-} open import HoTT open import homotopy.HSpace module homotopy.CircleHSpace where S¹-hSpace : HSpaceStructure S¹ S¹-hSpace = hSpaceStructure base μ μ-e-l μ-e-r μ-coh where turn-around : (x : S¹) → x == x turn-around = S¹-elim loop (↓-idf=idf-in (∙=∙' loop loop)) module Mu = S¹Rec (idf S¹) (λ= turn-around) μ : S¹ → S¹ → S¹ μ = Mu.f μ-e-l : (x : S¹) → μ base x == x μ-e-l x = idp μ-e-r : (x : S¹) → μ x base == x μ-e-r = S¹-elim idp (↓-app=idf-in (idp ∙' loop =⟨ ∙'-unit-l loop ⟩ loop =⟨ idp ⟩ turn-around base =⟨ ! (app=-β turn-around base) ⟩ ap (λ z → z base) (λ= turn-around) =⟨ ! (Mu.loop-β |in-ctx (ap (λ z → z base))) ⟩ ap (λ z → z base) (ap μ loop) =⟨ ! (ap-∘ (λ z → z base) μ loop) ⟩ ap (λ z → μ z base) loop =⟨ ! (∙-unit-r _) ⟩ ap (λ z → μ z base) loop ∙ idp ∎)) μ-coh = idp
#include <boost/test/unit_test.hpp> #include <iostream> #include <am/succinct/dag_vector/comp_vector.hpp> #include <string> #include <cstdio> using namespace std; BOOST_AUTO_TEST_SUITE(dag_vector_test) BOOST_AUTO_TEST_CASE(comp_vector) { int n = 10000; cout << "n=" << n << endl; izenelib::am::succinct::comp_vector<string> cv; vector<string> origs; char buf[256]; for (int i = 0; i < n; ++i) { snprintf(buf, 256, "%d", rand() % 1000); cv.push_back(string(buf)); origs.push_back(buf); } for (size_t i = 0; i < origs.size(); ++i) { if (origs[i] != cv[i]) { cout << "Error () i=" << i << " " << origs[i] << " " << cv[i] << endl; } } uint64_t pos = 0; for (izenelib::am::succinct::comp_vector<string>::const_iterator it = cv.begin(); it != cv.end(); ++it, ++pos) { if (origs[pos] != *it) { cout << "Error iter i=" << pos << " " << origs[pos] << " " << *it << endl; } } cout << "test passed." << endl; } BOOST_AUTO_TEST_SUITE_END() // dag_vector_test
# 尽可能的化简解的约束 $ifndef _CON_REFINE_ $define _CON_REFINE_ $include "Condition.mpl" $include "../seg/Seg.mpl" # 总的简化函数 conRefine:=proc(r::RepSol) signRefine(r); epRefine(r); uniqueAndSort(r);# 简化之后重新对条件进行排序 return; end proc: # 对于代表元v[k]删去a[k]>0. # 对于代表元-v[k]删去a[k]<0. # 这里只删去了acon的条件,对于osol并没有进行修改 signRefine:=proc(r::RepSol) local vs,k,rc; vs:=indets(r:-rep,name); if numelems(vs)<>1 then return; end if; k:=op([1,1],vs); rc:=eval({a[k]>0,a[k]<0}); r:-acon:=map(x->x minus rc,r:-acon); return; end proc: # 尽可能删去和epsilon有关的约束 epRefine:=proc(r::RepSol) r:-acon:=epDeal~(r:-acon); end proc: # 处理每个可能情况的约束条件 epDeal:=proc(s::set) local ca,ce,r; ce,ca:=selectremove(has,s,epsilon); ce:=ceDeal~(ce); r:=ce union ca; r:=classifySolve(r); return r; end proc: # 单个关于epsilon的条件处理 ceDeal:=proc(e) local rs; # 有的时候solve会抽,对于这种情况不做处理 try rs:=conSolve(e); catch : return e; end try; if numelems(rs)=0 then # 无解则原样返回 return e; elif numelems(rs)=1 then # 只有一个解,则不论有多少条件都可以 return rs[][]; else return multiConRefine(rs); end if; end proc: multiConRefine:=proc(rs) local s; # 单变量约束的并集,只处理无约束和,x<>c的约束 if numelems(indets(rs,name))=1 and andmap(x->evalb(numelems(x)=1),rs) then s:=`union`(seq(Seg(x),x in rs)); if s=real then return NULL; end if; s:=&C s; if type(s:-bound,numeric) then return indets(rs,name)[]<>s:-bound; else return e; end if; # 删去一个共同条件之后能够构成单变量约束的并集 elif numelems(`intersect`(rs[]))=1 then s:=`intersect`(rs[]); return s[],multiConRefine(map(x->x minus s,rs)); else return e; end if; end proc: # 求解不等式, # 在解中删除自由变量 # 删除和epsilon有关的约束 conSolve:=proc(c) local r; r:=[RealDomain:-solve(c)]; r:=map(x->remove(t->evalb(lhs(t)=rhs(t)),x),r); r:=map(x->remove(has,x,epsilon),r); r:=[{r[]}[]];# 去重 return r; end proc: $endif
[STATEMENT] lemma frange_vintersection_vsubset: "\<R>\<^sub>\<bullet> (r \<inter>\<^sub>\<circ> s) \<subseteq>\<^sub>\<circ> \<R>\<^sub>\<bullet> r \<inter>\<^sub>\<circ> \<R>\<^sub>\<bullet> s" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<R>\<^sub>\<bullet> (r \<inter>\<^sub>\<circ> s) \<subseteq>\<^sub>\<circ> \<R>\<^sub>\<bullet> r \<inter>\<^sub>\<circ> \<R>\<^sub>\<bullet> s [PROOF STEP] by auto
module Derive.TestDefs data W : (a : Type) -> (a -> Type) -> Type where Sup : (x : a) -> (p x -> W a p) -> W a p
As a mark of respect , Dagenham & Redbridge postponed the game Exeter were due to play against them at Victoria Road four days after his death . Exeter retired his shirt number 9 for nine seasons .
import pandas as pd import numpy as np from pypfopt.efficient_frontier import EfficientFrontier from pypfopt import risk_models from pypfopt import expected_returns from pypfopt import discrete_allocation # Reading in the data; preparing expected returns and a risk model df = pd.read_csv("tests/stock_prices.csv", parse_dates=True, index_col="date") assets_classes = { "GOOG":"Tech", "AAPL":"Tech", "FB":"Tech", "BABA":"Tech", "AMZN":"Tech", "GE":"Consumer", "AMD":"Tech", "WMT":"Consumer", "BAC":"Financial", "GM":"Consumer", "T":"Consumer", "UAA":"Consumer", "SHLD":"Consumer", "XOM":"Energy", "RRC":"Energy", "BBY":"Consumer", "MA":"Financial", "PFE":"Healthcare", "JPM":"Financial", "SBUX":"Consumer" } assets_allocation = { "Tech": (.10, .30), "Consumer": (.10, .50), "Financial": (.10, .20), "Energy": (0.05, .10), "Healthcare": (0.05, .10) } assert(all([tick in df.columns for tick in assets_classes])) returns = df.pct_change().dropna(how="all") mu = expected_returns.mean_historical_return(df) S = risk_models.sample_cov(df) ef = EfficientFrontier(mu, S, asset_classes=assets_classes, asset_allocation=assets_allocation) weights = ef.max_sharpe() ef.portfolio_performance(verbose=True) print(weights) df = df[['AAPL','BAC','GE']] assets_classes = { "AAPL":"Tech", "GE":"Consumer", "BAC":"Financial", } assets_allocation = { "Tech": (.30, .30), "Consumer": (.50, .50), "Financial": (.20, .20), } returns = df.pct_change().dropna(how="all") mu = expected_returns.mean_historical_return(df) S = risk_models.sample_cov(df) ef = EfficientFrontier(mu, S, asset_classes=assets_classes, asset_allocation=assets_allocation) weights = ef.max_sharpe() ef.portfolio_performance(verbose=True) print(weights)
/* ----------------------------------------------------------------------------- * Copyright 2021 Jonathan Haigh * SPDX-License-Identifier: MIT * ---------------------------------------------------------------------------*/ #ifndef SQ_INCLUDE_GUARD_results_Filter_h_ #define SQ_INCLUDE_GUARD_results_Filter_h_ #include "core/Field.h" #include "core/typeutil.h" #include "parser/FilterSpec.h" #include <gsl/gsl> #include <memory> namespace sq::results { struct Filter; using FilterPtr = std::unique_ptr<Filter>; struct Filter { /** * Create a Filter for the given spec. */ SQ_ND static FilterPtr create(const parser::FilterSpec &spec); /** * Apply this filter to a Result. */ SQ_ND virtual Result operator()(Result &&result) const = 0; virtual ~Filter() = default; Filter() = default; Filter(const Filter &) = delete; Filter(Filter &&) = delete; Filter &operator=(const Filter &) = delete; Filter &operator=(Filter &&) = delete; }; } // namespace sq::results #endif // SQ_INCLUDE_GUARD_results_Filter_h_
Home Truman Library Photograph Collection Gallegos and Truman holed ceremonial keys in Bolivar, MO. Gallegos and Truman holed ceremonial keys in Bolivar, MO. Title Gallegos and Truman holed ceremonial keys in Bolivar, MO. Description Venezuelan President Romulo Gallegos, left, and President Harry S. Truman, right, are presented with ceremonial keys while in Bolivar, Missouri. All others in photograph are unidentified.
\documentclass[bigger]{beamer} \input{header-beam} % change to header-handout for handouts % ==================== \title[Lecture 12]{Logic I F13 Lecture 12} \date{October 22, 2013} % ==================== \include{header} \setlength{\fitchprfwidth}{5em} \section{Review} \subsec{Satisfaction}{ \bit \item Atomic wffs like $\sf Cube(x)$ express the properties we've assigned to the predicate symbol \item More general: any wff $\sf P(x)$ expresses a property \item Which one? The property of \emph{satisfying $\sf P(x)$}. \item \emph{$\alpha$ satisfies $\sf P(x)$ in~$W$} iff $\sf P(n)$ is true in the world~$W'$ which is just like $W$ except $n$ names $\alpha$ \item Extension of $\sf P(x)$ in $W$: set of all objects that satisfy $\sf P(x)$ in $W$. \item Examples: \bit \item $x$ is a small tetrahedron to the left of $b$:\[ \sf Small(x) \land Tet(x) \land LeftOf(x, b) \] \item $x$ adjoins c or d, but not both \[ \sf \lnot(Adjoins(x, c) \iff Adjoins(x, d)) \] \eit \eit } \subsec{Quantifiers and Satisfaction: $\forall$}{ \bit \item The sentence \[\sf \forall x\, P(x) \] says (is true iff) \bit \item every object in the domain (= world) satisfies P(x) \item P(n) is true for \emph{whatever} object is named by~n \item extension of P(x) in $W$ is the entire domain \eit \eit } \subsec{Quantifiers and Satisfaction: $\exists$}{ \bit \item The sentence \[\sf \exists x\, P(x) \] says (is true iff) \bit \item at least one object in the domain satisfies P(x) \item P(n) is true for \emph{at least one} object named by~n \item extension of P(x) in $W$ is not empty \eit \eit } \subsec{Expressing ``Everything'', ``Something''}{ \bit \item ``Everything is a large cube'' \[ \sf \forall x(Large(x) \land Cube(x)) \] \item ``Something is a large cube'' \[ \sf \exists x(Large(x) \land Cube(x)) \] \eit } \subsec{Expressing ``Nothing'', ``Not Everything''}{ \bit\item ``Nothing is a large cube'' \pause \begin{align*} & \sf \forall x\,\lnot(Large(x) \land Cube(x)) \\ & \sf \lnot\exists x(Large(x) \land Cube(x)) \end{align*} Also: ``Everything is: not a large cube'' \item ``Something isn't a large cube'' \pause \begin{align*} & \sf \exists x\,\lnot(Large(x) \land Cube(x)) \\ & \sf \lnot\forall x(Large(x) \land Cube(x)) \end{align*} Also: ``Not everything is a large cube'' \eit } \section{Restricted Quantification} \subsec{Determiner Phrases}{ \bit \item Determiners combine with noun phrases to make determiner phrases (DP): \bit \item ``\emph{A} large terahedron'' \item ``\emph{Three} cubes which are to the left of b'' \item ``\emph{Every} even number'' \item ``\emph{Some} cube(s) between d and e'' \item ``\emph{Most} philosophy majors'' \item ``\emph{Both} small cubes'' \eit \eit } \subsec{Determiner Phrases in Sentences}{ \bit \item DPs make subjects of sentence, just like names/constants and coordination constructions of them do \bit \item ``\emph{Claire and Alex} study logic''---``\emph{Most philosophy majors} study logic'' \item ``\emph{2} is prime''---``\emph{Some even number} is prime'' \item ``\emph{a} is between b and c''---``\emph{Every large cube} is between b and c'' \eit \item We know how to translate the former---how do we deal with the latter? \eit } \subsec{Restricted Quantification}{ \bit \item ``Det A is/are B'' \item A is a noun (phrase), B an adjective or article + noun (phrase) \item Translate ``x is an A'' into a wff of FOL: A(x) \item Translate ``x is B'' into a wff of FOL: B(x) \item Combine A(x), B(x) in the right way \eit } \subsec{Some A is B}{ \bit \item ``Some cube is large'' \item ``x is a cube'': $\sf Cube(x)$ \item ``x is large'': $\sf Large(x)$ \item Combine: \[\sf \uncovers{2-4}{\exists x}\uncovers{2-4}{(}Cube(x) \uncovers{3-4}{{}\land{}} Large(x)\uncovers{2-4}{)} \] \items{4} Also: \bit \item ``Some cubes are large'' \item ``There are large cubes'' \item ``Something large is a cube'' \item ``A cube is large'' \eit \eit } \subsec{Every A is B}{ \bits \item ``Every cube is large'' \item Options: \bens \item[] $\sf \forall x(Cube(x) \phantom{{}\land{}} Large(x))$ \item $\sf \forall x(Cube(x) \land Large(x))$ \uncovers{7-}{\color{red}NO} \item $\sf \forall x(Cube(x) \lor Large(x))$ \uncovers{7-}{\color{red}NO} \item $\sf \forall x(Cube(x) \to Large(x))$ \uncovers{7-}{\color{green}YES} \een \item Also: \bit \item ``All cubes are large'' \item ``Any cube is large'' \item ``Cubes are large'' \item ``If something is a cube, it is large'' \eit \eit } \subsec{The Indefinite Article}{ \bits \item ``A small cube adjoins a'' \item[] $\sf \exists x((Small(x) \land Cube(x)) \land Adjoins(x, a))$ \item ``a is left of a large tetrahedron'' \item[]$ \sf \exists x((Large(x) \land Tet(x)) \land LeftOf(a, x)) $ \item ``An even number is a multiple of 2'' \item[] $\sf \forall x(Even(x) \to MultipleOf(x, (1+1)))$ \item ``If a cube adjoins a, it is large'' \item[]$\sf \forall x((Cube(x) \land Adjoins(x, a)) \to Large(x))$ \eit } \subsec{No A is B}{ \bits \item ``No cube is large'' \item Options: \bens \item[] $\sf \phantom{lnot\forall} x(Cube(x) \phantom{{}\land{}} Large(x))$ \item $\sf \forall x(Cube(x) \to \lnot Large(x))$ \item $\sf \lnot\exists x(Cube(x) \land Large(x))$ \een \item Also: \bit \item ``No cubes are large'' \item ``There are no large cubes'' \item ``Nothing large is a cube'' \eit \eit } \subsec{Only As are Bs}{ \bits \item ``Only cubes are large'' \bits \item ``All non-cubes are non-large'' \item $\sf \forall x(\lnot Cube(x) \to \lnot Large(x))$ \item $\sf \forall x(Large(x) \to Cube(x))$ \eit \item ``Only a is large'' \bits \item ``a is large, and nothing other than a is large'' \item $\sf Large(a) \land \forall x(x \neq a \to \lnot Large(x))$ \item $\sf \forall x(Large(x) \iff x = a)$ \eit \eit } \subsec{Existential Import}{ \bit \item Does ``all cubes are small'' have ``there are cubes'' as a consequence? \item Not according to our translations! \[ \sf\forall x(Cube(x) \to Small(x)) \] is true if there are no cubes at all. \item (1) ``Everyone who took the exam passed''\\ (2) ``Noone who took the exam failed'' \bit \item (1) and (2) are equivalent \item If noone took the exam, then (2) is true \eit \eit } \subsec{Existential Import and Implicature}{ \bit \item P \emph{implies} Q iff Q is a consequence of P \item If P implies Q, then the denial of Q contradicts P \bit \item ``Some A are B'' implies ``There are As'' \item ``Some cubes are small'' implies ``There are cubes'' \item ``Some cubes are small. There are no cubes'': contradictory \eit \item Does ``All cubes are small'' imply ``There are cubes?'' \eit } \subsec{Existential Import and Implicature}{ \bit \item P \emph{implicates} Q if in asserting P, it is (strongly) suggested that Q is true \item Existential import is only \emph{implicated}, not \emph{implied} \item Test: No contradiction if implicature is denied: \bit \item ``Noone who took the exam failed.\\ In fact, noone took the exam at all'' \item ``Some students passed the exam.\\ In fact, all students passed.'' \item ``All unicorns are white.\\ All zero of them.'' \eit\eit } \subsec{Quantifiers and Function Symbols}{ \bits \item ``The leftmost block in the same row as any cube is small'' \bits \item ``For every cube, the leftmost block in the same column as it is small'' \item \[ \sf \forall x(Cube(x) \to Small(lm(x))) \] \eit \item ``Some multiples of 3 are even, and some aren't'' \bits \item Note: every multiple of 3 is the multiple of 3 \emph{by some number} \item ``There is a number such that the multiple of 3 by it is even'' \item $ \sf \exists x\,Even(x \times (1 + (1+1))) $ \item $ \sf \exists x\, Even(x \times (1 + (1+1))) \land \exists x\, \lnot Even(x \times (1 + (1+1))) $ \eit \eit } \end{document}
% % % % % % % % % % % % % % % % % % % % % % % % % \chapter{4-Manifolds} % % % % % % % % % % % % % % % % % % % % % % % % % % ---------------------- \section{Bordism} % ---------------------- \begin{definition} The $n$-dimensional oriented \textit{cobordism group} \index{cobordism group} over the space $X$ is \begin{equation*} \Omega_{n}[X] = \frac{ \{ f \colon M^{n} \rightarrow X \mid M^n \textrm{ oriented, closed, } n\textrm{-dim. manifold} \}}{\textrm{bordism}} \end{equation*} \marginnote{If $\alpha \colon M^{n} \rightarrow X$ represents a bordism class, $M^n$ is allowed to have more than one component.} \end{definition} \begin{proposition}[{\citep[13.15, p. 319]{kauffman1987knots}}] \begin{itemize} \item Pushing forward a fundamental class \begin{align*} \Omega_n [X] & \rightarrow H_{n}(X ; \Z) \\ [f \colon M^{n} \rightarrow X] & \mapsto f_{*}([M]) \end{align*} is an isomorphism for $n \le 3$. \item The sequence \begin{equation*} \Omega_{4}[\ast] \rightarrow \Omega_{4}[X] \rightarrow H_{4}(X ; \Z) \end{equation*} is exact. \end{itemize} \end{proposition} %TODO % ------------------------------------ \section{Mazur manifolds} % ------------------------------------ \textbf{References}: \begin{itemize} \item Homology spheres: \citep{saveliev2013invariants} \item \citep{akbulut1979mazur} \end{itemize} %TODO TODO % ------------------------------------ \section{Andrews-Curtis Conjecture} % ------------------------------------ \citep{SCP4} \begin{definition} A \textit{balanced presentation} \index{presentation!balanced} is a presentation \[ \langle g_1, \ldots, g_n \mid r_1, \ldots, r_n \rangle \] with the same number of generators and relations. The Andrew-Curtis moves on a balanced presentation are \begin{enumerate}[label=(\roman*)] \item \textbf{1-handle slides:} Replace a pair of generators $ \{ x, y \} $ by $ \{ x, xy \} $ \item \textbf{2-handle slides:} Replace a pair of relations $ \{ r, s \} $ by $ \{ grg^{-1}s, s \} $, where $ g $ is any word in the generators \item \textbf{1-2-handle cancellations:} Add a generator together with a new relation killing it \end{enumerate} In particular, you are \underline{not} allowed to make a copy of a relation to keep for later use (which would correspond to \textbf{2-3-handle creation/cancellation}). \end{definition} \begin{conjecture*}[Andrews-Curtis conjecture \textcolor{red}{(Probably false?)}] Any balanced presentation of the trivial group can be transformed by Andrews-Curtis moves to the trivial presentation. \end{conjecture*} \begin{example} %TODO TODO \[ \langle x, y \mid xyx = yxy, x^{5} = y^{4} \rangle \] is a balanced presentation of the trivial group, but until now nobody was able to find a sequence of Andrews-Curtis moves to transform it into the trivial presentation \[ \langle x, y \mid x, y \rangle \] \end{example} %TODO TODO Explain how to construct homotopy $4$-spheres from balanced presentations of the trivial group \citep{akbulut1985potential} \marginnote{ In \citep[I.3]{kirby2006topology} Kirby suspected that the \textit{Dolgachev surface} \index{Dolgachev surface} $E(1)_{2,3}$ (an exotic copy of the rational elliptic surface $ \CP{2} \# 9 \overline{\CP{2}} $) might require 1- and/or 3-handles. But in \citep{akbulut2008dolgachev} Akbulut found a handlebody presentation without those. } \begin{openquestion*}[] Does a simply connected, closed, smooth $4$-manifold need $1$-handles and/or $3$-handles? \end{openquestion*} \begin{observation} If exotic $\sphere{4}$ exist, their handle decomposition must contain $1$- or $3$-handles. For this suppose you have a handle decomposition of a manifold with the homology of $\sphere{4}$ and no $1$- and $3$-handles, then there could not be any $2$-handles either because these would give nontrivial second homology. \end{observation} \begin{definition} Use the following notation to denote the abelian group \begin{equation*} \Gamma_n = \frac{\textrm{orientation preserving diffeomorphisms of } \sphere{n-1}} {\textrm{those that extend to a diffeomorphism of } \disk{n}} \end{equation*} \end{definition} \marginnote{ \begin{itemize} \item $\Gamma_{1} = \Gamma_{2} = 0$ \item Munkres, Smale: $\Gamma_{3} = 0$ \item Cerf: $\Gamma_{4} = 0$ \item Kervaire, Milnor: $\Gamma_{5} = \Gamma_{6} = 0$, $\Gamma_{7} = \Z / 28$ \end{itemize} } \begin{proposition} For $n \ge 5$ we can identify $\Gamma_{n}$ with the set of oriented smooth structures of the topological $n$-sphere. I.e. in dimension $\ge 5$ all exotic spheres can be obtained by using a diffeomorphism of $\sphere{n-1}$ to glue two $n$-disks along their boundary. \end{proposition} \begin{theorem}[Cerf, \citep{geiges2010eliashberg}] Any diffeomorphism of the $3$-sphere $\sphere{3}$ extends over the $4$-ball $\disk{4}$, in other words \[ \Gamma_4 = 0. \] \end{theorem} \begin{observation} Cerf's theorem implies that there are no exotic structures on $\sphere{4}$ that can be obtained by gluing two $4$-disks along their boundary. \end{observation} \newpage % ------------------------------------ \section{Trisections} % ------------------------------------ \begin{center} \textsc{``Trisections are to $4$-manifolds as Heegaard splittings are to $3$-manifolds''} \end{center} \subsection{References} \begin{itemize} \item Original paper: \citep{gay2016trisecting} \item Lecture notes: \citep{gay2019heegaard} \end{itemize} \subsection{Definitions} \marginnote{ \begin{itemize} \item $\#^n A$ is the connected sum of $n$ copies of $A$, with $\#^{0} A = \sphere{m}$ \item TODO %TODO \end{itemize}} \begin{definition} \begin{itemize} \item The standard genus $g$ surface is \[ \Sigma_g = {\#}^{g} (\sphere{1} \times \sphere{1}) \] \item The standard genus $g$ solid handlebody is \[ H_g = \natural^g (\sphere{1} \times \disk{2}) \] with $\partial H_{g} = \Sigma_{g}$ \marginnote{$\partial (A \natural B) = (\partial A) \# (\partial B)$} \item The standard $4$-dimensional $1$-handlebody (of ``genus $k$'') is \[ Z_{k} =\natural^{k} (\sphere{1} \times \disk{3}) \] i.e.\ a $4$-ball to which we attach $k$-many $4$-dimensional $1$-handles. \end{itemize} \end{definition} \begin{marginfigure} \begin{center} \includegraphics{./pictures/standard_manifolds.png} \end{center} \caption{Standard manifolds of dimension 2, 3} \label{fig:standard_manifolds} \end{marginfigure}
Viewing news posted in May, 2013. View all news. In May 2013, Atlantic Business Magazine awarded our President and CEO, Jack Kelly, his fourth Top 50 CEO Award. Jack won this award in the past in 2009, 2010, and 2012.
Formal statement is: lemma mult_monom: "monom a m * monom b n = monom (a * b) (m + n)" Informal statement is: The product of two monomials is a monomial.
If $A$ is a subset of the power set of a set $S$, and $a_i$ is a $\sigma$-algebra on $S$ for each $i \in S$, then the intersection of all the $a_i$ is a $\sigma$-algebra on $S$.
[STATEMENT] lemma norm_bound_Basis_lt: "b \<in> Basis \<Longrightarrow> norm x < e \<Longrightarrow> \<bar>inner x b\<bar> < e" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>b \<in> Basis; norm x < e\<rbrakk> \<Longrightarrow> \<bar>inner x b\<bar> < e [PROOF STEP] by (metis Basis_le_norm le_less_trans)
Are you moving house in Stirling and need to find an affordable and competitive removal company? By using Movingboom.com you are able to compare house removals companies in Stirling in a matter of seconds. If you are moving house and looking to compare removals quotes in Stirling, why not try Movingboom.com today to see what you could save on your house removals costs. We think you will be amazed at how good our new system is and surprised at just what you could save on your moving costs.
Star midfielder Yaya Toure will be at Manchester City for the club's Premier League title defence. The Ivory Coast international, 31, had been linked with a move away from the champions throughout the close-season. Despite all the speculation, Toure said he wanted to see out his contract, which expires in mid-2017. "There has been a lot of speculation but they [City] have always been good with me and good with my family," he told Sky Sports News on Saturday. "I want to say that I will always honour my contract and stay as long as possible and don't think about all the speculation saying that I’m leaving. "For the fans for all they have done for me and the club as well, I need to say it's a big pleasure to stay and continue and try to enjoy the next season." Toure's agent Dimitri Seluk had appeared to be angling for a move for his client, even saying racism was the reason he was underrated. Linked with a move to Paris Saint-Germain and Manchester United, Toure said his focus was on the upcoming season. "Everything is fine now. There was a lot of speculation about people sending me away and people were sending me everywhere," he said. "I think sometimes it can be disappointing and I need to do something for the fans because people love me and people want to hear about what is happening. "It's important as well to keep them in a good way and let them know that the team are preparing well and we’ll try to do it again next year." There were reports Toure was unhappy with how City treated him for his birthday despite the club giving him a birthday cake. Seluk said Toure would continue giving his best for the club. "He has a contract and he will work very hard and I hope that next season Yaya will be the best player in the club," he said. "I hope now everybody is very friendly and I hope for his next birthday they will celebrate together."
Load LFindLoad. From lfind Require Import LFind. From QuickChick Require Import QuickChick. From adtind Require Import goal33. Derive Show for natural. Derive Arbitrary for natural. Instance Dec_Eq_natural : Dec_Eq natural. Proof. dec_eq. Qed. Lemma conj22eqsynthconj2 : forall (lv0 : natural) (lv1 : natural), (@eq natural (plus lv0 lv1) (plus Zero (plus lv1 lv0))). Admitted. QuickChick conj22eqsynthconj2.
State Before: C : Type u_2 inst✝¹ : Category C inst✝ : Preadditive C X : SimplicialObject C ⊢ PInfty ≫ PInfty = PInfty State After: case h C : Type u_2 inst✝¹ : Category C inst✝ : Preadditive C X : SimplicialObject C n : ℕ ⊢ HomologicalComplex.Hom.f (PInfty ≫ PInfty) n = HomologicalComplex.Hom.f PInfty n Tactic: ext n State Before: case h C : Type u_2 inst✝¹ : Category C inst✝ : Preadditive C X : SimplicialObject C n : ℕ ⊢ HomologicalComplex.Hom.f (PInfty ≫ PInfty) n = HomologicalComplex.Hom.f PInfty n State After: no goals Tactic: exact PInfty_f_idem n
[GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C ⊢ (𝟙 (𝟙_ C) ⊗ (ρ_ (𝟙_ C)).inv) ≫ (α_ (𝟙_ C) (𝟙_ C) (𝟙_ C)).inv ≫ ((ρ_ (𝟙_ C)).hom ⊗ 𝟙 (𝟙_ C)) = (ρ_ (𝟙_ C)).hom ≫ (λ_ (𝟙_ C)).inv [PROOFSTEP] coherence [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C ⊢ ((ρ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (𝟙_ C) (𝟙_ C) (𝟙_ C)).hom ≫ (𝟙 (𝟙_ C) ⊗ (ρ_ (𝟙_ C)).hom) = (λ_ (𝟙_ C)).hom ≫ (ρ_ (𝟙_ C)).inv [PROOFSTEP] coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X : C inst✝ : HasRightDual X ⊢ 𝟙 Xᘁ = 𝟙 Xᘁ [PROOFSTEP] simp only [rightAdjointMate, MonoidalCategory.tensor_id, Category.id_comp, coevaluation_evaluation_assoc, Category.comp_id, Iso.inv_hom_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X : C inst✝ : HasLeftDual X ⊢ (ᘁ𝟙 X) = 𝟙 ᘁX [PROOFSTEP] simp only [leftAdjointMate, MonoidalCategory.tensor_id, Category.id_comp, evaluation_coevaluation_assoc, Category.comp_id, Iso.inv_hom_id] [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y Z : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y g : Xᘁ ⟶ Z ⊢ fᘁ ≫ g = (ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ g) ≫ (α_ Yᘁ Y Z).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Z) ≫ (λ_ Z).hom [PROOFSTEP] dsimp only [rightAdjointMate] [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y Z : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y g : Xᘁ ⟶ Z ⊢ ((ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom) ≫ g = (ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ g) ≫ (α_ Yᘁ Y Z).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Z) ≫ (λ_ Z).hom [PROOFSTEP] rw [Category.assoc, Category.assoc, associator_inv_naturality_assoc, associator_inv_naturality_assoc, ← tensor_id_comp_id_tensor g, Category.assoc, Category.assoc, Category.assoc, Category.assoc, id_tensor_comp_tensor_id_assoc, ← leftUnitor_naturality, tensor_id_comp_id_tensor_assoc] [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y Z : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y g : ᘁX ⟶ Z ⊢ (ᘁf) ≫ g = (λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((g ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ Z Y ᘁY).hom ≫ (𝟙 Z ⊗ ε_ (ᘁY) Y) ≫ (ρ_ Z).hom [PROOFSTEP] dsimp only [leftAdjointMate] [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y Z : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y g : ᘁX ⟶ Z ⊢ ((λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom) ≫ g = (λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((g ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ Z Y ᘁY).hom ≫ (𝟙 Z ⊗ ε_ (ᘁY) Y) ≫ (ρ_ Z).hom [PROOFSTEP] rw [Category.assoc, Category.assoc, associator_naturality_assoc, associator_naturality_assoc, ← id_tensor_comp_tensor_id _ g, Category.assoc, Category.assoc, Category.assoc, Category.assoc, tensor_id_comp_id_tensor_assoc, ← rightUnitor_naturality, id_tensor_comp_tensor_id_assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (f ≫ g)ᘁ = gᘁ ≫ fᘁ [PROOFSTEP] rw [rightAdjointMate_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (f ≫ g)ᘁ = (ρ_ Zᘁ).inv ≫ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ fᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] simp only [rightAdjointMate, comp_tensor_id, Iso.cancel_iso_inv_left, id_tensor_comp, Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ (ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] symm [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ (ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] iterate 5 trans rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ (ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ (ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ?m.275599 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.275599 = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ Zᘁ ⊗ tensorUnit' ⟶ Xᘁ [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (g ⊗ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (g ⊗ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ?m.275921 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.275921 = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ Zᘁ ⊗ tensorUnit' ⟶ Xᘁ [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (g ⊗ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (g ⊗ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ?m.276208 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.276208 = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ Zᘁ ⊗ tensorUnit' ⟶ Xᘁ [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ?m.276519 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.276519 = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ Zᘁ ⊗ tensorUnit' ⟶ Xᘁ [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (g ⊗ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (g ⊗ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ?m.276866 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.276866 = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ Zᘁ ⊗ tensorUnit' ⟶ Xᘁ [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] rw [← Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom))) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] symm [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ((𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom))) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] iterate 2 trans rw [← Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ((𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom))) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ?m.277444 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.277444 = ((𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom))) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ Zᘁ ⊗ tensorUnit' ⟶ Xᘁ [PROOFSTEP] rw [← Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ((𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom))) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ?m.277668 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.277668 = ((𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom))) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ Zᘁ ⊗ tensorUnit' ⟶ Xᘁ [PROOFSTEP] rw [← Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (((𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ)) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = ((𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom))) ≫ (α_ Zᘁ Z Xᘁ).inv ≫ (ε_ Z Zᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] apply eq_whisker [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) = (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom)) [PROOFSTEP] repeat' -- Porting note: why do we need to fill in the implicit `C` here, and below?rw [← @id_tensor_comp C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((𝟙 Zᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Zᘁ ⊗ f ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) = (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom)) [PROOFSTEP] rw [← @id_tensor_comp C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (𝟙 Zᘁ ⊗ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Zᘁ ⊗ g ⊗ 𝟙 Xᘁ) = (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom)) [PROOFSTEP] rw [← @id_tensor_comp C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ 𝟙 Zᘁ ⊗ (η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) ≫ (g ⊗ 𝟙 Xᘁ) = (𝟙 Zᘁ ⊗ η_ Y Yᘁ) ≫ (𝟙 Zᘁ ⊗ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom)) [PROOFSTEP] rw [← @id_tensor_comp C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ 𝟙 Zᘁ ⊗ (η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) ≫ (g ⊗ 𝟙 Xᘁ) = 𝟙 Zᘁ ⊗ η_ Y Yᘁ ≫ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom) [PROOFSTEP] rw [← @id_tensor_comp C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ 𝟙 Zᘁ ⊗ (η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) ≫ (g ⊗ 𝟙 Xᘁ) = 𝟙 Zᘁ ⊗ η_ Y Yᘁ ≫ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom) [PROOFSTEP] congr 1 [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) ≫ (g ⊗ 𝟙 Xᘁ) = η_ Y Yᘁ ≫ (𝟙 Y ⊗ (ρ_ Yᘁ).inv) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Y ⊗ 𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (g ⊗ (λ_ Xᘁ).hom) [PROOFSTEP] rw [← id_tensor_comp_tensor_id (λ_ (Xᘁ)).hom g, id_tensor_rightUnitor_inv, Category.assoc, Category.assoc, rightUnitor_inv_naturality_assoc, ← associator_naturality_assoc, tensor_id, tensor_id_comp_id_tensor_assoc, ← associator_naturality_assoc] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (η_ Y Yᘁ ⊗ η_ X Xᘁ) ≫ ((𝟙 Y ⊗ 𝟙 Yᘁ) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] slice_rhs 2 3 => rw [← tensor_comp, tensor_id, Category.comp_id, ← Category.id_comp (η_ Y (Yᘁ)), tensor_comp] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (η_ Y Yᘁ ⊗ η_ X Xᘁ) ≫ ((𝟙 Y ⊗ 𝟙 Yᘁ) ⊗ f ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv [PROOFSTEP] rw [← tensor_comp, tensor_id, Category.comp_id, ← Category.id_comp (η_ Y (Yᘁ)), tensor_comp] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (η_ Y Yᘁ ⊗ η_ X Xᘁ) ≫ ((𝟙 Y ⊗ 𝟙 Yᘁ) ⊗ f ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv [PROOFSTEP] rw [← tensor_comp, tensor_id, Category.comp_id, ← Category.id_comp (η_ Y (Yᘁ)), tensor_comp] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (η_ Y Yᘁ ⊗ η_ X Xᘁ) ≫ ((𝟙 Y ⊗ 𝟙 Yᘁ) ⊗ f ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv [PROOFSTEP] rw [← tensor_comp, tensor_id, Category.comp_id, ← Category.id_comp (η_ Y (Yᘁ)), tensor_comp] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ ((((((𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (η_ Y Yᘁ ⊗ f ⊗ 𝟙 Xᘁ)) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv)) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom)) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [← id_tensor_comp_tensor_id _ (η_ Y (Yᘁ)), ← tensor_id] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ ((((((𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ)) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv)) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom)) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] repeat' rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ ((((((𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ)) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv)) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom)) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (((((𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ)) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv)) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ)) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ ((((𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ)) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv)) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (((𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ)) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom) ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ ((𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ)) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ ((𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ)) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (η_ Y Yᘁ ⊗ 𝟙 Y ⊗ 𝟙 Xᘁ) ≫ (α_ Y Yᘁ (Y ⊗ Xᘁ)).hom ≫ (𝟙 Y ⊗ (α_ Yᘁ Y Xᘁ).inv) ≫ (𝟙 Y ⊗ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [pentagon_hom_inv_assoc, ← associator_naturality_assoc, associator_inv_naturality_assoc] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ (𝟙_ C) Y Xᘁ).inv ≫ ((η_ Y Yᘁ ⊗ 𝟙 Y) ⊗ 𝟙 Xᘁ) ≫ ((α_ Y Yᘁ Y).hom ⊗ 𝟙 Xᘁ) ≫ ((𝟙 Y ⊗ ε_ Y Yᘁ) ⊗ 𝟙 Xᘁ) ≫ (α_ Y (𝟙_ C) Xᘁ).hom ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] slice_rhs 5 7 => rw [← comp_tensor_id, ← comp_tensor_id, evaluation_coevaluation, comp_tensor_id] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | ((η_ Y Yᘁ ⊗ 𝟙 Y) ⊗ 𝟙 Xᘁ) ≫ ((α_ Y Yᘁ Y).hom ⊗ 𝟙 Xᘁ) ≫ ((𝟙 Y ⊗ ε_ Y Yᘁ) ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y (𝟙_ C) Xᘁ).hom case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ η_ X Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (𝟙_ C) Y Xᘁ).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, evaluation_coevaluation, comp_tensor_id] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | ((η_ Y Yᘁ ⊗ 𝟙 Y) ⊗ 𝟙 Xᘁ) ≫ ((α_ Y Yᘁ Y).hom ⊗ 𝟙 Xᘁ) ≫ ((𝟙 Y ⊗ ε_ Y Yᘁ) ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y (𝟙_ C) Xᘁ).hom case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ η_ X Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (𝟙_ C) Y Xᘁ).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, evaluation_coevaluation, comp_tensor_id] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | ((η_ Y Yᘁ ⊗ 𝟙 Y) ⊗ 𝟙 Xᘁ) ≫ ((α_ Y Yᘁ Y).hom ⊗ 𝟙 Xᘁ) ≫ ((𝟙 Y ⊗ ε_ Y Yᘁ) ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y (𝟙_ C) Xᘁ).hom case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ η_ X Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (𝟙_ C) Y Xᘁ).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, evaluation_coevaluation, comp_tensor_id] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (𝟙 (𝟙_ C) ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ (𝟙_ C) Y Xᘁ).inv ≫ (((((λ_ Y).hom ⊗ 𝟙 Xᘁ) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ)) ≫ (α_ Y (𝟙_ C) Xᘁ).hom) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom)) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [associator_inv_naturality_assoc] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (α_ (𝟙_ C) X Xᘁ).inv ≫ ((𝟙 (𝟙_ C) ⊗ f) ⊗ 𝟙 Xᘁ) ≫ (((((λ_ Y).hom ⊗ 𝟙 Xᘁ) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ)) ≫ (α_ Y (𝟙_ C) Xᘁ).hom) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom)) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] slice_rhs 4 5 => rw [← tensor_comp, leftUnitor_naturality, tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | ((𝟙 (𝟙_ C) ⊗ f) ⊗ 𝟙 Xᘁ) ≫ ((λ_ Y).hom ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ Y).inv ⊗ 𝟙 Xᘁ case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y (𝟙_ C) Xᘁ).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ η_ X Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (𝟙_ C) X Xᘁ).inv [PROOFSTEP] rw [← tensor_comp, leftUnitor_naturality, tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | ((𝟙 (𝟙_ C) ⊗ f) ⊗ 𝟙 Xᘁ) ≫ ((λ_ Y).hom ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ Y).inv ⊗ 𝟙 Xᘁ case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y (𝟙_ C) Xᘁ).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ η_ X Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (𝟙_ C) X Xᘁ).inv [PROOFSTEP] rw [← tensor_comp, leftUnitor_naturality, tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | ((𝟙 (𝟙_ C) ⊗ f) ⊗ 𝟙 Xᘁ) ≫ ((λ_ Y).hom ⊗ 𝟙 Xᘁ) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ Y).inv ⊗ 𝟙 Xᘁ case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ Y (𝟙_ C) Xᘁ).hom case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 Y ⊗ (λ_ Xᘁ).hom case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | g ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 (𝟙_ C) ⊗ η_ X Xᘁ case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (𝟙_ C) X Xᘁ).inv [PROOFSTEP] rw [← tensor_comp, leftUnitor_naturality, tensor_comp] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (α_ (𝟙_ C) X Xᘁ).inv ≫ ((((((λ_ X).hom ⊗ 𝟙 Xᘁ) ≫ (f ⊗ 𝟙 Xᘁ)) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ)) ≫ (α_ Y (𝟙_ C) Xᘁ).hom) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom)) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] repeat' rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (α_ (𝟙_ C) X Xᘁ).inv ≫ ((((((λ_ X).hom ⊗ 𝟙 Xᘁ) ≫ (f ⊗ 𝟙 Xᘁ)) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ)) ≫ (α_ Y (𝟙_ C) Xᘁ).hom) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom)) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (α_ (𝟙_ C) X Xᘁ).inv ≫ (((((λ_ X).hom ⊗ 𝟙 Xᘁ) ≫ (f ⊗ 𝟙 Xᘁ)) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ)) ≫ (α_ Y (𝟙_ C) Xᘁ).hom) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (α_ (𝟙_ C) X Xᘁ).inv ≫ ((((λ_ X).hom ⊗ 𝟙 Xᘁ) ≫ (f ⊗ 𝟙 Xᘁ)) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ)) ≫ (α_ Y (𝟙_ C) Xᘁ).hom ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (α_ (𝟙_ C) X Xᘁ).inv ≫ (((λ_ X).hom ⊗ 𝟙 Xᘁ) ≫ (f ⊗ 𝟙 Xᘁ)) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ) ≫ (α_ Y (𝟙_ C) Xᘁ).hom ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (α_ (𝟙_ C) X Xᘁ).inv ≫ ((λ_ X).hom ⊗ 𝟙 Xᘁ) ≫ (f ⊗ 𝟙 Xᘁ) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ) ≫ (α_ Y (𝟙_ C) Xᘁ).hom ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (g ⊗ 𝟙 Xᘁ) = (ρ_ tensorUnit').inv ≫ (𝟙 (𝟙_ C) ⊗ η_ X Xᘁ) ≫ (α_ (𝟙_ C) X Xᘁ).inv ≫ ((λ_ X).hom ⊗ 𝟙 Xᘁ) ≫ (f ⊗ 𝟙 Xᘁ) ≫ ((ρ_ Y).inv ⊗ 𝟙 Xᘁ) ≫ (α_ Y (𝟙_ C) Xᘁ).hom ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] rw [triangle_assoc_comp_right_inv_assoc, ← leftUnitor_tensor_assoc, leftUnitor_naturality_assoc, unitors_equal, ← Category.assoc, ← Category.assoc] [GOAL] case w.e_g C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasRightDual X inst✝¹ : HasRightDual Y inst✝ : HasRightDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) ≫ (g ⊗ 𝟙 Xᘁ) = ((ρ_ tensorUnit').inv ≫ (ρ_ (𝟙_ C)).hom) ≫ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).inv) ≫ (𝟙 Y ⊗ (λ_ Xᘁ).hom) ≫ (g ⊗ 𝟙 Xᘁ) [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (ᘁf ≫ g) = (ᘁg) ≫ ᘁf [PROOFSTEP] rw [leftAdjointMate_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (ᘁf ≫ g) = (λ_ ᘁZ).inv ≫ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((ᘁf) ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] simp only [leftAdjointMate, id_tensor_comp, Iso.cancel_iso_inv_left, comp_tensor_id, Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] symm [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] iterate 5 trans rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ?m.320227 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.320227 = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ tensorUnit' ⊗ ᘁZ ⟶ ᘁX [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ?m.320549 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.320549 = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ tensorUnit' ⊗ ᘁZ ⟶ ᘁX [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ?m.320836 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.320836 = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ tensorUnit' ⊗ ᘁZ ⟶ ᘁX [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ?m.321147 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.321147 = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ tensorUnit' ⊗ ᘁZ ⟶ ᘁX [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ?m.321494 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.321494 = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ tensorUnit' ⊗ ᘁZ ⟶ ᘁX [PROOFSTEP] rw [← Category.id_comp g, tensor_comp] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] rw [← Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] symm [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ((η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] iterate 2 trans rw [← Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ((η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ?m.322070 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.322070 = ((η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ tensorUnit' ⊗ ᘁZ ⟶ ᘁX [PROOFSTEP] rw [← Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ)) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ((η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] trans [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ)) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ?m.322294 C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ?m.322294 = ((η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ tensorUnit' ⊗ ᘁZ ⟶ ᘁX [PROOFSTEP] rw [← Category.assoc] [GOAL] C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (((η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ)) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom = ((η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁX) Z ᘁZ).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁZ) Z) ≫ (ρ_ ᘁX).hom [PROOFSTEP] apply eq_whisker [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ)) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) = (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) [PROOFSTEP] repeat' -- Porting note: why do we need to fill in the implicit `C` here, and below?rw [← @comp_tensor_id C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ ((η_ (ᘁX) X ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ)) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) = (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) [PROOFSTEP] rw [← @comp_tensor_id C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁZ) ≫ ((𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ) = (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) [PROOFSTEP] rw [← @comp_tensor_id C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ = (η_ (ᘁY) Y ⊗ 𝟙 ᘁZ) ≫ (((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ) [PROOFSTEP] rw [← @comp_tensor_id C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ = η_ (ᘁY) Y ≫ ((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ [PROOFSTEP] rw [← @comp_tensor_id C] [GOAL] case w C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ g) ⊗ 𝟙 ᘁZ = η_ (ᘁY) Y ≫ ((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) ⊗ 𝟙 ᘁZ [PROOFSTEP] congr 1 [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ g) = η_ (ᘁY) Y ≫ ((λ_ ᘁY).inv ⊗ 𝟙 Y) ≫ ((η_ (ᘁX) X ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ⊗ 𝟙 Y) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ g) [PROOFSTEP] rw [← tensor_id_comp_id_tensor g (ρ_ (ᘁX)).hom, leftUnitor_inv_tensor_id, Category.assoc, Category.assoc, leftUnitor_inv_naturality_assoc, ← associator_inv_naturality_assoc, tensor_id, id_tensor_comp_tensor_id_assoc, ← associator_inv_naturality_assoc] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ η_ (ᘁY) Y) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY ⊗ 𝟙 Y) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] slice_rhs 2 3 => rw [← tensor_comp, tensor_id, Category.comp_id, ← Category.id_comp (η_ (ᘁY) Y), tensor_comp] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (η_ (ᘁX) X ⊗ η_ (ᘁY) Y) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY ⊗ 𝟙 Y) case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv [PROOFSTEP] rw [← tensor_comp, tensor_id, Category.comp_id, ← Category.id_comp (η_ (ᘁY) Y), tensor_comp] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (η_ (ᘁX) X ⊗ η_ (ᘁY) Y) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY ⊗ 𝟙 Y) case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv [PROOFSTEP] rw [← tensor_comp, tensor_id, Category.comp_id, ← Category.id_comp (η_ (ᘁY) Y), tensor_comp] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (η_ (ᘁX) X ⊗ η_ (ᘁY) Y) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY ⊗ 𝟙 Y) case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv [PROOFSTEP] rw [← tensor_comp, tensor_id, Category.comp_id, ← Category.id_comp (η_ (ᘁY) Y), tensor_comp] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ ((((((η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ η_ (ᘁY) Y)) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y)) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y)) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y)) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [← tensor_id_comp_id_tensor (η_ (ᘁY) Y), ← tensor_id] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ ((((((η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y)) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y)) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y)) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y)) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] repeat' rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ ((((((η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y)) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y)) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y)) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y)) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (((((η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y)) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y)) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y)) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ ((((η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y)) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y)) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (((η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y)) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv) ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ ((η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y)) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y)) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ 𝟙 Y) ⊗ η_ (ᘁY) Y) ≫ (α_ (ᘁX ⊗ Y) (ᘁY) Y).inv ≫ ((α_ (ᘁX) Y ᘁY).hom ⊗ 𝟙 Y) ≫ ((𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [pentagon_inv_hom_assoc, ← associator_inv_naturality_assoc, associator_naturality_assoc] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) Y (𝟙_ C)).hom ≫ (𝟙 ᘁX ⊗ 𝟙 Y ⊗ η_ (ᘁY) Y) ≫ (𝟙 ᘁX ⊗ (α_ Y (ᘁY) Y).inv) ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y ⊗ 𝟙 Y) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] slice_rhs 5 7 => rw [← id_tensor_comp, ← id_tensor_comp, coevaluation_evaluation, id_tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ 𝟙 Y ⊗ η_ (ᘁY) Y) ≫ (𝟙 ᘁX ⊗ (α_ Y (ᘁY) Y).inv) ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y ⊗ 𝟙 Y) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) (𝟙_ C) Y).inv case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C) case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) Y (𝟙_ C)).hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, coevaluation_evaluation, id_tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ 𝟙 Y ⊗ η_ (ᘁY) Y) ≫ (𝟙 ᘁX ⊗ (α_ Y (ᘁY) Y).inv) ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y ⊗ 𝟙 Y) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) (𝟙_ C) Y).inv case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C) case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) Y (𝟙_ C)).hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, coevaluation_evaluation, id_tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ 𝟙 Y ⊗ η_ (ᘁY) Y) ≫ (𝟙 ᘁX ⊗ (α_ Y (ᘁY) Y).inv) ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y ⊗ 𝟙 Y) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) (𝟙_ C) Y).inv case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C) case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) Y (𝟙_ C)).hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, coevaluation_evaluation, id_tensor_comp] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) Y (𝟙_ C)).hom ≫ ((((𝟙 ᘁX ⊗ (ρ_ Y).hom) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv)) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y)) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [associator_naturality_assoc] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) X (𝟙_ C)).hom ≫ (𝟙 ᘁX ⊗ f ⊗ 𝟙 (𝟙_ C)) ≫ ((((𝟙 ᘁX ⊗ (ρ_ Y).hom) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv)) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y)) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] slice_rhs 4 5 => rw [← tensor_comp, rightUnitor_naturality, tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ f ⊗ 𝟙 (𝟙_ C)) ≫ (𝟙 ᘁX ⊗ (ρ_ Y).hom) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ (λ_ Y).inv case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) (𝟙_ C) Y).inv case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) X (𝟙_ C)).hom [PROOFSTEP] rw [← tensor_comp, rightUnitor_naturality, tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ f ⊗ 𝟙 (𝟙_ C)) ≫ (𝟙 ᘁX ⊗ (ρ_ Y).hom) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ (λ_ Y).inv case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) (𝟙_ C) Y).inv case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) X (𝟙_ C)).hom [PROOFSTEP] rw [← tensor_comp, rightUnitor_naturality, tensor_comp] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (𝟙 ᘁX ⊗ f ⊗ 𝟙 (𝟙_ C)) ≫ (𝟙 ᘁX ⊗ (ρ_ Y).hom) case a.a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ (λ_ Y).inv case a.a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) (𝟙_ C) Y).inv case a.a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (ρ_ ᘁX).hom ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | 𝟙 ᘁX ⊗ g case a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (λ_ tensorUnit').inv case a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z | (α_ (ᘁX) X (𝟙_ C)).hom [PROOFSTEP] rw [← tensor_comp, rightUnitor_naturality, tensor_comp] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) X (𝟙_ C)).hom ≫ (((((𝟙 ᘁX ⊗ (ρ_ X).hom) ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv)) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y)) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] repeat' rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) X (𝟙_ C)).hom ≫ (((((𝟙 ᘁX ⊗ (ρ_ X).hom) ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv)) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y)) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) X (𝟙_ C)).hom ≫ ((((𝟙 ᘁX ⊗ (ρ_ X).hom) ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv)) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) X (𝟙_ C)).hom ≫ (((𝟙 ᘁX ⊗ (ρ_ X).hom) ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv)) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) X (𝟙_ C)).hom ≫ ((𝟙 ᘁX ⊗ (ρ_ X).hom) ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) X (𝟙_ C)).hom ≫ (𝟙 ᘁX ⊗ (ρ_ X).hom) ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [@Category.assoc C] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ g) = (λ_ tensorUnit').inv ≫ (η_ (ᘁX) X ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (ᘁX) X (𝟙_ C)).hom ≫ (𝟙 ᘁX ⊗ (ρ_ X).hom) ≫ (𝟙 ᘁX ⊗ f) ≫ (𝟙 ᘁX ⊗ (λ_ Y).inv) ≫ (α_ (ᘁX) (𝟙_ C) Y).inv ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] rw [triangle_assoc_comp_left_inv_assoc, ← rightUnitor_tensor_assoc, rightUnitor_naturality_assoc, ← unitors_equal, ← Category.assoc, ← Category.assoc] [GOAL] case w.e_f C : Type u₁ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : MonoidalCategory C X Y Z : C inst✝² : HasLeftDual X inst✝¹ : HasLeftDual Y inst✝ : HasLeftDual Z f : X ⟶ Y g : Y ⟶ Z ⊢ (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f)) ≫ (𝟙 ᘁX ⊗ g) = ((λ_ tensorUnit').inv ≫ (λ_ (𝟙_ C)).hom) ≫ η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ≫ ((ρ_ ᘁX).inv ⊗ 𝟙 Y) ≫ ((ρ_ ᘁX).hom ⊗ 𝟙 Y) ≫ (𝟙 ᘁX ⊗ g) [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z ⊢ (fun f => (𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom) ((fun f => (λ_ X).inv ≫ (η_ Y Y' ⊗ 𝟙 X) ≫ (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ f)) f) = f [PROOFSTEP] dsimp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z ⊢ (𝟙 Y' ⊗ (λ_ X).inv ≫ (η_ Y Y' ⊗ 𝟙 X) ≫ (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ f)) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom = f [PROOFSTEP] simp only [id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z ⊢ ((𝟙 Y' ⊗ (λ_ X).inv) ≫ (𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (𝟙 Y' ⊗ 𝟙 Y ⊗ f)) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom = f [PROOFSTEP] slice_lhs 4 5 => rw [associator_inv_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (𝟙 Y' ⊗ 𝟙 Y ⊗ f) ≫ (α_ Y' Y Z).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | ε_ Y Y' ⊗ 𝟙 Z case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (α_ Y Y' X).hom [PROOFSTEP] rw [associator_inv_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (𝟙 Y' ⊗ 𝟙 Y ⊗ f) ≫ (α_ Y' Y Z).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | ε_ Y Y' ⊗ 𝟙 Z case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (α_ Y Y' X).hom [PROOFSTEP] rw [associator_inv_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (𝟙 Y' ⊗ 𝟙 Y ⊗ f) ≫ (α_ Y' Y Z).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | ε_ Y Y' ⊗ 𝟙 Z case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (α_ Y Y' X).hom [PROOFSTEP] rw [associator_inv_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z ⊢ (𝟙 Y' ⊗ (λ_ X).inv) ≫ (𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (((α_ Y' Y (Y' ⊗ X)).inv ≫ ((𝟙 Y' ⊗ 𝟙 Y) ⊗ f)) ≫ (ε_ Y Y' ⊗ 𝟙 Z)) ≫ (λ_ Z).hom = f [PROOFSTEP] slice_lhs 5 6 => rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | ((𝟙 Y' ⊗ 𝟙 Y) ⊗ f) ≫ (ε_ Y Y' ⊗ 𝟙 Z) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (α_ Y Y' X).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (α_ Y' Y (Y' ⊗ X)).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | ((𝟙 Y' ⊗ 𝟙 Y) ⊗ f) ≫ (ε_ Y Y' ⊗ 𝟙 Z) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (α_ Y Y' X).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (α_ Y' Y (Y' ⊗ X)).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | ((𝟙 Y' ⊗ 𝟙 Y) ⊗ f) ≫ (ε_ Y Y' ⊗ 𝟙 Z) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (α_ Y Y' X).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (α_ Y' Y (Y' ⊗ X)).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z ⊢ (𝟙 Y' ⊗ (λ_ X).inv) ≫ (𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ ((ε_ Y Y' ⊗ 𝟙 (Y' ⊗ X)) ≫ (𝟙 (𝟙_ C) ⊗ f)) ≫ (λ_ Z).hom = f [PROOFSTEP] slice_lhs 2 5 => simp only [← tensor_id, associator_inv_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (ε_ Y Y' ⊗ 𝟙 (Y' ⊗ X)) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 (𝟙_ C) ⊗ f case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv [PROOFSTEP] simp only [← tensor_id, associator_inv_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (ε_ Y Y' ⊗ 𝟙 (Y' ⊗ X)) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 (𝟙_ C) ⊗ f case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv [PROOFSTEP] simp only [← tensor_id, associator_inv_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (𝟙 Y' ⊗ η_ Y Y' ⊗ 𝟙 X) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (ε_ Y Y' ⊗ 𝟙 (Y' ⊗ X)) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 (𝟙_ C) ⊗ f case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z | 𝟙 Y' ⊗ (λ_ X).inv [PROOFSTEP] simp only [← tensor_id, associator_inv_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z ⊢ (𝟙 Y' ⊗ (λ_ X).inv) ≫ ((((α_ Y' tensorUnit' X).inv ≫ ((𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X) ≫ (α_ Y' (Y ⊗ Y') X).hom) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv ≫ ((ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X) ≫ (α_ (𝟙_ C) Y' X).hom) ≫ (𝟙 (𝟙_ C) ⊗ f)) ≫ (λ_ Z).hom = f [PROOFSTEP] have c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ _ _ _).inv ⊗ 𝟙 _ [GOAL] case c C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z ⊢ (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X ⊢ (𝟙 Y' ⊗ (λ_ X).inv) ≫ ((((α_ Y' tensorUnit' X).inv ≫ ((𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X) ≫ (α_ Y' (Y ⊗ Y') X).hom) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv ≫ ((ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X) ≫ (α_ (𝟙_ C) Y' X).hom) ≫ (𝟙 (𝟙_ C) ⊗ f)) ≫ (λ_ Z).hom = f [PROOFSTEP] pure_coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X ⊢ (𝟙 Y' ⊗ (λ_ X).inv) ≫ ((((α_ Y' tensorUnit' X).inv ≫ ((𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X) ≫ (α_ Y' (Y ⊗ Y') X).hom) ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv ≫ ((ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X) ≫ (α_ (𝟙_ C) Y' X).hom) ≫ (𝟙 (𝟙_ C) ⊗ f)) ≫ (λ_ Z).hom = f [PROOFSTEP] slice_lhs 4 7 => rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ (𝟙_ C) Y' X).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 (𝟙_ C) ⊗ f case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' tensorUnit' X).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X [PROOFSTEP] rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ (𝟙_ C) Y' X).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 (𝟙_ C) ⊗ f case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' tensorUnit' X).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X [PROOFSTEP] rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ (𝟙_ C) Y' X).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 (𝟙_ C) ⊗ f case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' tensorUnit' X).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X [PROOFSTEP] rw [c] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X ⊢ (𝟙 Y' ⊗ (λ_ X).inv) ≫ (α_ Y' tensorUnit' X).inv ≫ ((𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X) ≫ (((((α_ Y' Y Y').inv ⊗ 𝟙 X) ≫ ((ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X)) ≫ (α_ (𝟙_ C) Y' X).hom) ≫ (𝟙 (𝟙_ C) ⊗ f)) ≫ (λ_ Z).hom = f [PROOFSTEP] slice_lhs 3 5 => rw [← comp_tensor_id, ← comp_tensor_id, coevaluation_evaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | ((𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X) ≫ ((α_ Y' Y Y').inv ⊗ 𝟙 X) ≫ ((ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ (𝟙_ C) Y' X).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 (𝟙_ C) ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' tensorUnit' X).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, coevaluation_evaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | ((𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X) ≫ ((α_ Y' Y Y').inv ⊗ 𝟙 X) ≫ ((ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ (𝟙_ C) Y' X).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 (𝟙_ C) ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' tensorUnit' X).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, coevaluation_evaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | ((𝟙 Y' ⊗ η_ Y Y') ⊗ 𝟙 X) ≫ ((α_ Y' Y Y').inv ⊗ 𝟙 X) ≫ ((ε_ Y Y' ⊗ 𝟙 Y') ⊗ 𝟙 X) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ (𝟙_ C) Y' X).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 (𝟙_ C) ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | 𝟙 Y' ⊗ (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X | (α_ Y' tensorUnit' X).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, coevaluation_evaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X ⊢ (𝟙 Y' ⊗ (λ_ X).inv) ≫ (α_ Y' tensorUnit' X).inv ≫ ((((ρ_ Y').hom ≫ (λ_ Y').inv ⊗ 𝟙 X) ≫ (α_ (𝟙_ C) Y' X).hom) ≫ (𝟙 (𝟙_ C) ⊗ f)) ≫ (λ_ Z).hom = f [PROOFSTEP] simp only [leftUnitor_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z c : (α_ Y' (Y ⊗ Y') X).hom ≫ (𝟙 Y' ⊗ (α_ Y Y' X).hom) ≫ (α_ Y' Y (Y' ⊗ X)).inv ≫ (α_ (Y' ⊗ Y) Y' X).inv = (α_ Y' Y Y').inv ⊗ 𝟙 X ⊢ (𝟙 Y' ⊗ (λ_ X).inv) ≫ (α_ Y' tensorUnit' X).inv ≫ ((((ρ_ Y').hom ≫ (λ_ Y').inv ⊗ 𝟙 X) ≫ (α_ (𝟙_ C) Y' X).hom) ≫ (λ_ (Y' ⊗ X)).hom ≫ f ≫ (λ_ Z).inv) ≫ (λ_ Z).hom = f [PROOFSTEP] coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z ⊢ (fun f => (λ_ X).inv ≫ (η_ Y Y' ⊗ 𝟙 X) ≫ (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ f)) ((fun f => (𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom) f) = f [PROOFSTEP] dsimp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z ⊢ (λ_ X).inv ≫ (η_ Y Y' ⊗ 𝟙 X) ≫ (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ (𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom) = f [PROOFSTEP] simp only [id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z ⊢ (λ_ X).inv ≫ (η_ Y Y' ⊗ 𝟙 X) ≫ (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ 𝟙 Y' ⊗ f) ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] slice_lhs 3 4 => rw [← associator_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ 𝟙 Y' ⊗ f) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (α_ Y' Y Z).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | η_ Y Y' ⊗ 𝟙 X [PROOFSTEP] rw [← associator_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ 𝟙 Y' ⊗ f) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (α_ Y' Y Z).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | η_ Y Y' ⊗ 𝟙 X [PROOFSTEP] rw [← associator_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ 𝟙 Y' ⊗ f) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (α_ Y' Y Z).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | η_ Y Y' ⊗ 𝟙 X [PROOFSTEP] rw [← associator_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z ⊢ (λ_ X).inv ≫ (η_ Y Y' ⊗ 𝟙 X) ≫ (((((𝟙 Y ⊗ 𝟙 Y') ⊗ f) ≫ (α_ Y Y' (Y ⊗ Z)).hom) ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv)) ≫ (𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z)) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] slice_lhs 2 3 => rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (η_ Y Y' ⊗ 𝟙 X) ≫ ((𝟙 Y ⊗ 𝟙 Y') ⊗ f) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (α_ Y Y' (Y ⊗ Z)).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (α_ Y' Y Z).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (η_ Y Y' ⊗ 𝟙 X) ≫ ((𝟙 Y ⊗ 𝟙 Y') ⊗ f) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (α_ Y Y' (Y ⊗ Z)).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (α_ Y' Y Z).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (η_ Y Y' ⊗ 𝟙 X) ≫ ((𝟙 Y ⊗ 𝟙 Y') ⊗ f) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (α_ Y Y' (Y ⊗ Z)).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (α_ Y' Y Z).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z ⊢ (λ_ X).inv ≫ (((((𝟙 tensorUnit' ⊗ f) ≫ (η_ Y Y' ⊗ 𝟙 (Y ⊗ Z))) ≫ (α_ Y Y' (Y ⊗ Z)).hom) ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv)) ≫ (𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z)) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] slice_lhs 3 6 => simp only [← tensor_id, associator_inv_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (η_ Y Y' ⊗ 𝟙 (Y ⊗ Z)) ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 tensorUnit' ⊗ f [PROOFSTEP] simp only [← tensor_id, associator_inv_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (η_ Y Y' ⊗ 𝟙 (Y ⊗ Z)) ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 tensorUnit' ⊗ f [PROOFSTEP] simp only [← tensor_id, associator_inv_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (η_ Y Y' ⊗ 𝟙 (Y ⊗ Z)) ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (𝟙 Y ⊗ ε_ Y Y' ⊗ 𝟙 Z) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z | 𝟙 tensorUnit' ⊗ f [PROOFSTEP] simp only [← tensor_id, associator_inv_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z ⊢ (λ_ X).inv ≫ (𝟙 tensorUnit' ⊗ f) ≫ (((α_ tensorUnit' Y Z).inv ≫ ((η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z) ≫ (α_ (Y ⊗ Y') Y Z).hom) ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv ≫ ((𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z) ≫ (α_ Y (𝟙_ C) Z).hom) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] have c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ _ _ _).hom ⊗ 𝟙 Z [GOAL] case c C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z ⊢ (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z ⊢ (λ_ X).inv ≫ (𝟙 tensorUnit' ⊗ f) ≫ (((α_ tensorUnit' Y Z).inv ≫ ((η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z) ≫ (α_ (Y ⊗ Y') Y Z).hom) ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv ≫ ((𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z) ≫ (α_ Y (𝟙_ C) Z).hom) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] pure_coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z ⊢ (λ_ X).inv ≫ (𝟙 tensorUnit' ⊗ f) ≫ (((α_ tensorUnit' Y Z).inv ≫ ((η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z) ≫ (α_ (Y ⊗ Y') Y Z).hom) ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv ≫ ((𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z) ≫ (α_ Y (𝟙_ C) Z).hom) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] slice_lhs 5 8 => rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ Y (𝟙_ C) Z).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 tensorUnit' ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ tensorUnit' Y Z).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z [PROOFSTEP] rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ Y (𝟙_ C) Z).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 tensorUnit' ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ tensorUnit' Y Z).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z [PROOFSTEP] rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ Y (𝟙_ C) Z).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 tensorUnit' ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ tensorUnit' Y Z).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z [PROOFSTEP] rw [c] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z ⊢ (λ_ X).inv ≫ (𝟙 tensorUnit' ⊗ f) ≫ (α_ tensorUnit' Y Z).inv ≫ ((η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z) ≫ ((((α_ Y Y' Y).hom ⊗ 𝟙 Z) ≫ ((𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z)) ≫ (α_ Y (𝟙_ C) Z).hom) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] slice_lhs 4 6 => rw [← comp_tensor_id, ← comp_tensor_id, evaluation_coevaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | ((η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z) ≫ ((α_ Y Y' Y).hom ⊗ 𝟙 Z) ≫ ((𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ Y (𝟙_ C) Z).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 tensorUnit' ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ tensorUnit' Y Z).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, evaluation_coevaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | ((η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z) ≫ ((α_ Y Y' Y).hom ⊗ 𝟙 Z) ≫ ((𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ Y (𝟙_ C) Z).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 tensorUnit' ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ tensorUnit' Y Z).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, evaluation_coevaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | ((η_ Y Y' ⊗ 𝟙 Y) ⊗ 𝟙 Z) ≫ ((α_ Y Y' Y).hom ⊗ 𝟙 Z) ≫ ((𝟙 Y ⊗ ε_ Y Y') ⊗ 𝟙 Z) case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ Y (𝟙_ C) Z).hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 Y ⊗ (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (λ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | 𝟙 tensorUnit' ⊗ f case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z | (α_ tensorUnit' Y Z).inv [PROOFSTEP] rw [← comp_tensor_id, ← comp_tensor_id, evaluation_coevaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z ⊢ (λ_ X).inv ≫ (𝟙 tensorUnit' ⊗ f) ≫ (α_ tensorUnit' Y Z).inv ≫ (((λ_ Y).hom ≫ (ρ_ Y).inv ⊗ 𝟙 Z) ≫ (α_ Y (𝟙_ C) Z).hom) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] simp only [leftUnitor_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z c : (α_ (Y ⊗ Y') Y Z).hom ≫ (α_ Y Y' (Y ⊗ Z)).hom ≫ (𝟙 Y ⊗ (α_ Y' Y Z).inv) ≫ (α_ Y (Y' ⊗ Y) Z).inv = (α_ Y Y' Y).hom ⊗ 𝟙 Z ⊢ (λ_ X).inv ≫ ((λ_ X).hom ≫ f ≫ (λ_ (Y ⊗ Z)).inv) ≫ (α_ tensorUnit' Y Z).inv ≫ (((λ_ Y).hom ≫ (ρ_ Y).inv ⊗ 𝟙 Z) ≫ (α_ Y (𝟙_ C) Z).hom) ≫ (𝟙 Y ⊗ (λ_ Z).hom) = f [PROOFSTEP] coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z ⊢ (fun f => (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) ((fun f => (ρ_ X).inv ≫ (𝟙 X ⊗ η_ Y Y') ≫ (α_ X Y Y').inv ≫ (f ⊗ 𝟙 Y')) f) = f [PROOFSTEP] dsimp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z ⊢ ((ρ_ X).inv ≫ (𝟙 X ⊗ η_ Y Y') ≫ (α_ X Y Y').inv ≫ (f ⊗ 𝟙 Y') ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom = f [PROOFSTEP] simp only [comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z ⊢ (((ρ_ X).inv ⊗ 𝟙 Y) ≫ ((𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ ((f ⊗ 𝟙 Y') ⊗ 𝟙 Y)) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom = f [PROOFSTEP] slice_lhs 4 5 => rw [associator_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | ((f ⊗ 𝟙 Y') ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | 𝟙 Z ⊗ ε_ Y Y' case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ X Y Y').inv ⊗ 𝟙 Y [PROOFSTEP] rw [associator_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | ((f ⊗ 𝟙 Y') ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | 𝟙 Z ⊗ ε_ Y Y' case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ X Y Y').inv ⊗ 𝟙 Y [PROOFSTEP] rw [associator_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | ((f ⊗ 𝟙 Y') ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | 𝟙 Z ⊗ ε_ Y Y' case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ X Y Y').inv ⊗ 𝟙 Y [PROOFSTEP] rw [associator_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z ⊢ ((ρ_ X).inv ⊗ 𝟙 Y) ≫ ((𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (((α_ (X ⊗ Y) Y' Y).hom ≫ (f ⊗ 𝟙 Y' ⊗ 𝟙 Y)) ≫ (𝟙 Z ⊗ ε_ Y Y')) ≫ (ρ_ Z).hom = f [PROOFSTEP] slice_lhs 5 6 => rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (f ⊗ 𝟙 Y' ⊗ 𝟙 Y) ≫ (𝟙 Z ⊗ ε_ Y Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ X Y Y').inv ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ (X ⊗ Y) Y' Y).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (f ⊗ 𝟙 Y' ⊗ 𝟙 Y) ≫ (𝟙 Z ⊗ ε_ Y Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ X Y Y').inv ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ (X ⊗ Y) Y' Y).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (f ⊗ 𝟙 Y' ⊗ 𝟙 Y) ≫ (𝟙 Z ⊗ ε_ Y Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ X Y Y').inv ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (α_ (X ⊗ Y) Y' Y).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z ⊢ ((ρ_ X).inv ⊗ 𝟙 Y) ≫ ((𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ ((𝟙 (X ⊗ Y) ⊗ ε_ Y Y') ≫ (f ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ Z).hom = f [PROOFSTEP] slice_lhs 2 5 => simp only [← tensor_id, associator_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | ((𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (𝟙 (X ⊗ Y) ⊗ ε_ Y Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | f ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y [PROOFSTEP] simp only [← tensor_id, associator_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | ((𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (𝟙 (X ⊗ Y) ⊗ ε_ Y Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | f ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y [PROOFSTEP] simp only [← tensor_id, associator_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | ((𝟙 X ⊗ η_ Y Y') ⊗ 𝟙 Y) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (𝟙 (X ⊗ Y) ⊗ ε_ Y Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | f ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z | (ρ_ X).inv ⊗ 𝟙 Y [PROOFSTEP] simp only [← tensor_id, associator_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z ⊢ ((ρ_ X).inv ⊗ 𝟙 Y) ≫ ((((α_ X tensorUnit' Y).hom ≫ (𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y) ≫ (α_ X (Y ⊗ Y') Y).inv) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom ≫ (𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y') ≫ (α_ X Y (𝟙_ C)).inv) ≫ (f ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ Z).hom = f [PROOFSTEP] have c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 _ ⊗ (α_ _ _ _).hom [GOAL] case c C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z ⊢ (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom ⊢ ((ρ_ X).inv ⊗ 𝟙 Y) ≫ ((((α_ X tensorUnit' Y).hom ≫ (𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y) ≫ (α_ X (Y ⊗ Y') Y).inv) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom ≫ (𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y') ≫ (α_ X Y (𝟙_ C)).inv) ≫ (f ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ Z).hom = f [PROOFSTEP] pure_coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom ⊢ ((ρ_ X).inv ⊗ 𝟙 Y) ≫ ((((α_ X tensorUnit' Y).hom ≫ (𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y) ≫ (α_ X (Y ⊗ Y') Y).inv) ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom ≫ (𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y') ≫ (α_ X Y (𝟙_ C)).inv) ≫ (f ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ Z).hom = f [PROOFSTEP] slice_lhs 4 7 => rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | 𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y' case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X Y (𝟙_ C)).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | f ⊗ 𝟙 (𝟙_ C) case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X tensorUnit' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | 𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y [PROOFSTEP] rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | 𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y' case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X Y (𝟙_ C)).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | f ⊗ 𝟙 (𝟙_ C) case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X tensorUnit' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | 𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y [PROOFSTEP] rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | 𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y' case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X Y (𝟙_ C)).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | f ⊗ 𝟙 (𝟙_ C) case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X tensorUnit' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | 𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y [PROOFSTEP] rw [c] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom ⊢ ((ρ_ X).inv ⊗ 𝟙 Y) ≫ (α_ X tensorUnit' Y).hom ≫ (𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y) ≫ ((((𝟙 X ⊗ (α_ Y Y' Y).hom) ≫ (𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y')) ≫ (α_ X Y (𝟙_ C)).inv) ≫ (f ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ Z).hom = f [PROOFSTEP] slice_lhs 3 5 => rw [← id_tensor_comp, ← id_tensor_comp, evaluation_coevaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y) ≫ (𝟙 X ⊗ (α_ Y Y' Y).hom) ≫ (𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X Y (𝟙_ C)).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | f ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X tensorUnit' Y).hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, evaluation_coevaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y) ≫ (𝟙 X ⊗ (α_ Y Y' Y).hom) ≫ (𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X Y (𝟙_ C)).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | f ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X tensorUnit' Y).hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, evaluation_coevaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (𝟙 X ⊗ η_ Y Y' ⊗ 𝟙 Y) ≫ (𝟙 X ⊗ (α_ Y Y' Y).hom) ≫ (𝟙 X ⊗ 𝟙 Y ⊗ ε_ Y Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X Y (𝟙_ C)).inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | f ⊗ 𝟙 (𝟙_ C) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (ρ_ X).inv ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom | (α_ X tensorUnit' Y).hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, evaluation_coevaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom ⊢ ((ρ_ X).inv ⊗ 𝟙 Y) ≫ (α_ X tensorUnit' Y).hom ≫ (((𝟙 X ⊗ (λ_ Y).hom ≫ (ρ_ Y).inv) ≫ (α_ X Y (𝟙_ C)).inv) ≫ (f ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ Z).hom = f [PROOFSTEP] simp only [rightUnitor_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z c : (α_ X (Y ⊗ Y') Y).inv ≫ ((α_ X Y Y').inv ⊗ 𝟙 Y) ≫ (α_ (X ⊗ Y) Y' Y).hom ≫ (α_ X Y (Y' ⊗ Y)).hom = 𝟙 X ⊗ (α_ Y Y' Y).hom ⊢ ((ρ_ X).inv ⊗ 𝟙 Y) ≫ (α_ X tensorUnit' Y).hom ≫ (((𝟙 X ⊗ (λ_ Y).hom ≫ (ρ_ Y).inv) ≫ (α_ X Y (𝟙_ C)).inv) ≫ (ρ_ (X ⊗ Y)).hom ≫ f ≫ (ρ_ Z).inv) ≫ (ρ_ Z).hom = f [PROOFSTEP] coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' ⊢ (fun f => (ρ_ X).inv ≫ (𝟙 X ⊗ η_ Y Y') ≫ (α_ X Y Y').inv ≫ (f ⊗ 𝟙 Y')) ((fun f => (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) f) = f [PROOFSTEP] dsimp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' ⊢ (ρ_ X).inv ≫ (𝟙 X ⊗ η_ Y Y') ≫ (α_ X Y Y').inv ≫ ((f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] simp only [comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' ⊢ (ρ_ X).inv ≫ (𝟙 X ⊗ η_ Y Y') ≫ (α_ X Y Y').inv ≫ ((f ⊗ 𝟙 Y) ⊗ 𝟙 Y') ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ ((𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y') ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] slice_lhs 3 4 => rw [← associator_inv_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ X Y Y').inv ≫ ((f ⊗ 𝟙 Y) ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ Z Y' Y).hom ⊗ 𝟙 Y' case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | 𝟙 X ⊗ η_ Y Y' [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ X Y Y').inv ≫ ((f ⊗ 𝟙 Y) ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ Z Y' Y).hom ⊗ 𝟙 Y' case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | 𝟙 X ⊗ η_ Y Y' [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ X Y Y').inv ≫ ((f ⊗ 𝟙 Y) ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ Z Y' Y).hom ⊗ 𝟙 Y' case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | 𝟙 X ⊗ η_ Y Y' [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' ⊢ (ρ_ X).inv ≫ (𝟙 X ⊗ η_ Y Y') ≫ ((((f ⊗ 𝟙 Y ⊗ 𝟙 Y') ≫ (α_ (Z ⊗ Y') Y Y').inv) ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y')) ≫ ((𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y')) ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] slice_lhs 2 3 => rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 X ⊗ η_ Y Y') ≫ (f ⊗ 𝟙 Y ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ (Z ⊗ Y') Y Y').inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ Z Y' Y).hom ⊗ 𝟙 Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 X ⊗ η_ Y Y') ≫ (f ⊗ 𝟙 Y ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ (Z ⊗ Y') Y Y').inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ Z Y' Y).hom ⊗ 𝟙 Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 X ⊗ η_ Y Y') ≫ (f ⊗ 𝟙 Y ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ (Z ⊗ Y') Y Y').inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (α_ Z Y' Y).hom ⊗ 𝟙 Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' ⊢ (ρ_ X).inv ≫ (((((f ⊗ 𝟙 tensorUnit') ≫ (𝟙 (Z ⊗ Y') ⊗ η_ Y Y')) ≫ (α_ (Z ⊗ Y') Y Y').inv) ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y')) ≫ ((𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y')) ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] slice_lhs 3 6 => simp only [← tensor_id, associator_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 (Z ⊗ Y') ⊗ η_ Y Y') ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ ((𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | f ⊗ 𝟙 tensorUnit' [PROOFSTEP] simp only [← tensor_id, associator_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 (Z ⊗ Y') ⊗ η_ Y Y') ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ ((𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | f ⊗ 𝟙 tensorUnit' [PROOFSTEP] simp only [← tensor_id, associator_conjugation] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (𝟙 (Z ⊗ Y') ⊗ η_ Y Y') ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ ((𝟙 Z ⊗ ε_ Y Y') ⊗ 𝟙 Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' | f ⊗ 𝟙 tensorUnit' [PROOFSTEP] simp only [← tensor_id, associator_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' ⊢ (ρ_ X).inv ≫ (f ⊗ 𝟙 tensorUnit') ≫ (((α_ Z Y' tensorUnit').hom ≫ (𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y') ≫ (α_ Z Y' (Y ⊗ Y')).inv) ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom ≫ (𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y') ≫ (α_ Z (𝟙_ C) Y').inv) ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] have c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 _ ⊗ (α_ _ _ _).inv [GOAL] case c C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' ⊢ (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv ⊢ (ρ_ X).inv ≫ (f ⊗ 𝟙 tensorUnit') ≫ (((α_ Z Y' tensorUnit').hom ≫ (𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y') ≫ (α_ Z Y' (Y ⊗ Y')).inv) ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom ≫ (𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y') ≫ (α_ Z (𝟙_ C) Y').inv) ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] pure_coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv ⊢ (ρ_ X).inv ≫ (f ⊗ 𝟙 tensorUnit') ≫ (((α_ Z Y' tensorUnit').hom ≫ (𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y') ≫ (α_ Z Y' (Y ⊗ Y')).inv) ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom ≫ (𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y') ≫ (α_ Z (𝟙_ C) Y').inv) ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] slice_lhs 5 8 => rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | 𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y' case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z (𝟙_ C) Y').inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | f ⊗ 𝟙 tensorUnit' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' tensorUnit').hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | 𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y' [PROOFSTEP] rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | 𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y' case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z (𝟙_ C) Y').inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | f ⊗ 𝟙 tensorUnit' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' tensorUnit').hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | 𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y' [PROOFSTEP] rw [c] [GOAL] case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom case a.a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | 𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y' case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z (𝟙_ C) Y').inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | f ⊗ 𝟙 tensorUnit' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' tensorUnit').hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | 𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y' [PROOFSTEP] rw [c] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv ⊢ (ρ_ X).inv ≫ (f ⊗ 𝟙 tensorUnit') ≫ (α_ Z Y' tensorUnit').hom ≫ (𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y') ≫ (((𝟙 Z ⊗ (α_ Y' Y Y').inv) ≫ (𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y')) ≫ (α_ Z (𝟙_ C) Y').inv) ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] slice_lhs 4 6 => rw [← id_tensor_comp, ← id_tensor_comp, coevaluation_evaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y') ≫ (𝟙 Z ⊗ (α_ Y' Y Y').inv) ≫ (𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z (𝟙_ C) Y').inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | f ⊗ 𝟙 tensorUnit' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' tensorUnit').hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, coevaluation_evaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y') ≫ (𝟙 Z ⊗ (α_ Y' Y Y').inv) ≫ (𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z (𝟙_ C) Y').inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | f ⊗ 𝟙 tensorUnit' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' tensorUnit').hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, coevaluation_evaluation] [GOAL] case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (𝟙 Z ⊗ 𝟙 Y' ⊗ η_ Y Y') ≫ (𝟙 Z ⊗ (α_ Y' Y Y').inv) ≫ (𝟙 Z ⊗ ε_ Y Y' ⊗ 𝟙 Y') case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z (𝟙_ C) Y').inv case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ Z).hom ⊗ 𝟙 Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (ρ_ X).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | f ⊗ 𝟙 tensorUnit' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv | (α_ Z Y' tensorUnit').hom [PROOFSTEP] rw [← id_tensor_comp, ← id_tensor_comp, coevaluation_evaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv ⊢ (ρ_ X).inv ≫ (f ⊗ 𝟙 tensorUnit') ≫ (α_ Z Y' tensorUnit').hom ≫ ((𝟙 Z ⊗ (ρ_ Y').hom ≫ (λ_ Y').inv) ≫ (α_ Z (𝟙_ C) Y').inv) ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] simp only [rightUnitor_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' c : (α_ Z Y' (Y ⊗ Y')).inv ≫ (α_ (Z ⊗ Y') Y Y').inv ≫ ((α_ Z Y' Y).hom ⊗ 𝟙 Y') ≫ (α_ Z (Y' ⊗ Y) Y').hom = 𝟙 Z ⊗ (α_ Y' Y Y').inv ⊢ (ρ_ X).inv ≫ ((ρ_ X).hom ≫ f ≫ (ρ_ (Z ⊗ Y')).inv) ≫ (α_ Z Y' tensorUnit').hom ≫ ((𝟙 Z ⊗ (ρ_ Y').hom ≫ (λ_ Y').inv) ≫ (α_ Z (𝟙_ C) Y').inv) ≫ ((ρ_ Z).hom ⊗ 𝟙 Y') = f [PROOFSTEP] coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z g : Z ⟶ Z' ⊢ ↑(tensorLeftHomEquiv X Y Y' Z') (f ≫ g) = ↑(tensorLeftHomEquiv X Y Y' Z) f ≫ (𝟙 Y ⊗ g) [PROOFSTEP] dsimp [tensorLeftHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : Y' ⊗ X ⟶ Z g : Z ⟶ Z' ⊢ (λ_ X).inv ≫ (η_ Y Y' ⊗ 𝟙 X) ≫ (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ f ≫ g) = ((λ_ X).inv ≫ (η_ Y Y' ⊗ 𝟙 X) ≫ (α_ Y Y' X).hom ≫ (𝟙 Y ⊗ f)) ≫ (𝟙 Y ⊗ g) [PROOFSTEP] simp only [id_tensor_comp, Category.assoc] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ X' g : X' ⟶ Y ⊗ Z ⊢ ↑(tensorLeftHomEquiv X Y Y' Z).symm (f ≫ g) = (𝟙 Y' ⊗ f) ≫ ↑(tensorLeftHomEquiv X' Y Y' Z).symm g [PROOFSTEP] dsimp [tensorLeftHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ X' g : X' ⟶ Y ⊗ Z ⊢ (𝟙 Y' ⊗ f ≫ g) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom = (𝟙 Y' ⊗ f) ≫ (𝟙 Y' ⊗ g) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom [PROOFSTEP] simp only [id_tensor_comp, Category.assoc] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z g : Z ⟶ Z' ⊢ ↑(tensorRightHomEquiv X Y Y' Z') (f ≫ g) = ↑(tensorRightHomEquiv X Y Y' Z) f ≫ (g ⊗ 𝟙 Y') [PROOFSTEP] dsimp [tensorRightHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⊗ Y ⟶ Z g : Z ⟶ Z' ⊢ (ρ_ X).inv ≫ (𝟙 X ⊗ η_ Y Y') ≫ (α_ X Y Y').inv ≫ (f ≫ g ⊗ 𝟙 Y') = ((ρ_ X).inv ≫ (𝟙 X ⊗ η_ Y Y') ≫ (α_ X Y Y').inv ≫ (f ⊗ 𝟙 Y')) ≫ (g ⊗ 𝟙 Y') [PROOFSTEP] simp only [comp_tensor_id, Category.assoc] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ X' g : X' ⟶ Z ⊗ Y' ⊢ ↑(tensorRightHomEquiv X Y Y' Z).symm (f ≫ g) = (f ⊗ 𝟙 Y) ≫ ↑(tensorRightHomEquiv X' Y Y' Z).symm g [PROOFSTEP] dsimp [tensorRightHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z : C inst✝ : ExactPairing Y Y' f : X ⟶ X' g : X' ⟶ Z ⊗ Y' ⊢ (f ≫ g ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom = (f ⊗ 𝟙 Y) ≫ (g ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom [PROOFSTEP] simp only [comp_tensor_id, Category.assoc] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' ⊢ ↑(tensorLeftHomEquiv (X ⊗ X') Y Y' (Z ⊗ Z')).symm ((f ⊗ g) ≫ (α_ Y Z Z').hom) = (α_ Y' X X').inv ≫ (↑(tensorLeftHomEquiv X Y Y' Z).symm f ⊗ g) [PROOFSTEP] dsimp [tensorLeftHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' ⊢ (𝟙 Y' ⊗ (f ⊗ g) ≫ (α_ Y Z Z').hom) ≫ (α_ Y' Y (Z ⊗ Z')).inv ≫ (ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z')) ≫ (λ_ (Z ⊗ Z')).hom = (α_ Y' X X').inv ≫ ((𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom ⊗ g) [PROOFSTEP] simp only [id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' ⊢ ((𝟙 Y' ⊗ f ⊗ g) ≫ (𝟙 Y' ⊗ (α_ Y Z Z').hom)) ≫ (α_ Y' Y (Z ⊗ Z')).inv ≫ (ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z')) ≫ (λ_ (Z ⊗ Z')).hom = (α_ Y' X X').inv ≫ ((𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom ⊗ g) [PROOFSTEP] simp only [associator_inv_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' ⊢ (((α_ Y' X X').inv ≫ ((𝟙 Y' ⊗ f) ⊗ g) ≫ (α_ Y' (Y ⊗ Z) Z').hom) ≫ (𝟙 Y' ⊗ (α_ Y Z Z').hom)) ≫ (α_ Y' Y (Z ⊗ Z')).inv ≫ (ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z')) ≫ (λ_ (Z ⊗ Z')).hom = (α_ Y' X X').inv ≫ ((𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom ⊗ g) [PROOFSTEP] slice_lhs 2 2 => rw [← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (𝟙 Y' ⊗ f) ⊗ g case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' (Y ⊗ Z) Z').hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | 𝟙 Y' ⊗ (α_ Y Z Z').hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' Y (Z ⊗ Z')).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (λ_ (Z ⊗ Z')).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' X X').inv [PROOFSTEP] rw [← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (𝟙 Y' ⊗ f) ⊗ g case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' (Y ⊗ Z) Z').hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | 𝟙 Y' ⊗ (α_ Y Z Z').hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' Y (Z ⊗ Z')).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (λ_ (Z ⊗ Z')).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' X X').inv [PROOFSTEP] rw [← id_tensor_comp_tensor_id] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (𝟙 Y' ⊗ f) ⊗ g case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' (Y ⊗ Z) Z').hom case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | 𝟙 Y' ⊗ (α_ Y Z Z').hom case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' Y (Z ⊗ Z')).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (λ_ (Z ⊗ Z')).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' X X').inv [PROOFSTEP] rw [← id_tensor_comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' ⊢ (α_ Y' X X').inv ≫ ((((((𝟙 (Y' ⊗ X) ⊗ g) ≫ ((𝟙 Y' ⊗ f) ⊗ 𝟙 Z')) ≫ (α_ Y' (Y ⊗ Z) Z').hom) ≫ (𝟙 Y' ⊗ (α_ Y Z Z').hom)) ≫ (α_ Y' Y (Z ⊗ Z')).inv) ≫ (ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z'))) ≫ (λ_ (Z ⊗ Z')).hom = (α_ Y' X X').inv ≫ ((𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom ⊗ g) [PROOFSTEP] conv_rhs => rw [← id_tensor_comp_tensor_id, comp_tensor_id, comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' X X').inv ≫ ((𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom ⊗ g) [PROOFSTEP] rw [← id_tensor_comp_tensor_id, comp_tensor_id, comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' X X').inv ≫ ((𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom ⊗ g) [PROOFSTEP] rw [← id_tensor_comp_tensor_id, comp_tensor_id, comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' | (α_ Y' X X').inv ≫ ((𝟙 Y' ⊗ f) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom ⊗ g) [PROOFSTEP] rw [← id_tensor_comp_tensor_id, comp_tensor_id, comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' ⊢ (α_ Y' X X').inv ≫ ((((((𝟙 (Y' ⊗ X) ⊗ g) ≫ ((𝟙 Y' ⊗ f) ⊗ 𝟙 Z')) ≫ (α_ Y' (Y ⊗ Z) Z').hom) ≫ (𝟙 Y' ⊗ (α_ Y Z Z').hom)) ≫ (α_ Y' Y (Z ⊗ Z')).inv) ≫ (ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z'))) ≫ (λ_ (Z ⊗ Z')).hom = (α_ Y' X X').inv ≫ (𝟙 (Y' ⊗ X) ⊗ g) ≫ ((𝟙 Y' ⊗ f) ⊗ 𝟙 Z') ≫ ((α_ Y' Y Z).inv ⊗ 𝟙 Z') ≫ ((ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom ⊗ 𝟙 Z') [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Y ⊗ Z g : X' ⟶ Z' ⊢ (𝟙 (Y' ⊗ X) ⊗ g) ≫ (α_ Y' X Z').hom ≫ (𝟙 Y' ⊗ f ⊗ 𝟙 Z') ≫ (𝟙 Y' ⊗ (α_ Y Z Z').hom) ≫ (α_ Y' Y (Z ⊗ Z')).inv ≫ (ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z')) ≫ (α_ (𝟙_ C) Z Z').inv ≫ ((λ_ Z).hom ⊗ 𝟙 Z') = (𝟙 (Y' ⊗ X) ⊗ g) ≫ (α_ Y' X Z').hom ≫ (𝟙 Y' ⊗ f ⊗ 𝟙 Z') ≫ (α_ Y' (Y ⊗ Z) Z').inv ≫ ((α_ Y' Y Z).inv ⊗ 𝟙 Z') ≫ (α_ (Y' ⊗ Y) Z Z').hom ≫ (ε_ Y Y' ⊗ 𝟙 (Z ⊗ Z')) ≫ (α_ (𝟙_ C) Z Z').inv ≫ ((λ_ Z).hom ⊗ 𝟙 Z') [PROOFSTEP] coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' ⊢ ↑(tensorRightHomEquiv (X' ⊗ X) Y Y' (Z' ⊗ Z)).symm ((g ⊗ f) ≫ (α_ Z' Z Y').inv) = (α_ X' X Y).hom ≫ (g ⊗ ↑(tensorRightHomEquiv X Y Y' Z).symm f) [PROOFSTEP] dsimp [tensorRightHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' ⊢ ((g ⊗ f) ≫ (α_ Z' Z Y').inv ⊗ 𝟙 Y) ≫ (α_ (Z' ⊗ Z) Y' Y).hom ≫ (𝟙 (Z' ⊗ Z) ⊗ ε_ Y Y') ≫ (ρ_ (Z' ⊗ Z)).hom = (α_ X' X Y).hom ≫ (g ⊗ (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] simp only [comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' ⊢ (((g ⊗ f) ⊗ 𝟙 Y) ≫ ((α_ Z' Z Y').inv ⊗ 𝟙 Y)) ≫ (α_ (Z' ⊗ Z) Y' Y).hom ≫ (𝟙 (Z' ⊗ Z) ⊗ ε_ Y Y') ≫ (ρ_ (Z' ⊗ Z)).hom = (α_ X' X Y).hom ≫ (g ⊗ (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] simp only [associator_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' ⊢ (((α_ X' X Y).hom ≫ (g ⊗ f ⊗ 𝟙 Y) ≫ (α_ Z' (Z ⊗ Y') Y).inv) ≫ ((α_ Z' Z Y').inv ⊗ 𝟙 Y)) ≫ (α_ (Z' ⊗ Z) Y' Y).hom ≫ (𝟙 (Z' ⊗ Z) ⊗ ε_ Y Y') ≫ (ρ_ (Z' ⊗ Z)).hom = (α_ X' X Y).hom ≫ (g ⊗ (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] slice_lhs 2 2 => rw [← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | g ⊗ f ⊗ 𝟙 Y case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ Z' (Z ⊗ Y') Y).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ Z' Z Y').inv ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ (Z' ⊗ Z) Y' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | 𝟙 (Z' ⊗ Z) ⊗ ε_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (ρ_ (Z' ⊗ Z)).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ X' X Y).hom [PROOFSTEP] rw [← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | g ⊗ f ⊗ 𝟙 Y case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ Z' (Z ⊗ Y') Y).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ Z' Z Y').inv ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ (Z' ⊗ Z) Y' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | 𝟙 (Z' ⊗ Z) ⊗ ε_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (ρ_ (Z' ⊗ Z)).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ X' X Y).hom [PROOFSTEP] rw [← tensor_id_comp_id_tensor] [GOAL] case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | g ⊗ f ⊗ 𝟙 Y case a.a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ Z' (Z ⊗ Y') Y).inv case a.a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ Z' Z Y').inv ⊗ 𝟙 Y case a.a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ (Z' ⊗ Z) Y' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | 𝟙 (Z' ⊗ Z) ⊗ ε_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (ρ_ (Z' ⊗ Z)).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ X' X Y).hom [PROOFSTEP] rw [← tensor_id_comp_id_tensor] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' ⊢ (α_ X' X Y).hom ≫ ((((((g ⊗ 𝟙 (X ⊗ Y)) ≫ (𝟙 Z' ⊗ f ⊗ 𝟙 Y)) ≫ (α_ Z' (Z ⊗ Y') Y).inv) ≫ ((α_ Z' Z Y').inv ⊗ 𝟙 Y)) ≫ (α_ (Z' ⊗ Z) Y' Y).hom) ≫ (𝟙 (Z' ⊗ Z) ⊗ ε_ Y Y')) ≫ (ρ_ (Z' ⊗ Z)).hom = (α_ X' X Y).hom ≫ (g ⊗ (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] conv_rhs => rw [← tensor_id_comp_id_tensor, id_tensor_comp, id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ X' X Y).hom ≫ (g ⊗ (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] rw [← tensor_id_comp_id_tensor, id_tensor_comp, id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ X' X Y).hom ≫ (g ⊗ (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] rw [← tensor_id_comp_id_tensor, id_tensor_comp, id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' | (α_ X' X Y).hom ≫ (g ⊗ (f ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] rw [← tensor_id_comp_id_tensor, id_tensor_comp, id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' ⊢ (α_ X' X Y).hom ≫ ((((((g ⊗ 𝟙 (X ⊗ Y)) ≫ (𝟙 Z' ⊗ f ⊗ 𝟙 Y)) ≫ (α_ Z' (Z ⊗ Y') Y).inv) ≫ ((α_ Z' Z Y').inv ⊗ 𝟙 Y)) ≫ (α_ (Z' ⊗ Z) Y' Y).hom) ≫ (𝟙 (Z' ⊗ Z) ⊗ ε_ Y Y')) ≫ (ρ_ (Z' ⊗ Z)).hom = (α_ X' X Y).hom ≫ (g ⊗ 𝟙 (X ⊗ Y)) ≫ (𝟙 Z' ⊗ f ⊗ 𝟙 Y) ≫ (𝟙 Z' ⊗ (α_ Z Y' Y).hom) ≫ (𝟙 Z' ⊗ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] simp only [← tensor_id, associator_conjugation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' ⊢ (α_ X' X Y).hom ≫ ((((((g ⊗ 𝟙 X ⊗ 𝟙 Y) ≫ (𝟙 Z' ⊗ f ⊗ 𝟙 Y)) ≫ (α_ Z' (Z ⊗ Y') Y).inv) ≫ ((α_ Z' Z Y').inv ⊗ 𝟙 Y)) ≫ (α_ (Z' ⊗ Z) Y' Y).hom) ≫ (α_ Z' Z (Y' ⊗ Y)).hom ≫ (𝟙 Z' ⊗ 𝟙 Z ⊗ ε_ Y Y') ≫ (α_ Z' Z (𝟙_ C)).inv) ≫ (ρ_ (Z' ⊗ Z)).hom = (α_ X' X Y).hom ≫ (g ⊗ 𝟙 X ⊗ 𝟙 Y) ≫ (𝟙 Z' ⊗ f ⊗ 𝟙 Y) ≫ (𝟙 Z' ⊗ (α_ Z Y' Y).hom) ≫ (𝟙 Z' ⊗ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom) [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y Y' Z Z' : C inst✝ : ExactPairing Y Y' f : X ⟶ Z ⊗ Y' g : X' ⟶ Z' ⊢ (g ⊗ f ⊗ 𝟙 Y) ≫ (α_ Z' (Z ⊗ Y') Y).inv ≫ ((α_ Z' Z Y').inv ⊗ 𝟙 Y) ≫ (α_ (Z' ⊗ Z) Y' Y).hom ≫ (α_ Z' Z (Y' ⊗ Y)).hom ≫ (𝟙 Z' ⊗ 𝟙 Z ⊗ ε_ Y Y') ≫ (𝟙 Z' ⊗ (ρ_ Z).hom) = (g ⊗ f ⊗ 𝟙 Y) ≫ (𝟙 Z' ⊗ (α_ Z Y' Y).hom) ≫ (𝟙 Z' ⊗ 𝟙 Z ⊗ ε_ Y Y') ≫ (𝟙 Z' ⊗ (ρ_ Z).hom) [PROOFSTEP] coherence [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z ⊢ ↑(tensorLeftHomEquiv (𝟙_ C) Y Y' Z).symm (η_ Y Y' ≫ (𝟙 Y ⊗ f)) = (ρ_ Y').hom ≫ f [PROOFSTEP] dsimp [tensorLeftHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z ⊢ (𝟙 Y' ⊗ η_ Y Y' ≫ (𝟙 Y ⊗ f)) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom = (ρ_ Y').hom ≫ f [PROOFSTEP] rw [id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z ⊢ ((𝟙 Y' ⊗ η_ Y Y') ≫ (𝟙 Y' ⊗ 𝟙 Y ⊗ f)) ≫ (α_ Y' Y Z).inv ≫ (ε_ Y Y' ⊗ 𝟙 Z) ≫ (λ_ Z).hom = (ρ_ Y').hom ≫ f [PROOFSTEP] slice_lhs 2 3 => rw [associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (𝟙 Y' ⊗ 𝟙 Y ⊗ f) ≫ (α_ Y' Y Z).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | ε_ Y Y' ⊗ 𝟙 Z case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' [PROOFSTEP] rw [associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (𝟙 Y' ⊗ 𝟙 Y ⊗ f) ≫ (α_ Y' Y Z).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | ε_ Y Y' ⊗ 𝟙 Z case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' [PROOFSTEP] rw [associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (𝟙 Y' ⊗ 𝟙 Y ⊗ f) ≫ (α_ Y' Y Z).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | ε_ Y Y' ⊗ 𝟙 Z case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' [PROOFSTEP] rw [associator_inv_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z ⊢ (𝟙 Y' ⊗ η_ Y Y') ≫ (((α_ Y' Y Y').inv ≫ ((𝟙 Y' ⊗ 𝟙 Y) ⊗ f)) ≫ (ε_ Y Y' ⊗ 𝟙 Z)) ≫ (λ_ Z).hom = (ρ_ Y').hom ≫ f [PROOFSTEP] slice_lhs 3 4 => rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | ((𝟙 Y' ⊗ 𝟙 Y) ⊗ f) ≫ (ε_ Y Y' ⊗ 𝟙 Z) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (α_ Y' Y Y').inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | ((𝟙 Y' ⊗ 𝟙 Y) ⊗ f) ≫ (ε_ Y Y' ⊗ 𝟙 Z) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (α_ Y' Y Y').inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | ((𝟙 Y' ⊗ 𝟙 Y) ⊗ f) ≫ (ε_ Y Y' ⊗ 𝟙 Z) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 Y' ⊗ η_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (α_ Y' Y Y').inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z ⊢ (𝟙 Y' ⊗ η_ Y Y') ≫ (α_ Y' Y Y').inv ≫ ((ε_ Y Y' ⊗ 𝟙 Y') ≫ (𝟙 (𝟙_ C) ⊗ f)) ≫ (λ_ Z).hom = (ρ_ Y').hom ≫ f [PROOFSTEP] slice_lhs 1 3 => rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (𝟙 Y' ⊗ η_ Y Y') ≫ (α_ Y' Y Y').inv ≫ (ε_ Y Y' ⊗ 𝟙 Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 (𝟙_ C) ⊗ f case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (𝟙 Y' ⊗ η_ Y Y') ≫ (α_ Y' Y Y').inv ≫ (ε_ Y Y' ⊗ 𝟙 Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 (𝟙_ C) ⊗ f case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (𝟙 Y' ⊗ η_ Y Y') ≫ (α_ Y' Y Y').inv ≫ (ε_ Y Y' ⊗ 𝟙 Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | 𝟙 (𝟙_ C) ⊗ f case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z | (λ_ Z).hom [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y' ⟶ Z ⊢ (((ρ_ Y').hom ≫ (λ_ Y').inv) ≫ (𝟙 (𝟙_ C) ⊗ f)) ≫ (λ_ Z).hom = (ρ_ Y').hom ≫ f [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y ⊢ ↑(tensorLeftHomEquiv (𝟙_ C) Y Yᘁ Xᘁ).symm (η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) = (ρ_ Yᘁ).hom ≫ fᘁ [PROOFSTEP] dsimp [tensorLeftHomEquiv, rightAdjointMate] [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y ⊢ (𝟙 Yᘁ ⊗ η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom = (ρ_ Yᘁ).hom ≫ (ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y ⊢ ↑(tensorRightHomEquiv (𝟙_ C) (ᘁY) Y ᘁX).symm (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f)) = (λ_ ᘁY).hom ≫ ᘁf [PROOFSTEP] dsimp [tensorRightHomEquiv, leftAdjointMate] [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y ⊢ (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom = (λ_ ᘁY).hom ≫ (λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z ⊢ ↑(tensorRightHomEquiv (𝟙_ C) Y Y' Z).symm (η_ Y Y' ≫ (f ⊗ 𝟙 Y')) = (λ_ Y).hom ≫ f [PROOFSTEP] dsimp [tensorRightHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z ⊢ (η_ Y Y' ≫ (f ⊗ 𝟙 Y') ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom = (λ_ Y).hom ≫ f [PROOFSTEP] rw [comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z ⊢ ((η_ Y Y' ⊗ 𝟙 Y) ≫ ((f ⊗ 𝟙 Y') ⊗ 𝟙 Y)) ≫ (α_ Z Y' Y).hom ≫ (𝟙 Z ⊗ ε_ Y Y') ≫ (ρ_ Z).hom = (λ_ Y).hom ≫ f [PROOFSTEP] slice_lhs 2 3 => rw [associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | ((f ⊗ 𝟙 Y') ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | 𝟙 Z ⊗ ε_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | η_ Y Y' ⊗ 𝟙 Y [PROOFSTEP] rw [associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | ((f ⊗ 𝟙 Y') ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | 𝟙 Z ⊗ ε_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | η_ Y Y' ⊗ 𝟙 Y [PROOFSTEP] rw [associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | ((f ⊗ 𝟙 Y') ⊗ 𝟙 Y) ≫ (α_ Z Y' Y).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | 𝟙 Z ⊗ ε_ Y Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | η_ Y Y' ⊗ 𝟙 Y [PROOFSTEP] rw [associator_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z ⊢ (η_ Y Y' ⊗ 𝟙 Y) ≫ (((α_ Y Y' Y).hom ≫ (f ⊗ 𝟙 Y' ⊗ 𝟙 Y)) ≫ (𝟙 Z ⊗ ε_ Y Y')) ≫ (ρ_ Z).hom = (λ_ Y).hom ≫ f [PROOFSTEP] slice_lhs 3 4 => rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (f ⊗ 𝟙 Y' ⊗ 𝟙 Y) ≫ (𝟙 Z ⊗ ε_ Y Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | η_ Y Y' ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (α_ Y Y' Y).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (f ⊗ 𝟙 Y' ⊗ 𝟙 Y) ≫ (𝟙 Z ⊗ ε_ Y Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | η_ Y Y' ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (α_ Y Y' Y).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (f ⊗ 𝟙 Y' ⊗ 𝟙 Y) ≫ (𝟙 Z ⊗ ε_ Y Y') case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | η_ Y Y' ⊗ 𝟙 Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (α_ Y Y' Y).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z ⊢ (η_ Y Y' ⊗ 𝟙 Y) ≫ (α_ Y Y' Y).hom ≫ ((𝟙 Y ⊗ ε_ Y Y') ≫ (f ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ Z).hom = (λ_ Y).hom ≫ f [PROOFSTEP] slice_lhs 1 3 => rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (η_ Y Y' ⊗ 𝟙 Y) ≫ (α_ Y Y' Y).hom ≫ (𝟙 Y ⊗ ε_ Y Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | f ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (η_ Y Y' ⊗ 𝟙 Y) ≫ (α_ Y Y' Y).hom ≫ (𝟙 Y ⊗ ε_ Y Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | f ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (η_ Y Y' ⊗ 𝟙 Y) ≫ (α_ Y Y' Y).hom ≫ (𝟙 Y ⊗ ε_ Y Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | f ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z | (ρ_ Z).hom [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Y' Z : C inst✝ : ExactPairing Y Y' f : Y ⟶ Z ⊢ (((λ_ Y).hom ≫ (ρ_ Y).inv) ≫ (f ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ Z).hom = (λ_ Y).hom ≫ f [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ ⊢ ↑(tensorLeftHomEquiv Y (ᘁZ) Z (𝟙_ C)) ((𝟙 Z ⊗ f) ≫ ε_ (ᘁZ) Z) = f ≫ (ρ_ ᘁZ).inv [PROOFSTEP] dsimp [tensorLeftHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ ⊢ (λ_ Y).inv ≫ (η_ (ᘁZ) Z ⊗ 𝟙 Y) ≫ (α_ (ᘁZ) Z Y).hom ≫ (𝟙 ᘁZ ⊗ (𝟙 Z ⊗ f) ≫ ε_ (ᘁZ) Z) = f ≫ (ρ_ ᘁZ).inv [PROOFSTEP] rw [id_tensor_comp] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ ⊢ (λ_ Y).inv ≫ (η_ (ᘁZ) Z ⊗ 𝟙 Y) ≫ (α_ (ᘁZ) Z Y).hom ≫ (𝟙 ᘁZ ⊗ 𝟙 Z ⊗ f) ≫ (𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z) = f ≫ (ρ_ ᘁZ).inv [PROOFSTEP] slice_lhs 3 4 => rw [← associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (α_ (ᘁZ) Z Y).hom ≫ (𝟙 ᘁZ ⊗ 𝟙 Z ⊗ f) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | η_ (ᘁZ) Z ⊗ 𝟙 Y [PROOFSTEP] rw [← associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (α_ (ᘁZ) Z Y).hom ≫ (𝟙 ᘁZ ⊗ 𝟙 Z ⊗ f) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | η_ (ᘁZ) Z ⊗ 𝟙 Y [PROOFSTEP] rw [← associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (α_ (ᘁZ) Z Y).hom ≫ (𝟙 ᘁZ ⊗ 𝟙 Z ⊗ f) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | η_ (ᘁZ) Z ⊗ 𝟙 Y [PROOFSTEP] rw [← associator_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ ⊢ (λ_ Y).inv ≫ (η_ (ᘁZ) Z ⊗ 𝟙 Y) ≫ (((𝟙 ᘁZ ⊗ 𝟙 Z) ⊗ f) ≫ (α_ (ᘁZ) Z ᘁZ).hom) ≫ (𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z) = f ≫ (ρ_ ᘁZ).inv [PROOFSTEP] slice_lhs 2 3 => rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (η_ (ᘁZ) Z ⊗ 𝟙 Y) ≫ ((𝟙 ᘁZ ⊗ 𝟙 Z) ⊗ f) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (α_ (ᘁZ) Z ᘁZ).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (η_ (ᘁZ) Z ⊗ 𝟙 Y) ≫ ((𝟙 ᘁZ ⊗ 𝟙 Z) ⊗ f) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (α_ (ᘁZ) Z ᘁZ).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (η_ (ᘁZ) Z ⊗ 𝟙 Y) ≫ ((𝟙 ᘁZ ⊗ 𝟙 Z) ⊗ f) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (α_ (ᘁZ) Z ᘁZ).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ ⊢ (λ_ Y).inv ≫ (((𝟙 tensorUnit' ⊗ f) ≫ (η_ (ᘁZ) Z ⊗ 𝟙 ᘁZ)) ≫ (α_ (ᘁZ) Z ᘁZ).hom) ≫ (𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z) = f ≫ (ρ_ ᘁZ).inv [PROOFSTEP] slice_lhs 3 5 => rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (η_ (ᘁZ) Z ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁZ) Z ᘁZ).hom ≫ (𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 tensorUnit' ⊗ f [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (η_ (ᘁZ) Z ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁZ) Z ᘁZ).hom ≫ (𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 tensorUnit' ⊗ f [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (η_ (ᘁZ) Z ⊗ 𝟙 ᘁZ) ≫ (α_ (ᘁZ) Z ᘁZ).hom ≫ (𝟙 ᘁZ ⊗ ε_ (ᘁZ) Z) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | (λ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ | 𝟙 tensorUnit' ⊗ f [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C Y Z : C inst✝ : HasLeftDual Z f : Y ⟶ ᘁZ ⊢ (λ_ Y).inv ≫ (𝟙 tensorUnit' ⊗ f) ≫ (λ_ ᘁZ).hom ≫ (ρ_ ᘁZ).inv = f ≫ (ρ_ ᘁZ).inv [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y ⊢ ↑(tensorLeftHomEquiv (ᘁY) (ᘁX) X (𝟙_ C)) ((f ⊗ 𝟙 ᘁY) ≫ ε_ (ᘁY) Y) = (ᘁf) ≫ (ρ_ ᘁX).inv [PROOFSTEP] dsimp [tensorLeftHomEquiv, leftAdjointMate] [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y ⊢ (λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) X ᘁY).hom ≫ (𝟙 ᘁX ⊗ (f ⊗ 𝟙 ᘁY) ≫ ε_ (ᘁY) Y) = ((λ_ ᘁY).inv ≫ (η_ (ᘁX) X ⊗ 𝟙 ᘁY) ≫ ((𝟙 ᘁX ⊗ f) ⊗ 𝟙 ᘁY) ≫ (α_ (ᘁX) Y ᘁY).hom ≫ (𝟙 ᘁX ⊗ ε_ (ᘁY) Y) ≫ (ρ_ ᘁX).hom) ≫ (ρ_ ᘁX).inv [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y ⊢ ↑(tensorRightHomEquiv Yᘁ X Xᘁ (𝟙_ C)) ((𝟙 Yᘁ ⊗ f) ≫ ε_ Y Yᘁ) = fᘁ ≫ (λ_ Xᘁ).inv [PROOFSTEP] dsimp [tensorRightHomEquiv, rightAdjointMate] [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y ⊢ (ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (α_ Yᘁ X Xᘁ).inv ≫ ((𝟙 Yᘁ ⊗ f) ≫ ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) = ((ρ_ Yᘁ).inv ≫ (𝟙 Yᘁ ⊗ η_ X Xᘁ) ≫ (𝟙 Yᘁ ⊗ f ⊗ 𝟙 Xᘁ) ≫ (α_ Yᘁ Y Xᘁ).inv ≫ (ε_ Y Yᘁ ⊗ 𝟙 Xᘁ) ≫ (λ_ Xᘁ).hom) ≫ (λ_ Xᘁ).inv [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ ⊢ ↑(tensorRightHomEquiv Y X Xᘁ (𝟙_ C)) ((f ⊗ 𝟙 X) ≫ ε_ X Xᘁ) = f ≫ (λ_ Xᘁ).inv [PROOFSTEP] dsimp [tensorRightHomEquiv] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ ⊢ (ρ_ Y).inv ≫ (𝟙 Y ⊗ η_ X Xᘁ) ≫ (α_ Y X Xᘁ).inv ≫ ((f ⊗ 𝟙 X) ≫ ε_ X Xᘁ ⊗ 𝟙 Xᘁ) = f ≫ (λ_ Xᘁ).inv [PROOFSTEP] rw [comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ ⊢ (ρ_ Y).inv ≫ (𝟙 Y ⊗ η_ X Xᘁ) ≫ (α_ Y X Xᘁ).inv ≫ ((f ⊗ 𝟙 X) ⊗ 𝟙 Xᘁ) ≫ (ε_ X Xᘁ ⊗ 𝟙 Xᘁ) = f ≫ (λ_ Xᘁ).inv [PROOFSTEP] slice_lhs 3 4 => rw [← associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (α_ Y X Xᘁ).inv ≫ ((f ⊗ 𝟙 X) ⊗ 𝟙 Xᘁ) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | ε_ X Xᘁ ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | 𝟙 Y ⊗ η_ X Xᘁ [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (α_ Y X Xᘁ).inv ≫ ((f ⊗ 𝟙 X) ⊗ 𝟙 Xᘁ) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | ε_ X Xᘁ ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | 𝟙 Y ⊗ η_ X Xᘁ [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (α_ Y X Xᘁ).inv ≫ ((f ⊗ 𝟙 X) ⊗ 𝟙 Xᘁ) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | ε_ X Xᘁ ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | 𝟙 Y ⊗ η_ X Xᘁ [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ ⊢ (ρ_ Y).inv ≫ (𝟙 Y ⊗ η_ X Xᘁ) ≫ ((f ⊗ 𝟙 X ⊗ 𝟙 Xᘁ) ≫ (α_ Xᘁ X Xᘁ).inv) ≫ (ε_ X Xᘁ ⊗ 𝟙 Xᘁ) = f ≫ (λ_ Xᘁ).inv [PROOFSTEP] slice_lhs 2 3 => rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (𝟙 Y ⊗ η_ X Xᘁ) ≫ (f ⊗ 𝟙 X ⊗ 𝟙 Xᘁ) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (α_ Xᘁ X Xᘁ).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | ε_ X Xᘁ ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (𝟙 Y ⊗ η_ X Xᘁ) ≫ (f ⊗ 𝟙 X ⊗ 𝟙 Xᘁ) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (α_ Xᘁ X Xᘁ).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | ε_ X Xᘁ ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (𝟙 Y ⊗ η_ X Xᘁ) ≫ (f ⊗ 𝟙 X ⊗ 𝟙 Xᘁ) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (α_ Xᘁ X Xᘁ).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | ε_ X Xᘁ ⊗ 𝟙 Xᘁ case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ ⊢ (ρ_ Y).inv ≫ (((f ⊗ 𝟙 tensorUnit') ≫ (𝟙 Xᘁ ⊗ η_ X Xᘁ)) ≫ (α_ Xᘁ X Xᘁ).inv) ≫ (ε_ X Xᘁ ⊗ 𝟙 Xᘁ) = f ≫ (λ_ Xᘁ).inv [PROOFSTEP] slice_lhs 3 5 => rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (𝟙 Xᘁ ⊗ η_ X Xᘁ) ≫ (α_ Xᘁ X Xᘁ).inv ≫ (ε_ X Xᘁ ⊗ 𝟙 Xᘁ) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | f ⊗ 𝟙 tensorUnit' [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (𝟙 Xᘁ ⊗ η_ X Xᘁ) ≫ (α_ Xᘁ X Xᘁ).inv ≫ (ε_ X Xᘁ ⊗ 𝟙 Xᘁ) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | f ⊗ 𝟙 tensorUnit' [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (𝟙 Xᘁ ⊗ η_ X Xᘁ) ≫ (α_ Xᘁ X Xᘁ).inv ≫ (ε_ X Xᘁ ⊗ 𝟙 Xᘁ) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | (ρ_ Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ | f ⊗ 𝟙 tensorUnit' [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y : C inst✝ : HasRightDual X f : Y ⟶ Xᘁ ⊢ (ρ_ Y).inv ≫ (f ⊗ 𝟙 tensorUnit') ≫ (ρ_ Xᘁ).hom ≫ (λ_ Xᘁ).inv = f ≫ (λ_ Xᘁ).inv [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y ⊢ η_ Y Yᘁ ≫ (𝟙 Y ⊗ fᘁ) = η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ) [PROOFSTEP] apply_fun (tensorLeftHomEquiv _ Y (Yᘁ) _).symm [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y ⊢ ↑(tensorLeftHomEquiv (𝟙_ C) Y Yᘁ Xᘁ).symm (η_ Y Yᘁ ≫ (𝟙 Y ⊗ fᘁ)) = ↑(tensorLeftHomEquiv (𝟙_ C) Y Yᘁ Xᘁ).symm (η_ X Xᘁ ≫ (f ⊗ 𝟙 Xᘁ)) [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y ⊢ (𝟙 X ⊗ ᘁf) ≫ ε_ (ᘁX) X = (f ⊗ 𝟙 ᘁY) ≫ ε_ (ᘁY) Y [PROOFSTEP] apply_fun tensorLeftHomEquiv _ (ᘁX) X _ [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y ⊢ ↑(tensorLeftHomEquiv (ᘁY) (ᘁX) X (𝟙_ C)) ((𝟙 X ⊗ ᘁf) ≫ ε_ (ᘁX) X) = ↑(tensorLeftHomEquiv (ᘁY) (ᘁX) X (𝟙_ C)) ((f ⊗ 𝟙 ᘁY) ≫ ε_ (ᘁY) Y) [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y ⊢ η_ (ᘁY) Y ≫ ((ᘁf) ⊗ 𝟙 Y) = η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f) [PROOFSTEP] apply_fun (tensorRightHomEquiv _ (ᘁY) Y _).symm [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasLeftDual X inst✝ : HasLeftDual Y f : X ⟶ Y ⊢ ↑(tensorRightHomEquiv (𝟙_ C) (ᘁY) Y ᘁX).symm (η_ (ᘁY) Y ≫ ((ᘁf) ⊗ 𝟙 Y)) = ↑(tensorRightHomEquiv (𝟙_ C) (ᘁY) Y ᘁX).symm (η_ (ᘁX) X ≫ (𝟙 ᘁX ⊗ f)) [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y ⊢ (fᘁ ⊗ 𝟙 X) ≫ ε_ X Xᘁ = (𝟙 Yᘁ ⊗ f) ≫ ε_ Y Yᘁ [PROOFSTEP] apply_fun tensorRightHomEquiv _ X (Xᘁ) _ [GOAL] C : Type u₁ inst✝³ : Category.{v₁, u₁} C inst✝² : MonoidalCategory C X Y : C inst✝¹ : HasRightDual X inst✝ : HasRightDual Y f : X ⟶ Y ⊢ ↑(tensorRightHomEquiv Yᘁ X Xᘁ (𝟙_ C)) ((fᘁ ⊗ 𝟙 X) ≫ ε_ X Xᘁ) = ↑(tensorRightHomEquiv Yᘁ X Xᘁ (𝟙_ C)) ((𝟙 Yᘁ ⊗ f) ≫ ε_ Y Yᘁ) [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (𝟙 Y ⊗ η_ X' Y ≫ (i.inv ⊗ 𝟙 Y)) ≫ (α_ Y X Y).inv ≫ ((𝟙 Y ⊗ i.hom) ≫ ε_ X' Y ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] rw [id_tensor_comp, comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ ((𝟙 Y ⊗ η_ X' Y) ≫ (𝟙 Y ⊗ i.inv ⊗ 𝟙 Y)) ≫ (α_ Y X Y).inv ≫ ((𝟙 Y ⊗ i.hom) ⊗ 𝟙 Y) ≫ (ε_ X' Y ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] simp only [Iso.inv_hom_id_assoc, associator_conjugation, Category.assoc] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (𝟙 Y ⊗ η_ X' Y) ≫ (𝟙 Y ⊗ i.inv ⊗ 𝟙 Y) ≫ (𝟙 Y ⊗ i.hom ⊗ 𝟙 Y) ≫ (α_ Y X' Y).inv ≫ (ε_ X' Y ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 2 3 => rw [← tensor_comp] simp [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (𝟙 Y ⊗ i.inv ⊗ 𝟙 Y) ≫ (𝟙 Y ⊗ i.hom ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ Y X' Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | ε_ X' Y ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 Y ⊗ η_ X' Y [PROOFSTEP] rw [← tensor_comp] simp [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (𝟙 Y ⊗ i.inv ⊗ 𝟙 Y) ≫ (𝟙 Y ⊗ i.hom ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ Y X' Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | ε_ X' Y ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 Y ⊗ η_ X' Y [PROOFSTEP] rw [← tensor_comp] simp [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (𝟙 Y ⊗ i.inv ⊗ 𝟙 Y) ≫ (𝟙 Y ⊗ i.hom ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ Y X' Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | ε_ X' Y ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 Y ⊗ η_ X' Y [PROOFSTEP] rw [← tensor_comp] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 Y ≫ 𝟙 Y ⊗ (i.inv ⊗ 𝟙 Y) ≫ (i.hom ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ Y X' Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | ε_ X' Y ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 Y ⊗ η_ X' Y [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (𝟙 Y ⊗ η_ X' Y) ≫ (𝟙 (Y ⊗ X' ⊗ Y) ≫ (α_ Y X' Y).inv) ≫ (ε_ X' Y ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (η_ X' Y ≫ (i.inv ⊗ 𝟙 Y) ⊗ 𝟙 X) ≫ (α_ X Y X).hom ≫ (𝟙 X ⊗ (𝟙 Y ⊗ i.hom) ≫ ε_ X' Y) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] rw [id_tensor_comp, comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ ((η_ X' Y ⊗ 𝟙 X) ≫ ((i.inv ⊗ 𝟙 Y) ⊗ 𝟙 X)) ≫ (α_ X Y X).hom ≫ (𝟙 X ⊗ 𝟙 Y ⊗ i.hom) ≫ (𝟙 X ⊗ ε_ X' Y) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 2 3 => rw [associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | ((i.inv ⊗ 𝟙 Y) ⊗ 𝟙 X) ≫ (α_ X Y X).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ 𝟙 Y ⊗ i.hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X [PROOFSTEP] rw [associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | ((i.inv ⊗ 𝟙 Y) ⊗ 𝟙 X) ≫ (α_ X Y X).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ 𝟙 Y ⊗ i.hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X [PROOFSTEP] rw [associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | ((i.inv ⊗ 𝟙 Y) ⊗ 𝟙 X) ≫ (α_ X Y X).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ 𝟙 Y ⊗ i.hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X [PROOFSTEP] rw [associator_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (η_ X' Y ⊗ 𝟙 X) ≫ (((α_ X' Y X).hom ≫ (i.inv ⊗ 𝟙 Y ⊗ 𝟙 X)) ≫ (𝟙 X ⊗ 𝟙 Y ⊗ i.hom)) ≫ (𝟙 X ⊗ ε_ X' Y) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 3 4 => rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (i.inv ⊗ 𝟙 Y ⊗ 𝟙 X) ≫ (𝟙 X ⊗ 𝟙 Y ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (i.inv ⊗ 𝟙 Y ⊗ 𝟙 X) ≫ (𝟙 X ⊗ 𝟙 Y ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (i.inv ⊗ 𝟙 Y ⊗ 𝟙 X) ≫ (𝟙 X ⊗ 𝟙 Y ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (η_ X' Y ⊗ 𝟙 X) ≫ (α_ X' Y X).hom ≫ ((𝟙 X' ⊗ 𝟙 Y ⊗ i.hom) ≫ (i.inv ⊗ 𝟙 (Y ⊗ X'))) ≫ (𝟙 X ⊗ ε_ X' Y) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 4 5 => rw [tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (i.inv ⊗ 𝟙 (Y ⊗ X')) ≫ (𝟙 X ⊗ ε_ X' Y) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ 𝟙 Y ⊗ i.hom [PROOFSTEP] rw [tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (i.inv ⊗ 𝟙 (Y ⊗ X')) ≫ (𝟙 X ⊗ ε_ X' Y) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ 𝟙 Y ⊗ i.hom [PROOFSTEP] rw [tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (i.inv ⊗ 𝟙 (Y ⊗ X')) ≫ (𝟙 X ⊗ ε_ X' Y) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ 𝟙 Y ⊗ i.hom [PROOFSTEP] rw [tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (η_ X' Y ⊗ 𝟙 X) ≫ (α_ X' Y X).hom ≫ (𝟙 X' ⊗ 𝟙 Y ⊗ i.hom) ≫ (𝟙 X' ⊗ ε_ X' Y) ≫ (i.inv ⊗ 𝟙 (𝟙_ C)) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 2 3 => rw [← associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom ≫ (𝟙 X' ⊗ 𝟙 Y ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ ε_ X' Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X [PROOFSTEP] rw [← associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom ≫ (𝟙 X' ⊗ 𝟙 Y ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ ε_ X' Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X [PROOFSTEP] rw [← associator_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X).hom ≫ (𝟙 X' ⊗ 𝟙 Y ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ ε_ X' Y case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | η_ X' Y ⊗ 𝟙 X [PROOFSTEP] rw [← associator_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (η_ X' Y ⊗ 𝟙 X) ≫ ((((𝟙 X' ⊗ 𝟙 Y) ⊗ i.hom) ≫ (α_ X' Y X').hom) ≫ (𝟙 X' ⊗ ε_ X' Y)) ≫ (i.inv ⊗ 𝟙 (𝟙_ C)) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 1 2 => rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (η_ X' Y ⊗ 𝟙 X) ≫ ((𝟙 X' ⊗ 𝟙 Y) ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (η_ X' Y ⊗ 𝟙 X) ≫ ((𝟙 X' ⊗ 𝟙 Y) ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (η_ X' Y ⊗ 𝟙 X) ≫ ((𝟙 X' ⊗ 𝟙 Y) ⊗ i.hom) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (α_ X' Y X').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 X' ⊗ ε_ X' Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [tensor_id, tensor_id_comp_id_tensor, ← id_tensor_comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ ((((𝟙 (𝟙_ C) ⊗ i.hom) ≫ (η_ X' Y ⊗ 𝟙 X')) ≫ (α_ X' Y X').hom) ≫ (𝟙 X' ⊗ ε_ X' Y)) ≫ (i.inv ⊗ 𝟙 (𝟙_ C)) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 2 4 => rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (η_ X' Y ⊗ 𝟙 X') ≫ (α_ X' Y X').hom ≫ (𝟙 X' ⊗ ε_ X' Y) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 (𝟙_ C) ⊗ i.hom [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (η_ X' Y ⊗ 𝟙 X') ≫ (α_ X' Y X').hom ≫ (𝟙 X' ⊗ ε_ X' Y) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 (𝟙_ C) ⊗ i.hom [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (η_ X' Y ⊗ 𝟙 X') ≫ (α_ X' Y X').hom ≫ (𝟙 X' ⊗ ε_ X' Y) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | 𝟙 (𝟙_ C) ⊗ i.hom [PROOFSTEP] rw [evaluation_coevaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (𝟙 (𝟙_ C) ⊗ i.hom) ≫ ((λ_ X').hom ≫ (ρ_ X').inv) ≫ (i.inv ⊗ 𝟙 (𝟙_ C)) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 1 2 => rw [leftUnitor_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (𝟙 (𝟙_ C) ⊗ i.hom) ≫ (λ_ X').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (ρ_ X').inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [leftUnitor_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (𝟙 (𝟙_ C) ⊗ i.hom) ≫ (λ_ X').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (ρ_ X').inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [leftUnitor_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (𝟙 (𝟙_ C) ⊗ i.hom) ≫ (λ_ X').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (ρ_ X').inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.inv ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [leftUnitor_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (((λ_ X).hom ≫ i.hom) ≫ (ρ_ X').inv) ≫ (i.inv ⊗ 𝟙 (𝟙_ C)) = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 3 4 => rw [← rightUnitor_inv_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (ρ_ X').inv ≫ (i.inv ⊗ 𝟙 (𝟙_ C)) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (λ_ X).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.hom [PROOFSTEP] rw [← rightUnitor_inv_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (ρ_ X').inv ≫ (i.inv ⊗ 𝟙 (𝟙_ C)) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (λ_ X).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.hom [PROOFSTEP] rw [← rightUnitor_inv_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (ρ_ X').inv ≫ (i.inv ⊗ 𝟙 (𝟙_ C)) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | (λ_ X).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' | i.hom [PROOFSTEP] rw [← rightUnitor_inv_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X X' Y : C inst✝ : ExactPairing X' Y i : X ≅ X' ⊢ (λ_ X).hom ≫ i.hom ≫ i.inv ≫ (ρ_ X).inv = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (𝟙 Y ⊗ η_ X Y' ≫ (𝟙 X ⊗ i.inv)) ≫ (α_ Y X Y).inv ≫ ((i.hom ⊗ 𝟙 X) ≫ ε_ X Y' ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] rw [id_tensor_comp, comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ ((𝟙 Y ⊗ η_ X Y') ≫ (𝟙 Y ⊗ 𝟙 X ⊗ i.inv)) ≫ (α_ Y X Y).inv ≫ ((i.hom ⊗ 𝟙 X) ⊗ 𝟙 Y) ≫ (ε_ X Y' ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 3 4 => rw [← associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y X Y).inv ≫ ((i.hom ⊗ 𝟙 X) ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ η_ X Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ 𝟙 X ⊗ i.inv [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y X Y).inv ≫ ((i.hom ⊗ 𝟙 X) ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ η_ X Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ 𝟙 X ⊗ i.inv [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y X Y).inv ≫ ((i.hom ⊗ 𝟙 X) ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ η_ X Y' case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ 𝟙 X ⊗ i.inv [PROOFSTEP] rw [← associator_inv_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (𝟙 Y ⊗ η_ X Y') ≫ (𝟙 Y ⊗ 𝟙 X ⊗ i.inv) ≫ ((i.hom ⊗ 𝟙 X ⊗ 𝟙 Y) ≫ (α_ Y' X Y).inv) ≫ (ε_ X Y' ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 2 3 => rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y ⊗ 𝟙 X ⊗ i.inv) ≫ (i.hom ⊗ 𝟙 X ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ η_ X Y' [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y ⊗ 𝟙 X ⊗ i.inv) ≫ (i.hom ⊗ 𝟙 X ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ η_ X Y' [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y ⊗ 𝟙 X ⊗ i.inv) ≫ (i.hom ⊗ 𝟙 X ⊗ 𝟙 Y) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y).inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y ⊗ η_ X Y' [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (𝟙 Y ⊗ η_ X Y') ≫ (((i.hom ⊗ 𝟙 (X ⊗ Y')) ≫ (𝟙 Y' ⊗ 𝟙 X ⊗ i.inv)) ≫ (α_ Y' X Y).inv) ≫ (ε_ X Y' ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 1 2 => rw [id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y ⊗ η_ X Y') ≫ (i.hom ⊗ 𝟙 (X ⊗ Y')) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ 𝟙 X ⊗ i.inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y).inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y [PROOFSTEP] rw [id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y ⊗ η_ X Y') ≫ (i.hom ⊗ 𝟙 (X ⊗ Y')) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ 𝟙 X ⊗ i.inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y).inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y [PROOFSTEP] rw [id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y ⊗ η_ X Y') ≫ (i.hom ⊗ 𝟙 (X ⊗ Y')) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ 𝟙 X ⊗ i.inv case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y).inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y [PROOFSTEP] rw [id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ ((((i.hom ⊗ 𝟙 (𝟙_ C)) ≫ (𝟙 Y' ⊗ η_ X Y')) ≫ (𝟙 Y' ⊗ 𝟙 X ⊗ i.inv)) ≫ (α_ Y' X Y).inv) ≫ (ε_ X Y' ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 3 4 => rw [associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y' ⊗ 𝟙 X ⊗ i.inv) ≫ (α_ Y' X Y).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ η_ X Y' [PROOFSTEP] rw [associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y' ⊗ 𝟙 X ⊗ i.inv) ≫ (α_ Y' X Y).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ η_ X Y' [PROOFSTEP] rw [associator_inv_naturality] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y' ⊗ 𝟙 X ⊗ i.inv) ≫ (α_ Y' X Y).inv case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ε_ X Y' ⊗ 𝟙 Y case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ η_ X Y' [PROOFSTEP] rw [associator_inv_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (i.hom ⊗ 𝟙 (𝟙_ C)) ≫ (𝟙 Y' ⊗ η_ X Y') ≫ ((α_ Y' X Y').inv ≫ ((𝟙 Y' ⊗ 𝟙 X) ⊗ i.inv)) ≫ (ε_ X Y' ⊗ 𝟙 Y) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 4 5 => rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ((𝟙 Y' ⊗ 𝟙 X) ⊗ i.inv) ≫ (ε_ X Y' ⊗ 𝟙 Y) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ η_ X Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y').inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ((𝟙 Y' ⊗ 𝟙 X) ⊗ i.inv) ≫ (ε_ X Y' ⊗ 𝟙 Y) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ η_ X Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y').inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | ((𝟙 Y' ⊗ 𝟙 X) ⊗ i.inv) ≫ (ε_ X Y' ⊗ 𝟙 Y) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 Y' ⊗ η_ X Y' case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ Y' X Y').inv [PROOFSTEP] rw [tensor_id, id_tensor_comp_tensor_id, ← tensor_id_comp_id_tensor] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (i.hom ⊗ 𝟙 (𝟙_ C)) ≫ (𝟙 Y' ⊗ η_ X Y') ≫ (α_ Y' X Y').inv ≫ (ε_ X Y' ⊗ 𝟙 Y') ≫ (𝟙 (𝟙_ C) ⊗ i.inv) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 2 4 => rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y' ⊗ η_ X Y') ≫ (α_ Y' X Y').inv ≫ (ε_ X Y' ⊗ 𝟙 Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 (𝟙_ C) ⊗ i.inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y' ⊗ η_ X Y') ≫ (α_ Y' X Y').inv ≫ (ε_ X Y' ⊗ 𝟙 Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 (𝟙_ C) ⊗ i.inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 Y' ⊗ η_ X Y') ≫ (α_ Y' X Y').inv ≫ (ε_ X Y' ⊗ 𝟙 Y') case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 (𝟙_ C) ⊗ i.inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom ⊗ 𝟙 (𝟙_ C) [PROOFSTEP] rw [coevaluation_evaluation] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (i.hom ⊗ 𝟙 (𝟙_ C)) ≫ ((ρ_ Y').hom ≫ (λ_ Y').inv) ≫ (𝟙 (𝟙_ C) ⊗ i.inv) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 1 2 => rw [rightUnitor_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (i.hom ⊗ 𝟙 (𝟙_ C)) ≫ (ρ_ Y').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (λ_ Y').inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 (𝟙_ C) ⊗ i.inv [PROOFSTEP] rw [rightUnitor_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (i.hom ⊗ 𝟙 (𝟙_ C)) ≫ (ρ_ Y').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (λ_ Y').inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 (𝟙_ C) ⊗ i.inv [PROOFSTEP] rw [rightUnitor_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (i.hom ⊗ 𝟙 (𝟙_ C)) ≫ (ρ_ Y').hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (λ_ Y').inv case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 (𝟙_ C) ⊗ i.inv [PROOFSTEP] rw [rightUnitor_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (((ρ_ Y).hom ≫ i.hom) ≫ (λ_ Y').inv) ≫ (𝟙 (𝟙_ C) ⊗ i.inv) = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] slice_lhs 3 4 => rw [← leftUnitor_inv_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (λ_ Y').inv ≫ (𝟙 (𝟙_ C) ⊗ i.inv) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (ρ_ Y).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom [PROOFSTEP] rw [← leftUnitor_inv_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (λ_ Y').inv ≫ (𝟙 (𝟙_ C) ⊗ i.inv) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (ρ_ Y).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom [PROOFSTEP] rw [← leftUnitor_inv_naturality] [GOAL] case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (λ_ Y').inv ≫ (𝟙 (𝟙_ C) ⊗ i.inv) case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (ρ_ Y).hom case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | i.hom [PROOFSTEP] rw [← leftUnitor_inv_naturality] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (ρ_ Y).hom ≫ i.hom ≫ i.inv ≫ (λ_ Y).inv = (ρ_ Y).hom ≫ (λ_ Y).inv [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (η_ X Y' ≫ (𝟙 X ⊗ i.inv) ⊗ 𝟙 X) ≫ (α_ X Y X).hom ≫ (𝟙 X ⊗ (i.hom ⊗ 𝟙 X) ≫ ε_ X Y') = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] rw [id_tensor_comp, comp_tensor_id] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ ((η_ X Y' ⊗ 𝟙 X) ≫ ((𝟙 X ⊗ i.inv) ⊗ 𝟙 X)) ≫ (α_ X Y X).hom ≫ (𝟙 X ⊗ i.hom ⊗ 𝟙 X) ≫ (𝟙 X ⊗ ε_ X Y') = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] simp only [Iso.inv_hom_id_assoc, associator_conjugation, Category.assoc] [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (η_ X Y' ⊗ 𝟙 X) ≫ (α_ X Y' X).hom ≫ (𝟙 X ⊗ i.inv ⊗ 𝟙 X) ≫ (𝟙 X ⊗ i.hom ⊗ 𝟙 X) ≫ (𝟙 X ⊗ ε_ X Y') = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] slice_lhs 3 4 => rw [← tensor_comp] simp [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 X ⊗ i.inv ⊗ 𝟙 X) ≫ (𝟙 X ⊗ i.hom ⊗ 𝟙 X) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 X ⊗ ε_ X Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | η_ X Y' ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ X Y' X).hom [PROOFSTEP] rw [← tensor_comp] simp [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 X ⊗ i.inv ⊗ 𝟙 X) ≫ (𝟙 X ⊗ i.hom ⊗ 𝟙 X) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 X ⊗ ε_ X Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | η_ X Y' ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ X Y' X).hom [PROOFSTEP] rw [← tensor_comp] simp [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (𝟙 X ⊗ i.inv ⊗ 𝟙 X) ≫ (𝟙 X ⊗ i.hom ⊗ 𝟙 X) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 X ⊗ ε_ X Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | η_ X Y' ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ X Y' X).hom [PROOFSTEP] rw [← tensor_comp] [GOAL] case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 X ≫ 𝟙 X ⊗ (i.inv ⊗ 𝟙 X) ≫ (i.hom ⊗ 𝟙 X) case a.a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | 𝟙 X ⊗ ε_ X Y' case a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | η_ X Y' ⊗ 𝟙 X case a.a C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' | (α_ X Y' X).hom [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C X Y Y' : C inst✝ : ExactPairing X Y' i : Y ≅ Y' ⊢ (η_ X Y' ⊗ 𝟙 X) ≫ (α_ X Y' X).hom ≫ 𝟙 (X ⊗ Y' ⊗ X) ≫ (𝟙 X ⊗ ε_ X Y') = (λ_ X).hom ≫ (ρ_ X).inv [PROOFSTEP] simp [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X Y₁ Y₂ : C p₁ : ExactPairing X Y₁ p₂ : ExactPairing X Y₂ ⊢ 𝟙 Xᘁ ≫ 𝟙 Xᘁ = 𝟙 Y₁ [PROOFSTEP] rw [← @comp_rightAdjointMate C _ _ X X X ⟨Y₁⟩ ⟨Y₂⟩ ⟨Y₁⟩, Category.comp_id, @rightAdjointMate_id _ _ _ _ ⟨Y₁⟩] [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X Y₁ Y₂ : C p₁ : ExactPairing X Y₁ p₂ : ExactPairing X Y₂ ⊢ 𝟙 Xᘁ = 𝟙 Y₁ [PROOFSTEP] rfl [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X Y₁ Y₂ : C p₁ : ExactPairing X Y₁ p₂ : ExactPairing X Y₂ ⊢ 𝟙 Xᘁ ≫ 𝟙 Xᘁ = 𝟙 Y₂ [PROOFSTEP] rw [← @comp_rightAdjointMate C _ _ X X X ⟨Y₂⟩ ⟨Y₁⟩ ⟨Y₂⟩, Category.comp_id, @rightAdjointMate_id _ _ _ _ ⟨Y₂⟩] [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X Y₁ Y₂ : C p₁ : ExactPairing X Y₁ p₂ : ExactPairing X Y₂ ⊢ 𝟙 Xᘁ = 𝟙 Y₂ [PROOFSTEP] rfl [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X₁ X₂ Y : C p₁ : ExactPairing X₁ Y p₂ : ExactPairing X₂ Y ⊢ ((ᘁ𝟙 Y) ≫ ᘁ𝟙 Y) = 𝟙 X₁ [PROOFSTEP] rw [← @comp_leftAdjointMate C _ _ Y Y Y ⟨X₁⟩ ⟨X₂⟩ ⟨X₁⟩, Category.comp_id, @leftAdjointMate_id _ _ _ _ ⟨X₁⟩] [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X₁ X₂ Y : C p₁ : ExactPairing X₁ Y p₂ : ExactPairing X₂ Y ⊢ 𝟙 ᘁY = 𝟙 X₁ [PROOFSTEP] rfl [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X₁ X₂ Y : C p₁ : ExactPairing X₁ Y p₂ : ExactPairing X₂ Y ⊢ ((ᘁ𝟙 Y) ≫ ᘁ𝟙 Y) = 𝟙 X₂ [PROOFSTEP] rw [← @comp_leftAdjointMate C _ _ Y Y Y ⟨X₂⟩ ⟨X₁⟩ ⟨X₂⟩, Category.comp_id, @leftAdjointMate_id _ _ _ _ ⟨X₂⟩] [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X₁ X₂ Y : C p₁ : ExactPairing X₁ Y p₂ : ExactPairing X₂ Y ⊢ 𝟙 ᘁY = 𝟙 X₂ [PROOFSTEP] rfl [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X Y : C p : ExactPairing X Y ⊢ rightDualIso p p = Iso.refl Y [PROOFSTEP] ext [GOAL] case w C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X Y : C p : ExactPairing X Y ⊢ (rightDualIso p p).hom = (Iso.refl Y).hom [PROOFSTEP] simp only [rightDualIso, Iso.refl_hom, @rightAdjointMate_id _ _ _ _ ⟨Y⟩] [GOAL] C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X Y : C p : ExactPairing X Y ⊢ leftDualIso p p = Iso.refl X [PROOFSTEP] ext [GOAL] case w C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C X Y : C p : ExactPairing X Y ⊢ (leftDualIso p p).hom = (Iso.refl X).hom [PROOFSTEP] simp only [leftDualIso, Iso.refl_hom, @leftAdjointMate_id _ _ _ _ ⟨X⟩]
\chapter{Overview} \pulpino is a single-core System-on-a-Chip built for the OpenRISC \orion core and the \riscv \rvcore core. \pulpino reuses most components from its bigger brother \pulp. It uses separate single-port data and instruction RAMs. It includes a boot ROM that contains a boot loader that can load a program via SPI from an external flash device. Figure~\ref{fig:pulpino_overview} shows a block diagram of the SoC. The SoC uses a AXI as its main interconnect with a bridge to APB for simple peripherals. Both the AXI and the APB buses feature 32 bit wide data channels. For debugging purposes the SoC includes an advanced debug unit which enables access to core registers, the two RAMs and memory-mapped IO via JTAG. Both RAMs are connected to the AXI bus via bus adapters. \begin{figure}[H] \centering \includegraphics[width=0.9\textwidth]{./figures/pulpino_block} \caption{\pulpino Overview.} \label{fig:pulpino_overview} \end{figure} \pulpino is mainly targeted at RTL simulation and ASICs, although there is also an FPGA version. The FPGA versions is not specifically optimal in terms of performance as we mainly use it as a emulation platform rather than a standalone platform.
library( "macroutils2" ) # ====== Write a binary file in SOIL or MACRO style ====== # 1.1. Read a table, that will then be written back # Path to the file to be read ( filenm <- system.file( "bintest/chat_winCer_GW-D_1kgHa_d298_annual_output.bin", package = "macroutils2", mustWork = TRUE ) ) # Read the file tmp1 <- macroReadBin( f = filenm, rmRunID = FALSE ) # 1.2. Generate a dummy temporary file where the table will be # written ( filenm <- tempfile( ) ) # 1.3. Write this table in SOIL or MACRO bin style # NB: This table is NOT a standard SOIL or MACRO input file! macroWriteBin( f = filenm, x = tmp1 ) # NB: When writing the bin file, time zones are ignored! # 1.4. Read that file again and check that it is the same: tmp1.b <- macroReadBin( f = filenm, rmRunID = FALSE ) # Maximum difference (small numerical differences) unlist( lapply( X = colnames(tmp1), FUN = function(X){ max( tmp1[,X] - tmp1.b[,X] ) } ) ) # Remove the temporary file file.remove( filenm )
State Before: α : Type u_1 β : Type ?u.361685 γ : Type ?u.361688 σ : Type ?u.361691 inst✝³ : Primcodable α inst✝² : Primcodable β inst✝¹ : Primcodable γ inst✝ : Primcodable σ n : ℕ ⊢ Primrec fun a => Vector.toList (a.fst ::ᵥ a.snd) State After: α : Type u_1 β : Type ?u.361685 γ : Type ?u.361688 σ : Type ?u.361691 inst✝³ : Primcodable α inst✝² : Primcodable β inst✝¹ : Primcodable γ inst✝ : Primcodable σ n : ℕ ⊢ Primrec fun a => a.fst :: Vector.toList a.snd Tactic: simp State Before: α : Type u_1 β : Type ?u.361685 γ : Type ?u.361688 σ : Type ?u.361691 inst✝³ : Primcodable α inst✝² : Primcodable β inst✝¹ : Primcodable γ inst✝ : Primcodable σ n : ℕ ⊢ Primrec fun a => a.fst :: Vector.toList a.snd State After: no goals Tactic: exact list_cons.comp fst (vector_toList_iff.2 snd)
\subsubsection{Isobaric Processes} Isobaric processes are compression/expansion processes in which the pressure of the gas does not change ($\Delta P = 0$). For example, consider a box of gas where the top face is a piston. If I heat up the gas with a candle, then the piston gets pushed up by the warming, expanding gas, while the pressure of the gas stays constant. \\ First, let us determine the work done on the gas in this process: \[W = -\int_{V_1}^{V_2} P(V)dV \] As $P$ is a constant, we can just take it outside the integral, and this becomes a very straightforward integration: \[W = -P\int_{V_1}^{V_2} dV = -P \cdot \left. V \right|_{V_1}^{V_2} = -P(V_2-V_1) = -P\Delta V\] \begin{equation} W = -P\Delta V \end{equation} Which is exactly as we would have expected. \\ Now that we know what the work done in an isobaric process is, we can consider the heat flow. We return to the first law of thermodynamics: \[ \Delta E = W + Q \] We recall that the following formula (from section 1) always holds true for change in energy: \[ \Delta E = nc_v\Delta T = n \frac{\chi}{2}R\Delta T \] We substitute the formulas for work and change in energy we have obtained: \[ n \frac{\chi}{2}R\Delta T = -P\Delta V + Q \] Now, we use the ideal gas law to recognize that: \[ P\Delta V = nR \Delta T \] Making this subtitution, we have: \[ n \frac{\chi}{2}R\Delta T = -nR \Delta T + Q \] Combining the like terms, we have: \[ Q = nR\left(\frac{\chi}{2}+1\right)\Delta T \] Now, let us define the heat capacity at constant pressure: \begin{equation} c_p = \left( \frac{\chi}{2}+1 \right)R = c_v+R \end{equation} Which gives us the formula for the heat in an isobaric process: \begin{equation} Q = nc_p \Delta T \end{equation} You may very well recognize this formula from high school physics or chemistry! Something of interest to point out here; we notive that $c_p>c_v$, or that the heat capacity at constant pressure is higher than the heat capacity at constant volume. This tells us that when something is allowed to expand as it is heated (retaining constant pressure), it requires more energy to increase its temperature than if it is kept at a fixed volume. \\ Finally, let's consider what an isobaric process looks like on a PV diagram. As you might suspect, since we fix $P$ and let $V$ vary throughout the whole process, we yet again get a straight line, except this time a horizontal one. Pictured below is an isothermal expansion: \begin{center} \begin{tikzpicture} \draw[stealth-stealth] (0,5) node[below left]{$P$} |- (5,0) node[below left]{$V$}; \draw[thick,->] (1,2.5) -- (2.5,2.5); \draw[thick] (2.5,2.5) -- (4,2.5); \draw[dashed] (0,2.5) -- (1,2.5); \draw[dashed] (1,0) -- (1,2.5); \draw[dashed] (4,0) -- (4,2.5); \filldraw (1,2.5) circle (2pt); \filldraw (4,2.5) circle (2pt); \node[below] at (4,0) {$V_2$}; \node[below] at (1,0) {$V_1$}; \node[left] at (0,2.5) {$P_1$}; \node[above] at (1,2.5) {$T_1$}; \node[above] at (4,2.5) {$T_2$}; \end{tikzpicture} \end{center} Again, for visual confirmation of our result for work during an isobaric process, we can see that the (negative) area under the curve is $-P_1\Delta V$, by inspection.
#pragma once #include <vector> #include <Eigen/Core> #include <Eigen/LU> #include <Eigen/Dense> namespace ImageInformationAnalyzer { namespace Domain { using namespace std::literals::string_literals; class FloatingPointImageData { public: const int Width; const int Height; const std::vector<std::vector<double>> ImageBuffer; const std::vector<std::vector<Eigen::Vector3d>> NormalBuffer; private: double maxValue_; double minValue_; public: explicit FloatingPointImageData::FloatingPointImageData(const int width, const int height , const std::vector<std::vector<double>> imageBuffer , const std::vector<std::vector<Eigen::Vector3d>> normalBuffer) : Width(width), Height(height), ImageBuffer(imageBuffer), NormalBuffer(normalBuffer) { maxValue_ = DBL_MIN; minValue_ = DBL_MAX; for(auto line : imageBuffer) { for(auto value : line) { if(value > maxValue_) { maxValue_ = value; } if(value < minValue_) { minValue_ = value; } } } } inline double GetMaxValue() const { return maxValue_; } inline double GetMinValue() const { return minValue_; } virtual ~FloatingPointImageData() = default; }; } }
If $g$ is analytic on $S$ and for every $z \in S$, there exists a $d > 0$ such that for all $w \in B(z, d) - \{a\}$, we have $g(w) = (w - a)f(w)$, then $F$ is analytic on $S$, where $F(z) = f(z) - g(a)/(z - a)$ if $z \neq a$ and $F(a) = g'(a)$.
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 17 22:30:07 2016 @author: [email protected] Dla Ruchu Społecznego Obywatele Nauki """ import numpy as np import matplotlib.pyplot as plt plt.rc('font', family='Arial') dt = np.dtype([('Country', 'S30'), ('Abrv', 'S3'), ("isEU", 'S5'), ('RD', np.float), ('Staff', np.float), ('SciPerMln', np.float), ('Granted', np.float), ('Eval', np.float), ('SucRate', np.float)]) MS = 10 FS = 19 TFS = 15 CLR = (0.25, 0.25, 0.85, 0.65) FIGSZ = (10, 10) low = 1.0 high = 2.0 figFormat = "png" legend_toupl = (u'> 2%', '1% - 2%', '< 1%', 'Polska', 'średnia') legTitle = '% PKB na BiR' def main(): """ """ data = np.genfromtxt("GDB_for_RD.csv", skip_header=1, dtype=dt, delimiter=',') pol = data[data['Abrv'] == "PL".encode()] jeden = data[data["RD"] <= low] dwa = data[np.logical_and(data["RD"] > low, data["RD"] <= high)] richBoys = data[data["RD"] > high] EU_mean_Staff = data[~np.isnan(data["Staff"])]["Staff"].mean() # How many application were evaluated depending on number of research staff plt.figure(1, figsize=FIGSZ) rb, = plt.loglog(richBoys["Staff"], richBoys["Eval"]+1, 'go', ms=MS) dw, = plt.loglog(dwa["Staff"], dwa["Eval"]+1, 'o', ms=MS, color=CLR) jj, = plt.loglog(jeden["Staff"], jeden["Eval"]+1, 'yo', ms=MS) pl, = plt.loglog(pol["Staff"], pol["Eval"]+1, 'ro', ms=MS) eu, = plt.loglog(EU_mean_Staff, np.mean(data["Eval"]+1), 'cD', ms=MS-2) plt.xlabel(u"Liczba badaczy na etatach w tys. [dane na 2014 r.]", fontsize=FS) plt.ylabel(u"Liczba wszystkich rozpatrzonych wniosków o granty ERC w 2015", fontsize=FS) for i, xy in enumerate(zip(data["Staff"], data["Eval"]+1)): plt.annotate(data['Abrv'][i].decode(), xy=xy, textcoords='data') plt.annotate("mean", xy=(EU_mean_Staff, np.mean(data["Eval"]+1)), textcoords='data') markers_toupl = (rb, dw, jj, pl, eu) plt.legend(markers_toupl, legend_toupl, loc='lower right', framealpha=0, numpoints=1, title=legTitle) plt.xticks(fontsize=TFS) plt.yticks(fontsize=TFS) plt.xlim(xmin=1) plt.grid(True) plt.savefig("EvalERC_Staff." + figFormat) # How many projects got approved depending on number of research staff plt.figure(2, figsize=FIGSZ) plt.loglog(richBoys["Staff"], richBoys["Granted"]+1, 'go', ms=MS) plt.loglog(jeden["Staff"], jeden["Granted"]+1, 'yo', ms=MS) plt.loglog(dwa["Staff"], dwa["Granted"]+1, 'o', ms=MS, color=CLR) plt.loglog(pol["Staff"], pol["Granted"]+1, 'ro', ms=MS) plt.loglog(EU_mean_Staff, np.mean(data["Granted"]+1), 'cD', ms=MS-2) plt.xlabel(u"Liczba badaczy na etatach w tys. [dane na 2014 r.]", fontsize=FS) plt.ylabel(u"Liczba pozytywnie rozpatrzonych wniosków o granty" + " ERC w 2015", fontsize=FS) for i, xy in enumerate(zip(data["Staff"], data["Granted"]+1)): plt.annotate(data['Abrv'][i].decode(), xy=xy, textcoords='data') plt.annotate("mean", xy=(EU_mean_Staff, np.mean(data["Granted"]+1)), textcoords='data') plt.legend(markers_toupl, legend_toupl, loc='lower right', framealpha=0, numpoints=1, title=legTitle) plt.xticks(fontsize=TFS) plt.yticks(fontsize=TFS) plt.xlim(xmin=1) plt.grid(True) plt.savefig("GrantedERC_Staff." + figFormat) # Success rate vs fraction of GDP spend on R&D plt.figure(3, figsize=FIGSZ) plt.plot(richBoys['RD'], richBoys['SucRate'], 'go', ms=MS) plt.plot(jeden['RD'], jeden['SucRate'], 'yo', ms=MS) plt.plot(dwa['RD'], dwa['SucRate'], 'o', ms=MS, color=CLR) plt.plot(pol['RD'], pol['SucRate'], 'ro', ms=MS) plt.plot(np.mean(data["RD"]), np.mean(data["SucRate"]), 'cD', ms=MS-2) plt.xlabel(u"Proc. PKB na badania i rozwój [dane na 2014 r.]", fontsize=FS) plt.ylabel("Wskaźnik sukcesu wliczajacy wszytkie konkursy ERC w 2015", fontsize=FS) for i, xy in enumerate(zip(data['RD'], data['SucRate'])): plt.annotate(data['Abrv'][i].decode(), xy=xy, textcoords='data') plt.annotate("mean", xy=(np.mean(data["RD"]), np.mean(data["SucRate"])), textcoords='data') plt.legend(markers_toupl, legend_toupl, loc='lower right', framealpha=0, numpoints=1, title=legTitle) plt.xticks(fontsize=TFS) plt.yticks(fontsize=TFS) plt.ylim(ymax=0.30001) plt.grid(True) plt.savefig("SucRate_GDP." + figFormat) # Number of scientist per million people vs R&D spending plt.figure(4, figsize=FIGSZ) plt.plot(richBoys['RD'], richBoys['SciPerMln'], 'go', ms=MS) plt.plot(jeden['RD'], jeden['SciPerMln'], 'yo', ms=MS) plt.plot(dwa['RD'], dwa['SciPerMln'], 'o', ms=MS, color=CLR) plt.plot(pol['RD'], pol['SciPerMln'], 'ro', ms=MS) plt.plot(np.mean(data["RD"]), np.mean(data["SciPerMln"]), 'cD', ms=MS-2) plt.xlabel(u"Proc. PKB na badania i rozwój [dane na 2014 r.]", fontsize=FS) plt.ylabel("Liczba badaczy przypadająca na million mieszkanców" + " [dane na 2014 r.]", fontsize=FS) for i, xy in enumerate(zip(data['RD'], data['SciPerMln'])): plt.annotate(data['Abrv'][i].decode(), xy=xy, textcoords='data') plt.annotate("mean", xy=(np.mean(data["RD"]), np.mean(data["SciPerMln"])), textcoords='data') plt.legend(markers_toupl, legend_toupl, loc='lower right', framealpha=0, numpoints=1, title=legTitle) plt.xticks(fontsize=TFS) plt.yticks(fontsize=TFS) plt.grid(True) # plt.tight_layout() plt.savefig("GDP_SciPerMln." + figFormat) print("Done!") plt.show() if __name__ == "__main__": main()
lemma Cauchy_theorem_homotopic: assumes hom: "if atends then homotopic_paths S g h else homotopic_loops S g h" and "open S" and f: "f holomorphic_on S" and vpg: "valid_path g" and vph: "valid_path h" shows "contour_integral g f = contour_integral h f"
(* Copyright (C) 2020 Susi Lehtola This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. *) (* type: mgga_exc *) (* prefix: mgga_x_jk_params *params; assert(p->params != NULL); params = (mgga_x_jk_params * ) (p->params); *) $include "gga_x_b88.mpl" (* equation 11 *) y := (x,u) -> x^2 - u: (* equation 5 *) gBecke := x -> b88_f(x)-1: (* equation 24 *) jk_f := (x,u,t) -> 1 + gBecke(x)/(1 + 2*y(x,u)/x^2): f := (rs, z, xt, xs0, xs1, u0, u1, t0, t1) -> mgga_exchange(jk_f, rs, z, xs0, xs1, u0, u1, t0, t1):
using Comrade, ComradeAdaptMCMC, Distributions using Test load_ehtim() include(joinpath(@__DIR__, "../../../test/test_util.jl")) @testset "ComradeAdaptMCMC.jl" begin m, vis, amp, lcamp, cphase = load_data() prior = test_prior() lklhd = RadioLikelihood(lcamp, cphase) post = Posterior(lklhd, prior, test_model) a1 = AdaptMCMC(ntemp=5) a2 = AdaptMCMC(ntemp=5, all_levels=true) x0 = prior_sample(post) chain, stats = sample(post, a1, 100_000; thin=5) chain, stats = sample(post, a2, 100_000; thin=5) chain, stats = sample(post, a1, 100_000; thin=5, init_params=x0) cpost = ascube(post) l0 = logdensityof(cpost, Comrade.HypercubeTransform.inverse(cpost, x0)) @test l0 < mean(stats.logl[1]) end
%[2015]-"Multi-verse optimizer: A nature-inspired algorithm for global %optimization" % (9/12/2020) function MVO = jMultiVerseOptimizer(feat,label,opts) % Parameters lb = 0; ub = 1; thres = 0.5; p = 6; % control TDR Wmax = 1; % maximum WEP Wmin = 0.2; % minimum WEP type = 1; if isfield(opts,'T'), max_Iter = opts.T; end if isfield(opts,'N'), N = opts.N; end if isfield(opts,'p'), p = opts.p; end if isfield(opts,'Wmin'), Wmin = opts.Wmin; end if isfield(opts,'Wmax'), Wmax = opts.Wmax; end if isfield(opts,'ty'), type = opts.ty; end if isfield(opts,'thres'), thres = opts.thres; end % Objective function fun = @jFitnessFunction; % Number of dimensions dim = size(feat,2); % Initial X = zeros(N,dim); for i = 1:N for d = 1:dim X(i,d) = lb + (ub - lb) * rand(); end end % Pre fit = zeros(1,N); fitG = inf; curve = inf; t = 1; % Iterations while t <= max_Iter % Calculate inflation rate for i = 1:N fit(i) = fun(feat,label,(X(i,:) > thres),opts); % Best universe if fit(i) < fitG fitG = fit(i); Xgb = X(i,:); end end % Sort universe from best to worst [fitSU, idx] = sort(fit,'ascend'); X_SU = X(idx,:); % Elitism (first 1 is elite) X(1,:) = X_SU(1,:); % Either 1-norm or 2-norm if type == 1 % Normalize inflation rate using 2-norm NI = fitSU ./ sqrt(sum(fitSU .^ 2)); elseif type == 2 % Normalize inflation rate using 1-norm NI = fitSU / sum(fitSU); end % Normalize inverse inflation rate using 1-norm inv_fitSU = 1 ./ (1 + fitSU); inv_NI = inv_fitSU / sum(inv_fitSU); % Wormhole Existence probability (3.3), increases from 0.2 to 1 WEP = Wmin + t * ((Wmax - Wmin) / max_Iter); % Travelling disrance rate (3.4), descreases from 0.6 to 0 TDR = 1 - ((t ^ (1 / p)) / (max_Iter ^ (1 / p))); % Start with 2 since first is elite for i = 2:N % Define black hole idx_BH = i; for d = 1:dim % White/black hole tunnels & exchange object of universes (3.1) r1 = rand(); if r1 < NI(i) % Random select k with roulette wheel idx_WH = jRouletteWheelSelection(inv_NI); % Position update X(idx_BH, d) = X_SU(idx_WH, d); end % Local changes for universes (3.2) r2 = rand(); if r2 < WEP r3 = rand(); r4 = rand(); if r3 < 0.5 X(i,d) = Xgb(d) + TDR * ((ub - lb) * r4 + lb); else X(i,d) = Xgb(d) - TDR * ((ub - lb) * r4 + lb); end else X(i,d) = X(i,d); end end % Boundary XB = X(i,:); XB(XB > ub) = ub; XB(XB < lb) = lb; X(i,:) = XB; end curve(t) = fitG; fprintf('\nIteration %d Best (MVO)= %f',t,curve(t)) t = t + 1; end % Select features Pos = 1:dim; Sf = Pos((Xgb > thres) == 1); sFeat = feat(:,Sf); % Store results MVO.sf = Sf; MVO.ff = sFeat; MVO.nf = length(Sf); MVO.c = curve; MVO.f = feat; MVO.l = label; end %// Roulette Wheel Selection // function Index = jRouletteWheelSelection(prob) % Cummulative summation C = cumsum(prob); % Random one value, most probability value [0~1] P = rand(); % Route wheel for i = 1:length(C) if C(i) > P Index = i; break; end end end
= = = = 2004 = = = =
[GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b✝ b₁ b₂ : β inst✝¹ : Preorder α inst✝ : Preorder β l : α → β u : β → α gc : GaloisConnection l u s : Set α b : β ⊢ b ∈ upperBounds (l '' s) ↔ b ∈ u ⁻¹' upperBounds s [PROOFSTEP] simp [upperBounds, gc _ _] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : Preorder α inst✝ : Preorder β l : α → β u : β → α gc : GaloisConnection l u s : Set α x✝ : BddAbove (l '' s) x : β hx : x ∈ upperBounds (l '' s) ⊢ u x ∈ upperBounds s [PROOFSTEP] rwa [gc.upperBounds_l_image] at hx [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β inst✝¹ : Preorder α inst✝ : Preorder β l : α → β u : β → α gc : GaloisConnection l u s : Set α a : α h : IsLUB s a b : β hb : b ∈ upperBounds (l '' s) ⊢ u b ∈ upperBounds s [PROOFSTEP] rwa [gc.upperBounds_l_image] at hb [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : PartialOrder α inst✝ : Preorder β l : α → β u : β → α gc : GaloisConnection l u z : α y : β ⊢ u y = z ↔ ∀ (x : α), x ≤ z ↔ l x ≤ y [PROOFSTEP] constructor [GOAL] case mp α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : PartialOrder α inst✝ : Preorder β l : α → β u : β → α gc : GaloisConnection l u z : α y : β ⊢ u y = z → ∀ (x : α), x ≤ z ↔ l x ≤ y [PROOFSTEP] rintro rfl x [GOAL] case mp α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : PartialOrder α inst✝ : Preorder β l : α → β u : β → α gc : GaloisConnection l u y : β x : α ⊢ x ≤ u y ↔ l x ≤ y [PROOFSTEP] exact (gc x y).symm [GOAL] case mpr α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : PartialOrder α inst✝ : Preorder β l : α → β u : β → α gc : GaloisConnection l u z : α y : β ⊢ (∀ (x : α), x ≤ z ↔ l x ≤ y) → u y = z [PROOFSTEP] intro H [GOAL] case mpr α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : PartialOrder α inst✝ : Preorder β l : α → β u : β → α gc : GaloisConnection l u z : α y : β H : ∀ (x : α), x ≤ z ↔ l x ≤ y ⊢ u y = z [PROOFSTEP] exact ((H <| u y).mpr (gc.l_u_le y)).antisymm ((gc _ _).mp <| (H z).mp le_rfl) [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : Preorder α inst✝ : PartialOrder β l : α → β u : β → α gc : GaloisConnection l u x : α z : β ⊢ l x = z ↔ ∀ (y : β), z ≤ y ↔ x ≤ u y [PROOFSTEP] constructor [GOAL] case mp α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : Preorder α inst✝ : PartialOrder β l : α → β u : β → α gc : GaloisConnection l u x : α z : β ⊢ l x = z → ∀ (y : β), z ≤ y ↔ x ≤ u y [PROOFSTEP] rintro rfl y [GOAL] case mp α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : Preorder α inst✝ : PartialOrder β l : α → β u : β → α gc : GaloisConnection l u x : α y : β ⊢ l x ≤ y ↔ x ≤ u y [PROOFSTEP] exact gc x y [GOAL] case mpr α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : Preorder α inst✝ : PartialOrder β l : α → β u : β → α gc : GaloisConnection l u x : α z : β ⊢ (∀ (y : β), z ≤ y ↔ x ≤ u y) → l x = z [PROOFSTEP] intro H [GOAL] case mpr α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : Preorder α inst✝ : PartialOrder β l : α → β u : β → α gc : GaloisConnection l u x : α z : β H : ∀ (y : β), z ≤ y ↔ x ≤ u y ⊢ l x = z [PROOFSTEP] exact ((gc _ _).mpr <| (H z).mp le_rfl).antisymm ((H <| l x).mpr (gc.le_u_l x)) [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : SemilatticeSup α inst✝ : SemilatticeSup β l : α → β u : β → α gc : GaloisConnection l u ⊢ IsLUB (l '' {a₁, a₂}) (l a₁ ⊔ l a₂) [PROOFSTEP] simp only [image_pair, isLUB_pair] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β l : α → β u : β → α gc : GaloisConnection l u f : ι → α ⊢ IsLUB (range (l ∘ f)) (l (iSup f)) [PROOFSTEP] rw [range_comp, ← sSup_range] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β l : α → β u : β → α gc : GaloisConnection l u f : ι → α ⊢ IsLUB (l '' range f) (l (sSup (range f))) [PROOFSTEP] exact gc.isLUB_l_image (isLUB_sSup _) [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β l : α → β u : β → α gc : GaloisConnection l u f : (i : ι) → κ i → α ⊢ l (⨆ (i : ι) (j : κ i), f i j) = ⨆ (i : ι) (j : κ i), l (f i j) [PROOFSTEP] simp_rw [gc.l_iSup] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β l : α → β u : β → α gc : GaloisConnection l u s : Set α ⊢ l (sSup s) = ⨆ (a : α) (_ : a ∈ s), l a [PROOFSTEP] simp only [sSup_eq_iSup, gc.l_iSup] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝² : Preorder α inst✝¹ : Preorder β inst✝ : Preorder γ l1 : α → β u1 : β → α l2 : β → γ u2 : γ → β gc1 : GaloisConnection l1 u1 gc2 : GaloisConnection l2 u2 ⊢ GaloisConnection (l2 ∘ l1) (u1 ∘ u2) [PROOFSTEP] intro a b [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β inst✝² : Preorder α inst✝¹ : Preorder β inst✝ : Preorder γ l1 : α → β u1 : β → α l2 : β → γ u2 : γ → β gc1 : GaloisConnection l1 u1 gc2 : GaloisConnection l2 u2 a : α b : γ ⊢ (l2 ∘ l1) a ≤ b ↔ a ≤ (u1 ∘ u2) b [PROOFSTEP] dsimp [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β inst✝² : Preorder α inst✝¹ : Preorder β inst✝ : Preorder γ l1 : α → β u1 : β → α l2 : β → γ u2 : γ → β gc1 : GaloisConnection l1 u1 gc2 : GaloisConnection l2 u2 a : α b : γ ⊢ l2 (l1 a) ≤ b ↔ a ≤ u1 (u2 b) [PROOFSTEP] rw [gc2, gc1] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : BooleanAlgebra α inst✝ : BooleanAlgebra β l : α → β u : β → α gc : GaloisConnection l u ⊢ GaloisConnection (compl ∘ u ∘ compl) (compl ∘ l ∘ compl) [PROOFSTEP] intro a b [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β inst✝¹ : BooleanAlgebra α inst✝ : BooleanAlgebra β l : α → β u : β → α gc : GaloisConnection l u a : β b : α ⊢ (compl ∘ u ∘ compl) a ≤ b ↔ a ≤ (compl ∘ l ∘ compl) b [PROOFSTEP] dsimp [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β inst✝¹ : BooleanAlgebra α inst✝ : BooleanAlgebra β l : α → β u : β → α gc : GaloisConnection l u a : β b : α ⊢ (u aᶜ)ᶜ ≤ b ↔ a ≤ (l bᶜ)ᶜ [PROOFSTEP] rw [le_compl_iff_le_compl, gc, compl_le_iff_compl_le] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝² : CompleteLattice α inst✝¹ : CompleteLattice β inst✝ : CompleteLattice γ f : α → β → γ s : Set α t : Set β l u : α → β → γ l₁ u₁ : β → γ → α l₂ u₂ : α → γ → β h₁ : ∀ (b : β), GaloisConnection (swap l b) (u₁ b) h₂ : ∀ (a : α), GaloisConnection (l a) (u₂ a) ⊢ sSup (image2 l s t) = l (sSup s) (sSup t) [PROOFSTEP] simp_rw [sSup_image2, ← (h₂ _).l_sSup, ← (h₁ _).l_sSup] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝² : CompleteLattice α inst✝¹ : CompleteLattice β inst✝ : CompleteLattice γ f : α → β → γ s : Set α t : Set β l u : α → β → γ l₁ u₁ : β → γ → α l₂ u₂ : α → γ → β h₁ : ∀ (b : β), GaloisConnection (l₁ b) (swap u b) h₂ : ∀ (a : α), GaloisConnection (l₂ a) (u a) ⊢ sInf (image2 u s t) = u (sInf s) (sInf t) [PROOFSTEP] simp_rw [sInf_image2, ← (h₂ _).u_sInf, ← (h₁ _).u_sInf] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : Preorder α inst✝ : Preorder β e : α ≃o β s : Set β ⊢ BddAbove (↑e ⁻¹' s) ↔ BddAbove s [PROOFSTEP] rw [← e.bddAbove_image, e.image_preimage] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β inst✝¹ : Preorder α inst✝ : Preorder β e : α ≃o β s : Set β ⊢ BddBelow (↑e ⁻¹' s) ↔ BddBelow s [PROOFSTEP] rw [← e.bddBelow_image, e.image_preimage] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β l : α → β u : β → α inst✝¹ : SemilatticeSup α inst✝ : SemilatticeSup β gi : GaloisInsertion l u a b : β ⊢ l (u a) ⊔ l (u b) = a ⊔ b [PROOFSTEP] simp only [gi.l_u_eq] [GOAL] α : Type u β : Type v γ : Type w ι✝ : Sort x κ : ι✝ → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β gi : GaloisInsertion l u ι : Sort x p : ι → Prop f : (i : ι) → p i → β ⊢ l (⨆ (i : ι) (hi : p i), u (f i hi)) = ⨆ (i : ι) (hi : p i), f i hi [PROOFSTEP] simp only [iSup_subtype', gi.l_iSup_u] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β gi : GaloisInsertion l u s : Set β ⊢ l (sSup (u '' s)) = sSup s [PROOFSTEP] rw [sSup_image, gi.l_biSup_u, sSup_eq_iSup] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β l : α → β u : β → α inst✝¹ : SemilatticeInf α inst✝ : SemilatticeInf β gi : GaloisInsertion l u a b : β ⊢ l (u (a ⊓ b)) = a ⊓ b [PROOFSTEP] simp only [gi.l_u_eq] [GOAL] α : Type u β : Type v γ : Type w ι✝ : Sort x κ : ι✝ → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β gi : GaloisInsertion l u ι : Sort x p : ι → Prop f : (i : ι) → p i → β ⊢ l (⨅ (i : ι) (hi : p i), u (f i hi)) = ⨅ (i : ι) (hi : p i), f i hi [PROOFSTEP] simp only [iInf_subtype', gi.l_iInf_u] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β gi : GaloisInsertion l u s : Set β ⊢ l (sInf (u '' s)) = sInf s [PROOFSTEP] rw [sInf_image, gi.l_biInf_u, sInf_eq_iInf] [GOAL] α : Type u β : Type v γ : Type w ι✝ : Sort x κ : ι✝ → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β gi : GaloisInsertion l u ι : Sort x f : ι → α hf : ∀ (i : ι), u (l (f i)) = f i ⊢ l (⨅ (i : ι), f i) = l (⨅ (i : ι), u (l (f i))) [PROOFSTEP] simp [hf] [GOAL] α : Type u β : Type v γ : Type w ι✝ : Sort x κ : ι✝ → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β gi : GaloisInsertion l u ι : Sort x p : ι → Prop f : (i : ι) → p i → α hf : ∀ (i : ι) (hi : p i), u (l (f i hi)) = f i hi ⊢ l (⨅ (i : ι) (hi : p i), f i hi) = ⨅ (i : ι) (hi : p i), l (f i hi) [PROOFSTEP] rw [iInf_subtype', iInf_subtype'] [GOAL] α : Type u β : Type v γ : Type w ι✝ : Sort x κ : ι✝ → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : CompleteLattice α inst✝ : CompleteLattice β gi : GaloisInsertion l u ι : Sort x p : ι → Prop f : (i : ι) → p i → α hf : ∀ (i : ι) (hi : p i), u (l (f i hi)) = f i hi ⊢ l (⨅ (x : { i // p i }), f ↑x (_ : p ↑x)) = ⨅ (x : { i // p i }), l (f ↑x (_ : p ↑x)) [PROOFSTEP] exact gi.l_iInf_of_ul_eq_self _ fun _ => hf _ _ [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : SemilatticeInf α gi : GaloisInsertion l u src✝ : PartialOrder β := inst✝¹ ⊢ ∀ (a b : β), a ⊓ b ≤ a [PROOFSTEP] simp only [gi.choice_eq] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : SemilatticeInf α gi : GaloisInsertion l u src✝ : PartialOrder β := inst✝¹ ⊢ ∀ (a b : β), l (u a ⊓ u b) ≤ a [PROOFSTEP] exact fun a b => gi.gc.l_le inf_le_left [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : SemilatticeInf α gi : GaloisInsertion l u src✝ : PartialOrder β := inst✝¹ ⊢ ∀ (a b : β), a ⊓ b ≤ b [PROOFSTEP] simp only [gi.choice_eq] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : SemilatticeInf α gi : GaloisInsertion l u src✝ : PartialOrder β := inst✝¹ ⊢ ∀ (a b : β), l (u a ⊓ u b) ≤ b [PROOFSTEP] exact fun a b => gi.gc.l_le inf_le_right [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : SemilatticeInf α gi : GaloisInsertion l u src✝ : PartialOrder β := inst✝¹ ⊢ ∀ (a b c : β), a ≤ b → a ≤ c → a ≤ b ⊓ c [PROOFSTEP] simp only [gi.choice_eq] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : SemilatticeInf α gi : GaloisInsertion l u src✝ : PartialOrder β := inst✝¹ ⊢ ∀ (a b c : β), a ≤ b → a ≤ c → a ≤ l (u b ⊓ u c) [PROOFSTEP] exact fun a b c hac hbc => (gi.le_l_u a).trans <| gi.gc.monotone_l <| le_inf (gi.gc.monotone_u hac) (gi.gc.monotone_u hbc) [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝² : PartialOrder β inst✝¹ : Preorder α inst✝ : OrderTop α gi : GaloisInsertion l u ⊢ ∀ (a : β), a ≤ ⊤ [PROOFSTEP] simp only [gi.choice_eq] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝² : PartialOrder β inst✝¹ : Preorder α inst✝ : OrderTop α gi : GaloisInsertion l u ⊢ ∀ (a : β), a ≤ l ⊤ [PROOFSTEP] exact fun b => (gi.le_l_u b).trans (gi.gc.monotone_l le_top) [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : CompleteLattice α gi : GaloisInsertion l u src✝¹ : BoundedOrder β := liftBoundedOrder gi src✝ : Lattice β := liftLattice gi s : Set β ⊢ ∀ (a : β), a ∈ s → sInf s ≤ a [PROOFSTEP] dsimp [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : CompleteLattice α gi : GaloisInsertion l u src✝¹ : BoundedOrder β := liftBoundedOrder gi src✝ : Lattice β := liftLattice gi s : Set β ⊢ ∀ (a : β), a ∈ s → choice gi (sInf (u '' s)) (_ : u (l (sInf (u '' s))) ≤ sInf (u '' s)) ≤ a [PROOFSTEP] rw [gi.choice_eq] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : CompleteLattice α gi : GaloisInsertion l u src✝¹ : BoundedOrder β := liftBoundedOrder gi src✝ : Lattice β := liftLattice gi s : Set β ⊢ ∀ (a : β), a ∈ s → l (sInf (u '' s)) ≤ a [PROOFSTEP] exact (gi.isGLB_of_u_image (isGLB_sInf _)).1 [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : CompleteLattice α gi : GaloisInsertion l u src✝¹ : BoundedOrder β := liftBoundedOrder gi src✝ : Lattice β := liftLattice gi s : Set β ⊢ ∀ (a : β), (∀ (b : β), b ∈ s → a ≤ b) → a ≤ sInf s [PROOFSTEP] dsimp [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : CompleteLattice α gi : GaloisInsertion l u src✝¹ : BoundedOrder β := liftBoundedOrder gi src✝ : Lattice β := liftLattice gi s : Set β ⊢ ∀ (a : β), (∀ (b : β), b ∈ s → a ≤ b) → a ≤ choice gi (sInf (u '' s)) (_ : u (l (sInf (u '' s))) ≤ sInf (u '' s)) [PROOFSTEP] rw [gi.choice_eq] [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a a₁ a₂ : α b b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder β inst✝ : CompleteLattice α gi : GaloisInsertion l u src✝¹ : BoundedOrder β := liftBoundedOrder gi src✝ : Lattice β := liftLattice gi s : Set β ⊢ ∀ (a : β), (∀ (b : β), b ∈ s → a ≤ b) → a ≤ l (sInf (u '' s)) [PROOFSTEP] exact (gi.isGLB_of_u_image (isGLB_sInf _)).2 [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder α inst✝ : SemilatticeInf β gi : GaloisCoinsertion l u src✝ : PartialOrder α := inst✝¹ a b : α ⊢ a ⊓ b ≤ a [PROOFSTEP] exact (@OrderDual.semilatticeInf αᵒᵈ gi.dual.liftSemilatticeSup).inf_le_left a b [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder α inst✝ : SemilatticeInf β gi : GaloisCoinsertion l u src✝ : PartialOrder α := inst✝¹ a b : α ⊢ a ⊓ b ≤ b [PROOFSTEP] exact (@OrderDual.semilatticeInf αᵒᵈ gi.dual.liftSemilatticeSup).inf_le_right a b [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder α inst✝ : SemilatticeInf β gi : GaloisCoinsertion l u src✝ : PartialOrder α := inst✝¹ a b c : α ⊢ a ≤ b → a ≤ c → a ≤ b ⊓ c [PROOFSTEP] exact (@OrderDual.semilatticeInf αᵒᵈ gi.dual.liftSemilatticeSup).le_inf a b c [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder α inst✝ : SemilatticeSup β gi : GaloisCoinsertion l u src✝ : PartialOrder α := inst✝¹ a b : α ⊢ a ≤ a ⊔ b [PROOFSTEP] exact (@OrderDual.semilatticeSup αᵒᵈ gi.dual.liftSemilatticeInf).le_sup_left a b [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder α inst✝ : SemilatticeSup β gi : GaloisCoinsertion l u src✝ : PartialOrder α := inst✝¹ a b : α ⊢ b ≤ a ⊔ b [PROOFSTEP] exact (@OrderDual.semilatticeSup αᵒᵈ gi.dual.liftSemilatticeInf).le_sup_right a b [GOAL] α : Type u β : Type v γ : Type w ι : Sort x κ : ι → Sort u_1 a✝ a₁ a₂ : α b✝ b₁ b₂ : β l : α → β u : β → α inst✝¹ : PartialOrder α inst✝ : SemilatticeSup β gi : GaloisCoinsertion l u src✝ : PartialOrder α := inst✝¹ a b c : α ⊢ a ≤ c → b ≤ c → a ⊔ b ≤ c [PROOFSTEP] exact (@OrderDual.semilatticeSup αᵒᵈ gi.dual.liftSemilatticeInf).sup_le a b c
Require Import HoTT. Require Import structures. Local Open Scope list_scope. Notation "[]" := nil : list_scope. Module ListHelpers. Definition tl {A} (l:list A) := match l with | nil => nil | a :: m => m end. Fixpoint onth {A : Type} (l:list A) (n:nat) {struct n} : option A := match n, l with | O, x :: _ => Some x | S n, _ :: l => onth l n | _, _ => None end. Definition nil_cons {A} {x:A} {l:list A} : [] <> x :: l := fun eq => @paths_rec _ [] (fun l => match l with [] => _ | _ => _ end) tt _ eq. Lemma cons_inj {A} {x y : A} {l k} : x :: l = y :: k -> x = y /\ l = k. Proof. intro eq. split. - exact (ap (fun a => match a with [] => x | z :: _ => z end) eq). - exact (ap (fun a => match a with [] => [] | _ :: z => z end) eq). Defined. End ListHelpers. Import ListHelpers. Module NEList. Export Magma. Inductive NEList (A : Type) : Type := | single : A -> NEList A | cons : A -> NEList A -> NEList A . Arguments single {_} _. Arguments cons {_} _ _. Fixpoint Napp {A} (l l' : (NEList A)) : (NEList A) := match l with | single i => cons i l' | cons i l => cons i (Napp l l') end. Section VarSec. Context {A} {G : Gop A}. Definition someOp : Gop (option A) := fun a b => match a,b with | Some x, Some y => Some (gop x y) | _, _ => None end. Fixpoint evalNE {B} (f : B -> option A) (l : (NEList B)) : option A := match l with | cons i l => someOp (f i) (evalNE f l) | single i => f i end. Global Instance someOp_assoc : forall {Hassoc : Associative G}, Associative someOp. Proof. red. destruct x,y,z;simpl;auto. unfold gop;simpl. apply ap;apply Hassoc. Defined. Global Instance someOp_comm : forall {Hcomm : Commutative G}, Commutative someOp. Proof. red;destruct x,y;simpl;auto. apply (ap (@Some _));apply Hcomm. Defined. Lemma evalNE_app : forall {Hassoc : Associative G}, forall {B} (f : B -> option A) l l', evalNE f (Napp l l') = someOp (evalNE f l) (evalNE f l'). Proof. induction l;intros;simpl in *. reflexivity. path_via (someOp (f a) (someOp (evalNE f l) (evalNE f l'))). apply ap. apply IHl. apply someOp_assoc. Defined. Lemma NEList_eq_dec : DecidablePaths A -> DecidablePaths (NEList A). Proof. red. intros Ha. induction x;destruct y. destruct (Ha a a0);[left|right]. apply ap;assumption. exact (fun H => n (ap (fun s => match s with | single x => x | _ => a end) H)). right;exact (fun H => transport (fun s => match s with | single _ => Unit | _ => Empty end) H tt). right;exact (fun H => transport (fun s => match s with | single _ => Empty | _ => Unit end) H tt). destruct (Ha a a0). destruct (IHx y). left;apply ap11;[apply ap|];assumption. right;exact (fun H => n (ap (fun s => match s with | cons _ z => z | single _ => x end) H)). right;exact (fun H => n (ap (fun s => match s with | cons z _ => z | _ => a end) H)). Defined. End VarSec. Section Sort. Context {A : Type}. Variable order_dec : A -> A -> Bool. Fixpoint sortInsert i l := match l with | single j => if order_dec i j then cons i (single j) else cons j (single i) | cons j l => if order_dec i j then cons i (cons j l) else cons j (sortInsert i l) end. Fixpoint sort l := match l with | single i => single i | cons i l => sortInsert i (sort l) end. Lemma sortInsert_correct : forall {B} {G:Gop B} {Hsg : IsSemigroup G}, forall (f : A -> option B) i l, evalNE f (sortInsert i l) = evalNE f (cons i l). Proof. simpl. induction l. - simpl. destruct (order_dec i a);simpl;first [reflexivity | apply someOp_comm]. - simpl. destruct (order_dec i a);simpl. reflexivity. path_via (someOp (f a) (someOp (f i) (evalNE f l))). apply ap. assumption. path_via (someOp (someOp (f a) (f i)) (evalNE f l)). apply someOp_assoc. path_via (someOp (someOp (f i) (f a)) (evalNE f l)). apply ap10. apply ap. apply someOp_comm. apply inverse;apply someOp_assoc. Defined. Lemma sort_correct : forall {B} {G:Gop B} {Hsg : IsSemigroup G}, forall (f : A -> option B) l, evalNE f (sort l) = evalNE f l. Proof. induction l;simpl. - reflexivity. - eapply concat. apply sortInsert_correct. simpl. apply ap. assumption. Defined. End Sort. Arguments sort_correct {_} _ {_ _ _} _ _. Definition nat_order_dec : nat -> nat -> Bool. Proof. intros n;induction n;intros m. - (*0 < m *) destruct m;[exact false | exact true]. - (* S n < m *) destruct m. (* S n < 0 *) exact false. (* S n < S m *) exact (IHn m). Defined. Definition NEList_order_dec : forall {A} (order_dec : A -> A -> Bool), forall l l' : NEList A, Bool. Proof. intros ? ? l;induction l as [x | x l];intro l';destruct l' as [y | y l']. - (* [x] < [y] *) exact (order_dec x y). - (* [x] < y::l', l' # [] *) exact (negb (order_dec y x)). - (* x::l < [y], l # [] *) exact (negb (order_dec x y)). - (* x::l < y::l', IHl is l < _ *) exact (orb (order_dec x y) (andb (negb (order_dec y x)) (IHl l'))). Defined. Definition NEList_nat_order_dec := NEList_order_dec nat_order_dec. End NEList. Export NEList. Module BinOpTree. (*Import ListNotations.*) Inductive T (A : Type) : Type := | Op : T A -> T A -> T A | Val : A -> T A . Arguments Op {_} _ _. Arguments Val {_} _. Fixpoint evalTree {A} {G:Gop A} {B} (f : B -> option A) (t : T B) : option A := match t with | Op t1 t2 => someOp (evalTree f t1) (evalTree f t2) | Val i => f i end. Section Nota. Fixpoint T2list {A} (t : T A) : (NEList A) := match t with | Op t1 t2 => Napp (T2list t1) (T2list t2) | Val i => single i end. Lemma T2list_correct : forall {A} {G : Gop A} {Hassoc : Associative G} {B} (f : B -> option A) t, evalNE f (T2list t) = evalTree f t. Proof. induction t. - simpl. path_via (someOp (evalNE f (T2list t1)) (evalNE f (T2list t2))). apply evalNE_app. apply ap11;[apply ap|];assumption. - simpl. reflexivity. Defined. Section SortUse. Context {A} {G : Gop A} {Hsg : IsSemigroup G}. Context {B} {order_dec : B -> B -> Bool}. Lemma sort_full : forall (f : B -> option A) t, evalNE f (sort order_dec (T2list t)) = evalTree f t. Proof. intros. path_via (evalNE f (T2list t)). apply sort_correct. assumption. apply T2list_correct. Defined. Lemma sort_inj : forall (f : B -> option A) t1 t2, evalNE f (sort order_dec (T2list t1)) = evalNE f (sort order_dec (T2list t2)) -> evalTree f t1 = evalTree f t2. Proof. intros ? ? ? H. eapply concat;[symmetry;apply sort_full|]. eapply concat;[apply H|]. apply sort_full. Defined. End SortUse. Section Prefix. Context {A : Type}. (* prefix stuff should be moved so that it may work for types not in magmas *) Inductive prefix : relation (list A) := | pref_nil : forall l, prefix nil l | pref_cons : forall l l', prefix l l' -> forall x, prefix (x::l) (x::l') . Instance prefix_refl : Reflexive prefix. Proof. red. intro l;induction l;constructor;auto. Defined. Lemma cons_pref : forall x l l', prefix (x::l) l' -> (l' = x::(tl l') /\ prefix l (tl l')). Proof. assert (H : forall l l', prefix l l' -> forall x l1, l = x::l1 -> l' = x::(tl l') /\ prefix l1 (tl l')). intros ? ? H;induction H. - intros ? ? H. destruct (nil_cons H). - intros ? ? H0. apply cons_inj in H0. destruct H0 as [H0 H1]; destruct H0; destruct H1. simpl. split;auto. - intros. apply H with (x::l);auto. Defined. Global Instance prefix_trans : Transitive prefix. Proof. red. intros l1 l2 l3 H H'. revert H'. revert l3. induction H. - constructor. - intros l3 H'. apply cons_pref in H'. destruct H' as [H0 H1]. destruct l3;simpl in *. destruct (nil_cons H0). apply cons_inj in H0. destruct H0 as [H0 _]; destruct H0. constructor. auto. Defined. Lemma app_prefix : forall l l', prefix l (l++l'). Proof. induction l;intros;constructor;auto. Defined. Lemma prefix_app : forall l l', prefix l l' -> exists l0, l' = l++l0. Proof. induction 1 as [| ? ? ? IH]. econstructor;reflexivity. destruct IH as [? p]. econstructor. simpl; apply ap. apply p. Defined. Lemma prefix_nth : forall l l', prefix l l' -> forall i v, onth l i = Some v -> onth l' i = Some v. Proof. intros ? ? H;induction H. - intros ? ? H;intros. destruct i;simpl in H;destruct (transport (fun s => match s with | None => Unit | _ => Empty end) H tt). - intros ? ? H'. destruct i. apply H'. apply IHprefix. apply H'. Defined. Global Instance prefix_antisymm : Relation.Antisymmetric prefix. Proof. intros ? ? H;induction H;intros H'. destruct l;auto. apply cons_pref in H'. destruct H' as [H _]. destruct (nil_cons H). apply cons_pref in H'. destruct H' as [_ H']. simpl in *. apply ap. auto. Defined. End Prefix. Arguments prefix_trans {_ _ _ _} _ _. Section XFind. Variable A : Type. Definition invariant s r i (e : A) := onth r i = Some e /\ prefix s r. (* Tagging for controlling the search of instances *) Structure xtagged := XTag {xuntag :> A}. Definition extend_tag := XTag. Definition recurse_tag := extend_tag. Canonical Structure found_tag x := recurse_tag x. (* Main structure s : input sequence r : output sequence. If elem_of is in the sequence, then it's equal to s, otherwise it's equal to (elem_of :: s) i : output index of elem_of in r *) Structure xfind (s r : list A) (i : nat) := XFind { elem_of :> xtagged; x_nth :> onth r i = @Some A elem_of; x_prefix :> prefix s r }. (*Implicit Arguments XFind [].*) Canonical Structure found_struct x t := XFind (x :: t) (x :: t) 0 (found_tag x) (idpath) (prefix_refl _). Lemma recurse_pf {i : nat} (y : A) {s r : list A} (f : xfind s r i) : invariant (y :: s) (y :: r) (S i) f. Proof. red. simpl. split. apply f. constructor. apply f. Defined. Canonical Structure recurse_struct i y t r (f : xfind t r i) := XFind (y :: t) (y :: r) (S i) (recurse_tag f) f (pref_cons _ _ f _). Canonical Structure extend_struct x := XFind [] (x :: []) 0 (extend_tag x) idpath (pref_nil _). End XFind. Arguments elem_of {_ _ _ _} _. Arguments xuntag {_} _. Arguments xfind {_} _ _ _. Section Ast. Context {A : Type} {G : Gop A}. Structure tagged := Tag { untag :> A }. Definition ctx := list A. Inductive valid : ctx -> T nat -> Type := | valid_op : forall c t1, valid c t1 -> forall t2, valid c t2 -> valid c (Op t1 t2) | valid_val : forall c i v (Hv : onth c i = Some v), valid c (Val i). Arguments valid_op {_ _} _ {_} _. Arguments valid_val {_ _ _} _. Lemma valid_prefix : forall c t, valid c t -> forall c', prefix c c' -> valid c' t. Proof. intros ? ? H;induction H;intros ? H'. constructor;auto. econstructor. eapply prefix_nth. apply H'. apply Hv. Defined. Arguments valid_prefix {_ _} _ {_} _. Lemma valid_prefix_eval : forall c t, valid c t -> forall c', prefix c c' -> evalTree (onth c) t = evalTree (onth c') t. Proof. intros ? ? H;induction H;intros ? H';simpl in *. apply ap11;[apply ap;apply IHvalid1|apply IHvalid2];auto. path_via (Some v). symmetry;eapply prefix_nth. apply H'. assumption. Defined. Lemma valid_ext : forall c t, valid c t -> sigT (fun v => evalTree (onth c) t = Some v). Proof. intros ? ? H;induction H. destruct IHvalid1 as [v1 H1]. destruct IHvalid2 as [v2 H2]. exists (gop v1 v2). simpl. path_via (someOp (Some v1) (Some v2)). intros;apply ap11;[apply ap|];auto. simpl. exists v;assumption. Defined. Arguments valid_ext {_ _} _. Lemma ext_valid : forall c t v, evalTree (onth c) t = Some v -> valid c t. Proof. induction t;intros ? H. simpl in H. destruct (evalTree (onth c) t1), (evalTree (onth c) t2); try solve [destruct (transport (fun s => match s with | None => Unit | _ => Empty end) H tt)]. constructor;eauto. eapply valid_val. apply H. Defined. Lemma prefix_eval : forall c c', prefix c c' -> forall t (v : A), evalTree (onth c) t = Some v -> evalTree (onth c') t = Some v. Proof. intros. path_via (evalTree (onth c) t). symmetry. apply valid_prefix_eval. apply ext_valid with v. assumption. assumption. Defined. Structure ast (c c' : ctx) (t : T nat) := Ast { val :> tagged; ast_prefix :> prefix c c'; ast_pr :> evalTree (onth c') t = @Some A val }. Arguments ast_prefix {_ _ _} _. Arguments val {_ _ _} _. Definition var_tag t := Tag t. Canonical Structure op_tag t := var_tag t. Lemma ast_pr_op : forall {i j k : ctx} {t1 t2 : T nat} (a1 : ast i j t1) (a2 : ast j k t2), evalTree (onth k) (Op t1 t2) = @Some A (op_tag (G a1 a2)). Proof. intros ? ? ? ? ? ? ?. change (someOp (evalTree (onth k) t1) (evalTree (onth k) t2) = someOp (@Some A a1) (@Some A a2)). apply ap11;[apply ap|]. eapply prefix_eval. apply a2. apply a1. apply a2. Defined. Canonical Structure ast_op (i j k : ctx) (t1 t2 : T nat) (a1 : ast i j t1) (a2 : ast j k t2) := Ast i k (Op t1 t2) (op_tag (G a1 a2)) (prefix_trans a1 a2) (ast_pr_op a1 a2). Canonical Structure ast_var (i j : ctx) (n : nat) (f : xfind i j n) := Ast i j (Val n) (var_tag (xuntag (elem_of f))) f f. Lemma untag_injective : forall x y, untag x = untag y -> x=y. Proof. intros. destruct x,y. apply ap;assumption. Defined. Context {Hsg : IsSemigroup G}. Definition someRel {T T' : Type} (R : T -> T' -> Type) : option T -> option T' -> Type := fun x y => match x,y with | Some a, Some b => R a b | _, _ => Empty end. Lemma some_injective : forall {T T' : Type} (R : T -> T' -> Type) x y, someRel R (Some x) (Some y) -> R x y. Proof. intros ? ? ? ? ? H. apply H. Defined. Lemma ast_use : forall (R : relation A) {i j : ctx} {t1 t2 : T nat} (f1 : ast [] i t1) (f2 : ast i j t2), someRel R (evalNE (onth j) (sort nat_order_dec (T2list t1))) (evalNE (onth j) (sort nat_order_dec (T2list t2))) -> R (untag (val f1)) (untag (val f2)). Proof. intros ? ? ? ? ? ? ? H. apply some_injective. pattern (Some (untag (val f1)));eapply transport;[|eapply transport;[|apply H]]; (eapply concat;[apply sort_full|]);[eapply prefix_eval;[apply f2|apply f1]|apply f2]. Defined. End Ast. End Nota. Ltac ssrapply l := first [refine l |refine (l _) |refine (l _ _) |refine (l _ _ _) |refine (l _ _ _ _) |refine (l _ _ _ _ _) |refine (l _ _ _ _ _ _) |refine (l _ _ _ _ _ _ _) |refine (l _ _ _ _ _ _ _ _) ]. End BinOpTree. Module Distributive. Export BinOpTree. Export Ring. Inductive T2 : Type := | Plus : T2 -> T2 -> T2 | Mult : T2 -> T2 -> T2 | Val2 : nat -> T2 . Definition somePlus {A} {G : Symbols.Plus A} : Symbols.Plus (option A) := someOp. Definition someMult {A} {G : Symbols.Mult A} : Symbols.Mult (option A) := someOp. Fixpoint evalT2 {A} {G : Prering A} (f : _ -> option A) (t : T2) : option A := match t with | Plus x y => somePlus (evalT2 f x) (evalT2 f y) | Mult x y => someMult (evalT2 f x) (evalT2 f y) | Val2 i => f i end. Notation Flat2 := (T (NEList nat)). Notation FPlus := (@Op (NEList nat)). Notation ValL := (@Val (NEList nat)). Definition evalFlat2 {A} {G : Prering A} (f : nat -> option A) (t : Flat2) : option A := @evalTree A (+) _ (fun l => @evalNE _ (°) _ f l) t. (* eval (distribute t1 t2) = (eval t1) * (eval t2) *) Fixpoint distribute (t1 : Flat2) : Flat2 -> Flat2 := fix f (t2 : Flat2) := match t1, t2 with | Op x y, Op x' y' => FPlus (f x') (f y') | Op x y, Val l' => FPlus (distribute x (ValL l')) (distribute y (ValL l')) | Val l', Op x y => FPlus (f x) (f y) | Val l1, Val l2 => ValL (Napp l1 l2) end. Fixpoint flatten (t : T2) : Flat2 := match t with | Plus x y => FPlus (flatten x) (flatten y) | Mult x y => distribute (flatten x) (flatten y) | Val2 i => ValL (single i) end. Fixpoint Flat2_order_in (t : Flat2) : Flat2 := match t with | Op x y => Op (Flat2_order_in x) (Flat2_order_in y) | Val l => Val (sort nat_order_dec l) end. Section Mag2. Context {A} {G : Prering A}. Context {Hadd : @IsSemigroup A (+)} {Hmult : @IsSemigroup A (°)} {Hdistrib : Distributes G}. Lemma some_distrib_right : forall a b c : option A, someMult (somePlus b c) a = somePlus (someMult b a) (someMult c a). Proof. destruct a,b,c;try reflexivity. simpl. apply ap. apply Hdistrib. Defined. Lemma some_distrib_left : forall a b c : option A, someMult a (somePlus b c) = somePlus (someMult a b) (someMult a c). Proof. destruct a,b,c;try reflexivity. simpl. apply ap. apply Hdistrib. Defined. Local Open Scope type_scope. Lemma distribute_ok : forall (f : _ -> option A) t1 t2, evalFlat2 f (distribute t1 t2) = someMult (evalFlat2 f t1) (evalFlat2 f t2). Proof. assert (Hleft : forall (f : _ -> option A) l x, evalFlat2 f (distribute x (ValL l)) = someMult (evalFlat2 f x) (evalFlat2 f (ValL l))). intros f l. simpl. assert (X:(sigT (fun v => evalFlat2 f (ValL l) = Some v)) + (evalFlat2 f (ValL l) = None)). destruct (evalFlat2 f (ValL l));eauto. destruct X as [[g Hl] | Hl];pattern (evalFlat2 f (ValL l)); apply (transport _ (inverse Hl)). - induction x. simpl. path_via (someMult (somePlus (evalFlat2 f x1) (evalFlat2 f x2)) (Some g)). destruct (evalFlat2 f x1);[destruct (evalFlat2 f x2)|]. simpl. eapply concat. apply (@ap11 _ _ (somePlus (evalFlat2 f (distribute x1 (ValL l))))) ;[apply ap;apply IHx1|apply IHx2]. simpl;apply ap;symmetry;apply Hdistrib. simpl. simpl in IHx2. path_via (somePlus (evalFlat2 f (distribute x1 (ValL l))) (evalFlat2 f (distribute x2 (ValL l)))). pattern (evalFlat2 f (distribute x2 (ValL l))); apply (transport _ (inverse IHx2)). destruct (evalFlat2 f (distribute x1 (ValL l)));reflexivity. simpl. simpl in IHx1. path_via (somePlus (evalFlat2 f (distribute x1 (ValL l))) (evalFlat2 f (distribute x2 (ValL l)))). pattern (evalFlat2 f (distribute x1 (ValL l))); apply (transport _ (inverse IHx1)). simpl. reflexivity. simpl. unfold someMult. eapply concat;[apply @evalNE_app|]. apply _. apply ap. apply Hl. - induction x. simpl. path_via (somePlus (evalFlat2 f (distribute x1 (ValL l))) (evalFlat2 f (distribute x2 (ValL l)))). path_via (someMult (somePlus (evalFlat2 f x1) (evalFlat2 f x2)) None). destruct (evalFlat2 f x1), (evalFlat2 f x2); simpl in *; (path_via (@somePlus A _ None None); apply ap11;[apply ap|];assumption). simpl. eapply concat. apply (@evalNE_app A (°)). apply _. apply ap. assumption. (* Hleft done *) - intros l t1 t2;revert t1. induction t2;auto. induction t1. path_via (somePlus (evalFlat2 l (distribute (FPlus t1_1 t1_2) t2_1)) (evalFlat2 l (distribute (FPlus t1_1 t1_2) t2_2))). pattern (evalFlat2 l (distribute (FPlus t1_1 t1_2) t2_2)). eapply transport. symmetry;apply IHt2_2. pattern (evalFlat2 l (distribute (FPlus t1_1 t1_2) t2_1)). eapply transport. symmetry;apply IHt2_1. path_via (somePlus (someMult (somePlus (evalFlat2 l t1_1) (evalFlat2 l t1_2)) (evalFlat2 l t2_1)) (someMult (somePlus (evalFlat2 l t1_1) (evalFlat2 l t1_2)) (evalFlat2 l t2_2))). path_via (someMult (somePlus (evalFlat2 l t1_1) (evalFlat2 l t1_2)) (somePlus (evalFlat2 l t2_1) (evalFlat2 l t2_2))). repeat first [rewrite some_distrib_left | rewrite some_distrib_right]. reflexivity. path_via (somePlus (someMult (evalFlat2 l (ValL a)) (evalFlat2 l t2_1)) (someMult (evalFlat2 l (ValL a)) (evalFlat2 l t2_2))). path_via (somePlus (evalFlat2 l (distribute (ValL a) t2_1)) (evalFlat2 l (distribute (ValL a) t2_2))). apply ap11;[apply ap|]; auto. symmetry. apply some_distrib_left. Defined. Lemma flatten_ok : forall (l : _ -> option A) t, evalFlat2 l (flatten t) = evalT2 l t. Proof. induction t. simpl. path_via (somePlus (evalFlat2 l (flatten t1)) (evalFlat2 l (flatten t2))). apply ap11;[apply ap|];assumption. simpl. eapply concat;[apply distribute_ok|]. apply ap11;[apply ap|];assumption. reflexivity. Defined. Lemma order_in_ok : forall (f : _ -> option A) t, evalFlat2 f (Flat2_order_in t) = evalFlat2 f t. Proof. induction t. path_via (somePlus (evalFlat2 f (Flat2_order_in t1)) (evalFlat2 f (Flat2_order_in t2))). path_via (somePlus (evalFlat2 f t1) (evalFlat2 f t2)). apply ap11;[apply ap|];assumption. unfold evalFlat2;simpl. apply (@sort_correct _ _ A (°)). exact _. Defined. End Mag2. Section Ast2. Context {A} {G : Prering A}. (*note: cannot reuse BinOpTree.tagged because its canonical projections would override our new ones *) Structure tagged := Tag { untag :> A }. Lemma prefix_eval2 : forall c c', prefix c c' -> forall (t : T2) (v : A), evalT2 (onth c) t = Some v -> evalT2 (onth c') t = Some v. Proof. induction t;intros. - simpl in *. destruct (evalT2 (onth c) t1) as [v1 |]; [destruct (evalT2 (onth c) t2) as [v2 |]|]. eapply concat;[|apply X0]. apply ap11;[apply ap|];auto. simpl in X0. destruct (transport (fun s => match s with | None => Unit | _ => Empty end) X0 tt). simpl in X0. destruct (transport (fun s => match s with | None => Unit | _ => Empty end) X0 tt). - simpl in *. destruct (evalT2 (onth c) t1) as [v1 |]; [destruct (evalT2 (onth c) t2) as [v2 |]|]. eapply concat;[|apply X0]. apply ap11;[apply ap|];auto. simpl in X0. destruct (transport (fun s => match s with | None => Unit | _ => Empty end) X0 tt). simpl in X0. destruct (transport (fun s => match s with | None => Unit | _ => Empty end) X0 tt). - simpl in *. eapply prefix_nth;eauto. Defined. Structure ast2 (c c' : ctx) (t : T2) := Ast2 { val2 :> tagged; ast2_prefix :> prefix c c'; ast2_pr :> evalT2 (onth c') t = Some (untag val2) }. Arguments ast2_prefix {_ _ _} _. Arguments val2 {_ _ _} _. Definition var_tag (t:A) := Tag t. Definition mult_tag (t:A) := var_tag t. Canonical Structure plus_tag (t:A) := mult_tag t. Lemma ast2_pr_plus : forall {i j k : ctx} {t1 t2 : T2} (a1 : ast2 i j t1) (a2 : ast2 j k t2), evalT2 (onth k) (Plus t1 t2) = Some (untag (plus_tag (untag a1 + untag a2))). Proof. intros ? ? ? ? ? ? ?. change (somePlus (evalT2 (onth k) t1) (evalT2 (onth k) t2) = somePlus (Some (untag a1)) (Some (untag a2))). apply ap11;[apply ap|]. apply prefix_eval2 with j. apply a2. apply a1. apply a2. Defined. Canonical Structure ast2_plus (i j k : ctx) (t1 t2 : T2) (a1 : ast2 i j t1) (a2 : ast2 j k t2) := Ast2 i k (Plus t1 t2) (plus_tag ((untag a1) + (untag a2))) (prefix_trans _ _ _ a1 a2) (ast2_pr_plus a1 a2). Lemma ast2_pr_mult : forall {i j k : ctx} {t1 t2 : T2} (a1 : ast2 i j t1) (a2 : ast2 j k t2), evalT2 (onth k) (Mult t1 t2) = Some (untag (mult_tag ((untag a1) ° (untag a2)))). Proof. intros ? ? ? ? ? ? ?. change (someMult (evalT2 (onth k) t1) (evalT2 (onth k) t2) = someMult (Some (untag a1)) (Some (untag a2))). apply ap11;[apply ap|]. apply prefix_eval2 with j. apply a2. apply a1. apply a2. Defined. Canonical Structure ast2_mult (i j k : ctx) (t1 t2 : T2) (a1 : ast2 i j t1) (a2 : ast2 j k t2) := Ast2 i k (Mult t1 t2) (mult_tag ((untag a1) ° (untag a2))) (prefix_trans _ _ _ a1 a2) (ast2_pr_mult a1 a2). Canonical Structure ast2_var (i j : ctx) (n : nat) (f : xfind _ i j n) := Ast2 i j (Val2 n) (var_tag (xuntag _ (elem_of _ _ _ _ f))) f f. Section Minimal. Context {Hadd : @IsSemigroup A (+)} {Hmult : @IsSemigroup A (°)} {Hdistrib : Distributes G}. Lemma ast2_use : forall R {i j : ctx} {t1 t2 : T2} (f1 : ast2 [] i t1) (f2 : ast2 i j t2), someRel R (evalFlat2 (onth j) (Flat2_order_in (flatten t1))) (evalFlat2 (onth j) (Flat2_order_in (flatten t2))) -> R (untag (val2 f1)) (untag (val2 f2)). Proof. intros ? ? ? ? ? ? ? H. apply some_injective. pattern (Some (untag (val2 f1)));eapply transport;[|eapply transport;[|apply H]]; (eapply concat;[ apply order_in_ok| eapply concat;[ apply flatten_ok|]]). eapply prefix_eval2. apply f2. apply f1. apply f2. Defined. End Minimal. Lemma ast2_semiring : forall {Hsemir : IsSemiring G}, forall R {i j : ctx} {t1 t2 : T2} (f1 : ast2 [] i t1) (f2 : ast2 i j t2), someRel R (evalFlat2 (onth j) (Flat2_order_in (flatten t1))) (evalFlat2 (onth j) (Flat2_order_in (flatten t2))) -> R (untag (val2 f1)) (untag (val2 f2)). Proof. intro. apply @ast2_use;apply _. Defined. Definition full_simplify (t : T2) := sort NEList_nat_order_dec (T2list (Flat2_order_in (flatten t))). Lemma ast2_full_semiring : forall {Hsemir : IsSemiring G}, forall R {i j : ctx} {t1 t2 : T2} (f1 : ast2 [] i t1) (f2 : ast2 i j t2), someRel R (@evalNE A (+) _ (fun l => @evalNE A (°) _ (onth j) l) (full_simplify t1)) (@evalNE A (+) _ (fun l => @evalNE A (°) _ (onth j) l) (full_simplify t2)) -> R (untag (val2 f1)) (untag (val2 f2)). Proof. intros ? ? ? ? ? ? ? ? H. apply (ast2_semiring R). unfold evalFlat2. eapply transport;[|pattern (@evalTree A (@plus A G) (NEList nat) (fun l : NEList nat => @evalNE A (@mult A G) nat (onth j) l) (Flat2_order_in (flatten t1))); eapply transport;[|apply H]]; (unfold full_simplify; eapply concat;[ apply sort_correct; apply _| apply T2list_correct]). Defined. End Ast2. Lemma test2 : forall A (G : Prering A) {Hsemir : IsSemiring G}, forall a b c : A, a°(b+c) = a°c + a°b. Proof. intros. refine (@ast2_full_semiring A _ Hsemir paths _ _ _ _ _ _ _). reflexivity. Fail idtac. Abort. End Distributive.
## Méthode des Trapèzes On sait que l'aire d'un trapèze est donnée par : $$Aire = \frac{(B + b)h}{2}$$ On définit : $$W_i = \frac{(f(x_i) + f(x_{i+1}))h}{2}$$ On trouve une formule pour approximer notre intégrale : $$ \begin{align*} I &\approx \sum_{i=0}^{n-1} W_i \\ &\approx \sum_{i=0}^{n-1} \frac{h}{2}(f(x_i) + f(x_{i+1}) \\ &\approx \frac{h}{2}(f(x_0) + f(x_1) + f(x_1) + ... + f(x_{n-1}) + f(x_{n-1}) + f(x_n)) \\ &\approx \frac{h}{2} \left[ f(x_0) + 2 \sum_{i=0}^{n-1}f(x_i) + f(x_n)) \right] \\ &\approx h \left[ \frac{1}{2}(f(x_0) + f(x_n)) + \sum_{i=0}^{n-1}f(x_i)) \right] \end{align*} $$ ### Itération - On diminue progressivement le pas de h de $\frac{1}{2}$ à chaque itération jusqu'à atteindre la précision souhaitée. - /!\ une itération = une évaluation complète de l'intégrale. Pour une fonction : $$\int_a^b f(x)dx$$ $n = 2^{k-1}$ => 1, 2, 4, 8,... $h = \frac{b-a}{n}$ => $h$, $\frac{h}{2}$, $\frac{h}{4}$,... Inconvénient : convergence lente donc besoin de beaucoup d'itérations pour être précis. ```python import numpy as np import math # precision de l'évaluation numérique de l'intégrale (trapèzes) TRESHOLD_PRECISION = 1e-9 DIMENSIONS = [1] #[1, 2, 10, 15] X_0 = -3 X_N = 3 class Trapezes(): def __init__(self, f, x_0, x_n): self.f = f self.x_0 = x_0 self.x_n = x_n # borne inférieure : x_0 # borne supérieure : x_n # en pratique on itère sur la méthode # et on diminue le pas h progressivement (de 1/2 à chaque itération) # k : itération en cours def trapezes(self, k): # si k = 1, le nombre de trapèzes serait de 1 (en effet, 2^0 = 1) if k == 1: # Aire d'un trapèze h = (self.x_n - self.x_0) return (self.f(self.x_0) + self.f(self.x_n)) * h / 2 # nombre de trapèzes n = int(math.pow(2, k-1)) # intervalle h h = (self.x_n - self.x_0) / n sum = 1/2 * (self.f(self.x_0) + self.f(self.x_n)) for i in range(1, n): x_i = self.x_0 + (i * h) sum += self.f(x_i) return h * sum # N : nombre de dimensions def integrate(self, iterations, precision): new_integral = 0 for k in range(1, iterations): old_integral = new_integral new_integral = self.trapezes(k) if abs(old_integral - new_integral) < precision and k > 1: return new_integral, k break def gaussian(x): f = math.exp(-(x**2) / 2) return f def gaussian_2_dim(x, y): return math.exp(-(x**2 + y**2) / 2) def gaussian_theo(N): return math.sqrt((2*math.pi)**N) print(f"dimension 1") print("-----------") print(f"Valeur théorique approximative: {gaussian_theo(N=1)}") gaussian_trapezes = Trapezes(gaussian, X_0, X_N) gaussian_trapezes_value = gaussian_trapezes.integrate(iterations = 20, precision = TRESHOLD_PRECISION) print(f"Valeur de la gaussienne à 1 dimension (trapèzes): {gaussian_trapezes_value}") print(f"dimension 2") print("-------------") print(f"Valeur théorique approximative: {gaussian_theo(N=2)}") print("-------------") def universe_model(x, omega_m, omega_rad, omega_k, omega_lambda): gaussian_trapezes = Trapezes(gaussian, X_0, X_N) gaussian_trapezes_value = gaussian_trapezes.integrate(iterations = 20, precision = TRESHOLD_PRECISION) print(f"Valeur de la gaussienne à 1 dimension (trapèzes): {gaussian_trapezes_value}") ``` dimension 1 ----------- Valeur théorique approximative: 2.5066282746310002 Valeur de la gaussienne à 1 dimension (trapèzes): (2.4998608892968623, 16) dimension 2 ------------- Valeur théorique approximative: 6.283185307179586 ## Méthode de Romberg Combine la méthode itérative des trapèzes avec l'extrapolation de Richardson. **Erreur sur la méthode des Trapèzes**: $E(h) = c_1h^2 + c_2h^4 + ... = \sum_i c_ih^{2i}$ ### Extrapolation de Richardson Pour un pas de h : $$G = I(h) + E(h)$$ Pour un pas de h/2 : $$G = I(h/2) + E(h/2)$$ On obtient le système : $$ \begin{align} \begin{cases} G = I(h) + ch^p \\ G = I(h/2) + c(h/2)^p \implies 2^pG = 2^pI(h/2) + ch^p \end{cases} \end{align} $$ On soustrait l'équation $(1)$ à l'équation $(2)$ : $$ \begin{align} 2^pG - G &= 2^pI(h/2) - I(h) \\ (2^p - 1)G &= 2^p I(h/2) - I(h) \\ G &= \frac{2^p I(h/2) - I(h)}{2^p - 1} \end{align} $$ Nuos avons donc une formule pour l'extrapolation de Richardson : $$ G = \frac{2^p I(h/2) - I(h)}{2^p - 1} $$ **Concrètement**: On va se constituer une matrice $n x n$ avec _n : le nombre d'itérations_. Elle contiendra dans sa première colonne les approximations de l'intégrale par la méthode des trapèzes. Ensuite on rempli "le reste" en cascade avec la formule de l'extrapolation de Richardson. **Algorithme**: On remarque que plus le nombre d'itérations augmente, plus la précision augmente. ```python import numpy as np import math class Romberg(): def __init__(self, f, x_0, x_n): self.f = f self.x_0 = x_0 self.x_n = x_n def trapezes(self, k): # si k = 1, le nombre de trapèzes serait de 1 (en effet, 2^0 = 1) if k == 1: # Aire d'un trapèze h = (self.x_n - self.x_0) return (self.f(self.x_0) + self.f(self.x_n)) * h / 2 # nombre de trapèzes n = int(math.pow(2, k-1)) # intervalle h h = (self.x_n - self.x_0) / n sum = 1/2 * (self.f(self.x_0) + self.f(self.x_n)) for i in range(1, n): x_i = self.x_0 + (i * h) sum += self.f(x_i) return h * sum def richardson_extrapolation(self, I_prev, I_current, k): return ((2**k * I_current) - I_prev) / (2**k - 1) def integrate(self, iterations, precision): # R(n, m) self.map = np.zeros((iterations, iterations)) """ iterations = 3 j __________________ i | trap x x | | trap rich x | | trap rich approx | ------------------ """ for i in range(1, iterations): i_prime = i - 1 # Méthode des trapèzes self.map[i_prime, 0] = self.trapezes(i) for j in range(1, i): # Extrapolation de Richardson self.map[i_prime, j] = self.richardson_extrapolation(self.map[i_prime-1, j-1], self.map[i_prime, j-1], 2*j) if abs(self.map[i_prime - 1, i_prime - 1] - self.map[i_prime, i_prime]) < precision: return self.map[i_prime, i_prime], i break # precision de l'évaluation numérique de l'intégrale (trapèzes) TRESHOLD_PRECISION = 1e-9 DIMENSIONS = [1] #[1, 2, 10, 15] X_0 = -3 X_N = 3 def gaussian(x): f = math.exp(-(x**2) / 2) return f # romberg gaussian_romberg = Romberg(gaussian, X_0, X_N) gaussian_romberg_value = gaussian_romberg.integrate(iterations = 10, precision = TRESHOLD_PRECISION) print(f"Valeur de la gaussienne à 2 dimension (romberg): {gaussian_romberg_value}") ``` Valeur de la gaussienne à 2 dimension (romberg): (2.4998608894818006, 8) ### Méthode de Monte-Carlo - Plus efficace pour calculer des intégrales à plusieurs dimensions. - On tire les points aléatoirement dans le domaine de la fonction. $$ \begin{align} <f> &= \frac{1}{b-a} \int_a^b f(x)dx \\ \int_a^b f(x)dx &= (b-a)<f> \\ \int_a^b f(x)dx &\approx (b-a) \frac{1}{N} \sum_{i=0}^{n-1} f(x_i) \end{align} $$ ```python import math import random import numpy as np def gaussian_theo(N): return math.sqrt((2*math.pi)**N) def gaussian(x_vec): sum = 0 # x^2 + y^2 + z^2 + ... for x_i in x_vec: sum += x_i**2 return math.exp(-(sum) / 2) class MonteCarlo(): def __init__(self, f, x_0, x_n): self.f = f self.x_0 = x_0 self.x_n = x_n def integrate(self, iterations): sum = 0 # e.g.: 3 = intégrale triple dimension = len(self.x_0) # N * N * N * ... = N^(dimension) volume = np.prod([x_n - x_0 for x_0, x_n in zip(self.x_0, self.x_n)]) # somme des f(x_i) sum = 0 for i in range(iterations): x_i = [random.uniform(self.x_0[k], self.x_n[k]) for k in range(dimension)] sum += self.f(x_i) integral = volume * (1/iterations) * sum return integral print(f"predicted gaussian integral value: {gaussian_theo(3)}") integral = MonteCarlo(gaussian, [-3, -3, -3], [3, 3, 3]).integrate(1000000) print(f"approximated gaussian integral value: {integral}") ``` predicted gaussian integral value: 15.749609945722419 approximated gaussian integral value: 15.627813816362522 #### Amélioration - Utiliser une répartition arbitraire selon la forme de la fonction à intégrer.
subroutine mapc2m_torus(blockno,xc,yc,xp,yp,zp,alpha) implicit none integer blockno double precision xc,yc,xp,yp,zp double precision alpha, r double precision pi, pi2 common /compi/ pi, pi2 r = 1 + alpha*cos(pi2*yc) xp = r*cos(pi2*xc) yp = r*sin(pi2*xc) zp = alpha*sin(pi2*yc) end subroutine mapc2m_torus_invert(xp,yp,zp,xc1,yc1,alpha) implicit none double precision xp,yp,zp,xc1,yc1 double precision alpha double precision pi, pi2 common /compi/ pi, pi2 double precision r xc1 = atan2(yp,xp) if (xc1 .lt. 0) then xc1 = xc1 + pi2 endif xc1 = xc1/pi2 yc1 = asin(zp/alpha) r = sqrt(xp**2 + yp**2); if (r .gt. 1 .and. yc1 .lt. 0) then c # Quad IV yc1 = yc1 + pi2 elseif (r .le. 1) then c # Quads II and III yc1 = pi-yc1 endif yc1 = yc1/pi2 end
Formal statement is: lemma AE_I2[simp, intro]: "(\<And>x. x \<in> space M \<Longrightarrow> P x) \<Longrightarrow> AE x in M. P x" Informal statement is: If $P$ holds for all $x$ in the space $M$, then $P$ holds almost everywhere in $M$.
If $S$ is a bounded set of Lebesgue measure zero such that for all $c \geq 0$ and $x \in S$, if $cx \in S$, then $c = 1$, then $S$ is a null set.
[STATEMENT] lemma renormalize: "ccw 0 (a - b) (c - a) \<Longrightarrow> ccw b a c" [PROOF STATE] proof (prove) goal (1 subgoal): 1. ccw (0::'a) (a - b) (c - a) \<Longrightarrow> ccw b a c [PROOF STEP] by (metis diff_add_cancel diff_self cyclic minus_diff_eq translate_plus3 uminus1)
SUBROUTINE proj_terrain(n_max, m_max, n, m, z, mask, n_off, m_off, k_max, & n_inc, m_inc, h_offset, zmax, htol, dem_nr, dem_nc, nlA_ori, nsA_ori) implicit none ! subroutine to construct mask of shade pixels ! z(m_max,n_max) is the main array of heights ! A(m,n) is the (sub-)matrix of target heights in: ! z(m_off+1,n_off+1) to z(m_off+m,n_off+n) ! mask(m,n) is the output mask ! on input assumed to be 1 where valid data exist 0 else ! k_max is the number of lags in the projection ! n_inc(k_max) real increments column number for projection ! m_inc(k_max) real increments row number for the projection ! h_offset(k_max) is the height of the projection hor each lag ! zmax is the maximum altitude in the whole array ! htol is a tolerance (m) for the test for a hit (RMS error in z) integer dem_nr, dem_nc, nlA_ori, nsA_ori integer n_max, m_max, n, m, n_off, m_off, k_max ! NOTE: n_inc and m_inc are Floating Point arrays real m_inc(k_max), n_inc(k_max) real h_offset(k_max) real z(dem_nr, dem_nc) integer*2 mask(nlA_ori, nsA_ori) real zmax, t, tt, test, htol, xd, yd, zpos integer i, j, ii, jj, k, ipos, jpos integer*4 itot real pi,r2d,d2r,eps common/base/pi,r2d,d2r,eps ! loop over object matrix A and project out into buffer ! The main 2 loops are over the pixels in the submatrix A ! For given A(i,j) the search for occluding terrain is done along a "line" ! in the sun direction. The search can stop when the terrain would ! have to be higher than the maximum value to occlude the current test ! pixel (i,j) in the sub-matrix A itot=0 do 100 i=1,m ii=m_off+i do 110 j=1,n jj=n_off+j t=z(ii,jj) do 120 k=1,k_max tt=t+h_offset(k) if(tt .le. zmax+htol) then ipos = ifix(float(ii)+m_inc(k)) jpos = ifix(float(jj)+n_inc(k)) yd = float(ii)+m_inc(k)-float(ipos) xd = float(jj)+n_inc(k)-float(jpos) zpos = z(ipos,jpos)*(1.0-yd)*(1.0-xd) + & z(ipos,jpos+1)*xd*(1.0-yd) + & z(ipos+1,jpos+1)*xd*yd + & z(ipos+1,jpos)*(1.0-xd)*yd test = tt-zpos if (test.le.htol) then mask(i,j) = 0 itot = itot+1 goto 125 endif else go to 125 endif 120 continue 125 continue 110 continue 100 continue return END SUBROUTINE proj_terrain
theory Star imports Main begin inductive star :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool" for r where refl: "star r x x" | step: "r x y \<Longrightarrow> star r y z \<Longrightarrow> star r x z" hide_fact (open) refl step \<comment> \<open>names too generic\<close> lemma star_trans: "star r x y \<Longrightarrow> star r y z \<Longrightarrow> star r x z" proof(induction rule: star.induct) case refl thus ?case . next case step thus ?case by (metis star.step) qed lemmas star_induct = star.induct[of "r:: 'a*'b \<Rightarrow> 'a*'b \<Rightarrow> bool", split_format(complete)] declare star.refl[simp,intro] lemma star_step1[simp, intro]: "r x y \<Longrightarrow> star r x y" by(metis star.refl star.step) code_pred star . end
subroutine wrtabx(actlg,afrc1,aft1,alk,cteaq,dvoso,dwoso, $ eh,fo2lg,iindx1,iktmax,iopt,ipndx1,kmax,km1,kmt,kstep,kx1, $ kxt,loph,ncmpr,modr,mopht,narn1,mosp,nct,nctmax,noptmx, $ nptmax,nrct,nrctmx,nstmax,ntabx,ntidmx,ntitl2,ntitld,ntitmx, $ nxtmax,pe,ph,ppmwe,prcinf,press,prminf,qbye,qmod,qriinf, $ tempc,time1,uelem,uphase,uplatm,ureac,uspec,usteq6,utitl2, $ utitld,uveeq6,vodrt,vosoct,wodrt,woh2o,wosoct,xbar,xi1) c c This subroutine writes the scratch tab file tabx. The length of c any line should not exceed 129 characters. c c This subroutine is called by: c c EQ6/path.f c c----------------------------------------------------------------------- c c Principal input: c c c Principal output: c c c----------------------------------------------------------------------- c implicit none c c----------------------------------------------------------------------- c c Calling sequence variable declarations. c integer iktmax,kmax,nctmax,noptmx,nptmax,nrctmx,nstmax, $ ntidmx,ntitmx,nxtmax c integer ntabx c integer iindx1(kmax),iopt(noptmx),ipndx1(kmax),ncmpr(2,nptmax) c integer km1,kmt,kstep,kx1,kxt,narn1,nct,nrct,ntitl2,ntitld c logical qbye,qmod,qriinf c character*80 utitl2(ntitmx),utitld(ntidmx) character*48 uspec(nstmax) character*24 uphase(nptmax),ureac(nrctmx) character*8 uelem(nctmax) character*8 uplatm,usteq6,uveeq6 c real*8 actlg(nstmax),afrc1(nrctmx),cteaq(nctmax),loph(nptmax), $ modr(nrctmx),mopht(nptmax),mosp(nstmax),ppmwe(nctmax), $ xbar(nstmax) c real*8 aft1,alk,dvoso,dwoso,eh,fo2lg,wodrt,wosoct,pe,ph, $ prcinf,press,prminf,tempc,time1,vodrt,vosoct,woh2o,xi1 c c----------------------------------------------------------------------- c c Local variable declarations with global dimensioning. c character(len=16), dimension(:,:), allocatable :: uprss character(len=8), dimension(:,:), allocatable :: uprmn character(len=8), dimension(:), allocatable :: uelac c real(8), dimension(:), allocatable :: lcteaq,ppmaq,xfrac,zvclgx c c Saved values of local array sizes. c integer isv_kmax,isv_nctmax,isv_nxcmax c SAVE isv_kmax,isv_nctmax,isv_nxcmax c SAVE lcteaq,ppmaq,uelac,uprmn,uprss,xfrac,zvclgx c c----------------------------------------------------------------------- c c Local variable declarations. c integer nxcmax c integer i,j2,j3,j4,k,kcol,ktot,ktotlm,n,nc,nctpr,nlim,nlim1,nlim2, $ np,np1,nrc,ns c integer ilnobl c logical qphasc,qstart,qtitl c character*1 ua,ub,uc,ud,ue,uf,ug,uh,uj,uk,ul,um,un,uo,up,uq,ur, $ us,ut,uu,uv,ux,uy c real*8 cx,dx1,dx2,dx3,lalk,mx,tdays,tlogd,wkgh2o,xilog c real*8 tlg c c----------------------------------------------------------------------- c data ua,ub,uc,ud,ue,uf,ug,uh,uj,uk,ul,um,un,uo,up,uq,ur,us, $ ut,uu,uv,ux,uy/'a','b','c','d','e','f','g','h','j', $ 'k','l','m','n','o','p','q','r','s','t','u','v','x','y'/ c c----------------------------------------------------------------------- c nxcmax = nxtmax*iktmax c c Allocate or reallocate local work arrays as needed. c if (.not.ALLOCATED(uprss)) then c c Local work arrays are not allocated. Zero the saved c array size variables. Note that only one array is tested c to see if it is allocated. It is assumed that all local c work arrays are either allocated or not. c isv_kmax = 0 isv_nctmax = 0 isv_nxcmax = 0 else c c Local work arrays are allocated. Check to see if any of the c array size variables have changed. If so, deallocate c the corresponding local work arrays and zero the corresponding c saved size variables. c if (kmax .ne. isv_kmax) then DEALLOCATE(uprmn) DEALLOCATE(uprss) DEALLOCATE(zvclgx) isv_kmax = 0 endif c if (nctmax .ne. isv_nctmax) then DEALLOCATE(uelac) DEALLOCATE(lcteaq,ppmaq) isv_nctmax = 0 endif c if (nxcmax .ne. isv_nxcmax) then DEALLOCATE(xfrac) isv_nxcmax = 0 endif endif c c At this point, the saved array size values are zero if the c corresponding arrays need to be allocated. c if (isv_kmax .eq. 0) then ALLOCATE(uprmn(3,kmax)) ALLOCATE(uprss(2,kmax)) ALLOCATE(zvclgx(kmax)) isv_kmax = kmax endif c if (isv_nctmax .eq. 0) then ALLOCATE(uelac(nctmax)) ALLOCATE(lcteaq(nctmax),ppmaq(nctmax)) isv_nctmax = nctmax endif c if (isv_nxcmax .eq. 0) then ALLOCATE(xfrac(nxcmax)) isv_nxcmax = nxcmax endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Zero the contents of the local work arrays. c do k = 1,kmax uprmn(1,k) = ' ' uprmn(2,k) = ' ' uprmn(3,k) = ' ' uprss(1,k) = ' ' uprss(2,k) = ' ' enddo c do k = 1,kmax zvclgx(k) = -99999. enddo c do n = 1,nctmax uelac(n) = ' ' enddo c do n = 1,nctmax lcteaq(n) = -99999. ppmaq(n) = 0. enddo c do n = 1,nxcmax xfrac(n) = 0. enddo c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write output tables of some selected parameters. These are c identified by the letters a, b, c, etc. They are written on c the file tabx in scrambled order (i.e., the lines of any given c tables are interspersed with those of the other tables). Each c line is marked in column one with the letter of the table to c which it belongs. When the run is complete, EQLIBU/dscram.f c writes the lines in descrambled form on file tab. File tabx c is preserved. The maximum line length for the tabx file is 129 c characters. The maximum line length for the tab file is 128 c characters. c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write table a. Header data. c c Run title c Code version identification c Data file title c c Note: the original primary title (utitl1) has been rolled over c to the current secondary title (utitl2). c qstart = kstep .eq. 0 if (qstart) then do i = 1,3 write (ntabx,1000) ua 1000 format(a1,1x) enddo c do n = 1,ntitl2 j2 = ilnobl(utitl2(n)) write (ntabx,1005) ua,utitl2(n)(1:j2) 1005 format(a1,1x,a) enddo c write (ntabx,1000) ua j2 = ilnobl(uveeq6) j3 = ilnobl(usteq6) j4 = ilnobl(uplatm) write (ntabx,1010) ua,uveeq6(1:j2),usteq6(1:j3),uplatm(1:j4) 1010 format(a1,1x,'Running EQ3/6-V',a,'-EQ6-EXE-',a,'-',a) write (ntabx,1015) ua 1015 format(a1) write (ntabx,1000) ua c do n = 1,ntitld j2 = ilnobl(utitld(n)) write (ntabx,1005) ua,utitld(n)(1:j2) enddo endif c qtitl = qstart if (iopt(18) .ge. 1) qtitl = .false. c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write table b. Major run parameters. c c Overall reaction progress c Log of overall reaction progress c Time, days c Log days c Temperature, C c Pressure, bars c pH c log fO2 c Eh, volts c pe c Mass of solvent, kg c Total affinity, kcal c if (qtitl) then do i = 1,3 write (ntabx,1000) ub enddo c write (ntabx,1020) ub 1020 format(a1,' xi log xi time, d log days', $ ' tempc ',' press ph log fo2 eh', $ ' pe kg h2o tot aff') write (ntabx,1000) ub endif c cXX Will eventually have to revise the tab file (-99999. vs. -999.). cXX xilog = -99999. xilog = -999. if (xi1 .gt. 0.) xilog = tlg(xi1) wkgh2o = 0.001*woh2o if (qriinf) then tdays = prcinf cXX tlogd = +99999. tlogd = +999. else tdays = time1/86400. if (time1 .gt. prminf) then tlogd = tlg(tdays) else cXX tlogd = -99999. tlogd = -999. endif endif c cXX if (eh .le. -99999.) eh = -999. if (pe .le. -99999.) pe = -999. if (aft1 .ge. 99999.) aft1 = 999. cXX c write (ntabx,1025) ub,xi1,xilog,tdays,tlogd,tempc,press,ph,fo2lg, $ eh,pe,wkgh2o,aft1 1025 format(a1,1x,1pe10.3,0pf10.4,1pe10.3,9(0pf10.4)) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write table c. Miscellaneous aqueous solution composition c parameters. c c Log of activity of water c Alkalinity, eq/kg.H2O (not defined for c temperatures greater than 50 C) c if (qtitl) then do i = 1,3 write (ntabx,1000) uc enddo c write (ntabx,1030) uc 1030 format(a1,1x,' log xi time, d log days log alk', $ ' log tot log tot log tot log a h2o') write (ntabx,1035) uc 1035 format(a1,41x,' co3-- so4-- s--') write (ntabx,1000) uc endif c cXX lalk = -99999. lalk = -999. if (alk .gt. 0.) lalk = tlg(alk) dx1 = 0. dx2 = 0. dx3 = 0. write (ntabx,1040) uc,xilog,tdays,tlogd,lalk,dx1,dx2,dx3, $ actlg(narn1) 1040 format(a1,1x,0pf10.4,1pe10.3,10(0pf10.4)) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write tables d, e, f, g, and h. Aqueous solution composition c in terms of molalities of chemical elements. Write c corresponding tables j, k, l, m, and n (aqueous solution c composition in terms of ppm of chemical elements). c nctpr = 0 do nc = 1,nct if (uelem(nc)(1:2).ne.'H ' .and. uelem(nc)(1:2) .ne. 'O ') then nctpr = nctpr + 1 uelac(nctpr) = uelem(nc) cx = cteaq(nc) lcteaq(nctpr) = tlg(cx) cXX Will eventually have to revise the tab file (-99999. vs. -999.). if (lcteaq(nctpr) .lt. -999.) lcteaq(nctpr) = -999. ppmaq(nctpr) = ppmwe(nc) endif enddo c if (nctpr .le. 0) go to 100 nlim2 = min(9,nctpr) c if (qtitl) then do i = 1,3 write (ntabx,1000) ud write (ntabx,1000) uj enddo c write (ntabx,1045) ud 1045 format(a1,20x,'log molality of dissolved elements') write (ntabx,1050) uj 1050 format(a1,17x,'ppm (mg/kg.sol) of dissolved elements') write (ntabx,1000) ud write (ntabx,1000) uj write (ntabx,1055) ud,(uelac(n), n = 1,nlim2) write (ntabx,1055) uj,(uelac(n), n = 1,nlim2) 1055 format(a1,1x,' log xi time, d log days ',10(4x,a3,3x)) write (ntabx,1000) ud write (ntabx,1000) uj endif c write (ntabx,1040) ud,xilog,tdays,tlogd,(lcteaq(n), n = 1,nlim2) write (ntabx,1065) uj,xilog,tdays,tlogd,(ppmaq(n), n = 1,nlim2) 1065 format(a1,1x,0pf10.4,1pe10.3,0pf10.4,9(1x,g8.3,1x)) c if (nctpr .le. nlim2) go to 100 nlim1 = nlim2 + 1 nlim2 = min(18,nctpr) c if (qtitl) then do i = 1,3 write (ntabx,1000) ue write (ntabx,1000) uk enddo c write (ntabx,1055) ue,(uelac(n), n = nlim1,nlim2) write (ntabx,1055) uk,(uelac(n), n = nlim1,nlim2) write (ntabx,1000) ue write (ntabx,1000) uk endif c write (ntabx,1040) ue,xilog,tdays,tlogd, $ (lcteaq(n), n = nlim1,nlim2) write (ntabx,1065) uk,xilog,tdays,tlogd, $ (ppmaq(n), n = nlim1,nlim2) c if (nctpr .le. nlim2) go to 100 nlim1 = nlim2 + 1 nlim2 = min(27,nctpr) c if (qtitl) then do i = 1,3 write (ntabx,1000) uf write (ntabx,1000) ul enddo c write (ntabx,1055) uf,(uelac(n), n = nlim1,nlim2) write (ntabx,1055) ul,(uelac(n), n = nlim1,nlim2) write (ntabx,1000) uf write (ntabx,1000) ul endif c write (ntabx,1040) uf,xilog,tdays,tlogd, $ (lcteaq(n), n = nlim1,nlim2) write (ntabx,1065) ul,xilog,tdays,tlogd, $ (ppmaq(n), n = nlim1,nlim2) c if (nctpr .le. nlim2) go to 100 nlim1 = nlim2 + 1 nlim2 = min(36,nctpr) c if (qtitl) then do i = 1,3 write (ntabx,1000) ug write (ntabx,1000) um enddo c write (ntabx,1055) ug,(uelac(n), n = nlim1,nlim2) write (ntabx,1055) um,(uelac(n), n = nlim1,nlim2) write (ntabx,1000) ug write (ntabx,1000) um endif c write (ntabx,1040) ug,xilog,tdays,tlogd, $ (lcteaq(n), n = nlim1,nlim2) write (ntabx,1065) um,xilog,tdays,tlogd, $ (ppmaq(n), n = nlim1,nlim2) c if (nctpr .le. nlim2) go to 100 nlim1 = nlim2 + 1 nlim2 = min(45,nctpr) c if (qtitl) then do i = 1,3 write (ntabx,1000) uh write (ntabx,1000) un enddo c write (ntabx,1055) uh,(uelac(n), n = nlim1,nlim2) write (ntabx,1055) un,(uelac(n), n = nlim1,nlim2) write (ntabx,1000) uh write (ntabx,1000) un endif c write (ntabx,1040) uh,xilog,tdays,tlogd, $ (lcteaq(n), n = nlim1,nlim2) write (ntabx,1065) un,xilog,tdays,tlogd, $ (ppmaq(n), n = nlim1,nlim2) c 100 continue c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write table o. Product solid solution compositions. c c Endmember compositions of product phases. c c Write header on first pass through. c if (qtitl) then do i = 1,3 write (ntabx,1000) uo enddo c write (ntabx,2100) uo 2100 format(a1,20x,'solid solution product compositions') write (ntabx,1000) uo endif c c First check if solid solution phases are present in matrix. c ktot = kxt - kx1 + 1 c if (ktot .le. 0) go to 400 c c Go through solid solutions in matrix. c n = 0 do kcol = kx1,kxt ns = iindx1(kcol) np = ipndx1(kcol) n = n + 1 uprss(1,n) = uspec(ns)(1:10) uprss(2,n) = uspec(ns)(11:20) xfrac(n) = xbar(ns) enddo c c Write out solid solution name and composition. c nlim = min(6,n) write (ntabx,2006) uo,(uprss(1,i),i = 1,nlim) write (ntabx,2011) uo,(uprss(2,i),i = 1,nlim) 2006 format(a1,1x,' log xi ',8x,6(1x,a10,1x)) 2011 format(a1,19x,6(1x,a10,1x)) write (ntabx,2007) uo,xilog,(xfrac(i),i = 1,nlim) 2007 format(a1,4x,f9.4,6x,6(1x,f10.8,1x)) if (n .gt. nlim) then nlim = min(12,n) write (ntabx,2008) uo,(uprss(1,i),i = 7,nlim) write (ntabx,2008) uo,(uprss(2,i),i = 7,nlim) write (ntabx,2009) uo,(xfrac(i),i = 7,nlim) 2008 format(/,a1,19x,5(1x,a10,1x),1x,a10) 2009 format(a1,19x,6(1x,f10.8,1x)) endif if (n .gt. nlim) then nlim = min(18,n) write (ntabx,2008) uo,(uprss(1,i),i = 13,nlim) write (ntabx,2008) uo,(uprss(2,i),i = 13,nlim) write (ntabx,2009) uo,(xfrac(i),i = 13,nlim) endif if (n .gt. nlim) then nlim = min(24,n) write (ntabx,2008) uo,(uprss(1,i),i = 19,nlim) write (ntabx,2008) uo,(uprss(2,i),i = 19,nlim) write (ntabx,2009) uo,(xfrac(i),i = 19,nlim) endif if (n .gt. 24) write (ntabx,2051) uo 2051 format(a1,1x,'number of solid solution product phases > 24') 400 continue c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write tables p, q, r, and s. Product minerals. c c Log of mass (moles) for closed system c Log of cumulative mass (moles) for flow-through c system c if (qtitl) then do i = 1,3 write (ntabx,1000) up enddo c if (iopt(1) .eq. 2) then write (ntabx,2000) up 2000 format(a1,20x,'log of moles of product minerals (cumulative)') else write (ntabx,2002) up 2002 format(a1,20x,'log of moles of product minerals') endif write (ntabx,1000) up endif c ktot = kxt - km1 + 1 c if (ktot .le. 0) go to 200 c c ktotlm = no. of minerals that can be printed in the tables. c ktotlm = 36 c if (kmt .ge. km1) then do kcol = km1,kmt n = kcol - km1 + 1 if (n .gt. ktotlm) go to 125 np = ipndx1(kcol) uprmn(1,n) = uphase(np)(1:8) uprmn(2,n) = uphase(np)(9:16) uprmn(3,n) = uphase(np)(17:24) if (iopt(1) .eq. 2) then zvclgx(n) = tlg(mopht(np)) else zvclgx(n) = loph(np) endif cXX Will eventually have to revise the tab file (-99999. vs. -999.). if (zvclgx(n) .lt. -999.) zvclgx(n) = -999. enddo else c c If all products present are solid solutions, reset counter to 0. c n = 0 endif c if (kxt .ge. kx1) then np1 = 0 do kcol = kx1,kxt ns = iindx1(kcol) np = ipndx1(kcol) c c The values of kx1 - kxt correspond to all the endmembers of c solid solutions in the PRS. The following line checks to c see if the next solid solution phase has been reached. c if (np .ne. np1) then np1 = np n = n + 1 if (n .gt. ktotlm) go to 125 uprmn(1,n) = uphase(np)(1:8) uprmn(2,n) = uphase(np)(9:16) uprmn(3,n) = uphase(np)(17:24) if (iopt(1) .eq. 2) then zvclgx(n) = tlg(mopht(np)) else zvclgx(n) = loph(np) endif if (zvclgx(n) .lt. -999.) zvclgx(n) = -999. endif enddo endif 125 ktot = n c nlim2 = min(9,ktot) c qphasc = qmod .or. qbye .or. qtitl if (qphasc) then c do i = 1,3 write (ntabx,1000) up enddo c write (ntabx,2005) up,(uprmn(1,n), n = 1,nlim2) 2005 format(a1,1x,' log xi time, d log days ',9(1x,a8,1x)) write (ntabx,2010) up,(uprmn(2,n), n = 1,nlim2) 2010 format(a1,32x,9(1x,a8,1x),1x,a8) write (ntabx,2010) up,(uprmn(3,n), n = 1,nlim2) write (ntabx,1000) up endif c write (ntabx,1040) up,xilog,tdays,tlogd,(zvclgx(n), n = 1,nlim2) c if (ktot .le. nlim2) go to 200 nlim1 = nlim2 + 1 nlim2 = min(18,ktot) c if (qphasc) then do i = 1,3 write (ntabx,1000) uq enddo c write (ntabx,2005) uq,(uprmn(1,n), n = nlim1,nlim2) write (ntabx,2010) uq,(uprmn(2,n), n = nlim1,nlim2) write (ntabx,2010) uq,(uprmn(3,n), n = nlim1,nlim2) write (ntabx,1000) uq endif c write (ntabx,1040) uq,xilog,tdays,tlogd, $ (zvclgx(n), n = nlim1,nlim2) c if (ktot .le. nlim2) go to 200 nlim1 = nlim2 + 1 nlim2 = min(27,ktot) c if (qphasc) then do i = 1,3 write (ntabx,1000) ur enddo c write (ntabx,2005) ur,(uprmn(1,n), n = nlim1,nlim2) write (ntabx,2010) ur,(uprmn(2,n), n = nlim1,nlim2) write (ntabx,2010) ur,(uprmn(3,n), n = nlim1,nlim2) write (ntabx,1000) ur endif c write (ntabx,1040) ur,xilog,tdays,tlogd, $ (zvclgx(n), n = nlim1,nlim2) c if (ktot .le. nlim2) go to 200 nlim1 = nlim2 + 1 nlim2 = min(36,ktot) c if (qphasc) then do i = 1,3 write (ntabx,1000) us enddo c write (ntabx,2005) us,(uprmn(1,n), n = nlim1,nlim2) write (ntabx,2010) us,(uprmn(2,n), n = nlim1,nlim2) write (ntabx,2010) us,(uprmn(3,n), n = nlim1,nlim2) write (ntabx,1000) us endif c write (ntabx,1040) us,xilog,tdays,tlogd, $ (zvclgx(n), n = nlim1,nlim2) c 200 continue c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write tables t and u. Reactants. c c Log of mass (moles) of reactant destroyed. c if (nrct .le. 0) go to 215 c do nrc = 1,nrct mx = abs(modr(nrc)) cXX zvclgx(nrc) = -99999. zvclgx(nrc) = -999. if (mx .gt. 0.) zvclgx(nrc) = tlg(mx) enddo c nlim2 = min(9,nrct) c if (qtitl) then do i = 1,3 write (ntabx,1000) ut enddo c write (ntabx,2020) ut 2020 format(a1,20x,'log of destroyed moles of reactants') write (ntabx,1000) ut write (ntabx,2005) ut,(ureac(nrc)(1:8), nrc = 1,nlim2) write (ntabx,2010) ut,(ureac(nrc)(9:16), nrc = 1,nlim2) write (ntabx,2010) ut,(ureac(nrc)(17:24), nrc = 1,nlim2) write (ntabx,1000) ut endif c write (ntabx,1040) ut,xilog,tdays,tlogd, $ (zvclgx(nrc), nrc = 1,nlim2) c if (nrct .le. nlim2) go to 215 nlim1 = nlim2 + 1 nlim2 = min(18,nrct) c if (qtitl) then do i = 1,3 write (ntabx,1000) uu enddo c write (ntabx,2005) uu,(ureac(nrc)(1:8), nrc = nlim1,nlim2) write (ntabx,2010) uu,(ureac(nrc)(9:16), nrc = nlim1,nlim2) write (ntabx,2010) uu,(ureac(nrc)(17:24), nrc = nlim1,nlim2) write (ntabx,1000) uu endif c write (ntabx,1040) uu,xilog,tdays,tlogd, $ (zvclgx(nrc), nrc = nlim1,nlim2) c 215 continue c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write table v. Overall masses and volumes. c c Total mass of solids destroyed, grams c Total mass of solids created, grams c Net mass of solids created, grams c Total volume of solids destroyed, cc c Total volume of solids created, cc c Net volume of solids created, cc c if (qtitl) then do i = 1,3 write (ntabx,1000) uv enddo c write (ntabx,2030) uv 2030 format(a1,1x,' xi log xi time, d log days g des', $ ' g cre g net cc des cc cre cc net') write (ntabx,1000) uv endif c write (ntabx,2035) uv,xi1,xilog,tdays,tlogd,wodrt,wosoct,dwoso, $ vodrt,vosoct,dvoso 2035 format(a1,1x,1pe10.3,0pf10.4,1pe10.3,0pf10.4,8(1pe10.3)) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write tables x and y. Affinities of irreversible reactions. c c Affinities of individual reactants, kcal. c if (nrct .le. 0) go to 300 nlim2 = min(9,nrct) c if (qtitl) then do i = 1,3 write (ntabx,1000) ux enddo c write (ntabx,2040) ux 2040 format(a1,20x,'affinities of irreversible reactions') write (ntabx,1000) ux write (ntabx,2005) ux,(ureac(nrc)(1:8), nrc = 1,nlim2) write (ntabx,2010) ux,(ureac(nrc)(9:16), nrc = 1,nlim2) write (ntabx,2010) ux,(ureac(nrc)(17:24), nrc = 1,nlim2) write (ntabx,1000) ux endif c write (ntabx,1040) ux,xilog,tdays,tlogd, $ (afrc1(nrc), nrc = 1,nlim2) c if (nrct .le. nlim2) go to 300 nlim1 = nlim2 + 1 nlim2 = min(18,nrct) if (qtitl) then do i = 1,3 write (ntabx,1000) uy enddo c write (ntabx,2005) uy,(ureac(nrc)(1:8), nrc = nlim1,nlim2) write (ntabx,2010) uy,(ureac(nrc)(9:16), nrc = nlim1,nlim2) write (ntabx,2010) uy,(ureac(nrc)(17:24), nrc = nlim1,nlim2) write (ntabx,1000) uy endif c write (ntabx,1040) uy,xilog,tdays,tlogd, $ (afrc1(nrc), nrc = nlim1,nlim2) c 300 continue c end
classdef ipfHKLKey < ipfColorKey % defines an orientation mapping based on a certain inverse pole figure % Detailed explanation goes here methods function oM = ipfHKLKey(varargin) oM = oM@ipfColorKey(varargin{:}); oM.CS1 = oM.CS1.Laue; oM.dirMap = HKLDirectionKey(oM.CS1); end end end
\documentclass[11pt,a4paper,twoside,headinclude,footexclude]{scrreprt} %---------------------------------------------------------------------- \input{settings} \input{defs} \RequirePackage{geometry} \geometry{reset,twoside,a4paper,includemp=false,% top=4.5cm,bottom=4.5cm,left=3.2cm,right=3.2cm,% headheight=30pt } \begin{document} \input{layout} \input{title} \cleardoublepage %---------------------------------------------------------------------- %---------------------------------------------------------------------- \newpage \tableofcontents %\newpage %\listoftables \listoffigures %---------------------------------------------------------------------- \cleardoublepage %====================================================================== \chapter{User Documentation} \section{Introduction}\label{sec:introduction} \input{introduction} \section{L4 Language Description}\label{sec:language} \input{language} \section{Translations to Proof Tools}\label{sec:translations} \input{translations} %====================================================================== \chapter{Developer Documentation} \section{Parsing and Typechecking}\label{sec:parsing_typechecking} \input{parsing_typechecking} %====================================================================== \newpage \bibliographystyle{alpha} \bibliography{main} \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End:
module Toolkit.Data.Pair import Decidable.Equality %default total public export data IsFirst : (this : a) -> (that : Pair a b) -> Type where IF : (prf : x = y) -> IsFirst x (y,b) export isFirst : DecEq type => (this : type) -> (that : Pair type b) -> Dec (IsFirst this that) isFirst this (x, y) with (decEq this x) isFirst this (this, y) | (Yes Refl) = Yes (IF Refl) isFirst this (x, y) | (No contra) = No (\(IF Refl) => contra Refl) public export data IsSecond : (this : b) -> (that : Pair a b) -> Type where IS : (prf : x = y) -> IsSecond x (a,y) export isSecond : DecEq type => (this : type) -> (that : Pair a type) -> Dec (IsSecond this that) isSecond this (x, y) with (decEq this y) isSecond this (x, this) | (Yes Refl) = Yes (IS Refl) isSecond this (x, y) | (No contra) = No (\(IS Refl) => contra Refl) -- [ EOF ]
r=359.13 https://sandbox.dams.library.ucdavis.edu/fcrepo/rest/collection/sherry-lehmann/catalogs/d7sg6b/media/images/d7sg6b-006/svc:tesseract/full/full/359.13/default.jpg Accept:application/hocr+xml
Require Import Ensembles. Require Import Coq.Lists.List. Require Import ListExt. Require Import folProof. Require Import folProp. Require Vector. Require Import Peano_dec. Require Import misc. Require Import Arith. Section Model_Theory. Variable L : Language. Fixpoint naryFunc (A : Set) (n : nat) {struct n} : Set := match n with | O => A | S m => A -> naryFunc A m end. Fixpoint naryRel (A : Set) (n : nat) {struct n} : Type := match n with | O => Prop | S m => A -> naryRel A m end. Record Model : Type := model {U : Set; func : forall f : Functions L, naryFunc U (arityF L f); rel : forall r : Relations L, naryRel U (arityR L r)}. Variable M : Model. Fixpoint interpTerm (value : nat -> U M) (t : Term L) {struct t} : U M := match t with | var v => value v | apply f ts => interpTerms _ (func M f) value ts end with interpTerms (m : nat) (f : naryFunc (U M) m) (value : nat -> U M) (ts : Terms L m) {struct ts} : U M := match ts in (Terms _ n) return (naryFunc (U M) n -> U M) with | Tnil => fun f => f | Tcons m t ts => fun f => interpTerms m (f (interpTerm value t)) value ts end f. Fixpoint interpRels (m : nat) (r : naryRel (U M) m) (value : nat -> U M) (ts : Terms L m) {struct ts} : Prop := match ts in (Terms _ n) return (naryRel (U M) n -> Prop) with | Tnil => fun r => r | Tcons m t ts => fun r => interpRels m (r (interpTerm value t)) value ts end r. Definition updateValue (value : nat -> U M) (n : nat) (v : U M) (x : nat) : U M := match eq_nat_dec n x with | left _ => v | right _ => value x end. Fixpoint interpFormula (value : nat -> U M) (f : Formula L) {struct f} : Prop := match f with | equal t s => interpTerm value t = interpTerm value s | atomic r ts => interpRels _ (rel M r) value ts | impH A B => interpFormula value A -> interpFormula value B | notH A => interpFormula value A -> False | forallH v A => forall x : U M, interpFormula (updateValue value v x) A end. Lemma freeVarInterpTerm (v1 v2 : nat -> U M) (t : Term L): (forall x : nat, In x (freeVarTerm L t) -> v1 x = v2 x) -> interpTerm v1 t = interpTerm v2 t. Proof. elim t using Term_Terms_ind with (P0 := fun (n : nat) (ts : Terms L n) => forall f : naryFunc (U M) n, (forall x : nat, In x (freeVarTerms L n ts) -> v1 x = v2 x) -> interpTerms n f v1 ts = interpTerms n f v2 ts); simpl. - intros n H; apply H; left; auto. - intros f t0 H H0; apply H. intros x H1; apply H0, H1. - reflexivity. - intros n t0 H t1 H0 f H1. rewrite H. apply H0. intros x H2; apply H1. + unfold freeVarTerms; apply in_or_app. right; apply H2. + intros x H2; apply H1. unfold freeVarTerms; apply in_or_app; left. apply H2. Qed. Lemma freeVarInterpRel (v1 v2 : nat -> U M) (n : nat) (ts : Terms L n) (r : naryRel (U M) n): (forall x : nat, In x (freeVarTerms L n ts) -> v1 x = v2 x) -> interpRels n r v1 ts -> interpRels n r v2 ts. Proof. intros H; induction ts as [| n t ts Hrects]; simpl in |- *. - auto. - rewrite (freeVarInterpTerm v1 v2). + apply Hrects. intros x H0; apply H. unfold freeVarTerms; apply in_or_app; right; apply H0. + intros x H0; apply H. unfold freeVarTerms; apply in_or_app; left; apply H0. Qed. Lemma freeVarInterpFormula (v1 v2 : nat -> U M) (g : Formula L): (forall x : nat, In x (freeVarFormula L g) -> v1 x = v2 x) -> interpFormula v1 g -> interpFormula v2 g. Proof. revert v1 v2. induction g as [t t0| r t| g1 Hrecg1 g0 Hrecg0| g Hrecg| n g Hrecg]; simpl in |- *; intros v1 v2 H. - repeat rewrite (freeVarInterpTerm v1 v2). + auto. + intros x H0; apply H. simpl; auto with datatypes. + intros x H0; apply H. simpl; auto with datatypes. - intros H0; apply (freeVarInterpRel v1 v2). + apply H. + apply H0. - assert (H0: interpFormula v2 g1 -> interpFormula v1 g1). { apply Hrecg1. intros x H0; symmetry; apply H. simpl; auto with datatypes. } assert (H1: interpFormula v1 g0 -> interpFormula v2 g0). { apply Hrecg0. intros x H1; apply H; simpl; auto with datatypes. } tauto. - intros H0 H1; apply H0. apply Hrecg with v2. intros x H2; symmetry; auto. assumption. - intros H0 x; apply Hrecg with (updateValue v1 n x). + intros x0 H1; unfold updateValue; induction (eq_nat_dec n x0). * reflexivity. * apply H. apply in_in_remove; auto. + auto. Qed. Lemma subInterpTerm (value : nat -> U M) (t : Term L) (v : nat) (s : Term L): interpTerm (updateValue value v (interpTerm value s)) t = interpTerm value (substituteTerm L t v s). Proof. elim t using Term_Terms_ind with (P0 := fun (n : nat) (ts : Terms L n) => forall f : naryFunc (U M) n, interpTerms n f (updateValue value v (interpTerm value s)) ts = interpTerms n f value (substituteTerms L n ts v s)); simpl. - intro n; unfold updateValue; induction (eq_nat_dec v n); reflexivity. - intros f t0 H; rewrite H. + reflexivity. - reflexivity. - intros n t0 H t1 H0 f; rewrite H; apply H0. Qed. Lemma subInterpRel (value : nat -> U M) (n : nat) (ts : Terms L n) (v : nat) (s : Term L) (r : naryRel (U M) n): interpRels n r (updateValue value v (interpTerm value s)) ts <-> interpRels n r value (substituteTerms L n ts v s). Proof. induction ts as [| n t ts Hrects]. - simpl; tauto. - simpl; rewrite <- subInterpTerm; apply Hrects. Qed. Lemma subInterpFormula : forall (value : nat -> U M) (f : Formula L) (v : nat) (s : Term L), interpFormula (updateValue value v (interpTerm value s)) f <-> interpFormula value (substituteFormula L f v s). Proof. intros value f; revert value. elim f using Formula_depth_ind2; simpl. - intros t t0 value v s; repeat rewrite subInterpTerm. tauto. - intros r t value v s; apply subInterpRel. - intros f0 H f1 H0 value v s; rewrite (subFormulaImp L). simpl; assert (H1: interpFormula (updateValue value v (interpTerm value s)) f1 <-> interpFormula value (substituteFormula L f1 v s)) by auto. assert (H2: interpFormula (updateValue value v (interpTerm value s)) f0 <-> interpFormula value (substituteFormula L f0 v s)) by auto. tauto. - intros f0 H value v s; rewrite (subFormulaNot L). simpl in |- *. assert (interpFormula (updateValue value v (interpTerm value s)) f0 <-> interpFormula value (substituteFormula L f0 v s)). auto. tauto. - intros v a H value v0 s; rewrite (subFormulaForall L). induction (eq_nat_dec v v0) as [a0 | b]. + rewrite a0. simpl in |- *. unfold updateValue in |- *. split. * intros H0 x; apply freeVarInterpFormula with (fun x0 : nat => match eq_nat_dec v0 x0 with | left _ => x | right _ => match eq_nat_dec v0 x0 with | left _ => interpTerm value s | right _ => value x0 end end). -- intros x0 H1; induction (eq_nat_dec v0 x0); reflexivity. -- auto. * intros H0 x; apply freeVarInterpFormula with (fun x0 : nat => match eq_nat_dec v0 x0 with | left _ => x | right _ => value x0 end). -- intros x0 H1; induction (eq_nat_dec v0 x0); reflexivity. -- auto. + induction (In_dec eq_nat_dec v (freeVarTerm L s)) as [a0 | b0]. * simpl; set (nv := newVar (v0 :: freeVarTerm L s ++ freeVarFormula L a)) in *. assert (~ In nv (v0 :: freeVarTerm L s ++ freeVarFormula L a)). { unfold nv in |- *. apply newVar1. } assert (forall (x : U M) (x0 : nat), In x0 (freeVarFormula L a) -> updateValue (updateValue value v0 (interpTerm value s)) v x x0 = updateValue (updateValue (updateValue value nv x) v0 (interpTerm (updateValue value nv x) s)) v (interpTerm (updateValue (updateValue value nv x) v0 (interpTerm (updateValue value nv x) s)) (var nv)) x0). { intros x x0 H1; unfold updateValue in |- *; simpl in |- *. induction (eq_nat_dec v x0) as [a1 | ?]. - induction (eq_nat_dec v0 nv) as [a2 | b0]. + elim H0. rewrite a2. simpl in |- *. auto. + induction (eq_nat_dec nv nv) as [a2 | b1]. * reflexivity. * elim b1; reflexivity. - induction (eq_nat_dec v0 x0) as [a1 | b1]. + apply freeVarInterpTerm. intros x1 H2; induction (eq_nat_dec nv x1). * elim H0. rewrite a2. simpl in |- *. auto with datatypes. * reflexivity. + induction (eq_nat_dec nv x0) as [a1 | ?]. * elim H0. rewrite a1. auto with datatypes. * reflexivity. } assert (H2: (forall x : U M, interpFormula (updateValue (updateValue (updateValue value nv x) v0 (interpTerm (updateValue value nv x) s)) v (interpTerm (updateValue (updateValue value nv x) v0 (interpTerm (updateValue value nv x) s)) (var nv))) a) <-> (forall x : U M, interpFormula (updateValue value nv x) (substituteFormula L (substituteFormula L a v (var nv)) v0 s))). { split. - assert (H2: forall b : Formula L, lt_depth L b (forallH v a) -> forall (value : nat -> U M) (v : nat) (s : Term L), interpFormula (updateValue value v (interpTerm value s)) b -> interpFormula value (substituteFormula L b v s)). { intros b0 H2 value0 v1 s0 H3; induction (H b0 H2 value0 v1 s0); auto. } intros H3 x; apply H2. + eapply eqDepth. * symmetry; apply subFormulaDepth. * apply depthForall. + apply H2. * apply depthForall. * apply H3. - intros H2 x. assert (H3: forall b : Formula L, lt_depth L b (allH v, a)%fol -> forall (value : nat -> U M) (v : nat) (s : Term L), interpFormula value (substituteFormula L b v s) -> interpFormula (updateValue value v (interpTerm value s)) b) by (intros; induction (H b0 H3 value0 v1 s0); auto). clear H; apply H3. + apply depthForall. + apply H3. * eapply eqDepth. -- symmetry; apply subFormulaDepth. -- apply depthForall. * auto. } assert (H3: (forall x : U M, interpFormula (updateValue (updateValue value v0 (interpTerm value s)) v x) a) <-> (forall x : U M, interpFormula (updateValue (updateValue (updateValue value nv x) v0 (interpTerm (updateValue value nv x) s)) v (interpTerm (updateValue (updateValue value nv x) v0 (interpTerm (updateValue value nv x) s)) (var nv))) a)). { split. - intros H3 x; apply freeVarInterpFormula with (updateValue (updateValue value v0 (interpTerm value s)) v x). auto. auto. - intros H3 x. apply freeVarInterpFormula with (updateValue (updateValue (updateValue value nv x) v0 (interpTerm (updateValue value nv x) s)) v (interpTerm (updateValue (updateValue value nv x) v0 (interpTerm (updateValue value nv x) s)) (var nv))). + intros x0 H4; symmetry in |- *. auto. + auto. } tauto. * simpl in |- *. assert (forall (x : U M) (x0 : nat), In x0 (freeVarFormula L a) -> updateValue (updateValue value v0 (interpTerm value s)) v x x0 = updateValue (updateValue value v x) v0 (interpTerm (updateValue value v x) s) x0). { intros x x0 H0; unfold updateValue; induction (eq_nat_dec v x0) as [a0 | b1]. - induction (eq_nat_dec v0 x0) as [a1 | ?]. + elim b. transitivity x0; auto. + reflexivity. - induction (eq_nat_dec v0 x0) as [a0 | ?]. + apply freeVarInterpTerm. intros x1 H1; induction (eq_nat_dec v x1). * elim b0. rewrite a1. auto. * reflexivity. + reflexivity. } split. -- intros H1 x; assert (H2: forall b : Formula L, lt_depth L b (forallH v a) -> forall (value : nat -> U M) (v : nat) (s : Term L), interpFormula (updateValue value v (interpTerm value s)) b -> interpFormula value (substituteFormula L b v s)). { intros b1 H2 value0 v1 s0 H3; induction (H b1 H2 value0 v1 s0); auto. } apply H2. ++ apply depthForall. ++ apply freeVarInterpFormula with (updateValue (updateValue value v0 (interpTerm value s)) v x). ** apply (H0 x). ** apply H1. -- assert (forall b : Formula L, lt_depth L b (forallH v a) -> forall (value : nat -> U M) (v : nat) (s : Term L), interpFormula value (substituteFormula L b v s) -> interpFormula (updateValue value v (interpTerm value s)) b). { intros b1 H1 value0 v1 s0 H2; induction (H b1 H1 value0 v1 s0); auto. } intros H2 x; apply freeVarInterpFormula with (updateValue (updateValue value v x) v0 (interpTerm (updateValue value v x) s)). ++ intros; symmetry in |- *; auto. ++ apply H1. ** apply depthForall. ** auto. Qed. Lemma subInterpFormula1 (value : nat -> U M) (f : Formula L) (v : nat) (s : Term L): interpFormula (updateValue value v (interpTerm value s)) f -> interpFormula value (substituteFormula L f v s). Proof. induction (subInterpFormula value f v s); auto. Qed. Lemma subInterpFormula2 (value : nat -> U M) (f : Formula L) (v : nat) (s : Term L): interpFormula value (substituteFormula L f v s) -> interpFormula (updateValue value v (interpTerm value s)) f. Proof. induction (subInterpFormula value f v s); auto. Qed. Fixpoint nnHelp (f : Formula L) : Formula L := match f with | equal t s => equal t s | atomic r ts => atomic r ts | impH A B => impH (nnHelp A) (nnHelp B) | notH A => notH (nnHelp A) | forallH v A => (allH v, ~ ~ nnHelp A)%fol end. Definition nnTranslate (f : Formula L) : Formula L := notH (notH (nnHelp f)). Lemma freeVarNNHelp (f : Formula L): freeVarFormula L f = freeVarFormula L (nnHelp f). Proof. induction f as [t t0| r t| f1 Hrecf1 f0 Hrecf0| f Hrecf| n f Hrecf]; try reflexivity. - simpl; now rewrite Hrecf1, Hrecf0. - simpl; assumption. - simpl; now rewrite Hrecf. Qed. Lemma subNNHelp : forall (f : Formula L) (v : nat) (s : Term L), substituteFormula L (nnHelp f) v s = nnHelp (substituteFormula L f v s). Proof. intro f; elim f using Formula_depth_ind2; intros; try reflexivity. - simpl; rewrite subFormulaImp, H, H0. now rewrite subFormulaImp. - simpl; rewrite subFormulaNot, H, subFormulaNot; easy. - simpl; do 2 rewrite subFormulaForall. simpl; induction (eq_nat_dec v v0). + simpl; reflexivity. + induction (In_dec eq_nat_dec v (freeVarTerm L s)) as [? | ?]. * simpl; repeat rewrite subFormulaNot; repeat rewrite H. -- now rewrite <- freeVarNNHelp. -- eapply eqDepth. ++ symmetry; apply subFormulaDepth. ++ apply depthForall. -- apply depthForall. * repeat rewrite subFormulaNot. rewrite H; simpl. -- reflexivity. -- apply depthForall. Qed. Section Consistent_Theory. Variable T : System L. Fixpoint interpTermsVector (value : nat -> U M) (n : nat) (ts : Terms L n) {struct ts} : Vector.t (U M) n := match ts in (Terms _ n) return (Vector.t (U M) n) with | Tnil => Vector.nil (U M) | Tcons m t ts => Vector.cons (U M) (interpTerm value t) m (interpTermsVector value m ts) end. Lemma preserveValue (value : nat -> U M): (forall f : Formula L, mem _ T f -> interpFormula value (nnTranslate f)) -> forall g : Formula L, SysPrf L T g -> interpFormula value (nnTranslate g). Proof. intros H g H0. induction H0 as (x, H0). induction H0 as (x0, H0). cut (forall g : Formula L, In g x -> interpFormula value (nnTranslate g)). - clear H H0; revert value. induction x0 as [A| Axm1 Axm2 A B x0_1 Hrecx0_1 x0_0 Hrecx0_0| Axm A v n x0 Hrecx0| A B| A B C| A B| A v t| A v n| A B v| | | | R| f]; intros; try (simpl in |- *; tauto). + apply H. auto with datatypes. + assert (H0: interpFormula value (nnTranslate A)) by auto with datatypes. assert (H1: interpFormula value (nnTranslate (A -> B)%fol)) by auto with datatypes. clear Hrecx0_1 Hrecx0_0. simpl in H0, H1. simpl in |- *. tauto. + simpl in |- *. intros. apply H0. clear H0. intros. simpl in Hrecx0. apply (Hrecx0 (updateValue value v x)). * intros. simpl in H. eapply H. -- apply H1. -- intros. apply H2. apply freeVarInterpFormula with value. ++ intros. rewrite <- freeVarNNHelp in H4. unfold updateValue in |- *. induction (eq_nat_dec v x1). ** elim n. rewrite a. clear n x0 Hrecx0 H. induction Axm as [| a0 Axm HrecAxm]. apply H1. simpl in |- *. simpl in H1. induction H1 as [H| H]. rewrite H. auto with datatypes. auto with datatypes. ** reflexivity. ++ assumption. * assumption. + simpl in |- *. intros. apply H0. intros. elim H1 with (interpTerm value t). intros. apply H0. intros. rewrite <- subNNHelp. apply subInterpFormula1. auto. + simpl in |- *. intros. apply H0. intros. apply H2. apply freeVarInterpFormula with value. * intros. unfold updateValue in |- *. induction (eq_nat_dec v x0). -- elim n. rewrite a. rewrite freeVarNNHelp. assumption. -- reflexivity. * assumption. + simpl in |- *. intros. apply H0. clear H0. intros. apply H0 with x. intros. apply H1 with x. auto. + simpl in |- *. auto. + simpl in |- *. intros. apply H0. intros. transitivity (value 1); auto. + simpl in |- *. intros. apply H0. clear H H0. unfold AxmEq4 in |- *. cut (forall a b : Terms L (arityR L R), interpTermsVector value _ a = interpTermsVector value _ b -> interpFormula value (nnHelp (iffH (atomic R a) (atomic R b)))). * assert (H: forall A, (forall a b : Terms L (arityR L R), interpTermsVector value (arityR L R) a = interpTermsVector value (arityR L R) b -> interpFormula value (nnHelp (A a b))) -> interpFormula value (nnHelp (nat_rec (fun _ : nat => Formula L) (prod_rec (fun _ : Terms L (arityR L R) * Terms L (arityR L R) => Formula L) (fun a b : Terms L (arityR L R) => A a b) (nVars L (arityR L R))) (fun (n : nat) (Hrecn : Formula L) => (v_ (n + n)%nat = v_ (S (n+n))%nat -> Hrecn)%fol) (arityR L R)))). { generalize (arityR L R). simple induction n. - simpl; intros A H; now apply H. - intros n0 H A H0; simpl; induction (nVars L n0). simpl in H |- *. intro H1; apply (H (fun x y : Terms L n0 => A (Tcons (var (n0 + n0)) x) (Tcons (var (S (n0 + n0))) y))). intros a0 b0 H2; apply H0. simpl; rewrite H1. now rewrite H2. } apply (H (fun a b => iffH (atomic R a) (atomic R b))). * simpl; generalize (rel M R). generalize (arityR L R). intros n n0 a b H H0. induction a as [| n t a Hreca]. -- assert (H1: b = Tnil) by (symmetry; apply nilTerms). rewrite H1 in H0; auto. -- induction (consTerms L n b) as [x p]. induction x as (a0, b0). simpl in p. rewrite <- p in H0. rewrite <- p in H. simpl in H. inversion H. simpl in H0. rewrite H2 in H0. apply (Hreca (n0 (interpTerm value a0)) b0). ++ apply (inj_right_pair2 _ eq_nat_dec _ _ _ _ H3). ++ auto. + simpl in |- *. intros H0; apply H0. clear H H0. unfold AxmEq5 in |- *. cut (forall a b : Terms L (arityF L f), interpTermsVector value _ a = interpTermsVector value _ b -> interpFormula value (nnHelp (apply f a = apply f b)%fol)). * assert (H: forall A, (forall a b : Terms L (arityF L f), interpTermsVector value (arityF L f) a = interpTermsVector value (arityF L f) b -> interpFormula value (nnHelp (A a b))) -> interpFormula value (nnHelp (nat_rec (fun _ : nat => Formula L) (prod_rec (fun _ : Terms L (arityF L f) * Terms L (arityF L f) => Formula L) (fun a b : Terms L (arityF L f) => A a b) (nVars L (arityF L f))) (fun (n : nat) (Hrecn : Formula L) => (v_ (n + n)%nat = v_ (S (n + n))%nat -> Hrecn)%fol) (arityF L f)))). { generalize (arityF L f). simple induction n. - simpl; intros A H; auto. - intros n0 H A H0; simpl. induction (nVars L n0). simpl in H |- *. intros H1; apply (H (fun x y : Terms L n0 => A (Tcons (var (n0 + n0)) x) (Tcons (var (S (n0 + n0))) y))). intros a0 b0 H2; apply H0. simpl; rewrite H1. now rewrite H2. } apply (H (fun a b => equal (apply f a) (apply f b))). * simpl; generalize (func M f). generalize (arityF L f). intros n n0 a b H. induction a as [| n t a Hreca]. -- assert (H0: b = Tnil) by ( symmetry; apply nilTerms). now rewrite H0. -- induction (consTerms L n b) as [x p]; induction x as (a0, b0). simpl in p; rewrite <- p; rewrite <- p in H. simpl in H. inversion H. simpl; rewrite H1. apply Hreca. apply (inj_right_pair2 _ eq_nat_dec _ _ _ _ H2). - auto. Qed. Lemma ModelConsistent (value : nat -> U M): (forall f : Formula L, mem _ T f -> interpFormula value (nnTranslate f)) -> Consistent L T. Proof. intros H; unfold Consistent; exists (v_ O <> v_ 0)%fol. intros H0; assert (H1: interpFormula value (nnTranslate (v_ O <> v_ 0)%fol)). { apply preserveValue. assumption. auto. } apply H1; simpl; auto. Qed. End Consistent_Theory. End Model_Theory.
#include "server_comm_thread.h" #include <lepton/core/defines.h> #include <ros/ros.h> #include <boost/thread.hpp> namespace bzrobot { namespace server { RosCommThread::RosCommThread() { } RosCommThread::~RosCommThread() { } void RosCommThread::Start() { LEPTON_MOVE_FUNCTION_TO_THREAD(RosCommThread::RunThread); } void RosCommThread::RunThread() { // ros message loop here ros::spin(); } } }
function printClosedloopData(mpciter, u, x, t_Elapsed,output_data) global fst_output_data ; global snd_output_data ; if size(x,2)==2 fprintf(' %3d |%+11.4f %+11.4f %+11.4f %+11.4f %+8.3f', ... mpciter, u(1), u(2), x(1), x(2), t_Elapsed); fst_output_data = [output_data; [mpciter, u(1), u(2), x(1), x(2), t_Elapsed]]; else fprintf(' %3d |%+11.4f %+11.4f %+11.4f %+11.4f %+11.4f %+11.4f', ... mpciter, u(1), u(2), u(3), x(1), x(2), x(3)); snd_output_data = [output_data; [mpciter, u(1), u(2), u(3), x(1), x(2), x(3)]]; end end
/- Copyright (c) 2018 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison, Johannes Hölzl, Reid Barton, Sean Leather -/ import tactic.pi_instances /-! # Bundled types `bundled c` provides a uniform structure for bundling a type equipped with a type class. We provide `category` instances for these in `category_theory/unbundled_hom.lean` (for categories with unbundled homs, e.g. topological spaces) and in `category_theory/bundled_hom.lean` (for categories with bundled homs, e.g. monoids). -/ universes u v namespace category_theory variables {c d : Type u → Type v} {α : Type u} /-- `bundled` is a type bundled with a type class instance for that type. Only the type class is exposed as a parameter. -/ @[nolint has_inhabited_instance] structure bundled (c : Type u → Type v) : Type (max (u+1) v) := (α : Type u) (str : c α . tactic.apply_instance) namespace bundled /-- A generic function for lifting a type equipped with an instance to a bundled object. -/ -- Usually explicit instances will provide their own version of this, e.g. `Mon.of` and `Top.of`. def of {c : Type u → Type v} (α : Type u) [str : c α] : bundled c := ⟨α, str⟩ instance : has_coe_to_sort (bundled c) (Type u) := ⟨bundled.α⟩ @[simp] lemma coe_mk (α) (str) : (@bundled.mk c α str : Type u) = α := rfl /- `bundled.map` is reducible so that, if we define a category def Ring : Type (u+1) := induced_category SemiRing (bundled.map @ring.to_semiring) instance search is able to "see" that a morphism R ⟶ S in Ring is really a (semi)ring homomorphism from R.α to S.α, and not merely from `(bundled.map @ring.to_semiring R).α` to `(bundled.map @ring.to_semiring S).α`. -/ /-- Map over the bundled structure -/ @[reducible] def map (f : Π {α}, c α → d α) (b : bundled c) : bundled d := ⟨b, f b.str⟩ end bundled end category_theory
If $a$ is a real number, then $a \leq \sup(S)$ if and only if $a \leq s$ for all $s \in S$.
\subsection{Test 1} \begin{enumerate} \item Consider two intersecting lines $\vec{r_1}(t) = \langle 2, 3, 4t \rangle$ and $\vec{r_2}(t) = \langle 2+t, 3+2t, 0 \rangle$. Give the direction vector of each line. Find the equation of the plane which contains both lines. Draw a diagram of the lines, the plane, and the relevant vectors.\\ \indent The direction vector of a line is the derivative of the position vector. \begin{itemize} \item Direction 1: $\langle 0, 0, 4 \rangle$ \item Direction 2: $\langle 1, 2, 0 \rangle$ \end{itemize} A the normal vector of the plane is the cross product of the direction vectors. \begin{itemize} \item $\vec{n} = \langle 0, 0, 4 \rangle \times \langle 1, 2, 0 \rangle = \langle -8, 4, 0 \rangle$ \end{itemize} The lines intersect when $t = 0$ at $(2,3,0)$. So, the plane equation is: $\langle -8, 4, 0 \rangle \cdot \langle x-2, y-3, z \rangle = 0$ \begin{figure}[h] \centering \includegraphics[scale=.5]{Images/additionalMaterials/test1_plane} \end{figure} \item Given the VVF $\vec{r}(t)\langle 10t, 7\cos{t}, 7\sin{t} \rangle$... \begin{enumerate}[label=\alph*.] \item Compute the unit tangent vector $\hat{T}(t)$ and the unit normal vector $\hat{N}(t)$. \begin{equation*} \hat{T} = \frac{\vec{r^\prime}(t)}{\norm{\vec{r^\prime}(t)}} \end{equation*} \begin{equation*} \vec{r^\prime}(t) = \langle 10, -7\sin{t}, 7\cos{t} \rangle \end{equation*} \begin{equation*} \norm{\vec{r^\prime}(t)} = \sqrt{10^2 + (-7\sin{t})^2 + (7\cos{t})^2} = \sqrt{149} \end{equation*} \begin{equation*} \hat{T}(t) = \frac{1}{\sqrt{149}}\langle 10, -7\sin{t}, 7\cos{t} \rangle \end{equation*} \begin{equation*} \hat{N}(t) = \frac{\mathrm{d}\hat{T}/\mathrm{d}t}{\norm{\mathrm{d}\hat{T}/\mathrm{d}t}} \end{equation*} \begin{equation*} \frac{\mathrm{d}\hat{T}}{\mathrm{d}t} = \frac{1}{\sqrt{149}} \langle 0, -7\cos{t}, -7\sin{t} \rangle \end{equation*} \begin{equation*} \norm{\frac{\mathrm{d}\hat{T}}{\mathrm{d}t}} = \frac{1}{\sqrt{149}}\sqrt{(-7\cos{t})^2 + (-7\sin{t})^2} = \frac{7}{\sqrt{149}} \end{equation*} \begin{equation*} \hat{N}(t) = \langle 0, -\cos{t},-\sin{t}\rangle \end{equation*} \item Show that $\hat{T}\perp\hat{N}$ for all $t$.\\ If $\hat{T}\perp\hat{N}$, then $\hat{T}\cdot\hat{N} = 0$ for all $t$.\\ \begin{align*} \hat{T} \cdot \hat{N} &= \frac{1}{\sqrt{149}}\langle 10, -7\sin{t}, 7\cos{t} \rangle \cdot \langle 0, -\cos{t}, -\sin{t}\rangle \\ &= \frac{1}{\sqrt{149}}(0 + 7\sin{t}\cos{t} - 7\sin{t}\cos{t}) = 0 \\ &\implies \hat{T}\perp\hat{N} \end{align*} \end{enumerate} \item A cannon fires cannonballs with a speed of $20 \text{ m} / \text{s}$. Take acceleration due to gravity to be $g = 10 \text{m} / \text{s}^2$. \begin{enumerate}[label=\alph*.] \item Starting with a constant acceleration function $\vec{a} = \langle 0, -g \rangle$, find the velocity and position functions ($\vec{r^\prime}(t) \text{ and } \vec{r}(t)$ respectively) of the cannonball if the cannon is fired from an angle $\theta$ with respect to the horizontal. Assume the cannonball is initially positioned at the origin.\\ We know that velocity is the integral of acceleration. \begin{equation*} \vec{v}(t) = \vec{r^\prime}(t) = \langle c_1, c_2-gt \rangle \end{equation*} We are given that the initial speed is $20 \text{ m} / \text{s}$ at an angle $\theta$. \begin{equation*} \vec{v_0} = 20\langle \cos{\theta}, \sin{\theta} \rangle \end{equation*} \begin{equation*} \vec{v}(t) = \langle 20\cos{\theta}, 20\sin{\theta}-gt \rangle \end{equation*} We know that position is the integral of velocity. \begin{equation*} \vec{r}(t) = \langle 20t\cos{\theta} + c_1, 20t\sin{\theta} - \frac{1}{2}gt^2 + c_2 \rangle \end{equation*} We are given that the cannonball starts at the origin. \begin{equation*} \vec{r}(t) = \langle 20t\cos{\theta}, 20t\sin{\theta} - \frac{1}{2}gt^2 \rangle \end{equation*} Taking $g = 10 \text{m} / \text{s}^2$,\\ \begin{equation*} \vec{r}(t) = \langle 20t\cos{\theta}, 20t\sin{\theta}-5t^2 \rangle \end{equation*} \item What angle $\theta$ should the cannon be fired to hit a target on the ground at a distance $40\text{ m}$ away?\\ We want to find a point on the trajectory where $y = 0$ and $x = 40$. $y = 0$ when $t = 0, 4\sin{\theta}$. We can reasonably eliminate $t = 0$ because this is when the cannon first fires and $x = 0$.\\ Plugging in $t = 4\sin{\theta}$ to the x-component of position when $x = 40$, \begin{align*} 20\cos{\theta} \cdot 4\sin{\theta} &= 40 \\ 2\sin{\theta}\cos{\theta} &= 1 \\ \sin{(2\theta)}=1, 2\theta &= \pi/2 \\ \implies \theta &= \pi/4 \end{align*} \end{enumerate} \item Consider the following particle trajectory: $\vec{r}(t) = \langle R\cos{e^t}, R\sin{e^t}, \frac{h}{2\pi}e^t \rangle$ for $t \geq 0$. The shape of the trajectory is a helix with radius $R$ and vertical spacing $h$. Find the arc length function $s(t)$ of the trajectory starting with $s(0) = 0$. Give the arc length reparameterization of the helix. \begin{align*} s(t) &= \int_{0}^{t}{\norm{\vec{r^\prime}(\tau)}\mathrm{d}\tau}\\ \vec{r^\prime}(t) &= \langle -Re^{t}\sin{e^t}, Re^{t}\cos{e^t}, \frac{h}{2\pi}e^{t} \rangle \end{align*} \begin{align*} \norm{\vec{r^\prime}(t)} &= \sqrt{(-Re^{t}\sin{e^t})^2 + (Re^{t}\cos{e^t})^2 + (\frac{h}{2\pi}e^t)^2} \\ &= e^{t}\sqrt{R^2 + \frac{h^2}{4\pi^2}} \end{align*} \begin{equation*} s(t) = \int_{0}^{t}{e^{\tau}\sqrt{R^2 + \frac{h^2}{4\pi^2}}\mathrm{d}\tau} = \sqrt{R^2 + \frac{h^2}{4\pi^2}(e^{t} - 1)} \end{equation*} Solving for $t$, \begin{equation*} t = \ln{\left(\frac{s}{\sqrt{R^2 + \frac{h^2}{4\pi^2}}} + 1\right)} \end{equation*} \begin{equation*} \vec{r}(s) = \left< R\cos{\left(\frac{s}{\sqrt{R^2 + \frac{h^2}{4\pi^2}}} + 1\right)}, R\sin{\left(\frac{s}{\sqrt{R^2 + \frac{h^2}{4\pi^2}}} + 1\right)}, \frac{h}{2\pi}\left(\frac{s}{\sqrt{R^2 +\frac{h^2}{4\pi^2}}} + 1\right) \right> \end{equation*} \item Let $\vec{r}(t)$ be the position function of a particle trapped on the surface of a sphere centered at the origin. Show that $\vec{r}(t)\perp\frac{\mathrm{d}}{\mathrm{d}t}\vec{r}(t)$ for all $t$.\\ Since $\vec{r}(t)$ is on a sphere, $\norm{\vec{r}(t)} = R$ and $\vec{r}(t) \cdot \vec{r}(t) = R^2$. \begin{equation*} \frac{\mathrm{d}}{\mathrm{d}t}(\vec{r}(t) \cdot \vec{r}(t)) = 2\vec{r}(t) \cdot \vec{r^\prime}(t) \end{equation*} \begin{equation*} \frac{\mathrm{d}}{\mathrm{d}t}(\vec{r}(t) \cdot \vec{r}(t)) = \frac{\mathrm{d}}{\mathrm{d}t}R^2 = 0 \end{equation*} So, \begin{equation*} 2\vec{r}(t) \cdot \vec{r^\prime}(t) = 0 \end{equation*} and \begin{equation*} \vec{r}(t) \cdot \vec{r^\prime}(t) = 0 \end{equation*} \begin{equation*} \implies \vec{r}(t)\perp\vec{r^\prime}(t) \end{equation*} \end{enumerate}
% clear; close all; clc; function ani_slider fs = 200; t = 0:1/fs:5-1/fs; f = 1; x = sin(2*pi*1*t); figure; set(gcf,'position',[500 500 640 480]); figsize = get(gcf,'position'); h = plot(t,x); SliderH = uicontrol('style','slider','position',[70 6 512 20],'min',1,'max',5,'value',1,'callback',@cbfcn); function cbfcn(src, event) f = SliderH.Value ; x = sin(2*pi*f*t); h = plot(t,x); end end
# EM EM algorithm applies to a large faimily of estimation problems with latent variables, e.g GMM. Suppose we have a training set $\{x^{(1)},...,x^{(n)}\}$ with $z$ being the latent variable, by marginal probabilities: $$p(x;\theta) = \sum_{z}p(x, z; \theta)$$ We wish to fit the parameters $\theta$ by maximizing the log-likelihood of the data: $$ \begin{equation} \begin{split} l(\theta) =& \sum_{i=1}^{n}\log{p(x^{(i)};\theta)} \\ =& \sum_{i=1}^{n}\log\sum_{z^{(i)}}p(x^{(i)}, z^{(i)}; \theta) \end{split} \end{equation} $$ Maximizing $l(\theta)$ directly might be difficult. Our strategy will be to instead repeatedly construct a lower-bound on $l$ (E-step), and then optimize that lower-bound (M-step). ## Lower Bound Let $Q$ be a distribution over $z$, then: $$ \begin{equation} \begin{split} \log{p(x;\theta)} =& \log\sum_{z}p(x,z;\theta)\\ =& \log\sum_{z}Q(z)\frac{p(x,z;\theta)}{Q(z)}\\ \ge& \sum_{z}Q(z)\log{\frac{p(x,z;\theta)}{Q(z)}}\quad\mbox{(log is concave)} \end{split} \end{equation} $$ We call this bound the *evidence lower bound(ELBO)* and denote it by: $$\mbox{ELBO}(x;Q,\theta) = \sum_{z}Q(z)\log\frac{p(x,z;\theta)}{Q(z)}$$ To hold with equality, it is sufficient that: $$\frac{p(x,z;\theta)}{Q(z)} = c$$ which is equivalent to: $$Q(z) = p(z|x;\theta)$$ ## The EM Algorithm Taking all instances into account, for any distributions $Q_{1},...,Q_{n}$: $$ \begin{equation} \begin{split} l(\theta) \ge& \sum_{i}\mbox{ELBO}(x^{(i)};Q_{i},\theta)\\ =& \sum_{i}\sum_{z^{(i)}}Q_{i}(z^{(i)})\log\frac{p(x^{(i)},z^{(i)};\theta)}{Q_{i}(z^{(i)})} \end{split} \end{equation} $$ equality holds when $Q_{i}$ equal to the posterior distribution in this setting of $\theta$: $$\mbox{E-step:}\quad{Q_{i}{(z^{(i)})}} = p(z^{(i)}|x^{(i)};\theta)$$ M-step maximize the lower bound with respect to $\theta$ while keeping $Q_{i}$ fixed. $$ \theta := \underset{\theta}{\mbox{argmax}}\sum_{i}\mbox{ELBO}(x^{(i)};Q_{i},\theta) $$ EM algorithm ensures $l(\theta^{(t)}) \le l(\theta^{(t+1)})$, thus ensures convergence. ```python ```
# Numerical Computing in Python (c) 2019 [Steve Phelps](mailto:[email protected]) ## Overview - Floating-point representation - Arrays and Matrices with `numpy` - Basic plotting with `matplotlib` - Pseudo-random variates with `numpy.random` ## Representing continuous values - Digital computers are inherently *discrete*. - Real numbers $x \in R$ cannot always be represented exactly in a digital computer. - They are stored in a format called *floating-point*. - [IEEE Standard 754](http://steve.hollasch.net/cgindex/coding/ieeefloat.html) specifies a universal format across different implementations. - As always there are deviations from the standard. - There are two standard sizes of floating-point numbers: 32-bit and 64-bit. - 64-bit numbers are called *double precision*, are sometimes called *double* values. - IEEE floating-point calculations are performed in *hardware* on modern computers. - How can we represent aribitrary real values using only 32 bits? ## Fixed-point verses floating-point - One way we could discretise continuous values is to represent them as two integers $x$ and $y$. - The final value is obtained by e.g. $r = x + y \times 10^{-5}$. - So the number $500.4421$ would be represented as the tuple $x = 500$, $y = 44210$. - The exponent $5$ is fixed for all computations. - This number represents the *precision* with which we can represent real values. - It corresponds to the where we place we place the decimal *point*. - This scheme is called fixed precision. - It is useful in certain circumstances, but suffers from many problems, in particular it can only represent a very limited *range* of values. - In practice, we use variable precision, also known as *floating* point. ## Scientific Notation - Humans also use a form of floating-point representation. - In [Scientific notation](https://en.wikipedia.org/wiki/Scientific_notation), all numbers are written in the form $m \times 10^n$. - When represented in ASCII, we abbreviate this `<m>e<n>`, for example `6.72e+11` = $6.72 \times 10^{11}$. - The integer $m$ is called the *significand* or *mantissa*. - The integer $n$ is called the *exponent*. - The integer $10$ is the *base*. ## Scientific Notation in Python - Python uses Scientific notation when it displays floating-point numbers: ```python print(672000000000000000.0) ``` 6.72e+17 - Note that internally, the value is not *represented* exactly like this. - Scientific notation is a convention for writing or rendering numbers, *not* representing them digitally. ## Floating-point representation - Floating point numbers use a base of $2$ instead of $10$. - Additionally, the mantissa are exponent are stored in binary. - Therefore we represent floating-point numbers as $m \times 2 ^ e$. - The integers $m$ (mantissa) and $e$ (exponent) are stored in binary. - The mantissa uses [two's complement](https://en.wikipedia.org/wiki/Two's_complement) to represent positive and negative numbers. - One bit is reserved as the sign-bit: 1 for negative, 0 for positive values. - The mantissa is normalised, so we assume that it starts with the digit $1$ (which is not stored). ## Bias - We also need to represent signed *exponents*. - The exponent does *not* use two's complement. - Instead a *bias* value is subtracted from the stored exponent ($s$) to obtain the final value ($e$). - Double-precision values use a bias of $b = 1023$, and single-precision uses a bias value of $b = 127$. - The actual exponent is given by $e = s - b$ where $s$ is the stored exponent. - The stored exponent values $s=0$ and $s=1024$ are reserved for special values- discussed later. - The stored exponent $s$ is represented in binary *without using a sign bit*. ## Double and single precision formats The number of bits allocated to represent each integer component of a float is given below: | **Format** | **Sign** | **Exponent** | **Mantissa** | **Total** | | ------------ | -------- | -------------- | ------------ | ---------- | | **single** | 1 | 8 | 23 | 32 | **double** | 1 | 11 | 52 | 64 - By default, Python uses 64-bit precision. - We can specify alternative precision by using the [numpy numeric data types](https://docs.scipy.org/doc/numpy/user/basics.types.html). ## Loss of precision - We cannot represent every value in floating-point. - Consider single-precision (32-bit). - Let's try to represent $4,039,944,879$. ## Loss of precision - As a binary integer we write $4,039,944,879$ as: `11110000 11001100 10101010 10101111` - This already takes up 32-bits. - The mantissa only allows us to store 24-bit integers. - So we have to *round*. We store it as: `+1.1110000 11001100 10101011e+31` - Which gives us `+11110000 11001100 10101011 0000000` $= 4,039,944,960$ ## Ranges of floating-point values In single precision arithmetic, we *cannot* represent the following values: - Negative numbers less than $-(2-2^{-23}) \times 2^{127}$ - Negative numbers greater than $-2^{-149}$ - Positive numbers less than $2^{-149}$ - Positive numbers greater than $(2-2^{-23}) \times 2^{127}$ Attempting to represent these numbers results in *overflow* or *underflow*. ## Effective floating-point range | Format | Binary | Decimal | | ------ | ------ | ------- | | single | $\pm (2-2^{-23}) \times 2^{127}$ | $\approx \pm 10^{38.53}$ | | double | $\pm (2-2^{-52}) \times 2^{1023}$ | $\approx \pm 10^{308.25}$ | ```python import sys sys.float_info.max ``` 1.7976931348623157e+308 ```python sys.float_info.min ``` 2.2250738585072014e-308 ```python sys.float_info ``` sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1) ## Range versus precision - With a fixed number of bits, we have to choose between: - maximising the range of values (minimum to maximum) we can represent, - maximising the precision with-which we can represent each indivdual value. - These are conflicting objectives: - we can increase range, but only by losing precision, - we can increase precision, but only by decreasing range. - Floating-point addresses this dilemma by allowing the precision to *vary* ("float") according to the magnitude of the number we are trying to represent. ## Floating-point density - Floating-point numbers are unevenly-spaced over the line of real-numbers. - The precision *decreases* as we increase the magnitude. ## Representing Zero - Zero cannot be represented straightforwardly because we assume that all mantissa values start with the digit 1. - Zero is stored as a special-case, by setting mantissa *and* exponent both to zero. - The sign-bit can either be set or unset, so there are distinct positive and negative representations of zero. ## Zero in Python ```python x = +0.0 x ``` 0.0 ```python y = -0.0 y ``` -0.0 - However, these are considered equal: ```python x == y ``` True ## Infinity - Positive overflow results in a special value of infinity (in Python `inf`). - This is stored with an exponent consiting of all 1s, and a mantissa of all 0s. - The sign-bit allows us to differentiate between negative and positive overflow: $-\infty$ and $+\infty$. - This allows us to carry on calculating past an overflow event. ## Infinity in Python ```python x = 1e300 * 1e100 x ``` inf ```python x = x + 1 x ``` inf ## Negative infinity in Python ```python x > 0 ``` True ```python y = -x y ``` -inf ```python y < x ``` True ## Not A Number (NaN) - Some mathematical operations on real numbers do not map onto real numbers. - These results are represented using the special value to `NaN` which represents "not a (real) number". - `NaN` is represented by an exponent of all 1s, and a non-zero mantissa. ## `NaN` in Python ```python from numpy import sqrt, inf, isnan, nan x = sqrt(-1) x ``` /home/sphelps/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:2: RuntimeWarning: invalid value encountered in sqrt nan ```python y = inf - inf y ``` nan ## Comparing `nan` values in Python - Beware of comparing `nan` values ```python x == y ``` False - To test whether a value is `nan` use the `isnan` function: ```python isnan(x) ``` True ## `NaN` is not the same as `None` - `None` represents a *missing* value. - `NaN` represents an *invalid* floating-point value. - These are fundamentally different entities: ```python nan is None ``` False ```python isnan(None) ``` ## Beware finite precision ```python x = 0.1 + 0.2 ``` ```python x == 0.3 ``` False ```python x ``` 0.30000000000000004 ## Relative and absolute error - Consider a floating point number $x_{fp}$ which represents a real number $x \in \mathbf{R}$. - In general, we cannot precisely represent the real number; that is $x_{fp} \neq x$. - The absolute error $r$ is $r = x - x_{fp}$. - The relative error $R$ is: \begin{equation} R = \frac{x - x_{fp}}{x} \end{equation} ## Numerical Methods - In e.g. simulation models or quantiative analysis we typically repeatedly update numerical values inside long loops. - Programs such as these implement *numerical algorithms*. - It is very easy to introduce bugs into code like this. ## Numerical stability - The round-off error associated with a result can be compounded in a loop. - If the error increases as we go round the loop, we say the algorithm is numerically *unstable*. - Mathematicians design numerically stable algorithms using [numerical analysis](https://en.wikipedia.org/wiki/Numerical_analysis). ## Catastrophic Cancellation - Suppose we have two real values $x$, and $y = x + \epsilon$. - $\epsilon$ is very small and $x$ is very large. - $x$ has an _exact_ floating point representation - However, because of lack of precision $x$ and $y$ have the same floating point representation. - i.e. they are represented as the same sequence of 64-bits - Consider wheat happens when we compute $y - x$ in floating-point. ## Catestrophic Cancellation and Relative Error - Catestrophic cancellation results in very large relative error. - If we calculate $y - x$ in floating-point we will obtain the result 0. - The correct value is $(x + \epsilon) - x = \epsilon$. - The relative error is \begin{equation} \frac {\epsilon - 0} {\epsilon} = 1 \end{equation} - That is, the relative error is $100\%$. - This can result in [catastrophy](http://www-users.math.umn.edu/~arnold/disasters/). ## Catastrophic Cancellation in Python ```python x = 3.141592653589793 x ``` 3.141592653589793 ```python y = 6.022e23 x = (x + y) - y ``` ```python x ``` 0.0 ### Cancellation versus addition - Addition, on the other hand, is not catestrophic. ```python z = x + y z ``` 6.022e+23 - The above result is still inaccurate with an absolute error $r \approx \pi$. - However, let's examine the *relative* error: \begin{equation} R = \frac {1.2044 \times 10^{24} - (1.2044 \times 10^{24} + \pi)} {1.2044 \times 10^{24} + \pi} \\ \approx 10^{-24} \end{equation} - Here we see that that the relative error from the addition is miniscule compared with the cancellation. ### Floating-point arithemetic is nearly always inaccurate. - You can hardly-ever eliminate absolute rounding error when using floating-point. - The best we can do is to take steps to minimise error, and prevent it from increasing as your calculation progresses. - Cancellation can be *catastrophic*, because it can greatly increase the *relative* error in your calculation. ## Use a well-tested library for numerical algorithms. - Avoid subtracting two nearly-equal numbers. - Especially in a loop! - Better-yet use a well-validated existing implementation in the form of a numerical library. ## Importing numpy - Functions for numerical computiing are provided by a separate _module_ called [`numpy`](http://www.numpy.org/). - Before we use the numpy module we must import it. - By convention, we import `numpy` using the alias `np`. - Once we have done this we can prefix the functions in the numpy library using the prefix `np.` ```python import numpy as np ``` - We can now use the functions defined in this package by prefixing them with `np`. ## Arrays - Arrays represent a collection of values. - In contrast to lists: - arrays typically have a *fixed length* - they can be resized, but this involves an expensive copying process. - and all values in the array are of the *same type*. - typically we store floating-point values. - Like lists: - arrays are *mutable*; - we can change the elements of an existing array. ## Arrays in `numpy` - Arrays are provided by the `numpy` module. - The function `array()` creates an array given a list. ```python import numpy as np x = np.array([0, 1, 2, 3, 4]) x ``` array([0, 1, 2, 3, 4]) ## Array indexing - We can index an array just like a list ```python x[4] ``` 4 ```python x[4] = 2 x ``` array([0, 1, 2, 3, 2]) ## Arrays are not lists - Although this looks a bit like a list of numbers, it is a fundamentally different type of value: ```python type(x) ``` numpy.ndarray - For example, we cannot append to the array: ```python x.append(5) ``` ## Populating Arrays - To populate an array with a range of values we use the `np.arange()` function: ```python x = np.arange(0, 10) print(x) ``` [0 1 2 3 4 5 6 7 8 9] - We can also use floating point increments. ```python x = np.arange(0, 1, 0.1) print(x) ``` [0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9] ## Functions over arrays - When we use arithmetic operators on arrays, we create a new array with the result of applying the operator to each element. ```python y = x * 2 y ``` array([0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8]) - The same goes for numerical functions: ```python x = np.array([-1, 2, 3, -4]) y = abs(x) y ``` array([1, 2, 3, 4]) ## Vectorized functions - Note that not every function automatically works with arrays. - Functions that have been written to work with arrays of numbers are called *vectorized* functions. - Most of the functions in `numpy` are already vectorized. - You can create a vectorized version of any other function using the higher-order function `numpy.vectorize()`. ## `vectorize` example ```python def myfunc(x): if x >= 0.5: return x else: return 0.0 fv = np.vectorize(myfunc) ``` ```python x = np.arange(0, 1, 0.1) x ``` array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) ```python fv(x) ``` array([0. , 0. , 0. , 0. , 0. , 0.5, 0.6, 0.7, 0.8, 0.9]) ## Testing for equality - Because of finite precision we need to take great care when comparing floating-point values. - The numpy function [`allclose()`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.allclose.html) can be used to test equality of floating-point numbers within a relative tolerance. - It is a vectorized function so it will work with arrays as well as single floating-point values. ```python x = 0.1 + 0.2 y = 0.3 x == y ``` False ```python np.allclose(x, y) ``` True ## Plotting with `matplotlib` - We will use a module called `matplotlib` to plot some simple graphs. - This module has a nested module called `pyplot`. - By convention we import this with the alias `plt`. - This module provides functions which are very similar to [MATLAB plotting commands](http://uk.mathworks.com/help/matlab/ref/plot.html). ```python import matplotlib.pyplot as plt ``` ### A simple linear plot ```python x = np.arange(0, 1, 0.1) y = x*2 + 5 plt.plot(x, y) plt.xlabel('$x$') plt.ylabel('$y = 2x + 5$') plt.title('Linear plot') plt.show() ``` ### Plotting a sine curve ```python from numpy import pi, sin x = np.arange(0, 2*pi, 0.01) y = sin(x) plt.plot(x, y) plt.xlabel('x') plt.ylabel('sin(x)') plt.show() ``` ## Multi-dimensional data - Numpy arrays can hold multi-dimensional data. - To create a multi-dimensional array, we can pass a list of lists to the `array()` function: ```python import numpy as np x = np.array([[1,2], [3,4]]) x ``` array([[1, 2], [3, 4]]) ### Arrays containing arrays - A multi-dimensional array is an array of an arrays. - The outer array holds the rows. - Each row is itself an array: ```python x[0] ``` array([1, 2]) ```python x[1] ``` array([3, 4]) - So the element in the second row, and first column is: ```python x[1][0] ``` 3 ### Matrices - We can create a matrix from a multi-dimensional array. ```python M = np.matrix(x) M ``` matrix([[1, 2], [3, 4]]) ### Plotting multi-dimensional with matrices - If we supply a matrix to `plot()` then it will plot the y-values taken from the *columns* of the matrix (notice the transpose in the example below). ```python from numpy import pi, sin, cos x = np.arange(0, 2*pi, 0.01) y = sin(x) ax = plt.plot(x, np.matrix([sin(x), cos(x)]).T) plt.show() ``` ### Performance - When we use `numpy` matrices in Python the corresponding functions are linked with libraries written in C and FORTRAN. - For example, see the [BLAS (Basic Linear Algebra Subprograms) library](http://www.netlib.org/blas/). - These libraries are very fast. - Vectorised code can be more easily ported to frameworks like [TensorFlow](https://www.tensorflow.org/) so that operations are performed in parallel using GPU hardware. ### Matrix Operators - Once we have a matrix, we can perform matrix computations. - To compute the [transpose](http://mathworld.wolfram.com/MatrixTranspose.html) and [inverse](http://mathworld.wolfram.com/MatrixInverse.html) use the `T` and `I` attributes: To compute the transpose $M^{T}$ ```python M.T ``` matrix([[1, 3], [2, 4]]) To compute the inverse $M^{-1}$ ```python M.I ``` matrix([[-2. , 1. ], [ 1.5, -0.5]]) ### Matrix Dimensions - The total number of elements, and the dimensions of the array: ```python M.size ``` 4 ```python M.shape ``` (2, 2) ```python len(M.shape) ``` 2 ### Creating Matrices from strings - We can also create arrays directly from strings, which saves some typing: ```python I2 = np.matrix('2 0; 0 2') I2 ``` matrix([[2, 0], [0, 2]]) - The semicolon starts a new row. ### Matrix Multiplication Now that we have two matrices, we can perform [matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication): ```python M * I2 ``` matrix([[2, 4], [6, 8]]) ### Matrix Indexing - We can [index and slice matrices](http://docs.scipy.org/doc/numpy/user/basics.indexing.html) using the same syntax as lists. ```python M[:,1] ``` matrix([[2], [4]]) ### Slices are references - If we use this is an assignment, we create a *reference* to the sliced elements, *not* a copy. ```python V = M[:,1] # This does not make a copy of the elements! V ``` matrix([[2], [4]]) ```python M[0,1] = -2 V ``` matrix([[-2], [ 4]]) ### Copying matrices and vectors - To copy a matrix, or a slice of its elements, use the function `np.copy()`: ```python M = np.matrix('1 2; 3 4') V = np.copy(M[:,1]) # This does copy the elements. V ``` array([[2], [4]]) ```python M[0,1] = -2 V ``` array([[2], [4]]) ## Sums One way we _could_ sum a vector or matrix is to use a `for` loop. ```python vector = np.arange(0.0, 100.0, 10.0) vector ``` array([ 0., 10., 20., 30., 40., 50., 60., 70., 80., 90.]) ```python result = 0.0 for x in vector: result = result + x result ``` 450.0 - This is not the most _efficient_ way to compute a sum. ## Efficient sums - Instead of using a `for` loop, we can use a numpy function `sum()`. - This function is written in the C language, and is very fast. ```python vector = np.array([0, 1, 2, 3, 4]) print(np.sum(vector)) ``` 10 ## Summing rows and columns - When dealing with multi-dimensional data, the 'sum()' function has a named-argument `axis` which allows us to specify whether to sum along, each rows or columns. ```python matrix = np.matrix('1 2 3; 4 5 6; 7 8 9') print(matrix) ``` [[1 2 3] [4 5 6] [7 8 9]] ### To sum along rows: ```python np.sum(matrix, axis=0) ``` matrix([[12, 15, 18]]) ### To sum along columns: ```python np.sum(matrix, axis=1) ``` matrix([[ 6], [15], [24]]) ## Cumulative sums - Suppose we want to compute $y_n = \sum_{i=1}^{n} x_i$ where $\vec{x}$ is a vector. ```python import numpy as np x = np.array([0, 1, 2, 3, 4]) y = np.cumsum(x) print(y) ``` [ 0 1 3 6 10] ## Cumulative sums along rows and columns ```python x = np.matrix('1 2 3; 4 5 6; 7 8 9') print(x) ``` [[1 2 3] [4 5 6] [7 8 9]] ```python y = np.cumsum(x) np.cumsum(x, axis=0) ``` matrix([[ 1, 2, 3], [ 5, 7, 9], [12, 15, 18]]) ```python np.cumsum(x, axis=1) ``` matrix([[ 1, 3, 6], [ 4, 9, 15], [ 7, 15, 24]]) ## Cumulative products - Similarly we can compute $y_n = \Pi_{i=1}^{n} x_i$ using `cumprod()`: ```python import numpy as np x = np.array([1, 2, 3, 4, 5]) np.cumprod(x) ``` array([ 1, 2, 6, 24, 120]) - We can compute cummulative products along rows and columns using the `axis` parameter, just as with the `cumsum()` example. ## Generating (pseudo) random numbers - The nested module `numpy.random` contains functions for generating random numbers from different probability distributions. ```python from numpy.random import normal, uniform, exponential, randint ``` - Suppose that we have a random variable $\epsilon \sim N(0, 1)$. - In Python we can draw from this distribution like so: ```python epsilon = normal() epsilon ``` 0.1465312427787133 - If we execute another call to the function, we will make a _new_ draw from the distribution: ```python epsilon = normal() epsilon ``` -2.3135050810408773 ## Pseudo-random numbers - Strictly speaking, these are not random numbers. - They rely on an initial state value called the *seed*. - If we know the seed, then we can predict with total accuracy the rest of the sequence, given any "random" number. - Nevertheless, statistically they behave like independently and identically-distributed values. - Statistical tests for correlation and auto-correlation give insignificant results. - For this reason they called *pseudo*-random numbers. - The algorithms for generating them are called Pseudo-Random Number Generators (PRNGs). - Some applications, such as cryptography, require genuinely unpredictable sequences. - never use a standard PRNG for these applications! ## Managing seed values - In some applications we need to reliably reproduce the same sequence of pseudo-random numbers that were used. - We can specify the seed value at the beginning of execution to achieve this. - Use the function `seed()` in the `numpy.random` module. ## Setting the seed ```python from numpy.random import seed seed(5) ``` ```python normal() ``` 0.44122748688504143 ```python normal() ``` -0.33087015189408764 ```python seed(5) ``` ```python normal() ``` 0.44122748688504143 ```python normal() ``` -0.33087015189408764 ## Drawing multiple variates - To generate more than number, we can specify the `size` parameter: ```python normal(size=10) ``` array([ 2.43077119, -0.25209213, 0.10960984, 1.58248112, -0.9092324 , -0.59163666, 0.18760323, -0.32986996, -1.19276461, -0.20487651]) - If you are generating very many variates, this will be *much* faster than using a for loop - We can also specify more than one dimension: ```python normal(size=(5,5)) ``` array([[-0.35882895, 0.6034716 , -1.66478853, -0.70017904, 1.15139101], [ 1.85733101, -1.51117956, 0.64484751, -0.98060789, -0.85685315], [-0.87187918, -0.42250793, 0.99643983, 0.71242127, 0.05914424], [-0.36331088, 0.00328884, -0.10593044, 0.79305332, -0.63157163], [-0.00619491, -0.10106761, -0.05230815, 0.24921766, 0.19766009]]) ## Histograms - We can plot a histograms of randomly-distributed data using the `hist()` function from matplotlib: ```python import matplotlib.pyplot as plt data = normal(size=10000) ax = plt.hist(data) plt.title('Histogram of normally distributed data ($n=10^5$)') plt.show() ``` ## Computing histograms as matrices - The function `histogram()` in the `numpy` module will count frequencies into bins and return the result as a 2-dimensional array. ```python import numpy as np np.histogram(data) ``` (array([ 23, 136, 618, 1597, 2626, 2635, 1620, 599, 130, 16]), array([-3.59780883, -2.87679609, -2.15578336, -1.43477063, -0.71375789, 0.00725484, 0.72826758, 1.44928031, 2.17029304, 2.89130578, 3.61231851])) ## Descriptive statistics - We can compute the descriptive statistics of a sample of values using the numpy functions `mean()` and `var()` to compute the sample mean $\bar{X}$ and sample [variance](https://en.wikipedia.org/wiki/Variance) $\sigma_{X}^2$ . ```python np.mean(data) ``` -0.00045461080333497925 ```python np.var(data) ``` 1.0016048722546331 - These functions also have an `axis` parameter to compute mean and variances of columns or rows of a multi-dimensional data-set. ## Descriptive statistics with `nan` values - If the data contains `nan` values, then the descriptive statistics will also be `nan`. ```python from numpy import nan import numpy as np data = np.array([1, 2, 3, 4, nan]) np.mean(data) ``` nan - To omit `nan` values from the calculation, use the functions `nanmean()` and `nanvar()`: ```python np.nanmean(data) ``` 2.5 ## Discrete random numbers - The `randint()` function in `numpy.random` can be used to draw from a uniform discrete probability distribution. - It takes two parameters: the low value (inclusive), and the high value (exclusive). - So to simulate one roll of a die, we would use the following Python code. ```python die_roll = randint(0, 6) + 1 die_roll ``` 4 - Just as with the `normal()` function, we can generate an entire sequence of values. - To simulate a [Bernoulli process](https://en.wikipedia.org/wiki/Bernoulli_process) with $n=20$ trials: ```python bernoulli_trials = randint(0, 2, size = 20) bernoulli_trials ``` array([1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0]) __Acknowledgements__ The early sections of this notebook were adapted from an online article by [Steve Hollasch](https://steve.hollasch.net/cgindex/coding/ieeefloat.html).
\section{Dimensionality reduction}
## Chapter 4 - Training Models ### Logistic Regression Logistic regression / Logit regression is commonly used to estimate the probability that an instance belongs to a particular class. If the estimated probability is greater than 50%, then the model predicts that the instance belongs to that class. Otherwise it belongs to the complement class. This makes logistic regression a binary classifier. The central problem is to model the relationship with a probability of an event occuring: $p(\mathbf x) = \Pr (y=1|\mathbf x)$ from the predictors $\mathbf x$. If we use the linear model $$p(\mathbf x) = \beta_0 + \beta_1 x_1$$ then we could get values of the probability, $\Pr(\cdot)$ that is outside $[0,1]$. Hence, we transform the linear model to the logistic model: $$p(\mathbf x) = \frac{\exp(\beta_0 + \beta_1 x_1)}{1+\exp(\beta_0 + \beta_1 x_1)} = \frac{1}{1+\exp[-(\beta_0 + \beta_1 x_1)]}$$ from there, after the evaluation of the RHS, we obtain the result: $$y = \begin{cases}1 \text{ if } \hat{p}(\mathbf x)\geq0.5\\0 \text{ if } \hat{p}(\mathbf x)<0.5\end{cases}$$ Note that $0.5$ is an arbitrary threshold. It can be shifted up and down in the range $(0,1)$. After manipulation of the logit model, we find: $$\frac{p(\mathbf x)}{1-p(\mathbf x)} = \exp(\beta_0 + \beta_1 x_1)$$ where the LHS is the <b>odds</b> and can take on any value between $0$ and $\infty$. If the odds are close to zero then there is a low probability of $y=1$. If the odds are very large then there $\Pr(y=1)$ is high. By taking log on both sides, we obtain $$\log \frac{p(\mathbf x)}{1-p(\mathbf x)} = \beta_0 + \beta_1 x_1$$ and so we say the logistic regression model has a <b>logit</b> or <b>log-odds</b> that is linear in $\mathbf x$. In a logistic regression model, increasing $x_1$ by 1 unit changes the log odds by $\beta_1$. However, because the relationship between $p$ and $\mathbf x$ is not linear, a one unit increase in $x_1$ does not correspond to a $\beta_1$ change in $p$. The amount that $p$ changes due to a one unit change in $x_1$ will depend on the current value of $\mathbf x$. #### Estimation using Maximum Likelihood In order to obtain the estimates $\hat{\beta_0}$ and $\hat{\beta_1}$, we use maximum likelihood estimation. The intuition is to fit a model - seeking coefficient estimates such that the predicted probability of each observation in the training set, for each type of event, is the highest. We first obtain the likelihood function of the observed data: $$L(\beta) = L(\beta_0, \beta_1) = \prod_{i=1}^n p(\mathbf x_i)^{y_i} \cdot(1-p(\mathbf x_i))^{1-y_i}$$ Observe that for each sample, the term in the product reduces to $p(\mathbf x_i)$ if $y_i=1$ and $1-p(\mathbf x_i)$ if $y_i=0$. From the likelihood function, we obtain the cost function in this problem - the log-likelihood function: $$\begin{align}J(\Theta) = l(\beta) = l(\beta_0, \beta_1) &= \sum_{i=1}^n y_i \log p(\mathbf x_i) + (1-y_i) \log (1-p(\mathbf x_i)) \\ &= \sum_{i=1}^n y_i \log p(\mathbf x_i) + \log (1-p(x_i)) - y_i \log(1-p(\mathbf x_i)) \\ &= \sum_{i=1}^n \log (1-p(\mathbf x_i)) + \sum_{i=1}^m y_i \log \frac{p(\mathbf x_i)}{1 - p(\mathbf x_i)}\\ &= \sum_{i=1}^n -\log (1+e^{\beta_0 + \beta_1x_i}) + \sum_{i=1}^m y_i ({\beta_0 + \beta_1x_i})\end{align}$$ There is no closed-form solution to the log likelihood for logistic regression so we perform gradient descent for each of the parameters to estimate. ```python import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.linear_model import LogisticRegression import statsmodels.api as sm ``` ```python df = pd.read_csv('Default.csv', index_col=0) df['y'] = df['default'].apply(lambda x: 1 if x == 'Yes' else 0) df['is_student'] = df['student'].apply(lambda x: 1 if x == 'Yes' else 0) df['income_000'] = df['income'].apply(lambda x: x/1000) ``` ```python X1 = df[['balance']].copy() train_df1 = df[['balance', 'y']].copy() X2 = df[['balance', 'income_000', 'is_student']].copy() y = df['y'].copy() ``` ```python # Logistic Regression using sklearn reg = LogisticRegression() reg.fit(X1, y) print(reg.intercept_, reg.coef_) ``` [-10.65132824] [[0.00549892]] ```python # Logistic Regression using statsmodels reg2 = sm.Logit(y, sm.add_constant(X1)) results2 = reg2.fit() Theta_hat2 = list(results2.params) print(["{:.6f}".format(t) for t in Theta_hat2]) ``` Optimization terminated successfully. Current function value: 0.079823 Iterations 10 ['-10.651331', '0.005499'] ```python print(results2.summary().tables[1]) ``` ============================================================================== coef std err z P>|z| [0.025 0.975] ------------------------------------------------------------------------------ const -10.6513 0.361 -29.491 0.000 -11.359 -9.943 balance 0.0055 0.000 24.952 0.000 0.005 0.006 ============================================================================== In this example, we see that $\hat{\beta_1}=0.0055$. This indicates that a one-unit increase in `balance` results in a 0.0055 unit increase in the log odds. An increase in balance is an associated with an increase in the probability of default. Hypothesis testing can also be applied to logistic regression. The $z$-statistic is similar in concept to the $t$-statistic in linear regression. A large value of the $z$-statistic (and correspondingly a small $p$-value) indicates evidence in the null hypothesis, where $\beta_1$ is insignificant and near zero. Since the $p$-value for `balance` is small, we reject the null in favour of the alternate hypothesis. There is indeed an association between `balance` and `default`. ```python # Prediction results2.predict([[1,1000], [1,2000]]) ``` array([0.00575215, 0.58576937]) For prediction, the probability of someone defaulting with a balance of \\$1000 is $0.00576$ which is below 1\%. This increases drastically to $59\%$ when the balance increases to \\$2000. ```python # Plotting for different alpha values lin_X = np.linspace(X1['balance'].min(),X1['balance'].max(),1000).reshape(-1,1) y_prob = results2.predict(sm.add_constant(lin_X)) y_prob1 = 1-y_prob pred_df = pd.DataFrame({'X' : lin_X.flatten(), 'y0' : y_prob, 'y1' : y_prob1}) # display(pred_df.head()) fig, ax = plt.subplots(figsize=(10, 5)) train_df1[train_df1.y==0].plot(kind='scatter', x='balance', y='y', ax=ax, color='red') train_df1[train_df1.y==1].plot(kind='scatter', x='balance', y='y', ax=ax, color='green', marker='X') pred_df.plot(kind='line', x='X', y='y0', ax=ax, color='maroon') pred_df.plot(kind='line', x='X', y='y1', ax=ax, color='green', style='--') plt.show() ``` ```python # Using dummy variables for prediction X3 = sm.add_constant(df[['is_student']].copy()) reg3 = sm.Logit(y, X3) results3 = reg3.fit() print(results3.summary2().tables[1]) ``` Optimization terminated successfully. Current function value: 0.145434 Iterations 7 Coef. Std.Err. z P>|z| [0.025 0.975] const -3.504128 0.070713 -49.554094 0.000000 -3.642723 -3.365532 is_student 0.404887 0.115019 3.520177 0.000431 0.179454 0.630320 We can use dummy variables to assess for the `is_student` variable. Also note that for this variable `is_student`, the associated $p$-value is also small, indicating it is significant. ```python results3.predict([[1,1], [1,0]]) # We can see that students have a higher probability of default compared to non-students. ``` array([0.04313859, 0.02919501]) ### Multivariate Logistic Regression Multivariate logistic regression extends the above to have more than 1 predictor: $$p(\mathbf x) = \frac{\exp(\Theta^T\mathbf x)}{1+\exp(\Theta^T\mathbf x)} = \frac{1}{1+\exp[-(\Theta^T\mathbf x)]}$$ where $\Theta = \begin{pmatrix}\beta_0, \beta_1, \cdots, \beta_p\end{pmatrix}^T$ and $\mathbf x = \begin{pmatrix}1, x_{1}, \cdots, x_{p}\end{pmatrix}^T$ Similarly, the cost function of multivariate logistic regression is: $$\begin{align}J(\Theta) = l(\Theta) &= \sum_{i=1}^n -\log (1+e^{\Theta^T\mathbf x}) + \sum_{i=1}^m y_i (\Theta^T\mathbf x)\end{align}$$ ```python # Multivar Logistic Regression using statsmodels multivarreg = sm.Logit(y, sm.add_constant(X2)) results22 = multivarreg.fit() Theta_hat21 = list(results22.params) print(["{:.6f}".format(t) for t in Theta_hat21]) ``` Optimization terminated successfully. Current function value: 0.078577 Iterations 10 ['-10.869045', '0.005737', '0.003033', '-0.646776'] ```python print(results22.summary().tables[1]) ``` ============================================================================== coef std err z P>|z| [0.025 0.975] ------------------------------------------------------------------------------ const -10.8690 0.492 -22.079 0.000 -11.834 -9.904 balance 0.0057 0.000 24.737 0.000 0.005 0.006 income_000 0.0030 0.008 0.370 0.712 -0.013 0.019 is_student -0.6468 0.236 -2.738 0.006 -1.110 -0.184 ============================================================================== In this model, we see that the $p$-value associated with `income` is very large. The coefficient for the dummy variable `is_student` is also negative, indicating students are <i>less likely</i> to default. It is likely that the variables `is_student` and `balance` are correlated. Note that logistic regression assume that the model and the output are linearly correlated. ### Softmax Regression Logistic regression can be generalised to the softmax regression. Generalising the function, given that there are now $K$ different classes, the probability that the instance is in class $k$ is: $$ \hat{p_k(\mathbf x)} = \frac{e^{\Theta^T_k \mathbf x_i}}{\sum_{j \in K} \exp{\Theta^T_j \mathbf x_i}} $$ For the cost function, use the cross entropy cost function: $$J(\Theta) = \sum_{i=1}^n\sum_{k=1}^K y_k^{(i)}\log \begin{pmatrix}\hat{p_k}^{(i)}\end{pmatrix}$$ and the gradient is: $$\nabla_{\theta_k} J(\Theta) = \frac1m \sum_{i=1}^m \begin{pmatrix}\hat{p_k}^{(i)}-\hat{y_k}^{(i)}\end{pmatrix}\mathbf x_i$$ Similarly, compute the gradient vector for each class and use Gradient Descent to find the parameter matrix $\Theta$ that minimises the cost function. ```python # Ingest iris = datasets.load_iris() Xiris = pd.DataFrame(iris['data'], columns=iris['feature_names']) display(Xiris.head()) yiris = pd.Series([1 if t else 0 for t in list(iris['target']==2) ]) display(yiris.head()) feat2 = Xiris.iloc[:,2:4] y2iris = iris['target'] ``` <div> <style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; } </style> <table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>sepal length (cm)</th> <th>sepal width (cm)</th> <th>petal length (cm)</th> <th>petal width (cm)</th> </tr> </thead> <tbody> <tr> <th>0</th> <td>5.1</td> <td>3.5</td> <td>1.4</td> <td>0.2</td> </tr> <tr> <th>1</th> <td>4.9</td> <td>3.0</td> <td>1.4</td> <td>0.2</td> </tr> <tr> <th>2</th> <td>4.7</td> <td>3.2</td> <td>1.3</td> <td>0.2</td> </tr> <tr> <th>3</th> <td>4.6</td> <td>3.1</td> <td>1.5</td> <td>0.2</td> </tr> <tr> <th>4</th> <td>5.0</td> <td>3.6</td> <td>1.4</td> <td>0.2</td> </tr> </tbody> </table> </div> 0 0 1 0 2 0 3 0 4 0 dtype: int64 ```python # Train softmax_reg = LogisticRegression(multi_class='multinomial', solver='lbfgs', C=10) softmax_reg.fit(feat2, y2iris) ``` LogisticRegression(C=10, class_weight=None, dual=False, fit_intercept=True, intercept_scaling=1, l1_ratio=None, max_iter=100, multi_class='multinomial', n_jobs=None, penalty='l2', random_state=None, solver='lbfgs', tol=0.0001, verbose=0, warm_start=False) ```python # Train using statsmodels mnlogit = sm.MNLogit(y2iris, sm.add_constant(feat2)) results3 = mnlogit.fit(maxiter=90) print(results3.summary()) ``` Warning: Maximum number of iterations has been exceeded. Current function value: 0.068545 Iterations: 90 MNLogit Regression Results ============================================================================== Dep. Variable: y No. Observations: 150 Model: MNLogit Df Residuals: 144 Method: MLE Df Model: 4 Date: Tue, 19 May 2020 Pseudo R-squ.: 0.9376 Time: 12:02:24 Log-Likelihood: -10.282 converged: False LL-Null: -164.79 Covariance Type: nonrobust LLR p-value: 1.227e-65 ===================================================================================== y=1 coef std err z P>|z| [0.025 0.975] ------------------------------------------------------------------------------------- const -74.7912 3.63e+04 -0.002 0.998 -7.12e+04 7.11e+04 petal length (cm) 28.0872 1.53e+04 0.002 0.999 -2.99e+04 3e+04 petal width (cm) 22.4123 2.17e+04 0.001 0.999 -4.25e+04 4.26e+04 ------------------------------------------------------------------------------------- y=2 coef std err z P>|z| [0.025 0.975] ------------------------------------------------------------------------------------- const -120.0636 3.63e+04 -0.003 0.997 -7.12e+04 7.1e+04 petal length (cm) 33.8417 1.53e+04 0.002 0.998 -2.99e+04 3e+04 petal width (cm) 32.8590 2.17e+04 0.002 0.999 -4.25e+04 4.26e+04 ===================================================================================== /Users/bryanlim/.pyenv/versions/3.7.2/envs/botanic/lib/python3.7/site-packages/statsmodels/base/model.py:568: ConvergenceWarning: Maximum Likelihood optimization failed to converge. Check mle_retvals "Check mle_retvals", ConvergenceWarning) ```python # Predict print(softmax_reg.predict([[5,2]])) print(softmax_reg.predict_proba([[5,2]])) ``` [2] [[6.38014896e-07 5.74929995e-02 9.42506362e-01]] ```python results3.predict([[1,5,2]]) ``` array([[1.28938767e-50, 1.22039372e-02, 9.87796063e-01]])
------------------------------------------------------------------------ -- Alpha-equivalence ------------------------------------------------------------------------ open import Atom module Alpha-equivalence (atoms : χ-atoms) where open import Equality.Propositional open import Prelude hiding (const) open import Bag-equivalence equality-with-J using (_∈_) import Nat equality-with-J as Nat open import Chi atoms open import Free-variables atoms open χ-atoms atoms private variable A : Type b₁ b₂ : Br bs₁ bs₂ : List Br c c₁ c₂ : Const e e₁ e₂ e₃ e₁₁ e₁₂ e₂₁ e₂₂ : Exp es₁ es₂ : List Exp R R₁ R₂ : A → A → Type x x₁ x₁′ x₂ x₂′ y : A xs xs₁ xs₂ : List A ------------------------------------------------------------------------ -- The definition of α-equivalence -- R [ x ∼ y ] relates x to y, and for pairs of variables x′, y′ such -- that x is distinct from x′ and y is distinct from y′ it behaves -- like R. infix 5 _[_∼_] _[_∼_] : (Var → Var → Type) → Var → Var → (Var → Var → Type) (R [ x ∼ y ]) x′ y′ = x ≡ x′ × y ≡ y′ ⊎ x ≢ x′ × y ≢ y′ × R x′ y′ -- Alpha-⋆ lifts a binary relation to lists. infixr 5 _∷_ data Alpha-⋆ (R : A → A → Type) : List A → List A → Type where [] : Alpha-⋆ R [] [] _∷_ : R x₁ x₂ → Alpha-⋆ R xs₁ xs₂ → Alpha-⋆ R (x₁ ∷ xs₁) (x₂ ∷ xs₂) -- Alpha R is α-equivalence up to R: free variables are related if -- they are related by R. mutual data Alpha (R : Var → Var → Type) : Exp → Exp → Type where apply : Alpha R e₁₁ e₁₂ → Alpha R e₂₁ e₂₂ → Alpha R (apply e₁₁ e₂₁) (apply e₁₂ e₂₂) lambda : Alpha (R [ x₁ ∼ x₂ ]) e₁ e₂ → Alpha R (lambda x₁ e₁) (lambda x₂ e₂) case : Alpha R e₁ e₂ → Alpha-⋆ (Alpha-Br R) bs₁ bs₂ → Alpha R (case e₁ bs₁) (case e₂ bs₂) rec : Alpha (R [ x₁ ∼ x₂ ]) e₁ e₂ → Alpha R (rec x₁ e₁) (rec x₂ e₂) var : R x₁ x₂ → Alpha R (var x₁) (var x₂) const : Alpha-⋆ (Alpha R) es₁ es₂ → Alpha R (const c es₁) (const c es₂) data Alpha-Br (R : Var → Var → Type) : Br → Br → Type where nil : Alpha R e₁ e₂ → Alpha-Br R (branch c [] e₁) (branch c [] e₂) cons : Alpha-Br (R [ x₁ ∼ x₂ ]) (branch c xs₁ e₁) (branch c xs₂ e₂) → Alpha-Br R (branch c (x₁ ∷ xs₁) e₁) (branch c (x₂ ∷ xs₂) e₂) -- The α-equivalence relation. infix 4 _≈α_ _≈α_ : Exp → Exp → Type _≈α_ = Alpha _≡_ ------------------------------------------------------------------------ -- Some properties related to reflexivity -- If R y y holds assuming that y is distinct from x, then -- (R [ x ∼ x ]) y y holds. [≢→[∼]]→[∼] : ∀ R → (y ≢ x → R y y) → (R [ x ∼ x ]) y y [≢→[∼]]→[∼] {y = y} {x = x} _ r = case x V.≟ y of λ where (yes x≡y) → inj₁ (x≡y , x≡y) (no x≢y) → inj₂ ( x≢y , x≢y , r (x≢y ∘ sym) ) -- Alpha R is reflexive for expressions for which R x x holds for -- every free variable x. mutual refl-Alpha : ∀ e → (∀ x → x ∈FV e → R x x) → Alpha R e e refl-Alpha (apply e₁ e₂) r = apply (refl-Alpha e₁ λ x x∈e₁ → r x (apply-left x∈e₁)) (refl-Alpha e₂ λ x x∈e₂ → r x (apply-right x∈e₂)) refl-Alpha {R = R} (lambda x e) r = lambda (refl-Alpha e λ y y∈e → [≢→[∼]]→[∼] R λ y≢x → r y (lambda y≢x y∈e)) refl-Alpha (case e bs) r = case (refl-Alpha e λ x x∈e → r x (case-head x∈e)) (refl-Alpha-B⋆ bs λ x ∈bs x∉xs x∈ → r x (case-body x∈ ∈bs x∉xs)) refl-Alpha {R = R} (rec x e) r = rec (refl-Alpha e λ y y∈e → [≢→[∼]]→[∼] R λ y≢x → r y (rec y≢x y∈e)) refl-Alpha (var x) r = var (r x (var refl)) refl-Alpha (const c es) r = const (refl-Alpha-⋆ es λ x e e∈es x∈e → r x (const x∈e e∈es)) refl-Alpha-B : ∀ c xs e → (∀ x → ¬ x ∈ xs → x ∈FV e → R x x) → Alpha-Br R (branch c xs e) (branch c xs e) refl-Alpha-B c [] e r = nil (refl-Alpha e λ x x∈e → r x (λ ()) x∈e) refl-Alpha-B {R = R} c (x ∷ xs) e r = cons (refl-Alpha-B c xs e λ y y∉xs y∈e → [≢→[∼]]→[∼] R λ y≢x → r y [ y≢x , y∉xs ] y∈e) refl-Alpha-⋆ : ∀ es → (∀ x e → e ∈ es → x ∈FV e → R x x) → Alpha-⋆ (Alpha R) es es refl-Alpha-⋆ [] _ = [] refl-Alpha-⋆ (e ∷ es) r = refl-Alpha e (λ x x∈e → r x e (inj₁ refl) x∈e) ∷ refl-Alpha-⋆ es (λ x e e∈es x∈e → r x e (inj₂ e∈es) x∈e) refl-Alpha-B⋆ : ∀ bs → (∀ x {c xs e} → branch c xs e ∈ bs → ¬ x ∈ xs → x ∈FV e → R x x) → Alpha-⋆ (Alpha-Br R) bs bs refl-Alpha-B⋆ [] r = [] refl-Alpha-B⋆ (branch c xs e ∷ bs) r = refl-Alpha-B c xs e (λ x x∉xs x∈e → r x (inj₁ refl) x∉xs x∈e) ∷ refl-Alpha-B⋆ bs (λ x ∈bs x∉xs x∈ → r x (inj₂ ∈bs) x∉xs x∈) -- The α-equivalence relation is reflexive. refl-α : e ≈α e refl-α = refl-Alpha _ (λ _ _ → refl) -- Equational reasoning combinators. infix -1 finally-α _∎α infixr -2 step-≡-≈α step-≈α-≡ _≡⟨⟩α_ _∎α : ∀ e → e ≈α e _ ∎α = refl-α step-≡-≈α : ∀ e₁ → e₂ ≈α e₃ → e₁ ≡ e₂ → e₁ ≈α e₃ step-≡-≈α _ e₂≈e₃ e₁≡e₂ = subst (_≈α _) (sym e₁≡e₂) e₂≈e₃ syntax step-≡-≈α e₁ e₂≈e₃ e₁≡e₂ = e₁ ≡⟨ e₁≡e₂ ⟩α e₂≈e₃ step-≈α-≡ : ∀ e₁ → e₂ ≡ e₃ → e₁ ≈α e₂ → e₁ ≈α e₃ step-≈α-≡ _ e₂≡e₃ e₁≈e₂ = subst (_ ≈α_) e₂≡e₃ e₁≈e₂ syntax step-≈α-≡ e₁ e₂≡e₃ e₁≈e₂ = e₁ ≈⟨ e₁≈e₂ ⟩α e₂≡e₃ _≡⟨⟩α_ : ∀ e₁ → e₁ ≈α e₂ → e₁ ≈α e₂ _ ≡⟨⟩α e₁≈e₂ = e₁≈e₂ finally-α : ∀ e₁ e₂ → e₁ ≈α e₂ → e₁ ≈α e₂ finally-α _ _ e₁≈e₂ = e₁≈e₂ syntax finally-α e₁ e₂ e₁≈e₂ = e₁ ≈⟨ e₁≈e₂ ⟩α∎ e₂ ∎ ------------------------------------------------------------------------ -- A map function -- A kind of map function for _[_∼_]. map-[∼] : ∀ R₁ → (∀ {x₁ x₂} → R₁ x₁ x₂ → R₂ x₁ x₂) → (R₁ [ x₁ ∼ x₂ ]) x₁′ x₂′ → (R₂ [ x₁ ∼ x₂ ]) x₁′ x₂′ map-[∼] _ r = ⊎-map id (Σ-map id (Σ-map id r)) -- A kind of map function for Alpha. mutual map-Alpha : (∀ {x₁ x₂} → R₁ x₁ x₂ → R₂ x₁ x₂) → Alpha R₁ e₁ e₂ → Alpha R₂ e₁ e₂ map-Alpha r (var Rx₁x₂) = var (r Rx₁x₂) map-Alpha {R₁ = R₁} r (lambda e₁≈e₂) = lambda (map-Alpha (map-[∼] R₁ r) e₁≈e₂) map-Alpha {R₁ = R₁} r (rec e₁≈e₂) = rec (map-Alpha (map-[∼] R₁ r) e₁≈e₂) map-Alpha r (apply e₁₁≈e₁₂ e₂₁≈e₂₂) = apply (map-Alpha r e₁₁≈e₁₂) (map-Alpha r e₂₁≈e₂₂) map-Alpha r (const es₁≈es₂) = const (map-Alpha-⋆ r es₁≈es₂) map-Alpha r (case e₁≈e₂ bs₁≈bs₂) = case (map-Alpha r e₁≈e₂) (map-Alpha-Br-⋆ r bs₁≈bs₂) map-Alpha-Br : (∀ {x₁ x₂} → R₁ x₁ x₂ → R₂ x₁ x₂) → Alpha-Br R₁ b₁ b₂ → Alpha-Br R₂ b₁ b₂ map-Alpha-Br r (nil e₁≈e₂) = nil (map-Alpha r e₁≈e₂) map-Alpha-Br {R₁ = R₁} r (cons b₁≈b₂) = cons (map-Alpha-Br (map-[∼] R₁ r) b₁≈b₂) map-Alpha-⋆ : (∀ {x₁ x₂} → R₁ x₁ x₂ → R₂ x₁ x₂) → Alpha-⋆ (Alpha R₁) es₁ es₂ → Alpha-⋆ (Alpha R₂) es₁ es₂ map-Alpha-⋆ _ [] = [] map-Alpha-⋆ r (e₁≈e₂ ∷ es₁≈es₂) = map-Alpha r e₁≈e₂ ∷ map-Alpha-⋆ r es₁≈es₂ map-Alpha-Br-⋆ : (∀ {x₁ x₂} → R₁ x₁ x₂ → R₂ x₁ x₂) → Alpha-⋆ (Alpha-Br R₁) bs₁ bs₂ → Alpha-⋆ (Alpha-Br R₂) bs₁ bs₂ map-Alpha-Br-⋆ _ [] = [] map-Alpha-Br-⋆ r (b₁≈b₂ ∷ bs₁≈bs₂) = map-Alpha-Br r b₁≈b₂ ∷ map-Alpha-Br-⋆ r bs₁≈bs₂ ------------------------------------------------------------------------ -- Symmetry -- A kind of symmetry holds for _[_∼_]. sym-[∼] : ∀ R → (R [ x₁ ∼ x₂ ]) x₁′ x₂′ → (flip R [ x₂ ∼ x₁ ]) x₂′ x₁′ sym-[∼] _ = ⊎-map Prelude.swap (λ (x₁≢x₁′ , x₂≢x₂′ , R₁x₁′x₂′) → x₂≢x₂′ , x₁≢x₁′ , R₁x₁′x₂′) -- A kind of symmetry holds for Alpha. mutual sym-Alpha : Alpha R e₁ e₂ → Alpha (flip R) e₂ e₁ sym-Alpha (var Rx₁x₂) = var Rx₁x₂ sym-Alpha {R = R} (lambda e₁≈e₂) = lambda (map-Alpha (sym-[∼] R) (sym-Alpha e₁≈e₂)) sym-Alpha {R = R} (rec e₁≈e₂) = rec (map-Alpha (sym-[∼] R) (sym-Alpha e₁≈e₂)) sym-Alpha (apply e₁₁≈e₁₂ e₂₁≈e₂₂) = apply (sym-Alpha e₁₁≈e₁₂) (sym-Alpha e₂₁≈e₂₂) sym-Alpha (const es₁≈es₂) = const (sym-Alpha-⋆ es₁≈es₂) sym-Alpha (case e₁≈e₂ bs₁≈bs₂) = case (sym-Alpha e₁≈e₂) (sym-Alpha-Br-⋆ bs₁≈bs₂) sym-Alpha-Br : Alpha-Br R b₁ b₂ → Alpha-Br (flip R) b₂ b₁ sym-Alpha-Br (nil e₁≈e₂) = nil (sym-Alpha e₁≈e₂) sym-Alpha-Br {R = R} (cons b₁≈b₂) = cons (map-Alpha-Br (sym-[∼] R) (sym-Alpha-Br b₁≈b₂)) sym-Alpha-⋆ : Alpha-⋆ (Alpha R) es₁ es₂ → Alpha-⋆ (Alpha (flip R)) es₂ es₁ sym-Alpha-⋆ [] = [] sym-Alpha-⋆ (e₁≈e₂ ∷ es₁≈es₂) = sym-Alpha e₁≈e₂ ∷ sym-Alpha-⋆ es₁≈es₂ sym-Alpha-Br-⋆ : Alpha-⋆ (Alpha-Br R) bs₁ bs₂ → Alpha-⋆ (Alpha-Br (flip R)) bs₂ bs₁ sym-Alpha-Br-⋆ [] = [] sym-Alpha-Br-⋆ (b₁≈b₂ ∷ bs₁≈bs₂) = sym-Alpha-Br b₁≈b₂ ∷ sym-Alpha-Br-⋆ bs₁≈bs₂ -- The α-equivalence relation is symmetric. sym-α : e₁ ≈α e₂ → e₂ ≈α e₁ sym-α = map-Alpha sym ∘ sym-Alpha ------------------------------------------------------------------------ -- Several things respect α-equivalence -- The free variable relation respects α-equivalence. mutual Alpha-∈ : Alpha R e₁ e₂ → x₁ ∈FV e₁ → ∃ λ x₂ → R x₁ x₂ × x₂ ∈FV e₂ Alpha-∈ {R = R} (var Ry₁y₂) (var x₁≡y₁) = _ , subst (flip R _) (sym x₁≡y₁) Ry₁y₂ , var refl Alpha-∈ (lambda e₁≈e₂) (lambda x₁≢y₁ x₁∈) with Alpha-∈ e₁≈e₂ x₁∈ … | x₂ , inj₂ (_ , y₂≢x₂ , Rx₁x₂) , x₂∈ = x₂ , Rx₁x₂ , lambda (y₂≢x₂ ∘ sym) x₂∈ … | _ , inj₁ (y₁≡x₁ , _) , _ = ⊥-elim $ x₁≢y₁ (sym y₁≡x₁) Alpha-∈ (rec e₁≈e₂) (rec x₁≢y₁ x₁∈) with Alpha-∈ e₁≈e₂ x₁∈ … | x₂ , inj₂ (_ , y₂≢x₂ , Rx₁x₂) , x₂∈ = x₂ , Rx₁x₂ , rec (y₂≢x₂ ∘ sym) x₂∈ … | _ , inj₁ (y₁≡x₁ , _) , _ = ⊥-elim $ x₁≢y₁ (sym y₁≡x₁) Alpha-∈ (apply e₁₁≈e₁₂ e₂₁≈e₂₂) (apply-left x₁∈) = Σ-map id (Σ-map id apply-left) $ Alpha-∈ e₁₁≈e₁₂ x₁∈ Alpha-∈ (apply e₁₁≈e₁₂ e₂₁≈e₂₂) (apply-right x₁∈) = Σ-map id (Σ-map id apply-right) $ Alpha-∈ e₂₁≈e₂₂ x₁∈ Alpha-∈ (const es₁≈es₂) (const x₁∈ ∈es₁) = Σ-map id (Σ-map id $ uncurry λ _ → uncurry const) $ Alpha-⋆-∈ es₁≈es₂ x₁∈ ∈es₁ Alpha-∈ (case e₁≈e₂ bs₁≈bs₂) (case-head x₁∈) = Σ-map id (Σ-map id case-head) $ Alpha-∈ e₁≈e₂ x₁∈ Alpha-∈ (case e₁≈e₂ bs₁≈bs₂) (case-body x₁∈ ∈bs₁ ∉xs₁) = Σ-map id (Σ-map id λ (_ , _ , _ , x₂∈ , ∈bs₂ , ∉xs₂) → case-body x₂∈ ∈bs₂ ∉xs₂) $ Alpha-Br-⋆-∈ bs₁≈bs₂ x₁∈ ∈bs₁ ∉xs₁ Alpha-Br-∈ : Alpha-Br R (branch c₁ xs₁ e₁) (branch c₂ xs₂ e₂) → x₁ ∈FV e₁ → ¬ x₁ ∈ xs₁ → ∃ λ x₂ → R x₁ x₂ × x₂ ∈FV e₂ × ¬ x₂ ∈ xs₂ Alpha-Br-∈ (nil e₁≈e₂) x₁∈ _ = Σ-map id (Σ-map id (_, λ ())) $ Alpha-∈ e₁≈e₂ x₁∈ Alpha-Br-∈ (cons {x₁ = y₁} {x₂ = y₂} bs₁≈bs₂) x₁∈ x₁∉ with Alpha-Br-∈ bs₁≈bs₂ x₁∈ (x₁∉ ∘ inj₂) … | x₂ , inj₂ (_ , y₂≢x₂ , Rx₁x₂) , x₂∈ , x₂∉ = x₂ , Rx₁x₂ , x₂∈ , [ y₂≢x₂ ∘ sym , x₂∉ ] … | _ , inj₁ (y₁≡x₁ , _) , _ = ⊥-elim $ x₁∉ (inj₁ (sym y₁≡x₁)) Alpha-⋆-∈ : Alpha-⋆ (Alpha R) es₁ es₂ → x₁ ∈FV e₁ → e₁ ∈ es₁ → ∃ λ x₂ → R x₁ x₂ × ∃ λ e₂ → x₂ ∈FV e₂ × e₂ ∈ es₂ Alpha-⋆-∈ (e₁≈e₂ ∷ es₁≈es₂) x₁∈ (inj₁ ≡e₁) = Σ-map id (Σ-map id λ x₂∈ → _ , x₂∈ , inj₁ refl) $ Alpha-∈ e₁≈e₂ (subst (_ ∈FV_) ≡e₁ x₁∈) Alpha-⋆-∈ (e₁≈e₂ ∷ es₁≈es₂) x₁∈ (inj₂ ∈es₁) = Σ-map id (Σ-map id (Σ-map id (Σ-map id inj₂))) $ Alpha-⋆-∈ es₁≈es₂ x₁∈ ∈es₁ Alpha-Br-⋆-∈ : Alpha-⋆ (Alpha-Br R) bs₁ bs₂ → x₁ ∈FV e₁ → branch c₁ xs₁ e₁ ∈ bs₁ → ¬ x₁ ∈ xs₁ → ∃ λ x₂ → R x₁ x₂ × ∃ λ c₂ → ∃ λ xs₂ → ∃ λ e₂ → x₂ ∈FV e₂ × branch c₂ xs₂ e₂ ∈ bs₂ × ¬ x₂ ∈ xs₂ Alpha-Br-⋆-∈ (_∷_ {x₁ = branch _ _ _} {x₂ = branch _ _ _} b₁≈b₂ bs₁≈bs₂) x₁∈ (inj₁ ≡b₁) x₁∉ with Alpha-Br-∈ b₁≈b₂ (subst (_ ∈FV_) (cong (λ { (branch _ _ e) → e }) ≡b₁) x₁∈) (x₁∉ ∘ subst (_ ∈_) (cong (λ { (branch _ xs _) → xs }) (sym ≡b₁))) … | x₂ , Rx₁x₂ , x₂∈ , x₂∉ = x₂ , Rx₁x₂ , _ , _ , _ , x₂∈ , inj₁ refl , x₂∉ Alpha-Br-⋆-∈ (b₁≈b₂ ∷ bs₁≈bs₂) x₁∈ (inj₂ ∈bs₁) x₁∉ = (Σ-map id $ Σ-map id $ Σ-map id $ Σ-map id $ Σ-map id $ Σ-map id $ Σ-map inj₂ id) $ Alpha-Br-⋆-∈ bs₁≈bs₂ x₁∈ ∈bs₁ x₁∉ α-∈ : e₁ ≈α e₂ → x ∈FV e₁ → x ∈FV e₂ α-∈ e₁≈e₂ x∈ with Alpha-∈ e₁≈e₂ x∈ … | x′ , x≡x′ , x′∈ = subst (_∈FV _) (sym x≡x′) x′∈ -- The predicate Closed′ respects α-equivalence. α-closed′ : e₁ ≈α e₂ → Closed′ xs e₁ → Closed′ xs e₂ α-closed′ e₁≈e₂ cl x x∉ x∈ = cl x x∉ (α-∈ (sym-α e₁≈e₂) x∈) -- The predicate Closed respects α-equivalence. α-closed : e₁ ≈α e₂ → Closed e₁ → Closed e₂ α-closed = α-closed′ -- Substitution does not necessarily respect α-equivalence. ¬-subst-α : ¬ (∀ {x₁ x₂ e₁ e₂ e₁′ e₂′} → Alpha (_≡_ [ x₁ ∼ x₂ ]) e₁ e₂ → e₁′ ≈α e₂′ → e₁ [ x₁ ← e₁′ ] ≈α e₂ [ x₂ ← e₂′ ]) ¬-subst-α subst-α = not-equal (subst-α e¹≈e² e′≈e′) where x¹ = V.name 0 x² = V.name 1 z = V.name 2 e¹ = lambda x¹ (var z) e² = lambda x² (var z) e′ = var x¹ e¹≈e² : Alpha (_≡_ [ z ∼ z ]) e¹ e² e¹≈e² = lambda (var (inj₂ ( V.distinct-codes→distinct-names (λ ()) , V.distinct-codes→distinct-names (λ ()) , inj₁ (refl , refl) ))) e′≈e′ : e′ ≈α e′ e′≈e′ = refl-α not-equal : ¬ e¹ [ z ← e′ ] ≈α e² [ z ← e′ ] not-equal _ with z V.≟ x¹ | z V.≟ x² | z V.≟ z not-equal (lambda (var (inj₁ (_ , x²≡x¹)))) | no _ | no _ | yes _ = from-⊎ (1 Nat.≟ 0) (V.name-injective x²≡x¹) not-equal (lambda (var (inj₂ (x¹≢x¹ , _)))) | no _ | no _ | yes _ = x¹≢x¹ refl not-equal _ | yes z≡x¹ | _ | _ = from-⊎ (2 Nat.≟ 0) (V.name-injective z≡x¹) not-equal _ | _ | yes z≡x² | _ = from-⊎ (2 Nat.≟ 1) (V.name-injective z≡x²) not-equal _ | _ | _ | no z≢z = z≢z refl -- TODO: Does substitution of closed terms respect α-equivalence? Does -- the semantics respect α-equivalence for closed terms?
#ifndef _PYGSL_SOLVER_INTERN_H_ #define _PYGSL_SOLVER_INTERN_H_ 1 #define _PyGSL_SOLVER_API_MODULE 1 #include <pygsl/solver.h> #undef _PyGSL_SOLVER_API_MODULE #include <pygsl/general_helpers.h> #include <pygsl/block_helpers.h> #include <pygsl/function_helpers.h> #include <setjmp.h> #include <gsl/gsl_math.h> /* * Collect all element accessor methods which just need a pointer to the struct * and return a value. */ struct _ElementAccessor{ int_m_t method; const char * name; }; static PyTypeObject PyGSL_solver_pytype; #define PyGSL_solver_check(ob) ((ob)->ob_type == &PyGSL_solver_pytype) #define _PyGSL_solver_n_init PyGSL_solver_n_init static PyGSL_solver* _PyGSL_solver_init(const struct _SolverStatic *mstatic); static int PyGSL_solver_set_called(PyGSL_solver *self); #define PyGSL_SOLVER_SET_CALLED(ob) \ (((ob)->set_called == 1) ? GSL_SUCCESS: PyGSL_solver_set_called((ob))) static int PyGSL_solver_func_set(PyGSL_solver *self, PyObject *args, PyObject *f, PyObject *df, PyObject *fdf); #if 0 static PyObject * _PyGSL_solver_np_init(PyObject *self, PyObject *args, const solver_alloc_struct * alloc); static PyObject * _PyGSL_solver_i_vvdd(PyObject * self, PyObject * args, int_f_vvdd_t func); #endif #endif /* _PYGSL_SOLVER_INTERN_H_ */
State Before: α : Type u_1 inst✝⁵ : AddCommSemigroup α inst✝⁴ : PartialOrder α inst✝³ : ExistsAddOfLE α inst✝² : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1 inst✝¹ : Sub α inst✝ : OrderedSub α a b c d : α hc : AddLECancellable c h : c ≤ b ⊢ a < b - c ↔ c + a < b State After: α : Type u_1 inst✝⁵ : AddCommSemigroup α inst✝⁴ : PartialOrder α inst✝³ : ExistsAddOfLE α inst✝² : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1 inst✝¹ : Sub α inst✝ : OrderedSub α a b c d : α hc : AddLECancellable c h : c ≤ b ⊢ a < b - c ↔ a + c < b Tactic: rw [add_comm] State Before: α : Type u_1 inst✝⁵ : AddCommSemigroup α inst✝⁴ : PartialOrder α inst✝³ : ExistsAddOfLE α inst✝² : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1 inst✝¹ : Sub α inst✝ : OrderedSub α a b c d : α hc : AddLECancellable c h : c ≤ b ⊢ a < b - c ↔ a + c < b State After: no goals Tactic: exact hc.lt_tsub_iff_right_of_le h
module Control.Monad.Dom.Interface import Control.MonadRec import Control.Monad.Reader import Control.Monad.State import Control.Monad.Writer import Control.WellFounded import Data.Iterable import Data.Nat import Data.SOP import JS import Text.CSS import Text.Html import Web.Dom %default total -------------------------------------------------------------------------------- -- ElemRef -------------------------------------------------------------------------------- ||| A typed reference to an element or container in the DOM. Elements can ||| either be referenced by their ID string or their CSS class ||| (both of which must be unique), or by holding a value directly. ||| This can be used to access the element in question, ||| for instance by invoking `getElementByRef`. ||| ||| In addition, we provide (pseudo-)element references for ||| `body`, `document`, and `window`. public export data ElemRef : (t : Type) -> Type where Id : {tag : String} -> (tpe : ElementType tag t) -> (id : String) -> ElemRef t Class : {tag : String} -> (tpe : ElementType tag t) -> (class : String) -> ElemRef t Ref : (ref : t) -> ElemRef t Body : ElemRef HTMLElement Document : ElemRef Document Window : ElemRef Window ||| Predicate witnessing that a given `ElemRef` is a reference ||| by ID. public export data ById : ElemRef t -> Type where IsById : {0 tpe : _} -> {0 id : _} -> ById (Id tpe id) ||| Predicate witnessing that a given `ElemRef` is a reference ||| by Class. public export data ByClass : ElemRef t -> Type where IsByClass : {0 tpe : _} -> {0 id : _} -> ByClass (Class tpe id) namespace Attribute ||| Uses an element ref as an ID attribute export ref : (r : ElemRef t) -> {auto 0 _ : ById r} -> Attribute ev ref (Id _ i) = id i namespace CSS ||| Uses an element ref as an ID selector export idRef : (r : ElemRef t) -> {auto 0 _ : ById r} -> Selector 0 False False idRef (Id _ i) = Id i ||| Uses an element ref as a class selector export classRef : (r : ElemRef t) -> {auto 0 _ : ByClass r} -> Selector 0 False False classRef (Class _ i) = Class i -------------------------------------------------------------------------------- -- Types -------------------------------------------------------------------------------- public export data Position = BeforeBegin | AfterBegin | BeforeEnd | AfterEnd export positionStr : Position -> String positionStr BeforeBegin = "beforebegin" positionStr AfterBegin = "afterbegin" positionStr BeforeEnd = "beforeend" positionStr AfterEnd = "afterend" -------------------------------------------------------------------------------- -- Interface -------------------------------------------------------------------------------- ||| Interface for setting up interactions with the DOM public export interface Monad m => MonadDom (0 ev : Type) (0 m : Type -> Type) | m where ||| Generates a new unique ID uniqueId : m String ||| Registers an event listener at the given DOM element, ||| acting on events provided by the given `DOMEvent` value. registerEvent : ElemRef t -> DOMEvent ev -> m () export MonadDom ev m => MonadDom ev (ReaderT e m) where uniqueId = lift uniqueId registerEvent r e = lift (registerEvent r e) export MonadDom ev m => MonadDom ev (StateT s m) where uniqueId = lift uniqueId registerEvent r e = lift (registerEvent r e) export MonadDom ev m => MonadDom ev (WriterT w m) where uniqueId = lift uniqueId registerEvent r e = lift (registerEvent r e) -------------------------------------------------------------------------------- -- Node Preparation -------------------------------------------------------------------------------- -- generates an `ElemRef` for the given HTMLElement type `t`, -- either by using the ID already defined in the attribute list, -- or by creating a new unique ID. -- -- This ID will be used by `innerHtmlAt` to properly set up the -- necessary event listeners. getRef : {str : String} -> MonadDom ev m => Attributes ev -> ElementType str t -> m (Attributes ev, ElemRef t) getRef as tpe = case getId as of Just i => pure (as, Id tpe i) Nothing => (\i => (Id i :: as, Id tpe i)) <$> uniqueId PrepareRes : Type -> (Type -> Type) -> Type PrepareRes ev m = (List (Node ev), List (m ())) mutual -- tail-call optimized preparation of nodes -- the totality checker needs a wee bit of help for this prepareNodes : MonadDom ev m => MonadRec m => List (Node ev) -> m (PrepareRes ev m) prepareNodes ns = trSized ns ([], []) go where go : (vs : List (Node ev)) -> PrepareRes ev m -> m (Step Smaller vs (PrepareRes ev m) (PrepareRes ev m)) go [] ( ns2,ens) = pure $ Done (reverse ns2, ens) go (h :: t) (ns2,ens) = do (n2, en) <- assert_total $ prepareNode h pure $ Cont t (reflexive {rel = LTE}) (n2 :: ns2, en ++ ens) -- inserts unique IDs where necessary and extracts a list of -- actions, which will register the necessary event listeners -- after creating the nodes in the DOM prepareNode : MonadDom ev m => MonadRec m => Node ev -> m (Node ev, List $ m ()) prepareNode (El tpe as ns) = case getEvents as of Nil => do (ns2, ens) <- prepareNodes ns pure (El tpe as ns2, ens) es => do (as2,r) <- getRef as tpe (ns2, ens) <- prepareNodes ns pure $ (El tpe as2 ns2, map (registerEvent r) es ++ ens) prepareNode r@(Raw _) = pure (r,[]) prepareNode r@(Text _) = pure (r,[]) -------------------------------------------------------------------------------- -- Inserting Nodes -------------------------------------------------------------------------------- ||| Tries to retrieve an element of the given type by looking ||| up its ID in the DOM. Unlike `getElementById`, this will throw ||| an exception in the `JSIO` monad if the element is not found ||| or can't be safely cast to the desired type. export strictGetElementById : LiftJSIO m => SafeCast t => (tag,id : String) -> m t strictGetElementById tag id = do Nothing <- castElementById t id | Just t => pure t liftJSIO $ throwError $ Caught "Control.Monad.Dom.Interface.strictGetElementById: Could not find \{tag} with id \{id}" ||| Tries to retrieve a HTMLElement by looking ||| up its ID in the DOM. Unlike `getElementById`, this will throw ||| an exception in the `JSIO` monad if the element is not found ||| or can't be safely cast to the desired type. export %inline strictGetHTMLElementById : LiftJSIO m => (tag,id : String) -> m HTMLElement strictGetHTMLElementById = strictGetElementById ||| Tries to retrieve an element of the given type by looking ||| up its ID in the DOM. Unlike `getElementById`, this will throw ||| an exception in the `JSIO` monad if the element is not found ||| or can't be safely cast to the desired type. export getElementByRef : LiftJSIO m => SafeCast t => ElemRef t -> m t getElementByRef (Id {tag} _ id) = strictGetElementById tag id getElementByRef (Class _ class) = getElementByClass class getElementByRef (Ref t) = pure t getElementByRef Body = liftJSIO body getElementByRef Document = liftJSIO document getElementByRef Window = liftJSIO window err : String err = "Control.Monad.Dom.Interface.castElementByRef" ||| Tries to retrieve an element of the given type by looking ||| up its ID in the DOM. Unlike `getElementById`, this will throw ||| an exception in the `JSIO` monad if the element is not found ||| or can't be safely cast to the desired type. export castElementByRef : LiftJSIO m => SafeCast t2 => ElemRef t -> m t2 castElementByRef (Id {tag} _ id) = strictGetElementById tag id castElementByRef (Class _ class) = getElementByClass class castElementByRef Body = liftJSIO $ body >>= tryCast err castElementByRef Document = liftJSIO $ document >>= tryCast err castElementByRef Window = liftJSIO $ window >>= tryCast err castElementByRef (Ref t) = liftJSIO $ tryCast err t ||| Sets up the reactive behavior of the given `Node` and ||| inserts it as the only child of the given target. ||| ||| This adds unique IDs and event listeners to the generated ||| nodes as required in their attributes. export innerHtmlAtN : LiftJSIO m => MonadRec m => MonadDom ev m => ElemRef t -> List (Node ev) -> m () innerHtmlAtN ref ns = do elem <- castElementByRef {t2 = Element} ref (n2, es) <- prepareNodes ns liftJSIO $ innerHTML elem .= renderMany n2 forM_ (\x => x) es ||| Sets up the reactive behavior of the given `Node` and ||| inserts it as the only child of the given target. ||| ||| This adds unique IDs and event listeners to the generated ||| nodes as required in their attributes. export innerHtmlAt : LiftJSIO m => MonadRec m => MonadDom ev m => ElemRef t -> Node ev -> m () innerHtmlAt ref n = do elem <- castElementByRef {t2 = Element} ref (n2, es) <- prepareNode n liftJSIO $ innerHTML elem .= render n2 forM_ (\x => x) es ||| Replaces the `innerHTML` property of the target with the ||| given `String`. Warning: The string will not be escaped ||| before being inserted, so don't use this with text from ||| untrusted sources. export rawInnerHtmlAt : LiftJSIO m => ElemRef t -> String -> m () rawInnerHtmlAt ref str = liftJSIO $ do elem <- castElementByRef {t2 = Element} ref liftJSIO $ innerHTML elem .= str
import textdistance import pandas as pd import fasttext from scipy import spatial import numpy as np import matplotlib.pyplot as plt model = fasttext.load_model("cc.en.300.bin") inputFile = sys.argv[1] country = sys.argv[2] mappings = sys.argv[3] data = pd.read_csv(inputFile, sep='\t', encoding='utf-8',) labelName = [] tagName = [] for col in data.columns: if 'cls_' in col: labelName.append(col) if '=' in col: tagName.append(col) confOSM = [] for i in labelName: for j in tagName: #print(j) try: temp1 = len(data[(data[i] ==1) & (data[j] ==1)]) except KeyError: temp1 = 0 temp2 = len(data[(data[j] ==1)]) try: temp3 = temp1/temp2 except ZeroDivisionError: temp3 = 0 confOSM.append((i.replace('cls_',''),j.replace('osmTagKey_',''),temp3)) df_tag_cls= pd.DataFrame(confOSM, columns=['cls', 'tag', 'value']) dfprerec = pd.read_csv(mappings,sep='\t', encoding='utf-8',) dfprerecSD = pd.merge(dfprerec, df_tag_cls, how='left', left_on=['tag','cls'], right_on = ['tag','cls']) dfprerecSD.to_csv('SDTypeMappings'+country+'.csv', sep='\t', encoding='utf-8') source = list(dfprerec['tag'].values) target = list(dfprerec['cls'].values) fasttextDist = [] for i in range(len(source)): osm = model.get_word_vector(source[i]) wiki = model.get_word_vector(target[i]) fasttextDist.append((1 - spatial.distance.cosine(osm, wiki))) dfprerec['fasttextDist'] = fasttextDist levenshteinSim = [] for i in range(len(source)): levenshteinSim.append(textdistance.levenshtein.normalized_similarity(source[i], target[i])) dfprerec['leven'] = levenshteinSim dfprerec.to_csv('fastTextLevenShteinMatches'+country+'.csv', sep='\t', encoding='utf-8')
(*<*) theory Monitor_Impl imports Monitor Optimized_MTL "HOL-Library.Code_Target_Nat" Containers.Containers begin (*>*) section \<open>Instantiation of the generic algorithm and code setup\<close> declare [[code drop: card]] Set_Impl.card_code[code] instantiation enat :: set_impl begin definition set_impl_enat :: "(enat, set_impl) phantom" where "set_impl_enat = phantom set_RBT" instance .. end derive ccompare Formula.trm derive (eq) ceq Formula.trm derive (rbt) set_impl Formula.trm derive (eq) ceq Monitor.mregex derive ccompare Monitor.mregex derive (rbt) set_impl Monitor.mregex derive (rbt) mapping_impl Monitor.mregex derive (no) cenum Monitor.mregex derive (rbt) set_impl event_data derive (rbt) mapping_impl event_data definition add_new_mmuaux' :: "args \<Rightarrow> event_data table \<Rightarrow> event_data table \<Rightarrow> ts \<Rightarrow> event_data mmuaux \<Rightarrow> event_data mmuaux" where "add_new_mmuaux' = add_new_mmuaux" interpretation muaux valid_mmuaux init_mmuaux add_new_mmuaux' length_mmuaux eval_mmuaux using valid_init_mmuaux valid_add_new_mmuaux valid_length_mmuaux valid_eval_mmuaux unfolding add_new_mmuaux'_def by unfold_locales assumption+ type_synonym 'a vmsaux = "nat \<times> (nat \<times> 'a table) list" definition valid_vmsaux :: "args \<Rightarrow> nat \<Rightarrow> event_data vmsaux \<Rightarrow> (nat \<times> event_data table) list \<Rightarrow> bool" where "valid_vmsaux = (\<lambda>_ cur (t, aux) auxlist. t = cur \<and> aux = auxlist)" definition init_vmsaux :: "args \<Rightarrow> event_data vmsaux" where "init_vmsaux = (\<lambda>_. (0, []))" definition add_new_ts_vmsaux :: "args \<Rightarrow> nat \<Rightarrow> event_data vmsaux \<Rightarrow> event_data vmsaux" where "add_new_ts_vmsaux = (\<lambda>args nt (t, auxlist). (nt, filter (\<lambda>(t, rel). enat (nt - t) \<le> right (args_ivl args)) auxlist))" definition join_vmsaux :: "args \<Rightarrow> event_data table \<Rightarrow> event_data vmsaux \<Rightarrow> event_data vmsaux" where "join_vmsaux = (\<lambda>args rel1 (t, auxlist). (t, map (\<lambda>(t, rel). (t, join rel (args_pos args) rel1)) auxlist))" definition add_new_table_vmsaux :: "args \<Rightarrow> event_data table \<Rightarrow> event_data vmsaux \<Rightarrow> event_data vmsaux" where "add_new_table_vmsaux = (\<lambda>args rel2 (cur, auxlist). (cur, (case auxlist of [] => [(cur, rel2)] | ((t, y) # ts) \<Rightarrow> if t = cur then (t, y \<union> rel2) # ts else (cur, rel2) # auxlist)))" definition result_vmsaux :: "args \<Rightarrow> event_data vmsaux \<Rightarrow> event_data table" where "result_vmsaux = (\<lambda>args (cur, auxlist). foldr (\<union>) [rel. (t, rel) \<leftarrow> auxlist, left (args_ivl args) \<le> cur - t] {})" type_synonym 'a vmuaux = "nat \<times> (nat \<times> 'a table \<times> 'a table) list" definition valid_vmuaux :: "args \<Rightarrow> nat \<Rightarrow> event_data vmuaux \<Rightarrow> (nat \<times> event_data table \<times> event_data table) list \<Rightarrow> bool" where "valid_vmuaux = (\<lambda>_ cur (t, aux) auxlist. t = cur \<and> aux = auxlist)" definition init_vmuaux :: "args \<Rightarrow> event_data vmuaux" where "init_vmuaux = (\<lambda>_. (0, []))" definition add_new_vmuaux :: "args \<Rightarrow> event_data table \<Rightarrow> event_data table \<Rightarrow> nat \<Rightarrow> event_data vmuaux \<Rightarrow> event_data vmuaux" where "add_new_vmuaux = (\<lambda>args rel1 rel2 nt (t, auxlist). (nt, update_until args rel1 rel2 nt auxlist))" definition length_vmuaux :: "args \<Rightarrow> event_data vmuaux \<Rightarrow> nat" where "length_vmuaux = (\<lambda>_ (_, auxlist). length auxlist)" definition eval_vmuaux :: "args \<Rightarrow> nat \<Rightarrow> event_data vmuaux \<Rightarrow> event_data table list \<times> event_data vmuaux" where "eval_vmuaux = (\<lambda>args nt (t, auxlist). (let (res, auxlist') = eval_until (args_ivl args) nt auxlist in (res, (t, auxlist'))))" global_interpretation verimon_maux: maux valid_vmsaux init_vmsaux add_new_ts_vmsaux join_vmsaux add_new_table_vmsaux result_vmsaux valid_vmuaux init_vmuaux add_new_vmuaux length_vmuaux eval_vmuaux defines vminit0 = "maux.minit0 (init_vmsaux :: _ \<Rightarrow> event_data vmsaux) (init_vmuaux :: _ \<Rightarrow> event_data vmuaux) :: _ \<Rightarrow> Formula.formula \<Rightarrow> _" and vminit = "maux.minit (init_vmsaux :: _ \<Rightarrow> event_data vmsaux) (init_vmuaux :: _ \<Rightarrow> event_data vmuaux) :: Formula.formula \<Rightarrow> _" and vminit_safe = "maux.minit_safe (init_vmsaux :: _ \<Rightarrow> event_data vmsaux) (init_vmuaux :: _ \<Rightarrow> event_data vmuaux) :: Formula.formula \<Rightarrow> _" and vmupdate_since = "maux.update_since add_new_ts_vmsaux join_vmsaux add_new_table_vmsaux (result_vmsaux :: _ \<Rightarrow> event_data vmsaux \<Rightarrow> event_data table)" and vmeval = "maux.meval add_new_ts_vmsaux join_vmsaux add_new_table_vmsaux (result_vmsaux :: _ \<Rightarrow> event_data vmsaux \<Rightarrow> _) add_new_vmuaux (eval_vmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data vmuaux \<Rightarrow> _)" and vmstep = "maux.mstep add_new_ts_vmsaux join_vmsaux add_new_table_vmsaux (result_vmsaux :: _ \<Rightarrow> event_data vmsaux \<Rightarrow> _) add_new_vmuaux (eval_vmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data vmuaux \<Rightarrow> _)" and vmsteps0_stateless = "maux.msteps0_stateless add_new_ts_vmsaux join_vmsaux add_new_table_vmsaux (result_vmsaux :: _ \<Rightarrow> event_data vmsaux \<Rightarrow> _) add_new_vmuaux (eval_vmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data vmuaux \<Rightarrow> _)" and vmsteps_stateless = "maux.msteps_stateless add_new_ts_vmsaux join_vmsaux add_new_table_vmsaux (result_vmsaux :: _ \<Rightarrow> event_data vmsaux \<Rightarrow> _) add_new_vmuaux (eval_vmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data vmuaux \<Rightarrow> _)" and vmonitor = "maux.monitor init_vmsaux add_new_ts_vmsaux join_vmsaux add_new_table_vmsaux (result_vmsaux :: _ \<Rightarrow> event_data vmsaux \<Rightarrow> _) init_vmuaux add_new_vmuaux (eval_vmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data vmuaux \<Rightarrow> _)" unfolding valid_vmsaux_def init_vmsaux_def add_new_ts_vmsaux_def join_vmsaux_def add_new_table_vmsaux_def result_vmsaux_def valid_vmuaux_def init_vmuaux_def add_new_vmuaux_def length_vmuaux_def eval_vmuaux_def by unfold_locales auto global_interpretation default_maux: maux valid_mmsaux "init_mmsaux :: _ \<Rightarrow> event_data mmsaux" add_new_ts_mmsaux gc_join_mmsaux add_new_table_mmsaux result_mmsaux valid_mmuaux "init_mmuaux :: _ \<Rightarrow> event_data mmuaux" add_new_mmuaux' length_mmuaux eval_mmuaux defines minit0 = "maux.minit0 (init_mmsaux :: _ \<Rightarrow> event_data mmsaux) (init_mmuaux :: _ \<Rightarrow> event_data mmuaux) :: _ \<Rightarrow> Formula.formula \<Rightarrow> _" and minit = "maux.minit (init_mmsaux :: _ \<Rightarrow> event_data mmsaux) (init_mmuaux :: _ \<Rightarrow> event_data mmuaux) :: Formula.formula \<Rightarrow> _" and minit_safe = "maux.minit_safe (init_mmsaux :: _ \<Rightarrow> event_data mmsaux) (init_mmuaux :: _ \<Rightarrow> event_data mmuaux) :: Formula.formula \<Rightarrow> _" and mupdate_since = "maux.update_since add_new_ts_mmsaux gc_join_mmsaux add_new_table_mmsaux (result_mmsaux :: _ \<Rightarrow> event_data mmsaux \<Rightarrow> event_data table)" and meval = "maux.meval add_new_ts_mmsaux gc_join_mmsaux add_new_table_mmsaux (result_mmsaux :: _ \<Rightarrow> event_data mmsaux \<Rightarrow> _) add_new_mmuaux' (eval_mmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data mmuaux \<Rightarrow> _)" and mstep = "maux.mstep add_new_ts_mmsaux gc_join_mmsaux add_new_table_mmsaux (result_mmsaux :: _ \<Rightarrow> event_data mmsaux \<Rightarrow> _) add_new_mmuaux' (eval_mmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data mmuaux \<Rightarrow> _)" and msteps0_stateless = "maux.msteps0_stateless add_new_ts_mmsaux gc_join_mmsaux add_new_table_mmsaux (result_mmsaux :: _ \<Rightarrow> event_data mmsaux \<Rightarrow> _) add_new_mmuaux' (eval_mmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data mmuaux \<Rightarrow> _)" and msteps_stateless = "maux.msteps_stateless add_new_ts_mmsaux gc_join_mmsaux add_new_table_mmsaux (result_mmsaux :: _ \<Rightarrow> event_data mmsaux \<Rightarrow> _) add_new_mmuaux' (eval_mmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data mmuaux \<Rightarrow> _)" and monitor = "maux.monitor init_mmsaux add_new_ts_mmsaux gc_join_mmsaux add_new_table_mmsaux (result_mmsaux :: _ \<Rightarrow> event_data mmsaux \<Rightarrow> _) init_mmuaux add_new_mmuaux' (eval_mmuaux :: _ \<Rightarrow> _ \<Rightarrow> event_data mmuaux \<Rightarrow> _)" by unfold_locales lemma image_these: "f ` Option.these X = Option.these (map_option f ` X)" by (force simp: in_these_eq Bex_def image_iff map_option_case split: option.splits) thm default_maux.meval.simps(2) lemma meval_MPred: "meval n t db (MPred e ts) = (case Mapping.lookup db e of None \<Rightarrow> [{}] | Some Xs \<Rightarrow> map (\<lambda>X. \<Union>v \<in> X. (set_option (map_option (\<lambda>f. Table.tabulate f 0 n) (match ts v)))) Xs, MPred e ts)" by (force split: option.splits simp: Option.these_def image_iff) lemmas meval_code[code] = default_maux.meval.simps(1) meval_MPred default_maux.meval.simps(3-) definition mk_db :: "(Formula.name \<times> event_data list set) list \<Rightarrow> _" where "mk_db t = Monitor.mk_db (\<Union>n \<in> set (map fst t). (\<lambda>v. (n, v)) ` the (map_of t n))" definition rbt_fold :: "_ \<Rightarrow> event_data tuple set_rbt \<Rightarrow> _ \<Rightarrow> _" where "rbt_fold = RBT_Set2.fold" definition rbt_empty :: "event_data list set_rbt" where "rbt_empty = RBT_Set2.empty" definition rbt_insert :: "_ \<Rightarrow> _ \<Rightarrow> event_data list set_rbt" where "rbt_insert = RBT_Set2.insert" lemma saturate_commute: assumes "\<And>s. r \<in> g s" "\<And>s. g (insert r s) = g s" "\<And>s. r \<in> s \<Longrightarrow> h s = g s" and terminates: "mono g" "\<And>X. X \<subseteq> C \<Longrightarrow> g X \<subseteq> C" "finite C" shows "saturate g {} = saturate h {r}" proof (cases "g {} = {r}") case True with assms have "g {r} = {r}" "h {r} = {r}" by auto with True show ?thesis by (subst (1 2) saturate_code; subst saturate_code) (simp add: Let_def) next case False then show ?thesis unfolding saturate_def while_def using while_option_finite_subset_Some[OF terminates] assms(1-3) by (subst while_option_commute_invariant[of "\<lambda>S. S = {} \<or> r \<in> S" "\<lambda>S. g S \<noteq> S" g "\<lambda>S. h S \<noteq> S" "insert r" h "{}", symmetric]) (auto 4 4 dest: while_option_stop[of "\<lambda>S. g S \<noteq> S" g "{}"]) qed definition "RPDs_aux = saturate (\<lambda>S. S \<union> \<Union> (RPD ` S))" lemma RPDs_aux_code[code]: "RPDs_aux S = (let S' = S \<union> Set.bind S RPD in if S' \<subseteq> S then S else RPDs_aux S')" unfolding RPDs_aux_def bind_UNION by (subst saturate_code) auto declare RPDs_code[code del] lemma RPDs_code[code]: "RPDs r = RPDs_aux {r}" unfolding RPDs_aux_def RPDs_code by (rule saturate_commute[where C="RPDs r"]) (auto 0 3 simp: mono_def subset_singleton_iff RPDs_refl RPDs_trans finite_RPDs) definition "LPDs_aux = saturate (\<lambda>S. S \<union> \<Union> (LPD ` S))" lemma LPDs_aux_code[code]: "LPDs_aux S = (let S' = S \<union> Set.bind S LPD in if S' \<subseteq> S then S else LPDs_aux S')" unfolding LPDs_aux_def bind_UNION by (subst saturate_code) auto declare LPDs_code[code del] lemma LPDs_code[code]: "LPDs r = LPDs_aux {r}" unfolding LPDs_aux_def LPDs_code by (rule saturate_commute[where C="LPDs r"]) (auto 0 3 simp: mono_def subset_singleton_iff LPDs_refl LPDs_trans finite_LPDs) lemma is_empty_table_unfold [code_unfold]: "X = empty_table \<longleftrightarrow> Set.is_empty X" "empty_table = X \<longleftrightarrow> Set.is_empty X" "set_eq X empty_table \<longleftrightarrow> Set.is_empty X" "set_eq empty_table X \<longleftrightarrow> Set.is_empty X" "X = (set_empty impl) \<longleftrightarrow> Set.is_empty X" "(set_empty impl) = X \<longleftrightarrow> Set.is_empty X" "set_eq X (set_empty impl) \<longleftrightarrow> Set.is_empty X" "set_eq (set_empty impl) X \<longleftrightarrow> Set.is_empty X" unfolding set_eq_def set_empty_def empty_table_def Set.is_empty_def by auto lemma tabulate_rbt_code[code]: "Monitor.mrtabulate (xs :: mregex list) f = (case ID CCOMPARE(mregex) of None \<Rightarrow> Code.abort (STR ''tabulate RBT_Mapping: ccompare = None'') (\<lambda>_. Monitor.mrtabulate (xs :: mregex list) f) | _ \<Rightarrow> RBT_Mapping (RBT_Mapping2.bulkload (List.map_filter (\<lambda>k. let fk = f k in if fk = empty_table then None else Some (k, fk)) xs)))" unfolding mrtabulate.abs_eq RBT_Mapping_def by (auto split: option.splits) lemma combine_Mapping[code]: fixes t :: "('a :: ccompare, 'b) mapping_rbt" shows "Mapping.combine f (RBT_Mapping t) (RBT_Mapping u) = (case ID CCOMPARE('a) of None \<Rightarrow> Code.abort (STR ''combine RBT_Mapping: ccompare = None'') (\<lambda>_. Mapping.combine f (RBT_Mapping t) (RBT_Mapping u)) | Some _ \<Rightarrow> RBT_Mapping (RBT_Mapping2.join (\<lambda>_. f) t u))" by (auto simp add: Mapping.combine.abs_eq Mapping_inject lookup_join split: option.split) lemma upd_set_empty[simp]: "upd_set m f {} = m" by transfer auto lemma upd_set_insert[simp]: "upd_set m f (insert x A) = Mapping.update x (f x) (upd_set m f A)" by (rule mapping_eqI) (auto simp: Mapping_lookup_upd_set Mapping.lookup_update') lemma upd_set_fold: assumes "finite A" shows "upd_set m f A = Finite_Set.fold (\<lambda>a. Mapping.update a (f a)) m A" proof - interpret comp_fun_idem "\<lambda>a. Mapping.update a (f a)" by unfold_locales (transfer; auto simp: fun_eq_iff)+ from assms show ?thesis by (induct A arbitrary: m rule: finite.induct) auto qed lift_definition upd_cfi :: "('a \<Rightarrow> 'b) \<Rightarrow> ('a, ('a, 'b) mapping) comp_fun_idem" is "\<lambda>f a m. Mapping.update a (f a) m" by unfold_locales (transfer; auto simp: fun_eq_iff)+ lemma upd_set_code[code]: "upd_set m f A = (if finite A then set_fold_cfi (upd_cfi f) m A else Code.abort (STR ''upd_set: infinite'') (\<lambda>_. upd_set m f A))" by (transfer fixing: m) (auto simp: upd_set_fold) lemma lexordp_eq_code[code]: "lexordp_eq xs ys \<longleftrightarrow> (case xs of [] \<Rightarrow> True | x # xs \<Rightarrow> (case ys of [] \<Rightarrow> False | y # ys \<Rightarrow> if x < y then True else if x > y then False else lexordp_eq xs ys))" by (subst lexordp_eq.simps) (auto split: list.split) definition "filter_set m X t = Mapping.filter (filter_cond X m t) m" declare [[code drop: shift_end]] declare shift_end.simps[folded filter_set_def, code] lemma upd_set'_empty[simp]: "upd_set' m d f {} = m" by (rule mapping_eqI) (auto simp add: upd_set'_lookup) lemma upd_set'_insert: "d = f d \<Longrightarrow> (\<And>x. f (f x) = f x) \<Longrightarrow> upd_set' m d f (insert x A) = (let m' = (upd_set' m d f A) in case Mapping.lookup m' x of None \<Rightarrow> Mapping.update x d m' | Some v \<Rightarrow> Mapping.update x (f v) m')" by (rule mapping_eqI) (auto simp: upd_set'_lookup Mapping.lookup_update' split: option.splits) lemma upd_set'_aux1: "upd_set' Mapping.empty d f {b. b = k \<or> (a, b) \<in> A} = Mapping.update k d (upd_set' Mapping.empty d f {b. (a, b) \<in> A})" by (rule mapping_eqI) (auto simp add: Let_def upd_set'_lookup Mapping.lookup_update' Mapping.lookup_empty split: option.splits) lemma upd_set'_aux2: "Mapping.lookup m k = None \<Longrightarrow> upd_set' m d f {b. b = k \<or> (a, b) \<in> A} = Mapping.update k d (upd_set' m d f {b. (a, b) \<in> A})" by (rule mapping_eqI) (auto simp add: upd_set'_lookup Mapping.lookup_update' split: option.splits) lemma upd_set'_aux3: "Mapping.lookup m k = Some v \<Longrightarrow> upd_set' m d f {b. b = k \<or> (a, b) \<in> A} = Mapping.update k (f v) (upd_set' m d f {b. (a, b) \<in> A})" by (rule mapping_eqI) (auto simp add: upd_set'_lookup Mapping.lookup_update' split: option.splits) lemma upd_set'_aux4: "k \<notin> fst ` A \<Longrightarrow> upd_set' Mapping.empty d f {b. (k, b) \<in> A} = Mapping.empty" by (rule mapping_eqI) (auto simp add: upd_set'_lookup Mapping.lookup_update' Domain.DomainI fst_eq_Domain split: option.splits) lemma upd_nested_empty[simp]: "upd_nested m d f {} = m" by (rule mapping_eqI) (auto simp add: upd_nested_lookup split: option.splits) definition upd_nested_step :: "'c \<Rightarrow> ('c \<Rightarrow> 'c) \<Rightarrow> 'a \<times> 'b \<Rightarrow> ('a, ('b, 'c) mapping) mapping \<Rightarrow> ('a, ('b, 'c) mapping) mapping" where "upd_nested_step d f x m = (case x of (k, k') \<Rightarrow> (case Mapping.lookup m k of Some m' \<Rightarrow> (case Mapping.lookup m' k' of Some v \<Rightarrow> Mapping.update k (Mapping.update k' (f v) m') m | None \<Rightarrow> Mapping.update k (Mapping.update k' d m') m) | None \<Rightarrow> Mapping.update k (Mapping.update k' d Mapping.empty) m))" lemma upd_nested_insert: "d = f d \<Longrightarrow> (\<And>x. f (f x) = f x) \<Longrightarrow> upd_nested m d f (insert x A) = upd_nested_step d f x (upd_nested m d f A)" unfolding upd_nested_step_def using upd_set'_aux1[of d f _ _ A] upd_set'_aux2[of _ _ d f _ A] upd_set'_aux3[of _ _ _ d f _ A] upd_set'_aux4[of _ A d f] by (auto simp add: Let_def upd_nested_lookup upd_set'_lookup Mapping.lookup_update' Mapping.lookup_empty split: option.splits prod.splits if_splits intro!: mapping_eqI) definition upd_nested_max_tstp where "upd_nested_max_tstp m d X = upd_nested m d (max_tstp d) X" lemma upd_nested_max_tstp_fold: assumes "finite X" shows "upd_nested_max_tstp m d X = Finite_Set.fold (upd_nested_step d (max_tstp d)) m X" proof - interpret comp_fun_idem "upd_nested_step d (max_tstp d)" by (unfold_locales; rule ext) (auto simp add: comp_def upd_nested_step_def Mapping.lookup_update' Mapping.lookup_empty update_update max_tstp_d_d max_tstp_idem' split: option.splits) note upd_nested_insert' = upd_nested_insert[of d "max_tstp d", OF max_tstp_d_d[symmetric] max_tstp_idem'] show ?thesis using assms by (induct X arbitrary: m rule: finite.induct) (auto simp add: upd_nested_max_tstp_def upd_nested_insert') qed lift_definition upd_nested_max_tstp_cfi :: "ts + tp \<Rightarrow> ('a \<times> 'b, ('a, ('b, ts + tp) mapping) mapping) comp_fun_idem" is "\<lambda>d. upd_nested_step d (max_tstp d)" by (unfold_locales; rule ext) (auto simp add: comp_def upd_nested_step_def Mapping.lookup_update' Mapping.lookup_empty update_update max_tstp_d_d max_tstp_idem' split: option.splits) lemma upd_nested_max_tstp_code[code]: "upd_nested_max_tstp m d X = (if finite X then set_fold_cfi (upd_nested_max_tstp_cfi d) m X else Code.abort (STR ''upd_nested_max_tstp: infinite'') (\<lambda>_. upd_nested_max_tstp m d X))" by transfer (auto simp add: upd_nested_max_tstp_fold) declare [[code drop: add_new_mmuaux']] declare add_new_mmuaux'_def[unfolded add_new_mmuaux.simps, folded upd_nested_max_tstp_def, code] lemma filter_set_empty[simp]: "filter_set m {} t = m" unfolding filter_set_def by transfer (auto simp: fun_eq_iff split: option.splits) lemma filter_set_insert[simp]: "filter_set m (insert x A) t = (let m' = filter_set m A t in case Mapping.lookup m' x of Some u \<Rightarrow> if t = u then Mapping.delete x m' else m' | _ \<Rightarrow> m')" unfolding filter_set_def by transfer (auto simp: fun_eq_iff Let_def Map_To_Mapping.map_apply_def split: option.splits) lemma filter_set_fold: assumes "finite A" shows "filter_set m A t = Finite_Set.fold (\<lambda>a m. case Mapping.lookup m a of Some u \<Rightarrow> if t = u then Mapping.delete a m else m | _ \<Rightarrow> m) m A" proof - interpret comp_fun_idem "\<lambda>a m. case Mapping.lookup m a of Some u \<Rightarrow> if t = u then Mapping.delete a m else m | _ \<Rightarrow> m" by unfold_locales (transfer; auto simp: fun_eq_iff Map_To_Mapping.map_apply_def split: option.splits)+ from assms show ?thesis by (induct A arbitrary: m rule: finite.induct) (auto simp: Let_def) qed lift_definition filter_cfi :: "'b \<Rightarrow> ('a, ('a, 'b) mapping) comp_fun_idem" is "\<lambda>t a m. case Mapping.lookup m a of Some u \<Rightarrow> if t = u then Mapping.delete a m else m | _ \<Rightarrow> m" by unfold_locales (transfer; auto simp: fun_eq_iff Map_To_Mapping.map_apply_def split: option.splits)+ lemma filter_set_code[code]: "filter_set m A t = (if finite A then set_fold_cfi (filter_cfi t) m A else Code.abort (STR ''upd_set: infinite'') (\<lambda>_. filter_set m A t))" by (transfer fixing: m) (auto simp: filter_set_fold) lemma filter_Mapping[code]: fixes t :: "('a :: ccompare, 'b) mapping_rbt" shows "Mapping.filter P (RBT_Mapping t) = (case ID CCOMPARE('a) of None \<Rightarrow> Code.abort (STR ''filter RBT_Mapping: ccompare = None'') (\<lambda>_. Mapping.filter P (RBT_Mapping t)) | Some _ \<Rightarrow> RBT_Mapping (RBT_Mapping2.filter (case_prod P) t))" by (auto simp add: Mapping.filter.abs_eq Mapping_inject split: option.split) definition "filter_join pos X m = Mapping.filter (join_filter_cond pos X) m" declare [[code drop: join_mmsaux]] declare join_mmsaux.simps[folded filter_join_def, code] lemma filter_join_False_empty: "filter_join False {} m = m" unfolding filter_join_def by transfer (auto split: option.splits) lemma filter_join_False_insert: "filter_join False (insert a A) m = filter_join False A (Mapping.delete a m)" proof - { fix x have "Mapping.lookup (filter_join False (insert a A) m) x = Mapping.lookup (filter_join False A (Mapping.delete a m)) x" by (auto simp add: filter_join_def Mapping.lookup_filter Mapping_lookup_delete split: option.splits) } then show ?thesis by (simp add: mapping_eqI) qed lemma filter_join_False: assumes "finite A" shows "filter_join False A m = Finite_Set.fold Mapping.delete m A" proof - interpret comp_fun_idem "Mapping.delete" by (unfold_locales; transfer) (fastforce simp add: comp_def)+ from assms show ?thesis by (induction A arbitrary: m rule: finite.induct) (auto simp add: filter_join_False_empty filter_join_False_insert fold_fun_left_comm) qed lift_definition filter_not_in_cfi :: "('a, ('a, 'b) mapping) comp_fun_idem" is "Mapping.delete" by (unfold_locales; transfer) (fastforce simp add: comp_def)+ lemma filter_join_code[code]: "filter_join pos A m = (if \<not>pos \<and> finite A \<and> card A < Mapping.size m then set_fold_cfi filter_not_in_cfi m A else Mapping.filter (join_filter_cond pos A) m)" unfolding filter_join_def by (transfer fixing: m) (use filter_join_False in \<open>auto simp add: filter_join_def\<close>) definition set_minus :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" where "set_minus X Y = X - Y" lift_definition remove_cfi :: "('a, 'a set) comp_fun_idem" is "\<lambda>b a. a - {b}" by unfold_locales auto lemma set_minus_finite: assumes fin: "finite Y" shows "set_minus X Y = Finite_Set.fold (\<lambda>a X. X - {a}) X Y" proof - interpret comp_fun_idem "\<lambda>a X. X - {a}" by unfold_locales auto from assms show ?thesis by (induction Y arbitrary: X rule: finite.induct) (auto simp add: set_minus_def) qed lemma set_minus_code[code]: "set_minus X Y = (if finite Y \<and> card Y < card X then set_fold_cfi remove_cfi X Y else X - Y)" by transfer (use set_minus_finite in \<open>auto simp add: set_minus_def\<close>) declare [[code drop: bin_join]] declare bin_join.simps[folded set_minus_def, code] definition remove_Union where "remove_Union A X B = A - (\<Union>x \<in> X. B x)" lemma remove_Union_finite: assumes "finite X" shows "remove_Union A X B = Finite_Set.fold (\<lambda>x A. A - B x) A X" proof - interpret comp_fun_idem "\<lambda>x A. A - B x" by unfold_locales auto from assms show ?thesis by (induct X arbitrary: A rule: finite_induct) (auto simp: remove_Union_def) qed lift_definition remove_Union_cfi :: "('a \<Rightarrow> 'b set) \<Rightarrow> ('a, 'b set) comp_fun_idem" is "\<lambda>B x A. A - B x" by unfold_locales auto lemma remove_Union_code[code]: "remove_Union A X B = (if finite X then set_fold_cfi (remove_Union_cfi B) A X else A - (\<Union>x \<in> X. B x))" by (transfer fixing: A X B) (use remove_Union_finite[of X A B] in \<open>auto simp add: remove_Union_def\<close>) lemma tabulate_remdups: "Mapping.tabulate xs f = Mapping.tabulate (remdups xs) f" by (transfer fixing: xs f) (auto simp: map_of_map_restrict) lift_definition clearjunk :: "(String.literal \<times> event_data list set) list \<Rightarrow> (String.literal, event_data list set list) alist" is "\<lambda>t. List.map_filter (\<lambda>(p, X). if X = {} then None else Some (p, [X])) (AList.clearjunk t)" unfolding map_filter_def o_def list.map_comp by (subst map_cong[OF refl, of _ _ fst]) (auto simp: map_filter_def distinct_map_fst_filter split: if_splits) lemma map_filter_snd_map_filter: "List.map_filter (\<lambda>(a, b). if P b then None else Some (f a b)) xs = map (\<lambda>(a, b). f a b) (filter (\<lambda>x. \<not> P (snd x)) xs)" by (simp add: map_filter_def prod.case_eq_if) lemma mk_db_code_alist: "mk_db t = Assoc_List_Mapping (clearjunk t)" unfolding mk_db_def Assoc_List_Mapping_def by (transfer' fixing: t) (auto simp: map_filter_snd_map_filter fun_eq_iff map_of_map image_iff map_of_clearjunk map_of_filter_apply dest: weak_map_of_SomeI intro!: bexI[rotated, OF map_of_SomeD] split: if_splits option.splits) lemma mk_db_code[code]: "mk_db t = Mapping.of_alist (List.map_filter (\<lambda>(p, X). if X = {} then None else Some (p, [X])) (AList.clearjunk t))" unfolding mk_db_def by (transfer' fixing: t) (auto simp: map_filter_snd_map_filter fun_eq_iff map_of_map image_iff map_of_clearjunk map_of_filter_apply dest: weak_map_of_SomeI intro!: bexI[rotated, OF map_of_SomeD] split: if_splits option.splits) declare [[code drop: New_max_getIJ_genericJoin New_max_getIJ_wrapperGenericJoin]] declare New_max.genericJoin.simps[folded remove_Union_def, code] declare New_max.wrapperGenericJoin.simps[folded remove_Union_def, code] (*<*) end (*>*)
Formal statement is: lemma norm_triangle_sub: "norm x \<le> norm y + norm (x - y)" Informal statement is: The norm of $x$ is less than or equal to the norm of $y$ plus the norm of $x - y$.
# Re-creating [Capillary Hysteresis in Neutrally Wettable Fibrous Media: A Pore Network Study of a Fuel Cell Electrode](http://link.springer.com/10.1007/s11242-017-0973-2) # Part C: Purcell Meniscus Model ## Introduction In the final part of this series we take a deeper look at the Purcell meniscus model, which is central to the whole study. The fundamental concept is that the fibers form throats with properties similar to that of a torus: As the fluid invades throaugh the center of the torus the meniscus is pinned to the surface and the "effective" contact angle becomes influenced by the converging diverging geometry and is a function of the filling angle $\alpha$. The shape of the meniscus as the invading phase moves upwards through the torus with key model parameters is shown below. Different intrinsic contact angles through invading phase: (a) 60$^\circ$, (b) 90$^\circ$ and (c) 120$^\circ$. All scenarios clearly show an inflection of the meniscus curvature signifying a switch in the sign of the capillary pressure from negative to positive. This inflection is predicted to occur for all contact angles by the model with varying filling angle. The capillary pressure can be shown to be: $P_C = -2\sigma cos(\theta-\alpha))/(r+R(1-cos(\alpha))$ ## Set up We will set up a trivially small network with one throat to demonstrate the use of the meniscus model. Here we do the imports and define a few functions for plotting. ```python import numpy as np import sympy as syp import matplotlib.pyplot as plt from ipywidgets import interact %matplotlib inline %pylab inline pylab.rcParams['figure.figsize'] = (5, 5) theta = 90 fiberRad = 5e-6 throatRad = 2e-5 max_bulge = 1e-5 # Parameters for plotting fibers x, R, rt, s, t = syp.symbols('x, R, rt, s, t') points = np.linspace(-fiberRad, fiberRad, 1001) y = R*syp.sqrt(1- (x/R)**2) r = rt + (R-y) rx = syp.lambdify((x, R, rt), r, 'numpy') def plot_arc(ax, arc_cen, arc_rad, arc_angle, num_points=100): r''' plot the meniscus arc from neg to pos angle ''' angles = np.linspace(-arc_angle, arc_angle, num_points) x = arc_cen - arc_rad*np.cos(angles) y = arc_rad*np.sin(angles) print(x) print(y) ax.plot(x, y, 'b-') ``` Populating the interactive namespace from numpy and matplotlib Now we define our two pore network and add the meniscus model in several modes: 'max' returns the maximum pressure experienced by the meniscus as it transitions through the throat, i.e. the burst entry pressure. 'touch' is the pressure at which the meniscus has protruded past the throat center a distance defined by the 'touch_length' dictionary key. In network simulations this could be set to the pore_diameter. Finally the 'men' mode accepts a target_Pc parameter and returns all the mensicus information required for assessing cooperative filling or plotting. ```python import openpnm as op import openpnm.models.physics as pm net = op.network.Cubic(shape=[2, 1, 1], spacing=5e-5) geo = op.geometry.StickAndBall(network=net, pores=net.pores(), throats=net.throats()) phase = op.phases.Water(network=net) phase['pore.contact_angle'] = theta phys = op.physics.Standard(network=net, phase=phase, geometry=geo) geo['throat.diameter'] = throatRad*2 geo['throat.touch_length'] = max_bulge phys.add_model(propname='throat.max', model=pm.meniscus.purcell, mode='max', r_toroid=fiberRad) phys.add_model(propname='throat.touch', model=pm.meniscus.purcell, mode='touch', r_toroid=fiberRad) phys.add_model(propname='throat.meniscus', model=pm.meniscus.purcell, mode='men', r_toroid=fiberRad, target_Pc=1000) touch_Pc = phys['throat.touch'][0] print(touch_Pc) max_Pc = phys['throat.max'][0] print(max_Pc) ``` 4114.018827899374 5878.390833049412 We define a plotting function that uses the meniscus data: $\alpha$ is filling angle as defined above, $radius$ is the radius of curvature of the mensicus, $center$ is the position of the centre of curvature relative to the throat center along the axis of the throat, $\gamma$ is the angle between the throat axis and the line joining the meniscus center and meniscus contact point. ```python def plot_phys(target_Pc, print_data=False): phys.add_model(propname='throat.meniscus', model=pm.meniscus.purcell, mode='men', r_toroid=fiberRad, target_Pc=target_Pc) throatRad = geo['throat.diameter'][0]/2 theta = np.deg2rad(phys['pore.contact_angle'][0]) men_data = {} men_data['alpha'] = phys['throat.meniscus.alpha'] men_data['gamma'] = phys['throat.meniscus.gamma'] men_data['radius'] = phys['throat.meniscus.radius'] men_data['center'] = phys['throat.meniscus.center'] fig, ax = plt.subplots() ax.plot(points, rx(points, fiberRad, throatRad), 'k-') ax.plot(points, -rx(points, fiberRad, throatRad), 'k-') arc_cen = men_data['center'] arc_rad = men_data['radius'] arc_angle = men_data['gamma'] angles = np.linspace(-arc_angle, arc_angle, 100) arcx = arc_cen - arc_rad*np.cos(angles) arcy = arc_rad*np.sin(angles) ax.plot(arcx, arcy, 'b-') ax.axis('equal') ax.ticklabel_format(style='sci', axis='both', scilimits=(-6,-6)) if print_data: print(men_data) return ax ``` We can see that the touch_Pc calculated earlier, corresponds with the tip of the meniscus exceeding the max_bulge parameter. Try changing this and re-running to see what happens. ```python # NBVAL_IGNORE_OUTPUT ax = plot_phys(target_Pc=touch_Pc, print_data=True); ax.plot([max_bulge, max_bulge], [-throatRad, throatRad], 'r--'); ``` We can interact with the mensicus model by changing the target_Pc parameter. ```python # NBVAL_IGNORE_OUTPUT interact(plot_phys, target_Pc=(-max_Pc, max_Pc, 10)); ``` interactive(children=(FloatSlider(value=-8.390833049412322, description='target_Pc', max=5878.390833049412, mi…
[GOAL] α : Type u_1 l l₁ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α l₂ : List α ⊢ [] <+ [] [PROOFSTEP] rfl [GOAL] α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a : α l₁ l₂ t : List α s : t <+ l₁ e : t ++ l₂ = l₁ ∪ l₂ h : a ∈ l₁ ∪ l₂ ⊢ t ++ l₂ = a :: l₁ ∪ l₂ [PROOFSTEP] simp only [e, cons_union, insert_of_mem h] [GOAL] α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a : α l₁ l₂ t : List α s : t <+ l₁ e : t ++ l₂ = l₁ ∪ l₂ h : ¬a ∈ l₁ ∪ l₂ ⊢ a :: t ++ l₂ = a :: l₁ ∪ l₂ [PROOFSTEP] simp only [cons_append, cons_union, e, insert_of_not_mem h] [GOAL] α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α ⊢ (∀ (x : α), x ∈ l₁ ∪ l₂ → p x) ↔ (∀ (x : α), x ∈ l₁ → p x) ∧ ∀ (x : α), x ∈ l₂ → p x [PROOFSTEP] simp only [mem_union_iff, or_imp, forall_and] [GOAL] α : Type u_1 l l₁✝ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α l₁ : List α h : a ∈ l₂ ⊢ (a :: l₁) ∩ l₂ = a :: l₁ ∩ l₂ [PROOFSTEP] simp only [Inter.inter, List.inter, filter_cons_of_pos, h] [GOAL] α : Type u_1 l l₁✝ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α l₁ : List α h : ¬a ∈ l₂ ⊢ (a :: l₁) ∩ l₂ = l₁ ∩ l₂ [PROOFSTEP] simp only [Inter.inter, List.inter, filter_cons_of_neg, h] [GOAL] α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α h : a ∈ l₁ ∩ l₂ ⊢ a ∈ l₂ [PROOFSTEP] simpa using of_mem_filter h [GOAL] α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α h₁ : a ∈ l₁ h₂ : a ∈ l₂ ⊢ decide (a ∈ l₂) = true [PROOFSTEP] simpa using h₂ [GOAL] α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α ⊢ l₁ ∩ l₂ = [] ↔ Disjoint l₁ l₂ [PROOFSTEP] simp only [eq_nil_iff_forall_not_mem, mem_inter_iff, not_and] [GOAL] α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α ⊢ (∀ (a : α), a ∈ l₁ → ¬a ∈ l₂) ↔ Disjoint l₁ l₂ [PROOFSTEP] rfl [GOAL] α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α xs ys : List α ⊢ List.inter xs (reverse ys) = List.inter xs ys [PROOFSTEP] simp only [List.inter, mem_reverse] [GOAL] α : Type u_1 l✝ l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α l : List α ⊢ List.bagInter [] l = [] [PROOFSTEP] cases l [GOAL] case nil α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α ⊢ List.bagInter [] [] = [] [PROOFSTEP] rfl [GOAL] case cons α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α head✝ : α tail✝ : List α ⊢ List.bagInter [] (head✝ :: tail✝) = [] [PROOFSTEP] rfl [GOAL] α : Type u_1 l✝ l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α l : List α ⊢ List.bagInter l [] = [] [PROOFSTEP] cases l [GOAL] case nil α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α ⊢ List.bagInter [] [] = [] [PROOFSTEP] rfl [GOAL] case cons α : Type u_1 l l₁ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α head✝ : α tail✝ : List α ⊢ List.bagInter (head✝ :: tail✝) [] = [] [PROOFSTEP] rfl [GOAL] α : Type u_1 l l₁✝ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α l₁ : List α h : a ∈ l₂ ⊢ List.bagInter (a :: l₁) l₂ = a :: List.bagInter l₁ (List.erase l₂ a) [PROOFSTEP] cases l₂ [GOAL] case nil α : Type u_1 l l₁✝ : List α p : α → Prop a : α inst✝ : DecidableEq α l₁ : List α h : a ∈ [] ⊢ List.bagInter (a :: l₁) [] = a :: List.bagInter l₁ (List.erase [] a) [PROOFSTEP] exact if_pos h [GOAL] case cons α : Type u_1 l l₁✝ : List α p : α → Prop a : α inst✝ : DecidableEq α l₁ : List α head✝ : α tail✝ : List α h : a ∈ head✝ :: tail✝ ⊢ List.bagInter (a :: l₁) (head✝ :: tail✝) = a :: List.bagInter l₁ (List.erase (head✝ :: tail✝) a) [PROOFSTEP] simp only [List.bagInter, if_pos (elem_eq_true_of_mem h)] [GOAL] α : Type u_1 l l₁✝ l₂ : List α p : α → Prop a : α inst✝ : DecidableEq α l₁ : List α h : ¬a ∈ l₂ ⊢ List.bagInter (a :: l₁) l₂ = List.bagInter l₁ l₂ [PROOFSTEP] cases l₂ [GOAL] case nil α : Type u_1 l l₁✝ : List α p : α → Prop a : α inst✝ : DecidableEq α l₁ : List α h : ¬a ∈ [] ⊢ List.bagInter (a :: l₁) [] = List.bagInter l₁ [] [PROOFSTEP] simp only [bagInter_nil] [GOAL] case cons α : Type u_1 l l₁✝ : List α p : α → Prop a : α inst✝ : DecidableEq α l₁ : List α head✝ : α tail✝ : List α h : ¬a ∈ head✝ :: tail✝ ⊢ List.bagInter (a :: l₁) (head✝ :: tail✝) = List.bagInter l₁ (head✝ :: tail✝) [PROOFSTEP] simp only [erase_of_not_mem h, List.bagInter, if_neg (mt mem_of_elem_eq_true h)] [GOAL] α : Type u_1 l l₁ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a : α l₂ : List α ⊢ a ∈ List.bagInter [] l₂ ↔ a ∈ [] ∧ a ∈ l₂ [PROOFSTEP] simp only [nil_bagInter, not_mem_nil, false_and_iff] [GOAL] α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α ⊢ a ∈ List.bagInter (b :: l₁) l₂ ↔ a ∈ b :: l₁ ∧ a ∈ l₂ [PROOFSTEP] by_cases h : b ∈ l₂ [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α h : b ∈ l₂ ⊢ a ∈ List.bagInter (b :: l₁) l₂ ↔ a ∈ b :: l₁ ∧ a ∈ l₂ [PROOFSTEP] rw [cons_bagInter_of_pos _ h, mem_cons, mem_cons, mem_bagInter] [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α h : b ∈ l₂ ⊢ a = b ∨ a ∈ l₁ ∧ a ∈ List.erase l₂ b ↔ (a = b ∨ a ∈ l₁) ∧ a ∈ l₂ [PROOFSTEP] by_cases ba : a = b [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α h : b ∈ l₂ ba : a = b ⊢ a = b ∨ a ∈ l₁ ∧ a ∈ List.erase l₂ b ↔ (a = b ∨ a ∈ l₁) ∧ a ∈ l₂ [PROOFSTEP] simp only [ba, h, eq_self_iff_true, true_or_iff, true_and_iff] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α h : b ∈ l₂ ba : ¬a = b ⊢ a = b ∨ a ∈ l₁ ∧ a ∈ List.erase l₂ b ↔ (a = b ∨ a ∈ l₁) ∧ a ∈ l₂ [PROOFSTEP] simp only [mem_erase_of_ne ba, ba, false_or_iff] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ a ∈ List.bagInter (b :: l₁) l₂ ↔ a ∈ b :: l₁ ∧ a ∈ l₂ [PROOFSTEP] rw [cons_bagInter_of_neg _ h, mem_bagInter, mem_cons, or_and_right] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ a ∈ l₁ ∧ a ∈ l₂ ↔ a = b ∧ a ∈ l₂ ∨ a ∈ l₁ ∧ a ∈ l₂ [PROOFSTEP] symm [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ a = b ∧ a ∈ l₂ ∨ a ∈ l₁ ∧ a ∈ l₂ ↔ a ∈ l₁ ∧ a ∈ l₂ [PROOFSTEP] apply or_iff_right_of_imp [GOAL] case neg.ha α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ a = b ∧ a ∈ l₂ → a ∈ l₁ ∧ a ∈ l₂ [PROOFSTEP] rintro ⟨rfl, h'⟩ [GOAL] case neg.ha.intro α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a : α l₁ l₂ : List α h' : a ∈ l₂ h : ¬a ∈ l₂ ⊢ a ∈ l₁ ∧ a ∈ l₂ [PROOFSTEP] exact h.elim h' [GOAL] α : Type u_1 l l₁ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a : α l₂ : List α ⊢ count a (List.bagInter [] l₂) = min (count a []) (count a l₂) [PROOFSTEP] simp [GOAL] α : Type u_1 l l₁✝ l₂ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a : α l₁ : List α ⊢ count a (List.bagInter l₁ []) = min (count a l₁) (count a []) [PROOFSTEP] simp [GOAL] α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α ⊢ count a (List.bagInter (b :: l₁) l₂) = min (count a (b :: l₁)) (count a l₂) [PROOFSTEP] by_cases hb : b ∈ l₂ [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : b ∈ l₂ ⊢ count a (List.bagInter (b :: l₁) l₂) = min (count a (b :: l₁)) (count a l₂) [PROOFSTEP] rw [cons_bagInter_of_pos _ hb, count_cons', count_cons', count_bagInter, count_erase, ← min_add_add_right] [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : b ∈ l₂ ⊢ min (count a l₁ + if a = b then 1 else 0) ((count a l₂ - if a = b then 1 else 0) + if a = b then 1 else 0) = min (count a l₁ + if a = b then 1 else 0) (count a l₂) [PROOFSTEP] by_cases ab : a = b [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : b ∈ l₂ ab : a = b ⊢ min (count a l₁ + if a = b then 1 else 0) ((count a l₂ - if a = b then 1 else 0) + if a = b then 1 else 0) = min (count a l₁ + if a = b then 1 else 0) (count a l₂) [PROOFSTEP] rw [if_pos ab, @tsub_add_cancel_of_le] [GOAL] case pos.h α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : b ∈ l₂ ab : a = b ⊢ 1 ≤ count a l₂ [PROOFSTEP] rwa [succ_le_iff, count_pos, ab] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : b ∈ l₂ ab : ¬a = b ⊢ min (count a l₁ + if a = b then 1 else 0) ((count a l₂ - if a = b then 1 else 0) + if a = b then 1 else 0) = min (count a l₁ + if a = b then 1 else 0) (count a l₂) [PROOFSTEP] rw [if_neg ab, tsub_zero, add_zero, add_zero] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : ¬b ∈ l₂ ⊢ count a (List.bagInter (b :: l₁) l₂) = min (count a (b :: l₁)) (count a l₂) [PROOFSTEP] rw [cons_bagInter_of_neg _ hb, count_bagInter] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : ¬b ∈ l₂ ⊢ min (count a l₁) (count a l₂) = min (count a (b :: l₁)) (count a l₂) [PROOFSTEP] by_cases ab : a = b [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : ¬b ∈ l₂ ab : a = b ⊢ min (count a l₁) (count a l₂) = min (count a (b :: l₁)) (count a l₂) [PROOFSTEP] rw [← ab] at hb [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : ¬a ∈ l₂ ab : a = b ⊢ min (count a l₁) (count a l₂) = min (count a (b :: l₁)) (count a l₂) [PROOFSTEP] rw [count_eq_zero.2 hb, min_zero, min_zero] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a✝ : α inst✝ : DecidableEq α a b : α l₁ l₂ : List α hb : ¬b ∈ l₂ ab : ¬a = b ⊢ min (count a l₁) (count a l₂) = min (count a (b :: l₁)) (count a l₂) [PROOFSTEP] rw [count_cons_of_ne ab] [GOAL] α : Type u_1 l l₁ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α l₂ : List α ⊢ List.bagInter [] l₂ <+ [] [PROOFSTEP] simp [GOAL] α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α ⊢ List.bagInter (b :: l₁) l₂ <+ b :: l₁ [PROOFSTEP] by_cases h : b ∈ l₂ [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α h : b ∈ l₂ ⊢ List.bagInter (b :: l₁) l₂ <+ b :: l₁ [PROOFSTEP] simp only [h, cons_bagInter_of_pos, cons_bagInter_of_neg, not_false_iff] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ List.bagInter (b :: l₁) l₂ <+ b :: l₁ [PROOFSTEP] simp only [h, cons_bagInter_of_pos, cons_bagInter_of_neg, not_false_iff] [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α h : b ∈ l₂ ⊢ b :: List.bagInter l₁ (List.erase l₂ b) <+ b :: l₁ [PROOFSTEP] exact (bagInter_sublist_left _ _).cons_cons _ [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ List.bagInter l₁ l₂ <+ b :: l₁ [PROOFSTEP] apply sublist_cons_of_sublist [GOAL] case neg.a α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ List.bagInter l₁ l₂ <+ l₁ [PROOFSTEP] apply bagInter_sublist_left [GOAL] α : Type u_1 l l₁ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α l₂ : List α ⊢ List.bagInter [] l₂ = [] ↔ [] ∩ l₂ = [] [PROOFSTEP] simp [GOAL] α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α ⊢ List.bagInter (b :: l₁) l₂ = [] ↔ (b :: l₁) ∩ l₂ = [] [PROOFSTEP] by_cases h : b ∈ l₂ [GOAL] case pos α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α h : b ∈ l₂ ⊢ List.bagInter (b :: l₁) l₂ = [] ↔ (b :: l₁) ∩ l₂ = [] [PROOFSTEP] simp [h] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ List.bagInter (b :: l₁) l₂ = [] ↔ (b :: l₁) ∩ l₂ = [] [PROOFSTEP] simp [h] [GOAL] case neg α : Type u_1 l l₁✝ l₂✝ : List α p : α → Prop a : α inst✝ : DecidableEq α b : α l₁ l₂ : List α h : ¬b ∈ l₂ ⊢ List.bagInter l₁ l₂ = [] ↔ l₁ ∩ l₂ = [] [PROOFSTEP] exact bagInter_nil_iff_inter_nil l₁ l₂
import numpy as np import pandas as pd from collections import defaultdict from scipy.stats import norm class Stratum(object): def __init__(self, signature, y_control, y_treatment): self.signature = signature self.y_control = y_control self.y_treatment = y_treatment self.difference = np.mean(y_treatment) - np.mean(y_control) self.sigma = np.sqrt((np.var(y_control)/len(y_control)) + (np.var(y_treatment)/len(y_treatment))) def get_signature(self): return self.signature def get_difference(self): return self.difference def get_sigma(self): return self.sigma def get_difference_confint(self, alpha): z = norm(0, 1).interval(1. - alpha)[1] w = z * self.sigma return self.difference - w, self.difference + w def get_control_count(self): return len(self.y_control) def get_treatment_count(self): return len(self.y_treatment) class ExactMatching(object): def __init__(self): self.strata = None def match(self, X, t, y): control_obs, treatment_obs = defaultdict(list), defaultdict(list) """Perform exact matching using covariates X (pandas dataframe), treatment indicator t, and response variable y.""" for i, tup in enumerate(X.iterrows()): _, x_row = tup if t[i] == 1: treatment_obs[tuple(x_row)].append(y[i]) elif t[i] == 0: control_obs[tuple(x_row)].append(y[i]) else: raise Exception('Treatment values must be 1 or 0, but got {0}'.format(t[i])) unique_signatures = list(set(treatment_obs) | set(control_obs)) self.strata = {} for k in unique_signatures: self.strata[k] = Stratum(k, control_obs[k], treatment_obs[k]) def get_att(self): strata_df = self.get_strata_dataframe() w = strata_df['treatment_count'] / strata_df['treatment_count'].sum() return np.dot(strata_df['diff'], w) def get_atc(self): strata_df = self.get_strata_dataframe() w = strata_df['control_count'] / strata_df['control_count'].sum() return np.dot(strata_df['diff'], w) def get_ate(self): strata_df = self.get_strata_dataframe() w = strata_df['total_count'] / strata_df['total_count'].sum() return np.dot(strata_df['diff'], w) def get_strata(self): return self.strata def get_strata_dataframe(self): rows = [[sig, s.get_difference(), s.get_sigma(), s.get_control_count(), s.get_treatment_count(), s.get_control_count() + s.get_treatment_count()] for sig, s in self.get_strata().items()] return pd.DataFrame(rows, columns=['signature', 'diff', 'sigma', 'control_count', 'treatment_count', 'total_count']) def get_pruned_strata(self): pass
If $S$ is a nonempty convex set, then $S$ is starlike.
module Statistics.Report ( reportTxFate ) where import Data.Map.Strict (Map) import qualified Data.Map.Strict as M import qualified Data.Set as S import qualified Data.Text as T import System.IO (hPutStrLn) import Statistics.Block (TxFate (..)) import Types import Universum reportTxFate :: FilePath -> Map TxHash TxFate -> IO ([TxHash], [TxHash], [TxHash]) reportTxFate f m = withFile f WriteMode $ \h -> do let total = M.size m m' = M.filter isFork m fork = M.size m' m'' = M.filter isChain m chain = M.size m'' m''' = M.filter isLost m lost = M.size m''' chains = fst <$> M.toList m'' forks = fst <$> M.toList m' losts = fst <$> M.toList m'' hPutStrLn h $ "total transactions: " ++ show total hPutStrLn h $ "in blockchain: " ++ show chain hPutStrLn h $ "in fork: " ++ show fork hPutStrLn h $ "lost: " ++ show lost hPutStrLn h "" hPutStrLn h "transactions in blockchain:" for_ (M.toList m'') $ \(tx, InBlockChain _ hash _) -> hPutStrLn h $ toString tx ++ ": " ++ toString (T.take 6 hash) hPutStrLn h "" hPutStrLn h "transactions in fork:" for_ (M.toList m') $ \(tx, InFork s) -> hPutStrLn h $ toString tx ++ ": " ++ toString (unwords $ map (T.take 6 . snd) $ S.toList s) hPutStrLn h "" hPutStrLn h "lost transactions:" for_ (M.toList m''') $ \(tx, InNoBlock) -> hPutStrLn h (toString tx) return (chains, forks, losts) isFork :: TxFate -> Bool isFork (InFork _) = True isFork _ = False isLost :: TxFate -> Bool isLost InNoBlock = True isLost _ = False isChain :: TxFate -> Bool isChain (InBlockChain{}) = True isChain _ = False
On April 4 , 1991 H. John Heinz III , one of the US Senators from Pennsylvania , was killed when his chartered plane collided with a helicopter inspecting its landing gear . Under the Seventeenth Amendment to the United States Constitution , the legislature of each state has the power to permit the governor to fill the vacant seat until a special election can be held . In Pennsylvania , this power had been delegated , and Governor Robert P. Casey signed a writ on May 13 , 1991 , declaring November 5 the date for a special election and temporarily appointing Harris Wofford to fill Heinz 's now @-@ vacant seat . Under Pennsylvanian law , there was no need for a primary in such a situation ; instead , both the Democrats and Republicans would each internally select their candidate , who would run in the special election . John S. Trinsey Jr . , a member of the Pennsylvanian electorate and potential candidate , challenged the constitutionality of this law , claiming that it violated his rights under the Fourteenth and Seventeenth Amendments .
C ------------------------------------------------------------------ SUBROUTINE FANTALINCCR(DJI,DJK,ANGFACT,NNAT,XOBS,XTOLPROT, & NOMEFILE1,ERWPROT,ERRORE) C ------------------------------------------------------------------ C Handles the stuff for the calculation of CCR constant coefficient C C CX,CY,CZ(STRUCTURE,ATOMNUMBER) keep coordinates of nuclei C FX,FY,FZ(STRUCTURE,ATOMNUMBER) keep coordinates of metal C NAT is a vector with the number of atoms C OBS is a vector with the observed cross correlation rates C TOLPROT is a vector with the errors on CCR C NOMEFILE1 is the name of the file to save deviations C ERWPROT is a vector with the weights C ERRORE switches the use(1) of weights C C By Gabriele Cavallaro, Andrea Giachetti and Giacomo Parigi (2003) C ------------------------------------------------------------------ INCLUDE 'supccr.inc' INCLUDE 'fantaxplor.inc' INTEGER NNAT,METHOD DOUBLE PRECISION AK,A COMMON /CRUN/AK DOUBLE PRECISION DJI(1000),DJK(1000),ANGFACT(1000), & XOBS(1000),XTOLPROT(1000),ERWPROT(1000) CHARACTER NOMEFILE1*132 INTEGER ERRORE DO I=1,1000 AK1(I)=ANGFACT(I) RK1(I)=DJI(I) RK2(I)=DJK(I) END DO PRINT*,' ' PRINT*,'===---FANTACROSS---===' C ------------------------------------------------------------------ C IHP is the number of CCR C ------------------------------------------------------------------ NAT=NNAT IHP=NNAT NHP=NNAT PRINT*,'IHP is:',IHP C ------------------------------------------------------------------ C NFE is the number of paramagnetic centers C ------------------------------------------------------------------ NFE=1 NIA=0 C ------------------------------------------------------------------ C Reference system not active C ------------------------------------------------------------------ NSYSTEM=0 C ------------------------------------------------------------------ C Calculation is done on a single structure C ------------------------------------------------------------------ NSTR=1 C ------------------------------------------------------------------ C Errors are set to 0 C ------------------------------------------------------------------ PERC=0 C ------------------------------------------------------------------ C Grid setting C ------------------------------------------------------------------ NGRID=1 C ------------------------------------------------------------------ C Weights and multiplicity are set to 1 C ------------------------------------------------------------------ DO NIA=1,NAT MLPROT(NIA)=1 IF(ERRORE.EQ.0) THEN WPROT(NIA)=1 ELSE WPROT(NIA)=ERWPROT(NIA) END IF END DO OPEN(322,FILE='FANTACROSS.LOG') C ------------------------------------------------------------------ C Vectors are passed from Xplor-NIH core C ------------------------------------------------------------------ DO NIA=1,NAT OBS(NIA)=XOBS(NIA) C ------------------------------------------------------------------ C No tolerance in fitting C ------------------------------------------------------------------ TOLPROT(NIA)=0 END DO CLOSE (322) FILENAME3=NOMEFILE1 PRINT*,'NOMEFILE1 is:',NOMEFILE1 OPEN(744,FILE=FILENAME3) CALL CSIMPLEXRUN() RETURN END C ------------------------------------------------------------------ SUBROUTINE CSIMPLEXRUN() C ------------------------------------------------------------------ C Calculates the CCR constant coefficient which minimizes the C experimental-to-calculated squared difference C C By Gabriele Cavallaro, Andrea Giachetti and Giacomo Parigi (2003) C ------------------------------------------------------------------ INCLUDE 'supccr.inc' DIMENSION SIMP(MP,NP),EXTR(NP),VAL(MP) DIMENSION ZRR(3,3) OLDRESID=1.E+9 RESID=2.E+9 IVIOLATION=2000000 IOLDVIO=1000000 C ------------------------------------------------------------------ C Initial conditions grid C ------------------------------------------------------------------ DELTA=3.14159/DBLE(NGRID+1) DO 1000 L=1,NGRID DO 999 NK=1,NFE SIMP(1,(NK-1)*MPAR+1)=1000.*(1.-2*RAND()) 999 CONTINUE DO 10 I=1,MP DO 10 J=1,NP SIMP(I,J)=SIMP(1,J) IF (I.EQ.1) THEN SIMP(1,J)=SIMP(1,J)*0.8 ENDIF IF (I.EQ.J+1) THEN SIMP(I,J)=SIMP(I,J)/0.8*1.2 ENDIF 10 CONTINUE DO 11 I=1,MP DO 12 J=1,NP 12 EXTR(J)=SIMP(I,J) VAL(I)=CCASH(EXTR) 11 CONTINUE CALL CSIMPCALC(SIMP,VAL) C ------------------------------------------------------------------ C Criterion of minimization of optimal solution C ------------------------------------------------------------------ IF (OLDRESID.GE.RESID) THEN OLDRESID=RESID IOLDVIO=IVIOLATION DO 13 I=1,NFE OPTPHI(I)=PHI(I) 13 CONTINUE ENDIF 1000 CONTINUE DO 998 NK=1,NFE EXTR((NK-1)*MPAR+1)=OPTPHI(NK) 998 CONTINUE PRINT*,' ' WRITE(*,FMT='(1X,A)') ' ***** BEST SOLUTION *****' PRINT*,' ' WRITE(*,20) IOLDVIO,OLDRESID WRITE(*,21) (OPTPHI(I),I=1,NFE) WRITE(*,*) 'Value of K =',OPTPHI(1) WRITE(744,*) 'Value of K =',OPTPHI(1) 20 FORMAT (1X,' VIOLATIONS ',I6,1X,' RESIDUALS ',F10.3) 21 FORMAT (1X,'K = ',F15.3) ERR=CCASH(EXTR) CALL CDISPSHIFT RETURN END C ------------------------------------------------------------------ SUBROUTINE CSIMPCALC(P,Y) C ------------------------------------------------------------------ C Simplex calculation C C By Gabriele Cavallaro, Andrea Giachetti and Giacomo Parigi (2003) C ------------------------------------------------------------------ INCLUDE 'supccr.inc' INCLUDE 'fantaxplor.inc' PARAMETER (AL=1.,BE=.5,GA=2.) DIMENSION P(MP,NP),Y(MP),PR(MP),PT(MP),PE(MP), & PC(MP),PK(MP),PBAR(MP),OLDP(NP),EXTR(MP) C ------------------------------------------------------------------ C Algorithm initialization C ------------------------------------------------------------------ ITER=0 RNDOM=0 1 PERM=1 DO 1000 WHILE (PERM.GT.0) PERM=0 DO 1100 I=1,NP IF (Y(I).GT.Y(I+1)) THEN APP=Y(I+1) Y(I+1)=Y(I) Y(I)=APP DO 1200 J=1,NP APP=P(I+1,J) P(I+1,J)=P(I,J) P(I,J)=APP 1200 CONTINUE PERM=PERM+1 ENDIF 1100 CONTINUE 1000 CONTINUE AVERAGE=0 ASTDEV=0 DO 100 I=1,MP 100 AVERAGE=AVERAGE+Y(I) AVERAGE=AVERAGE/MP DO 101 I=1,MP 101 ASTDEV=ASTDEV+(Y(I)-AVERAGE)**2. ERR=DSQRT(ASTDEV/MP) RESID=Y(1) IF (ITER.GT.39999.OR.ERR.LT.1.D-9) THEN WRITE (*,200) ITER,IVIOLATION,RESID WRITE (*,201) (P(1,(I-1)*MPAR+5),I=1,NFE) 200 FORMAT (1X,'Iters ',I6,1X,' Violations ',I6, & 1X,'Residuals= ',F10.3) 201 FORMAT (1X,'K = ',F9.3) DO 997 NK=1,NFE PHI(NK)=P(1,(NK-1)*MPAR+1) 997 CONTINUE RETURN ENDIF ITER=ITER+1 DO 12 J=1,NP 12 PBAR(J)=0 DO 13 I=1,NP DO 13 J=1,NP 13 PBAR(J)=PBAR(J)+P(I,J) DO 14 J=1,NP PBAR(J)=PBAR(J)/NP PR(J)=(1.+AL)*PBAR(J)-AL*P(MP,J) 14 CONTINUE YR=CCASH(PR) DO 15 J=1,NP PK(J)=PR(J) 15 CONTINUE YK=YR IF (YR.LT.Y(NP)) THEN IF (YR.LT.Y(1)) THEN DO 16 J=1,NP PE(J)=GA*PR(J)+(1.-GA)*PBAR(J) 16 CONTINUE YE=CCASH(PE) ITER=ITER+1 IF (YE.LT.Y(1)) THEN DO 17 J=1,NP PK(J)=PE(J) 17 CONTINUE YK=YE ENDIF ENDIF ELSE DO 18 J=1,NP PT(J)=P(MP,J) 18 CONTINUE YT=Y(MP) IF (YR.LT.YT) THEN DO 19 J=1,NP PT(J)=PR(J) 19 CONTINUE YT=YR ENDIF DO 20 J=1,NP PC(J)=BE*PT(J)+(1.-BE)*PBAR(J) 20 CONTINUE YC=CCASH(PC) ITER=ITER+1 IF (YC.LT.Y(NP)) THEN DO 21 J=1,NP PK(J)=PC(J) 21 CONTINUE YK=YC ELSE DO 22 I=1,NP OLDP(I)=P(2,I) 22 CONTINUE DO 24 I=2,NP DO 23 J=1,NP P(I,J)=.5*(P(1,J)+P(I,J)) 23 CONTINUE PR(I)=P(I,I) Y(I)=CCASH(PR) 24 CONTINUE ITER=ITER+NP-1 DO 25 I=1,NP OLDP(I)=ABS(OLDP(I)-P(2,I)) 25 CONTINUE OLDPOPPA=0 DO 251 I=1,NP-1 OLDPOPPA=OLDPOPPA+OLDP(I) 251 CONTINUE IF (ABS(OLDPOPPA).LT.1.D-8.AND.RNDOM.LT.10) THEN RNDOM=RNDOM+1 WRITE(*,FMT='(BN,A,F16.6)') 'RANDOM ',Y(1) DO 2001 IL=1,MP DO 2002 IM=1,NP RMR=1+RAND() P(IL,IM)=P(IL,IM)*RMR 2002 CONTINUE 2001 CONTINUE DO 2011 IL=1,MP DO 2012 JM=1,NP 2012 EXTR(JM)=P(IL,JM) Y(IL)=CCASH(EXTR) 2011 CONTINUE GOTO 1 ENDIF IF (ABS(OLDPOPPA).LT.1.D-9) THEN ITER=50000 ENDIF DO 26 J=1,NP PK(J)=0.5*(P(1,J)+P(MP,J)) 26 CONTINUE YK=CCASH(PK) ITER=ITER+1 ENDIF ENDIF DO 27 J=1,NP P(MP,J)=PK(J) 27 CONTINUE Y(MP)=YK GOTO 1 END C ------------------------------------------------------------------ FUNCTION CCASH(VETT) C ------------------------------------------------------------------ C Calculation of deviations and violations C C By Gabriele Cavallaro, Andrea Giachetti and Giacomo Parigi (2003) C ------------------------------------------------------------------ INCLUDE 'supccr.inc' DIMENSION VETT(NP) INTEGER M1 IVIOLATION=0 TMP1=0 I=1 DO WHILE (I.LE.NHP*NSTR) CSHIFT(I)=0.0 I=I+1 ENDDO DO 1 N=1,NSTR DO 2 M=1,NFE P=VETT((M-1)*MPAR+1) TMP2=0.0 I=1 IHP=(N-1)*NHP DO 10 WHILE (I.LE.NHP) NPROTML=MLPROT(IHP+I) CSHIFT(IHP+I)=CSHIFT(IHP+I)+AK1(IHP+I)/(RK2(IHP+I)**3* & RK1(IHP+I)**3) I=I+1 10 CONTINUE 2 CONTINUE DO 3 I=1,NHP TMP2=ABS(CSHIFT(IHP+I)-OBS(IHP+I))-TOLPROT(IHP+I) IF (TMP2.GT.0.0) THEN IVIOLATION=IVIOLATION+1 TMP1=TMP1+TMP2**2*WPROT(IHP+I)/DBLE(MLPROT(IHP+I)) ENDIF 3 CONTINUE 1 CONTINUE CCASH=TMP1 RETURN END C ------------------------------------------------------------------ SUBROUTINE CDISPSHIFT C ------------------------------------------------------------------ C Display of violations C C By Gabriele Cavallaro, Andrea Giachetti and Giacomo Parigi (2003) C ------------------------------------------------------------------ INCLUDE 'supccr.inc' INCLUDE 'fantaxplor.inc' CHARACTER FILESTR*21,SS*40 DIMENSION VV(MAXSTR,MAXOS),VMAX(MAXOS),VMIN(MAXOS) RM=0 TMP1=0 SMED=0 STDEV=0 DO 2 I=1,NSTR DO 2 J=1,NHP TMP2=ABS(OBS(J+(I-1)*NHP)-CSHIFT(J+(I-1)*NHP))- & TOLPROT(J+(I-1)*NHP) IF (TMP2.GT.0.0) THEN IF (CSHIFT(J+(I-1)*NHP).GT.OBS(J+(I-1)*NHP)) THEN VV(I,J)=TMP2 ELSE VV(I,J)=-TMP2 ENDIF ELSE VV(I,J)=0. ENDIF 2 CONTINUE DO 44 I=1, NHP VMAX(I)=0. VMIN(I)=1000. 44 CONTINUE DO 4 J=1,NHP DO 4 I=1,NSTR IF (ABS(VV(I,J)).GT.ABS(VMAX(J))) THEN VMAX(J)=VV(I,J) ENDIF IF ((ABS(VV(I,J)).LT.ABS(VMIN(J))).AND.(VV(I,J).NE.0.)) THEN VMIN(J)=VV(I,J) ENDIF 4 CONTINUE DO 7 J=1,NHP DO 8 I=1,NSTR IF (ABS(VV(I,J)).GT.0.) THEN SS(I:I+1)="*" ELSE SS(I:I+1)=" " ENDIF 8 CONTINUE IF (VMIN(J).EQ.1000.) THEN VMIN(J)=0. ENDIF 7 CONTINUE WRITE(744,'(1X)') WRITE(744,'(1X)') WRITE(744,'(1X)') WRITE(744,'(1X,A)') & ' PROTONS OBS. CALC. ERR.^2' FILESTR='USELESS.FILE' NIA=0 REWIND(1) DO 3 J=1,NHP*NSTR TMP2=ABS(OBS(J)-CSHIFT(J))-TOLPROT(J) NIA=NIA+1 IF (TMP2.GT.0.0) THEN IVIOLATION=IVIOLATION+1 RM=RM+1 SMED=SMED+TMP2**2*WPROT(J)/MLPROT(J) TMP1=TMP2**2*WPROT(J)/MLPROT(J) WRITE (744,'(1X,A4,1X,A4,1X,A4,1X,F7.3,1X,F7.3,1X,F10.5)') & NRESIDFA(NIA),NRESFA(NIA),NTYPEFA(NIA), & OBS(J),CSHIFT(J),TMP1 15 FORMAT(1X,A,1X,F7.3,1X,F7.3,1X,F7.3) ELSE WRITE (744,'(1X,A4,1X,A4,1X,A4,1X,F7.3,1X,F7.3)') & NRESIDFA(NIA),NRESFA(NIA),NTYPEFA(NIA), & OBS(J),CSHIFT(J) ENDIF 3 CONTINUE SMED=SMED/RM DO 41 J=1,NHP*NSTR TMP2=ABS(OBS(J)-CSHIFT(J))-TOLPROT(J) IF (TMP2.GT.0.0) THEN STDEV=STDEV+(TMP2**2-MED)**2*WPROT(J)/MLPROT(J) ENDIF 41 CONTINUE STDEV=STDEV/RM PRINT*,' ' WRITE(744,'(A)') ' ' WRITE(*,11) 'Mean value of error =',SMED 11 FORMAT(1X,A,1X,F10.6) WRITE(744,12) 'Mean value of error =',SMED 12 FORMAT(1X,A,1X,F10.6) WRITE(*,13) 'Standard deviation =',STDEV 13 FORMAT(1X,A,1X,F10.6) WRITE(744,14) 'Standard deviation =',STDEV 14 FORMAT(1X,A,1X,F10.6) CLOSE(744) RETURN END
This earthstar has been used in traditional Chinese medicine as a hemostatic agent ; the spore dust is applied externally to stop wound bleeding and reduce chilblains . Two Indian forest tribes , the <unk> and the <unk> of Madhya Pradesh , have been reported to use the fruit bodies medicinally . The spore mass is blended with mustard seed oil , and used as a salve against burns . The Blackfoot of North America called the fungus " fallen stars " , considering them to be stars fallen to the earth during supernatural events .
Commissioned as a destroyer in 1919 , she undertook a number of patrol and training duties along the East Coast of the United States until being decommissioned in 1922 . Overhauled in 1931 , she returned to service with the United States Pacific Fleet on training and patrol for the next 10 years . She was present during the attack on Pearl Harbor , and following this she supported several operations during the war , laying minefields and sweeping for mines in the Pacific . Following the end of the war , she was sold for scrap in 1946 and broken up .
function matrix = rmAverageTime(matrix,nrep); % rmAverageTime - average non-unique epochs in time (1st) dimension % % out = rmAverageTime(in,nrep); % % 2006/03 SOD: wrote it. % sanity check (<1 no averaging needed) if nrep <= 1, return; else, matrixin = matrix; end; % get total size input sz = size(matrixin); % get total size output len = sz(1)./nrep; szout = sz; szout(1) = len; % initiate matrixout matrix = matrixin(1:len,:); % repeat (add) process start = len; for n=1:nrep-1, matrix = matrix + matrixin(start+1:start+len,:); start = start + len; end; % mean matrix = matrix ./ nrep; % reshape if necesary matrix = reshape(matrix,szout); return
[STATEMENT] lemma ts_ord_add_isor: "n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z" [PROOF STATE] proof (prove) goal (1 subgoal): 1. n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z [PROOF STEP] using n_add_op_def n_comm ts_ord_add_isol [PROOF STATE] proof (prove) using this: ?x \<oplus> ?y \<equiv> n (n ?x \<cdot> n ?y) n ?x \<cdot> n ?y = n ?y \<cdot> n ?x n ?x \<sqsubseteq> n ?y \<Longrightarrow> n ?z \<oplus> n ?x \<sqsubseteq> n ?z \<oplus> n ?y goal (1 subgoal): 1. n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z [PROOF STEP] by presburger
lemma limsup_root_limit': assumes "(\<lambda>n. root n (norm (f n))) \<longlonglongrightarrow> l" shows "limsup (\<lambda>n. ereal (root n (norm (f n)))) = ereal l"
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl ! This file was ported from Lean 3 source module logic.nonempty ! leanprover-community/mathlib commit d2d8742b0c21426362a9dacebc6005db895ca963 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.Logic.Basic /-! # Nonempty types > THIS FILE IS SYNCHRONIZED WITH MATHLIB4. > Any changes to this file require a corresponding PR to mathlib4. This file proves a few extra facts about `nonempty`, which is defined in core Lean. ## Main declarations * `nonempty.some`: Extracts a witness of nonemptiness using choice. Takes `nonempty α` explicitly. * `classical.arbitrary`: Extracts a witness of nonemptiness using choice. Takes `nonempty α` as an instance. -/ variable {α β : Type _} {γ : α → Type _} attribute [simp] instNonempty #print Zero.nonempty /- instance (priority := 20) Zero.nonempty [Zero α] : Nonempty α := ⟨0⟩ #align has_zero.nonempty Zero.nonempty -/ #print One.nonempty /- instance (priority := 20) One.nonempty [One α] : Nonempty α := ⟨1⟩ #align has_one.nonempty One.nonempty -/ #print exists_true_iff_nonempty /- theorem exists_true_iff_nonempty {α : Sort _} : (∃ a : α, True) ↔ Nonempty α := Iff.intro (fun ⟨a, _⟩ => ⟨a⟩) fun ⟨a⟩ => ⟨a, trivial⟩ #align exists_true_iff_nonempty exists_true_iff_nonempty -/ #print nonempty_Prop /- @[simp] theorem nonempty_Prop {p : Prop} : Nonempty p ↔ p := Iff.intro (fun ⟨h⟩ => h) fun h => ⟨h⟩ #align nonempty_Prop nonempty_Prop -/ #print not_nonempty_iff_imp_false /- theorem not_nonempty_iff_imp_false {α : Sort _} : ¬Nonempty α ↔ α → False := ⟨fun h a => h ⟨a⟩, fun h ⟨a⟩ => h a⟩ #align not_nonempty_iff_imp_false not_nonempty_iff_imp_false -/ #print nonempty_sigma /- @[simp] theorem nonempty_sigma : Nonempty (Σa : α, γ a) ↔ ∃ a : α, Nonempty (γ a) := Iff.intro (fun ⟨⟨a, c⟩⟩ => ⟨a, ⟨c⟩⟩) fun ⟨a, ⟨c⟩⟩ => ⟨⟨a, c⟩⟩ #align nonempty_sigma nonempty_sigma -/ /- warning: nonempty_psigma -> nonempty_psigma is a dubious translation: lean 3 declaration is forall {α : Sort.{u1}} {β : α -> Sort.{u2}}, Iff (Nonempty.{max 1 u1 u2} (PSigma.{u1, u2} α β)) (Exists.{u1} α (fun (a : α) => Nonempty.{u2} (β a))) but is expected to have type forall {α : Sort.{u2}} {β : α -> Sort.{u1}}, Iff (Nonempty.{max (max 1 u1) u2} (PSigma.{u2, u1} α β)) (Exists.{u2} α (fun (a : α) => Nonempty.{u1} (β a))) Case conversion may be inaccurate. Consider using '#align nonempty_psigma nonempty_psigmaₓ'. -/ @[simp] theorem nonempty_psigma {α} {β : α → Sort _} : Nonempty (PSigma β) ↔ ∃ a : α, Nonempty (β a) := Iff.intro (fun ⟨⟨a, c⟩⟩ => ⟨a, ⟨c⟩⟩) fun ⟨a, ⟨c⟩⟩ => ⟨⟨a, c⟩⟩ #align nonempty_psigma nonempty_psigma #print nonempty_subtype /- @[simp] theorem nonempty_subtype {α} {p : α → Prop} : Nonempty (Subtype p) ↔ ∃ a : α, p a := Iff.intro (fun ⟨⟨a, h⟩⟩ => ⟨a, h⟩) fun ⟨a, h⟩ => ⟨⟨a, h⟩⟩ #align nonempty_subtype nonempty_subtype -/ #print nonempty_prod /- @[simp] theorem nonempty_prod : Nonempty (α × β) ↔ Nonempty α ∧ Nonempty β := Iff.intro (fun ⟨⟨a, b⟩⟩ => ⟨⟨a⟩, ⟨b⟩⟩) fun ⟨⟨a⟩, ⟨b⟩⟩ => ⟨⟨a, b⟩⟩ #align nonempty_prod nonempty_prod -/ /- warning: nonempty_pprod -> nonempty_pprod is a dubious translation: lean 3 declaration is forall {α : Sort.{u1}} {β : Sort.{u2}}, Iff (Nonempty.{max 1 u1 u2} (PProd.{u1, u2} α β)) (And (Nonempty.{u1} α) (Nonempty.{u2} β)) but is expected to have type forall {α : Sort.{u2}} {β : Sort.{u1}}, Iff (Nonempty.{max (max 1 u1) u2} (PProd.{u2, u1} α β)) (And (Nonempty.{u2} α) (Nonempty.{u1} β)) Case conversion may be inaccurate. Consider using '#align nonempty_pprod nonempty_pprodₓ'. -/ @[simp] theorem nonempty_pprod {α β} : Nonempty (PProd α β) ↔ Nonempty α ∧ Nonempty β := Iff.intro (fun ⟨⟨a, b⟩⟩ => ⟨⟨a⟩, ⟨b⟩⟩) fun ⟨⟨a⟩, ⟨b⟩⟩ => ⟨⟨a, b⟩⟩ #align nonempty_pprod nonempty_pprod #print nonempty_sum /- @[simp] theorem nonempty_sum : Nonempty (Sum α β) ↔ Nonempty α ∨ Nonempty β := Iff.intro (fun ⟨h⟩ => match h with | Sum.inl a => Or.inl ⟨a⟩ | Sum.inr b => Or.inr ⟨b⟩) fun h => match h with | Or.inl ⟨a⟩ => ⟨Sum.inl a⟩ | Or.inr ⟨b⟩ => ⟨Sum.inr b⟩ #align nonempty_sum nonempty_sum -/ /- warning: nonempty_psum -> nonempty_psum is a dubious translation: lean 3 declaration is forall {α : Sort.{u1}} {β : Sort.{u2}}, Iff (Nonempty.{max 1 u1 u2} (PSum.{u1, u2} α β)) (Or (Nonempty.{u1} α) (Nonempty.{u2} β)) but is expected to have type forall {α : Sort.{u2}} {β : Sort.{u1}}, Iff (Nonempty.{max (max 1 u1) u2} (PSum.{u2, u1} α β)) (Or (Nonempty.{u2} α) (Nonempty.{u1} β)) Case conversion may be inaccurate. Consider using '#align nonempty_psum nonempty_psumₓ'. -/ @[simp] theorem nonempty_psum {α β} : Nonempty (PSum α β) ↔ Nonempty α ∨ Nonempty β := Iff.intro (fun ⟨h⟩ => match h with | PSum.inl a => Or.inl ⟨a⟩ | PSum.inr b => Or.inr ⟨b⟩) fun h => match h with | Or.inl ⟨a⟩ => ⟨PSum.inl a⟩ | Or.inr ⟨b⟩ => ⟨PSum.inr b⟩ #align nonempty_psum nonempty_psum @[simp] theorem nonempty_empty : ¬Nonempty Empty := fun ⟨h⟩ => h.elim #align nonempty_empty nonempty_empty /- warning: nonempty_ulift -> nonempty_ulift is a dubious translation: lean 3 declaration is forall {α : Type.{u1}}, Iff (Nonempty.{succ (max u1 u2)} (ULift.{u2, u1} α)) (Nonempty.{succ u1} α) but is expected to have type forall {α : Type.{u2}}, Iff (Nonempty.{max (succ u2) (succ u1)} (ULift.{u1, u2} α)) (Nonempty.{succ u2} α) Case conversion may be inaccurate. Consider using '#align nonempty_ulift nonempty_uliftₓ'. -/ @[simp] theorem nonempty_ulift : Nonempty (ULift α) ↔ Nonempty α := Iff.intro (fun ⟨⟨a⟩⟩ => ⟨a⟩) fun ⟨a⟩ => ⟨⟨a⟩⟩ #align nonempty_ulift nonempty_ulift #print nonempty_plift /- @[simp] theorem nonempty_plift {α} : Nonempty (PLift α) ↔ Nonempty α := Iff.intro (fun ⟨⟨a⟩⟩ => ⟨a⟩) fun ⟨a⟩ => ⟨⟨a⟩⟩ #align nonempty_plift nonempty_plift -/ #print Nonempty.forall /- @[simp] theorem Nonempty.forall {α} {p : Nonempty α → Prop} : (∀ h : Nonempty α, p h) ↔ ∀ a, p ⟨a⟩ := Iff.intro (fun h a => h _) fun h ⟨a⟩ => h _ #align nonempty.forall Nonempty.forall -/ #print Nonempty.exists /- @[simp] theorem Nonempty.exists {α} {p : Nonempty α → Prop} : (∃ h : Nonempty α, p h) ↔ ∃ a, p ⟨a⟩ := Iff.intro (fun ⟨⟨a⟩, h⟩ => ⟨a, h⟩) fun ⟨a, h⟩ => ⟨⟨a⟩, h⟩ #align nonempty.exists Nonempty.exists -/ #print Classical.inhabited_of_nonempty' /- /-- Using `classical.choice`, lifts a (`Prop`-valued) `nonempty` instance to a (`Type`-valued) `inhabited` instance. `classical.inhabited_of_nonempty` already exists, in `core/init/classical.lean`, but the assumption is not a type class argument, which makes it unsuitable for some applications. -/ noncomputable def Classical.inhabited_of_nonempty' {α} [h : Nonempty α] : Inhabited α := ⟨Classical.choice h⟩ #align classical.inhabited_of_nonempty' Classical.inhabited_of_nonempty' -/ #print Nonempty.some /- /-- Using `classical.choice`, extracts a term from a `nonempty` type. -/ @[reducible] protected noncomputable def Nonempty.some {α} (h : Nonempty α) : α := Classical.choice h #align nonempty.some Nonempty.some -/ #print Classical.arbitrary /- /-- Using `classical.choice`, extracts a term from a `nonempty` type. -/ @[reducible] protected noncomputable def Classical.arbitrary (α) [h : Nonempty α] : α := Classical.choice h #align classical.arbitrary Classical.arbitrary -/ /- warning: nonempty.map -> Nonempty.map is a dubious translation: lean 3 declaration is forall {α : Sort.{u1}} {β : Sort.{u2}}, (α -> β) -> (Nonempty.{u1} α) -> (Nonempty.{u2} β) but is expected to have type forall {α : Sort.{u2}} {β : Sort.{u1}}, (α -> β) -> (Nonempty.{u2} α) -> (Nonempty.{u1} β) Case conversion may be inaccurate. Consider using '#align nonempty.map Nonempty.mapₓ'. -/ /-- Given `f : α → β`, if `α` is nonempty then `β` is also nonempty. `nonempty` cannot be a `functor`, because `functor` is restricted to `Type`. -/ theorem Nonempty.map {α β} (f : α → β) : Nonempty α → Nonempty β | ⟨h⟩ => ⟨f h⟩ #align nonempty.map Nonempty.map /- warning: nonempty.map2 -> Nonempty.map2 is a dubious translation: lean 3 declaration is forall {α : Sort.{u1}} {β : Sort.{u2}} {γ : Sort.{u3}}, (α -> β -> γ) -> (Nonempty.{u1} α) -> (Nonempty.{u2} β) -> (Nonempty.{u3} γ) but is expected to have type forall {α : Sort.{u3}} {β : Sort.{u2}} {γ : Sort.{u1}}, (α -> β -> γ) -> (Nonempty.{u3} α) -> (Nonempty.{u2} β) -> (Nonempty.{u1} γ) Case conversion may be inaccurate. Consider using '#align nonempty.map2 Nonempty.map2ₓ'. -/ protected theorem Nonempty.map2 {α β γ : Sort _} (f : α → β → γ) : Nonempty α → Nonempty β → Nonempty γ | ⟨x⟩, ⟨y⟩ => ⟨f x y⟩ #align nonempty.map2 Nonempty.map2 /- warning: nonempty.congr -> Nonempty.congr is a dubious translation: lean 3 declaration is forall {α : Sort.{u1}} {β : Sort.{u2}}, (α -> β) -> (β -> α) -> (Iff (Nonempty.{u1} α) (Nonempty.{u2} β)) but is expected to have type forall {α : Sort.{u2}} {β : Sort.{u1}}, (α -> β) -> (β -> α) -> (Iff (Nonempty.{u2} α) (Nonempty.{u1} β)) Case conversion may be inaccurate. Consider using '#align nonempty.congr Nonempty.congrₓ'. -/ protected theorem Nonempty.congr {α β} (f : α → β) (g : β → α) : Nonempty α ↔ Nonempty β := ⟨Nonempty.map f, Nonempty.map g⟩ #align nonempty.congr Nonempty.congr #print Nonempty.elim_to_inhabited /- theorem Nonempty.elim_to_inhabited {α : Sort _} [h : Nonempty α] {p : Prop} (f : Inhabited α → p) : p := h.elim <| f ∘ Inhabited.mk #align nonempty.elim_to_inhabited Nonempty.elim_to_inhabited -/ instance {α β} [h : Nonempty α] [h2 : Nonempty β] : Nonempty (α × β) := h.elim fun g => h2.elim fun g2 => ⟨⟨g, g2⟩⟩ instance {ι : Sort _} {α : ι → Sort _} [∀ i, Nonempty (α i)] : Nonempty (∀ i, α i) := ⟨fun _ => Classical.arbitrary _⟩ /- warning: classical.nonempty_pi -> Classical.nonempty_pi is a dubious translation: lean 3 declaration is forall {ι : Sort.{u1}} {α : ι -> Sort.{u2}}, Iff (Nonempty.{imax u1 u2} (forall (i : ι), α i)) (forall (i : ι), Nonempty.{u2} (α i)) but is expected to have type forall {ι : Sort.{u2}} {α : ι -> Sort.{u1}}, Iff (Nonempty.{imax u2 u1} (forall (i : ι), α i)) (forall (i : ι), Nonempty.{u1} (α i)) Case conversion may be inaccurate. Consider using '#align classical.nonempty_pi Classical.nonempty_piₓ'. -/ theorem Classical.nonempty_pi {ι} {α : ι → Sort _} : Nonempty (∀ i, α i) ↔ ∀ i, Nonempty (α i) := ⟨fun ⟨f⟩ a => ⟨f a⟩, @Pi.nonempty _ _⟩ #align classical.nonempty_pi Classical.nonempty_pi #print subsingleton_of_not_nonempty /- theorem subsingleton_of_not_nonempty {α : Sort _} (h : ¬Nonempty α) : Subsingleton α := ⟨fun x => False.elim <| not_nonempty_iff_imp_false.mp h x⟩ #align subsingleton_of_not_nonempty subsingleton_of_not_nonempty -/ #print Function.Surjective.nonempty /- theorem Function.Surjective.nonempty {α β : Sort _} [h : Nonempty β] {f : α → β} (hf : Function.Surjective f) : Nonempty α := let ⟨y⟩ := h let ⟨x, hx⟩ := hf y ⟨x⟩ #align function.surjective.nonempty Function.Surjective.nonempty -/
State Before: M : Type u_1 N : Type ?u.25731 inst✝¹ : SeminormedAddCommGroup M inst✝ : SeminormedAddCommGroup N S : AddSubgroup M x : M ⧸ S ⊢ ‖x‖ = infDist 0 {m | ↑m = x} State After: no goals Tactic: simp only [AddSubgroup.quotient_norm_eq, infDist_eq_iInf, sInf_image', dist_zero_left]
If a set of points in the plane is affinely dependent, then there are two disjoint subsets of the set whose convex hulls intersect.
Symbol table '.symtab' contains 11 entries: Num: Value Size Type Bind Vis Ndx Name +[a-f0-9]+: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND +[a-f0-9]+: 0000000000402014 0 NOTYPE GLOBAL DEFAULT 3 non_initdummy +[a-f0-9]+: 0000000000402010 0 NOTYPE GLOBAL DEFAULT 2 initdummy +[a-f0-9]+: 0000000000400000 0 NOTYPE GLOBAL DEFAULT 1 __executable_start +[a-f0-9]+: 0000000000401000 0 NOTYPE GLOBAL DEFAULT 1 begin +[a-f0-9]+: 0000000000402012 0 NOTYPE GLOBAL DEFAULT 3 __bss_start +[a-f0-9]+: 0000000000402000 0 NOTYPE GLOBAL DEFAULT 2 Struct +[a-f0-9]+: 0000000000402011 0 NOTYPE GLOBAL DEFAULT 2 initializedVar +[a-f0-9]+: 0000000000402012 0 NOTYPE GLOBAL DEFAULT 2 _edata +[a-f0-9]+: 0000000000402018 0 NOTYPE GLOBAL DEFAULT 3 _end +[a-f0-9]+: 0000000000402015 0 NOTYPE GLOBAL DEFAULT 3 non_initialVar Hex dump of section '.data': 0x00402000 11204000 00000000 15204000 00000000 . @...... @..... 0x00402010 aa55 .U #pass
# 고유분해와 특이값 분해 정방 행렬 $A$에 대해 다음 식을 만족하는 단위 벡터 $v$, 스칼라 $\lambda$을 여러 개 찾을 수 있다. $$ Av = \lambda v $$ * $ A \in \mathbf{R}^{M \times M} $ * $ \lambda \in \mathbf{R} $ * $ v \in \mathbf{R}^{M} $ 이러한 실수 $\lambda$를 고유값(eigenvalue), 단위 벡터 $v$ 를 고유벡터(eigenvector) 라고 하며 고유값과 고유벡터를 찾는 작업을 고유분해(eigen-decomposition)라고 한다. $ A \in \mathbf{R}^{M \times M} $ 에 대해 최대 $M$개의 고유값-고유벡터 쌍이 존재할 수 있다. 예를 들어 다음 행렬 $A$ $$ A= \begin{bmatrix} 1 & -2 \\ 2 & -3 \end{bmatrix} $$ 에 대해 다음 단위 벡터와 스칼라 값은 고유벡터-고유값이 된다. $$\lambda = -1$$ $$ v= \begin{bmatrix} \dfrac{1}{\sqrt{2}} \\ \dfrac{1}{\sqrt{2}} \end{bmatrix} $$ 복수 개의 고유 벡터가 존재하는 경우에는 다음과 같이 고유벡터 행렬 $V$와 고유값 행렬 $\Lambda$로 표기할 수 있다. $$ A \left[ v_1 \cdots v_M \right] = \left[ \lambda_1 v_1 \cdots \lambda_M v_M \right] = \left[ v_1 \cdots v_M \right] \begin{bmatrix} \lambda_{1} & 0 & \cdots & 0 \\ 0 & \lambda_{2} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & \lambda_{M} \\ \end{bmatrix} $$ $$ AV = V\Lambda $$ 여기에서 $$ V = \left[ v_1 \cdots v_M \right] $$ $$ \Lambda = \begin{bmatrix} \lambda_{1} & 0 & \cdots & 0 \\ 0 & \lambda_{2} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & \lambda_{M} \\ \end{bmatrix} $$ numpy linalg 서브패키지에서는 고유값과 고유벡터를 구할 수 있는 `eig` 명령을 제공한다. ```python w, V = np.linalg.eig(np.array([[1, -2], [2, -3]])) ``` ```python w ``` array([-0.99999998, -1.00000002]) ```python V ``` array([[ 0.70710678, 0.70710678], [ 0.70710678, 0.70710678]]) ## 대칭 행렬의 고유 분해 행렬 $A$가 대칭(symmetric) 행렬이면 고유값 벡터 행렬 $V$는 다음과 같이 전치 행렬이 역행렬과 같아진다. $$ V^T V = V V^T = I$$ 이 때는 고유 분해가 다음과 같이 표시된다. $$ A = V\Lambda V^T = \sum_{i=1}^{M} {\lambda_i} v_i v_i^T$$ $$ A^{-1} = V \Lambda^{-1} V^T = \sum_{i=1}^{M} \dfrac{1}{\lambda_i} v_i v_i^T$$ ## 확률 변수의 좌표 변환 확률 변수의 공분산 행렬 $\Sigma$ 은 대칭 행렬이므로 위의 관계식이 성립한다. 따라서 다변수 가우시안 정규 분포의 확률 밀도 함수는 다음과 같이 표시할 수 있다. $$ \begin{eqnarray} \mathcal{N}(x \mid \mu, \Sigma) &=& \dfrac{1}{(2\pi)^{D/2} |\Sigma|^{1/2}} \exp \left( -\dfrac{1}{2} (x-\mu)^T \Sigma^{-1} (x-\mu) \right) \\ &=& \dfrac{1}{(2\pi)^{D/2} |\Sigma|^{1/2}} \exp \left( -\dfrac{1}{2} (x-\mu)^T V \Lambda^{-1} V^T (x-\mu) \right) \\ &=& \dfrac{1}{(2\pi)^{D/2} |\Sigma|^{1/2}} \exp \left( -\dfrac{1}{2} (V^T(x-\mu))^T \Lambda^{-1} (V^T (x-\mu)) \right) \\ \end{eqnarray} $$ 즉 변환 행렬 $V^T$로 좌표 변환하면 서로 독립인 성분들로 나누어진다. ```python mu = [2, 3] cov = [[2, 3],[3, 7]] rv = sp.stats.multivariate_normal(mu, cov) xx = np.linspace(0, 4, 120) yy = np.linspace(1, 5, 150) XX, YY = np.meshgrid(xx, yy) plt.grid(False) plt.contourf(XX, YY, rv.pdf(np.dstack([XX, YY]))) x1 = np.array([0, 2]) x1_mu = x1 - mu x2 = np.array([3, 4]) x2_mu = x2 - mu plt.plot(x1_mu[0] + mu[0], x1_mu[1] + mu[1], 'bo', ms=20) plt.plot(x2_mu[0] + mu[0], x2_mu[1] + mu[1], 'ro', ms=20) plt.axis("equal") plt.show() ``` ```python w, V = np.linalg.eig(cov) ``` ```python w ``` array([ 0.59487516, 8.40512484]) ```python V ``` array([[-0.90558942, -0.4241554 ], [ 0.4241554 , -0.90558942]]) ```python rv = sp.stats.multivariate_normal(mu, w) xx = np.linspace(0, 4, 120) yy = np.linspace(1, 5, 150) XX, YY = np.meshgrid(xx, yy) plt.grid(False) plt.contourf(XX, YY, rv.pdf(np.dstack([XX, YY]))) x1 = np.array([0, 2]) x1_mu = x1 - mu x2 = np.array([3, 4]) x2_mu = x2 - mu x1t_mu = V.T.dot(x1_mu) # 좌표 변환 x2t_mu = V.T.dot(x2_mu) # 좌표 변환 plt.plot(x1t_mu[0] + mu[0], x1t_mu[1] + mu[1], 'bo', ms=20) plt.plot(x2t_mu[0] + mu[0], x2t_mu[1] + mu[1], 'ro', ms=20) plt.axis("equal") plt.show() ``` ## 특이값 분해 정방 행렬이 아닌 행렬 $M$에 대해서도 고유 분해와 유사한 분해가 가능하다. 이를 특이값 분해(singular value decomposition)이라고 한다. * $M \in \mathbf{R}^{m \times n}$ $$M = U \Sigma V^T$$ 여기에서 * $U \in \mathbf{R}^{m \times m}$ * $\Sigma \in \mathbf{R}^{m \times n}$ * $V \in \mathbf{R}^{n \times n}$ 이고 행렬 $U$와 $V$는 다음 관계를 만족한다. $$ U^T U = UU^T = I $$ $$ V^T V = VV^T = I $$ 예를 들어 $$\mathbf{M} = \begin{bmatrix} 1 & 0 & 0 & 0 & 2 \\ 0 & 0 & 3 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 & 0 \end{bmatrix} $$ 에 대한 특이값 분해 결과는 다음과 같다. $$ \begin{align} \mathbf{U} &= \begin{bmatrix} 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & -1 \\ 0 & 1 & 0 & 0 \\ \end{bmatrix} \\ \boldsymbol{\Sigma} &= \begin{bmatrix} \sqrt{5} & 0 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \end{bmatrix} \\ \mathbf{V}^T &= \begin{bmatrix} 0 & 0 & \sqrt{0.2} & 0 & \sqrt{0.8} \\ 0 & 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & -\sqrt{0.8} & 0 & \sqrt{0.2} \\ 0 & 0 & 0 & 1 & 0 \\ \end{bmatrix} \end{align}$$ 이는 다음과 같이 확인 할 수 있다. $$\begin{align} \mathbf{U} \mathbf{U^T} &= \begin{bmatrix} 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & -1 \\ 0 & 1 & 0 & 0 \\ \end{bmatrix} \cdot \begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} = \mathbf{I}_4 \\ \mathbf{V} \mathbf{V^T} &= \begin{bmatrix} 0 & 0 & \sqrt{0.2} & 0 & \sqrt{0.8} \\ 0 & 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & -\sqrt{0.8} & 0 & \sqrt{0.2} \\ 0 & 0 & 0 & 1 & 0 \\ \end{bmatrix} \cdot \begin{bmatrix} 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ \sqrt{0.2} & 0 & 0 & -\sqrt{0.8} & 0\\ 0 & 0 & 0 & 0 & 1 \\ \sqrt{0.8} & 0 & 0 & \sqrt{0.2} & 0 \\ \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \end{bmatrix} = \mathbf{I}_5 \end{align}$$ ```python from pprint import pprint M = np.array([[1,0,0,0,0],[0,0,2,0,3],[0,0,0,0,0],[0,2,0,0,0]]) print("\nM:"); pprint(M) U, S0, V0 = np.linalg.svd(M, full_matrices=True) print("\nU:"); pprint(U) S = np.hstack([np.diag(S0), np.zeros(M.shape[0])[:, np.newaxis]]) print("\nS:"); pprint(S) print("\nV:"); pprint(V) V = V0.T print("\nU.dot(U.T):"); pprint(U.dot(U.T)) print("\nV.dot(V.T):"); pprint(V.dot(V.T)) print("\nU.dot(S).dot(V.T):"); pprint(U.dot(S).dot(V.T)) ``` M: array([[1, 0, 0, 0, 0], [0, 0, 2, 0, 3], [0, 0, 0, 0, 0], [0, 2, 0, 0, 0]]) U: array([[ 0., 0., 1., 0.], [ 1., 0., 0., 0.], [ 0., 0., 0., -1.], [ 0., 1., 0., 0.]]) S: array([[ 3.60555128, 0. , 0. , 0. , 0. ], [ 0. , 2. , 0. , 0. , 0. ], [ 0. , 0. , 1. , 0. , 0. ], [ 0. , 0. , 0. , 0. , 0. ]]) V: array([[-0. , -0. , 1. , 0. , 0. ], [ 0. , 1. , 0. , 0. , 0. ], [ 0.5547002 , 0. , 0. , -0.83205029, 0. ], [ 0. , 0. , 0. , 0. , 1. ], [ 0.83205029, 0. , 0. , 0.5547002 , 0. ]]) U.dot(U.T): array([[ 1., 0., 0., 0.], [ 0., 1., 0., 0.], [ 0., 0., 1., 0.], [ 0., 0., 0., 1.]]) V.dot(V.T): array([[ 1., 0., 0., 0., 0.], [ 0., 1., 0., 0., 0.], [ 0., 0., 1., 0., 0.], [ 0., 0., 0., 1., 0.], [ 0., 0., 0., 0., 1.]]) U.dot(S).dot(V.T): array([[ 1., 0., 0., 0., 0.], [ 0., 0., 2., 0., 3.], [ 0., 0., 0., 0., 0.], [ 0., 2., 0., 0., 0.]])
module Task.Equality import Task.Internal import Task.Semantics import Helpers %default total %access export -- Equivallence ---------------------------------------------------------------- equivallent : MonadRef l m => TaskT m a -> TaskT m a -> m Bool equivallent {a} t1 t2 = do t1' <- normalise t1 t2' <- normalise t2 v1 <- value t1' v2 <- value t2' let _ = eq a --NOTE: Brings `Eq` in scope for universe type `a` pure $ v1 == v2 -- Similarity ------------------------------------------------------------------ similar : MonadTrace NotApplicable m => MonadRef l m => TaskT m a -> TaskT m a -> m Bool similar {a} t1 t2 = do t1' <- normalise t1 t2' <- normalise t2 v1 <- value t1' v2 <- value t2' let _ = eq a --NOTE: Brings `Eq` in scope for universe type `a` if v1 == v2 then do ok12 <- sim t1 t2 ok21 <- sim t2 t1 pure $ ok12 && ok21 else pure False where sim : MonadTrace NotApplicable m => MonadRef l m => TaskT m a -> TaskT m a -> m Bool sim t1 t2 = do is1 <- inputs t1 is2 <- inputs t2 pairs <- sequence [ bisequence ( handle t1 i1, handle t2 i2 ) | i1 <- is1, i2 <- is2, i2 =~ i1 ] results <- sequence $ map (uncurry similar) pairs pure $ and results -- Conform ---------------------------------------------------------------------
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Data.Prod.Properties where open import Cubical.Core.Everything open import Cubical.Data.Prod.Base open import Cubical.Data.Sigma renaming (_×_ to _×Σ_) hiding (prodIso ; toProdIso ; curryIso) open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence private variable ℓ ℓ' : Level A : Type ℓ B : Type ℓ' -- Swapping is an equivalence ×≡ : {a b : A × B} → proj₁ a ≡ proj₁ b → proj₂ a ≡ proj₂ b → a ≡ b ×≡ {a = (a1 , b1)} {b = (a2 , b2)} id1 id2 i = (id1 i) , (id2 i) swap : A × B → B × A swap (x , y) = (y , x) swap-invol : (xy : A × B) → swap (swap xy) ≡ xy swap-invol (_ , _) = refl isEquivSwap : (A : Type ℓ) (B : Type ℓ') → isEquiv (λ (xy : A × B) → swap xy) isEquivSwap A B = isoToIsEquiv (iso swap swap swap-invol swap-invol) swapEquiv : (A : Type ℓ) (B : Type ℓ') → A × B ≃ B × A swapEquiv A B = (swap , isEquivSwap A B) swapEq : (A : Type ℓ) (B : Type ℓ') → A × B ≡ B × A swapEq A B = ua (swapEquiv A B) private open import Cubical.Data.Nat -- As × is defined as a datatype this computes as expected -- (i.e. "C-c C-n test1" reduces to (2 , 1)). If × is implemented -- using Sigma this would be "transp (λ i → swapEq ℕ ℕ i) i0 (1 , 2)" test : ℕ × ℕ test = transp (λ i → swapEq ℕ ℕ i) i0 (1 , 2) testrefl : test ≡ (2 , 1) testrefl = refl -- equivalence between the sigma-based definition and the inductive one A×B≃A×ΣB : A × B ≃ A ×Σ B A×B≃A×ΣB = isoToEquiv (iso (λ { (a , b) → (a , b)}) (λ { (a , b) → (a , b)}) (λ _ → refl) (λ { (a , b) → refl })) A×B≡A×ΣB : A × B ≡ A ×Σ B A×B≡A×ΣB = ua A×B≃A×ΣB -- truncation for products isOfHLevelProd : (n : HLevel) → isOfHLevel n A → isOfHLevel n B → isOfHLevel n (A × B) isOfHLevelProd {A = A} {B = B} n h1 h2 = let h : isOfHLevel n (A ×Σ B) h = isOfHLevelΣ n h1 (λ _ → h2) in transport (λ i → isOfHLevel n (A×B≡A×ΣB {A = A} {B = B} (~ i))) h ×-≃ : ∀ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} {A : Type ℓ₁} {B : Type ℓ₂} {C : Type ℓ₃} {D : Type ℓ₄} → A ≃ C → B ≃ D → A × B ≃ C × D ×-≃ {A = A} {B = B} {C = C} {D = D} f g = isoToEquiv (iso φ ψ η ε) where φ : A × B → C × D φ (a , b) = equivFun f a , equivFun g b ψ : C × D → A × B ψ (c , d) = equivFun (invEquiv f) c , equivFun (invEquiv g) d η : section φ ψ η (c , d) i = retEq f c i , retEq g d i ε : retract φ ψ ε (a , b) i = secEq f a i , secEq g b i {- Some simple ismorphisms -} prodIso : ∀ {ℓ ℓ' ℓ'' ℓ'''} {A : Type ℓ} {B : Type ℓ'} {C : Type ℓ''} {D : Type ℓ'''} → Iso A C → Iso B D → Iso (A × B) (C × D) Iso.fun (prodIso iAC iBD) (a , b) = (Iso.fun iAC a) , Iso.fun iBD b Iso.inv (prodIso iAC iBD) (c , d) = (Iso.inv iAC c) , Iso.inv iBD d Iso.rightInv (prodIso iAC iBD) (c , d) = ×≡ (Iso.rightInv iAC c) (Iso.rightInv iBD d) Iso.leftInv (prodIso iAC iBD) (a , b) = ×≡ (Iso.leftInv iAC a) (Iso.leftInv iBD b) toProdIso : ∀ {ℓ ℓ' ℓ''} {A : Type ℓ} {B : Type ℓ'} {C : Type ℓ''} → Iso (A → B × C) ((A → B) × (A → C)) Iso.fun toProdIso = λ f → (λ a → proj₁ (f a)) , (λ a → proj₂ (f a)) Iso.inv toProdIso (f , g) = λ a → (f a) , (g a) Iso.rightInv toProdIso (f , g) = refl Iso.leftInv toProdIso b = funExt λ a → sym (×-η _) curryIso : ∀ {ℓ ℓ' ℓ''} {A : Type ℓ} {B : Type ℓ'} {C : Type ℓ''} → Iso (A × B → C) (A → B → C) Iso.fun curryIso f a b = f (a , b) Iso.inv curryIso f (a , b) = f a b Iso.rightInv curryIso a = refl Iso.leftInv curryIso f = funExt λ {(a , b) → refl}
Load LFindLoad. From lfind Require Import LFind. From QuickChick Require Import QuickChick. From adtind Require Import goal33. Derive Show for natural. Derive Arbitrary for natural. Instance Dec_Eq_natural : Dec_Eq natural. Proof. dec_eq. Qed. Lemma conj18eqsynthconj5 : forall (lv0 : natural) (lv1 : natural) (lv2 : natural), (@eq natural (plus (plus lv0 lv1) lv2) (plus lv1 (plus lv0 lv2))). Admitted. QuickChick conj18eqsynthconj5.
""" Perform necessary preprocessing of features in CSV files, subset data as necessary based on values of target (quantity sold) and write resulting dataset to date-partitioned Parquet dataset in AWS s3 bucket. Copyright (c) 2021 Sasha Kapralov Licensed under the MIT License (see LICENSE for details) ------------------------------------------------------------ Usage: run from the command line as such: # Get a list of CSV files (as a preliminary check) python create_parquet_from_csvs.py list 15-07 # Run full code with 10000 chunksize, 50% sampling rate, and subsetting # dataset to quantity sold values greater than 0 python create_parquet_from_csvs.py process 15-10 -s 10000 -b gt0 -f 0.5 """ import argparse import datetime import json import logging import os from pathlib import Path import platform import sys import time import awswrangler as wr import boto3 from botocore.exceptions import ClientError from dateutil.relativedelta import relativedelta from ec2_metadata import ec2_metadata import numpy as np import pandas as pd from sklearn.preprocessing import OrdinalEncoder s3_client = boto3.client("s3") # in addition to Prefix=, can also use: # StartAfter (string) -- StartAfter is where you want Amazon S3 to start listing from. # Amazon S3 starts listing after this specified key. StartAfter can be any key in the bucket. # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.list_objects_v2 # (keys are like 'shops15_10.csv') def list_csvs(bucket="my-rds-exports", prefix="shops", first_mon=""): """List CSV files in S3 bucket. Parameters: ----------- bucket : str S3 bucket containing CSV files (default: 'my-rds-exports') prefix : str Prefix of CSV file name (S3 key) (default: 'shops') first_mon : str First month of CSV data to be included in output (default: '', which produces a list of all files) Returns: -------- csv_list : list List of CSV file names (S3 keys) """ try: csv_list = [ key["Key"] for key in s3_client.list_objects_v2( Bucket=bucket, Prefix=prefix, StartAfter=first_mon )["Contents"] ] return csv_list except ClientError: logging.exception( "Exception occurred during execution of list_csvs() function." ) sys.exit(1) def preprocess_chunk(df, null_col_dict, index, cat_col_name_dict): """Perform necessary preprocessing steps on each chunk of CSV data. Parameters: ----------- df : DataFrame Chunk of CSV data null_col_dict : dict Dictionary of columns that have null values in CSVs, with their data types that need to be assigned after nulls are filled with 0's index : int Chunk counter cat_col_name_dict : dict Dictionary of categorical columns (identified using uint8 data type), with keys being original column names and values being same names with 'cat_#_' prefix (e.g., cat_1_..., cat_2_..., etc.) Returns: -------- Dataframe with preprocessed features Dictionary mapping original categorical column names to names with cat_#_ prefix """ # drop string columns, quantity sold columns that include quantity from current day, # and row identification columns (shop, item, date) # also drop sid_coef_var_price, which cannot be reliably constructed for test data cols_to_drop = ( [ "i_item_category_id", "id_item_category_id", "sid_item_category_id", "i_item_cat_grouped_by_game_console", "i_item_category_name", "i_item_name", "s_city", "s_shop_name", "sid_coef_var_price", ] + [ col for col in df.columns if col.endswith("_qty_sold_day") and col != "sid_shop_item_qty_sold_day" ] + ["d_day_total_qty_sold"] # + ["shop_id", "item_id", "sale_date"] ) # errors='ignore' is added to suppress error when sid_coef_var_price is not found # among existing labels df.drop(cols_to_drop, axis=1, inplace=True, errors="ignore") # fill columns with null values and change data type from float to the type # previously determined for each column for col, dtype_str in null_col_dict.items(): # sid_shop_item_qty_sold_day is already dropped above, so it can be excluded # from this step if ( not col.endswith("_qty_sold_day") or col == "sid_shop_item_qty_sold_day" ) and col != "sid_coef_var_price": df[col].fillna(0, inplace=True) df[col] = df[col].astype(dtype_str) # fix data type of some columns df["d_modern_education_share"] = df["d_modern_education_share"].apply( lambda x: float(x.replace(",", ".")) ) df["d_old_education_build_share"] = df["d_old_education_build_share"].apply( lambda x: float(x.replace(",", ".")) ) # replace previously missed negative infinity value in one of the columns df["id_cat_qty_sold_per_item_last_7d"] = df[ "id_cat_qty_sold_per_item_last_7d" ].replace(-np.inf, 0) # replace previously missed infinity values with 0s in one of the columns df["sid_shop_item_expanding_adi"] = df[ "sid_shop_item_expanding_adi" ].replace([-np.inf, np.inf], 0) # cast to int the column that was for some reason cast to float in PostgreSQL df["id_num_unique_shops_prior_to_day"] = df[ "id_num_unique_shops_prior_to_day" ].astype("int16") broad_cats = [ "Аксессуары", "Кино", "Служебные", "Программы", "Музыка", "PC", "Подарки", "Игровые", "Элементы", "Доставка", "Билеты", "Карты", "Игры", "Чистые", "Книги", ] mons_of_first_sale = [x for x in range(13)] years = [2013, 2014, 2015] dow = [x for x in range(7)] months = [x for x in range(12)] quarters = [x for x in range(1, 5)] cat_col_names = [ "i_item_category_broad", "i_item_mon_of_first_sale", "d_year", "d_day_of_week", "d_month", "d_quarter_of_year", "d_week_of_year", ] df = pd.concat( [ df.drop(cat_col_names, axis=1,), ordinal_encode( df[cat_col_names].copy(), broad_cats, mons_of_first_sale, years, dow, months, quarters, ), ], axis=1, ) # check each chunk for infinity values and stop script if any values are found if df[df.isin([np.inf, -np.inf])].count().any(): cts = df[df.isin([np.inf, -np.inf])].count().to_dict() non_zero_cts = {k: v for k, v in cts.items() if v > 0} logging.debug( f"Chunk {index} has columns with infinity values: " f"{non_zero_cts}" ) sys.exit(1) # rename columns with uint8 type to start with 'cat_#_' prefix if cat_col_name_dict is None: cat_col_name_dict = { col: f"cat_{i}_{col}" for i, col in enumerate(df.columns, 1) if col in df.select_dtypes("uint8").columns } df.rename( cat_col_name_dict, axis=1, inplace=True, ) return df, cat_col_name_dict def ordinal_encode(df, broad_cats, mons_of_first_sale, years, dow, months, quarters): enc = OrdinalEncoder( categories=[ broad_cats, mons_of_first_sale, years, dow, months, quarters, [x for x in range(1, 54)], # for d_week_of_year ], dtype="uint8", ) # convert category types to uint8/16 df["i_item_mon_of_first_sale"] = df["i_item_mon_of_first_sale"].astype("uint8") df["d_year"] = df["d_year"].astype("uint16") cat_cols = enc.fit_transform(df) cat_cols_df = pd.DataFrame(cat_cols, columns=df.columns, index=df.index) return cat_cols_df def save_to_parquet( bucket="my-rds-exports", chunksize=1000, first_mon="", subset="", frac=1.0, ): """. Parameters: ----------- bucket : str S3 bucket containing CSV data (default: 'my-rds-exports') chunksize : int Number of rows to include in each iteration of read_csv() (default: 1000) first_mon : str First month of CSV data included in PCA (all, if '' (default)) subset : str Optional, used to subset dataset to desired range of target values frac : float Fraction of rows to sample from CSVs (default: 1.0) Returns: -------- None """ csv_list = list_csvs(first_mon=first_mon) assert isinstance(csv_list, list), f"csv_list is not a list, but {type(csv_list)}!" with open("./features/pd_types_from_psql_mapping.json", "r") as f: pd_types = json.load(f) del pd_types["sale_date"] # remove sale_date as it will be included in parse_dates= # change types of integer columns to floats (float32) for columns that contain nulls # change the dictionary values, while also extracting the key-value pairs and # putting them into a separate dictionary to pass to the preprocess_chunk function # so columns can be changed to appropriate types after null values are filled. null_col_dict = dict() null_col_list = [ "sid_shop_cat_qty_sold_last_7d", "sid_cat_sold_at_shop_before_day_flag", "sid_shop_item_rolling_7d_max_qty", "sid_shop_item_rolling_7d_min_qty", "sid_shop_item_rolling_7d_avg_qty", "sid_shop_item_rolling_7d_mode_qty", "sid_shop_item_rolling_7d_median_qty", "sid_shop_item_expand_qty_max", "sid_shop_item_expand_qty_mean", "sid_shop_item_expand_qty_min", "sid_shop_item_expand_qty_mode", "sid_shop_item_expand_qty_median", "sid_shop_item_date_avg_gap_bw_sales", "sid_shop_item_date_max_gap_bw_sales", "sid_shop_item_date_min_gap_bw_sales", "sid_shop_item_date_mode_gap_bw_sales", "sid_shop_item_date_median_gap_bw_sales", "sid_shop_item_date_std_gap_bw_sales", "sid_shop_item_cnt_sale_dts_last_7d", "sid_shop_item_cnt_sale_dts_last_30d", "sid_shop_item_cnt_sale_dts_before_day", "sid_expand_cv2_of_qty", "sid_shop_item_days_since_first_sale", "sid_days_since_max_qty_sold", "sid_shop_item_qty_sold_day", "sid_shop_item_first_month", "sid_shop_item_last_qty_sold", "sid_shop_item_first_week", "sid_shop_item_expanding_adi", "sid_shop_item_date_diff_bw_last_and_prev_qty", "sid_shop_item_days_since_prev_sale", "sid_shop_item_qty_sold_7d_ago", "sid_qty_median_abs_dev", "sid_coef_var_price", "sid_shop_item_qty_sold_2d_ago", "sid_qty_mean_abs_dev", "sid_shop_item_qty_sold_1d_ago", "sid_shop_item_qty_sold_3d_ago", ] for col in null_col_list: # these 3 columns have nulls, but they will need to be set to uint8 # after nulls are filled, not to their signed data type if col in [ "sid_cat_sold_at_shop_before_day_flag", "sid_shop_item_first_month", "sid_shop_item_first_week", ]: null_col_dict[col] = "uint8" else: null_col_dict[col] = pd_types[col] pd_types[col] = "float32" # change types of binary features to 'uint8' # do not include the three sid_ features in bin_features here, but add them to the # null_col_dict dictionary with uint8 type, which will change the type to uint8 # after null values are filled in bin_features = ( "d_holiday", "d_is_weekend", "d_major_event", "d_ps4_game_release_dt", "d_ps4_game_release_dt_plus_2", "i_digital_item", "id_item_first_month", "id_item_first_week", "id_item_had_spike_before_day", "s_online_store", "sd_shop_first_month", "sd_shop_first_week", ) pd_types = {k: "uint8" if k in bin_features else v for k, v in pd_types.items()} start_time = current_time = time.perf_counter() processed_data = None overall_shape = (0, None) shape_list = list() cat_col_name_dict = None s3_path = f"s3://sales-demand-data/parquet_dataset_w_cat_cols_{subset}/" types_map = { "int64": "bigint", "int32": "int", "int16": "smallint", "float32": "float", "float64": "float", "uint8": "smallint", } for csv_file in csv_list: csv_body = s3_client.get_object(Bucket=bucket, Key=csv_file).get("Body") for index, chunk in enumerate( pd.read_csv( csv_body, chunksize=chunksize, dtype=pd_types, parse_dates=["sale_date"] ), ): if index == 0: logging.debug( f"Columns in DF converted from CSV: {list(enumerate(chunk.columns))}" ) if index % 100 == 0: print( f"current index is {index} and current time is " f"{datetime.datetime.strftime(datetime.datetime.now(), format='%Y-%m-%d %H:%M:%S')}" ) print( f"elapsed time since last check (in secs): {round(time.perf_counter() - current_time, 2)}" ) print( f"total elapsed time (in secs): {round(time.perf_counter() - start_time, 2)}" ) current_time = time.perf_counter() # try: if subset == "gt0": chunk = chunk[chunk.sid_shop_item_qty_sold_day > 0] elif subset == "gt0_lt6": chunk = chunk[ (chunk.sid_shop_item_qty_sold_day > 0) & (chunk.sid_shop_item_qty_sold_day < 6) ] if chunk.shape[0] == 0: continue preprocessed_chunk, cat_col_name_dict = preprocess_chunk( chunk.sample(frac=frac, random_state=42).sort_values( by=["shop_id", "item_id", "sale_date"] ), null_col_dict, index, cat_col_name_dict, ) # except ValueError: # unique_dict = {col: chunk[col].unique() for col in chunk.columns} # logging.debug( # f"Unique values in chunk that produced ValueError: {unique_dict}" # ) # sys.exit(1) if processed_data is None: processed_data = preprocessed_chunk else: processed_data = pd.concat([processed_data, preprocessed_chunk], axis=0) shape_list.append(preprocessed_chunk.shape) if processed_data.memory_usage(deep=True).sum() > 100_000_000: # upload dataframe to S3 # as a parquet dataset dtype_dict = { k: types_map[v] for k, v in processed_data.dtypes.map(str).to_dict().items() if v != 'datetime64[ns]' } wr.s3.to_parquet( df=processed_data, path=s3_path, index=False, dataset=True, mode="append", partition_cols=["sale_date"], # https://docs.aws.amazon.com/athena/latest/ug/data-types.html dtype=dtype_dict, ) # also update combined shape of preprocessed data overall_shape = ( overall_shape[0] + processed_data.shape[0], processed_data.shape[1], ) # also, reset processed_data to None processed_data = None if processed_data is not None: # upload dataframe to S3 # as a parquet dataset dtype_dict = { k: types_map[v] for k, v in processed_data.dtypes.map(str).to_dict().items() if v != 'datetime64[ns]' } wr.s3.to_parquet( df=processed_data, path=s3_path, index=False, dataset=True, mode="append", partition_cols=["sale_date"], # https://docs.aws.amazon.com/athena/latest/ug/data-types.html dtype=dtype_dict, ) # also update combined shape of preprocessed data overall_shape = ( overall_shape[0] + processed_data.shape[0], processed_data.shape[1], ) print(f"Final shape of preprocessed data: {overall_shape}") shape_arr = np.array(shape_list) print(f"Size of shape_arr: {shape_arr.shape}") if np.max(shape_arr[:, 1]) != np.min(shape_arr[:, 1]): logging.debug("Different chunks have different counts of columns!!!") if (np.sum(shape_arr[:, 0]), np.min(shape_arr[:, 1])) != overall_shape: logging.debug( "Final shape of preprocessed data does not " "match the combined shape of individual chunks!!!" ) def valid_date(s): """Convert command-line date argument to YY-MM datetime value. Parameters: ----------- s : str Command-line argument for first month of data to be used Returns: -------- Datetime.datetime object (format: %y-%m) Raises: ------- ArgumentTypeError if input string cannot be parsed according to %y-%m strptime format """ try: return datetime.datetime.strptime(s, "%y-%m") except ValueError: msg = f"Not a valid date: {s}." raise argparse.ArgumentTypeError(msg) def valid_frac(s): """Convert command-line fraction argument to float value. Parameters: ----------- s : str Command-line argument for fraction of rows to sample Returns: -------- float Raises: ------- ArgumentTypeError if input string cannot be converted to float or if the resulting float is a negative value """ try: f = float(s) except ValueError: msg = f"Not a valid fraction value: {s}. Enter a value between 0.0 and 1.0." raise argparse.ArgumentTypeError(msg) else: if f < 0: msg = f"{f} is an invalid positive float value. Enter a value between 0.0 and 1.0." raise argparse.ArgumentTypeError(msg) return f def main(): parser = argparse.ArgumentParser() parser.add_argument( "command", metavar="<command>", help="'list' or 'process'", ) parser.add_argument( "startmonth", metavar="<startmonth>", help="first (earliest) month of data to be used, format: YY-MM", type=valid_date, ) parser.add_argument( "--chunksize", "-s", help="chunksize (number of rows) for read_csv(), default is 1,000", default="1000", type=int, ) parser.add_argument( "--subset", "-b", help="how to subset the data based on value of target (sid_shop_item_qty_sold_day)", choices=["gt0", "gt0_lt6"], ) parser.add_argument( "--frac", "-f", help="fraction of rows to sample (default is 1.0 if omitted)", default="1.0", type=valid_frac, ) args = parser.parse_args() if args.command not in ["list", "process"]: print("'{}' is not recognized. " "Use 'list' or 'process'".format(args.command)) else: fmt = "%(name)-12s : %(asctime)s %(levelname)-8s %(lineno)-7d %(message)s" datefmt = "%Y-%m-%d %H:%M:%S" log_dir = Path.cwd().joinpath("logs") path = Path(log_dir) path.mkdir(exist_ok=True) curr_dt_time = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M") log_fname = f"logging_{curr_dt_time}_{args.command}.log" log_path = log_dir.joinpath(log_fname) logging.basicConfig( level=logging.DEBUG, filemode="w", format=fmt, datefmt=datefmt, filename=log_path, ) # statements to suppress irrelevant logging by boto3-related libraries logging.getLogger("boto3").setLevel(logging.CRITICAL) logging.getLogger("botocore").setLevel(logging.CRITICAL) logging.getLogger("s3transfer").setLevel(logging.CRITICAL) logging.getLogger("urllib3").setLevel(logging.CRITICAL) logging.getLogger("awswrangler").setLevel(logging.DEBUG) # Check if code is being run on EC2 instance (vs locally) my_user = os.environ.get("USER") is_aws = True if "ec2" in my_user else False # Log EC2 instance name and type metadata if is_aws: instance_metadata = dict() instance_metadata["EC2 instance ID"] = ec2_metadata.instance_id instance_metadata["EC2 instance type"] = ec2_metadata.instance_type instance_metadata[ "EC2 instance public hostname" ] = ec2_metadata.public_hostname f = lambda x: ": ".join(x) r = list(map(f, list(instance_metadata.items()))) nl = "\n" + " " * 55 logging.info( f"Script is running on EC2 instance with the following metadata: " f"{nl}{nl.join(r)}" ) else: logging.info("Script is running on local machine, not on EC2 instance.") logging.info(f"The Python version is {platform.python_version()}.") logging.info(f"The pandas version is {pd.__version__}.") logging.info(f"The numpy version is {np.__version__}.") if args.command == "list": d_prev_mon = args.startmonth - relativedelta(months=1) first_mon = ( "shops_" + datetime.datetime.strftime(d_prev_mon, format="%y_%m") + "_addl" + ".csv" ) logging.info( f"Running list function with first_month: {args.startmonth}..." ) print(list_csvs(first_mon=first_mon)) elif args.command == "process": d_prev_mon = args.startmonth - relativedelta(months=1) first_mon = ( "shops_" + datetime.datetime.strftime(d_prev_mon, format="%y_%m") + "_addl" + ".csv" ) logging.info( f"Running process function with chunksize: {args.chunksize}, " f"first_month: {args.startmonth}, subset value: {args.subset}, " f"frac: {args.frac}..." ) save_to_parquet( chunksize=args.chunksize, first_mon=first_mon, subset=args.subset, frac=args.frac, ) # copy log file to S3 bucket try: s3_client.upload_file( f"./logs/{log_fname}", "my-ec2-logs", log_fname ) except ClientError: logging.exception("Log file was not copied to S3.") if __name__ == "__main__": main()
# ***Introduction to Radar Using Python and MATLAB*** ## Andy Harrison - Copyright (C) 2019 Artech House <br/> # Power Aperture Product *** Referring to Equation 4.54 \begin{equation}\label{eq:radar_equation_search_final} {SNR}_o = \frac{P_{av}\, A_e\, \sigma }{(4\pi)^3\, k\, T_0\, F\, L\, r^4} \, \frac{T_{scan}}{\Omega}, \end{equation} $P_{av}\, A_e$ is the power aperture product and is a useful measure of performance for search and surveillance type radar systems. *** Begin by getting the library path ```python import lib_path ``` Set the minimum and maximum target range (m) ```python target_min_range = 10e3 target_max_range = 100e3 ``` Import the `linspace` routine from `scipy` and set up the target range array ```python from numpy import linspace target_range = linspace(target_min_range, target_max_range, 2000) ``` Set the noise figure (dB), the radar losses (dB), the target RCS (dBsm), the signal to noise ration (dB), the system temperature (K), the search volume (sr), and the scan time (s) ```python from scipy.constants import pi noise_figure = 4.0 losses = 9.0 target_rcs = -5.0 signal_to_noise = 23.0 system_temperature = 305 search_volume = 2.0 * pi scan_time = 0.1 ``` Set up the keyword args ```python kwargs = {'target_range': target_range, 'system_temperature': system_temperature, 'search_volume': search_volume, 'noise_factor': 10 ** (noise_figure / 10.0), 'losses': 10 ** (losses / 10.0), 'signal_to_noise': 10 ** (signal_to_noise / 10.0), 'scan_time': scan_time, 'target_rcs': 10 ** (target_rcs / 10.0)} ``` Import the `power_aperture` routine from `search_radar_range` ```python from Libs.radar_range.search_radar_range import power_aperture ``` Calculate the power aperture product ```python power_aperture = power_aperture(**kwargs) ``` Import the `matplotlib` routines and the `log10` routine for plotting the power aperture product ```python from matplotlib import pyplot as plt from numpy import log10 ``` Display the results ```python # Set the figure size plt.rcParams["figure.figsize"] = (15, 10) # Display the results plt.plot(target_range / 1.0e3, 10.0 * log10(power_aperture), '') # Set the plot title and labels plt.title('Power Aperture Product', size=14) plt.xlabel('Target Range (km)', size=14) plt.ylabel('Power Aperture (dB)', size=14) # Set the tick label size plt.tick_params(labelsize=12) # Turn on the grid plt.grid(linestyle=':', linewidth=0.5) ```
""" setnexproperty!(nid::NexID, property::Symbol, val) Set property of a Nextion object given by it's NexID # Example: `setnexproperty!(NexID("t0"), :txt, "Hello!")` send and execute on the Nextion display `t0.txt="Hello"` `setnexproperty!(NexID("n0"), :val, 3)` send and execute on the Nextion display `n0.val=3` """ function setnexproperty!(nid::NexID, property::Symbol, val::String) _name = String(Name(nid)) _property = String(property) cmd = "$_name.$_property=\"$val\"" nexSerial = NexSerial(nid) send(nexSerial, cmd) end function setnexproperty!(nid::NexID, property::Symbol, val::Bool) if val val = 1 else val = 0 end setnexproperty!(nid, property, val) end function setnexproperty!(nid::NexID, property::Symbol, val) _name = String(Name(nid)) _property = String(property) cmd = "$_name.$_property=$val" nexSerial = NexSerial(nid) send(nexSerial, cmd) end """ getnexproperty(nid::NexID, property::Symbol) Get property of a Nextion object given by it's NexID """ function getnexproperty(nid::NexID, property::Symbol, ::Type{T}) where {T<:Unsigned} # send cmd to Nextion _name = String(Name(nid)) _property = String(property) cmd = "get $_name.$_property" @info cmd nexSerial = NexSerial(nid) send(nexSerial, cmd) # wait cmd completed timeout_ms = nexSerial.timeout_ms sp = nexSerial._serial waitcommandcomplete(sp, timeout_ms) # receive Nextion message #r = my_readuntil(sp, v_uint8_eoc, timeout_ms) nb, r = sp_blocking_read(sp.ref, my_bytesavailable(sp), timeout_ms) @info r evt = Event.NumberHeadEvent(r) evt.value end function getnexproperty(nid::NexID, property::Symbol, ::Type{T}) where {T<:Signed} value = getnexproperty(nid, property, Unsigned) reinterpret(Int32, value) # two's complement for UInt32 to Int32 end function getnexproperty(nid::NexID, property::Symbol, ::Type{String}) # send cmd to Nextion _name = String(Name(nid)) _property = String(property) cmd = "get $_name.$_property" @info cmd nexSerial = NexSerial(nid) send(nexSerial, cmd) # wait cmd completed timeout_ms = nexSerial.timeout_ms sp = nexSerial._serial waitcommandcomplete(sp, timeout_ms) # receive Nextion message #r = my_readuntil(sp, v_uint8_eoc, timeout_ms) nb, r = sp_blocking_read(sp.ref, my_bytesavailable(sp), timeout_ms) @info r evt = Event.StringHeadEvent(r) evt.value end
" There 's Got to Be a Way " ( 12 " remix )
import set_theory.cardinal import fol import completeness import Rings.Notation import Rings.ToMathlib.fol noncomputable theory namespace fol open_locale cardinal variables {L : Language} lemma realize_lift_bounded_term (M : Structure L) {n} : Π {l} (t : bounded_preterm L n l) (xs : dvector M n) (v : dvector M l) (a : M), realize_bounded_term (dvector.cons a xs) (t ↑ 1) v = realize_bounded_term xs t v | _ (bd_var k) _ _ _ := begin have hle : 0 ≤ (k : ℕ) := nat.zero_le _, dsimp [lift_bounded_term], rw [if_pos hle], congr', end | _ (bd_func f) _ _ _ := by { dsimp only [lift_bounded_term], simp } | _ (bd_app t s) xs v _ := begin dsimp only [lift_bounded_term], simp only [lift_bounded_term_at, realize_bounded_term_bd_app], have hinds := realize_lift_bounded_term s xs, rw hinds, have hind := realize_lift_bounded_term t xs (dvector.cons (realize_bounded_term xs s dvector.nil) v), rw hind, end /-- The formula that will give rise to a witness for function symbols -/ abbreviation wit_bd_func {n : ℕ} (f : L.functions n) (xs : dvector L.constants n) : bounded_formula L 1 := bd_apps (bd_func f) (dvector.map bd_const xs) ≃ x_ 0 -- /-- The formula that will give rise to a witness for terms -/ -- abbreviation wit_bd_preterm {n l} (t : bounded_preterm L n l) (v : dvector ) : -- bounded_preformula L (n+1) l := bd_equal (lift_bounded_term1 t) x_ 0 /-- The formula that will give rise to a witness for terms -/ abbreviation wit_bd_term (t : bounded_term L 0) : bounded_formula L 1 := (lift_bounded_term1 t : bounded_term L 1) ≃ x_ 0 variables (T : Theory L) [hcompl : fact (is_complete T)] include hcompl -- namespace is_complete -- def M : Structure L := classical.some $ (model_existence _).1 hcompl.1.1 -- def hM0 : nonempty (M T) := (classical.some_spec $ (model_existence _).1 hcompl.1.1).1 -- def hMT : (M T) ⊨ T := (classical.some_spec $ (model_existence _).1 hcompl.1.1).2 -- end is_complete instance equality_of_constants : setoid L.constants := { r := λ c d, (bd_const c ≃ bd_const d) ∈ T, iseqv := begin have hconsis := hcompl.1.1, have hcompl1 := hcompl.1, obtain ⟨ M , hM0 , hMT ⟩ := (model_existence _).1 hconsis, repeat {split}, { intro c, apply or.resolve_right (hcompl1.2 (bd_const c ≃ bd_const c)), intro hmem, specialize hMT hmem, apply hMT, simp }, { intros c d hcd, apply or.resolve_right (hcompl1.2 (bd_const d ≃ bd_const c)), intro hmem, apply hMT hmem, specialize hMT hcd, simp only [realize_sentence_equal, realize_closed_term] at hMT, simp [hMT] }, { intros c d e hcd hde, apply or.resolve_right (hcompl1.2 (bd_const c ≃ bd_const e)), intro hmem, apply hMT hmem, have Hcd := hMT hcd, have Hde := hMT hde, simp only [realize_sentence_equal, realize_closed_term] at Hcd Hde, simp [Hcd, Hde] }, end } namespace bounded_model_of_infinite_model variables (T) def model_carrier := @quotient L.constants (@fol.equality_of_constants _ T _) variables [hwit : fact (has_enough_constants T)] include hwit def w : bounded_formula L 1 → L.constants := classical.some hwit.1 lemma hw : ∀ (f : bounded_formula L 1), T ⊢' (∃' f) ⟹ f[bd_const ((w T) f) /0] := classical.some_spec hwit.1 variable {T} lemma all_realize_wit_of_mem (ϕ : bounded_formula L 1) : (∃' ϕ) ∈ T → T ⊨ ϕ[bd_const (w T ϕ) /0] := begin intro hmem, have hTϕ := hw T ϕ, rw completeness at hTϕ, intros M hM0 hMT, exact hTϕ hM0 hMT (hMT hmem), end variable (T) /-- The action of a function symbol on the set of constant symbols is given by the witness property: if `xs` is a list of constant symbols then we take the formula `∃ v, f(xs) = v ∈ T`. The witness property gives us `c : L.constants` such that `f(xs) = c ∈ T`. Proving these formulas are in `T` repeatedly uses completeness and (hence) consistency of `T`. -/ abbreviation fun_map_on_L_constants {n : ℕ} (f : L.functions n) (xs : dvector L.constants n) : L.constants := w T (wit_bd_func f xs) lemma fun_map_on_L_constants_all_realize_sentence {n : ℕ} (f : L.functions n) (xs : dvector L.constants n) : T ⊨ (wit_bd_func f xs)[bd_const (w T (wit_bd_func f xs)) /0] := begin obtain ⟨ M , hM0 , hMT ⟩ := (model_existence _).1 hcompl.1.1, set x := realize_bounded_term (dvector.nil : dvector M 0) (bd_apps (bd_func f) (dvector.map bd_const xs)) dvector.nil with hx, apply all_realize_wit_of_mem, apply or.resolve_right (hcompl.1.2 _), intro hmem, have hbot := hMT hmem, simp only [realize_bounded_term, realize_sentence_not, realize_bounded_formula, realize_sentence_ex, dvector.nth, fin.val_zero', not_exists] at hbot, apply hbot x, simpa [realize_bounded_term_bd_apps, hx], end lemma bd_func_on_L_constants_mem {n : ℕ} (f : L.functions n) (xs : dvector L.constants n) : -- T ⊨ (wit_bd_func f xs)[bd_const (w T (wit_bd_func f xs)) /0] → ((bd_apps (bd_func f) (dvector.map bd_const xs)) ≃ (bd_const (w T (wit_bd_func f xs)))) ∈ T := begin obtain ⟨ M , hM0 , hMT ⟩ := (model_existence _).1 hcompl.1.1, apply or.resolve_right (hcompl.1.2 _), intro hmem, have hbot := hMT hmem, apply hbot, simp [realize_sentence_equal, realize_closed_term, bd_const, realize_bounded_term_bd_apps], have hMϕ := fun_map_on_L_constants_all_realize_sentence T f xs hM0 hMT, simp [realize_subst_formula0] at hMϕ, -- cannot fix convert hMϕ, simp [bd_const, realize_bounded_term_bd_apps], end /-- The map on functions uses choice twice, once to find representatives from the quotient terms, once to find constant a symbol using witness property / henkin / enough constants (since `fol.bounded_model_of_infinite_model.w` uses choice) -/ def fun_map_on_M : Π {n : ℕ}, L.functions n → dvector (model_carrier T) n → model_carrier T := λ n f xs, quotient.mk (fun_map_on_L_constants T f (dvector.map quotient.out xs)) variable [L.is_algebraic] def model : Structure L := { carrier := model_carrier T, fun_map := λ _, fun_map_on_M T, rel_map := λ _ r, false.elim $ Language.is_algebraic.empty_relations _ r } lemma realize_term_all_realize_sentence (t : bounded_term L 0) : T ⊨ (wit_bd_term t)[bd_const (w T (wit_bd_term t)) /0] := begin apply all_realize_wit_of_mem, obtain ⟨ M , hM0 , hMT ⟩ := (model_existence _).1 hcompl.1.1, apply or.resolve_right (hcompl.1.2 _), intro hmem, apply hMT hmem, simp only [realize_bounded_formula, lift_bounded_term1, realize_bounded_term, realize_bounded_formula_ex, dvector.nth, fin.val_zero'], use (realize_closed_term M t), rw realize_lift_bounded_term, end -- lemma realize_bounded_term {n l} (xs : dvector (model T) n) (t : bounded_preterm L n l) -- (v : dvector (model T) l) : -- realize_bounded_term xs t v -- = realize_closed_term (model T) (bd_const (w T (wit_bd_term t))) := lemma realize_term' (t : bounded_term L 0) : realize_closed_term (model T) t = realize_closed_term (model T) (bd_const (w T (wit_bd_term t))) := begin sorry -- let ϕ := (lift_bounded_term1 t : bounded_term L 1) ≃ -- x_ 0, -- have hex : (∃' ϕ) ∈ T, -- { -- obtain ⟨ M , hM0 , hMT ⟩ := (model_existence _).1 hcompl.1.1, -- apply or.resolve_right (hcompl.1.2 _), -- intro hmem, -- apply hMT hmem, -- simp only [realize_bounded_formula, lift_bounded_term1, -- realize_bounded_term, realize_bounded_formula_ex, dvector.nth, fin.val_zero'], -- use (realize_closed_term M t), -- rw realize_lift_bounded_term }, -- use w T ϕ, -- simp only [realize_closed_term], -- have hTϕ := all_realize_wit_of_mem ϕ hex, -- cases t with k, -- { apply fin_zero_elim k }, -- { -- simp [bd_const], -- sorry -- }, -- {sorry}, end lemma realize_sentence_iff (ϕ : sentence L) : model T ⊨ ϕ ↔ ϕ ∈ T := begin obtain ⟨ M , hM0 , hMT ⟩ := (model_existence _).1 hcompl.1.1, cases ϕ, { simp only [false_of_satisfied_false, false_iff], intro hbot, apply hMT hbot }, { simp [realize_sentence_equal, realize_closed_term], sorry }, { sorry }, { sorry }, { sorry }, { sorry }, end lemma all_realize_sentence : model T ⊨ T := begin obtain ⟨ M , hM0 , hMT ⟩ := (model_existence _).1 hcompl.1.1, intro ϕ, cases ϕ, { intro hbot, exfalso, apply hMT hbot }, { intro hmem, sorry }, { sorry }, { sorry }, { sorry }, { sorry }, end lemma cardinality : #(model T) ≤ #L.constants := sorry end bounded_model_of_infinite_model /-- If a theory `T` is complete (i.e. maximal) and consistent then `T` has a model `M` with `#M ≤ |constant symbols of the language|` -/ theorem bounded_model_of_infinite_model [hwit : fact (has_enough_constants T)] [L.is_algebraic] : ∃ M : Structure L, nonempty M ∧ M ⊨ T ∧ #M ≤ #L.constants := ⟨ bounded_model_of_infinite_model.model T, sorry, bounded_model_of_infinite_model.all_realize_sentence T , bounded_model_of_infinite_model.cardinality T ⟩ #check Language.constants end fol
import Lean4Axiomatic.Rational.Core import Lean4Axiomatic.Rational.Impl.Fraction.Naive namespace Lean4Axiomatic.Rational.Impl open Logic (AP) open Relation.Equivalence (EqvOp) open Signed (Negative Positive Positivity) /-! ## (True) Fractions With the knowledge gained from the attempt at naive fractions, we can now make formal fractions that have the right constraints to be useful as rational numbers. -/ /-- A formal fraction of signed values, where the denominator must be positive. As explored in `Fraction.Naive`, we must at least constrain the denominator to be nonzero if we want to have a useful definition of fractions. We go a bit further than that here, and require a positive denominator, because it simplifies the definition of positive and negative for fractions: only the sign of the numerator matters. The `denominator_positive` field is defined with square brackets so that it becomes an instance parameter in `Fraction`'s constructor, allowing Lean to automatically fill it in. Otherwise it would frequently require tedious bookkeeping to manage. One way to think about values of this type is that they represent a "frozen" or "unevaluated" division operation between two numbers. If we represent a value of this type as the expression `n//d`, where `n` is the numerator and `d` is the denominator, then informally the division concept says `(n//d) * d ≃ n`. Another viewpoint, also described in the section on naive fractions, is that a fraction is a numeric value (the numerator) which is at a certain "size" or "scale" given by the denominator. Using the simple case of integer fractions, a scale of `1` corresponds with ordinary integers; a scale of `2` means that a numerator of `2` is the same size as the ordinary integer `1`; and in general we have `n//n ≃ 1`. Integers at the same scale can be added directly (`a//n + b//n ≃ (a + b)//n`), and this is what motivates the definition of addition for fractions. -/ structure Fraction (α : Type) [EqvOp α] [OfNat α 0] [Positivity.Ops α] : Type := numerator : α denominator : α [denominator_positive : AP (Positive denominator)] infix:90 "//" => Fraction.mk namespace Fraction /-- The naive representation of this fraction. This simply drops the positive requirement for the denominator. Mainly good for reusing naive fraction definitions that still work for true fractions. -/ def naive {α : Type} [EqvOp α] [OfNat α 0] [Positivity.Ops α] : Fraction α → Naive.Fraction α | a//b => Naive.Fraction.mk a b /-- Lift a naive fraction to a true fraction, if its denominator is positive. -/ def from_naive {α : Type} [EqvOp α] [OfNat α 0] [Positivity.Ops α] (p : Naive.Fraction α) : Positive p.denominator → Fraction α := by revert p; intro (Naive.Fraction.mk pn pd) (_ : Positive pd) have : AP (Positive pd) := AP.mk ‹Positive pd› exact pn//pd variable {ℕ : Type} [Natural ℕ] variable {ℤ : Type} [Integer (ℕ := ℕ) ℤ] /-- Equivalence relation on formal fractions of integers. See `Naive.eqv` for more explanation. -/ def eqv (p q : Fraction ℤ) : Prop := Naive.eqv p.naive q.naive instance equivalence_ops : Equivalence.Ops (Fraction ℤ) := { eqv := eqv } /-- Fraction equivalence is reflexive. -/ theorem eqv_refl {p : Fraction ℤ} : p ≃ p := Naive.eqv_refl (p := p.naive) /-- Fraction equivalence is symmetric. -/ theorem eqv_symm {p q : Fraction ℤ} : p ≃ q → q ≃ p := Naive.eqv_symm (p := p.naive) (q := q.naive) /-- Fraction equivalence is transitive. -/ theorem eqv_trans {p q r : Fraction ℤ} : p ≃ q → q ≃ r → p ≃ r := let qd := q.denominator have : Positive qd := q.denominator_positive.ev have : Positive qd ∨ Negative qd := Or.inl this have : Integer.Nonzero qd := Integer.nonzero_iff_pos_or_neg.mpr this have : qd ≄ 0 := Integer.nonzero_iff_neqv_zero.mp this Naive.eqv_trans_nonzero_denom (p := p.naive) (q := q.naive) (r := r.naive) ‹qd ≄ 0› instance equivalence_props : Equivalence.Props (Fraction ℤ) := { eqv_refl := eqv_refl eqv_symm := eqv_symm eqv_trans := eqv_trans } instance equivalence : Equivalence (Fraction ℤ) := {} /-- Replacing the numerator of a fraction with an equivalent value gives an equivalent result. **Property intuition**: This must be true for fractions to be a useful data structure. **Proof intuition**: Expand the definition of equivalence; use substitution of integer multiplication. -/ theorem substN {a₁ a₂ b : ℤ} [AP (Positive b)] : a₁ ≃ a₂ → a₁//b ≃ a₂//b := by intro (_ : a₁ ≃ a₂) show a₁//b ≃ a₂//b show a₁ * b ≃ a₂ * b exact AA.substL ‹a₁ ≃ a₂› /-- Replacing the denominator of a fraction with an equivalent value gives an equivalent result. **Property intuition**: This must be true for fractions to be a useful data structure. **Proof intuition**: Expand the definition of equivalence; use substitution of integer multiplication. -/ theorem substD {a b₁ b₂ : ℤ} [pb₁ : AP (Positive b₁)] [pb₂ : AP (Positive b₂)] : b₁ ≃ b₂ → a//b₁ ≃ a//b₂ := by intro (_ : b₁ ≃ b₂) show a//b₁ ≃ a//b₂ show a * b₂ ≃ a * b₁ exact AA.substR (Rel.symm ‹b₁ ≃ b₂›) /-- Every integer can be represented as a fraction. **Intuition**: Dividing by `1` leaves the input unchanged. Or, a denominator of `1` means that every unit of the numerator is the same "size" as the integer `1`. -/ def from_integer : ℤ → Fraction ℤ := (·//1) instance conversion_ops : Conversion.Ops (ℤ := ℤ) (Fraction ℤ) := { from_integer := from_integer } /-- Equivalent integers are converted to equivalent integer fractions. **Property intuition**: This must be true if we want integer fractions to be a superset of the integers. **Proof intuition**: The denominators are identical, so the result follows from the equivalence of the numerators. -/ theorem from_integer_subst {a₁ a₂ : ℤ} : a₁ ≃ a₂ → from_integer a₁ ≃ from_integer a₂ := by intro (_ : a₁ ≃ a₂) show from_integer a₁ ≃ from_integer a₂ show a₁//1 ≃ a₂//1 exact substN ‹a₁ ≃ a₂› /-- Equivalent converted fractions came from the same integer. **Property intuition**: Every integer must have a unique representation as an integer fraction. **Proof intuition**: Expand the hypothesis into an equivalence on integers. Cancel the common factor to obtain the result. -/ theorem from_integer_inject {a₁ a₂ : ℤ} : from_integer a₁ ≃ from_integer a₂ → a₁ ≃ a₂ := by intro (_ : from_integer a₁ ≃ from_integer a₂) show a₁ ≃ a₂ have : a₁//1 ≃ a₂//1 := ‹from_integer a₁ ≃ from_integer a₂› have : a₁ * 1 ≃ a₂ * 1 := this have : a₁ ≃ a₂ := AA.cancelRC (C := (· ≄ 0)) Integer.one_neqv_zero this exact this instance conversion_props : Conversion.Props (Fraction ℤ) := { from_integer_subst := from_integer_subst from_integer_inject := from_integer_inject } instance conversion : Conversion (ℤ := ℤ) (Fraction ℤ) := { toOps := conversion_ops toProps := conversion_props } instance core : Core (ℤ := ℤ) (Fraction ℤ) := { toEquivalence := equivalence toConversion := conversion } /-- Fractions are equivalent to zero exactly when their numerators are. **Property intuition**: The numerator of a fraction is the integer value that is "scaled down" by the denominator. So the fraction should represent zero only when its numerator is zero, and vice versa. **Proof intuition**: In both directions, expand equivalence between fractions into equivalence between integers. The goals follow easily from integer facts. -/ theorem eqv_zero_iff_numerator_eqv_zero {p : Fraction ℤ} : p ≃ 0 ↔ p.numerator ≃ 0 := by revert p; intro (pn//pd) apply Iff.intro case mp => intro (_ : pn//pd ≃ 0) show pn ≃ 0 have : pn//pd ≃ 0//1 := ‹pn//pd ≃ 0› have : pn * 1 ≃ 0 * pd := ‹pn//pd ≃ 0//1› calc pn ≃ _ := Rel.symm AA.identR pn * 1 ≃ _ := ‹pn * 1 ≃ 0 * pd› 0 * pd ≃ _ := AA.absorbL 0 ≃ _ := Rel.refl case mpr => intro (_ : pn ≃ 0) show pn//pd ≃ 0 show pn//pd ≃ 0//1 show pn * 1 ≃ 0 * pd calc pn * 1 ≃ _ := AA.identR pn ≃ _ := ‹pn ≃ 0› 0 ≃ _ := Rel.symm AA.absorbL 0 * pd ≃ _ := Rel.refl /-- An integer fraction that's not equivalent to zero has a nonzero numerator. This lemma is helpful for saving a few steps in proofs. **Property and proof intuition**: Follows directly from integer fractions being zero iff their numerators are. -/ theorem nonzero_numerator (p : Fraction ℤ) [AP (p ≄ 0)] : Integer.Nonzero p.numerator := by revert p; intro (a//b) (_ : AP (a//b ≄ 0)) have : a ≃ 0 → a//b ≃ 0 := (eqv_zero_iff_numerator_eqv_zero (p := a//b)).mpr have : a ≄ 0 := mt this ‹AP (a//b ≄ 0)›.ev have : Integer.Nonzero a := Integer.nonzero_iff_neqv_zero.mpr this exact this /-- Fractions are equivalent to one exactly when their numerators and denominators are equivalent. **Property intuition**: The denominator of a fraction denotes what the quantity of the numerator must be for the fraction to be equivalent to one, and that's exactly what this property expresses. **Proof intuition**: In both directions, expand equivalence between fractions into equivalence between integers. The goals follow easily from integer facts. -/ theorem eqv_one_iff_numer_eqv_denom {p : Fraction ℤ} : p ≃ 1 ↔ p.numerator ≃ p.denominator := by revert p; intro (pn//pd) apply Iff.intro case mp => intro (_ : pn//pd ≃ 1) show pn ≃ pd have : pn//pd ≃ 1//1 := ‹pn//pd ≃ 1//1› have : pn * 1 ≃ 1 * pd := ‹pn//pd ≃ 1//1› calc pn ≃ _ := Rel.symm AA.identR pn * 1 ≃ _ := ‹pn * 1 ≃ 1 * pd› 1 * pd ≃ _ := AA.identL pd ≃ _ := Rel.refl case mpr => intro (_ : pn ≃ pd) show pn//pd ≃ 1 show pn//pd ≃ 1//1 show pn * 1 ≃ 1 * pd calc pn * 1 ≃ _ := AA.substL ‹pn ≃ pd› pd * 1 ≃ _ := AA.comm 1 * pd ≃ _ := Rel.refl end Lean4Axiomatic.Rational.Impl.Fraction
r=359.50 https://sandbox.dams.library.ucdavis.edu/fcrepo/rest/collection/sherry-lehmann/catalogs/d7cg6m/media/images/d7cg6m-002/svc:tesseract/full/full/359.50/default.jpg Accept:application/hocr+xml
{-# OPTIONS --prop --without-K --rewriting #-} module Calf.Types.Unit where open import Calf.Prelude open import Calf.Metalanguage open import Data.Unit public using (⊤) renaming (tt to triv) unit : tp pos unit = U (meta ⊤)
%% logicRemoveInterior % Below is a demonstration of the features of the |logicRemoveInterior| function %% clear; close all; clc; %% Syntax % |[Lb]=logicRemoveInterior(L);| %% Description % UNDOCUMENTED %% Examples % %% % % <<gibbVerySmall.gif>> % % _*GIBBON*_ % <www.gibboncode.org> % % _Kevin Mattheus Moerman_, <[email protected]> %% % _*GIBBON footer text*_ % % License: <https://github.com/gibbonCode/GIBBON/blob/master/LICENSE> % % GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for % image segmentation, image-based modeling, meshing, and finite element % analysis. % % Copyright (C) 2006-2022 Kevin Mattheus Moerman and the GIBBON contributors % % This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
\title{Operatial Amplifier Topology Repository for use with Python} \author{Steven K Armour} \maketitle <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Premise" data-toc-modified-id="Premise-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Premise</a></span></li><li><span><a href="#Libarys" data-toc-modified-id="Libarys-2"><span class="toc-item-num">2&nbsp;&nbsp;</span>Libarys</a></span></li><li><span><a href="#Setup" data-toc-modified-id="Setup-3"><span class="toc-item-num">3&nbsp;&nbsp;</span>Setup</a></span></li><li><span><a href="#Ideal-OpAmp" data-toc-modified-id="Ideal-OpAmp-4"><span class="toc-item-num">4&nbsp;&nbsp;</span>Ideal OpAmp</a></span></li><li><span><a href="#TestBench" data-toc-modified-id="TestBench-5"><span class="toc-item-num">5&nbsp;&nbsp;</span>TestBench</a></span></li><li><span><a href="#Buffer" data-toc-modified-id="Buffer-6"><span class="toc-item-num">6&nbsp;&nbsp;</span>Buffer</a></span></li><li><span><a href="#Inverting" data-toc-modified-id="Inverting-7"><span class="toc-item-num">7&nbsp;&nbsp;</span>Inverting</a></span></li><li><span><a href="#Noninverting" data-toc-modified-id="Noninverting-8"><span class="toc-item-num">8&nbsp;&nbsp;</span>Noninverting</a></span></li><li><span><a href="#Miller-Capactive-Integrator" data-toc-modified-id="Miller-Capactive-Integrator-9"><span class="toc-item-num">9&nbsp;&nbsp;</span>Miller Capactive Integrator</a></span></li><li><span><a href="#Miller-Inductive-Integrator" data-toc-modified-id="Miller-Inductive-Integrator-10"><span class="toc-item-num">10&nbsp;&nbsp;</span>Miller Inductive Integrator</a></span></li><li><span><a href="#Low-Pass-1Pole" data-toc-modified-id="Low-Pass-1Pole-11"><span class="toc-item-num">11&nbsp;&nbsp;</span>Low Pass 1Pole</a></span></li><li><span><a href="#Miller-Capacitive-Differentiator" data-toc-modified-id="Miller-Capacitive-Differentiator-12"><span class="toc-item-num">12&nbsp;&nbsp;</span>Miller Capacitive Differentiator</a></span></li><li><span><a href="#Miller-Inductive-Differentiator" data-toc-modified-id="Miller-Inductive-Differentiator-13"><span class="toc-item-num">13&nbsp;&nbsp;</span>Miller Inductive Differentiator</a></span></li><li><span><a href="#High-Pass-1Zero" data-toc-modified-id="High-Pass-1Zero-14"><span class="toc-item-num">14&nbsp;&nbsp;</span>High Pass 1Zero</a></span></li><li><span><a href="#AllPass-(Phase)-Filter" data-toc-modified-id="AllPass-(Phase)-Filter-15"><span class="toc-item-num">15&nbsp;&nbsp;</span>AllPass (Phase) Filter</a></span><ul class="toc-item"><li><span><a href="#First-Order-Cap-First" data-toc-modified-id="First-Order-Cap-First-15.1"><span class="toc-item-num">15.1&nbsp;&nbsp;</span>First Order Cap First</a></span></li><li><span><a href="#First-Order-Cap-Second" data-toc-modified-id="First-Order-Cap-Second-15.2"><span class="toc-item-num">15.2&nbsp;&nbsp;</span>First Order Cap Second</a></span></li></ul></li><li><span><a href="#Sallen-Key-Filter" data-toc-modified-id="Sallen-Key-Filter-16"><span class="toc-item-num">16&nbsp;&nbsp;</span>Sallen-Key Filter</a></span><ul class="toc-item"><li><span><a href="#Low-Pass-with-Voltage-Gain" data-toc-modified-id="Low-Pass-with-Voltage-Gain-16.1"><span class="toc-item-num">16.1&nbsp;&nbsp;</span>Low Pass with Voltage Gain</a></span></li><li><span><a href="#Band-Pass-with-Voltage-Gain" data-toc-modified-id="Band-Pass-with-Voltage-Gain-16.2"><span class="toc-item-num">16.2&nbsp;&nbsp;</span>Band Pass with Voltage Gain</a></span></li><li><span><a href="#HIgh-Pass-with-Voltage-Gain" data-toc-modified-id="HIgh-Pass-with-Voltage-Gain-16.3"><span class="toc-item-num">16.3&nbsp;&nbsp;</span>HIgh Pass with Voltage Gain</a></span></li></ul></li></ul></div> Note: This notebook uses the `ipywidgets` to provided a interactive exploration experience. In order to make use of this experience, this notebook must be downloaded and run on a computer what has `ipywidgets` installed and activated for directions for that see http://ipywidgets.readthedocs.io/en/latest/user_install.html this notebook also uses the [`(some) LaTeX environments for Jupyter `](http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/latex_envs/README.html) found within the install of https://github.com/ipython-contrib/jupyter_contrib_nbextensions And all diagrams are made in **draw.io** where the source file is `OpAmpTobosDrawing.html` where that file and the exported files should accompany this notebook from its GitHub source # Premise This Notebook serves as a Repository of Operational Amplifier Topologies for use in [PySpice](https://pyspice.fabrice-salvaire.fr/) and for the topologies theory. The Goal for the Author personally is to make one or two upgrades to this notebook a week. Whether that be a new feature, expanded theory, or new topology. Some of the intended upgrades include: \begin{itemize} \item Enhanced analyses of output data \item Routines to find figures of merits from output data \item Added calculations from theory \item Simulations from theory and compersion to SPICE sim \item adding GUI interactivity via ipython notebook widgets \end{itemize} # Libarys ```python from sympy import * init_printing() import ipywidgets as wgs import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline from PySpice.Plot.BodeDiagram import bode_diagram from PySpice.Probe.Plot import plot from PySpice.Spice.Netlist import Circuit from PySpice.Spice.Netlist import SubCircuitFactory from PySpice.Unit import * from ipywidgets import widgets from IPython.display import display #https://github.com/jrjohansson/version_information %load_ext version_information %version_information sympy, numpy, matplotlib, pandas, PySPice, ipywidgets ``` <table><tr><th>Software</th><th>Version</th></tr><tr><td>Python</td><td>3.6.4 64bit [GCC 7.2.0]</td></tr><tr><td>IPython</td><td>6.2.1</td></tr><tr><td>OS</td><td>Linux 4.13.0 32 generic x86_64 with debian stretch sid</td></tr><tr><td>sympy</td><td>1.1.1</td></tr><tr><td>numpy</td><td>1.13.3</td></tr><tr><td>matplotlib</td><td>2.1.1</td></tr><tr><td>pandas</td><td>0.21.1</td></tr><tr><td>PySPice</td><td>1.2.0</td></tr><tr><td>ipywidgets</td><td>7.2.1</td></tr><tr><td colspan='2'>Mon May 07 11:51:59 2018 MDT</td></tr></table> # Setup ```python def lambdify2(expresion, ReVars=False): """ Helper Function to more automate sympy `lambdify` function Args: expresion: sympy expresion !Only Pass LHS of Equations ReVars (bool; False): Control to return the Vars in a list if True Note: lambdfy is set with `dummify=False` therefore do not pass unsantied variabls to functin else error will be thrown """ #collect vars Vars=sorted(list(expresion.free_symbols), key=lambda x: str(x)) #perform lambdfy with waver F=lambdify(Vars, expresion, dummify=False) if ReVars: return F, Vars else: return F ``` # Ideal OpAmp Using the Semi Ideal OpAmp model devloped by Fabrice Salvaire for the OpAmp Exsample [8.10.3. Operational Amplifier](https://pyspice.fabrice-salvaire.fr/examples/operational-amplifier/operational-amplifier.html) ```python class BasicOperationalAmplifier(SubCircuitFactory): """ Semi Ideal OpAmp Model SubCir from https://pyspice.fabrice-salvaire.fr/examples/operational-amplifier/operational-amplifier.html A0=100e3; pole=100; A=10e6Hz Termanals: non_inverting_input inverting_input output """ __name__ = 'BasicOperationalAmplifier' __nodes__ = ('non_inverting_input', 'inverting_input', 'output') ############################################## def __init__(self): super().__init__() # Input impedance self.R('input', 'non_inverting_input', 'inverting_input', 10@u_MΩ) # dc gain=100k and pole1=100hz # unity gain = dcgain x pole1 = 10MHZ self.VCVS('gain', 1, self.gnd, 'non_inverting_input', 'inverting_input', voltage_gain=kilo(100)) self.R('P1', 1, 2, 1@u_kΩ) self.C('P1', 2, self.gnd, 1.5915@u_uF) # Output buffer and resistance self.VCVS('buffer', 3, self.gnd, 2, self.gnd, 1) self.R('out', 3, 'output', 10@u_Ω) ``` # TestBench ```python class OnePortOpAmpTB(Circuit): """ Class for implimenting Bode plot simulation for One Port (Two Termanal) Opertinal Amplifer topology """ def __init__(self, DUT, **kwargs): """ Args: DUT (class SubCircuitFactory): The One Port OpAmp topology class to be tested kwargs (dict): Addital Ciricut Parmters to the topology under test """ #bind the DUT class to TB instance self.DUT=DUT #self.Theory=self.DUT.Theory() #create the ciruit name from DUT name super().__init__(title=f'{self.DUT.__name__}_TB', **kwargs) def SetupCir(self, **kwargs): """ Sets up the the DUT and the Testbench for simulation see diagrm in source IPYNB for cirucit diagram Args: kwargs (dict): Addital Ciricut Parmters to the topology under test """ #create instatince of DUT and setuo with parmaters self.DUT=self.DUT(**kwargs) #load the DUT in to the circuit self.subcircuit(self.DUT) self.X('Amp', self.DUT.__name__, 'Vin', 'Vout') #set up the TB elements self.R('Sload', 'Vin' , '1', 50@u_Ω) self.SinusoidalVoltageSource('Source', '1', self.gnd, amplitude=1@u_V) self.R('Tload', 'Vout', self.gnd, 50@u_Ω) #print out the resulting spice list print(self) def Simulate(self, fMin=1, fMax=20e6): """ Method to perform a Bode plot simulation via NgSpice AC sim @25C Args: fMin(float; 1 [Hz]): the starting frequnacy for Bode plot sweep in hertz fMax(float; 100e3[Hz]): the ending frequnacy for Bode plot sweep in hertz Retured Attributes: results: the ac simulation raw results from NGSpice Data: Pandas Dataframe with ouputs and calcs from results """ simulator = self.simulator(temperature=25, nominal_temperature=25) self.results = simulator.ac(start_frequency=fMin@u_Hz, stop_frequency=fMax@u_Hz, number_of_points=10, variation='dec') # returned dataframe self.Data=pd.DataFrame() self.Data['freq[Hz]']=self.results.frequency self.Data['Vin']=self.results.Vin self.Data['Vout']=self.results.Vout #normlized gain in dB self.Data['Gain[dB]']=20*np.log10(np.abs(self.Data['Vout']/self.Data['Vin'])) # phase in radians unwraped self.Data['Phase[rad_UW]']=(np.angle(self.Data['Vout'])) def PlotResults(self): """ Create a Bode plot from the simulation """ self.fig, [self.axMag, self.axPh]=plt.subplots(ncols=1, nrows=2, sharex=True) A=self.Data['Gain[dB]']; F=self.Data['freq[Hz]'] L=np.abs(np.abs(A-A.max())-3.0).idxmin() self.dB3=F[L] plt.suptitle("Bode Diagram of an Operational Amplifier") bode_diagram(axes=(self.axMag, self.axPh), frequency=self.Data['freq[Hz]'], gain=self.Data['Gain[dB]'], phase=self.Data['Phase[rad_UW]'], marker='.', color='blue', linestyle='-', ) self.axMag.axvline(x=self.dB3, label='3dB[Hz]', linestyle='-.', alpha=.7, color='g') self.axPh.axvline(x=self.dB3, label='3dB[Hz]', linestyle='-.', alpha=.7, color='g') ``` \begin{definition} $A$ Open Loop Gain (no feedback) $$A=\dfrac{V_o}{V_i}$$ \end{definition} \begin{definition} $G$ Closed Loop Gain (with feedback) $$G=\dfrac{V_o}{V_i}$$ \end{definition} \begin{definition} $Z_{\text{i}}$ Open Loop Input Impedance (no feedback) $$Z_{\text{i}}=\dfrac{V_{\text{diff}}}{I_i}$$ \end{definition} \begin{definition} $Z_{\text{o}}$ Open Loop Output Impedance (no feedback) $$Z_{\text{o}}=\dfrac{V_o}{I_o}$$ \end{definition} \begin{definition} $Z_{\text{ifb}}$ Closed Loop Input Impedance (with feedback) $$Z_{\text{ifb}}=\dfrac{V_i}{I_i}$$ \end{definition} \begin{definition} $Z_{\text{ofb}}$ Closed Loop Output Impedance (with feedback) $$Z_{\text{ofb}}=\dfrac{V_o}{I_o}$$ \end{definition} \begin{definition} $V_{\text{diff}}$ the differential input voltage $$V_{\text{diff}}=V_+-V_-$$ \end{definition} # Buffer [Analog Electronics: Circuits, Systems and Signal Processing](https://www.amazon.com/Analog-Electronics-Circuits-Systems-Processing-ebook/dp/B00CXO975A/ref=sr_1_1?ie=UTF8&qid=1524885102&sr=8-1&keywords=Analog+Electronics+Crecraft+Gergely) 3.5, 3.5.1, 3.5.2 $$V_{\text{diff}}=V_i-V_o$$ $$V_o=AV_{\text{diff}}$$ $$V_o=AV_i-AV_o$$ $$G=\dfrac{V_o}{V_i}=\dfrac{A}{1+A}\approx 1$$ $$I_i=\dfrac{V_{\text{diff}}}{Z_i} $$ $$V_{\text{diff}}=\dfrac{1}{1+A}V_i$$ $$I_i=\dfrac{1}{1+A} \dfrac{V_i}{Z_i}$$ $$Z_{\text{ifb}}=(1+A)Z_i$$ $$V_o=AV_{\text{diff}}-I_LZ_o$$ $$(1+A)V_o=AV_i-I_L Z_o$$ $$V_o=\dfrac{A}{1+A}V_i -\dfrac{Z_o}{1+A}I_L$$ $$V_o=GV_i -Z_{\text{ofb}}I_L$$ $$Z_{\text{ifb}}=\dfrac{Z_o}{1+A}$$ ```python class BufferOpAmp(SubCircuitFactory): """ Buffer OpAmp SubCircuit Termanals: Vin Vout """ __name__='BufferOpAmp' __nodes__=('Vin','Vout') def __init__(self): super().__init__() #'non_inverting_input', 'inverting_input', 'output' self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', 'Vin', 'Vout', 'Vout') @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_ifb')(s); Zout=Function('Z_ofb')(s) TF=Eq(H, A/(1+A)); Zin=Eq(Zin, (1+A)*Zi); Zout=Eq(Zout, Zo/(1+A)) return TF, Zin, Zout ``` ```python #Print out the Buffer Op Amp Theory BufferOpAmp.Theory() ``` ```python #create the Test Bench and Bind to this instance the BufferOpAmp Topo TB=OnePortOpAmpTB(BufferOpAmp) #Setup the Testbench and print the TB TB.SetupCir() #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` # Inverting ```python class InvertingOpAmp(SubCircuitFactory): """ Inverting OpAmp SubCir Termanals: Vin Vout Parms: R1[Ohms] R2[Ohms] """ __name__='InvertingOpAmp' __nodes__=('Vin','Vout') def __init__(self, R1=1, R2=1): super().__init__() self.R1=R1; self.R2=R2 self.R('1', 'Vin', '2', R1@u_Ω) self.R('2', '2', 'Vout', R2@u_Ω) self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', self.gnd, '2', 'Vout') self.Theory() @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" R1, R2=symbols('R_1, R_2', real=True, postive=True) A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_in')(s); Zout=Function('Z_out')(s) TF=Eq(H, -R2/R1) Zin=Eq(Zin, R1) Zout=Eq(Zout, Zo*(R1+R2)/(A*R1)) return TF, Zin, Zout ``` ```python #Print out the Inverting Op Amp Theory InvertingOpAmp.Theory() ``` ```python class InvertingExp(): """ Class to provide GUI for Inverting Amplifer """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', ) self.R2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R2 kOhm', ) #layout self.RSVBox=widgets.VBox([self.R1Slider, self.R2Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, R2=self.R2Slider) display(I) def BackEnd(self, R1, R2): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the InvertingOpAmp Topo TB=OnePortOpAmpTB(InvertingOpAmp) #Setup the Testbench; use a R1=20 Ohm,R2=5 Ohm and print the TB TB.SetupCir(**{'R1':R1*1e3, 'R2':R2*1e3}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python InvertingExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, step=5.0), FloatSlider(value=50… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> # Noninverting ```python class NonInvertingOpAmp(SubCircuitFactory): """ Non-Inverting OpAmp SubCir Termanals: Vin Vout Parms: R1 R2 """ __name__='NonInvertingOpAmp' __nodes__=('Vin','Vout') def __init__(self, R1, R2): super().__init__() self.R1=R1; self.R2=R2 self.R('1', '2', self.gnd, R1@u_Ω) self.R('2', '2', 'Vout', R2@u_Ω) self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', 'Vin', '2', 'Vout') @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" R1, R2=symbols('R_1, R_2', real=True, postive=True) A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_in')(s); Zout=Function('Z_out')(s) TF=Eq(H, (A(R1+R2))/(R2(1+A)+R1)) Zin=Eq(Zin, Zi*((1+A)*R2+R1)/(R2+(1-A)*R1)) Zout=Eq(Zout, Zo*(R1+R2)/(R1+(1+A)*R2)) return TF, Zin, Zout ``` ```python #Print out the NonInverting Op Amp Theory NonInvertingOpAmp.Theory() ``` ```python class NonInvertingExp(): """ Class to provide GUI for Inverting Amplifer """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm' ) self.R2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R2 kOhm' ) #layout self.RSVBox=widgets.VBox([self.R1Slider, self.R2Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, R2=self.R2Slider) display(I) def BackEnd(self, R1, R2): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the NonInverting Topo TB=OnePortOpAmpTB(NonInvertingOpAmp) #Setup the Testbench; use a R1=20 Ohm,R2=5 Ohm and print the TB TB.SetupCir(**{'R1':R1*1e3, 'R2':R2*1e3}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python NonInvertingExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, step=5.0), FloatSlider(value=50… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> # Miller Capactive Integrator ```python class MillerCapIntOpAmp(SubCircuitFactory): """ Inverting OpAmp SubCir Termanals: Vin Vout Parms: R1[Ohms] C1[Fards] """ __name__='MillerCapIntOpAmp' __nodes__=('Vin','Vout') def __init__(self, R1=1, C1=1): super().__init__() self.R1=R1; self.C1=C1 self.R('1', 'Vin', '2', R1@u_Ω) self.C('1', '2', 'Vout', C1@u_F) self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', self.gnd, '2', 'Vout') self.Theory() @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" R1, C1=symbols('R_1, C_1', real=True, postive=True) A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_in')(s); Zout=Function('Z_out')(s) TF=Eq(H, -(1/(s*C1))/R1) Zin=simplify(Eq(Zin, R1)) Zout=Eq(Zout, Zo/(A(1+s*C1*R1))) return TF, Zin, Zout ``` ```python #Print out the MillerCapInt Op Amp Theory MillerCapIntOpAmp.Theory() ``` ```python class MillerCapIntExp(): """ Class to provide GUI for MillerCapInt """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', readout_format='.1e') self.C1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C1 pF') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.C1Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, C1=self.C1Slider) display(I) def BackEnd(self, R1, C1): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the MillerCapInt Topo TB=OnePortOpAmpTB(MillerCapIntOpAmp) #Setup the Testbench; use a R1=20 Ohm,C1=10 muF and print the TB TB.SetupCir(**{'R1':R1*1e3, 'C1':C1*1e-12}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python MillerCapIntExp() ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> <__main__.MillerCapIntExp at 0x7fd2aeb03080> # Miller Inductive Integrator ```python class MillerIndIntOpAmp(SubCircuitFactory): """ Inverting OpAmp SubCir Termanals: Vin Vout Parms: R1[Ohms] L1[Henrys] """ __name__='MillerIndIntOpAmp' __nodes__=('Vin','Vout') def __init__(self, R1=1, L1=1): super().__init__() self.R1=R1; self.L1=L1 self.L('1', 'Vin', '2', L1@u_H) self.R('1', '2', 'Vout', R1@u_Ω) self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', self.gnd, '2', 'Vout') self.Theory() @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" R1, L1=symbols('R_1, L_1', real=True, postive=True) A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_in')(s); Zout=Function('Z_out')(s) TF=Eq(H, -R1/(s*L1)) Zin=Eq(Zin, s*L1) Zout=simplify(Eq(Zout, Zo*(s*L1+R1)/(A*s*L1))) return TF, Zin, Zout ``` ```python #Print out the MillerIndInt Op Amp Theory MillerIndIntOpAmp.Theory() ``` ```python class MillerIndIntExp(): """ Class to provide GUI for MillerIndInt """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', readout_format='.1e') self.L1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='L1 uH') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.L1Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, L1=self.L1Slider) display(I) def BackEnd(self, R1, L1): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the MillerCapInt Topo TB=OnePortOpAmpTB(MillerIndIntOpAmp) #Setup the Testbench; use a R1=20 Ohm,L1=10 muH and print the TB TB.SetupCir(**{'R1':R1*1e3, 'L1':L1*1e-6}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python MillerIndIntExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> # Low Pass 1Pole ```python class LowPass1POpAmp(SubCircuitFactory): """ Single Pole Low Pass OpAmp SubCir Termanals: Vin Vout Parms: R1[Ohms] R2[Ohms] C1[Farads] """ __name__='LowPass1POpAmp' __nodes__=('Vin','Vout') def __init__(self, R1=1, R2=1, C1=1): super().__init__() self.R1=R1; self.R2=R2; self.C1=C1 self.R('1', 'Vin', '2', R1@u_Ω) self.R('2', '2', 'Vout', R2@u_Ω) self.C('1', '2', 'Vout', C1@u_F) self.subcircuit(BasicOperationalAmplifier()) #non, inv, out self.X('op', 'BasicOperationalAmplifier', 'Vin', '2', 'Vout') @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" R1, R2, C1=symbols('R_1, R_2, C_1', real=True, postive=True) A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_in')(s); Zout=Function('Z_out')(s) TF=simplify(Eq(H, -(R2/(R2*s*C1+1))/R1)) Zin=Eq(Zin, R1) Zout=simplify(Eq(Zout, Zo*(R1+(R2/(R2*s*C1+1)))/(A*R1))) return TF, Zin, Zout ``` ```python LowPass1POpAmp.Theory() ``` ```python class LowPass1POpAmpExp(): """ Class to provide GUI for LowPass1POpAmp """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', readout_format='.1e') self.R2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R2 kOhm', readout_format='.1e') self.C1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C1 pF') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.R2Slider, self.C1Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, R2=self.R2Slider, C1=self.C1Slider) display(I) def BackEnd(self, R1, R2, C1): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the LowPass1POpAmp Topo TB=OnePortOpAmpTB(LowPass1POpAmp) #Setup the Testbench; use a R1=20 Ohm, R2=5 Ohm,C1=10 muH and print the TB TB.SetupCir(**{'R1':R1*1e3, 'R2':R2*1e3, 'C1':C1*1e-12}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python LowPass1POpAmpExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> # Miller Capacitive Differentiator ```python class MillerCapDiff(SubCircuitFactory): """ Miller Capacitive Differentiator OpAmp SubCir Termanals: Vin Vout Parms: R1[Ohms] C1[Farads] """ __name__='MillerCapDiff' __nodes__=('Vin','Vout') def __init__(self, R1=1, C1=1): super().__init__() self.R1=R1; self.C1=C1 self.C('1', 'Vin', '2', C1@u_F) self.R('1', '2', 'Vout', R1@u_Ω) self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', self.gnd, '2', 'Vout') self.Theory() @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" R1, R2, C1=symbols('R_1, R_2, C_1', real=True, postive=True) A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_in')(s); Zout=Function('Z_out')(s) TF=Eq(H, -R1/(1/(s*C1))) Zin=Eq(Zin, (1/(s*C1))) Zout=simplify(Eq(Zout, Zo*((1/(s*C1))+R1)/(A*(1/(s*C1))))) return TF, Zin, Zout ``` ```python MillerCapDiff.Theory() ``` ```python class MillerCapDiffExp(): """ Class to provide GUI for MillerCapDiff """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', readout_format='.1e') self.C1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C1 pF') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.C1Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, C1=self.C1Slider) display(I) def BackEnd(self, R1, C1): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the MillerCapDiff Topo TB=OnePortOpAmpTB(MillerCapDiff) #Setup the Testbench; use a R1=20 Ohm,C1=10 muF and print the TB TB.SetupCir(**{'R1':R1*1e3, 'C1':C1*1e-12}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python MillerCapDiffExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> # Miller Inductive Differentiator ```python class MillerIndDiff(SubCircuitFactory): """ Miller Inductive Differentiator OpAmp SubCir Termanals: Vin Vout Parms: R1[Ohms] L1[Henerys] """ __name__='MillerIndDiff' __nodes__=('Vin','Vout') def __init__(self, R1=1, L1=1): super().__init__() self.R1=R1; self.L1=L1 self.R('1', 'Vin', '2', R1@u_Ω) self.L('1', '2', 'Vout', L1@u_H) self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', self.gnd, '2', 'Vout') self.Theory() @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" R1, R2, L1=symbols('R_1, R_2, L_1', real=True, postive=True) A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_in')(s); Zout=Function('Z_out')(s) TF=Eq(H, -(s*L1)/R1) Zin=Eq(Zin, R1) Zout=Eq(Zout, Zo*(R1+(s*L1))/(A*R1)) return TF, Zin, Zout ``` ```python MillerIndDiff.Theory() ``` ```python class MillerIndDiffExp(): """ Class to provide GUI for MillerIndDiff """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', readout_format='.1e') self.L1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='L1 uH') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.L1Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, L1=self.L1Slider) display(I) def BackEnd(self, R1, L1): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the MillerCapInt Topo TB=OnePortOpAmpTB(MillerIndDiff) #Setup the Testbench; use a R1=20 Ohm,L1=10 muH and print the TB TB.SetupCir(**{'R1':R1*1e3, 'L1':L1*1e-12}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python MillerIndDiffExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> # High Pass 1Zero ```python class HighPass1ZOpAmp(SubCircuitFactory): """ Single Pole Low Pass OpAmp SubCir Termanals: Vin Vout Parms: R1[Ohms] R2[Ohms] L1[Henerys] """ __name__='HighPass1ZOpAmp' __nodes__=('Vin','Vout') def __init__(self, R1=1, R2=1, L1=1): super().__init__() self.R1=R1; self.R2=R2; self.L1=L1 self.R('1', 'Vin', '2', R1@u_Ω) self.R('2', '2', 'Vout', R2@u_Ω) self.L('1', '2', 'Vout', L1@u_H) self.subcircuit(BasicOperationalAmplifier()) #non, inv, out self.X('op', 'BasicOperationalAmplifier', 'Vin', '2', 'Vout') @staticmethod def Theory(): """Analog Electronics: Circuits, Systems and Signal Processing Crecraft Gergely""" R1, R2, L1=symbols('R_1, R_2, L_1', real=True, postive=True) A,Zi, Zo, s=symbols('A, Z_i, Z_o s') H=Function('H')(s); Zin=Function('Z_in')(s); Zout=Function('Z_out')(s) TF=simplify(Eq(H, -((R2*s*L1)/(s*L1+R2))/R1)) Zin=Eq(Zin, R1) Zout=simplify(Eq(Zout, Zo*(R1+((R2*s*L1)/(s*L1+R2)))/(A*R1))) return TF, Zin, Zout ``` ```python HighPass1ZOpAmp.Theory() ``` ```python class HighPass1ZExp(): """ Class to provide GUI for HighPass1ZOpAmp """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', readout_format='.1e') self.R2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R2 kOhm', readout_format='.1e') self.L1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='L1 uH') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.R2Slider, self.L1Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, R2=self.R2Slider, L1=self.L1Slider) display(I) def BackEnd(self, R1, R2, L1): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the HighPass1ZOpAmp Topo TB=OnePortOpAmpTB(HighPass1ZOpAmp) #Setup the Testbench; use a R1=20 Ohm,R2=5 Ohm, L1=10 muH and print the TB TB.SetupCir(**{'R1':R1*1e3, 'R2':R2*1e3, 'L1':L1*1e-6}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python HighPass1ZExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> # AllPass (Phase) Filter http://www.analog.com/media/en/training-seminars/tutorials/MT-202.pdf ## First Order Cap First ```python class AllPass1CapFOpAmp(SubCircuitFactory): """ AllPass 1st Order Cap First Termanals: Vin Vout Parms: R1[Ohms] R2[Ohms] R3[Ohms] C1[Farads] """ __name__='AllPass1CapFOpAmp' __nodes__=('Vin','Vout') def __init__(self, R1=1, R2=1, R3=1, C1=1): super().__init__() self.R1=R1; self.R2=R2; self.R3=R3 self.C1=C1 #inverting feedback stucter self.R('1', 'Vin', '2', R1@u_Ω) self.R('2', '2', 'Vout', R2@u_Ω) #Voltage Divider self.C('1', 'Vin', '3', C1@u_F) self.R('3', '3', self.gnd, R3@u_Ω) self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', '3', '2', 'Vout') self.Theory() @staticmethod def Theory(): A, R1, R2, R3, C1=symbols('A, R_1, R_2, R_3, C_1', real=True, postive=True) Vn, Vp, Vo, Vi=symbols('V_n, V_p, V_o, V_i') s=symbols('s') VpEq=Eq(Vp, (s*C1*R3)/(1+s*C1*R3)* Vi); VpEq VnEq=Eq(Vn, (R1/(R1+R2))*Vo+(R2/(R1+R2))*Vi); VnEq VoEq=Eq(Vo, A*(Vp-Vn)); VoEq VoEq=VoEq.subs({VpEq.lhs: VpEq.rhs, VnEq.lhs:VnEq.rhs}) H=Function('H')(s) TF=Eq(H, (solve(VoEq, Vo)[0]/Vi)); TF return TF ``` ```python class AllPass1CapFExp(): """ Class to provide GUI for Inverting AllPass1CapF """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', ) self.R2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R2 kOhm', ) self.R3Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R2 kOhm', ) self.C1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C1 pF') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.R2Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, R2=self.R2Slider, R3=self.R3Slider, C1=self.C1Slider) display(I) def BackEnd(self, R1, R2, R3, C1): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the HighPass1ZOpAmp Topo TB=OnePortOpAmpTB(AllPass1CapFOpAmp) #Setup the Testbench; use a R1=20 Ohm,R2=5 Ohm, L1=10 muH and print the TB TB.SetupCir(**{'R1':R1*1e3, 'R2':R2*1e3, 'R3':R3*1e3, 'C1':C1*1e-9}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python AllPass1CapFExp() ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, step=5.0), FloatSlider(value=50… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> <__main__.AllPass1CapFExp at 0x7fd2ae81c390> ## First Order Cap Second ```python class AllPass1CapSOpAmp(SubCircuitFactory): """ AllPass 1st Order Cap Second Termanals: Vin Vout Parms: R1[Ohms] R2[Ohms] R3[Ohms] C1[Farads] """ __name__='AllPass1CapSOpAmp' __nodes__=('Vin','Vout') def __init__(self, R1=1, R2=1, R3=1, C1=1): super().__init__() self.R1=R1; self.R2=R2; self.R3=R3 self.C1=C1 #inverting feedback stucter self.R('1', 'Vin', '2', R1@u_Ω) self.R('2', '2', 'Vout', R2@u_Ω) #Voltage Divider self.R('3', 'Vin', '3', R3@u_Ω) self.C('1', '3', self.gnd, C1@u_F) self.subcircuit(BasicOperationalAmplifier()) self.X('op', 'BasicOperationalAmplifier', '3', '2', 'Vout') self.Theory() @staticmethod def Theory(): A, R1, R2, R3, C1=symbols('A, R_1, R_2, R_3, C_1', real=True, postive=True) Vn, Vp, Vo, Vi=symbols('V_n, V_p, V_o, V_i') s=symbols('s') VpEq=simplify(Eq(Vp, ((1/(s*C1))/((1/s*C1 +R3)))* Vi)); VpEq VnEq=Eq(Vn, (R1/(R1+R2))*Vo+(R2/(R1+R2))*Vi); VnEq VoEq=Eq(Vo, A*(Vp-Vn)); VoEq VoEq=VoEq.subs({VpEq.lhs: VpEq.rhs, VnEq.lhs:VnEq.rhs}) H=Function('H')(s) TF=Eq(H, (solve(VoEq, Vo)[0]/Vi)); TF return TF ``` ```python AllPass1CapSOpAmp.Theory() ``` ```python class AllPass1CapSExp(): """ Class to provide GUI for Inverting AllPass1CapS """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', ) self.R2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R2 kOhm', ) self.R3Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R2 kOhm', ) self.C1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C1 pF') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.R2Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, R2=self.R2Slider, R3=self.R3Slider, C1=self.C1Slider) display(I) def BackEnd(self, R1, R2, R3, C1): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the HighPass1ZOpAmp Topo TB=OnePortOpAmpTB(AllPass1CapSOpAmp) #Setup the Testbench; use a R1=20 Ohm,R2=5 Ohm, L1=10 muH and print the TB TB.SetupCir(**{'R1':R1*1e3, 'R2':R2*1e3, 'R3':R3*1e3, 'C1':C1*1e-9}) #Run the AC Bode Simulation TB.Simulate() #View Bode Simulation TB.PlotResults() ``` ```python AllPass1CapSExp() ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, step=5.0), FloatSlider(value=50… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> <__main__.AllPass1CapSExp at 0x7fd2ae7de780> # Sallen-Key Filter [Analog Electronics: Circuits, Systems and Signal Processing Crecraft & Gergely](https://www.amazon.com/Analog-Electronics-Circuits-Systems-Processing-ebook/dp/B00CXO975A/ref=sr_1_1?ie=UTF8&qid=1524885102&sr=8-1&keywords=Analog+Electronics+Crecraft+Gergely) 10.6.2 $$G=\dfrac{A_V Y_1 Y_3}{Y_5(Y_1+Y_2+Y_3+Y_4)+Y_3(Y_1+Y_2+Y_4(1+A_V))}$$ ## Low Pass with Voltage Gain $$Y_1=R_1$$ $$Y_2=0$$ $$Y_3=R_3$$ $$Y_4=sC_4$$ $$Y_5=sC_5$$ ```python class LPSKV(SubCircuitFactory): """ Low Pass Sallen-Key with Voltage Gain NonInverting Amp Termanals: Vin Vout Parms: R1[Ohms] R3[Ohms] C4[Farads] C5[Farads] RF1[Ohms]: NonInverting Feedback R1 RF2[Ohms]: NonInverting Feedback R2 """ __name__='LPSKV' __nodes__=('Vin','Vout') def __init__(self, R1=1, R3=1, C4=1e-12, C5=1e-12, RF1=1, RF2=1): super().__init__() self.R1=R1; self.R3=R3; self.C4=C4; self.C5=C5 self.RF1=RF1; self.RF2=RF2 self.R('1', 'Vin', '1', R1@u_Ω) self.R('3', '1', '2', R3@u_Ω) self.C('4', '1', 'Vout', C4@u_F) self.C('5', '2', self.gnd, C5@u_F) self.subcircuit(NonInvertingOpAmp(R1=RF1, R2=RF2)) self.X('Av', 'NonInvertingOpAmp', '2', 'Vout') ``` ```python class LPSKVExp(): """ Class to provide GUI for LPSKV """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', readout_format='.1e') self.R3Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R5 kOhm', readout_format='.1e') self.C4Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C4 pF') self.C5Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C5 pF') self.RF1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='RF1 kOhm', readout_format='.1e') self.RF2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='RF2 kOhm', readout_format='.1e') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.R3Slider, self.C4Slider, self.C5Slider, self.RF1Slider, self.RF2Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, R3=self.R3Slider, C4=self.C4Slider, C5=self.C5Slider, RF1=self.RF1Slider, RF2=self.RF2Slider) display(I) def BackEnd(self, R1, R3, C4, C5, RF1, RF2): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the LPSKV Topo TB=OnePortOpAmpTB(LPSKV) #Setup the Testbench; use a R1:20 Ohm,R2:5 Ohm, L1:10 muH and print the TB TB.SetupCir(**{'R1':R1*1e3, 'R3':R3*1e3, 'C4':C4*1e-12, 'C5':C5*1e-12, 'RF1':RF1*1e3, 'RF2':RF2*1e3}) #Run the AC Bode Simulation TB.Simulate(fMax=10e9) #View Bode Simulation TB.PlotResults() ``` ```python LPSKVExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> ## Band Pass with Voltage Gain $$Y_1=R_1$$ $$Y_2=0$$ $$Y_3=C_3$$ $$Y_4=R_4$$ $$Y_5=sC_5$$ ```python class BPSKV(SubCircuitFactory): """ Band Pass Sallen-Key with Voltage Gain NonInverting Amp Termanals: Vin Vout Parms: R1[Ohms] R4[Ohms] R5[Ohms] C3[Farads] C5[Farads] RF1[Ohms]: NonInverting Feedback R1 RF2[Ohms]: NonInverting Feedback R2 """ __name__='BPSKV' __nodes__=('Vin','Vout') def __init__(self, R1=1, R4=1, R5=1, C3=1e-12, C5=1e-12, RF1=1, RF2=1): super().__init__() self.R1=R1; self.R4=R4; self.C3=C3; self.C5=C5 self.RF1=RF1; self.RF2=RF2 self.R('1', 'Vin', '1', R1@u_Ω) self.C('3', '1', '2', C3@u_F) self.R('4', '1', 'Vout', R4@u_Ω) self.C('5', '2', self.gnd, C5@u_F) self.R('5', '2', self.gnd, R5@u_Ω) self.subcircuit(NonInvertingOpAmp(R1=RF1, R2=RF2)) self.X('Av', 'NonInvertingOpAmp', '2', 'Vout') ``` ```python class BPSKVExp(): """ Class to provide GUI for BPSKV """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R1 kOhm', readout_format='.1e') self.R4Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R4 kOhm', readout_format='.1e') self.R5Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R5 kOhm', readout_format='.1e') self.C3Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C3 pF') self.C5Slider=widgets.FloatSlider(value=50, min=1, max=500, step=5, description='C5 pF') self.RF1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='RF1 kOhm', readout_format='.1e') self.RF2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='RF2 kOhm', readout_format='.1e') #layout self.RSVBox=widgets.VBox([self.R1Slider, self.R4Slider, self.R5Slider, self.C3Slider, self.C5Slider, self.RF1Slider, self.RF2Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R1=self.R1Slider, R4=self.R4Slider, R5=self.R5Slider, C3=self.C3Slider, C5=self.C5Slider, RF1=self.RF1Slider, RF2=self.RF2Slider) display(I) def BackEnd(self, R1, R4, R5, C3, C5, RF1, RF2): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the BPSKV Topo TB=OnePortOpAmpTB(BPSKV) #Setup the Testbench; use a R1:20 Ohm,R2:5 Ohm, L1:10 muH and print the TB TB.SetupCir(**{'R1':R1*1e3, 'R4':1e3, 'R5':1e3, 'C3':C3*1e-12, 'C5':C5*1e-12, 'RF1':RF1*1e3, 'RF2':RF2*1e3}) #Run the AC Bode Simulation TB.Simulate(fMax=10e9) #View Bode Simulation TB.PlotResults() ``` ```python BPSKVExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R1 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> ## HIgh Pass with Voltage Gain $$Y_1=sC_1$$ $$Y_2=0$$ $$Y_3=sC_3$$ $$Y_4=R_4$$ $$Y_5=R_5$$ ```python class HPSKV(SubCircuitFactory): """ High Pass Sallen-Key with Voltage Gain NonInverting Amp Termanals: Vin Vout Parms: R4[Ohms] R5[Ohms] C1[Farads] C3[Farads] RF1[Ohms]: NonInverting Feedback R1 RF2[Ohms]: NonInverting Feedback R2 """ __name__='HPSKV' __nodes__=('Vin','Vout') def __init__(self, R4=1, R5=1, C1=1e-12, C3=1e-12, RF1=1, RF2=1): super().__init__() self.R4=R4; self.R5=R5; self.C1=C1; self.C3=C3 self.RF1=RF1; self.RF2=RF2 self.C('1', 'Vin', '1', C1@u_F) self.C('3', '1', '2', C3@u_F) self.R('4', '1', 'Vout', R4@u_Ω) self.R('5', '2', self.gnd, R5@u_Ω) self.subcircuit(NonInvertingOpAmp(R1=RF1, R2=RF2)) self.X('Av', 'NonInvertingOpAmp', '2', 'Vout') ``` ```python class HPSKVExp(): """ Class to provide GUI for HPSKV """ def __init__(self): """ Front end and binding to backend """ #create the GUI elments self.R4Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R4 kOhm', readout_format='.1e') self.R5Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='R5 kOhm', readout_format='.1e') self.C1Slider=widgets.FloatSlider(value=50, min=1, max=500, step=25, description='C1 pF') self.C3Slider=widgets.FloatSlider(value=50, min=1, max=500, step=5, description='C5 pF') self.RF1Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='RF1 kOhm', readout_format='.1e') self.RF2Slider=widgets.FloatSlider(value=50, min=10, max=100, step=5, description='RF2 kOhm', readout_format='.1e') #layout self.RSVBox=widgets.VBox([self.R4Slider, self.R5Slider, self.C1Slider, self.C3Slider, self.RF1Slider, self.RF2Slider]) #bind to the backend I=widgets.interact_manual(self.BackEnd, R4=self.R4Slider, R5=self.R5Slider, C1=self.C1Slider, C3=self.C3Slider, RF1=self.RF1Slider, RF2=self.RF2Slider) display(I) def BackEnd(self, R4, R5, C1, C3, RF1, RF2): """ The backend wrapper to the TB and simulation """ #create the Test Bench and Bind to this instance the LPSKV Topo TB=OnePortOpAmpTB(HPSKV) #Setup the Testbench; use a R1:20 Ohm,R2:5 Ohm, L1:10 muH and print the TB TB.SetupCir(**{'R4':R4*1e3, 'R5':R5*1e3, 'C1':C1*1e-12, 'C3':C3*1e-12, 'RF1':RF1*1e3, 'RF2':RF2*1e3}) #Run the AC Bode Simulation TB.Simulate(fMax=10e9) #View Bode Simulation TB.PlotResults() ``` ```python HPSKVExp(); ``` interactive(children=(FloatSlider(value=50.0, description='R4 kOhm', min=10.0, readout_format='.1e', step=5.0)… <function ipywidgets.widgets.interaction._InteractFactory.__call__.<locals>.<lambda>> ```python ```
length(ARGS)>=4 || error("Usage: julia zn11nnet.jl datafile lr drop1 drop2 hidden1 hidden2...") using HDF5,JLD,KUnet KUnet.gpu(true) argn = 0 isdefined(:xtrn) || (@date @load ARGS[argn+=1]) lr = eval(parse(ARGS[argn+=1])) drop1 = eval(parse(ARGS[argn+=1])) drop2 = eval(parse(ARGS[argn+=1])) net = Layer[] while argn < length(ARGS) d = isempty(net) ? drop1 : drop2 d > 0 && (net = push!(net, Drop(d))) h = eval(parse(ARGS[argn+=1])) net = append!(net, [Mmul(h), Bias(), Relu()]) end d = isempty(net) ? drop1 : drop2 d > 0 && (net = push!(net, Drop(d))) h = size(ytrn, 1) net = append!(net, [Mmul(h), Bias(), XentLoss()]) setparam!(net, adagrad=1e-8, lr=lr) display(net) println("") for epoch=1:20 @date train(net, xtrn, ytrn) #@date zdev = predict(net,xdev) @date ztst = predict(net,xtst) @show (epoch, accuracy(ytst,ztst)) # accuracy(ydev,zdev) end # for h=7:16; h0=2^h # for g=3:8; g0=2f0^-g # @show (h0, g0) # net = [Mmul(h0), Bias(), Relu(), Mmul(size(ytrn,1)), Bias(), XentLoss()] # setparam!(net, adagrad=1e-8, lr=g0) # @date train(net, xtrn, ytrn) # @date zdev = predict(net,xdev) # @date ztst = predict(net,xtst) # @show (h0, g0, accuracy(ydev,zdev), accuracy(ytst,ztst)) # end # end # cnet = cpucopy(net) # @time train(net, xtrn, ytrn; iters=1000) # net = gpucopy(cnet) # gc() # @time @profile train(net, xtrn, ytrn; iters=1000) # for epoch=1:10 # @show epoch # @date train(net, xtrn, ytrn; iters=1000) # @date zdev = predict(net,xdev) # @date ztst = predict(net,xtst) # @show (epoch, accuracy(ydev,zdev), accuracy(ytst,ztst)) # end # Use this to optimize gamma: # isdefined(:xtrn) || (@date @load "zn11cpv.jld") # niters=2000 # nbatch=100 # nc = size(ytrn,1) # for g0=0.10:0.01:0.15 # #for g=2:.5:4; g0 = 2f0^-g # println("") # @show g0 # net = Layer[KPerceptron(nc, KUnet.kgauss, [g0])] # @date train(net, xtrn, ytrn; iters=niters, batch=nbatch) # @show size(net[1].s) # @date y = predict(net,xdev) # @show accuracy(ydev,y) # end
(* Title: HOL/SET_Protocol/Merchant_Registration.thy Author: Giampaolo Bella Author: Fabio Massacci Author: Lawrence C Paulson *) section\<open>The SET Merchant Registration Protocol\<close> theory Merchant_Registration imports Public_SET begin text\<open>Copmpared with Cardholder Reigstration, \<open>KeyCryptKey\<close> is not needed: no session key encrypts another. Instead we prove the "key compromise" theorems for sets KK that contain no private encryption keys (\<^term>\<open>priEK C\<close>).\<close> inductive_set set_mr :: "event list set" where Nil: \<comment> \<open>Initial trace is empty\<close> "[] \<in> set_mr" | Fake: \<comment> \<open>The spy MAY say anything he CAN say.\<close> "[| evsf \<in> set_mr; X \<in> synth (analz (knows Spy evsf)) |] ==> Says Spy B X # evsf \<in> set_mr" | Reception: \<comment> \<open>If A sends a message X to B, then B might receive it\<close> "[| evsr \<in> set_mr; Says A B X \<in> set evsr |] ==> Gets B X # evsr \<in> set_mr" | SET_MR1: \<comment> \<open>RegFormReq: M requires a registration form to a CA\<close> "[| evs1 \<in> set_mr; M = Merchant k; Nonce NM1 \<notin> used evs1 |] ==> Says M (CA i) \<lbrace>Agent M, Nonce NM1\<rbrace> # evs1 \<in> set_mr" | SET_MR2: \<comment> \<open>RegFormRes: CA replies with the registration form and the certificates for her keys\<close> "[| evs2 \<in> set_mr; Nonce NCA \<notin> used evs2; Gets (CA i) \<lbrace>Agent M, Nonce NM1\<rbrace> \<in> set evs2 |] ==> Says (CA i) M \<lbrace>sign (priSK (CA i)) \<lbrace>Agent M, Nonce NM1, Nonce NCA\<rbrace>, cert (CA i) (pubEK (CA i)) onlyEnc (priSK RCA), cert (CA i) (pubSK (CA i)) onlySig (priSK RCA) \<rbrace> # evs2 \<in> set_mr" | SET_MR3: \<comment> \<open>CertReq: M submits the key pair to be certified. The Notes event allows KM1 to be lost if M is compromised. Piero remarks that the agent mentioned inside the signature is not verified to correspond to M. As in CR, each Merchant has fixed key pairs. M is only optionally required to send NCA back, so M doesn't do so in the model\<close> "[| evs3 \<in> set_mr; M = Merchant k; Nonce NM2 \<notin> used evs3; Key KM1 \<notin> used evs3; KM1 \<in> symKeys; Gets M \<lbrace>sign (invKey SKi) \<lbrace>Agent X, Nonce NM1, Nonce NCA\<rbrace>, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA) \<rbrace> \<in> set evs3; Says M (CA i) \<lbrace>Agent M, Nonce NM1\<rbrace> \<in> set evs3 |] ==> Says M (CA i) \<lbrace>Crypt KM1 (sign (priSK M) \<lbrace>Agent M, Nonce NM2, Key (pubSK M), Key (pubEK M)\<rbrace>), Crypt EKi (Key KM1)\<rbrace> # Notes M \<lbrace>Key KM1, Agent (CA i)\<rbrace> # evs3 \<in> set_mr" | SET_MR4: \<comment> \<open>CertRes: CA issues the certificates for merSK and merEK, while checking never to have certified the m even separately. NOTE: In Cardholder Registration the corresponding rule (6) doesn't use the "sign" primitive. "The CertRes shall be signed but not encrypted if the EE is a Merchant or Payment Gateway."-- Programmer's Guide, page 191.\<close> "[| evs4 \<in> set_mr; M = Merchant k; merSK \<notin> symKeys; merEK \<notin> symKeys; Notes (CA i) (Key merSK) \<notin> set evs4; Notes (CA i) (Key merEK) \<notin> set evs4; Gets (CA i) \<lbrace>Crypt KM1 (sign (invKey merSK) \<lbrace>Agent M, Nonce NM2, Key merSK, Key merEK\<rbrace>), Crypt (pubEK (CA i)) (Key KM1) \<rbrace> \<in> set evs4 |] ==> Says (CA i) M \<lbrace>sign (priSK(CA i)) \<lbrace>Agent M, Nonce NM2, Agent(CA i)\<rbrace>, cert M merSK onlySig (priSK (CA i)), cert M merEK onlyEnc (priSK (CA i)), cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)\<rbrace> # Notes (CA i) (Key merSK) # Notes (CA i) (Key merEK) # evs4 \<in> set_mr" text\<open>Note possibility proofs are missing.\<close> declare Says_imp_knows_Spy [THEN parts.Inj, dest] declare parts.Body [dest] declare analz_into_parts [dest] declare Fake_parts_insert_in_Un [dest] text\<open>General facts about message reception\<close> lemma Gets_imp_Says: "[| Gets B X \<in> set evs; evs \<in> set_mr |] ==> \<exists>A. Says A B X \<in> set evs" apply (erule rev_mp) apply (erule set_mr.induct, auto) done lemma Gets_imp_knows_Spy: "[| Gets B X \<in> set evs; evs \<in> set_mr |] ==> X \<in> knows Spy evs" by (blast dest!: Gets_imp_Says Says_imp_knows_Spy) declare Gets_imp_knows_Spy [THEN parts.Inj, dest] subsubsection\<open>Proofs on keys\<close> text\<open>Spy never sees an agent's private keys! (unless it's bad at start)\<close> lemma Spy_see_private_Key [simp]: "evs \<in> set_mr ==> (Key(invKey (publicKey b A)) \<in> parts(knows Spy evs)) = (A \<in> bad)" apply (erule set_mr.induct) apply (auto dest!: Gets_imp_knows_Spy [THEN parts.Inj]) done lemma Spy_analz_private_Key [simp]: "evs \<in> set_mr ==> (Key(invKey (publicKey b A)) \<in> analz(knows Spy evs)) = (A \<in> bad)" by auto declare Spy_see_private_Key [THEN [2] rev_iffD1, dest!] declare Spy_analz_private_Key [THEN [2] rev_iffD1, dest!] (*This is to state that the signed keys received in step 4 are into parts - rather than installing sign_def each time. Needed in Spy_see_priSK_RCA, Spy_see_priEK and in Spy_see_priSK Goal "[|Gets C \<lbrace>Crypt KM1 (sign K \<lbrace>Agent M, Nonce NM2, Key merSK, Key merEK\<rbrace>), X\<rbrace> \<in> set evs; evs \<in> set_mr |] ==> Key merSK \<in> parts (knows Spy evs) \<and> Key merEK \<in> parts (knows Spy evs)" by (fast_tac (claset() addss (simpset())) 1); qed "signed_keys_in_parts"; ???*) text\<open>Proofs on certificates - they hold, as in CR, because RCA's keys are secure\<close> lemma Crypt_valid_pubEK: "[| Crypt (priSK RCA) \<lbrace>Agent (CA i), Key EKi, onlyEnc\<rbrace> \<in> parts (knows Spy evs); evs \<in> set_mr |] ==> EKi = pubEK (CA i)" apply (erule rev_mp) apply (erule set_mr.induct, auto) done lemma certificate_valid_pubEK: "[| cert (CA i) EKi onlyEnc (priSK RCA) \<in> parts (knows Spy evs); evs \<in> set_mr |] ==> EKi = pubEK (CA i)" apply (unfold cert_def signCert_def) apply (blast dest!: Crypt_valid_pubEK) done lemma Crypt_valid_pubSK: "[| Crypt (priSK RCA) \<lbrace>Agent (CA i), Key SKi, onlySig\<rbrace> \<in> parts (knows Spy evs); evs \<in> set_mr |] ==> SKi = pubSK (CA i)" apply (erule rev_mp) apply (erule set_mr.induct, auto) done lemma certificate_valid_pubSK: "[| cert (CA i) SKi onlySig (priSK RCA) \<in> parts (knows Spy evs); evs \<in> set_mr |] ==> SKi = pubSK (CA i)" apply (unfold cert_def signCert_def) apply (blast dest!: Crypt_valid_pubSK) done lemma Gets_certificate_valid: "[| Gets A \<lbrace> X, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; evs \<in> set_mr |] ==> EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)" by (blast dest: certificate_valid_pubEK certificate_valid_pubSK) text\<open>Nobody can have used non-existent keys!\<close> lemma new_keys_not_used [rule_format,simp]: "evs \<in> set_mr ==> Key K \<notin> used evs \<longrightarrow> K \<in> symKeys \<longrightarrow> K \<notin> keysFor (parts (knows Spy evs))" apply (erule set_mr.induct, simp_all) apply (force dest!: usedI keysFor_parts_insert) \<comment> \<open>Fake\<close> apply force \<comment> \<open>Message 2\<close> apply (blast dest: Gets_certificate_valid) \<comment> \<open>Message 3\<close> apply force \<comment> \<open>Message 4\<close> done subsubsection\<open>New Versions: As Above, but Generalized with the Kk Argument\<close> lemma gen_new_keys_not_used [rule_format]: "evs \<in> set_mr ==> Key K \<notin> used evs \<longrightarrow> K \<in> symKeys \<longrightarrow> K \<notin> keysFor (parts (Key`KK \<union> knows Spy evs))" by auto lemma gen_new_keys_not_analzd: "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> set_mr |] ==> K \<notin> keysFor (analz (Key`KK \<union> knows Spy evs))" by (blast intro: keysFor_mono [THEN [2] rev_subsetD] dest: gen_new_keys_not_used) lemma analz_Key_image_insert_eq: "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> set_mr |] ==> analz (Key ` (insert K KK) \<union> knows Spy evs) = insert (Key K) (analz (Key ` KK \<union> knows Spy evs))" by (simp add: gen_new_keys_not_analzd) lemma Crypt_parts_imp_used: "[|Crypt K X \<in> parts (knows Spy evs); K \<in> symKeys; evs \<in> set_mr |] ==> Key K \<in> used evs" apply (rule ccontr) apply (force dest: new_keys_not_used Crypt_imp_invKey_keysFor) done lemma Crypt_analz_imp_used: "[|Crypt K X \<in> analz (knows Spy evs); K \<in> symKeys; evs \<in> set_mr |] ==> Key K \<in> used evs" by (blast intro: Crypt_parts_imp_used) text\<open>Rewriting rule for private encryption keys. Analogous rewriting rules for other keys aren't needed.\<close> lemma parts_image_priEK: "[|Key (priEK (CA i)) \<in> parts (Key`KK \<union> (knows Spy evs)); evs \<in> set_mr|] ==> priEK (CA i) \<in> KK | CA i \<in> bad" by auto text\<open>trivial proof because (priEK (CA i)) never appears even in (parts evs)\<close> lemma analz_image_priEK: "evs \<in> set_mr ==> (Key (priEK (CA i)) \<in> analz (Key`KK \<union> (knows Spy evs))) = (priEK (CA i) \<in> KK | CA i \<in> bad)" by (blast dest!: parts_image_priEK intro: analz_mono [THEN [2] rev_subsetD]) subsection\<open>Secrecy of Session Keys\<close> text\<open>This holds because if (priEK (CA i)) appears in any traffic then it must be known to the Spy, by \<open>Spy_see_private_Key\<close>\<close> lemma merK_neq_priEK: "[|Key merK \<notin> analz (knows Spy evs); Key merK \<in> parts (knows Spy evs); evs \<in> set_mr|] ==> merK \<noteq> priEK C" by blast text\<open>Lemma for message 4: either merK is compromised (when we don't care) or else merK hasn't been used to encrypt K.\<close> lemma msg4_priEK_disj: "[|Gets B \<lbrace>Crypt KM1 (sign K \<lbrace>Agent M, Nonce NM2, Key merSK, Key merEK\<rbrace>), Y\<rbrace> \<in> set evs; evs \<in> set_mr|] ==> (Key merSK \<in> analz (knows Spy evs) | merSK \<notin> range(\<lambda>C. priEK C)) \<and> (Key merEK \<in> analz (knows Spy evs) | merEK \<notin> range(\<lambda>C. priEK C))" apply (unfold sign_def) apply (blast dest: merK_neq_priEK) done lemma Key_analz_image_Key_lemma: "P \<longrightarrow> (Key K \<in> analz (Key`KK \<union> H)) \<longrightarrow> (K\<in>KK | Key K \<in> analz H) ==> P \<longrightarrow> (Key K \<in> analz (Key`KK \<union> H)) = (K\<in>KK | Key K \<in> analz H)" by (blast intro: analz_mono [THEN [2] rev_subsetD]) lemma symKey_compromise: "evs \<in> set_mr ==> (\<forall>SK KK. SK \<in> symKeys \<longrightarrow> (\<forall>K \<in> KK. K \<notin> range(\<lambda>C. priEK C)) \<longrightarrow> (Key SK \<in> analz (Key`KK \<union> (knows Spy evs))) = (SK \<in> KK | Key SK \<in> analz (knows Spy evs)))" apply (erule set_mr.induct) apply (safe del: impI intro!: Key_analz_image_Key_lemma [THEN impI]) apply (drule_tac [7] msg4_priEK_disj) apply (frule_tac [6] Gets_certificate_valid) apply (safe del: impI) apply (simp_all del: image_insert image_Un imp_disjL add: analz_image_keys_simps abbrev_simps analz_knows_absorb analz_knows_absorb2 analz_Key_image_insert_eq notin_image_iff Spy_analz_private_Key analz_image_priEK) \<comment> \<open>5 seconds on a 1.6GHz machine\<close> apply spy_analz \<comment> \<open>Fake\<close> apply auto \<comment> \<open>Message 3\<close> done lemma symKey_secrecy [rule_format]: "[|CA i \<notin> bad; K \<in> symKeys; evs \<in> set_mr|] ==> \<forall>X m. Says (Merchant m) (CA i) X \<in> set evs \<longrightarrow> Key K \<in> parts{X} \<longrightarrow> Merchant m \<notin> bad \<longrightarrow> Key K \<notin> analz (knows Spy evs)" apply (erule set_mr.induct) apply (drule_tac [7] msg4_priEK_disj) apply (frule_tac [6] Gets_certificate_valid) apply (safe del: impI) apply (simp_all del: image_insert image_Un imp_disjL add: analz_image_keys_simps abbrev_simps analz_knows_absorb analz_knows_absorb2 analz_Key_image_insert_eq symKey_compromise notin_image_iff Spy_analz_private_Key analz_image_priEK) apply spy_analz \<comment> \<open>Fake\<close> apply force \<comment> \<open>Message 1\<close> apply (auto intro: analz_into_parts [THEN usedI] in_parts_Says_imp_used) \<comment> \<open>Message 3\<close> done subsection\<open>Unicity\<close> lemma msg4_Says_imp_Notes: "[|Says (CA i) M \<lbrace>sign (priSK (CA i)) \<lbrace>Agent M, Nonce NM2, Agent (CA i)\<rbrace>, cert M merSK onlySig (priSK (CA i)), cert M merEK onlyEnc (priSK (CA i)), cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)\<rbrace> \<in> set evs; evs \<in> set_mr |] ==> Notes (CA i) (Key merSK) \<in> set evs \<and> Notes (CA i) (Key merEK) \<in> set evs" apply (erule rev_mp) apply (erule set_mr.induct) apply (simp_all (no_asm_simp)) done text\<open>Unicity of merSK wrt a given CA: merSK uniquely identifies the other components, including merEK\<close> lemma merSK_unicity: "[|Says (CA i) M \<lbrace>sign (priSK(CA i)) \<lbrace>Agent M, Nonce NM2, Agent (CA i)\<rbrace>, cert M merSK onlySig (priSK (CA i)), cert M merEK onlyEnc (priSK (CA i)), cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)\<rbrace> \<in> set evs; Says (CA i) M' \<lbrace>sign (priSK(CA i)) \<lbrace>Agent M', Nonce NM2', Agent (CA i)\<rbrace>, cert M' merSK onlySig (priSK (CA i)), cert M' merEK' onlyEnc (priSK (CA i)), cert (CA i) (pubSK(CA i)) onlySig (priSK RCA)\<rbrace> \<in> set evs; evs \<in> set_mr |] ==> M=M' \<and> NM2=NM2' \<and> merEK=merEK'" apply (erule rev_mp) apply (erule rev_mp) apply (erule set_mr.induct) apply (simp_all (no_asm_simp)) apply (blast dest!: msg4_Says_imp_Notes) done text\<open>Unicity of merEK wrt a given CA: merEK uniquely identifies the other components, including merSK\<close> lemma merEK_unicity: "[|Says (CA i) M \<lbrace>sign (priSK(CA i)) \<lbrace>Agent M, Nonce NM2, Agent (CA i)\<rbrace>, cert M merSK onlySig (priSK (CA i)), cert M merEK onlyEnc (priSK (CA i)), cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)\<rbrace> \<in> set evs; Says (CA i) M' \<lbrace>sign (priSK(CA i)) \<lbrace>Agent M', Nonce NM2', Agent (CA i)\<rbrace>, cert M' merSK' onlySig (priSK (CA i)), cert M' merEK onlyEnc (priSK (CA i)), cert (CA i) (pubSK(CA i)) onlySig (priSK RCA)\<rbrace> \<in> set evs; evs \<in> set_mr |] ==> M=M' \<and> NM2=NM2' \<and> merSK=merSK'" apply (erule rev_mp) apply (erule rev_mp) apply (erule set_mr.induct) apply (simp_all (no_asm_simp)) apply (blast dest!: msg4_Says_imp_Notes) done text\<open>-No interest on secrecy of nonces: they appear to be used only for freshness. -No interest on secrecy of merSK or merEK, as in CR. -There's no equivalent of the PAN\<close> subsection\<open>Primary Goals of Merchant Registration\<close> subsubsection\<open>The merchant's certificates really were created by the CA, provided the CA is uncompromised\<close> text\<open>The assumption \<^term>\<open>CA i \<noteq> RCA\<close> is required: step 2 uses certificates of the same form.\<close> lemma certificate_merSK_valid_lemma [intro]: "[|Crypt (priSK (CA i)) \<lbrace>Agent M, Key merSK, onlySig\<rbrace> \<in> parts (knows Spy evs); CA i \<notin> bad; CA i \<noteq> RCA; evs \<in> set_mr|] ==> \<exists>X Y Z. Says (CA i) M \<lbrace>X, cert M merSK onlySig (priSK (CA i)), Y, Z\<rbrace> \<in> set evs" apply (erule rev_mp) apply (erule set_mr.induct) apply (simp_all (no_asm_simp)) apply auto done lemma certificate_merSK_valid: "[| cert M merSK onlySig (priSK (CA i)) \<in> parts (knows Spy evs); CA i \<notin> bad; CA i \<noteq> RCA; evs \<in> set_mr|] ==> \<exists>X Y Z. Says (CA i) M \<lbrace>X, cert M merSK onlySig (priSK (CA i)), Y, Z\<rbrace> \<in> set evs" by auto lemma certificate_merEK_valid_lemma [intro]: "[|Crypt (priSK (CA i)) \<lbrace>Agent M, Key merEK, onlyEnc\<rbrace> \<in> parts (knows Spy evs); CA i \<notin> bad; CA i \<noteq> RCA; evs \<in> set_mr|] ==> \<exists>X Y Z. Says (CA i) M \<lbrace>X, Y, cert M merEK onlyEnc (priSK (CA i)), Z\<rbrace> \<in> set evs" apply (erule rev_mp) apply (erule set_mr.induct) apply (simp_all (no_asm_simp)) apply auto done lemma certificate_merEK_valid: "[| cert M merEK onlyEnc (priSK (CA i)) \<in> parts (knows Spy evs); CA i \<notin> bad; CA i \<noteq> RCA; evs \<in> set_mr|] ==> \<exists>X Y Z. Says (CA i) M \<lbrace>X, Y, cert M merEK onlyEnc (priSK (CA i)), Z\<rbrace> \<in> set evs" by auto text\<open>The two certificates - for merSK and for merEK - cannot be proved to have originated together\<close> end
Formal statement is: lemma At: "At (f n) n" Informal statement is: $f$ is at $n$.
// // Copyright (c) 2019-2022 Ruben Perez Hidalgo (rubenperez038 at gmail dot com) // // Distributed under 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) // #ifndef BOOST_MYSQL_TEST_INTEGRATION_UTILS_INCLUDE_ER_STATEMENT_HPP #define BOOST_MYSQL_TEST_INTEGRATION_UTILS_INCLUDE_ER_STATEMENT_HPP #include <memory> #include "network_result.hpp" #include "er_resultset.hpp" #include <forward_list> #include <vector> #include <boost/mysql/value.hpp> #include <boost/mysql/execute_params.hpp> namespace boost { namespace mysql { namespace test { using value_list_it = std::forward_list<value>::const_iterator; class er_statement { public: virtual ~er_statement() {} virtual bool valid() const = 0; virtual unsigned id() const = 0; virtual unsigned num_params() const = 0; virtual network_result<er_resultset_ptr> execute_container(const std::vector<value>&) = 0; virtual network_result<er_resultset_ptr> execute_params(const execute_params<value_list_it>& params) = 0; virtual network_result<no_result> close() = 0; }; using er_statement_ptr = std::unique_ptr<er_statement>; } // test } // mysql } // boost #endif
From Test Require Import tactic. Section FOFProblem. Variable Universe : Set. Variable UniverseElement : Universe. Variable wd_ : Universe -> Universe -> Prop. Variable col_ : Universe -> Universe -> Universe -> Prop. Variable col_swap1_1 : (forall A B C : Universe, (col_ A B C -> col_ B A C)). Variable col_swap2_2 : (forall A B C : Universe, (col_ A B C -> col_ B C A)). Variable col_triv_3 : (forall A B : Universe, col_ A B B). Variable wd_swap_4 : (forall A B : Universe, (wd_ A B -> wd_ B A)). Variable col_trans_5 : (forall P Q A B C : Universe, ((wd_ P Q /\ (col_ P Q A /\ (col_ P Q B /\ col_ P Q C))) -> col_ A B C)). Theorem pipo_6 : (forall O E Eprime A B C Aprime Cprime : Universe, ((wd_ O Eprime /\ (wd_ E Eprime /\ (wd_ B O /\ (wd_ A O /\ (wd_ C O /\ (wd_ Aprime O /\ (wd_ O E /\ (col_ O Eprime Aprime /\ (col_ O Eprime O /\ (col_ O Eprime Cprime /\ (col_ Eprime B O /\ (col_ O E A /\ (col_ O E B /\ col_ O E C))))))))))))) -> col_ O E Eprime)). Proof. time tac. Qed. End FOFProblem.