text
stringlengths 0
3.34M
|
---|
using Test, OMEinsum
using OMEinsum: IndexGroup, NestedEinsum, parse_nested
@testset "einsequence" begin
@test push!(IndexGroup([],1), 'c').inds == IndexGroup(['c'], 1).inds
@test isempty(IndexGroup([],1))
@test_throws ArgumentError parse_nested("((ij,jk),km")
@test_throws ArgumentError parse_nested("((ij,jk),k1)")
a, b, c = rand(2,2), rand(2,2), rand(2,2)
abc1 = ein"(ij,jk),km -> im"(a,b,c)
abc2 = ein"((ij,jk),km) -> im"(a,b,c)
abc3 = ein"ij,jk,km -> im"(a,b,c)
@test abc1 ≈ abc2 ≈ abc3
end
@testset "macro" begin
b, c, d = rand(2,2), rand(2,2,2), rand(2,2,2,2)
@ein a[i,j] := b[i,k] * c[k,k,l] * d[l,m,m,j]
@ein a2[i,j] := b[i,k] * (c[k,k,l] * d[l,m,m,j])
@test a ≈ a2
end
|
State Before: R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
⊢ degree (X ^ n) = ↑n State After: no goals Tactic: rw [X_pow_eq_monomial, degree_monomial _ (one_ne_zero' R)]
|
import logic.basic
variables {α β : Type*} {a b : α} {c d : β}
protected lemma iff.ne : (a = b ↔ c = d) → (a ≠ b ↔ c ≠ d) := iff.not
|
opt_d<-function(v){
n<- length(v)
profiled_lik <- function(v1, v2){
mu1 <- mean(v1)
mu2 <- mean(v2)
d1<- v1- mu1
d2<- v2- mu2
n<- length(v1) + length(v2)
sigma2 <- (sum(d1^2) + sum(d2^2))/(n-1)
-0.5*log(sigma2*2*pi)*n- (n-1)/2
}
list_p_lik<- do.call("c",lapply(c(1:(n-1)), function(i){
profiled_lik(v[1:i],v[(i+1):n])
}))
which.max(list_p_lik)
}
|
I look forward to a learning adventure in geography with my 6th grade students this year. We will look at the geography of the world and focus on the cultures of all people. Along the way we will discover the tools and technology that shaped our past and developed our culture.
You may contact me via e-mail [email protected] with any questions or concerns.
CONTINUE TO EXPLORE THIS SITE AND COME BACK OFTEN FOR UPDATES!
|
#include <boost/log/keywords/incomplete_marker.hpp>
|
//
// Copyright (c) 2016-2019 CNRS INRIA
//
#ifndef __pinocchio_joint_composite_hpp__
#define __pinocchio_joint_composite_hpp__
#include "pinocchio/multibody/joint/fwd.hpp"
#include "pinocchio/multibody/joint/joint-collection.hpp"
#include "pinocchio/multibody/joint/joint-basic-visitors.hpp"
#include "pinocchio/container/aligned-vector.hpp"
#include "pinocchio/spatial/act-on-set.hpp"
#include "pinocchio/serialization/fwd.hpp"
namespace pinocchio
{
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
struct JointCompositeTpl;
template<typename _Scalar, int _Options, template<typename S, int O> class JointCollectionTpl>
struct traits< JointCompositeTpl<_Scalar,_Options,JointCollectionTpl> >
{
typedef _Scalar Scalar;
enum {
Options = _Options,
NQ = Eigen::Dynamic,
NV = Eigen::Dynamic
};
typedef JointCollectionTpl<Scalar,Options> JointCollection;
typedef JointDataCompositeTpl<Scalar,Options,JointCollectionTpl> JointDataDerived;
typedef JointModelCompositeTpl<Scalar,Options,JointCollectionTpl> JointModelDerived;
typedef ConstraintTpl<Eigen::Dynamic,Scalar,Options> Constraint_t;
typedef SE3Tpl<Scalar,Options> Transformation_t;
typedef MotionTpl<Scalar,Options> Motion_t;
typedef MotionTpl<Scalar,Options> Bias_t;
typedef Eigen::Matrix<Scalar,6,Eigen::Dynamic,Options> F_t;
// [ABA]
typedef Eigen::Matrix<Scalar,6,Eigen::Dynamic,Options> U_t;
typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic,Options> D_t;
typedef Eigen::Matrix<Scalar,6,Eigen::Dynamic,Options> UD_t;
PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1,Options> ConfigVector_t;
typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1,Options> TangentVector_t;
};
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
struct traits< JointModelCompositeTpl<Scalar,Options,JointCollectionTpl> >
{ typedef JointCompositeTpl<Scalar,Options,JointCollectionTpl> JointDerived; };
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
struct traits< JointDataCompositeTpl<Scalar,Options,JointCollectionTpl> >
{ typedef JointCompositeTpl<Scalar,Options,JointCollectionTpl> JointDerived; };
template<typename _Scalar, int _Options, template<typename S, int O> class JointCollectionTpl>
struct JointDataCompositeTpl
: public JointDataBase< JointDataCompositeTpl<_Scalar,_Options,JointCollectionTpl> >
{
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
typedef JointDataBase<JointDataCompositeTpl> Base;
typedef JointCompositeTpl<_Scalar,_Options,JointCollectionTpl> JointDerived;
PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE;
PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
typedef JointCollectionTpl<Scalar,Options> JointCollection;
typedef JointDataTpl<Scalar,Options,JointCollectionTpl> JointDataVariant;
typedef container::aligned_vector<JointDataVariant> JointDataVector;
// JointDataComposite() {} // can become necessary if we want a vector of JointDataComposite ?
JointDataCompositeTpl()
: joints()
, iMlast(0), pjMi(0)
, S(0)
, M(),v(),c()
, U(6,0), Dinv(0,0), UDinv(6,0)
, StU(0,0)
{}
JointDataCompositeTpl(const JointDataVector & joint_data, const int /*nq*/, const int nv)
: joints(joint_data), iMlast(joint_data.size()), pjMi(joint_data.size())
, S(nv)
, M(), v(), c()
, U(6,nv), Dinv(nv,nv), UDinv(6,nv)
, StU(nv,nv)
{}
/// \brief Vector of joints
JointDataVector joints;
/// \brief Transforms from previous joint to last joint
container::aligned_vector<Transformation_t> iMlast;
/// \brief Transforms from previous joint to joint i
container::aligned_vector<Transformation_t> pjMi;
Constraint_t S;
Transformation_t M;
Motion_t v;
Bias_t c;
// // [ABA] specific data
U_t U;
D_t Dinv;
UD_t UDinv;
D_t StU;
static std::string classname() { return std::string("JointDataComposite"); }
std::string shortname() const { return classname(); }
};
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline std::ostream & operator <<(std::ostream & os, const JointDataCompositeTpl<Scalar,Options,JointCollectionTpl> & jdata)
{
typedef typename JointDataCompositeTpl<Scalar,Options,JointCollectionTpl>::JointDataVector JointDataVector;
os << "JointDataComposite containing following models:\n" ;
for (typename JointDataVector::const_iterator it = jdata.joints.begin();
it != jdata.joints.end(); ++it)
os << " " << shortname(*it) << std::endl;
return os;
}
template<typename NewScalar, typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
struct CastType< NewScalar, JointModelCompositeTpl<Scalar,Options,JointCollectionTpl> >
{
typedef JointModelCompositeTpl<NewScalar,Options,JointCollectionTpl> type;
};
template<typename _Scalar, int _Options, template<typename S, int O> class JointCollectionTpl>
struct JointModelCompositeTpl
: public JointModelBase< JointModelCompositeTpl<_Scalar,_Options,JointCollectionTpl> >
{
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
typedef JointModelBase<JointModelCompositeTpl> Base;
typedef JointCompositeTpl<_Scalar,_Options,JointCollectionTpl> JointDerived;
PINOCCHIO_JOINT_TYPEDEF_TEMPLATE;
typedef JointCollectionTpl<Scalar,Options> JointCollection;
typedef JointModelTpl<Scalar,Options,JointCollectionTpl> JointModelVariant;
typedef SE3Tpl<Scalar,Options> SE3;
typedef MotionTpl<Scalar,Options> Motion;
typedef InertiaTpl<Scalar,Options> Inertia;
typedef container::aligned_vector<JointModelVariant> JointModelVector;
using Base::id;
using Base::idx_q;
using Base::idx_v;
using Base::setIndexes;
using Base::nq;
using Base::nv;
/// \brief Default contructor
JointModelCompositeTpl()
: joints()
, jointPlacements()
, m_nq(0)
, m_nv(0)
, njoints(0)
{}
/// \brief Default contructor with a defined size
JointModelCompositeTpl(const size_t size)
: joints()
, jointPlacements()
, m_nq(0)
, m_nv(0)
, njoints(0)
{
joints.reserve(size); jointPlacements.reserve(size);
m_idx_q.reserve(size); m_idx_v.reserve(size);
m_nqs.reserve(size); m_nvs.reserve(size);
}
///
/// \brief Constructor with one joint.
///
/// \param jmodel Model of the first joint.
/// \param placement Placement of the first joint w.r.t. the joint origin.
///
template<typename JointModel>
JointModelCompositeTpl(const JointModelBase<JointModel> & jmodel,
const SE3 & placement = SE3::Identity())
: joints(1,(JointModelVariant)jmodel.derived())
, jointPlacements(1,placement)
, m_nq(jmodel.nq())
, m_nv(jmodel.nv())
, m_idx_q(1,0), m_nqs(1,jmodel.nq())
, m_idx_v(1,0), m_nvs(1,jmodel.nv())
, njoints(1)
{}
///
/// \brief Copy constructor.
///
/// \param other JointModel to copy.
///
JointModelCompositeTpl(const JointModelCompositeTpl & other)
: Base(other)
, joints(other.joints)
, jointPlacements(other.jointPlacements)
, m_nq(other.m_nq)
, m_nv(other.m_nv)
, m_idx_q(other.m_idx_q), m_nqs(other.m_nqs)
, m_idx_v(other.m_idx_v), m_nvs(other.m_nvs)
, njoints(other.njoints)
{}
///
/// \brief Add a joint to the vector of joints.
///
/// \param jmodel Model of the joint to add.
/// \param placement Placement of the joint relatively to its predecessor.
///
/// \return A reference to *this
///
template<typename JointModel>
JointModelDerived & addJoint(const JointModelBase<JointModel> & jmodel,
const SE3 & placement = SE3::Identity())
{
joints.push_back((JointModelVariant)jmodel.derived());
jointPlacements.push_back(placement);
m_nq += jmodel.nq(); m_nv += jmodel.nv();
updateJointIndexes();
njoints++;
return *this;
}
JointDataDerived createData() const
{
typename JointDataDerived::JointDataVector jdata(joints.size());
for (int i = 0; i < (int)joints.size(); ++i)
jdata[(size_t)i] = ::pinocchio::createData<Scalar,Options,JointCollectionTpl>(joints[(size_t)i]);
return JointDataDerived(jdata,nq(),nv());
}
template<typename, int, template<typename S, int O> class, typename>
friend struct JointCompositeCalcZeroOrderStep;
template<typename ConfigVectorType>
void calc(JointDataDerived & data, const Eigen::MatrixBase<ConfigVectorType> & qs) const;
template<typename, int, template<typename S, int O> class, typename, typename>
friend struct JointCompositeCalcFirstOrderStep;
template<typename ConfigVectorType, typename TangentVectorType>
void calc(JointDataDerived & data,
const Eigen::MatrixBase<ConfigVectorType> & qs,
const Eigen::MatrixBase<TangentVectorType> & vs) const;
template<typename Matrix6Like>
void calc_aba(JointDataDerived & data, const Eigen::MatrixBase<Matrix6Like> & I, const bool update_I) const
{
data.U.noalias() = I * data.S.matrix();
data.StU.noalias() = data.S.matrix().transpose() * data.U;
// compute inverse
data.Dinv.setIdentity();
data.StU.llt().solveInPlace(data.Dinv);
data.UDinv.noalias() = data.U * data.Dinv;
if (update_I)
PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like,I) -= data.UDinv * data.U.transpose();
}
Scalar finiteDifferenceIncrement() const
{
using std::max;
Scalar eps = 0;
for(typename JointModelVector::const_iterator it = joints.begin();
it != joints.end(); ++it)
eps = max((Scalar)::pinocchio::finiteDifferenceIncrement(*it),eps);
return eps;
}
int nv_impl() const { return m_nv; }
int nq_impl() const { return m_nq; }
/**
* @brief Update the indexes of subjoints in the stack
*/
void setIndexes_impl(JointIndex id, int q, int v)
{
Base::setIndexes_impl(id, q, v);
updateJointIndexes();
}
static std::string classname() { return std::string("JointModelComposite"); }
std::string shortname() const { return classname(); }
JointModelCompositeTpl & operator=(const JointModelCompositeTpl & other)
{
Base::operator=(other);
m_nq = other.m_nq;
m_nv = other.m_nv;
m_idx_q = other.m_idx_q;
m_idx_v = other.m_idx_v;
m_nqs = other.m_nqs;
m_nvs = other.m_nvs;
joints = other.joints;
jointPlacements = other.jointPlacements;
njoints = other.njoints;
return *this;
}
using Base::isEqual;
bool isEqual(const JointModelCompositeTpl & other) const
{
return Base::isEqual(other)
&& nq() == other.nq()
&& nv() == other.nv()
&& m_idx_q == other.m_idx_q
&& m_idx_v == other.m_idx_v
&& m_nqs == other.m_nqs
&& m_nvs == other.m_nvs
&& joints == other.joints
&& jointPlacements == other.jointPlacements
&& njoints == other.njoints;
}
/// \returns An expression of *this with the Scalar type casted to NewScalar.
template<typename NewScalar>
JointModelCompositeTpl<NewScalar,Options,JointCollectionTpl> cast() const
{
typedef JointModelCompositeTpl<NewScalar,Options,JointCollectionTpl> ReturnType;
ReturnType res((size_t)njoints);
res.setIndexes(id(),idx_q(),idx_v());
res.m_nq = m_nq;
res.m_nv = m_nv;
res.m_idx_q = m_idx_q;
res.m_idx_v = m_idx_v;
res.m_nqs = m_nqs;
res.m_nvs = m_nvs;
res.njoints = njoints;
res.joints.resize(joints.size());
res.jointPlacements.resize(jointPlacements.size());
for(size_t k = 0; k < jointPlacements.size(); ++k)
{
res.joints[k] = joints[k].template cast<NewScalar>();
res.jointPlacements[k] = jointPlacements[k].template cast<NewScalar>();
}
return res;
}
/// \brief Vector of joints contained in the joint composite.
JointModelVector joints;
/// \brief Vector of joint placements. Those placements correspond to the origin of the joint relatively to their parent.
container::aligned_vector<SE3> jointPlacements;
template<typename D>
typename SizeDepType<NQ>::template SegmentReturn<D>::ConstType
jointConfigSelector(const Eigen::MatrixBase<D>& a) const { return a.segment(Base::i_q,nq()); }
template<typename D>
typename SizeDepType<NQ>::template SegmentReturn<D>::Type
jointConfigSelector( Eigen::MatrixBase<D>& a) const { return a.segment(Base::i_q,nq()); }
template<typename D>
typename SizeDepType<NV>::template SegmentReturn<D>::ConstType
jointVelocitySelector(const Eigen::MatrixBase<D>& a) const { return a.segment(Base::i_v,nv()); }
template<typename D>
typename SizeDepType<NV>::template SegmentReturn<D>::Type
jointVelocitySelector( Eigen::MatrixBase<D>& a) const { return a.segment(Base::i_v,nv()); }
template<typename D>
typename SizeDepType<NV>::template ColsReturn<D>::ConstType
jointCols(const Eigen::MatrixBase<D>& A) const { return A.middleCols(Base::i_v,nv()); }
template<typename D>
typename SizeDepType<NV>::template ColsReturn<D>::Type
jointCols(Eigen::MatrixBase<D>& A) const { return A.middleCols(Base::i_v,nv()); }
template<typename D>
typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::ConstType
jointConfigSelector_impl(const Eigen::MatrixBase<D>& a) const { return a.segment(Base::i_q,nq()); }
template<typename D>
typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::Type
jointConfigSelector_impl(Eigen::MatrixBase<D>& a) const { return a.segment(Base::i_q,nq()); }
template<typename D>
typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::ConstType
jointVelocitySelector_impl(const Eigen::MatrixBase<D>& a) const { return a.segment(Base::i_v,nv()); }
template<typename D>
typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::Type
jointVelocitySelector_impl(Eigen::MatrixBase<D>& a) const { return a.segment(Base::i_v,nv()); }
template<typename D>
typename SizeDepType<Eigen::Dynamic>::template ColsReturn<D>::ConstType
jointCols_impl(const Eigen::MatrixBase<D>& A) const { return A.middleCols(Base::i_v,nv()); }
template<typename D>
typename SizeDepType<Eigen::Dynamic>::template ColsReturn<D>::Type
jointCols_impl(Eigen::MatrixBase<D>& A) const { return A.middleCols(Base::i_v,nv()); }
protected:
friend struct Serialize<JointModelCompositeTpl>;
template<typename, int, template<typename,int> class>
friend struct JointModelCompositeTpl;
/// \brief Update the indexes of the joints contained in the composition according
/// to the position of the joint composite.
void updateJointIndexes()
{
int idx_q = this->idx_q();
int idx_v = this->idx_v();
m_idx_q.resize(joints.size());
m_idx_v.resize(joints.size());
m_nqs.resize(joints.size());
m_nvs.resize(joints.size());
for(size_t i = 0; i < joints.size(); ++i)
{
JointModelVariant & joint = joints[i];
m_idx_q[i] = idx_q; m_idx_v[i] = idx_v;
::pinocchio::setIndexes(joint,i,idx_q,idx_v);
m_nqs[i] = ::pinocchio::nq(joint);
m_nvs[i] = ::pinocchio::nv(joint);
idx_q += m_nqs[i]; idx_v += m_nvs[i];
}
}
/// \brief Dimensions of the config and tangent space of the composite joint.
int m_nq, m_nv;
/// Keep information of both the dimension and the position of the joints in the composition.
/// \brief Index in the config vector
std::vector<int> m_idx_q;
/// \brief Dimension of the segment in the config vector
std::vector<int> m_nqs;
/// \brief Index in the tangent vector
std::vector<int> m_idx_v;
/// \brief Dimension of the segment in the tangent vector
std::vector<int> m_nvs;
public:
/// \brief Number of joints contained in the JointModelComposite
int njoints;
};
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline std::ostream & operator <<(std::ostream & os, const JointModelCompositeTpl<Scalar,Options,JointCollectionTpl> & jmodel)
{
typedef typename JointModelCompositeTpl<Scalar,Options,JointCollectionTpl>::JointModelVector JointModelVector;
os << "JointModelComposite containing following models:\n" ;
for (typename JointModelVector::const_iterator it = jmodel.joints.begin();
it != jmodel.joints.end(); ++it)
os << " " << shortname(*it) << std::endl;
return os;
}
} // namespace pinocchio
#include <boost/type_traits.hpp>
namespace boost
{
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
struct has_nothrow_constructor< ::pinocchio::JointModelCompositeTpl<Scalar,Options,JointCollectionTpl> >
: public integral_constant<bool,true> {};
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
struct has_nothrow_copy< ::pinocchio::JointModelCompositeTpl<Scalar,Options,JointCollectionTpl> >
: public integral_constant<bool,true> {};
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
struct has_nothrow_constructor< ::pinocchio::JointDataCompositeTpl<Scalar,Options,JointCollectionTpl> >
: public integral_constant<bool,true> {};
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
struct has_nothrow_copy< ::pinocchio::JointDataCompositeTpl<Scalar,Options,JointCollectionTpl> >
: public integral_constant<bool,true> {};
}
/* --- Details -------------------------------------------------------------- */
/* --- Details -------------------------------------------------------------- */
/* --- Details -------------------------------------------------------------- */
#include "pinocchio/multibody/joint/joint-composite.hxx"
#endif // ifndef __pinocchio_joint_composite_hpp__
|
It was announced on 6 August 2014 , that Villa Park would appear in the FIFA video game from FIFA 15 onwards , with all other Premier League stadiums also fully licensed from this game onwards .
|
%-------------------------------------------------------------------------------------------------------------------%
%
% IB2d is an Immersed Boundary Code (IB) for solving fully coupled non-linear
% fluid-structure interaction models. This version of the code is based off of
% Peskin's Immersed Boundary Method Paper in Acta Numerica, 2002.
%
% Author: Nicholas A. Battista
% Email: [email protected]
% Date Modified: April 2021
% Current Institution: TCNJ
%
% IB2d Date Created: May 27th, 2015
% Institution Created: UNC-CH
%
% This code is capable of creating Lagrangian Structures using:
% 1. Springs
% 2. Beams (torsional springs or non-invariant beams)
% 3. Target Points
% 4. Muscle-Model (combined Force-Length-Velocity model, "HIll+(Length-Tension)")
%
% One is able to update those Lagrangian Structure parameters, e.g., spring constants, resting lengths, etc
%
% There are a number of built in Examples, mostly used for teaching purposes.
%
% If you would like us to add a specific muscle model, please let Nick ([email protected]) know.
%
%--------------------------------------------------------------------------------------------------------------------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION: updates the target point positions
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function targets = update_Target_Point_Positions(dt,current_time,targets)
%IDs = targets(:,1); % Stores Lag-Pt IDs in col vector
%xPts= targets(:,2); % Original x-Values of x-Target Pts.
%yPts= targets(:,3); % Original y-Values of y-Target Pts.
%kStiffs = targets(:,4); % Stores Target Stiffnesses
%-----------------------------------------------------
% Geometric Translations to Quadrant 1
% since stored .mat geo data centered at (0,0)
%-----------------------------------------------------
xoffset = 1; % To put geometry into QUADRANT-1
yoffset = 0.5; % To put geometry into QUADRANT-1
%-----------------------------------------------
% Note: (1) ds for stored data is 0.6/(2*1024)
% (2) 'ratio' is comparing 1024:desired resolution
%-----------------------------------------------
Lx=2; % Horizontal Eulerian grid length
Nx=64; % Eulerian grid resolution
dx=Lx/Nx; % Eulerian grid spacing
ds=dx/2; % Lagrangian point spacing
%-----------------------------------------------
% Load prescribed position data for tentacles
%-----------------------------------------------
load('total_coeffs.mat')
load('coral_coeff_30.mat')
%-----------------------------------------------
% Arclength
%-----------------------------------------------
s=(0:ds:total_meanL)/total_meanL;
%---------------------------------------------------------
% Get index correponding to current time in
% simulation to determine how interpolation occurs
%---------------------------------------------------------
indx=ceil(current_time/dt)+1;
%-----------------------------------------------
% Load geometry state data
%-----------------------------------------------
load('cval.mat')
%-------------------------------------------------
% Get interpolation polynomial coefficients and
% then determine geometry of LEFT tentacle
%-------------------------------------------------
C1=c1vals(indx,:);
C2=c2vals(indx,:);
XbL_1=(C1(1)*s.^3+C1(2)*s.^2+C1(3)*s+C1(4));
YbL_1=(C2(1)*s.^3+C2(2)*s.^2+C2(3)*s+C2(4));
L_ten=sum(sqrt((XbL_1(2:end)-XbL_1(1:end-1)).^2 +(YbL_1(2:end)-YbL_1(1:end-1)).^2 ));
XbL=(C1(1)*s.^3+C1(2)*s.^2+C1(3)*s+C1(4))*total_meanL/L_ten+total_offset;
YbL=(C2(1)*s.^3+C2(2)*s.^2+C2(3)*s+C2(4))*total_meanL/L_ten;
%-------------------------------------------------------
% Set up symmetric RIGHT tentacle interpolation states
%-------------------------------------------------------
XbR=-XbL;
YbR=YbL;
%-------------------------------------------------------
% Get coral polyp STEM geometry
%-------------------------------------------------------
YbStem=(YbL(1))+0*XbStem;
%-------------------------------------------------------
% Combine geometry into one vector and translate
%-------------------------------------------------------
x=[flip(XbR) XbStem XbL];
y=[flip(YbR) YbStem YbL];
%
x = x+xoffset;
y = y+yoffset;
%-------------------------------------------------------
% Update target point positions!
%-------------------------------------------------------
targets(:,2) = x; % Store new xVals
targets(:,3) = y; % Store new yVals
|
# Parabolske koordinater
Parabolske koordinater $(u, v)$ er gitt ved posisjonsvektor
$$
\vec{r} = 2 u v \mathbf{i} + (u^2-v^2)\mathbf{j}
$$
1. Finn enhetsvektorne. Er de ortogonale?
2. Finn gradienten til skalarfelt $f(u, v) = (1-u^2)(1-v^2)$ representert med parabolske koordinater. Plott skalarfeltet med tilhørende gradient for $(u, v) \in [0, 1] \times [-1, 1]$. Bruk Kartesiske koordinater til plottingen.
Start med å importere funksjonalitet fra `sympy`, og lag to tupler (Python immutable list) for `psi=(u, v)` og `rv=(2uv, u**2-v**2)`
```python
import sympy as sp
import numpy as np
u, v = psi = sp.symbols('u,v', real=True)
rv = (2*u*v, u**2-v**2)
```
Finn enhetsvektorer og skaleringsfaktorer. Lager to generelle funksjoner som kan gjenbrukes for andre koordinater
```python
def basisvektorer(psi, rv):
"""Returner basisvektorer
Parameters
----------
psi : Tuple av nye variable
rv : Posisjonsvektor
"""
b = np.zeros((len(psi), len(rv)), dtype=object)
for i, ui in enumerate(psi):
for j, rj in enumerate(rv):
b[i, j] = sp.simplify(rj.diff(ui, 1))
return b
def skaleringsfaktorer(b):
"""Returner skaleringsfaktorer
Parameters
----------
b : basisvektorer
"""
h = np.zeros(b.shape[0], dtype=object)
for i, s in enumerate(np.sum(b**2, axis=1)):
h[i] = sp.simplify(sp.sqrt(s))
return h
def enhetsvektorer(psi, rv):
"""Returner enhetsvektorer og skaleringsfaktorer
Parameters
----------
psi : Tuple av nye variable
rv : Posisjonsvektor
"""
b = basisvektorer(psi, rv)
hi = skaleringsfaktorer(b)
return b / hi[None, :], hi
```
```python
e, hi = enhetsvektorer(psi, rv)
```
Skriv ut enhetsvektorer og sjekk at de stemmer med Vector Calculus example 6.2.
```python
print(e)
print(hi)
```
[[v/sqrt(u**2 + v**2) u/sqrt(u**2 + v**2)]
[u/sqrt(u**2 + v**2) -v/sqrt(u**2 + v**2)]]
[2*sqrt(u**2 + v**2) 2*sqrt(u**2 + v**2)]
Lag skalarfelt $f(u, v) = (1-u^2)(1-v^2)$
```python
f = (1-u**2)*(1-v**2)
```
Plott skalarfelt. Merk at vi bruker $x=2uv$ og $y=u^2-v^2$ evaluert på et strukturert grid. `sp.lambdify` er en effektiv (vektorisert) metode å evaluere en `sympy` funksjon på. Så under tilsvarer `f(u, v) = sp.lambdify((u, v), f)(ui, vi)`.
```python
N = 20
ui = np.broadcast_to(np.linspace(0, 1, N)[:, None], (N, N))
vi = np.broadcast_to(np.linspace(-1, 1, N)[None, :], (N, N))
fj = sp.lambdify((u, v), f)(ui, vi)
```
Hvis vi nå velger å plotte $f(u, v)$ i det nye koordinatsystemet får vi.
```python
import matplotlib.pyplot as plt
%matplotlib inline
plt.contourf(ui, vi, fj)
```
```python
ui = np.broadcast_to(np.linspace(0, 1, N)[:, None], (N, N))
vi = np.broadcast_to(np.linspace(-1, 1, N)[None, :], (N, N))
for cu in np.linspace(0, 1, 10):
plt.plot(2*cu*vi[0], (cu**2-vi[0]**2), 'b')
for cv in np.linspace(-1, 1, 20):
plt.plot(2*ui[:, 0]*cv, ui[:, 0]**2-cv**2, 'r')
plt.xlabel('x')
plt.ylabel('y')
```
Men det er kanskje mer interessant å se resultatet i fysiske (Kartesiske) koordinater. Vi trenger derfor å finne kartesiske `x, y` fra de gitte `u, v`. Gjør dette som følger
```python
mesh = []
for rj in rv:
mesh.append(sp.lambdify((u, v), rj)(ui, vi))
x, y = mesh
plt.contourf(x, y, fj)
```
Å plotte gradienten i Kartesiske koordinater er mer involvert siden vi har beregnet gradienten i de nye koordinatene og derfor trenger å projisere ved å ta prikk-produktet av gradientvektoren
$$
\begin{align}
\frac{\partial f}{\partial x} &= \nabla f \cdot \mathbf{i},\\
\frac{\partial f}{\partial y} &= \nabla f \cdot \mathbf{j}.
\end{align}
$$
For å finne gradientvektoren deriverer vi først for å finne komponentene til $\nabla f$ i nye koordinater
```python
df = np.array((1/hi[0]*f.diff(u, 1), 1/hi[1]*f.diff(v, 1)))
print(df)
```
[-u*(1 - v**2)/sqrt(u**2 + v**2) -v*(1 - u**2)/sqrt(u**2 + v**2)]
Merk at `df` nå ikke inneholder enhetsvektorer. Så før vi prikker med $\mathbf{i}$ og $\mathbf{j}$ må vi gange med enhetsvektorene $\mathbf{e_1}$ og $\mathbf{e_2}$ for å få $\nabla f$
$$
\nabla f = \frac{\mathbf{e}_1}{h_1}\frac{\partial f}{\partial u} + \frac{\mathbf{e}_2}{h_2}\frac{\partial f}{\partial v},
$$
```python
gradf = e[0]*df[0] + e[1]*df[1]
print(gradf)
```
[-u*v*(1 - u**2)/(u**2 + v**2) - u*v*(1 - v**2)/(u**2 + v**2)
-u**2*(1 - v**2)/(u**2 + v**2) + v**2*(1 - u**2)/(u**2 + v**2)]
Merk at vi med denne summen nå har fått satt inn for $\mathbf{e_1}$ og $\mathbf{e_2}$, så vektoren `gradf` over er allerede gitt ved Kartesiske enhetsvektorer (e.g., siden $\mathbf{e_1} = 2/h_1(v\mathbf{i} + u\mathbf{j})$). Ved prikking mot $\mathbf{i}$ er resultatet derfor `gradf[0]`, mens prikking mot $\mathbf{j}$ gir `gradf[1]`. Derfor skipper vi prikkproduktet og henter ganske enkelt de Kartesiske vektorkomponentene
```python
dfdxi = sp.lambdify((u, v), gradf[0])(ui, vi)
dfdyi = sp.lambdify((u, v), gradf[1])(ui, vi)
plt.contourf(x, y, fj)
plt.quiver(x, y, dfdxi, dfdyi, scale=20)
```
Merk at gradienten peker i retning av økende $f$.
|
context("ncdc_locs_cats")
test_that("ncdc_locs_cats returns the correct ...", {
skip_on_cran()
vcr::use_cassette("ncdc_locs_cats", {
tt <- ncdc_locs_cats()
uu <- ncdc_locs_cats(locationcategoryid='CLIM_REG')
vv <- ncdc_locs_cats(startdate='1970-01-01')
# class
expect_is(tt, "ncdc_locs_cats")
expect_is(uu$data, "data.frame")
expect_is(vv, "ncdc_locs_cats")
expect_is(tt$meta, "list")
expect_is(tt$data, "data.frame")
expect_is(tt$meta$totalCount, "integer")
expect_is(tt$data$id, "character")
# dimensions
expect_equal(length(tt$meta), 3)
expect_equal(NCOL(tt$data), 2)
expect_equal(dim(uu$data), c(1,2))
expect_equal(NCOL(vv$data), 2)
expect_equal(length(tt), 2)
expect_equal(length(uu), 2)
expect_equal(length(vv), 2)
})
})
|
[STATEMENT]
lemma fls_X_intpow_times_fls_X_intpow:
"(fls_X_intpow i :: 'a::semiring_1 fls) * fls_X_intpow j = fls_X_intpow (i+j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fls_X_intpow i * fls_X_intpow j = fls_X_intpow (i + j)
[PROOF STEP]
by (simp add: fls_times_both_shifted_simp)
|
#include <math.h>
#include <stdlib.h>
#if !defined(__APPLE__)
#include <malloc.h>
#endif
#include <stdio.h>
#include <assert.h>
#include <time.h>
#include <string.h>
#include <stdbool.h>
#include <fftw3.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_sf_erf.h>
#include <gsl/gsl_integration.h>
#include <gsl/gsl_spline.h>
#include <gsl/gsl_sf_gamma.h>
#include <gsl/gsl_sf_legendre.h>
#include <gsl/gsl_sf_bessel.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_eigen.h>
#include <gsl/gsl_sf_expint.h>
#include <gsl/gsl_deriv.h>
#include <gsl/gsl_interp2d.h>
#include <gsl/gsl_spline2d.h>
#include "../cosmolike_core/theory/basics.c"
#include "../cosmolike_core/theory/structs.c"
#include "../cosmolike_core/theory/parameters.c"
#include "../cosmolike_core/emu17/P_cb/emu.c"
#include "../cosmolike_core/theory/recompute.c"
#include "../cosmolike_core/theory/cosmo3D.c"
#include "../cosmolike_core/theory/redshift_spline.c"
#include "../cosmolike_core/theory/halo.c"
#include "../cosmolike_core/theory/HOD.c"
#include "../cosmolike_core/theory/pt.c"
#include "../cosmolike_core/theory/cosmo2D_fourier.c"
#include "../cosmolike_core/theory/IA.c"
#include "../cosmolike_core/theory/BAO.c"
#include "../cosmolike_core/theory/external_prior.c"
#include "../cosmolike_core/theory/covariances_3D.c"
#include "../cosmolike_core/theory/covariances_fourier.c"
#include "../cosmolike_core/theory/CMBxLSS_fourier.c"
#include "../cosmolike_core/theory/covariances_CMBxLSS_fourier.c"
#include "../cosmolike_core/theory/covariances_binned_simple.c"
#include "../cosmolike_core/theory/run_covariances_fourier_binned_6x2pt.c"
#include "init_LSSxCMB.c"
int main(int argc, char** argv)
{
int i,l,m,n,o,s,p,nl1,t,k;
char OUTFILE[400],filename[400],arg1[400],arg2[400];
int N_scenarios=2;
double area_table[2]={12300.0,16500.0}; // Y1 corresponds to DESC SRD Y1, Y6 corresponds to assuming that we cover the full SO area=0.4*fsky and at a depth of 26.1 which is in a range of reasonable scenarios (see https://github.com/LSSTDESC/ObsStrat/tree/static/static )
double nsource_table[2]={11.0,23.0};
double nlens_table[2]={18.0,41.0};
char survey_designation[2][200]={"LSSTxSO_Y1","LSSTxSO_Y6"};
char source_zfile[2][400]={"src_LSSTY1","src_LSSTY6"};
#ifdef ONESAMPLE
char lens_zfile[2][400]={"src_LSSTY1","src_LSSTY6"};
nlens_table[0] = nsource_table[0];
nlens_table[1] = nsource_table[1];
#else
char lens_zfile[2][400]={"lens_LSSTY1","lens_LSSTY6"};
#endif
int hit=atoi(argv[1]);
Ntable.N_a=100;
k=1;
t = atoi(argv[2]);
//RUN MODE setup
init_cosmo_runmode("emu");
// init_binning_fourier(20,30.0,3000.0,3000.0,21.0,10,10);
init_binning_fourier(15,20.0,3000.0,3000.0,0.0,10,10);
init_survey(survey_designation[t],nsource_table[t],nlens_table[t],area_table[t]);
sprintf(arg1,"zdistris/%s",source_zfile[t]);
sprintf(arg2,"zdistris/%s",lens_zfile[t]);
init_galaxies(arg1,arg2,"none","none","source_std","LSST_gold");
init_IA("none","GAMA");
init_probes("6x2pt");
if(t==0) init_cmb("so_Y1");
if(t==1) init_cmb("so_Y5");
cmb.fsky = survey.area*survey.area_conversion_factor/(4.*M_PI);
//set l-bins for shear, ggl, clustering, clusterWL
double lmin=like.lmin;
double lmax=like.lmax;
int Nell=like.Ncl;
int Ncl = Nell;
double logdl=(log(lmax)-log(lmin))/Nell;
double *ellmin, *dell;
ellmin=create_double_vector(0,Nell);
dell=create_double_vector(0,Nell-1);
double ellmax;
for(i=0; i<Nell ; i++){
ellmin[i]=exp(log(lmin)+(i+0.0)*logdl);
ellmax = exp(log(lmin)+(i+1.0)*logdl);
dell[i]=ellmax-ellmin[i];
}
ellmin[Nell] = ellmax;
like.ell = ellmin;
covparams.ng = 1;
covparams.cng= 0;
printf("----------------------------------\n");
sprintf(survey.name,"%s_area%le_ng%le_nl%le",survey_designation[t],survey.area,survey.n_gal,survey.n_lens);
printf("area: %le n_source: %le n_lens: %le\n",survey.area,survey.n_gal,survey.n_lens);
// sprintf(covparams.outdir,"/home/u17/timeifler/covparallel/");
#ifdef ONESAMPLE
sprintf(covparams.outdir,"out_cov_lsstxso_1sample/");
#else
sprintf(covparams.outdir,"out_cov_lsstxso/");
//sprintf(covparams.outdir,"/halo_nobackup/cosmos/teifler/covparallel/");
#endif
printf("----------------------------------\n");
if (like.shear_shear)
{
sprintf(OUTFILE,"%s_ssss_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.shear_Npowerspectra; l++){
for (m=l;m<tomo.shear_Npowerspectra; m++){
if(k==hit){
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_shear_shear_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.pos_pos)
{
sprintf(OUTFILE,"%s_llll_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.clustering_Npowerspectra; l++){
for (m=l;m<tomo.clustering_Npowerspectra; m++){
if(k==hit){
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_clustering_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.shear_pos)
{
sprintf(OUTFILE,"%s_lsls_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.ggl_Npowerspectra; l++){
for (m=l;m<tomo.ggl_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_ggl_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.shear_pos && like.shear_shear)
{
sprintf(OUTFILE,"%s_lsss_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.ggl_Npowerspectra; l++){
for (m=0;m<tomo.shear_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_ggl_shear_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.pos_pos && like.shear_shear)
{
sprintf(OUTFILE,"%s_llss_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.clustering_Npowerspectra; l++){
for (m=0;m<tomo.shear_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_clustering_shear_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.pos_pos && like.shear_pos)
{
sprintf(OUTFILE,"%s_llls_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.clustering_Npowerspectra; l++){
for (m=0;m<tomo.ggl_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_clustering_ggl_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.gk && like.shear_shear)
{
sprintf(OUTFILE,"%s_lkss_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.clustering_Nbin; l++){
for (m=0;m<tomo.shear_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_gk_shear_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.ks && like.shear_shear)
{
sprintf(OUTFILE,"%s_ksss_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.shear_Nbin; l++){
for (m=0;m<tomo.shear_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_ks_shear_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.gk && like.shear_pos)
{
sprintf(OUTFILE,"%s_lkls_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.clustering_Nbin; l++){
for (m=0;m<tomo.ggl_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_gk_ggl_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.ks && like.shear_pos)
{
sprintf(OUTFILE,"%s_ksls_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.shear_Nbin; l++){
for (m=0;m<tomo.ggl_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_ks_ggl_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.gk && like.pos_pos)
{
sprintf(OUTFILE,"%s_lkll_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.clustering_Nbin; l++){
for (m=0;m<tomo.clustering_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_gk_clustering_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.ks && like.pos_pos)
{
sprintf(OUTFILE,"%s_ksll_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.shear_Nbin; l++){
for (m=0;m<tomo.clustering_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_ks_clustering_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.gk)
{
sprintf(OUTFILE,"%s_lklk_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.clustering_Nbin; l++){
for (m=l;m<tomo.clustering_Nbin; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_gk_gk_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.ks && like.gk)
{
sprintf(OUTFILE,"%s_kslk_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.shear_Nbin; l++){
for (m=0;m<tomo.clustering_Nbin; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_ks_gk_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
if (like.ks)
{
sprintf(OUTFILE,"%s_ksks_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (l=0;l<tomo.shear_Nbin; l++){
for (m=l;m<tomo.shear_Nbin; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_ks_ks_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,l,m,k);
}
k=k+1;
}
}
}
////////
if (like.kk && like.shear_shear)
{
sprintf(OUTFILE,"%s_kkss_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (m=0;m<tomo.shear_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_kk_shear_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,m,k);
}
k=k+1;
}
}
if (like.kk && like.shear_pos)
{
sprintf(OUTFILE,"%s_kkls_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (m=0;m<tomo.ggl_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_kk_ggl_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,m,k);
}
k=k+1;
}
}
if (like.kk && like.pos_pos)
{
sprintf(OUTFILE,"%s_kkll_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (m=0;m<tomo.clustering_Npowerspectra; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_kk_clustering_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,m,k);
}
k=k+1;
}
}
if (like.kk && like.gk)
{
sprintf(OUTFILE,"%s_kklk_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (m=0;m<tomo.clustering_Nbin; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_kk_gk_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,m,k);
}
k=k+1;
}
}
if (like.kk && like.ks)
{
sprintf(OUTFILE,"%s_kkks_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
for (m=0;m<tomo.shear_Nbin; m++){
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_kk_ks_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,m,k);
}
k=k+1;
}
}
if (like.kk)
{
sprintf(OUTFILE,"%s_kkkk_cov_Ncl%d_Ntomo%d",survey.name,Ncl,tomo.shear_Nbin);
if(k==hit) {
sprintf(filename,"%s%s_%d",covparams.outdir,OUTFILE,k);
// if (fopen(filename, "r") != NULL){exit(1);}
run_cov_kk_kk_fourier_bin(OUTFILE,covparams.outdir,ellmin,Ncl,k);
}
k=k+1;
}
printf("number of cov blocks for parallelization: %d\n",k-1);
printf("-----------------\n");
printf("PROGRAM EXECUTED\n");
printf("-----------------\n");
return 0;
}
|
/* eigen/schur.h
*
* Copyright (C) 2006 Patrick Alken
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_SCHUR_H__
#define __GSL_SCHUR_H__
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_complex.h>
/*
* Prototypes
*/
void gsl_schur_standardize(gsl_matrix *T, size_t row, gsl_complex *eval1,
gsl_complex *eval2, int update_t, gsl_matrix *Z);
#endif /* __GSL_SCHUR_H__ */
|
(* Title: HOL/Induct/Tree.thy
Author: Stefan Berghofer, TU Muenchen
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
*)
section \<open>Infinitely branching trees\<close>
theory Tree
imports Main
begin
datatype 'a tree =
Atom 'a
| Branch "nat \<Rightarrow> 'a tree"
primrec map_tree :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a tree \<Rightarrow> 'b tree"
where
"map_tree f (Atom a) = Atom (f a)"
| "map_tree f (Branch ts) = Branch (\<lambda>x. map_tree f (ts x))"
lemma tree_map_compose: "map_tree g (map_tree f t) = map_tree (g \<circ> f) t"
by (induct t) simp_all
primrec exists_tree :: "('a \<Rightarrow> bool) \<Rightarrow> 'a tree \<Rightarrow> bool"
where
"exists_tree P (Atom a) = P a"
| "exists_tree P (Branch ts) = (\<exists>x. exists_tree P (ts x))"
lemma exists_map:
"(\<And>x. P x \<Longrightarrow> Q (f x)) \<Longrightarrow>
exists_tree P ts \<Longrightarrow> exists_tree Q (map_tree f ts)"
by (induct ts) auto
subsection\<open>The Brouwer ordinals, as in ZF/Induct/Brouwer.thy.\<close>
datatype brouwer = Zero | Succ brouwer | Lim "nat \<Rightarrow> brouwer"
text \<open>Addition of ordinals\<close>
primrec add :: "brouwer \<Rightarrow> brouwer \<Rightarrow> brouwer"
where
"add i Zero = i"
| "add i (Succ j) = Succ (add i j)"
| "add i (Lim f) = Lim (\<lambda>n. add i (f n))"
text \<open>Multiplication of ordinals\<close>
primrec mult :: "brouwer \<Rightarrow> brouwer \<Rightarrow> brouwer"
where
"mult i Zero = Zero"
| "mult i (Succ j) = add (mult i j) i"
| "mult i (Lim f) = Lim (\<lambda>n. mult i (f n))"
lemma add_mult_distrib: "mult i (add j k) = add (mult i j) (mult i k)"
by (induct k) (auto simp add: add_assoc)
lemma mult_assoc: "mult (mult i j) k = mult i (mult j k)"
by (induct k) (auto simp add: add_mult_distrib)
text \<open>We could probably instantiate some axiomatic type classes and use
the standard infix operators.\<close>
subsection \<open>A WF Ordering for The Brouwer ordinals (Michael Compton)\<close>
text \<open>To use the function package we need an ordering on the Brouwer
ordinals. Start with a predecessor relation and form its transitive
closure.\<close>
definition brouwer_pred :: "(brouwer \<times> brouwer) set"
where "brouwer_pred = (\<Union>i. {(m, n). n = Succ m \<or> (\<exists>f. n = Lim f \<and> m = f i)})"
definition brouwer_order :: "(brouwer \<times> brouwer) set"
where "brouwer_order = brouwer_pred^+"
lemma wf_brouwer_pred: "wf brouwer_pred"
unfolding wf_def brouwer_pred_def
apply clarify
apply (induct_tac x)
apply blast+
done
lemma wf_brouwer_order[simp]: "wf brouwer_order"
unfolding brouwer_order_def
by (rule wf_trancl[OF wf_brouwer_pred])
lemma [simp]: "(f n, Lim f) \<in> brouwer_order"
by (auto simp add: brouwer_order_def brouwer_pred_def)
text \<open>Example of a general function\<close>
function add2 :: "brouwer \<Rightarrow> brouwer \<Rightarrow> brouwer"
where
"add2 i Zero = i"
| "add2 i (Succ j) = Succ (add2 i j)"
| "add2 i (Lim f) = Lim (\<lambda>n. add2 i (f n))"
by pat_completeness auto
termination by (relation "inv_image brouwer_order snd") auto
lemma add2_assoc: "add2 (add2 i j) k = add2 i (add2 j k)"
by (induct k) auto
end
|
(* Authors: F. Maric, M. Spasic, R. Thiemann *)
section \<open>Rational Numbers Extended with Infinitesimal Element\<close>
theory QDelta
imports
Abstract_Linear_Poly
Simplex_Algebra
begin
datatype QDelta = QDelta rat rat
primrec qdfst :: "QDelta \<Rightarrow> rat"
where
"qdfst (QDelta a b) = a"
primrec qdsnd :: "QDelta \<Rightarrow> rat"
where
"qdsnd (QDelta a b) = b"
lemma [simp]: "\<lbrakk>QDelta.qdsnd x = QDelta.qdsnd y; QDelta.qdfst y = QDelta.qdfst x\<rbrakk> \<Longrightarrow> x = y"
by (cases x) auto
instantiation QDelta :: rational_vector
begin
definition zero_QDelta :: "QDelta"
where
"0 = QDelta 0 0"
definition plus_QDelta :: "QDelta \<Rightarrow> QDelta \<Rightarrow> QDelta"
where
"qd1 + qd2 = QDelta (qdfst qd1 + qdfst qd2) (qdsnd qd1 + qdsnd qd2)"
definition minus_QDelta :: "QDelta \<Rightarrow> QDelta \<Rightarrow> QDelta"
where
"qd1 - qd2 = QDelta (qdfst qd1 - qdfst qd2) (qdsnd qd1 - qdsnd qd2)"
definition uminus_QDelta :: "QDelta \<Rightarrow> QDelta"
where
"- qd = QDelta (- (qdfst qd)) (- (qdsnd qd))"
definition scaleRat_QDelta :: "rat \<Rightarrow> QDelta \<Rightarrow> QDelta"
where
"r *R qd = QDelta (r*(qdfst qd)) (r*(qdsnd qd))"
instance
proof
qed (auto simp add: plus_QDelta_def zero_QDelta_def uminus_QDelta_def minus_QDelta_def scaleRat_QDelta_def field_simps)
end
instantiation QDelta :: linorder
begin
definition less_eq_QDelta :: "QDelta \<Rightarrow> QDelta \<Rightarrow> bool"
where
"qd1 \<le> qd2 \<longleftrightarrow> (qdfst qd1 < qdfst qd2) \<or> (qdfst qd1 = qdfst qd2 \<and> qdsnd qd1 \<le> qdsnd qd2)"
definition less_QDelta :: "QDelta \<Rightarrow> QDelta \<Rightarrow> bool"
where
"qd1 < qd2 \<longleftrightarrow> (qdfst qd1 < qdfst qd2) \<or> (qdfst qd1 = qdfst qd2 \<and> qdsnd qd1 < qdsnd qd2)"
instance proof qed (auto simp add: less_QDelta_def less_eq_QDelta_def)
end
instantiation QDelta:: linordered_rational_vector
begin
instance proof qed (auto simp add: plus_QDelta_def less_QDelta_def scaleRat_QDelta_def mult_strict_left_mono mult_strict_left_mono_neg)
end
instantiation QDelta :: lrv
begin
definition one_QDelta where
"one_QDelta = QDelta 1 0"
instance proof qed (auto simp add: one_QDelta_def zero_QDelta_def)
end
definition \<delta>0 :: "QDelta \<Rightarrow> QDelta \<Rightarrow> rat"
where
"\<delta>0 qd1 qd2 ==
let c1 = qdfst qd1; c2 = qdfst qd2; k1 = qdsnd qd1; k2 = qdsnd qd2 in
(if (c1 < c2 \<and> k1 > k2) then
(c2 - c1) / (k1 - k2)
else
1
)
"
definition val :: "QDelta \<Rightarrow> rat \<Rightarrow> rat"
where "val qd \<delta> = (qdfst qd) + \<delta> * (qdsnd qd)"
lemma val_plus:
"val (qd1 + qd2) \<delta> = val qd1 \<delta> + val qd2 \<delta>"
by (simp add: field_simps val_def plus_QDelta_def)
lemma val_scaleRat:
"val (c *R qd) \<delta> = c * val qd \<delta>"
by (simp add: field_simps val_def scaleRat_QDelta_def)
lemma qdfst_setsum:
"finite A \<Longrightarrow> qdfst (\<Sum>x\<in>A. f x) = (\<Sum>x\<in>A. qdfst (f x))"
by (induct A rule: finite_induct) (auto simp add: zero_QDelta_def plus_QDelta_def)
lemma qdsnd_setsum:
"finite A \<Longrightarrow> qdsnd (\<Sum>x\<in>A. f x) = (\<Sum>x\<in>A. qdsnd (f x))"
by (induct A rule: finite_induct) (auto simp add: zero_QDelta_def plus_QDelta_def)
lemma valuate_valuate_rat:
"lp \<lbrace>(\<lambda>v. (QDelta (vl v) 0))\<rbrace> = QDelta (lp\<lbrace>vl\<rbrace>) 0"
using Rep_linear_poly
by (simp add: valuate_def scaleRat_QDelta_def qdsnd_setsum qdfst_setsum)
lemma valuate_rat_valuate:
"lp\<lbrace>(\<lambda>v. val (vl v) \<delta>)\<rbrace> = val (lp\<lbrace>vl\<rbrace>) \<delta>"
unfolding valuate_def val_def
using rational_vector.scale_sum_right[of \<delta> "\<lambda>x. Rep_linear_poly lp x * qdsnd (vl x)" "{v :: nat. Rep_linear_poly lp v \<noteq> (0 :: rat)}"]
using Rep_linear_poly
by (auto simp add: field_simps sum.distrib qdfst_setsum qdsnd_setsum) (auto simp add: scaleRat_QDelta_def)
lemma delta0:
assumes "qd1 \<le> qd2"
shows "\<forall> \<epsilon>. \<epsilon> > 0 \<and> \<epsilon> \<le> (\<delta>0 qd1 qd2) \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>"
proof-
have "\<And> e c1 c2 k1 k2 :: rat. \<lbrakk>e \<ge> 0; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e*k1 \<le> c2 + e*k2"
proof-
fix e c1 c2 k1 k2 :: rat
show "\<lbrakk>e \<ge> 0; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e*k1 \<le> c2 + e*k2"
using mult_left_mono[of "k1" "k2" "e"]
using add_less_le_mono[of "c1" "c2" "e*k1" "e*k2"]
by simp
qed
then show ?thesis
using assms
by (auto simp add: \<delta>0_def val_def less_eq_QDelta_def Let_def field_simps mult_left_mono)
qed
primrec
\<delta>_min ::"(QDelta \<times> QDelta) list \<Rightarrow> rat" where
"\<delta>_min [] = 1" |
"\<delta>_min (h # t) = min (\<delta>_min t) (\<delta>0 (fst h) (snd h))"
lemma delta_gt_zero:
"\<delta>_min l > 0"
by (induct l) (auto simp add: Let_def field_simps \<delta>0_def)
lemma delta_le_one:
"\<delta>_min l \<le> 1"
by (induct l, auto)
lemma delta_min_append:
"\<delta>_min (as @ bs) = min (\<delta>_min as) (\<delta>_min bs)"
by (induct as, insert delta_le_one[of bs], auto)
lemma delta_min_mono: "set as \<subseteq> set bs \<Longrightarrow> \<delta>_min bs \<le> \<delta>_min as"
proof (induct as)
case Nil
then show ?case using delta_le_one by simp
next
case (Cons a as)
from Cons(2) have "a \<in> set bs" by auto
from split_list[OF this]
obtain bs1 bs2 where bs: "bs = bs1 @ [a] @ bs2" by auto
have bs: "\<delta>_min bs = \<delta>_min ([a] @ bs)" unfolding bs delta_min_append by auto
show ?case unfolding bs using Cons(1-2) by auto
qed
lemma delta_min:
assumes "\<forall> qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> qd1 \<le> qd2"
shows "\<forall> \<epsilon>. \<epsilon> > 0 \<and> \<epsilon> \<le> \<delta>_min qd \<longrightarrow> (\<forall> qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>)"
using assms
using delta0
by (induct qd, auto)
lemma QDelta_0_0: "QDelta 0 0 = 0" by code_simp
lemma qdsnd_0: "qdsnd 0 = 0" by code_simp
lemma qdfst_0: "qdfst 0 = 0" by code_simp
end
|
You spend your lifetime making your home and put in every possible effort to keep it up to the mark. The struggle to keep home sparkling clean is the story of every household.
The final cost of the this service would be calculated after investigation. Please find below our visiting charge which will be included in the final cost of the service.
Sorry! No service available at this moment.
|
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasStrictFDerivAt f f' x
hg : HasStrictFDerivAt g g' x
y : E × E
⊢ f y.fst - f y.snd - ↑f' (y.fst - y.snd) + (g y.fst - g y.snd - ↑g' (y.fst - y.snd)) =
(fun y => f y + g y) y.fst - (fun y => f y + g y) y.snd - ↑(f' + g') (y.fst - y.snd)
[PROOFSTEP]
simp only [LinearMap.sub_apply, LinearMap.add_apply, map_sub, map_add, add_apply]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasStrictFDerivAt f f' x
hg : HasStrictFDerivAt g g' x
y : E × E
⊢ f y.fst - f y.snd - (↑f' y.fst - ↑f' y.snd) + (g y.fst - g y.snd - (↑g' y.fst - ↑g' y.snd)) =
f y.fst + g y.fst - (f y.snd + g y.snd) - (↑f' y.fst + ↑g' y.fst - (↑f' y.snd + ↑g' y.snd))
[PROOFSTEP]
abel
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasStrictFDerivAt f f' x
hg : HasStrictFDerivAt g g' x
y : E × E
⊢ f y.fst - f y.snd - (↑f' y.fst - ↑f' y.snd) + (g y.fst - g y.snd - (↑g' y.fst - ↑g' y.snd)) =
f y.fst + g y.fst - (f y.snd + g y.snd) - (↑f' y.fst + ↑g' y.fst - (↑f' y.snd + ↑g' y.snd))
[PROOFSTEP]
abel
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasFDerivAtFilter f f' x L
hg : HasFDerivAtFilter g g' x L
x✝ : E
⊢ f x✝ - f x - ↑f' (x✝ - x) + (g x✝ - g x - ↑g' (x✝ - x)) =
(fun y => f y + g y) x✝ - (fun y => f y + g y) x - ↑(f' + g') (x✝ - x)
[PROOFSTEP]
simp only [LinearMap.sub_apply, LinearMap.add_apply, map_sub, map_add, add_apply]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasFDerivAtFilter f f' x L
hg : HasFDerivAtFilter g g' x L
x✝ : E
⊢ f x✝ - f x - (↑f' x✝ - ↑f' x) + (g x✝ - g x - (↑g' x✝ - ↑g' x)) =
f x✝ + g x✝ - (f x + g x) - (↑f' x✝ + ↑g' x✝ - (↑f' x + ↑g' x))
[PROOFSTEP]
abel
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasFDerivAtFilter f f' x L
hg : HasFDerivAtFilter g g' x L
x✝ : E
⊢ f x✝ - f x - (↑f' x✝ - ↑f' x) + (g x✝ - g x - (↑g' x✝ - ↑g' x)) =
f x✝ + g x✝ - (f x + g x) - (↑f' x✝ + ↑g' x✝ - (↑f' x + ↑g' x))
[PROOFSTEP]
abel
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
h : DifferentiableWithinAt 𝕜 (fun y => f y + c) s x
⊢ DifferentiableWithinAt 𝕜 f s x
[PROOFSTEP]
simpa using h.add_const (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
h : DifferentiableAt 𝕜 (fun y => f y + c) x
⊢ DifferentiableAt 𝕜 f x
[PROOFSTEP]
simpa using h.add_const (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
h : DifferentiableOn 𝕜 (fun y => f y + c) s
⊢ DifferentiableOn 𝕜 f s
[PROOFSTEP]
simpa using h.add_const (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
h : Differentiable 𝕜 fun y => f y + c
⊢ Differentiable 𝕜 f
[PROOFSTEP]
simpa using h.add_const (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hxs : UniqueDiffWithinAt 𝕜 s x
c : F
hf : ¬DifferentiableWithinAt 𝕜 f s x
⊢ fderivWithin 𝕜 (fun y => f y + c) s x = fderivWithin 𝕜 f s x
[PROOFSTEP]
rw [fderivWithin_zero_of_not_differentiableWithinAt hf, fderivWithin_zero_of_not_differentiableWithinAt]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hxs : UniqueDiffWithinAt 𝕜 s x
c : F
hf : ¬DifferentiableWithinAt 𝕜 f s x
⊢ ¬DifferentiableWithinAt 𝕜 (fun y => f y + c) s x
[PROOFSTEP]
simpa
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ fderiv 𝕜 (fun y => f y + c) x = fderiv 𝕜 f x
[PROOFSTEP]
simp only [← fderivWithin_univ, fderivWithin_add_const uniqueDiffWithinAt_univ]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
h : DifferentiableWithinAt 𝕜 (fun y => c + f y) s x
⊢ DifferentiableWithinAt 𝕜 f s x
[PROOFSTEP]
simpa using h.const_add (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
h : DifferentiableAt 𝕜 (fun y => c + f y) x
⊢ DifferentiableAt 𝕜 f x
[PROOFSTEP]
simpa using h.const_add (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
h : DifferentiableOn 𝕜 (fun y => c + f y) s
⊢ DifferentiableOn 𝕜 f s
[PROOFSTEP]
simpa using h.const_add (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
h : Differentiable 𝕜 fun y => c + f y
⊢ Differentiable 𝕜 f
[PROOFSTEP]
simpa using h.const_add (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hxs : UniqueDiffWithinAt 𝕜 s x
c : F
⊢ fderivWithin 𝕜 (fun y => c + f y) s x = fderivWithin 𝕜 f s x
[PROOFSTEP]
simpa only [add_comm] using fderivWithin_add_const hxs c
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ fderiv 𝕜 (fun y => c + f y) x = fderiv 𝕜 f x
[PROOFSTEP]
simp only [add_comm c, fderiv_add_const]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
ι : Type u_6
u : Finset ι
A : ι → E → F
A' : ι → E →L[𝕜] F
h : ∀ (i : ι), i ∈ u → HasStrictFDerivAt (A i) (A' i) x
⊢ HasStrictFDerivAt (fun y => ∑ i in u, A i y) (∑ i in u, A' i) x
[PROOFSTEP]
dsimp [HasStrictFDerivAt] at *
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
ι : Type u_6
u : Finset ι
A : ι → E → F
A' : ι → E →L[𝕜] F
h : ∀ (i : ι), i ∈ u → (fun p => A i p.fst - A i p.snd - ↑(A' i) (p.fst - p.snd)) =o[𝓝 (x, x)] fun p => p.fst - p.snd
⊢ (fun p => ∑ i in u, A i p.fst - ∑ i in u, A i p.snd - ↑(∑ i in u, A' i) (p.fst - p.snd)) =o[𝓝 (x, x)] fun p =>
p.fst - p.snd
[PROOFSTEP]
convert IsLittleO.sum h
[GOAL]
case h.e'_7.h
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
ι : Type u_6
u : Finset ι
A : ι → E → F
A' : ι → E →L[𝕜] F
h : ∀ (i : ι), i ∈ u → (fun p => A i p.fst - A i p.snd - ↑(A' i) (p.fst - p.snd)) =o[𝓝 (x, x)] fun p => p.fst - p.snd
x✝ : E × E
⊢ ∑ i in u, A i x✝.fst - ∑ i in u, A i x✝.snd - ↑(∑ i in u, A' i) (x✝.fst - x✝.snd) =
∑ i in u, (A i x✝.fst - A i x✝.snd - ↑(A' i) (x✝.fst - x✝.snd))
[PROOFSTEP]
simp [Finset.sum_sub_distrib, ContinuousLinearMap.sum_apply]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
ι : Type u_6
u : Finset ι
A : ι → E → F
A' : ι → E →L[𝕜] F
h : ∀ (i : ι), i ∈ u → HasFDerivAtFilter (A i) (A' i) x L
⊢ HasFDerivAtFilter (fun y => ∑ i in u, A i y) (∑ i in u, A' i) x L
[PROOFSTEP]
dsimp [HasFDerivAtFilter] at *
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
ι : Type u_6
u : Finset ι
A : ι → E → F
A' : ι → E →L[𝕜] F
h : ∀ (i : ι), i ∈ u → (fun x' => A i x' - A i x - ↑(A' i) (x' - x)) =o[L] fun x' => x' - x
⊢ (fun x' => ∑ i in u, A i x' - ∑ i in u, A i x - ↑(∑ i in u, A' i) (x' - x)) =o[L] fun x' => x' - x
[PROOFSTEP]
convert IsLittleO.sum h
[GOAL]
case h.e'_7.h
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
ι : Type u_6
u : Finset ι
A : ι → E → F
A' : ι → E →L[𝕜] F
h : ∀ (i : ι), i ∈ u → (fun x' => A i x' - A i x - ↑(A' i) (x' - x)) =o[L] fun x' => x' - x
x✝ : E
⊢ ∑ i in u, A i x✝ - ∑ i in u, A i x - ↑(∑ i in u, A' i) (x✝ - x) = ∑ i in u, (A i x✝ - A i x - ↑(A' i) (x✝ - x))
[PROOFSTEP]
simp [ContinuousLinearMap.sum_apply]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
h : DifferentiableWithinAt 𝕜 (fun y => -f y) s x
⊢ DifferentiableWithinAt 𝕜 f s x
[PROOFSTEP]
simpa only [neg_neg] using h.neg
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
h : DifferentiableAt 𝕜 (fun y => -f y) x
⊢ DifferentiableAt 𝕜 f x
[PROOFSTEP]
simpa only [neg_neg] using h.neg
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
h : DifferentiableOn 𝕜 (fun y => -f y) s
⊢ DifferentiableOn 𝕜 f s
[PROOFSTEP]
simpa only [neg_neg] using h.neg
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
h : Differentiable 𝕜 fun y => -f y
⊢ Differentiable 𝕜 f
[PROOFSTEP]
simpa only [neg_neg] using h.neg
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hxs : UniqueDiffWithinAt 𝕜 s x
h : ¬DifferentiableWithinAt 𝕜 f s x
⊢ fderivWithin 𝕜 (fun y => -f y) s x = -fderivWithin 𝕜 f s x
[PROOFSTEP]
rw [fderivWithin_zero_of_not_differentiableWithinAt h, fderivWithin_zero_of_not_differentiableWithinAt, neg_zero]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hxs : UniqueDiffWithinAt 𝕜 s x
h : ¬DifferentiableWithinAt 𝕜 f s x
⊢ ¬DifferentiableWithinAt 𝕜 (fun y => -f y) s x
[PROOFSTEP]
simpa
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
⊢ fderiv 𝕜 (fun y => -f y) x = -fderiv 𝕜 f x
[PROOFSTEP]
simp only [← fderivWithin_univ, fderivWithin_neg uniqueDiffWithinAt_univ]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasStrictFDerivAt f f' x
hg : HasStrictFDerivAt g g' x
⊢ HasStrictFDerivAt (fun x => f x - g x) (f' - g') x
[PROOFSTEP]
simpa only [sub_eq_add_neg] using hf.add hg.neg
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasFDerivAtFilter f f' x L
hg : HasFDerivAtFilter g g' x L
⊢ HasFDerivAtFilter (fun x => f x - g x) (f' - g') x L
[PROOFSTEP]
simpa only [sub_eq_add_neg] using hf.add hg.neg
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasStrictFDerivAt f f' x
c : F
⊢ HasStrictFDerivAt (fun x => f x - c) f' x
[PROOFSTEP]
simpa only [sub_eq_add_neg] using hf.add_const (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasFDerivAtFilter f f' x L
c : F
⊢ HasFDerivAtFilter (fun x => f x - c) f' x L
[PROOFSTEP]
simpa only [sub_eq_add_neg] using hf.add_const (-c)
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ DifferentiableWithinAt 𝕜 (fun y => f y - c) s x ↔ DifferentiableWithinAt 𝕜 f s x
[PROOFSTEP]
simp only [sub_eq_add_neg, differentiableWithinAt_add_const_iff]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ DifferentiableAt 𝕜 (fun y => f y - c) x ↔ DifferentiableAt 𝕜 f x
[PROOFSTEP]
simp only [sub_eq_add_neg, differentiableAt_add_const_iff]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ DifferentiableOn 𝕜 (fun y => f y - c) s ↔ DifferentiableOn 𝕜 f s
[PROOFSTEP]
simp only [sub_eq_add_neg, differentiableOn_add_const_iff]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ (Differentiable 𝕜 fun y => f y - c) ↔ Differentiable 𝕜 f
[PROOFSTEP]
simp only [sub_eq_add_neg, differentiable_add_const_iff]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hxs : UniqueDiffWithinAt 𝕜 s x
c : F
⊢ fderivWithin 𝕜 (fun y => f y - c) s x = fderivWithin 𝕜 f s x
[PROOFSTEP]
simp only [sub_eq_add_neg, fderivWithin_add_const hxs]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ fderiv 𝕜 (fun y => f y - c) x = fderiv 𝕜 f x
[PROOFSTEP]
simp only [sub_eq_add_neg, fderiv_add_const]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasStrictFDerivAt f f' x
c : F
⊢ HasStrictFDerivAt (fun x => c - f x) (-f') x
[PROOFSTEP]
simpa only [sub_eq_add_neg] using hf.neg.const_add c
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hf : HasFDerivAtFilter f f' x L
c : F
⊢ HasFDerivAtFilter (fun x => c - f x) (-f') x L
[PROOFSTEP]
simpa only [sub_eq_add_neg] using hf.neg.const_add c
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ DifferentiableWithinAt 𝕜 (fun y => c - f y) s x ↔ DifferentiableWithinAt 𝕜 f s x
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ DifferentiableAt 𝕜 (fun y => c - f y) x ↔ DifferentiableAt 𝕜 f x
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ DifferentiableOn 𝕜 (fun y => c - f y) s ↔ DifferentiableOn 𝕜 f s
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ (Differentiable 𝕜 fun y => c - f y) ↔ Differentiable 𝕜 f
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
hxs : UniqueDiffWithinAt 𝕜 s x
c : F
⊢ fderivWithin 𝕜 (fun y => c - f y) s x = -fderivWithin 𝕜 f s x
[PROOFSTEP]
simp only [sub_eq_add_neg, fderivWithin_const_add, fderivWithin_neg, hxs]
[GOAL]
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
c : F
⊢ fderiv 𝕜 (fun y => c - f y) x = -fderiv 𝕜 f x
[PROOFSTEP]
simp only [← fderivWithin_univ, fderivWithin_const_sub uniqueDiffWithinAt_univ]
|
theory TestRevList
imports Main
begin
no_notation Nil("[]") and Cons (infixr "#" 65) and append (infixr "@" 65)
hide_type list
hide_const rev
datatype 'a list = Nil ("[]")
| Cons 'a "'a list" (infixr "#" 65)
primrec app :: "'a list => 'a list =>'a list" (infixr "@" 65)
where
"[] @ ys = ys" |
"(x # xs) @ ys = x # (xs @ ys)"
primrec rev :: "'a list => 'a list" where
"rev [] = []" |
"rev (x # xs) = (rev xs) @ (x #[])"
value "rev (True # False # [])"
value "rev (a # b# c# [])"
lemma app_assoc [simp]: "(xs @ys) @ zs = xs @(ys @zs)"
apply(induct_tac xs)
apply(auto)
done
lemma app_Nil [simp]: "xs @ [] = xs"
apply(induct_tac xs)
apply(auto)
done
lemma rev_app [simp]: "rev(xs@ys) = (rev ys) @ (rev xs)"
apply(induct_tac xs)
apply(auto)
done
theorem rev_rev [simp]: "rev(rev xs) = xs"
apply(induct_tac xs)
apply(auto)
done
|
###########################################################
# from consensus matrix, get PAC index
###########################################################
# Ref: Critical limitations of consensus clustering in class discovery
# Yasin Senbabaoglu, George Michailidis & Jun Z. Li
# Scientific Reports 4, Article number: 6207 (2014)
# doi:10.1038/srep06207
# "the "proportion of ambigous clustering" (PAC),
# defined as the fraction of sample pairs with
# consensus index values falloing in the intermediate
# sub-interval (x1, x2), element of [0, 1]. A low value
# of PAC indicates a flat middle segment, allowing inference
# of the optimal K by the lowest PAC"
setwd(dir="github/stratipy/simulation/r_analysis/")
# install.packages("R.matlab")
library(R.matlab)
# install.packages("diceR")
library(diceR)
# PAC threashold
x1 <- 0.05
x2 <- 0.95
###########################################################
# to change!
sub_nb <- 10
pat_nb <- 300
subset_name <- paste0(sub_nb, "sub_", pat_nb, "pat")
plot_title <- paste0(sub_nb, " sub-networks with ", pat_nb, " patients")
output_dir <- paste0(subset_name, "/plot")
dir.create(subset_name)
dir.create(output_dir)
base_file <- paste0("../output/nbs_", subset_name, "/consensus_clustering")
mut_type <- c("raw", "diff", "mean_qn", "median_qn")
nmf_type <- c("nmf", "gnmf")
influence_weight <- "min"
simplification <- "True"
alpha <- c(0, 0.7)
tol <- 10e-3
keep_singletons <- "False"
ngh_max <- c(5, 10)
min_mutation <- 0
max_mutation <- 100
n_components <- 2:12
n_permutations <- 1000
lambd <- c(0, 200)
tol_nmf <- 1e-3
a_greek <- intToUtf8(0x03B1)
l_greek <- intToUtf8(0x03BB)
df <- data.frame(type=character(),
mut_type=character(),
nmf_type=character(),
influence_weight=character(),
simplification=logical(),
alpha=numeric(),
tol=numeric(),
keep_singletons=logical(),
ngh_max=integer(),
min_mutation=integer(),
max_mutation=integer(),
n_components=integer(),
n_permutations=integer(),
lambd=integer(),
tol_nmf=numeric(),
pac=numeric(),
stringsAsFactors = FALSE)
# iterate all consensus matrix file names
for (i0 in mut_type){
f0 <- paste(base_file, i0, sep="/")
for (i1 in nmf_type){
f1 <- paste(f0, i1, sep='/')
for (i2 in influence_weight){
f2 <- paste(f1, i2, sep='/consensus_weight=')
for (i3 in simplification){
f3 <- paste(f2, i3, sep="_simp=")
for (i4 in alpha){
if(i0!="raw" & i4==0) next
if(i0=="raw" & i4!=0) next
f4 <- paste(f3, i4, sep="_alpha=")
for (i5 in tol){
f5 <- paste(f4, i5, sep="_tol=")
for (i6 in keep_singletons){
f6 <- paste(f5, i6, sep="_singletons=")
for (i7 in ngh_max){
f7 <- paste(f6, i7, sep="_ngh=")
for (i8 in min_mutation){
f8 <- paste(f7, i8, sep="_minMut=")
for (i9 in max_mutation){
f9 <- paste(f8, i9, sep="_maxMut=")
for (i10 in n_components){
f10 <- paste(f9, i10, sep="_comp=")
for (i11 in n_permutations){
f11 <- paste(f10, i11, sep="_permut=")
for (i12 in lambd){
if(i1=="nmf" & i12!=0) next
if(i1=="gnmf" & i12==0) next
f12 <- paste(f11, i12, sep="_lambd=")
for (i13 in tol_nmf){
f13 <- paste(f12, i13, sep="_tolNMF=")
filename <- paste(f13, ".mat", sep="")
if (file.exists(filename)){
ia <- paste0(a_greek, "=", i4)
il <- paste0(l_greek, "=", i12)
ingh <- paste0(i7, "ngh")
type_name <- paste(toupper(i1), i0, ia, il, ingh)
# PCA function and save as a file
data <- readMat(filename)
cons_mat <- data$distance.patients
pac <- PAC(cons_mat, lower=x1, upper=x2)
# add all values to data frame
df[nrow(df)+1,] = c(type_name, i0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,pac)
}
else print(paste0("No such file: ", filename))
}
}
}
}
}
}
}
}
}
}
}
}
}
}
# convert some colums' mode (because all mode is character)
logic_col <- c("simplification","keep_singletons")
numeric_col <- c("alpha","tol","tol_nmf","pac")
int_col <- c("ngh_max","min_mutation","max_mutation","n_components","n_permutations","lambd")
for (i in logic_col) df[, i] <- as.logical(df[, i])
for (i in numeric_col) df[, i] <- as.numeric(df[, i])
for (i in int_col) df[, i] <- as.integer(df[, i])
# save data frame as csv file
write.table(df, file=paste0(subset_name, "/all_param_pca.csv"), row.names=FALSE, sep="\t")
# a <- read.csv(file="test.csv")
# b <- df[, c("n_components", "pac")]
###########################################################
library(ggplot2)
# install.packages('svglite')
# require("ggplot2")
# plot saving function
# savePlot <- function(myPlot) {
# pdf("myPlot.pdf")
# print(myPlot)
# dev.off()
# }
# global plot
ggplot(data=df, aes(x=n_components, y=pac, group=type)) +
geom_line(aes(color=type)) +
geom_point(aes(color=type)) +
scale_x_continuous(breaks=n_components) +
labs(x="Component number", y="PAC") +
ylim(0, 1) +
ggtitle(plot_title) +
theme_bw() +
theme(legend.title=element_blank(), panel.grid.minor.x = element_blank())
ggsave("all_data.png", plot = last_plot(), path = output_dir,
width = 7, height = 6, dpi = 300)
# get some rows for plot
# select_rows <- function(data, x1, x2, x3, x4, x5){
# subset(data,
# mut_type==x1 &
# nmf_type==x2 &
# alpha==x3 &
# ngh_max==x4 &
# lambd==x5)
# }
#
# nmf_raw <- select_rows(df, "raw", "nmf", alpha[1], ngh_max, lambd[1])
# nmf_diff <- select_rows(df, "diff", "nmf", alpha[2], ngh_max, lambd[1])
# nmf_mean <- select_rows(df, "mean_qn", "nmf", alpha[2], ngh_max, lambd[1])
# nmf_median <- select_rows(df, "median_qn", "nmf", alpha[2], ngh_max, lambd[1])
nmf_df <- subset(df, nmf_type=="nmf")
gnmf200_df <- subset(df, nmf_type=="gnmf" & lambd==200)
# gnmf1800_df <- subset(df, nmf_type=="gnmf"& lambd==1800)
# NMF plot
ggplot(data=nmf_df, aes(x=n_components, y=pac, group=type)) +
geom_line(aes(color=type)) +
geom_point(aes(color=type)) +
scale_x_continuous(breaks=n_components) +
labs(x="Component number", y="PAC") +
ylim(0, 1) +
ggtitle(plot_title) +
theme_bw() +
theme(legend.title=element_blank(), panel.grid.minor.x = element_blank())
ggsave("nmf.png", plot = last_plot(), path = output_dir,
width = 7, height = 6, dpi = 300)
# GNMF (lambd=200) plot
ggplot(data=gnmf200_df, aes(x=n_components, y=pac, group=type)) +
geom_line(aes(color=type)) +
geom_point(aes(color=type)) +
scale_x_continuous(breaks=n_components) +
labs(x="Component number", y="PAC") +
ylim(0, 1) +
ggtitle(plot_title) +
theme_bw() +
theme(legend.title=element_blank(), panel.grid.minor.x = element_blank())
ggsave("gnmf_200.png", plot = last_plot(), path = output_dir,
width = 7, height = 6, dpi = 300)
# GNMF (lambd=1800) plot
# ggplot(data=gnmf1800_df, aes(x=n_components, y=pac, group=type)) +
# geom_line(aes(color=type)) +
# geom_point(aes(color=type)) +
# scale_x_continuous(breaks=n_components) +
# labs(x="Component number", y="PAC") +
# ylim(0, 1) +
# ggtitle(plot_title) +
# theme_bw() +
# theme(legend.title=element_blank(), panel.grid.minor.x = element_blank())
#
# ggsave("gnmf_1800.png", plot = last_plot(), path = output_dir,
# width = 7, height = 6, dpi = 300)
###########################################################
|
#' OpenMP Examples
#'
#' There are 3 examples, each using OpenMP, across 4 implementations:
#' C, C++, F77, and F2003.
#'
#' The \code{_hello()} functions are simple hello worlds. Note that
#' the order of printing by the threads is not guaranteed.
#'
#' The \code{_sum()} functions sum up a numeric vector.
#'
#' The \code{_sweep()} functions sweep a numeric vector from a
#' numeric matrix, provided the vector is exactly the length of
#' the number of columns of the matrix. This is equivalent to a
#' special case of \code{sweep(x, STATS=vec, MARGIN=1, FUN="-")}.
#'
#' The \code{_primesbelow()} functions compute the number of prime
#' integers below a given (positive) integer.
#'
#' @param x
#' A numeric vector for the sum example, and a numeric matrix for
#' the sweep example.
#' @param vec
#' A numeric vector the same length as the number of rows as x.
#' @param n
#' The number from the "primes below" example, where the function
#' returns the total number of primes below \code{n}.
#'
#' @name ompexamples
#' @rdname ompexamples
NULL
### C
#' @rdname ompexamples
#' @export
c_hello <- function() invisible(.Call("c_hello", PACKAGE="Romp"))
#' @rdname ompexamples
#' @export
c_sum <- function(x)
{
if (!is.double(x))
storage.mode(x) <- "double"
.Call("c_sum", x, PACKAGE="Romp")
}
#' @rdname ompexamples
#' @export
c_sweep <- function(x, vec)
{
if (!is.double(x))
storage.mode(x) <- "double"
if (!is.double(vec))
storage.mode(vec) <- "double"
if (length(vec) != nrow(x))
stop("invalid vec length")
.Call("c_sweep", x, vec, PACKAGE="Romp")
}
#' @rdname ompexamples
#' @export
c_primesbelow <- function(n)
{
.Call("c_primesbelow", as.integer(n), PACKAGE="Romp")
}
### Fortran
#' @rdname ompexamples
#' @export
f77_hello <- function() invisible(.Call("f77_hello_wrap", PACKAGE="Romp"))
#' @rdname ompexamples
#' @export
f77_sum <- function(x)
{
if (!is.double(x))
storage.mode(x) <- "double"
.Call("f77_sum_wrap", x, PACKAGE="Romp")
}
#' @rdname ompexamples
#' @export
f77_sweep <- function(x, vec)
{
if (length(vec) != nrow(x))
stop("invalid vec length")
.Call("f77_sweep_wrap", x, vec, PACKAGE="Romp")
}
#' @rdname ompexamples
#' @export
f77_primesbelow <- function(n)
{
.Call("f77_primesbelow_wrap", as.integer(n), PACKAGE="Romp")
}
#' @rdname ompexamples
#' @export
f90_hello <- function() invisible(.Call("f90_hello_wrap", PACKAGE="Romp"))
#' @rdname ompexamples
#' @export
f90_sum <- function(x)
{
if (!is.double(x))
storage.mode(x) <- "double"
.Call("f90_sum_wrap", x, PACKAGE="Romp")
}
#' @rdname ompexamples
#' @export
f90_sweep <- function(x, vec)
{
if (length(vec) != nrow(x))
stop("invalid vec length")
.Call("f90_sweep_wrap", x, vec, PACKAGE="Romp")
}
#' @rdname ompexamples
#' @export
f90_primesbelow <- function(n)
{
.Call("f90_primesbelow_wrap", as.integer(n), PACKAGE="Romp")
}
### Rcpp
#' @rdname ompexamples
#' @export
rcpp_hello <- rcpp_hello_
#' @rdname ompexamples
#' @export
rcpp_sum <- rcpp_sum_
#' @rdname ompexamples
#' @export
rcpp_sweep <- function(x, vec)
{
if (length(vec) != nrow(x))
stop("invalid vec length")
rcpp_sweep_(x, vec)
}
#' @rdname ompexamples
#' @export
rcpp_primesbelow <- rcpp_primesbelow_
|
Havoc invented handsome and is one of the favorites at TWP. He was probably born in 2011 near San Antonio. His owner was an unscrupulous breeder who misrepresented puppies as wolves. When the local authorities caught up with him, the breeder released all his animals into the neighborhood. Thankfully animal control caught Havoc and some of the others. In 2013 he came to TWP. Havoc is a gentle laid-back guy who moves his lips like a puffer fish when he sniffs you and he leaps for joy on his walks. Havoc has also been seen helping one of the young volunteers with her homework. Even though Havoc loves his roommate Siren, he really wants to be part of a family who loves him.
|
```python
import sympy as sy
sy.init_printing()
```
## 2 equations, 2 unknowns
```python
x, y = sy.symbols('x y')
a, b, c, d = sy.symbols('a b c d')
eq1 = sy.Eq(a*x + b*y + 2, 0)
eq2 = sy.Eq(c*x + d*y - 2, 0)
sol = sy.solve((eq1, eq2), (x, y))
sol
```
## Try subscripts
```python
x, y = sy.symbols('x_mz y_ny')
a, b, c, d = sy.symbols('a_1 b_2 c_3 d_4')
eq1 = sy.Eq(a*x + b*y + 2, 0)
eq2 = sy.Eq(c*x + d*y - 2, 0)
sol = sy.solve((eq1, eq2), (x, y))
sol
```
## 3 equations, 3 unknowns
```python
x, y, z = sy.symbols('x y z')
a, b, c, d, e, f, g, h, i, j = sy.symbols('a b c d e, f, g, h, i, j')
eq1 = sy.Eq(a*x + b*y + c*z + 2, 0)
eq2 = sy.Eq(d*x + e*y + f*z - 2, 0)
eq3 = sy.Eq(g*x + h*y + i*z, 0)
sol = sy.solve((eq1, eq2, eq3), (x, y, z))
sol
```
```python
sol[x]
```
```python
```
|
#include <boost/flyweight/refcounted_fwd.hpp>
|
Formal statement is: lemma ball_empty: "e \<le> 0 \<Longrightarrow> ball x e = {}" Informal statement is: If $e \leq 0$, then the ball of radius $e$ around $x$ is empty.
|
section "Terms"
text\<open>
Originally based on @{file "~~/src/Pure/term.ML"}.
Diverged substantially, but some influences are still visible.
Further influences from @{dir "~~/src/HOL/Proofs/Lambda/"}.\<close>
theory Term
imports Main Core Preliminaries
begin
text\<open>Collecting parts of typs/terms and more substitutions\<close>
fun tvsT :: "typ \<Rightarrow> (variable \<times> sort) set" where
"tvsT (Tv v S) = {(v,S)}"
| "tvsT (Ty _ Ts) = \<Union>(set (map tvsT Ts))"
fun tvs :: "term \<Rightarrow> (variable \<times> sort) set" where
"tvs (Ct _ T) = tvsT T"
| "tvs (Fv _ T) = tvsT T"
| "tvs (Bv _) = {}"
| "tvs (Abs T t) = tvsT T \<union> tvs t"
| "tvs (t $ u) = tvs t \<union> tvs u"
abbreviation "tvs_set S \<equiv> \<Union>t\<in>S . tvs t"
lemma tvsT_tsubstT: "tvsT (tsubstT \<sigma> \<rho>) = \<Union> {tvsT (\<rho> a s) | a s. (a, s) \<in> tvsT \<sigma>}"
by (induction \<sigma>) fastforce+
lemma tsubstT_cong:
"(\<forall>(v,S) \<in> tvsT \<sigma>. \<rho>1 v = \<rho>2 v) \<Longrightarrow> tsubstT \<sigma> \<rho>1 = tsubstT \<sigma> \<rho>2"
by (induction \<sigma>) fastforce+
lemma tsubstT_ith: "i < length Ts \<Longrightarrow> map (\<lambda>T . tsubstT T \<rho>) Ts ! i = tsubstT (Ts ! i) \<rho>"
by simp
lemma tsubstT_fun_typ_dist: "tsubstT (T \<rightarrow> T1) \<rho> = tsubstT T \<rho> \<rightarrow> tsubstT T1 \<rho>"
by simp
fun subst :: "term \<Rightarrow> (variable \<Rightarrow> typ \<Rightarrow> term) \<Rightarrow> term" where
"subst (Ct s T) \<rho> = Ct s T"
| "subst (Fv v T) \<rho> = \<rho> v T"
| "subst (Bv i) _ = Bv i"
| "subst (Abs T t) \<rho> = Abs T (subst t \<rho>)"
| "subst (t $ u) \<rho> = subst t \<rho> $ subst u \<rho>"
definition "tinst t1 t2 \<equiv> \<exists>\<rho>. tsubst t2 \<rho> = t1"
definition "inst t1 t2 \<equiv> \<exists>\<rho>. subst t2 \<rho> = t1"
fun SortsT :: "typ \<Rightarrow> sort set" where
"SortsT (Tv _ S) = {S}"
| "SortsT (Ty _ Ts) = (\<Union>T\<in>set Ts . SortsT T)"
fun Sorts :: "term \<Rightarrow> sort set" where
"Sorts (Ct _ T) = SortsT T"
| "Sorts (Fv _ T) = SortsT T"
| "Sorts (Bv _) = {}"
| "Sorts (Abs T t) = SortsT T \<union> Sorts t"
| "Sorts (t $ u) = Sorts t \<union> Sorts u"
fun Types :: "term \<Rightarrow> typ set" where
"Types (Ct _ T) = {T}"
| "Types (Fv _ T) = {T}"
| "Types (Bv _) = {}"
| "Types (Abs T t) = insert T (Types t)"
| "Types (t $ u) = Types t \<union> Types u"
abbreviation "tvs_Set S \<equiv> \<Union>s\<in>S . tvs s"
abbreviation "tvsT_Set S \<equiv> \<Union>s\<in>S . tvsT s"
(* All those sets are finite *)
lemma finite_SortsT[simp]: "finite (SortsT T)"
by (induction T) auto
lemma finite_Sorts[simp]: "finite (Sorts t)"
by (induction t) auto
lemma finite_Types[simp]: "finite (Types t)"
by (induction t) auto
lemma finite_tvsT[simp]: "finite (tvsT T)"
by (induction T) auto
lemma no_tvsT_imp_tsubsT_unchanged: "tvsT T = {} \<Longrightarrow> tsubstT T \<rho> = T"
by (induction T) (auto simp add: map_idI)
lemma finite_fv[simp]: "finite (fv t)"
by (induction t) auto
lemma finite_tvs[simp]: "finite (tvs t)"
by (induction t) auto
lemma finite_FV: "finite S \<Longrightarrow> finite (FV S)"
by (induction S rule: finite_induct) auto
lemma finite_tvs_Set: "finite S \<Longrightarrow> finite (tvs_Set S)"
by (induction S rule: finite_induct) auto
lemma finite_tvsT_Set: "finite S \<Longrightarrow> finite (tvsT_Set S)"
by (induction S rule: finite_induct) auto
lemma no_tvs_imp_tsubst_unchanged: "tvs t = {} \<Longrightarrow> tsubst t \<rho> = t"
by (induction t) (auto simp add: map_idI no_tvsT_imp_tsubsT_unchanged)
lemma no_fv_imp_subst_unchanged: "fv t = {} \<Longrightarrow> subst t \<rho> = t"
by (induction t) (auto simp add: map_idI)
text\<open>Functional(also executable) version of @{term has_typ}\<close>
fun typ_of1 :: "typ list \<Rightarrow> term \<Rightarrow> typ option" where
"typ_of1 _ ( Ct _ T) = Some T"
| "typ_of1 Ts (Bv i) = (if i < length Ts then Some (nth Ts i) else None)"
| "typ_of1 _ (Fv _ T) = Some T"
| "typ_of1 Ts (Abs T body) = Option.bind (typ_of1 (T#Ts) body) (\<lambda>x. Some (T \<rightarrow> x))"
| "typ_of1 Ts (t $ u) = Option.bind (typ_of1 Ts u) (\<lambda>U. Option.bind (typ_of1 Ts t) (\<lambda>T.
case T of
Ty fun [T1,T2] \<Rightarrow> if fun = STR ''fun'' then
if T1=U then Some T2 else None
else None
| _ \<Rightarrow> None
))"
text\<open>For historic reasons a lot of proofs/definitions are still in terms of @{term typ_of1} instead of
@{term has_typ1}\<close>
lemma has_typ1_weaken_Ts: "has_typ1 Ts t rT \<Longrightarrow> has_typ1 (Ts@[T]) t rT"
proof (induction arbitrary: rule: has_typ1.induct)
case (2 i Ts)
hence "has_typ1 (Ts @ [T]) (Bv i) ((Ts@[T]) ! i)"
by (auto intro: has_typ1.intros(2))
then show ?case
by (simp add: "2.hyps" nth_append)
qed (auto intro: has_typ1.intros) thm less_Suc_eq nth_butlast
lemma has_typ1_imp_typ_of1: "has_typ1 Ts t ty \<Longrightarrow> typ_of1 Ts t = Some ty"
by (induction rule: has_typ1.induct) auto
lemma typ_of1_imp_has_typ1: "typ_of1 Ts t = Some ty \<Longrightarrow> has_typ1 Ts t ty"
proof (induction t arbitrary: Ts ty)
case (App t u)
from this obtain U where U: "typ_of1 Ts u = Some U" by fastforce
from this App obtain T where T: "typ_of1 Ts t = Some T" by fastforce
from U T App obtain T2 where "T = Ty STR ''fun'' [U, T2]"
by (auto simp add: bind_eq_Some_conv intro!: has_typ1.intros
split: if_splits typ.splits list.splits)
from this U T show ?case using App by (auto intro!: has_typ1.intros(5))
qed (auto simp add: bind_eq_Some_conv intro!: has_typ1.intros split: if_splits)
corollary has_typ1_iff_typ_of1[iff]: "has_typ1 Ts t ty \<longleftrightarrow> typ_of1 Ts t = Some ty"
using has_typ1_imp_typ_of1 typ_of1_imp_has_typ1 by blast
corollary has_typ_iff_typ_of[iff]: "has_typ t ty \<longleftrightarrow> typ_of t = Some ty"
by (force simp add: has_typ_def typ_of_def)
corollary typ_of_imp_has_typ: "typ_of t = Some ty \<Longrightarrow> has_typ t ty"
by simp
lemma typ_of1_weaken_Ts: "typ_of1 Ts t = Some ty \<Longrightarrow> typ_of1 (Ts@[T]) t = Some ty"
using has_typ1_weaken_Ts by simp
lemma typ_of1_weaken:
assumes "typ_of1 Ts t = Some T"
shows "typ_of1 (Ts@Ts') t = Some T"
using assms by (induction Ts t arbitrary: Ts' T rule: typ_of1.induct)
(auto split: if_splits simp add: nth_append bind_eq_Some_conv)
(* Instantiation of type variables produces instantiated types *)
lemma has_typ1_tsubst:
"has_typ1 Ts t T \<Longrightarrow> has_typ1 (map (\<lambda>T. tsubstT T \<rho>) Ts) (tsubst t \<rho>) (tsubstT T \<rho>)"
proof (induction rule: has_typ1.induct)
case (2 i Ts)
(* tsubst_ith must be applied reversed, in this direction it can cause simplifier to loop *)
then show ?case using tsubstT_ith by (metis has_typ1.intros(2) length_map tsubst.simps(3))
qed (auto simp add: tsubstT_fun_typ_dist intro: has_typ1.intros)
corollary has_typ1_unique:
assumes "has_typ1 \<tau>s t \<tau>1" and "has_typ1 \<tau>s t \<tau>2" shows "\<tau>1 = \<tau>2"
using assms
by (metis has_typ1_imp_typ_of1 option.inject)
hide_fact typ_of_def
lemma typ_of_def: "typ_of t \<equiv> typ_of1 [] t"
by (smt has_typ1_iff_typ_of1 has_typ_def has_typ_iff_typ_of not_None_eq)
text\<open>Loose bound variables\<close>
fun loose_bvar :: "term \<Rightarrow> nat \<Rightarrow> bool" where
"loose_bvar (Bv i) k \<longleftrightarrow> i \<ge> k"
| "loose_bvar (t $ u) k \<longleftrightarrow> loose_bvar t k \<or> loose_bvar u k"
| "loose_bvar (Abs _ t) k = loose_bvar t (k+1)"
| "loose_bvar _ _ = False"
fun loose_bvar1 :: "term \<Rightarrow> nat \<Rightarrow> bool" where
"loose_bvar1 (Bv i) k \<longleftrightarrow> i = k"
| "loose_bvar1 (t $ u) k \<longleftrightarrow> loose_bvar1 t k \<or> loose_bvar1 u k"
| "loose_bvar1 (Abs _ t) k = loose_bvar1 t (k+1)"
| "loose_bvar1 _ _ = False"
lemma loose_bvar1_imp_loose_bvar: "loose_bvar1 t n \<Longrightarrow> loose_bvar t n"
by (induction t arbitrary: n) auto
lemma not_loose_bvar_imp_not_loose_bvar1: "\<not> loose_bvar t n \<Longrightarrow> \<not> loose_bvar1 t n"
by (induction t arbitrary: n) auto
lemma loose_bvar_iff_exist_loose_bvar1: "loose_bvar t lev \<longleftrightarrow> (\<exists>lev'\<ge>lev. loose_bvar1 t lev')"
by (induction t arbitrary: lev) (auto dest: Suc_le_D)
definition "is_open t \<equiv> loose_bvar t 0"
abbreviation "is_closed t \<equiv> \<not> is_open t"
definition "is_dependent t \<equiv> loose_bvar1 t 0"
lemma loose_bvar_Suc: "loose_bvar t (Suc k) \<Longrightarrow> loose_bvar t k"
by (induction t arbitrary: k) auto
lemma loose_bvar_leq: "k\<ge>p \<Longrightarrow> loose_bvar t k \<Longrightarrow> loose_bvar t p"
by (induction rule: inc_induct) (use loose_bvar_Suc in auto)
lemma has_typ1_imp_no_loose_bvar: "has_typ1 Ts t ty \<Longrightarrow> \<not> loose_bvar t (length Ts)"
by (induction rule: has_typ1.induct) auto
corollary has_typ_imp_closed: "has_typ t ty \<Longrightarrow> \<not> is_open t"
unfolding is_open_def has_typ_def using has_typ1_imp_no_loose_bvar by fastforce
corollary typ_of_imp_closed: "typ_of t = Some ty \<Longrightarrow> \<not> is_open t"
by (simp add: has_typ_imp_closed)
text\<open>Subterms\<close>
(* probably ugly for proofs... *)
fun exists_subterm :: "(term \<Rightarrow> bool) \<Rightarrow> term \<Rightarrow> bool" where
"exists_subterm P t \<longleftrightarrow> P t \<or> (case t of
(t $ u) \<Rightarrow> exists_subterm P t \<or> exists_subterm P u
| Abs ty body \<Rightarrow> exists_subterm P body
| _ \<Rightarrow> False)"
(* Is this better? *)
fun exists_subterm' :: "(term \<Rightarrow> bool) \<Rightarrow> term \<Rightarrow> bool" where
"exists_subterm' P (t $ u) \<longleftrightarrow> P (t $ u) \<or> exists_subterm' P t \<or> exists_subterm' P u"
| "exists_subterm' P (Abs ty body) \<longleftrightarrow> P (Abs ty body) \<or> exists_subterm' P body"
| "exists_subterm' P t \<longleftrightarrow> P t"
lemma exists_subterm_iff_exists_subterm': "exists_subterm P t \<longleftrightarrow> exists_subterm' P t"
by (induction t) auto
lemma "exists_subterm (\<lambda>t. t=Fv idx T) t \<longleftrightarrow> (idx, T) \<in> fv t"
by (induction t) auto
(* Fairly old, however still needed for some proofs about "subterms" *)
(* Must have no loose bounds in t, from Logic.ML*)
abbreviation "occs t u \<equiv> exists_subterm (\<lambda>s. t = s) u"
lemma occs_Fv_eq_elem_fv: "occs (Fv v S) t \<longleftrightarrow> (v, S) \<in> fv t"
by (induction t) auto
lemma bind_fv2_unchanged:
"\<not>loose_bvar tm lev \<Longrightarrow> bind_fv2 v lev tm = tm \<Longrightarrow> v \<notin> fv tm"
by (induction v lev tm rule: bind_fv2.induct) auto
lemma bind_fv2_unchanged':
"\<not>loose_bvar tm lev \<Longrightarrow> bind_fv2 v lev tm = tm \<Longrightarrow> \<not> occs (case_prod Fv v) tm"
by (induction v lev tm rule: bind_fv2.induct) auto
lemma bind_fv2_changed:
"bind_fv2 v lev tm \<noteq> tm \<Longrightarrow> v \<in> fv tm"
by (induction v lev tm rule: bind_fv2.induct) (auto split: if_splits)
lemma bind_fv2_changed':
"bind_fv2 v lev tm \<noteq> tm \<Longrightarrow> occs (case_prod Fv v) tm"
by (induction v lev tm rule: bind_fv2.induct) (auto split: if_splits)
corollary bind_fv_changed: "bind_fv v tm \<noteq> tm \<Longrightarrow> v \<in> fv tm"
unfolding is_open_def bind_fv_def using bind_fv2_changed by simp
corollary bind_fv_changed': "bind_fv v tm \<noteq> tm \<Longrightarrow> occs (case_prod Fv v) tm"
unfolding is_open_def bind_fv_def using bind_fv2_changed' by simp
corollary bind_fv_unchanged: "(x,\<tau>) \<notin> fv t \<Longrightarrow> bind_fv (x,\<tau>) t = t"
using bind_fv_changed by auto
inductive_cases has_typ1_app_elim: "has_typ1 Ts (t $ u) R"
lemma has_typ1_arg_typ: "has_typ1 Ts (t $ u) R \<Longrightarrow> has_typ1 Ts u U \<Longrightarrow> has_typ1 Ts t (U \<rightarrow> R)"
using has_typ1_app_elim
by (metis has_typ1_imp_typ_of1 option.inject typ_of1_imp_has_typ1)
lemma has_typ1_fun_typ: "has_typ1 Ts (t $ u) R \<Longrightarrow> has_typ1 Ts t (U \<rightarrow> R) \<Longrightarrow> has_typ1 Ts u U"
by (cases rule: has_typ1_app_elim[of Ts t u R "has_typ1 Ts u U"]) (use has_typ1_unique in auto)
lemma typ_of1_arg_typ:
"typ_of1 Ts (t $ u) = Some R \<Longrightarrow> typ_of1 Ts u = Some U \<Longrightarrow> typ_of1 Ts t = Some (U \<rightarrow> R)"
using has_typ1_iff_typ_of1 has_typ1_arg_typ by simp
corollary typ_of_arg: "typ_of (t$u) = Some R \<Longrightarrow> typ_of u = Some T \<Longrightarrow> typ_of t = Some (T \<rightarrow> R)"
by (metis typ_of1_arg_typ typ_of_def)
lemma typ_of1_fun_typ:
"typ_of1 Ts (t $ u) = Some R \<Longrightarrow> typ_of1 Ts t = Some (U \<rightarrow> R) \<Longrightarrow> typ_of1 Ts u = Some U"
using has_typ1_iff_typ_of1 has_typ1_fun_typ by blast
corollary typ_of_fun: "typ_of (t$u) = Some R \<Longrightarrow> typ_of t = Some (U \<rightarrow> R) \<Longrightarrow> typ_of u = Some U"
by (metis typ_of1_fun_typ typ_of_def)
lemma typ_of_eta_expand: "typ_of f = Some (\<tau> \<rightarrow> \<tau>') \<Longrightarrow> typ_of (Abs \<tau> (f $ Bv 0)) = Some (\<tau> \<rightarrow> \<tau>')"
using typ_of1_weaken by (fastforce simp add: bind_eq_Some_conv typ_of_def)
lemma bind_fv2_preserves_type:
assumes "typ_of1 Ts t = Some ty"
shows "typ_of1 (Ts@[T]) (bind_fv2 (v, T) (length Ts) t) = Some ty"
using assms by (induction "(v, T)" "length Ts" t arbitrary: T Ts ty rule: bind_fv2.induct)
(force simp add: bind_eq_Some_conv nth_append split: if_splits)+
lemma typ_of_Abs_bind_fv:
assumes "typ_of A = Some ty"
shows "typ_of (Abs bT (bind_fv (v, bT) A)) = Some (bT \<rightarrow> ty)"
using bind_fv2_preserves_type bind_fv_def assms typ_of_def by fastforce
corollary typ_of_Abs_fv:
assumes "typ_of A = Some ty"
shows "typ_of (Abs_fv v bT A) = Some (bT \<rightarrow> ty)"
using assms typ_of_Abs_bind_fv typ_of_def by simp
lemma typ_of_mk_all:
assumes "typ_of A = Some propT"
shows "typ_of (mk_all x ty A) = Some propT"
using typ_of_Abs_bind_fv[OF assms, of ty] by (auto simp add: typ_of_def)
fun incr_bv :: "nat \<Rightarrow> nat \<Rightarrow> term \<Rightarrow> term" where
"incr_bv inc n (Bv i) = (if i \<ge> n then Bv (i+inc) else Bv i)"
| "incr_bv inc n (Abs T body) = Abs T (incr_bv inc (n+1) body)"
| "incr_bv inc n (App f t) = App (incr_bv inc n f) (incr_bv inc n t)"
| "incr_bv _ _ u = u"
(* Bridging *)
lemma lift_def: "lift t n = incr_bv 1 n t"
by (induction t n rule: lift.induct) auto
declare lift.simps[simp del]
declare lift_def[simp]
definition "incr_boundvars inc t = incr_bv inc 0 t"
fun decr :: "nat \<Rightarrow> term \<Rightarrow> term" where
"decr lev (Bv i) = (if i \<ge> lev then Bv (i - 1) else Bv i)"
| "decr lev (Abs T t) = Abs T (decr (lev + 1) t)"
| "decr lev (t $ u) = (decr lev t $ decr lev u)"
| "decr _ t = t"
lemma incr_bv_0[simp]: "incr_bv 0 lev t = t"
by (induction t arbitrary: lev) auto
lemma loose_bvar_incr_bvar: "loose_bvar t lev \<longleftrightarrow> loose_bvar (incr_bv inc lev t) (lev+inc)"
by (induction t arbitrary: inc lev) force+
lemma no_loose_bvar_no_incr[simp]: "\<not> loose_bvar t lev \<Longrightarrow> incr_bv inc lev t = t"
by (induction t arbitrary: inc lev) auto
lemma is_close_no_incr_boundvars[simp]: "is_closed t \<Longrightarrow> incr_boundvars inc t = t"
using no_loose_bvar_no_incr by (simp add: incr_boundvars_def is_open_def)
lemma fv_incr_bv [simp]: "fv (incr_bv inc lev t) = fv t"
by (induction inc lev t rule: incr_bv.induct) auto
lemma fv_incr_boundvars [simp]: "fv (incr_boundvars inc t) = fv t"
by (simp add: incr_boundvars_def)
lemma loose_bvar_decr: "\<not> loose_bvar t k \<Longrightarrow> \<not> loose_bvar (decr k t) k"
by (induction t k rule: loose_bvar.induct) auto
lemma loose_bvar_decr_unchanged[simp]: "\<not> loose_bvar t k \<Longrightarrow> decr k t = t"
by (induction t k rule: loose_bvar.induct) auto
lemma is_closed_decr_unchanged[simp]: "is_closed t \<Longrightarrow> decr 0 t = t"
by (simp add: is_open_def)
fun subst_bv1 :: "term \<Rightarrow> nat \<Rightarrow> term \<Rightarrow> term" where
"subst_bv1 (Bv i) lev u = (if i < lev then Bv i
else if i = lev then (incr_boundvars lev u)
else (Bv (i - 1)))"
| "subst_bv1 (Abs T body) lev u = Abs T (subst_bv1 body (lev + 1) u)"
| "subst_bv1 (f $ t) lev u = subst_bv1 f lev u $ subst_bv1 t lev u"
| "subst_bv1 t _ _ = t"
lemma incr_bv_combine: "incr_bv m k (incr_bv n k s) = incr_bv (m+n) k s"
by (induction s arbitrary: k) auto
lemma substn_subst_n : "subst_bv1 t n s = subst_bv2 t n (incr_bv n 0 s)"
by (induct t arbitrary: n) (auto simp add: incr_boundvars_def incr_bv_combine)
theorem substn_subst_0: "subst_bv1 t 0 s = subst_bv2 t 0 s"
by (simp add: substn_subst_n)
corollary substn_subst_0': "subst_bv s t = subst_bv2 t 0 s"
using subst_bv_def substn_subst_0 by simp
lemma subst_bv2_eq [simp]: "subst_bv2 (Bv k) k u = u"
by (simp add:)
lemma subst_bv2_gt [simp]: "i < j \<Longrightarrow> subst_bv2 (Bv j) i u = Bv (j - 1)"
by (simp add:)
lemma subst_bv2_subst_lt [simp]: "j < i \<Longrightarrow> subst_bv2 (Bv j) i u = Bv j"
by (simp add:)
lemma lift_lift:
"i < k + 1 \<Longrightarrow> lift (lift t i) (Suc k) = lift (lift t k) i"
by (induct t arbitrary: i k) auto
lemma lift_subst [simp]:
"j < i + 1 \<Longrightarrow> lift (subst_bv2 t j s) i = subst_bv2 (lift t (i + 1)) j (lift s i)"
proof (induction t arbitrary: i j s)
case (Abs T t)
then show ?case
by (simp_all add: diff_Suc lift_lift split: nat.split)
(metis One_nat_def Suc_eq_plus1 lift_def lift_lift zero_less_Suc)
qed (simp_all add: diff_Suc lift_lift split: nat.split)
lemma lift_subst_bv2_subst_lt:
"i < j + 1 \<Longrightarrow> lift (subst_bv2 t j s) i = subst_bv2 (lift t i) (j + 1) (lift s i)"
proof (induction t arbitrary: i j s)
case (Abs x1 t)
then show ?case
using lift_lift by force
qed (auto simp add: lift_lift)
lemma subst_bv2_lift [simp]:
"subst_bv2 (lift t k) k s = t"
by (induct t arbitrary: k s) simp_all
lemma subst_bv2_subst_bv2:
"i < j + 1 \<Longrightarrow> subst_bv2 (subst_bv2 t (Suc j) (lift v i)) i (subst_bv2 u j v)
= subst_bv2 (subst_bv2 t i u) j v"
proof(induction t arbitrary: i j u v)
case (Abs s T t)
then show ?case
by (smt Suc_mono add.commute lift_lift lift_subst_bv2_subst_lt plus_1_eq_Suc subst_bv2.simps(2) zero_less_Suc)
qed (use subst_bv2_lift in \<open>auto simp add: diff_Suc lift_lift [symmetric] lift_subst_bv2_subst_lt split: nat.split\<close>)
(* Bridging *)
hide_fact (open) subst_bv_def
lemma subst_bv_def: "subst_bv u t \<equiv> subst_bv1 t 0 u"
by (simp add: substn_subst_0' substn_subst_n)
(* Probably not necessary *)
fun subst_bvs1 :: "term \<Rightarrow> nat \<Rightarrow> term list \<Rightarrow> term" where
"subst_bvs1 (Bv n) lev args = (if n < lev
then Bv n
else if n - lev < length args
then incr_boundvars lev (nth args (n-lev))
else Bv (n - length args))"
| "subst_bvs1 (Abs T body) lev args = Abs T (subst_bvs1 body (lev+1) args)"
| "subst_bvs1 (f $ t) lev args = subst_bvs1 f lev args $ subst_bvs1 t lev args"
| "subst_bvs1 t _ _ = t"
definition "subst_bvs args t \<equiv> subst_bvs1 t 0 args"
lemma subst_bvs_App[simp]: "subst_bvs args (s$t) = subst_bvs args s $ subst_bvs args t"
by (auto simp add: subst_bvs_def)
lemma subst_bv1_special_case_subst_bvs1: "subst_bvs1 t lev [x] = subst_bv1 t lev x"
by (induction t lev "[x]" arbitrary: x rule: subst_bvs1.induct) auto
lemma no_loose_bvar_imp_no_subst_bv1: "\<not>loose_bvar t lev \<Longrightarrow> subst_bv1 t lev u = t"
by (induction t arbitrary: lev) auto
lemma no_loose_bvar_imp_no_subst_bvs1: "\<not>loose_bvar t lev \<Longrightarrow> subst_bvs1 t lev us = t"
by (induction t arbitrary: lev) auto
(* The precondition in the following lemmas makes them fairly useless *)
lemma subst_bvs1_step:
assumes "\<not> loose_bvar t lev"
shows "subst_bvs1 t lev (args@[u]) = subst_bv1 (subst_bvs1 t lev args) lev u"
using assms by (induction t arbitrary: lev args u) auto
corollary closed_subst_bv_no_change: "is_closed t \<Longrightarrow> subst_bv u t = t"
unfolding is_open_def subst_bv_def no_loose_bvar_imp_no_subst_bv1 by simp
lemma is_variable_imp_incr_bv_unchanged: "incr_bv inc lev (Fv v T) = (Fv v T)"
by simp
lemma is_variable_imp_incr_boundvars_unchganged: "incr_boundvars inc (Fv v T) = (Fv v T)"
using is_variable_imp_incr_bv_unchanged incr_boundvars_def by simp
lemma loose_bvar_subst_bv1:
"\<not> loose_bvar (subst_bv1 t lev u) lev \<Longrightarrow> \<not> loose_bvar t (Suc lev)"
by (induction t lev u rule: subst_bv1.induct) auto
lemma is_closed_subst_bv: "is_closed (subst_bv u t) \<Longrightarrow> \<not> loose_bvar t 1"
by (simp add: is_open_def loose_bvar_subst_bv1 subst_bv_def)
lemma subst_bv1_bind_fv2:
assumes "\<not> loose_bvar t lev"
shows "subst_bv1 (bind_fv2 (v, T) lev t) lev (Fv v T) = t"
using assms by (induction t arbitrary: lev) (use is_variable_imp_incr_boundvars_unchganged in auto)
corollary subst_bv_bind_fv:
assumes "is_closed t"
shows "subst_bv (Fv v T) (bind_fv (v, T) t) = t"
unfolding bind_fv_def subst_bv_def using assms subst_bv1_bind_fv2 is_open_def
by blast
fun betapply :: "term \<Rightarrow> term \<Rightarrow> term" (infixl "\<bullet>" 52) where
"betapply (Abs _ t) u = subst_bv u t"
| "betapply t u = t $ u"
lemma betapply_Abs_fv:
assumes "is_closed t"
shows "betapply (Abs_fv v T t) (Fv v T) = t"
using assms subst_bv_bind_fv by simp
lemma typ_of1_imp_no_loose_bvar: "typ_of1 Ts t = Some ty \<Longrightarrow> \<not> loose_bvar t (length Ts)"
by (simp add: has_typ1_imp_no_loose_bvar)
lemma typ_of1_subst_bv:
assumes "typ_of1 (Ts@[uty]) f = Some fty"
and "typ_of u = Some uty"
shows "typ_of1 Ts (subst_bv1 f (length Ts) u) = Some fty"
using assms
proof (induction f "length Ts" u arbitrary: uty fty Ts rule: subst_bv1.induct)
case (1 i arg)
then show ?case
using no_loose_bvar_no_incr typ_of1_imp_no_loose_bvar typ_of1_weaken
by (force simp add: bind_eq_Some_conv incr_boundvars_def nth_append typ_of_def
split: if_splits)
next
case (2 a T body arg)
then show ?case
by (simp add: bind_eq_Some_conv typ_of_def) (smt append_Cons bind_eq_Some_conv length_Cons)
qed (auto simp add: bind_eq_Some_conv)
lemma typ_of1_split_App:
"typ_of1 Ts (t $ u) = Some ty \<Longrightarrow> (\<exists>uty . typ_of1 Ts t = Some (uty \<rightarrow> ty) \<and> typ_of1 Ts u = Some uty)"
by (metis (no_types, lifting) bind.bind_lzero the_default.elims typ_of1.simps(5) typ_of1_arg_typ)
corollary typ_of1_split_App_obtains:
assumes "typ_of1 Ts (t $ u) = Some ty"
obtains uty where "typ_of1 Ts t = Some (uty \<rightarrow> ty)" "typ_of1 Ts u = Some uty"
using typ_of1_split_App assms by blast
lemma typ_of1_incr_bv:
assumes "typ_of1 Ts t = Some ty"
and "lev \<le> length Ts"
shows "typ_of1 (take lev Ts @ Ts' @ drop lev Ts) (incr_bv (length Ts') lev t) = Some ty"
using assms by (induction t arbitrary: ty Ts Ts' lev)
(fastforce simp add: nth_append bind_eq_Some_conv min_def split: if_splits)+
corollary typ_of1_incr_bv_lev0:
assumes "typ_of1 Ts t = Some ty"
shows "typ_of1 (Ts' @ Ts) (incr_bv (length Ts') 0 t) = Some ty"
using assms typ_of1_incr_bv[where lev=0] by simp
lemma typ_of1_subst_bv_gen:
assumes "typ_of1 (Ts'@[uty]@Ts) t = Some tty" and "typ_of1 Ts u = Some uty"
shows "typ_of1 (Ts' @ Ts) (subst_bv1 t (length Ts') u) = Some tty"
using assms
proof (induction t "length Ts'" u arbitrary: tty uty Ts Ts' rule: subst_bv1.induct)
next
case (2 a T body arg)
then show ?case
by (simp add: bind_eq_Some_conv) (metis append_Cons length_Cons)
qed (auto simp add: bind_eq_Some_conv nth_append incr_boundvars_def
typ_of1_incr_bv_lev0 split: if_splits)
(* This is the correct version, the other one inserts "at the wrong side of the bounds" *)
lemma typ_of1_subst_bv_gen_depre:
assumes "typ_of1 (Ts'@Ts) f = Some (fty)"
and "typ_of1 (Ts) u = Some uty"
and "last Ts' = uty" and "Ts' \<noteq> []"
shows "typ_of1 (butlast Ts' @ Ts) (subst_bv1 f (length Ts'-1) u) = Some fty"
using assms
proof (induction f "length Ts'" u arbitrary: fty uty Ts Ts' rule: subst_bv1.induct)
case (1 i arg)
from 1 consider (LT) "(length Ts' - 1) < i" | (EQ) "(length Ts' - 1) = i" | (GT) "(length Ts' - 1) > i"
using linorder_neqE_nat by blast
then show ?case
by cases (metis "1.prems" append_assoc append_butlast_last_id length_butlast typ_of1_subst_bv_gen)+
next
case (2 a T body arg)
then show ?case
by (metis append.assoc append_butlast_last_id length_butlast typ_of1_subst_bv_gen)
next
case (3 f t arg)
then show ?case
by (auto simp add: bind_eq_Some_conv nth_append incr_boundvars_def subst_bv_def
split: if_splits)
qed auto
corollary typ_of1_subst_bv_gen':
assumes "typ_of1 (uty#Ts) t = Some tty"
and "typ_of1 Ts u = Some uty"
shows "typ_of1 Ts (subst_bv1 t 0 u) = Some tty"
using assms typ_of1_subst_bv_gen
by (metis append.left_neutral append_Cons list.size(3))
lemma typ_of_betapply:
assumes "typ_of1 Ts (Abs uty t) = Some (uty \<rightarrow> tty)"
assumes "typ_of1 Ts u = Some uty"
shows "typ_of1 Ts ((Abs uty t) \<bullet> u) = Some tty"
using assms typ_of1_subst_bv_gen'
by (auto simp add: bind_eq_Some_conv subst_bv_def)
lemma no_Bv_Type_param_irrelevant_typ_of:
"\<not>exists_subterm (\<lambda>x . case x of Bv _ \<Rightarrow> True | _ \<Rightarrow> False) t
\<Longrightarrow> typ_of1 Ts t = typ_of1 Ts' t"
by (induction t arbitrary: Ts Ts') (simp_all, metis+)
lemma typ_of1_drop_extra_bounds:
"\<not>loose_bvar t (length Ts)
\<Longrightarrow> typ_of1 (Ts@rest) t = typ_of1 Ts t"
by (induction Ts t arbitrary: rest rule: typ_of1.induct) (fastforce simp add: nth_append)+
lemma typ_of_betaply:
assumes "typ_of t = Some (uty \<rightarrow> tty)" "typ_of u = Some uty"
shows "typ_of (t \<bullet> u) = Some tty"
proof (cases t)
case (Abs T t)
then show ?thesis
proof (cases "is_open t")
case True
then show ?thesis
unfolding is_open_def using assms Abs typ_of1_subst_bv
apply (simp add: bind_eq_Some_conv subst_bv_def typ_of_def)
by (metis append_Nil list.size(3) typ_of_def)
next
case False
hence "typ_of1 [uty] t = Some tty" using assms(1)
by (auto simp add: bind_eq_Some_conv typ_of_def is_open_def Abs)
then show ?thesis
using assms False no_loose_bvar_imp_no_subst_bv1
apply (simp add: bind_eq_Some_conv typ_of_def is_open_def subst_bv_def Abs)
using no_Bv_Type_param_irrelevant_typ_of
using typ_of1_drop_extra_bounds
by (metis list.size(3) self_append_conv2)
qed
qed (use assms in \<open>simp_all add: typ_of_def\<close>)
fun beta_reducible :: "term \<Rightarrow> bool" where
"beta_reducible (App (Abs _ _) _) = True"
| "beta_reducible (Abs _ t) = beta_reducible t"
| "beta_reducible (App t u) = (beta_reducible t \<or> beta_reducible u)"
| "beta_reducible _ = False"
fun eta_reducible :: "term \<Rightarrow> bool" where
"eta_reducible (Abs _ (t $ Bv 0)) = (\<not> is_dependent t \<or> eta_reducible t)"
| "eta_reducible (Abs _ t) = eta_reducible t"
| "eta_reducible (App t u) = (eta_reducible t \<or> eta_reducible u)"
| "eta_reducible _ = False"
lemma "\<not> loose_bvar t lev \<Longrightarrow> decr lev t = t"
by (induction t arbitrary: lev) auto
lemma decr_incr_bv1: "decr lev (incr_bv 1 lev t) = t"
by (induction t arbitrary: lev) auto
(* For termination proofs *)
fun depth :: "term \<Rightarrow> nat" where
"depth (Abs _ t) = depth t + 1"
| "depth (t $ u) = max (depth t) (depth u) +1"
| "depth t = 0"
lemma depth_decr: "depth (decr lev t) = depth t"
by (induction lev t rule: decr.induct) auto
lemma loose_bvar1_decr: "lev > 0 \<Longrightarrow> \<not> loose_bvar1 t (Suc lev) \<Longrightarrow> \<not> loose_bvar1 (decr lev t) lev"
by (induction lev t arbitrary: rule: decr.induct) auto
lemma loose_bvar1_decr':
"\<not> loose_bvar1 t (Suc lev) \<Longrightarrow> \<not> loose_bvar1 t lev \<Longrightarrow> \<not> loose_bvar1 (decr lev t) lev"
by (induction lev t arbitrary: rule: decr.induct) auto
lemma eta_reducible_Abs1: "\<not> eta_reducible (Abs T (t $ Bv 0)) \<Longrightarrow> \<not> eta_reducible t" by simp
lemma eta_reducible_Abs2:
assumes "\<not> (\<exists>f. t=f $ Bv 0)" "\<not> eta_reducible (Abs T t)"
shows "\<not> eta_reducible t"
proof (cases t)
case (Abs T body)
then show ?thesis using assms(2) by (cases body) auto
next
case (App f u)
then show ?thesis using assms less_imp_Suc_add by (cases f; cases u) fastforce+
qed auto
lemma eta_reducible_Abs: "\<not> eta_reducible (Abs T t) \<Longrightarrow> \<not> eta_reducible t"
using eta_reducible_Abs1 eta_reducible_Abs2
by (metis eta_reducible.simps(11) eta_reducible.simps(14))
lemma loose_bvar1_decr'': "loose_bvar1 t lev \<Longrightarrow> lev < lev'\<Longrightarrow> loose_bvar1 (decr lev' t) lev"
by (induction t arbitrary: lev lev') auto
lemma loose_bvar1_decr''': "loose_bvar1 t (Suc lev) \<Longrightarrow> lev' \<le> lev \<Longrightarrow> loose_bvar1 (decr lev' t) lev"
by (induction t arbitrary: lev lev') auto
lemma loose_bvar1_decr'''': "\<not> loose_bvar1 t lev' \<Longrightarrow> lev' \<le> lev \<Longrightarrow> \<not> loose_bvar1 t (Suc lev)
\<Longrightarrow> \<not> loose_bvar1 (decr lev' t) lev"
by (induction lev t arbitrary: lev' rule: decr.induct) auto
lemma not_eta_reducible_decr:
"\<not> eta_reducible t \<Longrightarrow> \<not> loose_bvar1 t lev \<Longrightarrow> \<not> eta_reducible (decr lev t) "
proof (induction lev t arbitrary: rule: decr.induct)
case (2 lev T body)
hence "\<not> eta_reducible body" using eta_reducible_Abs by blast
hence I: "\<not> eta_reducible (decr (lev + 1) body)" using "2.IH"
using "2.prems"(2) by simp
then show ?case
proof(cases body)
case (App f u)
note app = this
then show ?thesis
proof (cases u)
case (Bv n)
then show ?thesis
proof (cases "n")
case 0
have "is_dependent f" "\<not> eta_reducible f"
using "0" "2.prems"(1) App Bv eta_reducible.simps(1) by blast+
hence "loose_bvar1 f 0" by (simp add: is_dependent_def)
hence "loose_bvar1 (decr (Suc lev) f) 0" using loose_bvar1_decr'' by simp
then show ?thesis using I by (auto simp add: 0 Bv App is_dependent_def)
next
case (Suc nat)
then show ?thesis
using 2 App Bv
by (auto elim: eta_reducible.elims(2) simp add: Suc Bv App is_dependent_def)
qed
next
case (Abs T t)
then show ?thesis
using I by (auto split: if_splits simp add: App is_dependent_def)
qed (use I in \<open>auto split: if_splits simp add: App is_dependent_def\<close>)
qed (auto split: if_splits simp add: is_dependent_def)
qed auto
function (sequential, domintros) eta_norm :: "term \<Rightarrow> term" where
"eta_norm (Abs T t) = (case eta_norm t of
f $ Bv 0 \<Rightarrow> (if is_dependent f then Abs T (f $ Bv 0) else decr 0 (eta_norm f))
| body \<Rightarrow> Abs T body)"
| "eta_norm (t $ u) = eta_norm t $ eta_norm u"
| "eta_norm t = t"
by pat_completeness auto
lemma eta_norm_reduces_depth: "eta_norm_dom t \<Longrightarrow> depth (eta_norm t) <= depth t"
by (induction t rule: eta_norm.pinduct)
(use depth_decr in \<open>fastforce simp add: eta_norm.psimps eta_norm.domintros is_dependent_def
split: term.splits nat.splits\<close>)+
termination eta_norm
proof (relation "measure depth")
fix T body t u n
assume asms: "eta_norm body = t $ u" "u = Bv n" "n = 0" "\<not> is_dependent t" "eta_norm_dom body"
have "depth t < depth (t $ Bv 0)" by auto
moreover have "depth (eta_norm body) \<le> depth body" using asms eta_norm_reduces_depth by blast
ultimately show "(t, Abs T body) \<in> measure depth" using asms by (auto simp add: eta_norm.psimps)
qed simp_all
lemma loose_bvar1_eta_norm: "loose_bvar1 t lev \<Longrightarrow> loose_bvar1 (eta_norm t) lev"
by (induction t arbitrary: lev rule: eta_norm.induct)
(use loose_bvar1_decr''' in \<open>(fastforce split: term.splits nat.splits)+\<close>)
lemma loose_bvar1_eta_norm': "\<not> loose_bvar1 t lev \<Longrightarrow> \<not> loose_bvar1 (eta_norm t) lev"
proof (induction t arbitrary: lev rule: eta_norm.induct)
case (1 T body)
hence "\<not> loose_bvar1 body (Suc lev)" by simp
hence I: "\<not> loose_bvar1 (eta_norm body) (Suc lev)" using 1 by simp
then show ?case
proof (cases body)
case (Abs ty b)
show ?thesis
using I loose_bvar1_decr''''
by (auto split: term.splits nat.splits if_splits simp add: "1.IH"(2) is_dependent_def)
next
case (App T t)
then show ?thesis using 1 I loose_bvar1_decr''''
by (fastforce split: term.splits nat.splits if_splits simp add: is_dependent_def)
qed (auto split: term.splits nat.splits simp add: is_dependent_def)
qed (auto split: term.splits nat.splits simp add: is_dependent_def)
lemma not_eta_reducible_eta_norm: "\<not> eta_reducible (eta_norm t)"
proof (induction t rule: eta_norm.induct)
case (1 T body)
then show ?case
proof (cases "eta_norm (body)")
case (Abs T t)
then show ?thesis using 1 by auto
next
case (App f u)
then show ?thesis
proof (cases "u = Bv 0")
case True
note u = this
then show ?thesis
proof (cases "is_dependent f")
case True
then show ?thesis
using 1 App u by (auto simp add: is_dependent_def split: term.splits nat.splits if_splits)
next
case False
have "\<not> eta_reducible f" using 1 App u by simp
hence "\<not> eta_reducible (eta_norm f)"
by (simp add: "1.IH"(2) App False u)
have "\<not> loose_bvar1 f 0"
using False is_dependent_def by blast
hence "\<not> loose_bvar1 (eta_norm f) 0"
using loose_bvar1_eta_norm' by blast
show ?thesis
using 1 App u False not_eta_reducible_decr loose_bvar1_eta_norm \<open>\<not> loose_bvar1 (eta_norm f) 0\<close>
by (auto simp add: is_dependent_def split: term.splits nat.splits if_splits)
qed
next
case False
then show ?thesis using 1 App by (auto simp add: is_dependent_def
split: term.splits nat.splits if_splits)
qed
qed auto
qed auto
lemma not_eta_reducible_imp_eta_norm_no_change: "\<not> eta_reducible t \<Longrightarrow> eta_norm t = t"
by (induction t rule: eta_norm.induct) (auto simp add: eta_reducible_Abs is_dependent_def
split: term.splits nat.splits)
lemma eta_norm_collapse: "eta_norm (eta_norm t) = eta_norm t"
using not_eta_reducible_imp_eta_norm_no_change not_eta_reducible_eta_norm by blast
lemma typ_of1_decr: "typ_of1 (Ts@[T]@Ts') t = Some ty \<Longrightarrow> \<not> loose_bvar1 t (length Ts)
\<Longrightarrow> typ_of1 (Ts@Ts') (decr (length Ts) t) = Some ty"
proof (induction t arbitrary: Ts T Ts' ty)
case (Abs bT t)
then show ?case
by (simp add: bind_eq_Some_conv) (metis append_Cons length_Cons)
qed (auto split: if_splits simp add: bind_eq_Some_conv nth_append)
lemma typ_of1_decr_gen: "typ_of1 (Ts@[T]@Ts') t = tyo \<Longrightarrow> \<not> loose_bvar1 t (length Ts)
\<Longrightarrow> typ_of1 (Ts@Ts') (decr (length Ts) t) = tyo"
proof (induction t arbitrary: Ts T Ts' tyo)
case (Abs T t)
then show ?case
by (simp add: bind_eq_Some_conv) (metis append_Cons length_Cons)
next
case (App t1 t2)
then show ?case by simp
qed (auto split: if_splits simp add: bind_eq_Some_conv nth_append
split: option.splits)
lemma typ_of1_decr_gen': "typ_of1 (Ts@Ts') (decr (length Ts) t) = tyo\<Longrightarrow> \<not> loose_bvar1 t (length Ts)
\<Longrightarrow> typ_of1 (Ts@[T]@Ts') t = tyo"
proof (induction t arbitrary: Ts T Ts' tyo)
case (Abs T t)
then show ?case
by (simp add: bind_eq_Some_conv) (metis append_Cons length_Cons)
qed (auto split: if_splits simp add: bind_eq_Some_conv nth_append
split: option.splits)
(* Other direction does not necessarily hold, eta_norm could remove incorrect abstractions *)
lemma typ_of1_eta_norm: "typ_of1 Ts t = Some ty \<Longrightarrow> typ_of1 Ts (eta_norm t) = Some ty"
proof (induction Ts t arbitrary: ty rule: typ_of1.induct)
case (4 Ts T body)
then show ?case
proof(cases "eta_norm body")
case (App f u)
then show ?thesis
(* In dire need of cleanup *)
proof (cases u)
case (Bv n)
then show ?thesis
proof (cases n)
case 0
then show ?thesis
proof (cases "is_dependent f")
case True
hence "eta_norm (Abs T body) = Abs T (f $ Bv 0)"
by (auto simp add: App 0 "4.IH" Bv bind_eq_Some_conv is_dependent_def split: nat.splits)
then show ?thesis
using 4 by (force simp add: "0" Bv App is_dependent_def bind_eq_Some_conv split: if_splits)
next
case False
hence simp: "eta_norm (Abs T body) = decr 0 (eta_norm f)"
by (auto simp add: App 0 "4.IH" Bv bind_eq_Some_conv bind_eq_None_conv
is_dependent_def split: nat.splits)
obtain bT where bT: "typ_of1 (T # Ts) body = Some bT"
using "4.prems" by fastforce
hence "typ_of1 (T # Ts) (eta_norm body) = Some bT"
using "4.IH" by blast
moreover have "T \<rightarrow> bT = ty"
using "4.prems" bT by auto
ultimately have "typ_of1 (T#Ts) f = Some ty"
by (metis "0" App Bv length_Cons nth_Cons_0 typ_of1.simps(2) typ_of1_arg_typ zero_less_Suc)
hence "typ_of1 Ts (decr 0 f) = Some ty"
by (metis False append_Cons append_Nil is_dependent_def list.size(3) typ_of1_decr)
hence "typ_of1 Ts (decr 0 (eta_norm f)) = Some ty"
by (metis App eta_reducible.simps(11) not_eta_reducible_eta_norm not_eta_reducible_imp_eta_norm_no_change)
then show ?thesis
by(auto simp add: App 0 Bv False)
qed
next
case (Suc nat)
then show ?thesis
using 4 apply (simp add: App "4.IH" Bv bind_eq_Some_conv split: option.splits)
using option.sel by fastforce
qed
qed (use 4 in \<open>fastforce simp add: bind_eq_Some_conv nth_append split: if_splits\<close>)+
qed (use 4 in \<open>fastforce simp add: bind_eq_Some_conv nth_append split: if_splits\<close>)+
next
case (5 Ts f u)
then show ?case
apply (clarsimp split: term.splits typ.splits if_splits nat.splits option.splits
simp add: bind_eq_Some_conv)
by blast
qed (auto split: term.splits typ.splits if_splits nat.splits option.splits
simp add: bind_eq_Some_conv)
corollary typ_of_eta_norm: "typ_of t = Some ty \<Longrightarrow> typ_of (eta_norm t) = Some ty"
using typ_of1_eta_norm typ_of_def by simp
lemma typ_of_Abs_body_typ: "typ_of1 Ts (Abs T t) = Some ty \<Longrightarrow> \<exists>rty. ty = (T \<rightarrow> rty)"
by (metis (no_types, lifting) bind_eq_Some_conv option.sel typ_of1.simps(4))
lemma typ_of_Abs_body_typ': "typ_of1 Ts (Abs T t) = Some ty
\<Longrightarrow> \<exists>rty. ty = (T \<rightarrow> rty) \<and> typ_of1 (T#Ts) t = Some rty"
by (metis (no_types, lifting) bind_eq_Some_conv option.sel typ_of1.simps(4))
lemma typ_of_beta_redex_arg: "typ_of (Abs T s $ t) \<noteq> None \<Longrightarrow> typ_of t = Some T"
by (metis list.inject not_Some_eq typ.inject(1) typ_of1_split_App typ_of_Abs_body_typ' typ_of_def)
(* Does not terminate in general :( *)
partial_function (option) beta_norm :: "term \<Rightarrow> term option" where
"beta_norm t = (case t of
(Abs T body) \<Rightarrow> map_option (Abs T) (beta_norm body)
| (Abs T body $ u) \<Rightarrow> beta_norm (subst_bv u body)
| (f $ u) \<Rightarrow> (case beta_norm f of
Some (Abs T body) \<Rightarrow> beta_norm (subst_bv u body)
| Some f' \<Rightarrow> map_option (App f') (beta_norm u)
| None \<Rightarrow> None)
| t \<Rightarrow> Some t)"
simps_of_case beta_norm_simps[simp]: beta_norm.simps
declare beta_norm_simps[code]
lemma not_beta_reducible_imp_beta_norm_unchanged: "\<not> beta_reducible t \<Longrightarrow> beta_norm t = Some t"
proof (induction t)
case (App t u)
then show ?case by (cases t) auto
qed auto
lemma not_beta_reducible_decr: "\<not> beta_reducible t \<Longrightarrow> \<not> beta_reducible (decr n t)"
by (induction t arbitrary: n rule: beta_reducible.induct) auto
lemma "\<not> beta_reducible t \<Longrightarrow> eta_norm t = t' \<Longrightarrow> \<not> beta_reducible t'"
proof (induction t arbitrary: t' rule: eta_norm.induct)
case (1 T body)
show ?case
proof(cases "eta_norm body")
case (Abs T' t)
then show ?thesis using 1 by fastforce
next
case (App f u)
note oApp = this
show ?thesis
proof(cases u)
case (Bv n)
show ?thesis
proof(cases n)
case 0
then show ?thesis
proof(cases "is_dependent f")
case True
then show ?thesis
using 1 oApp Bv 0 apply simp
using beta_reducible.simps(2) by blast
next
case False
obtain body' where body': "eta_norm body = body'" by simp
obtain f' where f': "eta_norm f = f'" by simp
moreover have t': "t' = decr 0 f'" using "1.prems"(2)[symmetric] oApp Bv 0 False f' by simp
moreover have "\<not> beta_reducible t'"
proof-
have "\<not> beta_reducible (f $ Bv 0)"
using "1.IH"(1) 1 oApp Bv 0 by simp
hence "\<not> beta_reducible (decr 0 (f' $ Bv 0))"
by (metis eta_reducible.simps(11) f' not_beta_reducible_decr
not_eta_reducible_eta_norm not_eta_reducible_imp_eta_norm_no_change oApp)
hence "\<not> beta_reducible (decr 0 f' $ Bv 0)" by simp
hence "\<not> beta_reducible (decr 0 f')" by (auto elim: beta_reducible.elims)
thus ?thesis using t' by simp
qed
ultimately show ?thesis by blast
qed
next
case (Suc nat)
then show ?thesis using 1 oApp Bv by auto
qed
qed (use 1 oApp in auto)
qed (use 1 in auto)
next
case (2 f u)
hence "\<not> beta_reducible f" "\<not> beta_reducible u" by (blast elim!: beta_reducible.elims(3))+
moreover obtain f' u' where "eta_norm f = f'" "eta_norm u = u'" by simp_all
ultimately have "\<not> beta_reducible f'" "\<not> beta_reducible u'" using "2.IH" by simp_all
show ?case
proof(cases t')
case (App l r)
then show ?thesis
using "2.IH"(2) "2.prems"(2) \<open>\<not> beta_reducible u\<close> \<open>\<not> beta_reducible f'\<close> \<open>eta_norm f = f'\<close> "2"(3)
by (auto elim: beta_reducible.elims(3))
qed (use "2.prems"(2) in auto)
qed auto
fun is_variable :: "term \<Rightarrow> bool" where
"is_variable (Fv _ _) = True"
| "is_variable _ = False"
lemma fv_occs: "(x,\<tau>) \<in> fv t \<Longrightarrow> occs (Fv x \<tau>) t"
by (induction t) auto
lemma fv_iff_occs: "(x,\<tau>) \<in> fv t \<longleftrightarrow> occs (Fv x \<tau>) t"
by (induction t) auto
(* Next few definitions directly from ML code *)
fun strip_abs :: "term \<Rightarrow> typ list * term" where
"strip_abs (Abs T t) = (let (a', t') = strip_abs t in (T # a', t'))"
| "strip_abs t = ([], t)"
(*maps (x1,...,xn)t to t*)
fun strip_abs_body :: "term \<Rightarrow> term" where
"strip_abs_body (Abs _ t) = strip_abs_body t"
| "strip_abs_body u = u"
(*maps (x1,...,xn)t to [x1, ..., xn]*)
fun strip_abs_vars :: "term \<Rightarrow> typ list" where
"strip_abs_vars (Abs T t) = T # strip_abs_vars t"
| "strip_abs_vars u = []"
(*Dropped inner helper function, instead passing qnt along. *)
fun strip_qnt_body :: "name \<Rightarrow> term \<Rightarrow> term" where
"strip_qnt_body qnt ((Ct c ty) $ (Abs _ t)) =
(if c=qnt then strip_qnt_body qnt t else (Ct c ty))"
| "strip_qnt_body _ t = t"
(*Dropped inner helper function, instead passing qnt along. *)
fun strip_qnt_vars :: "name \<Rightarrow> term \<Rightarrow> typ list" where
"strip_qnt_vars qnt (Ct c _ $ Abs T t)= (if c=qnt then T # strip_qnt_vars qnt t else [])"
| "strip_qnt_vars qnt t = []"
(*maps (f, [t1,...,tn]) to f(t1,...,tn)*)
definition list_comb :: "term * term list \<Rightarrow> term" where "list_comb = case_prod (foldl ($))"
(*seems more natural curried...*)
definition list_comb' :: "term \<Rightarrow> term list \<Rightarrow> term" where "list_comb' = foldl ($)"
lemma "list_comb (h,t) = list_comb' h t" by (simp add: list_comb_def list_comb'_def)
(*curry this... ?*)
fun strip_comb_imp where
"strip_comb_imp (f$t, ts) = strip_comb_imp (f, t # ts)"
| "strip_comb_imp x = x"
(*maps f(t1,...,tn) to (f, [t1,...,tn]) ; naturally tail-recursive*)
definition strip_comb :: "term \<Rightarrow> term * term list" where
"strip_comb u = strip_comb_imp (u,[])"
(*maps f(t1,...,tn) to f , which is never a combination*)
fun head_of :: "term \<Rightarrow> term" where
"head_of (f$t) = head_of f"
| "head_of u = u"
(*some sanity check lemmas*)
lemma fst_strip_comb_imp_eq_head_of: "fst (strip_comb_imp (t,ts)) = head_of t"
by (induction "(t,ts)" arbitrary: t ts rule: strip_comb_imp.induct) simp_all
corollary "fst (strip_comb t) = head_of t"
using fst_strip_comb_imp_eq_head_of by (simp add: strip_comb_def)
(*not in ML*)
fun is_app :: "term \<Rightarrow> bool" where
"is_app (_ $ _) = True"
| "is_app _ = False"
lemma not_is_app_imp_strip_com_imp_unchanged: "\<not> is_app t \<Longrightarrow> strip_comb_imp (t,ts) = (t,ts)"
by (cases t) simp_all
corollary not_is_app_imp_strip_com_unchanged: "\<not> is_app t \<Longrightarrow> strip_comb t = (t,[])"
unfolding strip_comb_def using not_is_app_imp_strip_com_imp_unchanged .
lemma list_comb_fuse: "list_comb (list_comb (t,ts), ss) = list_comb (t,ts@ss)"
unfolding list_comb_def by simp
fun add_size_term :: "term \<Rightarrow> int \<Rightarrow> int" where
"add_size_term (t $ u) n = add_size_term t (add_size_term u n)"
| "add_size_term (Abs _ t) n = add_size_term t (n + 1)"
| "add_size_term _ n = n + 1"
definition "size_of_term t = add_size_term t 0"
fun add_size_type :: "typ \<Rightarrow> int \<Rightarrow> int" where
"add_size_type (Ty _ tys) n = fold add_size_type tys (n + 1)"
| "add_size_type _ n = n + 1"
definition "size_of_type ty = add_size_type ty 0"
fun map_types :: "(typ \<Rightarrow> typ) \<Rightarrow> term \<Rightarrow> term" where
"map_types f (Ct a T) = Ct a (f T)"
| "map_types f (Fv v T) = Fv v (f T)"
| "map_types f (Bv i) = Bv i"
| "map_types f (Abs T t) = Abs (f T) (map_types f t)"
| "map_types f (t $ u) = map_types f t $ map_types f u"
fun map_atyps :: "(typ \<Rightarrow> typ) \<Rightarrow> typ \<Rightarrow> typ" where
"map_atyps f (Ty a Ts) = Ty a (map (map_atyps f) Ts)"
| "map_atyps f T = f T"
lemma "map_atyps id ty = ty"
by (induction rule: typ.induct) (simp_all add: map_idI)
fun map_aterms :: "(term \<Rightarrow> term) \<Rightarrow> term \<Rightarrow> term" where
"map_aterms f (t $ u) = map_aterms f t $ map_aterms f u"
| "map_aterms f (Abs T t) = Abs T (map_aterms f t)"
| "map_aterms f t = f t"
lemma "map_aterms id t = t"
by (induction rule: term.induct) simp_all
definition "map_type_tvar f = map_atyps (\<lambda>x . case x of Tv iname s \<Rightarrow> f iname s | T \<Rightarrow> T)"
lemma map_types_id[simp]: "map_types id t = t"
by (induction t) simp_all
lemma map_types_id'[simp]: "map_types (\<lambda>a . a) t = t"
using map_types_id by (simp add: id_def)
(* fold types and terms *)
fun fold_atyps :: "(typ \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> typ \<Rightarrow> 'a \<Rightarrow> 'a" where
"fold_atyps f (Ty _ Ts) s = fold (fold_atyps f) Ts s"
| "fold_atyps f T s = f T s"
definition "fold_atyps_sorts f =
fold_atyps (\<lambda>x . case x of Tv vn S \<Rightarrow> f (Tv vn S) S)"
fun fold_aterms :: "(term \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> term \<Rightarrow> 'a \<Rightarrow> 'a" where
"fold_aterms f (t $ u) s = fold_aterms f u (fold_aterms f t s)"
| "fold_aterms f (Abs _ t) s = fold_aterms f t s"
| "fold_aterms f a s = f a s"
fun fold_term_types :: "(term \<Rightarrow> typ \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> term \<Rightarrow> 'a \<Rightarrow> 'a" where
"fold_term_types f (Ct n T) s = f (Ct n T) T s"
| "fold_term_types f (Fv idn T) s = f (Fv idn T) T s"
| "fold_term_types f (Bv _) s = s"
| "fold_term_types f (Abs T b) s = fold_term_types f b (f (Abs T b) T s)"
| "fold_term_types f (t $ u) s = fold_term_types f u (fold_term_types f t s)"
definition "fold_types f = fold_term_types (\<lambda>x . f)"
(* Patterns for empty list except with Bv missing. Probably need a precond when using *)
fun replace_types :: "term \<Rightarrow> typ list \<Rightarrow> term \<times> typ list" where
"replace_types (Ct c _) (T # Ts) = (Ct c T, Ts)"
| "replace_types (Fv xi _) (T # Ts) = (Fv xi T, Ts)"
| "replace_types (Bv i) Ts = (Bv i, Ts)"
| "replace_types (Abs _ b) (T # Ts) =
(let (b', Ts') = replace_types b Ts
in (Abs T b', Ts'))"
| "replace_types (t $ u) Ts =
(let
(t', Ts') = replace_types t Ts in
(let (u', Ts'') = replace_types u Ts
in (t' $ u', Ts'')))"
(*
collect variables, is the order important? Or should I just return sets?
The set case is basically just (T)fv(T)...
List.insert should keep order, just no duplicates...
*)
definition "add_tvar_namesT' = fold_atyps (\<lambda>x l . case x of Tv xi _ => List.insert xi l | _ => l)"
definition "add_tvar_names' = fold_types add_tvar_namesT'"
definition "add_tvarsT' = fold_atyps (\<lambda>x l . case x of Tv idn s => List.insert (idn,s) l | _ => l)"
definition "add_tvars' = fold_types add_tvarsT'"
definition "add_vars' = fold_aterms (\<lambda>x l . case x of Fv idn s => List.insert (idn,s) l | _ => l)"
definition "add_var_names' = fold_aterms (\<lambda>x l . case x of Fv xi _ => List.insert xi l | _ => l)"
definition "add_const_names' = fold_aterms (\<lambda>x l . case x of Ct c _ => List.insert c l | _ => l)"
definition "add_consts' = fold_aterms (\<lambda>x l . case x of Ct n s => List.insert (n,s) l | _ => l)"
definition "add_tvar_namesT = fold_atyps (\<lambda>x . case x of Tv xi _ => insert xi | _ => id)"
definition "add_tvar_names = fold_types add_tvar_namesT"
definition "add_tvarsT = fold_atyps (\<lambda>x . case x of Tv idn s => insert (idn,s) | _ => id)"
definition "add_tvars = fold_types add_tvarsT"
definition "add_var_names = fold_aterms (\<lambda>x . case x of Fv xi _ => insert xi | _ => id)"
definition "add_vars = fold_aterms (\<lambda>x . case x of Fv idn s => insert (idn,s) | _ => id)"
definition "add_const_names = fold_aterms (\<lambda>x . case x of Ct c _ => insert c | _ => id)"
definition "add_consts = fold_aterms (\<lambda>x . case x of Ct n s => insert (n,s) | _ => id)"
(*which of those do I need ^ *)
(* Show that these behave like (T)fv(T)? *)
lemma add_tvarsT'_tvsT_pre[simp]: "set (add_tvarsT' T acc) = set acc \<union> tvsT T"
unfolding add_tvarsT'_def
proof (induction T arbitrary: acc)
case (Ty n Ts)
then show ?case by (induction Ts arbitrary: acc) auto
qed auto
lemma add_tvars'_tvs_pre[simp]: "set (add_tvars' t acc) = set acc \<union> tvs t"
by (induction t arbitrary: acc) (auto simp add: add_tvars'_def fold_types_def)
lemma "add_tvarsT T acc = acc \<union> tvsT T"
unfolding add_tvarsT_def
proof (induction T arbitrary: acc)
case (Ty n Ts)
then show ?case by (induction Ts arbitrary: acc) auto
qed auto
lemma add_vars'_fv_pre: "set (add_vars' t acc) = set acc \<union> fv t"
unfolding add_vars'_def by (induction t arbitrary: acc) auto
corollary add_vars'_fv: "set (add_vars' t []) = fv t"
using add_vars'_fv_pre by simp
(*extra type variables in a term, not covered by its type*)
(* For some experiments for handling \<And>*)
(* I differ from the ML code here, requiring the correct typ for the \<And>*)
fun strip_all_body :: "term \<Rightarrow> term" where
"strip_all_body (Ct all S $ Abs T t) = (if all= STR ''Pure.all'' \<and> S=(T\<rightarrow>propT)\<rightarrow>propT
then strip_all_body t else (Ct all S $ Abs T t))"
| "strip_all_body t = t"
fun strip_all_vars :: "term \<Rightarrow> typ list" where
"strip_all_vars (Ct all S $ Abs T t) = (if all= STR ''Pure.all'' \<and> S=(T\<rightarrow>propT)\<rightarrow>propT
then T # strip_all_vars t else [])"
| "strip_all_vars t = []"
fun strip_all_single_body :: "term \<Rightarrow> term" where
"strip_all_single_body (Ct all S $ Abs T t) = (if all= STR ''Pure.all'' \<and> S=(T\<rightarrow>propT)\<rightarrow>propT
then t else (Ct all S $ Abs T t))"
| "strip_all_single_body t = t"
fun strip_all_single_var :: "term \<Rightarrow> typ option" where
"strip_all_single_var (Ct all S $ Abs T t) = (if all= STR ''Pure.all'' \<and> S=(T\<rightarrow>propT)\<rightarrow>propT
then Some T else None)"
| "strip_all_single_var t = None"
fun strip_all_multiple_body :: "nat \<Rightarrow> term \<Rightarrow> term" where
"strip_all_multiple_body 0 t = t"
| "strip_all_multiple_body (Suc n) (Ct all S $ Abs T t) = (if all= STR ''Pure.all'' \<and> S=(T\<rightarrow>propT)\<rightarrow>propT
then strip_all_multiple_body n t else (Ct all S $ Abs T t))"
| "strip_all_multiple_body _ t = t"
fun strip_all_multiple_vars :: "nat \<Rightarrow> term \<Rightarrow> typ list" where
"strip_all_multiple_vars 0 _ = []"
| "strip_all_multiple_vars (Suc n) (Ct all S $ Abs T t) = (if all= STR ''Pure.all'' \<and> S=(T\<rightarrow>propT)\<rightarrow>propT
then T # strip_all_multiple_vars n t else [])"
| "strip_all_multiple_vars _ t = []"
lemma strip_all_vars_strip_all_multiple_vars:
"n\<ge>length (strip_all_vars t) \<Longrightarrow> strip_all_multiple_vars n t = strip_all_vars t"
by (induction n t rule: strip_all_multiple_vars.induct) auto
lemma "n\<ge>length (strip_all_vars t) \<Longrightarrow> strip_all_multiple_body n t = strip_all_body t"
by (induction n t rule: strip_all_multiple_vars.induct) (auto elim!: strip_all_vars.elims)
lemma length_strip_all_multiple_vars: "length (strip_all_multiple_vars n t) \<le> n"
by (induction n t rule: strip_all_multiple_vars.induct) auto
lemma prefix_strip_all_multiple_vars: "prefix (strip_all_multiple_vars n t) (strip_all_vars t)"
unfolding prefix_def by (induction n t rule: strip_all_multiple_vars.induct) auto
definition "mk_all_list l t = fold (\<lambda>(n,T) acc . mk_all n T acc) l t"
lemma mk_all_list_empty[simp]: "mk_all_list [] t = t" by (simp add: mk_all_list_def)
(* Again, need correct typ here *)
fun is_all :: "term \<Rightarrow> bool" where
"is_all (Ct all S $ Abs T t) = (all= STR ''Pure.all'' \<and> S=(T\<rightarrow>propT)\<rightarrow>propT)"
| "is_all _ = False"
lemma strip_all_single_var_is_all: "strip_all_single_var t \<noteq> None \<longleftrightarrow> is_all t"
apply (cases t) apply simp_all
subgoal for f u apply (cases f; cases u) by (auto elim: is_all.elims split: if_splits)
done
lemma "is_all t \<Longrightarrow> hd (strip_all_vars t) = the (strip_all_single_var t)"
by (auto elim: is_all.elims)
lemma strip_all_body_single_simp[simp]: "strip_all_body (strip_all_single_body t) = strip_all_body t"
by (induction t rule: strip_all_body.induct) auto
lemma strip_all_body_single_simp'[simp]: "strip_all_single_body (strip_all_body t) = strip_all_body t"
by (induction t rule: strip_all_body.induct) auto
lemma strip_all_vars_step:
"strip_all_single_var t = Some T \<Longrightarrow> T # strip_all_vars (strip_all_single_body t) = strip_all_vars t"
by (induction t arbitrary: T rule: strip_all_vars.induct) (auto split: if_splits)
lemma is_all_iff_strip_all_vars_not_empty: "is_all t \<longleftrightarrow> strip_all_vars t \<noteq> []"
apply (cases t) apply simp_all
subgoal for f u apply (cases f; cases u) by (auto elim: strip_all_vars.elims is_all.elims split: if_splits)
done
lemma strip_all_vars_bind_fv:
"strip_all_vars (bind_fv2 v lev t) = (strip_all_vars t)"
by (induction t arbitrary: lev rule: strip_all_vars.induct) auto
lemma strip_all_vars_mk_all[simp]: "strip_all_vars (mk_all s ty t) = ty # strip_all_vars t"
using bind_fv_def strip_all_vars_bind_fv typ_of_def by auto
lemma strip_all_vars_mk_all_list:
"\<not>is_all t \<Longrightarrow> strip_all_vars (mk_all_list l t) = rev (map snd l)"
proof (induction l rule: rev_induct)
case Nil
then show ?case using is_all_iff_strip_all_vars_not_empty by simp
next
case (snoc v vs)
hence I: "strip_all_vars (mk_all_list vs t) = rev (map snd vs)" by simp
obtain s ty where v: "v = (s,ty)" by fastforce
have "strip_all_vars (mk_all_list (vs @ [v]) t)
= strip_all_vars (mk_all s ty (mk_all_list vs t))"
by (auto simp add: mk_all_list_def v)
also have "\<dots> = ty # strip_all_vars (mk_all_list vs t)"
using strip_all_vars_mk_all[of ty s "mk_all_list vs t"] by blast
also have "\<dots> = ty # rev (map snd vs)"
by (simp add: I)
also have "\<dots> = rev (map snd (vs @ [v]))"
using v by simp
finally show ?case .
qed
(* Move up *)
lemma subst_bv_no_loose_unchanged:
assumes "\<And>x . x \<ge> lev \<Longrightarrow> \<not> loose_bvar1 t x"
assumes "is_variable v"
shows "(subst_bv1 t lev v) = t"
using assms proof (induction t arbitrary: lev)
case (Bv x)
then show ?case
using loose_bvar_iff_exist_loose_bvar1 no_loose_bvar_imp_no_subst_bv1 by presburger
next
case (Abs T t)
then show ?case
using loose_bvar_iff_exist_loose_bvar1 no_loose_bvar_imp_no_subst_bv1 by presburger
qed auto
(* Should state those in terms "of \<in> fv", occs is a relict *)
lemma bind_fv2_no_occs_unchanged:
assumes "\<not> occs (case_prod Fv v) t"
shows "(bind_fv2 v lev t) = t"
using assms by (induction t arbitrary: lev) auto
lemma bind_fv2_subst_bv1_cancel:
assumes "\<And>x . x > lev \<Longrightarrow> \<not> loose_bvar1 t x"
assumes "\<not> occs (case_prod Fv v) t"
shows "bind_fv2 v lev (subst_bv1 t lev (case_prod Fv v)) = t"
using assms proof (induction t arbitrary: lev)
case (Bv x)
then show ?case
using linorder_neqE_nat
by (auto split: prod.splits simp add: is_variable_imp_incr_boundvars_unchganged)
next
case (Abs T t)
hence "bind_fv2 v (lev+1) (subst_bv1 t (lev+1) (case_prod Fv v)) = t"
by (auto elim: Suc_lessE)
then show ?case by simp
next
(* This proof contains so much duplication it makes me vomit...
Got even uglier after translation
*)
case (App t1 t2)
then show ?case
proof(cases "loose_bvar1 t1 lev")
case True
hence I1: "bind_fv2 v lev (subst_bv1 t1 lev (case_prod Fv v)) = t1" using App by auto
then show ?thesis
proof(cases "loose_bvar1 t2 lev")
case True
hence "bind_fv2 v lev (subst_bv1 t2 lev (case_prod Fv v)) = t2" using App by auto
then show ?thesis using I1 App.prems is_variable.elims(2) by auto
next
case False
hence "bind_fv2 v lev (subst_bv1 t2 lev (case_prod Fv v)) = t2"
proof-
have "subst_bv1 t2 lev (case_prod Fv v) = t2" using subst_bv_no_loose_unchanged
using App.prems(1-2) False assms le_neq_implies_less loose_bvar1.simps(2)
by (metis loose_bvar_iff_exist_loose_bvar1 no_loose_bvar_imp_no_subst_bv1)
moreover have "bind_fv2 v lev t2 = t2"
using App.prems(2) bind_fv2_no_occs_unchanged
using App.prems(2) bind_fv2_changed' exists_subterm'.simps(1)
exists_subterm_iff_exists_subterm' by blast
ultimately show ?thesis by simp
qed
then show ?thesis using I1 App.prems is_variable.elims(2) by auto
qed
next
case False
hence I1: "bind_fv2 v lev (subst_bv1 t1 lev (case_prod Fv v)) = t1"
proof-
have "subst_bv1 t1 lev (case_prod Fv v) = t1" using subst_bv_no_loose_unchanged
using App.prems(1-2) False le_neq_implies_less loose_bvar1.simps(2)
by (metis loose_bvar_iff_exist_loose_bvar1 no_loose_bvar_imp_no_subst_bv1)
moreover have "bind_fv2 v lev t1 = t1"
using App.prems(2) bind_fv2_no_occs_unchanged by auto
ultimately show ?thesis by simp
qed
then show ?thesis
proof(cases "loose_bvar1 t2 lev")
case True
hence "bind_fv2 v lev (subst_bv1 t2 lev (case_prod Fv v)) = t2" using App by auto
then show ?thesis using I1 App.prems is_variable.elims(2) by auto
next
case False
hence "bind_fv2 v lev (subst_bv1 t2 lev (case_prod Fv v)) = t2"
proof-
have "subst_bv1 t2 lev (case_prod Fv v) = t2" using subst_bv_no_loose_unchanged
using App.prems(1-2) False assms le_neq_implies_less loose_bvar1.simps(2)
by (metis loose_bvar_iff_exist_loose_bvar1 no_loose_bvar_imp_no_subst_bv1)
moreover have "bind_fv2 v lev t2 = t2"
using App.prems(2) bind_fv2_no_occs_unchanged by auto
ultimately show ?thesis by simp
qed
then show ?thesis using I1 App.prems is_variable.elims(2) by auto
qed
qed
qed auto
lemma bind_fv_subst_bv_cancel:
assumes "\<And>x . x > 0 \<Longrightarrow> \<not> loose_bvar1 t x"
assumes "\<not> occs (case_prod Fv v) t"
shows "bind_fv v (subst_bv (case_prod Fv v) t) = t"
using bind_fv2_subst_bv1_cancel bind_fv_def assms subst_bv_def by auto
lemma not_loose_bvar_imp_not_loose_bvar1_all_greater: "\<not> loose_bvar t lev \<Longrightarrow> x>lev \<Longrightarrow> \<not> loose_bvar1 t x"
by (simp add: loose_bvar_iff_exist_loose_bvar1)
lemma mk_all'_subst_bv_strip_all_single_body_cancel:
assumes "strip_all_single_var t = Some T"
assumes "is_closed t"
assumes "(name, T) \<notin> fv t"
shows "mk_all name T (subst_bv (Fv name T) (strip_all_single_body t) ) = t"
proof-
from assms(1) obtain t' where t': "(Ct STR ''Pure.all'' ((T \<rightarrow> propT) \<rightarrow> propT) $ Abs T t') = t"
by (auto elim!: strip_all_single_var.elims
simp add: bind_eq_Some_conv typ_of_def split: if_splits option.splits if_splits)
hence s: "strip_all_single_body t = t'" by auto
have "\<And>x. x > 0 \<Longrightarrow> \<not> loose_bvar1 t x"
using assms(2) is_open_def loose_bvar_iff_exist_loose_bvar1 by blast
have "0 < x \<Longrightarrow> \<not> loose_bvar1 t' x" for x
using assms(2) by (auto simp add: is_open_def t'[symmetric] loose_bvar_iff_exist_loose_bvar1 gr0_conv_Suc)
have "occs t' t" by (simp add: t'[symmetric])
have "bind_fv (name, T) (subst_bv (Fv name T) (strip_all_single_body t)) =
(strip_all_single_body t)"
using assms(2-3) bind_fv_subst_bv_cancel gr0_conv_Suc
by (force simp add: s is_open_def t'[symmetric]
loose_bvar_iff_exist_loose_bvar1 fv_iff_occs intro!: bind_fv_subst_bv_cancel)
then show ?thesis using assms by (auto simp add: s typ_of_def t')
qed
lemma not_is_all_imp_strip_all_body_unchanged: "\<not> is_all t \<Longrightarrow> strip_all_body t = t"
by (auto elim!: is_all.elims split: if_splits)
lemma no_loose_bvar_imp_no_subst_bvs: "is_closed t \<Longrightarrow> subst_bvs [] t = t"
using no_loose_bvar_imp_no_subst_bvs1 subst_bvs_def is_open_def by simp
lemma "is_closed (Abs T t) \<Longrightarrow> \<not> loose_bvar t 1" unfolding is_open_def by simp
lemma bind_fv2_Fv_fv[simp]: "fv (bind_fv2 (x, \<tau>) lev t) = fv t - {(x,\<tau>)}"
by (induction "(x, \<tau>)" lev t rule: bind_fv2.induct) (auto split: if_splits term.splits)
corollary mk_all_fv_unchanged: "fv (mk_all x \<tau> B) = fv B - {(x,\<tau>)}"
using bind_fv2_Fv_fv bind_fv_def by auto
lemma mk_all_list_fv_unchanged: "fv (mk_all_list l B) = fv B - set l"
proof (induction l arbitrary: B rule: rev_induct)
case Nil
then show ?case by simp
next
(* After translation, look at proof again*)
case (snoc x xs)
have s: "mk_all_list (xs@[x]) B = case_prod mk_all x (mk_all_list xs B)"
by (simp add: mk_all_list_def)
show ?case
by (simp only: s "snoc.IH" mk_all_fv_unchanged split: prod.splits) auto
qed
(* Hs parameter to check if var is fixed by hypotheses *)
abbreviation "forall_intro_vars t Hs \<equiv> mk_all_list
(diff_list (add_vars' t []) (fold (add_vars') Hs [])) t"
end
|
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE BangPatterns #-}
module SDLib where
import qualified SDL
import qualified Graphics.Rendering.OpenGL.GL as GL
import Graphics.Rendering.OpenGL.GL (($=))
import Control.Monad
import qualified Numeric.LinearAlgebra as L
import Numeric.LinearAlgebra.Data (flatten)
import qualified Numeric.LinearAlgebra.Data as LD
import Control.Lens hiding (indices)
import Debug.Trace
import Control.Arrow
import qualified Data.Vector as V
import Data.Vector.Strategies
import Control.Concurrent (forkOS, killThread)
import Control.Concurrent.MVar
import Utils (step, projectionMatrix,normalize,clampSpeed,norm)
import OBJReader
import Data.Shaders (loadShaders)
import Data.Mesh ( loadTexture
, createMesh
, flatQuad
, quaternion)
import Data.GameObject
import Physics.Collision
import Data.Scene
import Data.PhysicsData (acc,speed)
import Data.SkyBox
import Physics.Mechanics
import Tasks.Swarm
import EventHandler
import Utils.Quaternions
frameTime = round $ 1000/60
-- drawThread ::
debugPrint (GL.DebugMessage _ GL.DebugTypeError _ _ err) = putStrLn err
debugPrint _ = return ()
setup = do
SDL.swapInterval $= SDL.SynchronizedUpdates
GL.depthFunc $= Just GL.Less
-- GL.cullFace $= Just GL.Front
-- GL.debugMessageCallback $= Just debugPrint
-- GL.debugOutput $= GL.Enabled
drawThread mv window = forkOS $ do
context <- SDL.glCreateContext window
setup
let uniforms = ["camera","proj","pos","rot","texSampler","normSampler"] :: [String]
shad <- loadShaders "shaders/vert.glsl" "shaders/frag.glsl" uniforms
shadNoTex <- loadShaders "shaders/vert.glsl" "shaders/frag_no_text.glsl" uniforms
ultraMesh <- readOBJ "media/sphere.obj"
ultraVeh <- readOBJ "media/cube.obj"
vehPrim <- readBoxFromObj "media/cube.obj"
let miniVeh = ultraMesh
meh <- createMesh ultraVeh shadNoTex Nothing Nothing
veh <- createMesh ultraMesh shadNoTex Nothing Nothing
-- crvMesh <- createMesh curveVertices shadNoTex Nothing
tex <- loadTexture "media/bricks_dif.png"
normalTex <- loadTexture "media/bricks_norm.png"
sbox <- loadSkyBox
qd <- flatQuad shad tex normalTex
let quads =
V.fromList .
map (\(x,z) -> GameObject qd [x, -2.5, z] Nothing [] (Plane [0,1,0] (-2.5))) $
[(x,z) | x <- [-30,-26..30], z <- [-30,-26..30]]
camPos = [ 0, 10,20]
vehOb pos = initializePhysics (1/10) $
GameObject meh pos Nothing [] vehPrim
sphOb pos = initializePhysics (1/10) .
GameObject veh pos Nothing [] $
Sphere 1 (LD.ident 4)
dim = 1
sep = 3
vehs = -- V.fromList [vehOb [0.5,1,-5]]
-- V.fromList []
-- initializePhysics (1/10) .
-- GameObject veh [0.5,1,-5] Nothing [] $
-- Sphere 1 (LD.ident 4)]
V.fromList [sphOb [0,2,sep*z] | z <- [0..dim]]
mehOb =
-- initializePhysics (1/100) .
-- GameObject veh [0, 0, 10] Nothing [] $
-- Sphere 1 (LD.ident 4)
initializePhysics (1/10) $
GameObject meh [0,0,10] Nothing [] vehPrim
-- curve = GameObject crvMesh [0,0,0] Nothing []
scene = Scene camPos (Objects mehOb vehs quads) (flatten . L.tr $ projectionMatrix) (Just sbox)
putMVar mv scene
drawLoop
where drawLoop = takeMVar mv >>= draw window >> drawLoop
mainLoop :: MVar Scene -> SDL.Window -> Scene -> IO ()
mainLoop mv window scene = do
begTime <- SDL.ticks
events <- SDL.pollEvents
kState <- SDL.getKeyboardState
let qpressed = any handleQuit events
-- newTime = time + (0.1*step)
-- newTime2 = if newTime > 1 then 0 else newTime
handleKeys = foldr ((.).keyHandler) id $ filter kState keys
loc = scene^.objects.player.location
-- updateNPCS = applyLinear
-- . over (physics._Just.speed) (clamp 20)
-- . addGravityForce loc
!newScene = -- set objects.player.location) (countPosition newTime2)
adjustCamera .
over objects resolveObjectCollisions .
traverseObjects (floorReaction . applyForce . friction) .
traverseObjects gravityF $
-- . over (objects.npc) (computeForces updateNPCS)
handleKeys scene
-- print $ newScene^.campos
endTime <- SDL.ticks
when ((endTime - begTime) < frameTime)
$ SDL.delay (frameTime - (endTime - begTime))
print $ endTime - begTime
print $ scene^.objects.player
let cp = prepareCPrim $ scene^.objects.player
p = V.toList $ _cpoints cp
d = [norm (a- b) | a <- p, b <- p]
print $ p
print d
putMVar mv newScene
unless qpressed $ mainLoop mv window newScene
sdlMain :: IO ()
sdlMain = do
SDL.initializeAll
window <- SDL.createWindow "yolo" SDL.defaultWindow {
SDL.windowOpenGL = Just SDL.defaultOpenGL
, SDL.windowInitialSize = SDL.V2 1366 768 }
mv <- newEmptyMVar
dthr <- drawThread mv window
scene <- takeMVar mv
mainLoop mv window scene
killThread dthr
GL.finish
-- SDL.glDeleteContext context
SDL.quit
|
-- By default both sized types and constructor-based guardedness are
-- available.
open import Agda.Builtin.Size
record Stream (A : Set) : Set where
coinductive
field
head : A
tail : Stream A
open Stream
repeat : ∀ {A} → A → Stream A
repeat x .head = x
repeat x .tail = repeat x
record Sized-stream (A : Set) (i : Size) : Set where
coinductive
field
head : A
tail : {j : Size< i} → Sized-stream A j
open Sized-stream
postulate
destroy-guardedness : {A : Set} → A → A
repeat-sized : ∀ {A i} → A → Sized-stream A i
repeat-sized x .head = x
repeat-sized x .tail = destroy-guardedness (repeat-sized x)
|
filename='Bridge_Quadrilateral_Bilinear_Structured';
ptype = 'MACRO';
method = 'SIMP_P3'; % !! Instead of proportional to material density !!
materialType = 'ISOTROPIC';
initial_case = 'holes';
cost = {'compliance'};
weights = [1];
constraint = {'volumeConstraint'};
optimizer = 'HAMILTON-JACOBI'; incrementFactor = 1;
filterType = 'P1';
constraint_case = 'INEQUALITY';
HJiter0 = 1;
e2 = 30;
N_holes = [5 6];
R_holes = 0.7;
phase_holes = [0 pi/2];
nsteps = 1;
Vfrac_final = 0.5;
Perimeter_target=3.5;
optimality_final =1e-3;
constr_final =1e-3;
Vfrac_initial = 1;
optimality_initial = 1e-3;
constr_initial = 1e-3;
TOL.rho_plus = 1;
TOL.rho_minus = 0;
TOL.E_plus = 1;
TOL.E_minus = 1e-3;
TOL.nu_plus = 0.3;
TOL.nu_minus = 0.3;
plotting = 1;
printing = 0;
monitoring = 1;
monitoring_interval = 1;
maxiter = 50;
|
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from keras.optimizers import SGD, Adam, Adamax
from keras import backend as K
from keras.callbacks import ModelCheckpoint
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="0"
from keras.models import Sequential
from keras.layers import TimeDistributed, Conv2D, AveragePooling2D, Flatten, Dropout, Dense, BatchNormalization, CuDNNLSTM
from keras.layers.recurrent import LSTM
from tensorflow.keras.models import Model, load_model
x_dat = np.loadtxt('../COVIDMAPS_more.dat')
y_dat = x_dat[:,625:-2]
x_dat = x_dat[:,:625]
x_dat = x_dat.reshape((10000,30,-1))
x_dat1 = x_dat.reshape((10000,30,25,25,1))
y_dat = y_dat.reshape((10000,30,-1))
y_dat1 = y_dat[:,-1,:]
randomize = np.arange(len(x_dat1))
np.random.shuffle(randomize)
x_dat1 = x_dat1[randomize]
y_dat1 = y_dat1[randomize]
min0 = np.min(y_dat1[:,0])
min1 = np.min(y_dat1[:,1])
min2 = np.min(y_dat1[:,2])
max0 = np.max(y_dat1[:,0])
max1 = np.max(y_dat1[:,1])
max2 = np.max(y_dat1[:,2])
min3 = np.min(y_dat1[:,3])
max3 = np.max(y_dat1[:,3])
min4 = np.min(y_dat1[:,4])
max4 = np.max(y_dat1[:,4])
y_dat1[:,0] = (y_dat1[:,0]-min0)/(max0-min0)
y_dat1[:,1] = (y_dat1[:,1]-min1)/(max1-min1)
y_dat1[:,2] = (y_dat1[:,2]-min2)/(max2-min2)
y_dat1[:,3] = (y_dat1[:,3]-min3)/(max3-min3)
y_dat1[:,4] = (y_dat1[:,4]-min4)/(max4-min4)
print('min0,1,2,3,4,:',min0,min1,min2,min3,min4)
print('max0,1,2,3,4,:',max0,max1,max2,max3,max4)
xtrain=[]
ytrain=[]
lookback = 7
for i in range(800):
xx = x_dat1[i]
yy = y_dat1[i]
for j in range(30-lookback):
xxij = xx[j:j+lookback]
ninitial = np.sum(xx[j+lookback])
xtrain.append(xxij/ninitial)
ytrain.append(yy)
xtest=[]
ytest=[]
for i in range(800,1000):
xx = x_dat1[i]
yy = y_dat1[i]
for j in range(30-lookback):
xxij = xx[j:j+lookback]
ninitial = np.sum(xx[j+lookback])
xtest.append(xxij/ninitial)
ytest.append(yy)
xtrain = np.array(xtrain)
ytrain = np.array(ytrain)
xtest = np.array(xtest)
ytest = np.array(ytest)
def regulize(x_dat, y_dat, shuffle=True):
min0 = np.min(y_dat[:,0])
min1 = np.min(y_dat[:,1])
min2 = np.min(y_dat[:,2])
max0 = np.max(y_dat[:,0])
max1 = np.max(y_dat[:,1])
max2 = np.max(y_dat[:,2])
min3 = np.min(y_dat[:,3])
max3 = np.max(y_dat[:,3])
min4 = np.min(y_dat[:,4])
max4 = np.max(y_dat[:,4])
print('min0,1,2,3,4,:',min0,min1,min2,min3,min4)
print('max0,1,2,3,4,:',max0,max1,max2,max3,max4)
if shuffle == True:
randomize = np.arange(len(x_dat))
np.random.shuffle(randomize)
x_dat = x_dat[randomize]
y_dat = y_dat[randomize]
return x_dat, y_dat
xtrain, ytrain = regulize(xtrain, ytrain)
xtest, ytest = regulize(xtest, ytest)
def r2_keras(y_true, y_pred):
SS_res = K.sum(K.square(y_true - y_pred))
SS_tot = K.sum(K.square(y_true - K.mean(y_true)))
return (1 - SS_res/(SS_tot + K.epsilon()))
epochs = 50
epochs2 = 50
ytrain = ytrain[:,0] #transition rate
ytest = ytest[:,0]
print('x_dat.shape:',np.max(x_dat),np.min(x_dat))
from sklearn.model_selection import train_test_split
model = Sequential()
model.add(
TimeDistributed(
Conv2D(64, (3, 3), activation='relu', padding='same'),
input_shape=(lookback, 25, 25, 1)
)
)
model.add(
TimeDistributed(
Conv2D(64, (3, 3), strides= (2, 2), activation='relu', padding='same'),
)
)
model.add(
TimeDistributed(
Conv2D(64, (3, 3), activation='relu', padding='same'),
)
)
model.add(
TimeDistributed(
Conv2D(64, (3, 3), activation='relu', padding='same'),
)
)
model.add(TimeDistributed(Flatten()))
model.add(CuDNNLSTM(1024, return_sequences=False))
model.add(Dense(256, activation='relu'))
# normalized target in (0,1)
model.add(Dense(1, activation='sigmoid'))
model.summary()
adam = Adam(lr=0.00005)
checkpoint = ModelCheckpoint('params_regression.hdf5',monitor='val_loss',verbose=1, save_best_only=True, mode='auto', period=1)
model.compile(optimizer=adam,loss='mse',metrics=[r2_keras])
hist = model.fit(xtrain, ytrain, validation_data=(xtest, ytest), batch_size=16, epochs=epochs, verbose=1, callbacks=[checkpoint])
#model1 = load_model('transmission_regression.hdf5',custom_objects={'r2_keras': r2_keras})
K.set_value(adam.lr,0.00001)
hist1 = model.fit(xtrain, ytrain, validation_data=(xtest, ytest), batch_size=16, epochs=epochs, verbose=1, callbacks=[checkpoint])
K.set_value(adam.lr,0.000001)
hist2 = model.fit(xtrain, ytrain, validation_data=(xtest, ytest), batch_size=16, epochs=epochs, verbose=1, callbacks=[checkpoint])
score = model.evaluate(xtest, ytest, verbose=0)
print('Test loss:', score[0])
print('Test R2 Correlation:', score[1])
y_pred = model.predict(xtest)
np.savetxt('prediction_test.txt',np.c_[y_pred,ytest])
losst_hist = hist.history['loss']
lossv_hist = hist.history['val_loss']
losst_hist = np.array(losst_hist)
lossv_hist = np.array(lossv_hist)
acct_hist = hist.history['r2_keras']
accv_hist = hist.history['val_r2_keras']
acct_hist = np.array(acct_hist)
accv_hist = np.array(accv_hist)
np.savetxt('learning_curve_stage0.txt',np.c_[losst_hist,lossv_hist,acct_hist,accv_hist])
losst_hist = hist1.history['loss']
lossv_hist = hist1.history['val_loss']
losst_hist = np.array(losst_hist)
lossv_hist = np.array(lossv_hist)
acct_hist = hist1.history['r2_keras']
accv_hist = hist1.history['val_r2_keras']
acct_hist = np.array(acct_hist)
accv_hist = np.array(accv_hist)
np.savetxt('learning_curve_stage1.txt',np.c_[losst_hist,lossv_hist,acct_hist,accv_hist])
losst_hist = hist2.history['loss']
lossv_hist = hist2.history['val_loss']
losst_hist = np.array(losst_hist)
lossv_hist = np.array(lossv_hist)
acct_hist = hist2.history['r2_keras']
accv_hist = hist2.history['val_r2_keras']
acct_hist = np.array(acct_hist)
accv_hist = np.array(accv_hist)
np.savetxt('learning_curve_stage2.txt',np.c_[losst_hist,lossv_hist,acct_hist,accv_hist])
|
import Base:
==,
hash
##### state, action, and observation spaces and related functions #####
struct RockSampleState
index::Int64
end
RockSampleState() = RockSampleState(-1)
struct RockSampleAction
index::Int64
end
RockSampleAction() = RockSampleAction(-1)
struct RockSampleObs
index::Int64
end
RockSampleObs() = RockSampleObs(-1)
## spaces
struct RockSampleStateSpace
min_index::Int64
max_index::Int64
end
struct RockSampleActionSpace
min_index::Int64
max_index::Int64
end
struct RockSampleObsSpace
min_index::Int64
max_index::Int64
end
## space iterator types
struct RockSampleStateIterator
min_index::Int64
max_index::Int64
end
struct RockSampleActionIterator
min_index::Int64
max_index::Int64
end
struct RockSampleObsIterator
min_index::Int64
max_index::Int64
end
# iterator enabling functions
Base.start(::RockSampleStateIterator) = RockSampleState(0)
Base.start(::RockSampleActionIterator) = RockSampleAction(0)
Base.start(::RockSampleObsIterator) = RockSampleObs(0)
Base.next(::RockSampleStateIterator, state::RockSampleState) =
(state, RockSampleState(state.index+1))
Base.next(::RockSampleActionIterator, action::RockSampleAction) =
(action, RockSampleAction(action.index+1))
Base.next(::RockSampleObsIterator, obs::RockSampleObs) =
(obs, RockSampleObs(obs.index+1))
Base.done(iter::RockSampleStateIterator, state::RockSampleState) =
(state.index > iter.max_index)
Base.done(iter::RockSampleActionIterator, action::RockSampleAction) =
(action.index > iter.max_index)
Base.done(iter::RockSampleObsIterator, obs::RockSampleObs) =
(obs.index > iter.max_index)
## iterator creation functions
POMDPs.iterator(space::RockSampleStateSpace) =
RockSampleStateIterator(space.min_index, space.max_index)
POMDPs.iterator(space::RockSampleActionSpace) =
RockSampleActionIterator(space.min_index, space.max_index)
POMDPs.iterator(space::RockSampleObsSpace) =
RockSampleObsIterator(space.min_index, space.max_index)
==(x::RockSampleState, y::RockSampleState) = (x.index == y.index)
==(x::RockSampleAction, y::RockSampleAction) = (x.index == y.index)
==(x::RockSampleObs, y::RockSampleObs) = (x.index == y.index)
Base.hash(x::RockSampleState, h::Int64 = 0) = x.index
Base.hash(x::RockSampleAction, h::Int64 = 0) = x.index
Base.hash(x::RockSampleObs, h::Int64 = 0) = x.index
######## RockSample type definition ########
mutable struct RockSample <: POMDPs.POMDP{RockSampleState, RockSampleAction, RockSampleObs}
#problem parameters
grid_size::Int64
n_rocks::Int64
rand_max::Int64
model_seed ::UInt32 # random seed to construct arbitrary size scenarios
belief_seed::UInt32 # random seed used in initial belief construction,
# if needed
#problem properties
n_cells::Int64
n_actions::Int64
n_states::Int64
n_observations::Int64
robot_start_cell::Int64
half_eff_distance::Int64
discount::Float64
#internal variables and structures
rock_set_start::Int64
rock_at_cell::Array{Int64,1}
cell_to_coords::Array{Vector{Int64},1}
observation_effectiveness::Array{Float64,2}
rocks::Array{Int64,1}
T::Array{RockSampleState,2}
R::Array{DESPOTReward,2}
actions::Array{Int64,1} # needed for large problems
#observation aliases
#TODO: think how to best convert to const (or just wait for struct fields to be implemented...)
BAD_OBS::Int64
GOOD_OBS::Int64
NONE_OBS::Int64
TERMINAL_OBS::Int64
# the const value for 'seed' is meant to provide compatibility with the C++ version of DESPOT
function RockSample(grid_size::Int64 = 4,
n_rocks::Int64 = 4;
rand_max::Int64 = 2^31-1,
belief_seed::UInt32 = convert(UInt32, 479),
model_seed::UInt32 = convert(UInt32, 476),
discount::Float64 = 0.95)
this = new()
# problem parameters
this.grid_size = grid_size
this.n_rocks = n_rocks
this.rand_max = rand_max
this.belief_seed = belief_seed
this.model_seed = model_seed
this.discount = discount
# problem properties
this.n_cells = grid_size*grid_size
this.n_actions = n_rocks + 5
this.n_states = (grid_size*grid_size+1)*(1 << n_rocks)
this.n_observations = 4
this.robot_start_cell = 1
this.half_eff_distance = 20
#internal variables and structures
this.rock_set_start = 0
this.rock_at_cell = Array{Int64}(this.n_cells)
this.cell_to_coords = Array{Vector{Int64}}(this.n_cells)
this.observation_effectiveness = Array{Float64}(this.n_cells, this.n_cells)
this.rocks = Array{Int64}(this.n_rocks) # locations
this.T = Array{RockSampleState}(this.n_states, this.n_actions)
this.R = Array{Float64}(this.n_states, this.n_actions)
this.actions = collect(1:n_rocks + 5) # default ordering
this.BAD_OBS = 0
this.GOOD_OBS = 1
this.NONE_OBS = 2
this.TERMINAL_OBS = 3
init_problem(this)
return this
end
end
POMDPs.state_index(pomdp::RockSample, state::RockSampleState) = state.index
POMDPs.action_index(pomdp::RockSample, action::RockSampleAction) = action.index
POMDPs.obs_index(pomdp::RockSample, obs::RockSampleObs) = obs.index
## distribution types
mutable struct RockSampleTransitionDistribution
pomdp::RockSample
state::RockSampleState
action::RockSampleAction
end
mutable struct RockSampleObsDistribution
pomdp::RockSample
state::RockSampleState
action::RockSampleAction
next_state::RockSampleState
debug::Int64 #TODO: consider removing
#TODO: consider removing, not really needed except for debugging
function RockSampleObsDistribution(pomdp::RockSample,
state::RockSampleState,
action::RockSampleAction,
next_state::RockSampleState,
debug::Int64 = 0)
this = new()
this.pomdp = pomdp
this.state = state
this.action = action
this.next_state = next_state
this.debug = debug
return this
end
end
start_state(pomdp::RockSample) =
RockSampleState(make_state_index(pomdp, pomdp.robot_start_cell, pomdp.rock_set_start))
# Creates a default belief structure to store the problem's initial belief
DESPOT.create_belief(pomdp::RockSample) =
ParticleBelief(Array{Particle{RockSampleState}}(0))
create_transition_distribution(pomdp::RockSample) =
RockSampleTransitionDistribution(pomdp, RockSampleState(-1), RockSampleAction(-1))
create_observation_distribution(pomdp::RockSample) =
RockSampleObsDistribution(pomdp,
RockSampleState(-1),
RockSampleAction(-1),
RockSampleState(-1))
# default initial state distribution represented as a set of generic particles
function POMDPs.initial_state_distribution(pomdp::RockSample)
n_states = 1 << pomdp.n_rocks
pool = Array{POMDPToolbox.Particle{RockSampleState}}(0)
p = 1.0/n_states
for k = 0:n_states-1 #TODO: can make faster, potentially
push!(pool, POMDPToolbox.Particle{RockSampleState}(RockSampleState(make_state_index(pomdp, pomdp.robot_start_cell, k)), p))
end
return POMDPToolbox.ParticleDistribution(pool)
end
## accessor functions
POMDPs.n_states(pomdp::RockSample) = pomdp.n_states
POMDPs.n_actions(pomdp::RockSample) = pomdp.n_actions
POMDPs.n_observations(pomdp::RockSample) = pomdp.n_observations
# 0-based indexing in the following functions
POMDPs.states(pomdp::RockSample) = RockSampleStateSpace(0, pomdp.n_states-1)
POMDPs.actions(pomdp::RockSample) = RockSampleActionSpace(0, pomdp.n_actions-1)
POMDPs.observations(pomdp::RockSample) = RockSampleActionSpace(0, pomdp.n_observations-1)
POMDPs.discount(pomdp::RockSample) = pomdp.discount
## RockSample initialization
function init_4_4(pomdp::RockSample)
pomdp.rocks[1] = cell_num(pomdp,0,2) # rocks is an array
pomdp.rocks[2] = cell_num(pomdp,2,2)
pomdp.rocks[3] = cell_num(pomdp,3,2)
pomdp.rocks[4] = cell_num(pomdp,3,3)
pomdp.robot_start_cell = cell_num(pomdp,2,0)
end
function init_7_8(pomdp::RockSample)
pomdp.rocks[1] = cell_num(pomdp,0,1)
pomdp.rocks[2] = cell_num(pomdp,1,5)
pomdp.rocks[3] = cell_num(pomdp,2,2)
pomdp.rocks[4] = cell_num(pomdp,2,3)
pomdp.rocks[5] = cell_num(pomdp,3,6)
pomdp.rocks[6] = cell_num(pomdp,5,0)
pomdp.rocks[7] = cell_num(pomdp,5,3)
pomdp.rocks[8] = cell_num(pomdp,6,2)
pomdp.robot_start_cell = cell_num(pomdp,3,0)
end
function init_11_11(pomdp::RockSample)
pomdp.rocks[1] = cell_num(pomdp,7,0)
pomdp.rocks[2] = cell_num(pomdp,3,0)
pomdp.rocks[3] = cell_num(pomdp,2,1)
pomdp.rocks[4] = cell_num(pomdp,6,2)
pomdp.rocks[5] = cell_num(pomdp,7,3)
pomdp.rocks[6] = cell_num(pomdp,2,3)
pomdp.rocks[7] = cell_num(pomdp,7,4)
pomdp.rocks[8] = cell_num(pomdp,2,5)
pomdp.rocks[9] = cell_num(pomdp,9,6)
pomdp.rocks[10] = cell_num(pomdp,7,9)
pomdp.rocks[11] = cell_num(pomdp,1,9)
pomdp.robot_start_cell = cell_num(pomdp,5,0)
end
function init_15_15(pomdp::RockSample)
pomdp.rocks[1] = cell_num(pomdp,7,0)
pomdp.rocks[2] = cell_num(pomdp,3,0)
pomdp.rocks[3] = cell_num(pomdp,2,1)
pomdp.rocks[4] = cell_num(pomdp,6,2)
pomdp.rocks[5] = cell_num(pomdp,7,3)
pomdp.rocks[6] = cell_num(pomdp,2,3)
pomdp.rocks[7] = cell_num(pomdp,7,4)
pomdp.rocks[8] = cell_num(pomdp,2,5)
pomdp.rocks[9] = cell_num(pomdp,9,6)
pomdp.rocks[10] = cell_num(pomdp,7,9)
pomdp.rocks[11] = cell_num(pomdp,1,9)
pomdp.rocks[12] = cell_num(pomdp,8,11)
pomdp.rocks[13] = cell_num(pomdp,10,13)
pomdp.rocks[14] = cell_num(pomdp,9,14)
pomdp.rocks[15] = cell_num(pomdp,2,12)
pomdp.robot_start_cell = cell_num(pomdp,5,0)
end
function init_general(pomdp::RockSample, seed::Array{UInt32,1})
rockIndex::Int64 = 1 # rocks is an array
if !is_linux()
srand(seed[1])
end
while rockIndex <= pomdp.n_rocks
if is_linux()
cell = ccall((:rand_r, "libc"), Int, (Ptr{Cuint},), seed) % pomdp.n_cells
else
cell = Base.rand(0:pomdp.rand_max) % pomdp.n_cells
end
if findfirst(pomdp.rocks, cell) == 0
pomdp.rocks[rockIndex] = cell
rockIndex += 1
end
end
pomdp.robot_start_cell = cell_num(pomdp, round(Integer, pomdp.grid_size/2), 0)
end
function init_problem(pomdp::RockSample)
pomdp.rocks = Array{Int64}(pomdp.n_rocks)
seed = Cuint[convert(UInt32, pomdp.model_seed)]
if pomdp.grid_size == 4 && pomdp.n_rocks == 4
init_4_4(pomdp)
elseif pomdp.grid_size == 7 && pomdp.n_rocks == 8
init_7_8(pomdp)
elseif pomdp.grid_size == 11 && pomdp.n_rocks == 11
init_11_11(pomdp)
elseif pomdp.grid_size == 15 && pomdp.n_rocks == 15
init_15_15(pomdp)
else
init_general(pomdp, seed)
end
# Compute rock set start
pomdp.rock_set_start = 0
if !is_linux()
srand(seed[1])
end
for i in 0 : pomdp.n_rocks-1
if is_linux()
rand_num = ccall((:rand_r, "libc"), Int, (Ptr{Cuint},), seed)
else #Windows, etc
rand_num = Base.rand(0:pomdp.rand_max)
end
if (rand_num & 1) == 1
pomdp.rock_set_start |= (1 << i)
end
end
# Fill in cellToCoord and init rock_at_cell mappings
fill!(pomdp.rock_at_cell, -1)
for i in 0 : pomdp.n_cells-1
pomdp.cell_to_coords[i+1] = [trunc(Integer, i/pomdp.grid_size), i % pomdp.grid_size]
end
for i in 0 : pomdp.n_rocks-1
pomdp.rock_at_cell[pomdp.rocks[i+1]+1] = i # rock_at_cell and rocks are arrays
end
# T and R - ALL INDICES BELOW ARE OFFSET BY +1 (for 1-based array indexing)
for cell in 0 : pomdp.n_cells-1
for rock_set = 0:(1 << pomdp.n_rocks)-1
s_index = make_state_index(pomdp, cell, rock_set)
#initialize transition and rewards with default values
for a_index in 0:pomdp.n_actions-1
pomdp.T[s_index+1,a_index+1] =
RockSampleState(s_index)
pomdp.R[s_index+1,a_index+1] = 0.
end
row, col = pomdp.cell_to_coords[cell+1]
# North
if row == 0
pomdp.T[s_index+1,1] =
RockSampleState(s_index)
pomdp.R[s_index+1,1] = -100.
else
pomdp.T[s_index+1,1] =
RockSampleState(make_state_index(pomdp, cell_num(pomdp,row-1,col), rock_set))
pomdp.R[s_index+1,1] = 0
end
# South
if row == pomdp.grid_size-1
pomdp.T[s_index+1,2] =
RockSampleState(s_index)
pomdp.R[s_index+1,2] = -100.
else
pomdp.T[s_index+1,2] =
RockSampleState(make_state_index(pomdp, cell_num(pomdp,row+1,col), rock_set))
pomdp.R[s_index+1,2] = 0.
end
# East
if col == pomdp.grid_size-1
pomdp.T[s_index+1,3] =
RockSampleState(make_state_index(pomdp, pomdp.n_cells, rock_set))
pomdp.R[s_index+1,3] = 10.
else
pomdp.T[s_index+1,3] =
RockSampleState(make_state_index(pomdp, cell_num(pomdp,row,col+1), rock_set))
pomdp.R[s_index+1,3] = 0.
end
# West
if col == 0
pomdp.T[s_index+1, 4] = RockSampleState(s_index)
pomdp.R[s_index+1, 4] = -100.
else
pomdp.T[s_index+1, 4] =
RockSampleState(make_state_index(pomdp, cell_num(pomdp,row,col-1), rock_set))
pomdp.R[s_index+1, 4] = 0.
end
# Sample
rock = pomdp.rock_at_cell[cell+1] # array
if rock != -1
if rock_status(rock, rock_set)
pomdp.T[s_index+1, 5] =
RockSampleState(make_state_index(pomdp, cell, sample_rock_set(rock, rock_set)))
pomdp.R[s_index+1, 5] = +10.
else
pomdp.T[s_index+1, 5] = RockSampleState(s_index)
pomdp.R[s_index+1, 5] = -10.
end
else
pomdp.T[s_index+1, 5] = RockSampleState(s_index)
pomdp.R[s_index+1, 5] = -100.
end
# Check
for a_index in 5:pomdp.n_actions-1
pomdp.T[s_index+1, a_index+1] = RockSampleState(s_index)
pomdp.R[s_index+1, a_index+1] = 0.
end
end
end
# Terminal states
for k = 0:(1 << pomdp.n_rocks)-1
s_index = make_state_index(pomdp, pomdp.n_cells, k);
for a_index in 0:pomdp.n_actions-1
pomdp.T[s_index+1, a_index+1] = RockSampleState(s_index)
pomdp.R[s_index+1, a_index+1] = 0.
end
end
# precompute observation effectiveness table
for i in 0 : pomdp.n_cells-1
for j in 0 : pomdp.n_cells-1
agent = pomdp.cell_to_coords[i+1]
other = pomdp.cell_to_coords[j+1]
dist = sqrt((agent[1] - other[1])^2 + (agent[2]-other[2])^2)
pomdp.observation_effectiveness[i+1,j+1] =
(1 + 2^(-dist / pomdp.half_eff_distance)) * 0.5 # Array indexing starts from 1.
# Remember to subtract one to go back
end
end
end
## utility functions
# True for good rock, false for bad rock, x can be a rock set or state index
rock_status(rock::Int64, x::Int64) = (((x >>> rock) & 1) == 1 ? true : false)
cell_num(pomdp::RockSample, row::Int64, col::Int64) = row * pomdp.grid_size + col
make_state_index(pomdp::RockSample, cell::Int64, rock_set::Int64) =
convert(Int64, (cell << pomdp.n_rocks) + rock_set)
POMDPs.reward(pomdp::RockSample, s::RockSampleState, a::RockSampleAction) =
pomdp.R[s.index+1, a.index+1]
function POMDPs.transition(
pomdp::RockSample,
state::RockSampleState,
action::RockSampleAction)
distribution = create_transition_distribution(pomdp)
distribution.pomdp = pomdp
distribution.state = state
distribution.action = action
return distribution
end
function POMDPs.observation(
pomdp::RockSample,
state::RockSampleState,
action::RockSampleAction,
next_state::RockSampleState)
distribution = create_observation_distribution(pomdp)
distribution.pomdp = pomdp
distribution.state = next_state
distribution.action = action
distribution.next_state = next_state
return distribution
end
function POMDPs.rand(
rng::AbstractRNG,
distribution::RockSampleTransitionDistribution,
sample=nothing)
return RockSampleState(
distribution.pomdp.T[distribution.state.index+1, distribution.action.index+1].index)
end
function POMDPs.rand(
rng::AbstractRNG,
distribution::RockSampleObsDistribution,
sample=nothing)
# generate a new random number regardless of whether it's used below or not
rand_num::Array{Float64} = Array{Float64}(1)
rand!(rng, rand_num)
if (distribution.action.index < 5)
obs = isterminal(distribution.pomdp, distribution.next_state) ?
RockSampleObs(distribution.pomdp.TERMINAL_OBS) :
RockSampleObs(distribution.pomdp.NONE_OBS) # rs.T is an array
else
rock_cell = distribution.pomdp.rocks[distribution.action.index - 4] # would be [action-5] with 0-based indexing
agent_cell = cell_of(distribution.pomdp, distribution.state)
eff = distribution.pomdp.observation_effectiveness[agent_cell+1, rock_cell+1]
if (rand_num[1] <= eff) == rock_status(distribution.action.index - 5, distribution.state.index)
obs = RockSampleObs(distribution.pomdp.GOOD_OBS)
else
obs = RockSampleObs(distribution.pomdp.BAD_OBS)
end
end
return obs
end
function POMDPs.rand(
rng::AbstractRNG,
state_space::RockSampleStateSpace,
sample=nothing)
if is_linux()
random_number = ccall((:rand_r, "libc"), Int, (Ptr{Cuint},), rng.seed) / rng.rand_max
else #Windows, etc
srand(seed)
random_number = Base.rand()
end
return RockSampleState(floor(
random_number*(state_space.max_index-state_space.min_index)))
end
function POMDPs.pdf(distribution::RockSampleObsDistribution,
obs::RockSampleObs)
# Terminal state should match terminal obs
if isterminal(distribution.pomdp, distribution.next_state)
if obs.index == distribution.pomdp.TERMINAL_OBS
return 1.
else
return 0.
end
end
if (distribution.action.index < 5)
if obs.index == distribution.pomdp.NONE_OBS
return 1.
else
return 0.
end
end
if ((obs.index != distribution.pomdp.GOOD_OBS) && (obs.index != distribution.pomdp.BAD_OBS))
return 0.
end
rock::Int64 = distribution.action.index - 5
rockCell::Int64 = distribution.pomdp.rocks[rock+1]
agentCell::Int64 = cell_of(distribution.pomdp, distribution.next_state)
eff::Float64 = distribution.pomdp.observation_effectiveness[agentCell+1, rockCell+1]
rstatus::Bool = rock_status(rock, distribution.next_state.index)
if ((obs.index == distribution.pomdp.GOOD_OBS) && (rstatus == true)) ||
((obs.index == distribution.pomdp.BAD_OBS) && (rstatus == false))
return eff
else
return 1. - eff
end
end
POMDPs.isterminal(pomdp::RockSample, s::RockSampleState) =
cell_of(pomdp, s) == pomdp.n_cells
POMDPs.isterminal_obs(pomdp::RockSample, obs::RockSampleObs) =
obs.index == pomdp.TERMINAL_OBS
# Which cell the agent is in
cell_of(pomdp::RockSample, s::RockSampleState) = (s.index >>> pomdp.n_rocks)
# The rock set after sampling a rock from it
sample_rock_set(rock::Int64, rock_set::Int64) = (rock_set & ~(1 << rock))
# The set of rocks in the state
rock_set_of(pomdp::RockSample, s::RockSampleState) =
s.index & ((1 << pomdp.n_rocks)-1)
function show_state(pomdp::RockSample, s::RockSampleState)
ac = cell_of(pomdp, s)
for i in 0:pomdp.grid_size-1
for j in 0:pomdp.grid_size-1
if ac == cell_num(pomdp,i,j)
if pomdp.rock_at_cell[ac+1] == -1 # array
print("R ")
elseif rock_status(pomdp.rock_at_cell[ac+1], rock_set_of(pomdp,s))
print("G ")
else
print("B ")
end # if rock_at_cell[ac] == -1
continue
end # if ac == cell_num(i, j)
if pomdp.rock_at_cell[cell_num(pomdp,i,j)+1] == -1
print(". ")
elseif (rock_status(pomdp.rock_at_cell[cell_num(pomdp,i,j)+1], rock_set_of(pomdp,s)))
print("1 ")
else
print("0 ")
end # if rock_at_cell[cell_num(i,j)] == -1
end # for j in 1:grid_size
println("")
end # i in 1:grid_size
end
function show_obs(pomdp::RockSample, obs::RockSampleObs)
if obs.index == pomdp.NONE_OBS
println("NONE")
elseif obs.index == pomdp.GOOD_OBS
println("GOOD")
elseif obs.index == pomdp.BAD_OBS
println("BAD")
elseif obs.index == pomdp.TERMINAL_OBS
println("TERMINAL")
else
println("UNKNOWN")
end
end
|
import ..lectures.love05_inductive_predicates_demo
/-! # LoVe Exercise 5: Inductive Predicates -/
set_option pp.beta true
set_option pp.generalized_field_notation false
namespace LoVe
/-! ## Question 1: Even and Odd
The `even` predicate is true for even numbers and false for odd numbers. -/
#check even
/-! We define `odd` as the negation of `even`: -/
def odd (n : ℕ) : Prop :=
¬ even n
/-! 1.1. Prove that 1 is odd and register this fact as a simp rule.
Hint: `cases'` is useful to reason about hypotheses of the form `even …`. -/
@[simp] lemma odd_1 :
odd 1 :=
sorry
/-! 1.2. Prove that 3 and 5 are odd. -/
-- enter your answer here
/-! 1.3. Complete the following proof by structural induction. -/
lemma even_two_times :
∀m : ℕ, even (2 * m)
| 0 := even.zero
| (m + 1) :=
sorry
/-! 1.4. Complete the following proof by rule induction.
Hint: You can use the `cases'` tactic (or `match … with`) to destruct an
existential quantifier and extract the witness. -/
lemma even_imp_exists_two_times :
∀n : ℕ, even n → ∃m, n = 2 * m :=
begin
intros n hen,
induction' hen,
case zero {
apply exists.intro 0,
refl },
case add_two : k hek ih {
sorry }
end
/-! 1.5. Using `even_two_times` and `even_imp_exists_two_times`, prove the
following equivalence. -/
lemma even_iff_exists_two_times (n : ℕ) :
even n ↔ ∃m, n = 2 * m :=
sorry
/-! 1.6 (**optional**). Give a structurally recursive definition of `even` and
test it with `#eval`.
Hint: The negation operator on `bool` is called `not`. -/
def even_rec : nat → bool :=
sorry
/-! ## Question 2: Tennis Games
Recall the inductive type of tennis scores from the demo: -/
#check score
/-! 2.1. Define an inductive predicate that returns true if the server is ahead
of the receiver and that returns false otherwise. -/
inductive srv_ahead : score → Prop
-- enter the missing cases here
/-! 2.2. Validate your predicate definition by proving the following lemmas. -/
lemma srv_ahead_vs {m n : ℕ} (hgt : m > n) :
srv_ahead (score.vs m n) :=
sorry
lemma srv_ahead_adv_srv :
srv_ahead score.adv_srv :=
sorry
lemma not_srv_ahead_adv_rcv :
¬ srv_ahead score.adv_rcv :=
sorry
lemma srv_ahead_game_srv :
srv_ahead score.game_srv :=
sorry
lemma not_srv_ahead_game_rcv :
¬ srv_ahead score.game_rcv :=
sorry
/-! 2.3. Compare the above lemma statements with your definition. What do you
observe? -/
-- enter your answer here
/-! ## Question 3: Binary Trees
3.1. Prove the converse of `is_full_mirror`. You may exploit already proved
lemmas (e.g., `is_full_mirror`, `mirror_mirror`). -/
#check is_full_mirror
#check mirror_mirror
lemma mirror_is_full {α : Type} :
∀t : btree α, is_full (mirror t) → is_full t :=
sorry
/-! 3.2. Define a `map` function on binary trees, similar to `list.map`. -/
def map_btree {α β : Type} (f : α → β) : btree α → btree β
| _ := sorry -- remove this dummy case and enter the missing cases
/-! 3.3. Prove the following lemma by case distinction. -/
lemma map_btree_eq_empty_iff {α β : Type} (f : α → β) :
∀t : btree α, map_btree f t = btree.empty ↔ t = btree.empty :=
sorry
/-! 3.4 (**optional**). Prove the following lemma by rule induction. -/
lemma map_btree_mirror {α β : Type} (f : α → β) :
∀t : btree α, is_full t → is_full (map_btree f t) :=
sorry
end LoVe
|
```python
import sympy as sym #simbolica
import matplotlib.pyplot as plt #importa matplotlib solo pyplot
import matplotlib.image as mpimg
from IPython.display import Image #para importar y mostrar en jupyter imagenes
sym.init_printing() #activa a jupyter para mostrar simbolicamente el output
#%matplotlib widget
%matplotlib inline
```
```python
# Puente completo celda de carga es como se observa en la imagen.
Image(filename='straingauge.png',width=300)
```
```python
Image(filename='esq_sg.png',width=250) #Circuito esquematico cambiando el enfoque
```
```python
#Se busca el equivalente theveniN
#Se van a plantear ecuaciones nodales
#Vth es el voltaje en Vo cuando Io=0 => CA
sym.var('R1, R2, R3, R4, Io, Vo, Vth')
sym.var('Va, Vb, Vp')
find=sym.Matrix(([Vo], [Va], [Vb])) #son las incognitas
ec_p_0=sym.Eq((Va-Vo)/R1+(Vb-Vo)/R2,0) # Nodo Vo ; Io=0
ec_p_1=sym.Eq((Va-Vb),Vp) #SuperNodo
ec_p_2=sym.Eq((Va/R3)+Vb/R4,0) # Tierra Io=0
display(sym.Eq(Vth,sym.factor(sym.simplify(sym.solve([ec_p_0,ec_p_1,ec_p_2],find)[Vo]))))
Vth=sym.solve([ec_p_0,ec_p_1,ec_p_2],find)[Vo]
```
```python
#Circuito para encontrar eq. Norton Io=-In Vo=0 -> CC
Image(filename='esq_sg2.png',width=250)
```
```python
#Se busca el equivalente Norton y se usa LKV
sym.var('I1,I2,In')
ec_p_3=sym.Eq(I1*R3+Vp+(I1-In)*R4,0)
ec_p_4=sym.Eq(I2*R1+(I2-In)*R2,Vp)
ec_p_5=sym.Eq((In-I1)*R4+(In-I2)*R2,0)
display(sym.Eq(In,sym.simplify(sym.factor(sym.solve([ec_p_3,ec_p_4,ec_p_5],(In,I1,I2))[In]))))
In=sym.solve([ec_p_3,ec_p_4,ec_p_5],(In,I1,I2))[In]
```
```python
#Por lo tanto La resistencia de Thevenin
sym.var('Rth')
display(sym.Eq(Rth,sym.simplify(sym.factor(Vth/In))))
Rth=sym.simplify(Vth/In)
```
```python
#Calculo de forma directa
Image(filename='esq_sg.png',width=250) #Circuito esquematico cambiando el enfoque
```
```python
#De forma directa Vth es VR2+VR4
# Vth= Vp/(R1+R2) * R2 - Vp/(R3+R4) * R4
# Rth cuando Vp=0 es Rth=R1//R2 + R3//R4
sym.var('Vth_, Rth_')
display(sym.Eq(Vth_,sym.simplify(sym.factor(Vp*(R2/(R1+R2)-R4/(R3+R4))))))
Vth_=sym.fu((Vp/(R1+R2))*R2-(Vp/(R3+R4))*R4)
display(sym.Eq(Rth_,(R1**-1+R2**-1)**-1+(R3**-1+R4**-1)**-1))
display(sym.Eq(Rth_,sym.simplify(sym.factor((R1**-1+R2**-1)**-1+(R3**-1+R4**-1)**-1))))
Rth_=sym.factor(((R1**-1+R2**-1)**-1)+(R3**-1+R4**-1)**-1)
```
|
# HalidePerovskites
# Uses the newly forked off FeynmanKadanoffOsakaHellwarth.jl package
# Codes by Jarvist Moore Frost, 2017
# These codes were developed with Julia 0.5.0, and requires the Optim and Plots packages.
# This file, when run under Julia, should regenerate all data (and plots) associated with Arxiv paper:
# https://arxiv.org/abs/1704.05404
# Polaron mobility in halide perovskites
# Jarvist Moore Frost
# (Submitted on 18 Apr 2017 [v1])
push!(LOAD_PATH,"../src/") # load module from local directory
using PolaronMobility
##### load in library routines... #####
# Plot figures with Plots, which defaults to Pyplot backend
using Plots
#pyplot()
gr()
#default(grid=false) # No silly dotted grid lines
#default(size=(400,300)) # A good small size for two-column EPS output
#gr()
#default(size=(800,600)) # Nice size for small-ish PNGs for slides
# Physical constants
const hbar = const ħ = 1.05457162825e-34; # kg m2 / s
const eV = const q = const ElectronVolt = 1.602176487e-19; # kg m2 / s2
const me=MassElectron = 9.10938188e-31; # kg
const Boltzmann = const kB = 1.3806504e-23; # kg m2 / K s2
const ε_0 = 8.854E-12 #Units: C2N−1m−2, permittivity of free space
#####
# Call simulation
# CsSnX3 X={Cl,Br,I}
# L. Huang, W.Lambrecht - PRB 88, 165203 (2013)
# Dielectric consts, from TABLE VII
# Effective masses from TABLE VI, mh*
const cm1=2.997e10 # cm-1 to Herz
#Ts,Kμs, Hμs, FHIPμs, ks, Ms, As, Bs, Cs, Fs, Taus
#effectivemass=0.12 # the bare-electron band effective-mass.
# --> 0.12 for electrons and 0.15 for holes, in MAPI. See 2014 PRB.
# MAPI 4.5, 24.1, 2.25THz - 75 cm^-1 ; α=
println("OK, solving Polaron problem...")
MAPIe = polaronmobility("MAPI-electron", [150,300], 4.5, 24.1, 2.25E12, 0.12; verbose=true, figures=false)
MAPIh = polaronmobility("MAPI-hole", [150,300], 4.5, 24.1, 2.25E12, 0.15; verbose=true, figures=false)
MAPIe = polaronmobility("MAPI-electron", [150,300], 4.5, 24.1, 1.25E12, 0.12; verbose=true, figures=false)
s=ImX(0.1:0.1:6,MAPIe.v[2],MAPIe.w[2],MAPIe.βred[2], MAPIe.α[1],MAPIe.ω[1],MAPIe.mb[1])
plot( s.nu,s.ImX,label="ImX",
markersize=3,marker=:downtriangle, xlab="nu (units Omega)",ylab="ImX")
savefig("MAPIe-ImX.png")
plot( s.nu,s.μ,label="mu",
markersize=3,marker=:uptriangle, xlab="nu (units Omega)",ylab="Mob")
savefig("MAPIe-mu.png")
println("That's me!")
|
If you are looking for Web-Ready Widgets for your website please visit Widgets For Your Site.
theFinancials.com offers Custom Data Feeds that provide access to thousands of financial instruments in our Symbol Catalog. Our data services make it easy to integrate financial information into your website or to automate back-office systems maintenance.
All Custom Data Feeds are built on a client-by-client basis to make integration seamless. Clients pick the symbols, update frequency (from once-per-day to every 15 minutes), delivery format and even the specific markup in their feed.
theFinancials.com retains decades of data for many symbols. Historical data can be accessed as a one-time download or as part of a regular data feed update.
|
\documentclass{article}
\usepackage{algpseudocode}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{enumitem}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{mathtools}
\usepackage{microtype}
\usepackage{sectsty}
\usepackage[table,xcdraw]{xcolor}
\allsectionsfont{\sffamily}
\captionsetup{font=small,labelfont={bf,sf},margin=1.5em}
\title{Balanced Binary Search Trees}
\author{Florian Kretlow}
\begin{document}
\section{Red-Black-Tree}
\subsection{Introduction and general properties}
A red-black-tree is a self-balancing binary search tree. In addition to the invariants
of the latter, the former garantees that the tree remains roughly balanced even when it
receives input sequences that constitute pathological cases for normal binary search
trees (sorted input).
Every node in a red-black-tree is assigned one of two colors (traditionally red and
black). The following invariants hold after each insertion into, or deletion from a
red-black-tree.
\begin{enumerate}[label=(\arabic*)]
\item The root node of the tree is black. Every other node is either red or black.
\item If a node is red, it doesn't have a red child.
\item All paths from the root to a leaf go through the same number of black nodes.
\end{enumerate}
If \(b\) is the number of black nodes on every path from the root to a leaf, then the
shortest possible path from the root to a leaf (which contains no red nodes) has a
length of \(b\), and the longest possible path (where black and red nodes alternate) has
a length of \(2b\). Thus the invariants ensure that the lengths of any two paths from
the root to a leaf (i.e. the depths of any two leaf nodes) differ by at most a factor of
2.
\[
\forall \text{ leaf nodes } l_{i}, l_{j} \in T : \text{depth}(l_i) \leq 2 \cdot
\text{depth}(l_j)
\]
The balance is weaker than in an AVL tree (where the difference between the heights of
the left and right sub-trees of any sub-tree is at most 1). Consequently, operations on
a red-black-tree require fewer tree rotations, so they’re faster. Both red-black-trees
and AVL trees get, insert, and delete elements in logarithmic time (\(\Theta(\log n)\)).
\subsection{Groups of Nodes}
Let a \emph{group} of nodes in a red-black-tree denote \emph{any black node together
with all its direct red child nodes.} Every node in a red-black-tree belongs to exactly
one group: Every black node is the ‘head’ of its own group. Every red node belongs
to the group of its black parent. Using the fact that every group contains exactly one
black node, we can rephrase invariant 3 as follows:
\begin{enumerate}[label=(\arabic*)]
\setcounter{enumi}{2}
\item All paths from the root to a leaf go through the same number of groups.
\end{enumerate}
The \emph{weight} of a group \(g\) is the number of nodes it contains, obviously \(1
\leq \text{weight}(g) \leq 3\). If \(\text{weight}(g) = 1\), \(g\) is said to be
\emph{empty:} it doesn't contain any red child nodes. If \(\text{weight}(g) = 3\),
\(g\) is said to be \emph{full:} it contains two red child nodes and it's not possible
to add another node to the group. If \(\text{weight}(g) = 2\), it's possible to rotate
\(g\) in such a way that the former red child becomes the black root of the group, and
the former black root becomes a red child on the opposite site; this rotation does not
affect any other group than \(g\).
\begin{figure}
\begin{centering}
\includegraphics[scale=2]{img/groups.pdf}
\caption{Possible groups in a red-black-tree. The direct ancestor of the head of a
group can be both red and black. Every direct descendant below a group is black.}
\end{centering}
\end{figure}
\subsection{Insertion}
Insertion into a normal binary search tree is straightforward. You start at the root,
and then you always go left if the new value is less than the current value, or you go
right if it is greater. When you've nowhere left to go (i.e. you'd need to go left but
there's no left child, or the other way around) you simply add the value at that
position.
In order to preserve the invariants, inserting a node into a red-black-tree must not add
a new group to the tree (except at the very root where the addition affects all paths
equally). Therefore insertion is not possible if the direct parent of the to-be-added
node is part of a full group. The solution is to reduce the weight of that group: If \(
\text{weight}(g) \leq 2\), it is possible to add a node to \(g\).
\begin{small}
\begin{verbatim}
procedure decrease-weight(n):
p := parent of n
pp := grandparent of n
l, r := children of n
// assume that n is black and l, r are red
case 1: n is the root of the tree
recolor:
l, r: black
case 2: p is black
recolor:
n: red
l, r: black
case 3: p is red
case 3.1: pp has 1 red child (p)
case 3.1a: pp->p->n is right-right or left-left
right-right: rotate-left(pp)
left-left: rotate-right(pp)
recolor:
pp: red
p: black
n: red
l, r: black
case 3.1b: pp->p->n is right-left or left-right
right-left:
rotate-right(p)
rotate-left(pp)
left-right:
rotate-left(p)
rotate-right(pp)
recolor:
pp: red
l, r: black
case 3.2: pp has 2 red children
decrease-weight(pp)
decrease-weight(n) // try again
procedure insert(n, v):
p := parent of n
if v == n.value:
return
else if v < n.value and n has a left child:
insert(n.left, v)
return
else if v > n.value and n has a right child:
insert(n.right, v)
return
case 1: n is black
if v < n.value:
n.left = new node(v, red)
n.left.parent = n
else:
n.right = new node(v, red)
n.right.parent = n
case 2: n is red
case 2.1: weight(p) = 2
decrease-weight(p)
// now n can be anywhere, go again:
insert(n, v)
case 2.2: weight(p) = 1
case 2.2.1: v < n.value and n = p.left
rotate-right(p)
n.left = new node(v, red)
case 2.2.2: v > n.value and n = p.right
rotate-left(p)
n.right = new node(v, red)
case 2.2.3: v < n.value and n = p.right
p.left = new node(v, red)
swap(p, p.left)
case 2.2.4: v > n.value and n = p.left
p.right = new node(v, red)
swap(p, p.right)
\end{verbatim}
\end{small}
\subsection{Deletion}
Deletion is only possible if the group we delete from is not empty. Likewise, deleting a
node from the tree must not remove a group entirely (again, except at the root).
\begin{small}
\begin{verbatim}
procedure increase-weight(n):
p := parent of n
s := sibling of n
// case 1: ancestor group is not empty
if p is red or weight(p) >= 2:
if p is black:
if n == p.right:
rotate-right(p); s = p.left
else:
rotate-left(p); s = p.right
// case 1.1: s is empty
if weight(s) == 1:
recolor:
p: black
n, s: red
// case 1.2: s is not empty
else:
// make sure s has an outer child
if s == p.left and s.left is black:
rotate-left(s); s = p.left
else if s == p.right and s.right is black:
rotate-right(s); s = p.right
if n == p.right:
rotate-right(p)
else:
rotate-left(p)
recolor:
p: black
n, s: red
outer child of s: black
// case 2: ancestor group is empty
else:
// case 2.1: s is empty
if weight(s) == 1:
if p is root:
recolor:
n, s: red
else:
increase-weight(p)
increase-weight(n)
// case 2.2: s is not empty
else:
// make sure s has an outer child
if s == p.left and s.left is black:
rotate-left(s); s = p.left
else if s == p.right and s.right is black:
rotate-right(s); s = p.right
if n == p.right:
rotate-right(p)
else:
rotate-left(p)
recolor:
n: red
outer child of s: black
procedure delete(n, v):
while v != n.value:
if v < n.value:
n = n.left
else if v > n.value:
n = n.right
if n == nil: return // not found
if n is not in a leaf position:
successor := n.right
while successor has a left child:
successor = successor.left
swap(n, successor)
// now n is where successor was, in a leaf position
if n is black and not the root and weight(n) == 1:
increase-weight(n)
if n is black:
if n has a left child:
rotate-right(n)
else:
rotate-left(n)
remove n from the tree
\end{verbatim}
\end{small}
\end{document}
|
function X_rec = recoverData(Z, U, K)
%RECOVERDATA Recovers an approximation of the original data when using the
%projected data
% X_rec = RECOVERDATA(Z, U, K) recovers an approximation the
% original data that has been reduced to K dimensions. It returns the
% approximate reconstruction in X_rec.
%
% You need to return the following variables correctly.
X_rec = zeros(size(Z, 1), size(U, 1));
% ====================== YOUR CODE HERE ======================
% Instructions: Compute the approximation of the data by projecting back
% onto the original space using the top K eigenvectors in U.
%
% For the i-th example Z(i,:), the (approximate)
% recovered data for dimension j is given as follows:
% v = Z(i, :)';
% recovered_j = v' * U(j, 1:K)';
%
% Notice that U(j, 1:K) is a row vector.
%
% =============================================================
end
|
import Fragment.Algebra.Algebra
import Fragment.Algebra.Free
import Fragment.Algebra.Free.Atoms
import Fragment.Algebra.Free.Base
import Fragment.Algebra.Free.Evaluation
import Fragment.Algebra.Free.Monad
import Fragment.Algebra.Free.Properties
import Fragment.Algebra.Free.Syntax
import Fragment.Algebra.Homomorphism
import Fragment.Algebra.Homomorphism.Base
import Fragment.Algebra.Homomorphism.Definitions
import Fragment.Algebra.Homomorphism.Equivalence
import Fragment.Algebra.Homomorphism.Properties
import Fragment.Algebra.Homomorphism.Setoid
import Fragment.Algebra.Properties
import Fragment.Algebra.Quotient
import Fragment.Algebra.Signature
import Fragment.Equational.Coproduct
import Fragment.Equational.FreeExtension
import Fragment.Equational.FreeExtension.Base
import Fragment.Equational.FreeExtension.Properties
import Fragment.Equational.FreeExtension.Synthetic
import Fragment.Equational.Model
import Fragment.Equational.Model.Base
import Fragment.Equational.Model.Properties
import Fragment.Equational.Model.Satisfaction
import Fragment.Equational.Model.Synthetic
import Fragment.Equational.Structures
import Fragment.Equational.Theory
import Fragment.Equational.Theory.Base
import Fragment.Equational.Theory.Bundles
import Fragment.Equational.Theory.Combinators
import Fragment.Equational.Theory.Laws
import Fragment.Examples.CSemigroup.Arith.Atomic
import Fragment.Examples.CSemigroup.Arith.Base
import Fragment.Examples.CSemigroup.Arith.Functions
import Fragment.Examples.CSemigroup.Arith.Reasoning
import Fragment.Examples.CSemigroup.Types
import Fragment.Examples.Semigroup.Arith.Atomic
import Fragment.Examples.Semigroup.Arith.Base
import Fragment.Examples.Semigroup.Arith.Functions
import Fragment.Examples.Semigroup.Arith.Reasoning
import Fragment.Examples.Semigroup.Types
import Fragment.Extensions.CSemigroup
import Fragment.Extensions.CSemigroup.Base
import Fragment.Extensions.CSemigroup.Monomial
import Fragment.Extensions.CSemigroup.Nat
-- import Fragment.Extensions.Combinators
import Fragment.Extensions.Semigroup
import Fragment.Prelude
import Fragment.Setoid.Morphism
import Fragment.Setoid.Morphism.Base
import Fragment.Setoid.Morphism.Properties
import Fragment.Setoid.Morphism.Setoid
import Fragment.Tactic.Fragment
import Fragment.Tactic.Utils
|
"""Accelerator lattice"""
from typing import List, Tuple
import matplotlib.pyplot as plt
import numpy as np
from .beam import Beam
from .transfer_matrix import TransferMatrix
from .utils import (
compute_m_twiss,
compute_one_turn,
compute_twiss_invariant,
to_phase_coord,
to_twiss,
)
class Lattice(list):
"""A list of accelerator elements."""
def __init__(self, *args):
"""Looks like a list, smells like a list and tastes like a list.
With a few added bells and whistles.
Attributes:
m_h: horizontal transfer matrix
m_v: vertical transfer matrix.
Methods:
transport: transport either the phase space coords or the twiss
parameters through the lattice.
transport_beam: Same as `transport` but returns the phase space
ellipses along with the twiss parameters through the lattice.
"""
super().__init__(*args)
self._m_h = None
self._m_v = None
@property
def m_h(self):
if self._m_h is None:
self._m_h = TransferMatrix(
compute_one_turn([element.m_h for element in self])
)
return self._m_h
@property
def m_v(self):
if self._m_v is None:
self._m_v = TransferMatrix(
compute_one_turn([element.m_v for element in self])
)
return self._m_v
def _clear_cache(self):
self._m_h = None
self._m_v = None
def transport(
self, init: List[float], plane: str = "h", twiss: bool = False,
) -> Tuple[np.ndarray, np.ndarray]:
"""Transport the given phase space along the lattice.
Args:
init: list of phase space coordinates, position[m] and angle[rad],
if `twiss` is True, `init` should be the initial
twiss parameters a list [beta, alpha, gamma], one twiss
parameter can be None.
plane (optional): plane of interest.
twiss (optional): if True will use the twiss parameter transfer
matrices.
Returns:
vec, s: phase coordinates or twiss parameters along with the
lattice and the s coordinates.
"""
if twiss:
init = to_twiss(init)
else:
init = to_phase_coord(init)
out = [init]
s = [0]
transfer_ms = [getattr(element, "m_" + plane.lower()) for element in self]
if twiss:
transfer_ms = [m.twiss for m in transfer_ms]
for i, m in enumerate(transfer_ms):
out.append(m @ out[i])
s.append(s[i] + self[i].length)
return np.hstack(out), np.array(s)
def transport_beam(
self, twiss_init: List[float], beam: Beam, plane: str = "h",
) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
"""Compute the phase space ellipse along the lattice.
Args:
twiss_init: initial twiss parameters, as a list [beta, alpha,
gamma], one twiss parameter can be None.
beam: Beam instance.
plane (optional): plane of interest.
Returns:
u, u_prime, twiss, s: phase space ellipse positions, phase space
ellispe angles, twiss parameters along the lattice and
the s coordinates.
"""
twiss_init = to_twiss(twiss_init)
def calc_phasespace(u):
return beam.phasespace(u, plane=plane)
init_phase = calc_phasespace(twiss_init)
twiss = [twiss_init]
u = [init_phase[0]]
u_prime = [init_phase[1]]
s = [0]
transfer_ms = [getattr(element, "m_" + plane).twiss for element in self]
for i, m in enumerate(transfer_ms):
new_twiss = m @ twiss[i]
phase_space = calc_phasespace(new_twiss)
u.append(phase_space[0])
u_prime.append(phase_space[1])
twiss.append(new_twiss)
s.append(s[i] + self[i].length)
return np.vstack(u).T, np.vstack(u_prime).T, np.hstack(twiss), np.array(s)
# Very ugly way of clearing cached one turn matrices on in place
# modification of the sequence.
def append(self, *args, **kwargs):
self._clear_cache()
return super().append(*args, **kwargs)
def clear(self, *args, **kwargs):
self._clear_cache()
return super().clear(*args, **kwargs)
def extend(self, *args, **kwargs):
self._clear_cache()
return super().extend(*args, **kwargs)
def insert(self, *args, **kwargs):
self._clear_cache()
return super().insert(*args, **kwargs)
def pop(self, *args, **kwargs):
self._clear_cache()
return super().pop(*args, **kwargs)
def remove(self, *args, **kwargs):
self._clear_cache()
return super().remove(*args, **kwargs)
def reverse(self, *args, **kwargs):
self._clear_cache()
return super().reverse(*args, **kwargs)
def sort(self, *args, **kwargs):
self._clear_cache()
return super().sort(*args, **kwargs)
def __getslice__(self, i, j):
return Lattice(list.__getslice__(self, i, j))
def __add__(self, other):
return Lattice(list.__add__(self, other))
def __mul__(self, other):
return Lattice(list.__mul__(self, other))
def __getitem__(self, item):
result = list.__getitem__(self, item)
try:
return Lattice(result)
except TypeError:
return result
def plot(
self,
n_s_per_element: int = int(1e3),
xztheta_init: List[float] = [0, 0, np.pi / 2],
) -> Tuple[plt.Figure, plt.Axes]:
"""Plot the s coordinate in the horizontal plane of the lattice.
"""
xztheta = [np.array(xztheta_init)]
s_start = 0
for element in self:
# skip thin elements
if element.length == 0:
continue
d_s = element.length / n_s_per_element
for _ in range(n_s_per_element):
xztheta.append(xztheta[-1] + element._dxztheta_ds(xztheta[-1][2], d_s))
s_start += element.length
xztheta = np.vstack(xztheta)
fig, ax = plt.subplots(1, 1)
ax.plot(xztheta[:, 0], xztheta[:, 1], label="s")
ax.set_aspect("equal")
ax.set_xlabel("x [m]")
ax.set_ylabel("z [m]")
ax.legend()
return fig, ax
|
State Before: ι : Type ?u.1814
α : Type ?u.1817
β : Type ?u.1820
γ : Type ?u.1823
inst✝ : CommMonoid α
s✝ t : Multiset α
a : α
m : Multiset ι
f g : ι → α
s : Multiset α
x y z : α
⊢ (fun x x_1 => x * x_1) x ((fun x x_1 => x * x_1) y z) = (fun x x_1 => x * x_1) y ((fun x x_1 => x * x_1) x z) State After: no goals Tactic: simp [mul_left_comm]
|
[STATEMENT]
lemma integral_eq_zero_AE:
"(AE x in M. f x = 0) \<Longrightarrow> integral\<^sup>L M f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. AE x in M. f x = (0::'b) \<Longrightarrow> integral\<^sup>L M f = (0::'b)
[PROOF STEP]
using integral_cong_AE[of f M "\<lambda>_. 0"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f \<in> borel_measurable M; (\<lambda>_. 0::'b) \<in> borel_measurable M; AE x in M. f x = (0::'b)\<rbrakk> \<Longrightarrow> integral\<^sup>L M f = LINT _|M. (0::'b)
goal (1 subgoal):
1. AE x in M. f x = (0::'b) \<Longrightarrow> integral\<^sup>L M f = (0::'b)
[PROOF STEP]
by (cases "integrable M f") (simp_all add: not_integrable_integral_eq)
|
################################################################################
#
# Map/NumField.jl
#
################################################################################
# This implements maps between arbitrary number fields.
#
# Basic idea
# ----------
#
# If f : K -> * is a map from a number field K, then f is completely determined by
# - f(gen(K)), if K is an AnticNumberField
# - f(gen(K)), f|_base_field(K), if K is an NfRel
# - f(gens(K)), if K is an NfAbsNS
# - f(gens(K)), f|_base_field(K), if K is an NfRelNS
#
# Thus our map type NumFieldMor has fields
# - header (as usual)
# - image_data, which define the morphism (as described above)
# - inverse_data, which define the inverse morphism (if it exists)
#
# To untangle the data defining the morphism and the morphism itself, we
# introduce the types
#
# MapDataFromAnticNumberField, MapDataFromNfRel, MapDataFromNfAbsNS,
# MapDataFromNfRelNS
#
# They store the data defining the morphism (these constructions are recursive
# in the relative setting).
#
# Because we know what the type of the inverse_data will be, we can also fully
# initialize the type, even if we don't have access to the preimage data (yet).
#
# Applying a morphism
# -------------------
#
# The application of a morphism is delegated the MapData* types. They implement
# an image function, e.g., with signature
#
# image(MapDataFromAnticNumberField{NfRel{nf_elem}}, L, x::nf_elem),
#
# which gets called when f : K -> L is a map from AnticNumberField to
# NfRel{nf_elem}. (More precisely, f(a) = image(f.image_data, codomain(f), a))
#
# Note that we do not store L inside explicitely inside MapData* and this
# becomes a problem if f.isid is true. Thus we need to pass L to the function.
#
# Difference to the old system
# ----------------------------
#
# To allow creation of morphism between arbitrary types, we have to be a bit
# careful when it comes to morphism of relative fields.
#
# Assume L/K is an NfRel{nf_elem} and f : L -> L is a morphism, mapping K to K.
# Before, we were basically storing implicitely f(gen(L)) as well as g : K ->
# K. Instead we are storing f(gen(L)) as well as f(L(gen(K)). This new system
# is much more flexible and does not require awkward special cases, which do
# not scale. The (minor) price we pay is that some morphism are a bit slower to
# evaluate.
#
# We are mitigating this regression by storing (in this case) whether f is the
# identity on base_field(K).
#
# Creating morphisms
# ------------------
# This follows now a very easy rule. Let L be any number field. Constructing
# a homorphism K -> L can be constructed as follows:
#
# If K is an AnticNumberField:
# hom(K, L, ::elem_type(L))
# If K is an NfAbsNS:
# hom(K, L, ::Vector{elem_type(L)}
# If K is an NfRel:
# hom(K, L, g, ::elem_type(L)), where g can be
# - a homomorphism base_field(K) -> L
# - data defining a homomorphism base_field(K) -> L
# (e.g., to support
# hom(::NfRel{nf_elem}, AnticNumberField, nf_elem, nf_elem))
# - a homorphism base_field(K) -> base_field(L)
# hom(K, L, ::elem_type(L))
# - this assumes that the base_field of K embeds naturally into L
# If K is an NfRelNS:
# hom(K, L, g, ::Vector{elem_type(L)}), where g can be
# - a homomorphism base_field(K) -> L
# - data defining a homomorphism base_field(K) -> L
# (e.g., to support
# hom(::NfRelNS{nf_elem}, AnticNumberField, nf_elem, Vector{nf_elem}))
# - a homorphism base_field(K) -> base_field(L)
# hom(K, L, ::Vector{elem_type(L)})
# - this assumes that the base_field of K embeds naturally into L
#
# We also get a nice syntax to create inverses for free:
#
# hom(K, L, ..., inverse = (x))
#
# where x is such that hom(L, K, x) works.
#
export restrict
################################################################################
#
# The NumFieldMor type
#
################################################################################
mutable struct NumFieldMor{S, T, U, V, W} <: Map{S, T, HeckeMap, NumFieldMor}
header::MapHeader{S, T}
image_data::U
inverse_data::V
absolute_basis::Vector{W}
absolute_basis_matrix_image::fmpq_mat
rref::Tuple{fmpq_mat, fmpq_mat}
pivots_of_rref::Vector{Int}
function NumFieldMor{S, T, U, V}() where {S, T, U, V}
z = new{S, T, U, V, elem_type(S)}()
return z
end
function NumFieldMor(K::NumField, L::NumField)
z = new{typeof(K), typeof(L), map_data_type(K, L), map_data_type(L, K), elem_type(K)}()
z.header = MapHeader(K, L)
return z
end
function NumFieldMor{S, T, U, V}(h::MapHeader{S, T}, i::U, p::V) where {S, T, U, V}
z = new{S, T, U, V, elem_type(S)}(h, i, p)
return z
end
end
################################################################################
#
# The hom function
#
################################################################################
function hom(K::S, L::T, x...; inverse = nothing,
check::Bool = true,
compute_inverse = false) where {S <: NumField,
T <: NumField}
header = MapHeader(K, L)
# Check if data defines a morphism
image_data = map_data(K, L, x..., check = check)
if inverse !== nothing
# Check if data defines a morphism
# This goes through _validata_data, since we don't want to split the
# argument if for example the argument is a Vector
inverse_data = _map_data(L, K, inverse, check = check)
z = NumFieldMor{S, T, typeof(image_data),
typeof(inverse_data)}(header, image_data, inverse_data)
else
z = NumFieldMor{S, T, typeof(image_data), map_data_type(L, K)}()
end
z.header = header
z.image_data = image_data
if compute_inverse
_assure_has_inverse_data(z)
end
return z
end
################################################################################
#
# Some type acrobatic. This should be moved to where types will be ending up.
#
################################################################################
base_field_type(::AnticNumberField) = FlintRationalField
base_field_type(::NfAbsNS) = FlintRationalField
base_field_type(::NfRel{T}) where {T} = parent_type(T)
base_field_type(::NfRelNS{T}) where {T} = parent_type(T)
base_field_type(::Type{NfRelNS{T}}) where {T} = parent_type(T)
base_field_type(::Type{NfRel{T}}) where {T} = parent_type(T)
elem_type(::Type{NfRelNS{T}}) where {T} = NfRelNSElem{T}
elem_type(::NfRelNS{T}) where {T} = NfRelNSElem{T}
parent_type(::Type{NfRelNSElem{T}}) where {T} = NfRelNS{T}
elem_type(::Type{NfAbsNS}) = NfAbsNSElem
elem_type(::NfAbsNS) = NfAbsNSElem
parent_type(::Type{NfAbsNSElem}) = NfAbsNS
################################################################################
#
# Image and preimage function
#
################################################################################
function image(f::NumFieldMor, x)
@assert domain(f) === parent(x)
return image(f.image_data, codomain(f), x)
end
function preimage(f::NumFieldMor, x)
return image(f.inverse_data, domain(f), x)
end
################################################################################
#
# Now the types to store the data for the maps
#
################################################################################
# From AnticNumberField into something
mutable struct MapDataFromAnticNumberField{T}
prim_image::T
isid::Bool
function MapDataFromAnticNumberField{T}(x::Bool) where T
@assert x
z = new{T}()
z.isid = true
return z
end
function MapDataFromAnticNumberField{T}(x::T) where T
z = new{T}(x, false)
return z
end
end
# Helper functions to create the type
map_data_type(K::AnticNumberField, L::NumField) = map_data_type(AnticNumberField, typeof(L))
map_data_type(::Type{AnticNumberField}, T::Type{<:NumField}) = MapDataFromAnticNumberField{elem_type(T)}
# Test if data u, v specfiying a map K -> L define the same morphism
function _isequal(K, L, u::MapDataFromAnticNumberField{T},
v::MapDataFromAnticNumberField{S}) where {T, S}
if u.isid && v.isid
return true
end
z = gen(K)
return image(u, L, z) == image(v, L, z)
end
# Image function
function image(f::MapDataFromAnticNumberField, L, y::nf_elem)
f.isid && return L(y)
z = parent(defining_polynomial(parent(y)))(y)
return evaluate(z, f.prim_image)
end
# Functions to create and validate the data
#
map_data(K::AnticNumberField, L, ::Bool) = MapDataFromAnticNumberField{elem_type(L)}(true)
function map_data(K::AnticNumberField, L, x::NumFieldElem; check = true)
if parent(x) === L
xx = x
else
xx = L(x)::elem_type(L)
end
if check
if !iszero(evaluate(defining_polynomial(K), xx))
error("Data does not define a morphism")
end
end
return MapDataFromAnticNumberField{elem_type(L)}(xx)
end
function map_data(K::AnticNumberField, L, g::NumFieldMor; check = true)
if check
K !== domain(g) && error("Data does not define a morphism")
end
z = image_primitive_element(g)
return map_data(K, L, z; check = false)
end
# From NfRel into something
mutable struct MapDataFromNfRel{T, S}
prim_image::T
base_field_map_data::S
isid::Bool
function MapDataFromNfRel{T, S}(x::T, y::S) where {T, S}
z = new{T, S}(x, y, false)
return z
end
function MapDataFromNfRel{T, S}(x::Bool) where {T, S}
@assert x
z = new{T, S}()
z.isid = true
return z
end
end
# Helper functions to create the type
function map_data_type(T::Type{<: NfRel}, L::Type{<:Any})
MapDataFromNfRel{elem_type(L), map_data_type(base_field_type(T), L)}
end
map_data_type(K::NfRel, L::NumField) = map_data_type(typeof(K), typeof(L))
# Test if data u, v specfiying a map K -> L define the same morphism
function _isequal(K, L, u::MapDataFromNfRel{T, S}, v::MapDataFromNfRel{T, S}) where {T, S}
if u.isid && v.isid
return true
end
return image(u, L, gen(K)) == image(v, L, gen(K)) &&
_isequal(base_field(K), L, u.base_field_map_data, v.base_field_map_data)
end
# Image function
function image(f::MapDataFromNfRel, L, y)
f.isid && return L(y)
# TODO: Cache the polynomial ring
Ly, = PolynomialRing(L, "y", cached = false)
z = map_coefficients(t -> image(f.base_field_map_data, L, t), y.data, parent = Ly)
return evaluate(z, f.prim_image)
end
# Functions to validate and create the data.
function map_data(K::NfRel, L, ::Bool)
z = MapDataFromNfRel{elem_type(L), map_data_type(base_field(K), L)}(true)
z.base_field_map_data = map_data(base_field(K), L, true)
return z
end
function map_data(K::NfRel, L, x...; check = true)
z = map_data(base_field(K), L, Base.front(x)...; check = check)
local yy::elem_type(L)
if Base.last(x) isa NumFieldMor
domain(Base.last(x)) !== K && error("Data does not define a morphism")
_y = image_primitive_element(Base.last(x))
if parent(_y) === L
yy = _y
else
yy = L(_y)::elem_type(L)
end
else
y = Base.last(x)
if parent(y) === L
yy = y
else
yy = L(y)::elem_type(L)
end
end
if check
y = evaluate(map_coefficients(w -> image(z, L, w), defining_polynomial(K), cached = false), yy)
!iszero(y) && error("Data does not define a morphism")
end
@assert typeof(yy) == elem_type(L)
@assert typeof(z) == map_data_type(base_field(K), L)
return MapDataFromNfRel{typeof(yy), typeof(z)}(yy, z)
end
# From NfAbsNS into something
mutable struct MapDataFromNfAbsNS{T}
images::T
isid::Bool
function MapDataFromNfAbsNS{T}(x::T) where {T}
z = new{T}(x, false)
return z
end
function MapDataFromNfAbsNS{T}(x::Bool) where {T}
@assert x
z = new{T}()
z.isid = true
return z
end
end
function _isequal(K, L, u::MapDataFromNfAbsNS{T}, v::MapDataFromNfAbsNS{T}) where {T}
# If one is the identity, this means that K === L
if (u.isid && !v.isid)
return v.images == gens(K)
elseif (v.isid && !u.isid)
return u.images == gens(K)
elseif u.isid && v.isid
return true
end
return v.images == u.images
end
function image(f::MapDataFromNfAbsNS, L, y)
f.isid && return L(y)
return msubst(y.data, f.images)
end
map_data_type(K::NfAbsNS, L) = MapDataFromNfAbsNS{Vector{elem_type(L)}}
map_data_type(T::Type{NfAbsNS}, L::Type{<:Any}) = MapDataFromNfAbsNS{Vector{elem_type(L)}}
map_data(K::NfAbsNS, L, ::Bool) = MapDataFromNfAbsNS{Vector{elem_type(L)}}(true)
function map_data(K::NfAbsNS, L, x::Vector; check = true)
if length(x) != ngens(K)
error("Data does not define a morphism")
end
local xx::Vector{elem_type(L)}
if x isa Vector{elem_type(L)}
if parent(x[1]) !== L
error("Data does not define a morphism")
end
xx = x
else
xx = map(L, x)::Vector{elem_type(L)}
end
if check
for i in 1:ngens(K)
if !iszero(evaluate(K.pol[i], xx))
error("Data does not define a morphism")
end
end
end
@assert typeof(xx) == Vector{elem_type(L)}
return MapDataFromNfAbsNS{typeof(xx)}(xx)
end
# From NfRelNS into something
mutable struct MapDataFromNfRelNS{T, S}
images::T
base_field_map_data::S
isid::Bool
function MapDataFromNfRelNS{T, S}(x::T, y::S) where {T, S}
z = new{T, S}(x, y, false)
return z
end
function MapDataFromNfRelNS{T, S}(x::Bool) where {T, S}
@assert x
z = new{T, S}()
z.isid = true
return z
end
end
function _isequal(K, L, u::MapDataFromNfRelNS{T, S}, v::MapDataFromNfRelNS{T, S}) where {T, S}
if u.isid && v.isid
return true
end
return all(g -> image(u, L, g) == image(v, L, g), gens(K)) && _isequal(base_field(K), base_field(L), u.base_field_map_data, v.base_field_map_data)
end
function image(f::MapDataFromNfRelNS, L, y)
f.isid && return L(y)
z = map_coefficients(w -> image(f.base_field_map_data, L, w), y.data, cached = false)
return evaluate(z, f.images)
end
function map_data_type(T::Type{<: NfRelNS}, L::Type{<:Any})
MapDataFromNfRelNS{Vector{elem_type(L)}, map_data_type(base_field_type(T), L)}
end
map_data_type(K::NfRelNS, L) = MapDataFromNfRelNS{Vector{elem_type(L)}, map_data_type(base_field(K), L)}
function map_data(K::NfRelNS, L, ::Bool)
z = MapDataFromNfRelNS{Vector{elem_type(L)}, map_data_type(base_field(K), L)}(true)
z.base_field_map_data = map_data(base_field(K), L, true)
return z
end
function map_data(K::NfRelNS, L, x...; check = true)
z = map_data(base_field(K), L, Base.front(x)...; check = check)
local yy::Vector{elem_type(L)}
if Base.last(x) isa NumFieldMor
domain(Base.last(x)) !== K && error("")
_y = image_generators(Base.last(x))
if parent(_y[1]) === L
yy = _y
else
yy = map(L, _y)::Vector{elem_type(L)}
end
else
y = Base.last(x)
if !(y isa Vector)
error("")
end
if parent(y[1]) === L
yy = y
else
yy = map(L, y)::Vector{elem_type(L)}
end
end
if check
for i in 1:ngens(K)
w = evaluate(map_coefficients(w -> image(z, L, w), K.pol[i], cached = false), yy)
!iszero(w) && error("Data does not define a morphism")
end
end
@assert typeof(yy) == Vector{elem_type(L)}
@assert typeof(z) == map_data_type(base_field(K), L)
return MapDataFromNfRelNS{typeof(yy), typeof(z)}(yy, z)
end
################################################################################
#
# Equality
#
################################################################################
function Base.:(==)(u::NumFieldMor, v::NumFieldMor)
if (domain(u) != domain(v)) || (codomain(u) != codomain(v))
return false
end
return _isequal(domain(u), codomain(u), u.image_data, v.image_data)
end
################################################################################
#
# Identity morphism
#
################################################################################
function id_hom(K::NumField)
z = NumFieldMor{typeof(K), typeof(K), map_data_type(K, K), map_data_type(K, K)}(MapHeader(K, K), map_data(K, K, true), map_data(K, K, true))
end
################################################################################
#
# Helper functions to compare morphisms
#
################################################################################
_convert_map_data(g::NumFieldMor, L) = __convert_map_data(g.image_data, L)
__convert_map_data(d::MapDataFromAnticNumberField, L) = MapDataFromAnticNumberField{elem_type(L)}(d.isid ? true : L(d.prim_image))
__convert_map_data(d::MapDataFromNfRel, L) = MapDataFromNfReld{elem_type(L)}(L(d.prim_image), d.isid ? true : __convert_map_data(d.base_field_map_data), d.isid)
################################################################################
#
# Helper functions to pass through inverse data
#
################################################################################
@inline _validate_data(L, K, inverse) = validate_data(L, K, inverse)
@inline _validate_data(L, K, inverse::Tuple) = validate_data(L, K, inverse...)
@inline _map_data(L, K, inverse; check::Bool) = map_data(L, K, inverse, check = check)
@inline _map_data(L, K, inverse::Tuple; check::Bool) = map_data(L, K, inverse..., check = check)
################################################################################
#
# Morphism type
#
################################################################################
morphism_type(K::NumField) = morphism_type(typeof(K), typeof(K))
morphism_type(K::Type{T}) where T <: NumField = morphism_type(T, T)
morphism_type(K::S, L::T) where {S <: NumField, T <: NumField} = morphism_type(S, T)
morphism_type(::Type{S}, ::Type{T}) where {S <: NumField, T <: NumField} = NumFieldMor{S, T, map_data_type(S, T), map_data_type(T, S), elem_type(S)}
################################################################################
#
# Type aliases
#
################################################################################
const NfToNfMor = morphism_type(AnticNumberField, AnticNumberField)
const NfAbsNSToNfAbsNS = morphism_type(NfAbsNS, NfAbsNS)
const NfAbsToNfAbsNS = morphism_type(AnticNumberField, NfAbsNS)
const NfToNfRel = morphism_type(AnticNumberField, NfRel{nf_elem})
const NfRelToNfRelMor_nf_elem_nf_elem = morphism_type(NfRel{nf_elem}, NfRel{nf_elem})
const NfRelToNf = morphism_type(NfRel{nf_elem}, AnticNumberField)
const NfRelNSToNfRelNSMor_nf_elem = morphism_type(NfRelNS{nf_elem}, NfRelNS{nf_elem})
const NfRelToNfRelNSMor_nf_elem = morphism_type(NfRel{nf_elem}, NfRelNS{nf_elem})
################################################################################
#
# Images of primitive elements/generators
#
################################################################################
function image_primitive_element(f::NumFieldMor{AnticNumberField})
if f.image_data.isid
return codomain(f)(gen(domain(f)))
end
return f.image_data.prim_image
end
function preimage_primitive_element(f::NfToNfMor)
if f.inverse_data.isid
return codomain(f)(gen(domain(f)))
else
return f.inverse_data.prim_image
end
end
function image_generators(f::NumFieldMor{<:NfRelNS})
return f.image_data.images
end
function image_generators(f::NumFieldMor{<:NfAbsNS})
return f.image_data.images
end
function image_primitive_element(f::NumFieldMor{<:NfRel})
if f.image_data.isid
return gen(domain(f))
end
return f.image_data.prim_image
end
################################################################################
#
# Preimage computation
#
# ##############################################################################
function _assert_has_preimage_data(f::NumFieldMor)
if isdefined(f, :absolute_basis_matrix_image)
return nothing
end
K = domain(f)
L = codomain(f)
b = absolute_basis(K)
d = absolute_degree(K)
n = absolute_degree(L)
M = zero_matrix(FlintQQ, n, d)
for i in 1:d
c = f(b[i])
cc = absolute_coordinates(c)
for j in 1:length(cc)
M[j, i] = cc[j]
end
end
r, R, U = _rref_with_trans(M)
pivots = _get_pivots_ut(R)
f.absolute_basis_matrix_image = M
f.absolute_basis = b
f.pivots_of_rref = pivots
f.rref = R, U
return nothing
end
function haspreimage(f::NumFieldMor, g::NumFieldElem)
if isdefined(f, :inverse_data)
return true, image(f.inverse_data, domain(f), g)
end
@assert parent(g) === codomain(f)
cc = absolute_coordinates(g)
K = domain(f)
_assert_has_preimage_data(f)
fl, s = can_solve_given_rref(f.rref[1], f.rref[2], f.pivots_of_rref, cc)
if !fl
return false, zero(K)
else
b = f.absolute_basis
# This is suboptimal
prim_preimg = reduce(+, (s[i, 1] * b[i] for i in 1:length(b)), init = zero(K))::elem_type(K)
return true, prim_preimg
end
end
function preimage(f::NumFieldMor, g::NumFieldElem)
fl, y = haspreimage(f, g)
@assert fl
return y
end
################################################################################
#
# Computation of the inverse (data)
#
################################################################################
function _assure_has_inverse_data(f::NumFieldMor)
if isdefined(f, :inverse_data)
return nothing
else
pr = _compute_inverse_data(f, domain(f), codomain(f))
f.inverse_data = pr
return nothing
end
end
function inv(f::NumFieldMor{S, T}) where {S, T}
_assure_has_inverse_data(f)
pr = f.inverse_data
hd = MapHeader(codomain(f), domain(f))
g = NumFieldMor{T, S, map_data_type(T, S), map_data_type(S, T)}(hd, pr, f.image_data)
return g
end
# into AnticNumberField
function _compute_inverse_data(f#= image data =#, K, L::AnticNumberField)
return _compute_inverse_data(f#= image data =#, K, L, L)
end
function _compute_inverse_data(f#= image data =#, K, LL, L::AnticNumberField)
g = LL(gen(L))
fl, prim_preimg = haspreimage(f, LL(g))
@assert fl
return MapDataFromAnticNumberField{typeof(prim_preimg)}(prim_preimg)
end
# into NfAbsNS
function _compute_inverse_data(f#= image data =#, K, L::NfAbsNS)
return _compute_inverse_data(f, K, L, L)
end
function _compute_inverse_data(f#= image data =#, K, LL, L::NfAbsNS)
preimg_gens = elem_type(K)[]
for g in gens(L)
fl, preimg = haspreimage(f, LL(g))
@assert fl
push!(preimg_gens, preimg)
end
return MapDataFromNfAbsNS{typeof(preimg_gens)}(preimg_gens)
end
# into NfRel
function _compute_inverse_data(f#= image data =#, K, L::NfRel)
return _compute_inverse_data(f#= image data =#, K, L, L)
end
function _compute_inverse_data(f#= image data =#, K, LL, L::NfRel)
g = gen(L)
fl, preimg = haspreimage(f, LL(g))
inverse_data_base_field = _compute_inverse_data(f, K, LL, base_field(L))
return MapDataFromNfRel{typeof(preimg), typeof(inverse_data_base_field)}(preimg, inverse_data_base_field)
end
# into NfRelNS
function _compute_inverse_data(f#= image data =#, K, L::NfRelNS)
return _compute_inverse_data(f, K, L, L)
end
function _compute_inverse_data(f, K, LL, L::NfRelNS)
preimg_gens = elem_type(K)[]
for g in gens(L)
fl, preimg = haspreimage(f, LL(g))
push!(preimg_gens, preimg)
end
inverse_data_base_field = _compute_inverse_data(f, K, LL, base_field(L))
return MapDataFromNfRelNS{typeof(preimg_gens), typeof(inverse_data_base_field)}(preimg_gens, inverse_data_base_field)
end
################################################################################
#
# Auxillary map_data function
#
################################################################################
function map_data(K::NumField, L::NumField; check = true)
return map_data(K, L, true)
end
################################################################################
#
# Composition
#
################################################################################
# f : K -> L, g : L -> M
function _compose(f::MapDataFromAnticNumberField, g#= map data =#, K, L, M)
return map_data_type(K, M)(image(g, M, image(f, L, gen(K))))
end
function _compose(f::MapDataFromNfRel, g#= map data =#, K, L, M)
return map_data_type(K, M)(image(g, M, image(f, L, gen(K))),
_compose(f.base_field_map_data, g, base_field(K), L, M))
end
function _compose(f::MapDataFromNfAbsNS, g#= map data =#, K, L, M)
return map_data_type(K, M)(elem_type(M)[image(g, M, image(f, L, u)) for u in gens(K)])
end
function _compose(f::MapDataFromNfRelNS, g#= map data =#, K, L, M)
return map_data_type(K, M)(elem_type(M)[image(g, M, image(f, L, u)) for u in gens(K)],
_compose(f.base_field_map_data, g, base_field(K), L, M))
end
function Base.:(*)(f::NumFieldMor, g::NumFieldMor)
@req codomain(f) === domain(g) "Composition: Maps are not compatible"
z = NumFieldMor(domain(f), codomain(g))
z.image_data = _compose(f.image_data, g.image_data, domain(f), codomain(f), codomain(g))
if isdefined(f, :inverse_data) && isdefined(g, :inverse_data)
z.inverse_data = _compose(g.inverse_data, f.inverse_data, codomain(g), domain(g), domain(f))
end
return z
end
################################################################################
#
# Powering
#
################################################################################
function ^(f::NumFieldMor, b::Int)
K = domain(f)
@assert K == codomain(f)
d = absolute_degree(K)
b = mod(b, d)
if b == 0
return id_hom(K)
elseif b == 1
return f
else
bit = ~((~UInt(0)) >> 1)
while (UInt(bit) & b) == 0
bit >>= 1
end
z = f
bit >>= 1
while bit != 0
z = z * z
if (UInt(bit) & b) != 0
z = z * f
end
bit >>= 1
end
return z
end
end
^(a::NumFieldMor, n::IntegerUnion) = _generic_power(a, n)
################################################################################
#
# Hashing
#
################################################################################
function Base.hash(f::MapDataFromAnticNumberField, K, L, h::UInt)
if f.isid
return xor(hash(L, h), hash(K, h))
else
return hash(f.prim_image, h)
end
end
function Base.hash(f::MapDataFromNfRel, K, L, h::UInt)
if f.isid
h = xor(hash(L, h), hash(K, h))
else
h = hash(f.prim_image, h)
end
h = hash(f.base_field_map_data, base_field(K), L, h)
return h
end
function Base.hash(f::MapDataFromNfAbsNS, K, L, h::UInt)
if f.isid
return xor(hash(L, h), hash(K, h))
else
G = f.images
for g in G
h = hash(g, h)
end
return h
end
end
function Base.hash(f::MapDataFromNfRelNS, K, L, h::UInt)
if f.isid
h = xor(hash(L, h), hash(K, h))
else
G = f.images
for g in G
h = hash(g, h)
end
end
h = hash(f.base_field_map_data, base_field(K), L, h)
end
Base.hash(f::NumFieldMor, h::UInt) = hash(f.image_data, domain(f), codomain(f), h)
################################################################################
#
# Restriction
#
################################################################################
function restrict(f::NumFieldMor, K::NonSimpleNumField)
k = domain(f)
return hom(K, k, [k(x) for x in gens(K)])*f
end
function restrict(f::NumFieldMor, K::SimpleNumField)
k = domain(f)
return hom(K, k, k(gen(K)))*f
end
|
// Copyright (c) 2013, Thomas Goyne <[email protected]>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// Aegisub Project http://www.aegisub.org/
#include "config.h"
#include "search_replace_engine.h"
#include "ass_dialogue.h"
#include "ass_file.h"
#include "include/aegisub/context.h"
#include "selection_controller.h"
#include "text_selection_controller.h"
#include <libaegisub/of_type_adaptor.h>
#include <libaegisub/util.h>
#include <boost/locale.hpp>
#include <wx/msgdlg.h>
static const size_t bad_pos = -1;
namespace {
auto get_dialogue_field(SearchReplaceSettings::Field field) -> decltype(&AssDialogue::Text) {
switch (field) {
case SearchReplaceSettings::Field::TEXT: return &AssDialogue::Text;
case SearchReplaceSettings::Field::STYLE: return &AssDialogue::Style;
case SearchReplaceSettings::Field::ACTOR: return &AssDialogue::Actor;
case SearchReplaceSettings::Field::EFFECT: return &AssDialogue::Effect;
}
throw agi::InternalError("Bad field for search", nullptr);
}
std::string const& get_normalized(const AssDialogue *diag, decltype(&AssDialogue::Text) field) {
auto& value = const_cast<AssDialogue*>(diag)->*field;
auto normalized = boost::locale::normalize(value.get());
if (normalized != value)
value = normalized;
return value.get();
}
typedef std::function<MatchState (const AssDialogue*, size_t)> matcher;
class noop_accessor {
boost::flyweight<std::string> AssDialogue::*field;
size_t start;
public:
noop_accessor(SearchReplaceSettings::Field f) : field(get_dialogue_field(f)), start(0) { }
std::string get(const AssDialogue *d, size_t s) {
start = s;
return get_normalized(d, field).substr(s);
}
MatchState make_match_state(size_t s, size_t e, boost::u32regex *r = nullptr) {
return MatchState(s + start, e + start, r);
}
};
class skip_tags_accessor {
boost::flyweight<std::string> AssDialogue::*field;
std::vector<std::pair<size_t, size_t>> blocks;
size_t start;
void parse_str(std::string const& str) {
blocks.clear();
size_t ovr_start = bad_pos;
size_t i = 0;
for (auto const& c : str) {
if (c == '{' && ovr_start == bad_pos)
ovr_start = i;
else if (c == '}' && ovr_start != bad_pos) {
blocks.emplace_back(ovr_start, i);
ovr_start = bad_pos;
}
++i;
}
}
public:
skip_tags_accessor(SearchReplaceSettings::Field f) : field(get_dialogue_field(f)), start(0) { }
std::string get(const AssDialogue *d, size_t s) {
auto const& str = get_normalized(d, field);
parse_str(str);
std::string out;
size_t last = s;
for (auto const& block : blocks) {
if (block.second < s) continue;
if (block.first > last)
out.append(str.begin() + last, str.begin() + block.first);
last = block.second + 1;
}
if (last < str.size())
out.append(str.begin() + last, str.end());
start = s;
return out;
}
MatchState make_match_state(size_t s, size_t e, boost::u32regex *r = nullptr) {
s += start;
e += start;
// Shift the start and end of the match to be relative to the unstripped
// match
for (auto const& block : blocks) {
// Any blocks before start are irrelevant as they're included in `start`
if (block.second < s) continue;
// Skip over blocks at the very beginning of the match
// < should only happen if the cursor was within an override block
// when the user started a search
if (block.first <= s) {
size_t len = block.second - std::max(block.first, s) + 1;
s += len;
e += len;
continue;
}
assert(block.first > s);
// Blocks after the match are irrelevant
if (block.first >= e) break;
// Extend the match to include blocks within the match
// Note that blocks cannot be partially within the match
e += block.second - block.first + 1;
}
return MatchState(s, e, r);
}
};
template<typename Accessor>
matcher get_matcher(SearchReplaceSettings const& settings, Accessor&& a) {
if (settings.use_regex) {
int flags = boost::u32regex::perl;
if (!settings.match_case)
flags |= boost::u32regex::icase;
auto regex = boost::make_u32regex(settings.find, flags);
return [=](const AssDialogue *diag, size_t start) mutable -> MatchState {
boost::smatch result;
auto const& str = a.get(diag, start);
if (!u32regex_search(str, result, regex, start > 0 ? boost::match_not_bol : boost::match_default))
return MatchState();
return a.make_match_state(result.position(), result.position() + result.length(), ®ex);
};
}
bool full_match_only = settings.exact_match;
bool match_case = settings.match_case;
std::string look_for = settings.find;
if (!settings.match_case)
look_for = boost::locale::fold_case(look_for);
return [=](const AssDialogue *diag, size_t start) mutable -> MatchState {
const auto str = a.get(diag, start);
if (full_match_only && str.size() != look_for.size())
return MatchState();
if (match_case) {
const auto pos = str.find(look_for);
return pos == std::string::npos ? MatchState() : a.make_match_state(pos, pos + look_for.size());
}
const auto pos = agi::util::ifind(str, look_for);
return pos.first == bad_pos ? MatchState() : a.make_match_state(pos.first, pos.second);
};
}
template<typename Iterator, typename Container>
Iterator circular_next(Iterator it, Container& c) {
++it;
if (it == c.end())
it = c.begin();
return it;
}
}
std::function<MatchState (const AssDialogue*, size_t)> SearchReplaceEngine::GetMatcher(SearchReplaceSettings const& settings) {
if (settings.skip_tags)
return get_matcher(settings, skip_tags_accessor(settings.field));
return get_matcher(settings, noop_accessor(settings.field));
}
SearchReplaceEngine::SearchReplaceEngine(agi::Context *c)
: context(c)
, initialized(false)
{
}
void SearchReplaceEngine::Replace(AssDialogue *diag, MatchState &ms) {
auto& diag_field = diag->*get_dialogue_field(settings.field);
auto text = diag_field.get();
std::string replacement = settings.replace_with;
if (ms.re) {
auto to_replace = text.substr(ms.start, ms.end - ms.start);
replacement = u32regex_replace(to_replace, *ms.re, replacement, boost::format_first_only);
}
diag_field = text.substr(0, ms.start) + replacement + text.substr(ms.end);
ms.end = ms.start + replacement.size();
}
bool SearchReplaceEngine::FindReplace(bool replace) {
if (!initialized)
return false;
auto matches = GetMatcher(settings);
AssDialogue *line = context->selectionController->GetActiveLine();
auto it = context->ass->Line.iterator_to(*line);
size_t pos = 0;
MatchState replace_ms;
if (replace) {
if (settings.field == SearchReplaceSettings::Field::TEXT)
pos = context->textSelectionController->GetSelectionStart();
if ((replace_ms = matches(line, pos))) {
size_t end = bad_pos;
if (settings.field == SearchReplaceSettings::Field::TEXT)
end = context->textSelectionController->GetSelectionEnd();
if (end == bad_pos || (pos == replace_ms.start && end == replace_ms.end)) {
Replace(line, replace_ms);
pos = replace_ms.end;
context->ass->Commit(_("replace"), AssFile::COMMIT_DIAG_TEXT);
}
else {
// The current line matches, but it wasn't already selected,
// so the match hasn't been "found" and displayed to the user
// yet, so do that rather than replacing
context->textSelectionController->SetSelection(replace_ms.start, replace_ms.end);
return true;
}
}
}
// Search from the end of the selection to avoid endless matching the same thing
else if (settings.field == SearchReplaceSettings::Field::TEXT)
pos = context->textSelectionController->GetSelectionEnd();
// For non-text fields we just look for matching lines rather than each
// match within the line, so move to the next line
else if (settings.field != SearchReplaceSettings::Field::TEXT)
it = circular_next(it, context->ass->Line);
auto const& sel = context->selectionController->GetSelectedSet();
bool selection_only = sel.size() > 1 && settings.limit_to == SearchReplaceSettings::Limit::SELECTED;
do {
AssDialogue *diag = dynamic_cast<AssDialogue*>(&*it);
if (!diag) continue;
if (selection_only && !sel.count(diag)) continue;
if (settings.ignore_comments && diag->Comment) continue;
if (MatchState ms = matches(diag, pos)) {
if (selection_only)
// We're cycling through the selection, so don't muck with it
context->selectionController->SetActiveLine(diag);
else
context->selectionController->SetSelectionAndActive({ diag }, diag);
if (settings.field == SearchReplaceSettings::Field::TEXT)
context->textSelectionController->SetSelection(ms.start, ms.end);
return true;
}
} while (pos = 0, &*(it = circular_next(it, context->ass->Line)) != line);
// Replaced something and didn't find another match, so select the newly
// inserted text
if (replace_ms && settings.field == SearchReplaceSettings::Field::TEXT)
context->textSelectionController->SetSelection(replace_ms.start, replace_ms.end);
return true;
}
bool SearchReplaceEngine::ReplaceAll() {
if (!initialized)
return false;
size_t count = 0;
auto matches = GetMatcher(settings);
SubtitleSelection const& sel = context->selectionController->GetSelectedSet();
bool selection_only = settings.limit_to == SearchReplaceSettings::Limit::SELECTED;
for (auto diag : context->ass->Line | agi::of_type<AssDialogue>()) {
if (selection_only && !sel.count(diag)) continue;
if (settings.ignore_comments && diag->Comment) continue;
if (settings.use_regex) {
if (MatchState ms = matches(diag, 0)) {
auto& diag_field = diag->*get_dialogue_field(settings.field);
std::string const& text = diag_field.get();
count += distance(
boost::u32regex_iterator<std::string::const_iterator>(begin(text), end(text), *ms.re),
boost::u32regex_iterator<std::string::const_iterator>());
diag_field = u32regex_replace(text, *ms.re, settings.replace_with);
}
continue;
}
size_t pos = 0;
while (MatchState ms = matches(diag, pos)) {
++count;
Replace(diag, ms);
pos = ms.end;
}
}
if (count > 0) {
context->ass->Commit(_("replace"), AssFile::COMMIT_DIAG_TEXT);
wxMessageBox(wxString::Format(_("%i matches were replaced."), (int)count));
}
else {
wxMessageBox(_("No matches found."));
}
return true;
}
void SearchReplaceEngine::Configure(SearchReplaceSettings const& new_settings) {
settings = new_settings;
initialized = true;
}
|
Anderson’s disease is also known as chylomicron retention disease which is a rare hereditary disease. It is an autosomal recessive disease characterized by low plasma lipid and low lipid-soluble vitamins (such as vitamin E and vitamin D). After the digestion of food, lipids, and lipid soluble vitamins are absorbed in the human body with the help of chylomicrons. A lack of chylomicron can interrupt the transport of molecules from intestine to the bloodstream resulting in malabsorption. Subjects with these disorders show different clinical manifestations which were initially described by Anderson and colleagues, hence it was called as “Anderson’s disease”. Genotyping has revealed that Anderson's and chylomicron retention disease are in fact the same disease.
Anderson' disease and chylomicron retention disease is the same disease which has been proved genotypically. The disease is caused by the mutation in the gene SAR1B (formerly SARA2), which encodes the SAR1B protein. Mutation results in the defect in chylomicron secretion, a transport protein. A lack of transport of dietary lipids from the intestine to the bloodstream causes malabsorption, which is the main characteristic of the disorder. Malabsorption syndrome with steatorrhea and growth retardation is usually seen in chylomicron retention disease.
Chylomicrons are the transport lipids that primarily involved in carrying of dietary lipids such as triglyceride-rich lipoproteins which are secreted generally from the enterocytes. It is produced in the endoplasmic reticulum of the absorptive cells (enterocytes) of the small intestine. These large lipoproteins range from 700 to 6000 Å size which contains a single molecule of apolipoprotein (apo) B-48. It is a sole molecule, essential for chylomicron structure organization. Apo B-100 is different which is found within very-low-density lipoproteins (VLDL) secreted by the liver and in low-density lipoprotein (LDL), a catabolic product of VLDL.
It is rarely diagnosed in infants presenting with failure to thrive and chronic diarrhea. Malabsorption syndrome with steatorrhea and growth retardation is usually seen in chylomicron retention disease. Steatorrhea is the excretion of abnormal quantities of fat with the feces owing to reduced absorption of fat by the intestine. If not treated, it can cause subsequent neurological impairment. Neurological signs, although variable, consisting most frequently of a loss of reflexes. There is little acanthocytosis (red blood cells appear like thorny), hypocholesterolemia, hypotriglyceridemia, lipid malabsorption, diarrhea, retinitis pigmentosa, and spinocerebellar degeneration are negative of chylomicron retention disease.
Chylomicron retention disease is usually caused by gene mutations, particularly in the SAR1B gene. The SAR1B gene has instruction for Sar1b protein, which is involved in chylomicron transport from the endoplasmic reticulum to the Golgi apparatus. In fact, Sar1-GTP forms a coating protein complex with two heterodimers Sec23/24 and Sec 13/31, which initiates budding and captures cargo to eject vesicles from the endoplasmic reticulum to the Golgi apparatus.
SAR1B gene mutations impair the release of chylomicrons into the bloodstream. A lack of chylomicrons in the blood prevents dietary fats and fat-soluble vitamins from being used by the body, leading to the nutritional and developmental problems seen in people with chylomicron retention disease.
Why Is It Referred To As Autosomal Recessive Pattern?
Chylomicron retention disease is a good example for inherited autosomal recessive pattern. The parents of an individual with an autosomal recessive condition typically do not show any signs or symptoms of the condition. To have an autosomal recessive disorder, entities must inherit two mutated genes, one from each parent. These conditions are commonly passed on by two carriers. Their health is not often pretentious, but they have one mutated gene (recessive gene) and one normal gene (dominant gene) for the condition. With each pregnancy, two carriers have a 25 percent chance of having an unaffected child with two normal genes, a 50 percent chance of having an unaffected child who is also a carrier and a 25 percent chance of having an affected child with two recessive genes.
|
State Before: ι : Type u_4
ι' : Type u_3
R : Type u_1
R₂ : Type ?u.370286
K : Type ?u.370289
M : Type u_2
M' : Type ?u.370295
M'' : Type ?u.370298
V : Type u
V' : Type ?u.370303
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : AddCommMonoid M'
inst✝ : Module R M'
b b₁ : Basis ι R M
i : ι
c : R
x : M
b' : Basis ι' R M'
e : ι ≃ ι'
⊢ sumCoords (reindex b e) = sumCoords b State After: case h
ι : Type u_4
ι' : Type u_3
R : Type u_1
R₂ : Type ?u.370286
K : Type ?u.370289
M : Type u_2
M' : Type ?u.370295
M'' : Type ?u.370298
V : Type u
V' : Type ?u.370303
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : AddCommMonoid M'
inst✝ : Module R M'
b b₁ : Basis ι R M
i : ι
c : R
x✝ : M
b' : Basis ι' R M'
e : ι ≃ ι'
x : M
⊢ ↑(sumCoords (reindex b e)) x = ↑(sumCoords b) x Tactic: ext x State Before: case h
ι : Type u_4
ι' : Type u_3
R : Type u_1
R₂ : Type ?u.370286
K : Type ?u.370289
M : Type u_2
M' : Type ?u.370295
M'' : Type ?u.370298
V : Type u
V' : Type ?u.370303
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : AddCommMonoid M'
inst✝ : Module R M'
b b₁ : Basis ι R M
i : ι
c : R
x✝ : M
b' : Basis ι' R M'
e : ι ≃ ι'
x : M
⊢ ↑(sumCoords (reindex b e)) x = ↑(sumCoords b) x State After: case h
ι : Type u_4
ι' : Type u_3
R : Type u_1
R₂ : Type ?u.370286
K : Type ?u.370289
M : Type u_2
M' : Type ?u.370295
M'' : Type ?u.370298
V : Type u
V' : Type ?u.370303
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : AddCommMonoid M'
inst✝ : Module R M'
b b₁ : Basis ι R M
i : ι
c : R
x✝ : M
b' : Basis ι' R M'
e : ι ≃ ι'
x : M
⊢ (Finsupp.sum (Finsupp.mapDomain (↑e) (↑b.repr x)) fun x => id) = Finsupp.sum (↑b.repr x) fun x => id Tactic: simp only [coe_sumCoords, repr_reindex] State Before: case h
ι : Type u_4
ι' : Type u_3
R : Type u_1
R₂ : Type ?u.370286
K : Type ?u.370289
M : Type u_2
M' : Type ?u.370295
M'' : Type ?u.370298
V : Type u
V' : Type ?u.370303
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : AddCommMonoid M'
inst✝ : Module R M'
b b₁ : Basis ι R M
i : ι
c : R
x✝ : M
b' : Basis ι' R M'
e : ι ≃ ι'
x : M
⊢ (Finsupp.sum (Finsupp.mapDomain (↑e) (↑b.repr x)) fun x => id) = Finsupp.sum (↑b.repr x) fun x => id State After: no goals Tactic: exact Finsupp.sum_mapDomain_index (fun _ => rfl) fun _ _ _ => rfl
|
{-# LANGUAGE CPP #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE DeriveDataTypeable, DeriveGeneric, GADTs, RecordWildCards #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
-- |
-- Module : Criterion.Types
-- Copyright : (c) 2009-2014 Bryan O'Sullivan
--
-- License : BSD-style
-- Maintainer : [email protected]
-- Stability : experimental
-- Portability : GHC
--
-- Types for benchmarking.
--
-- The core type is 'Benchmarkable', which admits both pure functions
-- and 'IO' actions.
--
-- For a pure function of type @a -> b@, the benchmarking harness
-- calls this function repeatedly, each time with a different 'Int64'
-- argument (the number of times to run the function in a loop), and
-- reduces the result the function returns to weak head normal form.
--
-- For an action of type @IO a@, the benchmarking harness calls the
-- action repeatedly, but does not reduce the result.
module Criterion.Types
(
-- * Configuration
Config(..)
, Verbosity(..)
-- * Benchmark descriptions
, Benchmarkable(..)
, Benchmark(..)
-- * Measurements
, Measured(..)
, fromInt
, toInt
, fromDouble
, toDouble
, measureAccessors
, measureKeys
, measure
, rescale
-- * Benchmark construction
, env
, envWithCleanup
, perBatchEnv
, perBatchEnvWithCleanup
, perRunEnv
, perRunEnvWithCleanup
, toBenchmarkable
, bench
, bgroup
, addPrefix
, benchNames
-- ** Evaluation control
, nf
, whnf
, nfIO
, whnfIO
-- * Result types
, Outliers(..)
, OutlierEffect(..)
, OutlierVariance(..)
, Regression(..)
, KDE(..)
, Report(..)
, SampleAnalysis(..)
, DataRecord(..)
) where
import Control.DeepSeq (NFData(rnf))
import Criterion.Measurement.Types
import Data.Aeson (FromJSON(..), ToJSON(..))
import Data.Binary (Binary(..), putWord8, getWord8)
import Data.Data (Data, Typeable)
import Data.Int (Int64)
import Data.Map (Map)
import GHC.Generics (Generic)
import Prelude ()
import Prelude.Compat
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Statistics.Types as St
import Statistics.Resampling.Bootstrap ()
-- | Control the amount of information displayed.
data Verbosity = Quiet
| Normal
| Verbose
deriving (Eq, Ord, Bounded, Enum, Read, Show, Typeable, Data,
Generic)
-- | Top-level benchmarking configuration.
data Config = Config {
confInterval :: St.CL Double
-- ^ Confidence interval for bootstrap estimation (greater than
-- 0, less than 1).
, timeLimit :: Double
-- ^ Number of seconds to run a single benchmark. (In practice,
-- execution time will very slightly exceed this limit.)
, resamples :: Int
-- ^ Number of resamples to perform when bootstrapping.
, regressions :: [([String], String)]
-- ^ Regressions to perform.
, rawDataFile :: Maybe FilePath
-- ^ File to write binary measurement and analysis data to. If
-- not specified, this will be a temporary file.
, reportFile :: Maybe FilePath
-- ^ File to write report output to, with template expanded.
, csvFile :: Maybe FilePath
-- ^ File to write CSV summary to.
, jsonFile :: Maybe FilePath
-- ^ File to write JSON-formatted results to.
, junitFile :: Maybe FilePath
-- ^ File to write JUnit-compatible XML results to.
, verbosity :: Verbosity
-- ^ Verbosity level to use when running and analysing
-- benchmarks.
, template :: FilePath
-- ^ Template file to use if writing a report.
} deriving (Eq, Read, Show, Typeable, Data, Generic)
-- | Outliers from sample data, calculated using the boxplot
-- technique.
data Outliers = Outliers {
samplesSeen :: !Int64
, lowSevere :: !Int64
-- ^ More than 3 times the interquartile range (IQR) below the
-- first quartile.
, lowMild :: !Int64
-- ^ Between 1.5 and 3 times the IQR below the first quartile.
, highMild :: !Int64
-- ^ Between 1.5 and 3 times the IQR above the third quartile.
, highSevere :: !Int64
-- ^ More than 3 times the IQR above the third quartile.
} deriving (Eq, Read, Show, Typeable, Data, Generic)
instance FromJSON Outliers
instance ToJSON Outliers
instance Binary Outliers where
put (Outliers v w x y z) = put v >> put w >> put x >> put y >> put z
get = Outliers <$> get <*> get <*> get <*> get <*> get
instance NFData Outliers
-- | A description of the extent to which outliers in the sample data
-- affect the sample mean and standard deviation.
data OutlierEffect = Unaffected -- ^ Less than 1% effect.
| Slight -- ^ Between 1% and 10%.
| Moderate -- ^ Between 10% and 50%.
| Severe -- ^ Above 50% (i.e. measurements
-- are useless).
deriving (Eq, Ord, Read, Show, Typeable, Data, Generic)
instance FromJSON OutlierEffect
instance ToJSON OutlierEffect
instance Binary OutlierEffect where
put Unaffected = putWord8 0
put Slight = putWord8 1
put Moderate = putWord8 2
put Severe = putWord8 3
get = do
i <- getWord8
case i of
0 -> return Unaffected
1 -> return Slight
2 -> return Moderate
3 -> return Severe
_ -> fail $ "get for OutlierEffect: unexpected " ++ show i
instance NFData OutlierEffect
instance Semigroup Outliers where
(<>) = addOutliers
instance Monoid Outliers where
mempty = Outliers 0 0 0 0 0
#if !(MIN_VERSION_base(4,11,0))
mappend = addOutliers
#endif
addOutliers :: Outliers -> Outliers -> Outliers
addOutliers (Outliers s a b c d) (Outliers t w x y z) =
Outliers (s+t) (a+w) (b+x) (c+y) (d+z)
{-# INLINE addOutliers #-}
-- | Analysis of the extent to which outliers in a sample affect its
-- standard deviation (and to some extent, its mean).
data OutlierVariance = OutlierVariance {
ovEffect :: OutlierEffect
-- ^ Qualitative description of effect.
, ovDesc :: String
-- ^ Brief textual description of effect.
, ovFraction :: Double
-- ^ Quantitative description of effect (a fraction between 0 and 1).
} deriving (Eq, Read, Show, Typeable, Data, Generic)
instance FromJSON OutlierVariance
instance ToJSON OutlierVariance
instance Binary OutlierVariance where
put (OutlierVariance x y z) = put x >> put y >> put z
get = OutlierVariance <$> get <*> get <*> get
instance NFData OutlierVariance where
rnf OutlierVariance{..} = rnf ovEffect `seq` rnf ovDesc `seq` rnf ovFraction
-- | Results of a linear regression.
data Regression = Regression {
regResponder :: String
-- ^ Name of the responding variable.
, regCoeffs :: Map String (St.Estimate St.ConfInt Double)
-- ^ Map from name to value of predictor coefficients.
, regRSquare :: St.Estimate St.ConfInt Double
-- ^ R² goodness-of-fit estimate.
} deriving (Eq, Read, Show, Typeable, Generic)
instance FromJSON Regression
instance ToJSON Regression
instance Binary Regression where
put Regression{..} =
put regResponder >> put regCoeffs >> put regRSquare
get = Regression <$> get <*> get <*> get
instance NFData Regression where
rnf Regression{..} =
rnf regResponder `seq` rnf regCoeffs `seq` rnf regRSquare
-- | Result of a bootstrap analysis of a non-parametric sample.
data SampleAnalysis = SampleAnalysis {
anRegress :: [Regression]
-- ^ Estimates calculated via linear regression.
, anMean :: St.Estimate St.ConfInt Double
-- ^ Estimated mean.
, anStdDev :: St.Estimate St.ConfInt Double
-- ^ Estimated standard deviation.
, anOutlierVar :: OutlierVariance
-- ^ Description of the effects of outliers on the estimated
-- variance.
} deriving (Eq, Read, Show, Typeable, Generic)
instance FromJSON SampleAnalysis
instance ToJSON SampleAnalysis
instance Binary SampleAnalysis where
put SampleAnalysis{..} = do
put anRegress; put anMean; put anStdDev; put anOutlierVar
get = SampleAnalysis <$> get <*> get <*> get <*> get
instance NFData SampleAnalysis where
rnf SampleAnalysis{..} =
rnf anRegress `seq` rnf anMean `seq`
rnf anStdDev `seq` rnf anOutlierVar
-- | Data for a KDE chart of performance.
data KDE = KDE {
kdeType :: String
, kdeValues :: U.Vector Double
, kdePDF :: U.Vector Double
} deriving (Eq, Read, Show, Typeable, Data, Generic)
instance FromJSON KDE
instance ToJSON KDE
instance Binary KDE where
put KDE{..} = put kdeType >> put kdeValues >> put kdePDF
get = KDE <$> get <*> get <*> get
instance NFData KDE where
rnf KDE{..} = rnf kdeType `seq` rnf kdeValues `seq` rnf kdePDF
-- | Report of a sample analysis.
data Report = Report {
reportNumber :: Int
-- ^ A simple index indicating that this is the /n/th report.
, reportName :: String
-- ^ The name of this report.
, reportKeys :: [String]
-- ^ See 'measureKeys'.
, reportMeasured :: V.Vector Measured
-- ^ Raw measurements.
, reportAnalysis :: SampleAnalysis
-- ^ Report analysis.
, reportOutliers :: Outliers
-- ^ Analysis of outliers.
, reportKDEs :: [KDE]
-- ^ Data for a KDE of times.
} deriving (Eq, Read, Show, Typeable, Generic)
instance FromJSON Report
instance ToJSON Report
instance Binary Report where
put Report{..} =
put reportNumber >> put reportName >> put reportKeys >>
put reportMeasured >> put reportAnalysis >> put reportOutliers >>
put reportKDEs
get = Report <$> get <*> get <*> get <*> get <*> get <*> get <*> get
instance NFData Report where
rnf Report{..} =
rnf reportNumber `seq` rnf reportName `seq` rnf reportKeys `seq`
rnf reportMeasured `seq` rnf reportAnalysis `seq` rnf reportOutliers `seq`
rnf reportKDEs
data DataRecord = Measurement Int String (V.Vector Measured)
| Analysed Report
deriving (Eq, Read, Show, Typeable, Generic)
instance Binary DataRecord where
put (Measurement i n v) = putWord8 0 >> put i >> put n >> put v
put (Analysed r) = putWord8 1 >> put r
get = do
w <- getWord8
case w of
0 -> Measurement <$> get <*> get <*> get
1 -> Analysed <$> get
_ -> error ("bad tag " ++ show w)
instance NFData DataRecord where
rnf (Measurement i n v) = rnf i `seq` rnf n `seq` rnf v
rnf (Analysed r) = rnf r
instance FromJSON DataRecord
instance ToJSON DataRecord
|
[STATEMENT]
lemma CDERIV_inverse_fun:
"DERIV f x :> d \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> DERIV (\<lambda>x. inverse (f x)) x :> - (d * inverse ((f x)\<^sup>2))"
for x :: complex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>(f has_field_derivative d) (at x); f x \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. inverse (f x)) has_field_derivative - (d * inverse ((f x)\<^sup>2))) (at x)
[PROOF STEP]
unfolding numeral_2_eq_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>(f has_field_derivative d) (at x); f x \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. inverse (f x)) has_field_derivative - (d * inverse (f x ^ Suc (Suc 0)))) (at x)
[PROOF STEP]
by (rule DERIV_inverse_fun)
|
[STATEMENT]
lemma "OFCLASS('a::type, type_class)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. OFCLASS('a, type_class)
[PROOF STEP]
refute [expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. OFCLASS('a, type_class)
[PROOF STEP]
by intro_classes
|
section \<open>Correctness\<close>
subsection \<open>Well-formed queries\<close>
theory Generic_Join_Correctness
imports Generic_Join
begin
definition wf_set :: "nat \<Rightarrow> vertices \<Rightarrow> bool" where
"wf_set n V \<longleftrightarrow> (\<forall>x\<in>V. x < n)"
definition wf_atable :: "nat \<Rightarrow> 'a atable \<Rightarrow> bool" where
"wf_atable n X \<longleftrightarrow> table n (fst X) (snd X) \<and> finite (fst X)"
definition wf_query :: "nat \<Rightarrow> vertices \<Rightarrow> 'a query \<Rightarrow> 'a query \<Rightarrow> bool" where
"wf_query n V Q_pos Q_neg \<longleftrightarrow> (\<forall>X\<in>(Q_pos \<union> Q_neg). wf_atable n X) \<and> (wf_set n V) \<and> (card Q_pos \<ge> 1)"
definition included :: "vertices \<Rightarrow> 'a query \<Rightarrow> bool" where
"included V Q \<longleftrightarrow> (\<forall>(S, X)\<in>Q. S \<subseteq> V)"
definition covering :: "vertices \<Rightarrow> 'a query \<Rightarrow> bool" where
"covering V Q \<longleftrightarrow> V \<subseteq> (\<Union>(S, X)\<in>Q. S)"
definition non_empty_query :: "'a query \<Rightarrow> bool" where
"non_empty_query Q = (\<forall>X\<in>Q. card (fst X) \<ge> 1)"
definition rwf_query :: "nat \<Rightarrow> vertices \<Rightarrow> 'a query \<Rightarrow> 'a query \<Rightarrow> bool" where
"rwf_query n V Qp Qn \<longleftrightarrow> wf_query n V Qp Qn \<and> covering V Qp \<and> included V Qp \<and> included V Qn
\<and> non_empty_query Qp \<and> non_empty_query Qn"
lemma wf_tuple_empty: "wf_tuple n {} v \<longleftrightarrow> v = replicate n None"
by (auto intro!: replicate_eqI simp add: wf_tuple_def in_set_conv_nth)
lemma table_empty: "table n {} X \<longleftrightarrow> (X = empty_table \<or> X = unit_table n)"
by (auto simp add: wf_tuple_empty unit_table_def table_def)
context getIJ begin
lemma isSame_equi_dev:
assumes "wf_set n V"
assumes "wf_tuple n A t1"
assumes "wf_tuple n B t2"
assumes "s \<subseteq> A"
assumes "s \<subseteq> B"
assumes "A \<subseteq> V"
assumes "B \<subseteq> V"
shows "isSameIntersection t1 s t2 = (restrict s t1 = restrict s t2)"
proof -
have "(\<forall>i\<in>s. t1!i = t2!i) \<longleftrightarrow> (restrict s t1 = restrict s t2)" (is "?A \<longleftrightarrow> ?B")
proof -
have "?B \<Longrightarrow> ?A"
proof -
assume "?B"
have "\<And>i. i\<in>s \<Longrightarrow> t1!i = t2!i"
proof -
fix i assume "i \<in> s"
then have "i \<in> A" using assms(4) by blast
then have "i < n" using assms(1) assms(6) wf_set_def by auto
then show "t1!i = t2!i" by (metis (no_types, lifting) \<open>i \<in> s\<close> \<open>restrict s t1 = restrict s t2\<close>
assms(2) length_restrict nth_restrict wf_tuple_length)
qed
then show "?A" by blast
qed
moreover have "?A \<Longrightarrow> ?B"
proof -
assume "?A"
obtain "length (restrict s t1) = n" "length (restrict s t2) = n"
using assms(2) assms(3) length_restrict wf_tuple_length by blast
then have "\<And>i. i < n \<Longrightarrow> (restrict s t1)!i = (restrict s t2)!i"
proof -
fix i assume "i < n"
then show "(restrict s t1)!i = (restrict s t2)!i"
proof (cases "i \<in> s")
case True
then show ?thesis by (metis \<open>\<forall>i\<in>s. t1 ! i = t2 ! i\<close> \<open>i < n\<close> \<open>length (restrict s t1) = n\<close>
\<open>length (restrict s t2) = n\<close> length_restrict nth_restrict)
next
case False
then show ?thesis
by (metis (no_types, hide_lams) \<open>i < n\<close> assms(2) assms(3) assms(4) assms(5) wf_tuple_def
wf_tuple_restrict_simple)
qed
qed
then show "?B"
by (metis \<open>length (restrict s t1) = n\<close> \<open>length (restrict s t2) = n\<close> nth_equalityI)
qed
then show ?thesis using calculation by linarith
qed
then show ?thesis by simp
qed
lemma wf_getIJ:
assumes "card V \<ge> 2"
assumes "wf_set n V"
assumes "(I, J) = getIJ Q_pos Q_neg V"
shows "wf_set n I" and "wf_set n J"
using assms unfolding wf_set_def by (metis Un_iff coreProperties)+
lemma wf_projectTable:
assumes "wf_atable n X"
shows "wf_atable n (projectTable I X) \<and> (fst (projectTable I X) = (fst X \<inter> I))"
proof -
obtain Y where "Y = projectTable I X" by simp
obtain sX tX where "(sX, tX) = X" by (metis surj_pair)
moreover obtain S where "S = I \<inter> sX" by simp
moreover obtain sY tY where "(sY, tY) = Y" by (metis surj_pair)
then have "sY = S"
using calculation(1) calculation(2) \<open>Y = projectTable I X\<close> by auto
then have "\<And>t. t \<in> tY \<Longrightarrow> wf_tuple n S t"
proof -
fix t assume "t \<in> tY"
obtain x where "x \<in> tX" "t = restrict I x" using \<open>(sY, tY) = Y\<close> \<open>t \<in> tY\<close> \<open>Y = projectTable I X\<close> calculation(1) by auto
then have "wf_tuple n sX x"
proof -
have "table n sX tX" using assms(1) calculation(1) wf_atable_def by fastforce
then show ?thesis using \<open>x \<in> tX\<close> table_def by blast
qed
then show "wf_tuple n S t" using \<open>t = restrict I x\<close> calculation(2) wf_tuple_restrict by blast
qed
then have "\<forall>t \<in> tY. wf_tuple n S t" by blast
then have "table n S tY" using table_def by blast
then show ?thesis
by (metis \<open>(sY, tY) = Y\<close> \<open>Y = projectTable I X\<close> \<open>sY = S\<close> assms calculation(1) calculation(2) finite_Int fst_conv inf_commute snd_conv wf_atable_def)
qed
lemma set_filterQuery:
assumes "QQ = filterQuery I Q"
assumes "non_empty_query Q"
shows "\<forall>X\<in>Q. (card (fst X \<inter> I) \<ge> 1 \<longleftrightarrow> X \<in> QQ)"
proof -
have "\<And>X. X \<in> Q \<Longrightarrow> (card (fst X \<inter> I) \<ge> 1 \<longleftrightarrow> X \<in> QQ)"
proof -
fix X assume "X \<in> Q"
have "card (fst X \<inter> I) \<ge> 1 \<Longrightarrow> X \<in> QQ"
proof -
assume "card (fst X \<inter> I) \<ge> 1"
then have "(\<lambda>(s, _). s \<inter> I \<noteq> {}) X" by force
then show ?thesis by (simp add: \<open>case X of (s, uu_) \<Rightarrow> s \<inter> I \<noteq> {}\<close> Set.is_empty_def \<open>X \<in> Q\<close> assms(1))
qed
moreover have "X \<in> QQ \<Longrightarrow> card (fst X \<inter> I) \<ge> 1"
proof -
assume "X \<in> QQ"
have "(\<lambda>(s, _). s \<inter> I \<noteq> {}) X" using Set.is_empty_def \<open>X \<in> QQ\<close> assms(1) by auto
then have "fst X \<inter> I \<noteq> {}" by (simp add: case_prod_beta')
then show ?thesis
by (metis One_nat_def Suc_leI \<open>X \<in> Q\<close> assms(2) card.infinite card_gt_0_iff finite_Int non_empty_query_def)
qed
then show "(card (fst X \<inter> I) \<ge> 1 \<longleftrightarrow> X \<in> QQ)"
using calculation by blast
qed
then show ?thesis by blast
qed
lemma wf_filterQuery:
assumes "I \<subseteq> V"
assumes "card I \<ge> 1"
assumes "rwf_query n V Qp Qn"
assumes "QQp = filterQuery I Qp"
assumes "QQn = filterQueryNeg I Qn"
shows "wf_query n I QQp QQn" "non_empty_query QQp" "covering I QQp"
proof -
show "non_empty_query QQp"
by (metis assms(3) assms(4) filterQuery.simps member_filter non_empty_query_def rwf_query_def)
show "covering I QQp"
proof -
have "\<forall>X\<in>Qp. (card (fst X \<inter> I) \<ge> 1 \<longleftrightarrow> X \<in> QQp)"
using set_filterQuery assms(3) assms(4) rwf_query_def by fastforce
have "(\<Union>(S, X)\<in>Qp. S) \<inter> I \<subseteq> (\<Union>(S, _)\<in>QQp. S)" (is "?A \<inter> I \<subseteq> ?B")
proof (rule subsetI)
fix x assume "x \<in> ?A \<inter> I"
have "x \<in> ?A" using \<open>x \<in> (\<Union>(S, X)\<in>Qp. S) \<inter> I\<close> by blast
then obtain S X where "(S, X) \<in> Qp" and "x \<in> S" by blast
moreover have "(S, X) \<in> QQp" by (metis Int_iff One_nat_def Suc_le_eq
\<open>\<forall>X\<in>Qp. (1 \<le> card (fst X \<inter> I)) = (X \<in> QQp)\<close> \<open>x \<in> (\<Union>(S, X)\<in>Qp. S) \<inter> I\<close> assms(2)
calculation(1) calculation(2) card_gt_0_iff empty_iff finite_Int fst_conv)
ultimately show "x \<in> ?B" by auto
qed
then show ?thesis
by (metis (mono_tags, lifting) assms(1) assms(3) covering_def inf.absorb_iff2 le_infI1 rwf_query_def)
qed
show "wf_query n I QQp QQn"
proof -
have "(\<forall>X\<in>QQp. wf_atable n X)"
using assms(3) assms(4) rwf_query_def wf_query_def by fastforce
moreover have "(wf_set n I)"
by (meson assms(1) assms(3) rwf_query_def subsetD wf_query_def wf_set_def)
moreover have "card QQp \<ge> 1"
proof -
have "covering I QQp" by (simp add: \<open>covering I QQp\<close>)
have "\<not> (Set.is_empty QQp)"
proof (rule ccontr)
assume "\<not> (\<not> (Set.is_empty QQp))"
have "Set.is_empty QQp" using \<open>\<not> \<not> Set.is_empty QQp\<close> by auto
have "(\<Union>(S, X)\<in>QQp. S) = {}" by (metis SUP_empty Set.is_empty_def \<open>Set.is_empty QQp\<close>)
then show "False"
by (metis \<open>covering I QQp\<close> assms(2) card_eq_0_iff covering_def not_one_le_zero subset_empty)
qed
moreover have "finite QQp"
by (metis assms(3) assms(4) card_infinite filterQuery.simps finite_filter not_one_le_zero rwf_query_def wf_query_def)
then show ?thesis
by (metis One_nat_def Set.is_empty_def Suc_leI calculation card_gt_0_iff)
qed
moreover have "QQn \<subseteq> Qn"
proof -
have "QQn = filterQueryNeg I Qn" by (simp add: assms(5))
then show ?thesis by auto
qed
moreover have "wf_query n I QQp Qn"
by (meson Un_iff assms(3) calculation(1) calculation(2) calculation(3) rwf_query_def wf_query_def)
then have "(\<forall>X\<in>Qn. wf_atable n X)" by (simp add: wf_query_def)
then show ?thesis
by (meson \<open>wf_query n I QQp Qn\<close> calculation(4) subset_eq sup_mono wf_query_def)
qed
qed
lemma wf_set_subset:
assumes "I \<subseteq> V"
assumes "card I \<ge> 1"
assumes "wf_set n V"
shows "wf_set n I"
using assms(1) assms(3) wf_set_def by auto
lemma wf_projectQuery:
assumes "card I \<ge> 1"
assumes "wf_query n I Q Qn"
assumes "non_empty_query Q"
assumes "covering I Q"
assumes "\<forall>X\<in>Q. card (fst X \<inter> I) \<ge> 1"
assumes "QQ = projectQuery I Q"
assumes "included I Qn"
assumes "non_empty_query Qn"
shows "rwf_query n I QQ Qn"
proof -
have "wf_query n I QQ Qn"
proof -
have "\<forall>X\<in>QQ. wf_atable n X" using assms(2) assms(6) wf_query_def
by (simp add: wf_projectTable wf_query_def)
moreover have "wf_set n I" using assms(2) wf_query_def by blast
moreover have "card QQ \<ge> 1"
proof -
have "card QQ = card (Set.image (projectTable I) Q)" by (simp add: assms(6))
then show ?thesis
by (metis One_nat_def Suc_le_eq assms(2) card_gt_0_iff finite_imageI image_is_empty wf_query_def)
qed
then show ?thesis by (metis Un_iff assms(2) calculation(1) wf_query_def)
qed
moreover have "covering I QQ"
proof -
have "I \<subseteq> (\<Union>(S, X)\<in>Q. S)" using assms(4) covering_def by auto
moreover have "(\<Union>(S, X)\<in>Q. S \<inter> I) \<subseteq> (\<Union>(S, X)\<in>QQ. S)"
proof (rule subsetI)
fix x assume "x \<in> (\<Union>(S, X)\<in>Q. S \<inter> I)"
obtain S X where "(S, X) \<in> Q" and "x \<in> S \<inter> I" using \<open>x \<in> (\<Union>(S, X)\<in>Q. S \<inter> I)\<close> by blast
then have "fst (projectTable I (S, X)) = S \<inter> I" by simp
have "wf_atable n (S, X)" using \<open>(S, X) \<in> Q\<close> assms(2) wf_query_def by blast
then have "wf_atable n (projectTable I (S, X))" using wf_projectTable by blast
then show "x \<in> (\<Union>(S, X)\<in>QQ. S)" using \<open>(S, X) \<in> Q\<close> \<open>x \<in> S \<inter> I\<close> assms(6) by fastforce
qed
moreover have "(\<Union>(S, X)\<in>Q. S \<inter> I) = (\<Union>(S, X)\<in>Q. S) \<inter> I" by blast
then show ?thesis using calculation(1) calculation(2) covering_def inf_absorb2 by fastforce
qed
moreover have "included I QQ"
proof -
have "\<And>S X. (S, X) \<in> QQ \<Longrightarrow> S \<subseteq> I"
proof -
fix S X assume "(S, X) \<in> QQ"
have "(S, X) \<in> Set.image (projectTable I) Q" using \<open>(S, X) \<in> QQ\<close> assms(6) by simp
obtain XX where "XX \<in> Q" and "(S, X) = projectTable I XX" using \<open>(S, X) \<in> projectTable I ` Q\<close> by blast
then have "S = I \<inter> (fst XX)"
by (metis projectTable.simps fst_conv inf_commute prod.collapse)
then show "S \<subseteq> I" by simp
qed
then have "(\<forall>(S, X)\<in>QQ. S \<subseteq> I)" by blast
then show ?thesis by (simp add: included_def)
qed
moreover have "non_empty_query QQ" using assms(5) assms(6) non_empty_query_def by fastforce
then show ?thesis
by (simp add: assms(7) assms(8) calculation(1) calculation(2) calculation(3) rwf_query_def)
qed
lemma wf_firstRecursiveCall:
assumes "rwf_query n V Qp Qn"
assumes "card V \<ge> 2"
assumes "(I, J) = getIJ Qp Qn V"
assumes "Q_I_pos = projectQuery I (filterQuery I Qp)"
assumes "Q_I_neg = filterQueryNeg I Qn"
shows "rwf_query n I Q_I_pos Q_I_neg"
proof -
obtain "I \<subseteq> V" "card I \<ge> 1" using assms(2) assms(3) getIJProperties(5) getIJProperties(1) by fastforce
define tQ where "tQ = filterQuery I Qp"
obtain "wf_query n I tQ Q_I_neg" "non_empty_query tQ" "covering I tQ"
by (metis wf_filterQuery(1) wf_filterQuery(2) wf_filterQuery(3)
\<open>1 \<le> card I\<close> \<open>I \<subseteq> V\<close> assms(1) assms(5) tQ_def)
moreover obtain "card I \<ge> 1" and "\<forall>X\<in>tQ. card (fst X \<inter> I) \<ge> 1"
using set_filterQuery \<open>1 \<le> card I\<close> assms(1) rwf_query_def tQ_def by fastforce
moreover have "included I Q_I_neg" by (simp add: assms(5) included_def)
then show ?thesis
by (metis wf_projectQuery \<open>\<And>thesis. (\<lbrakk>wf_query n I tQ Q_I_neg; non_empty_query tQ; covering I tQ\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close>
assms(1) assms(4) assms(5) calculation(4) calculation(5) filterQueryNeg.simps member_filter non_empty_query_def rwf_query_def tQ_def)
qed
lemma wf_atable_subset:
assumes "table n V X"
assumes "Y \<subseteq> X"
shows "table n V Y"
by (meson assms(1) assms(2) subsetD table_def)
lemma same_set_semiJoin:
"fst (semiJoin x other) = fst x"
proof -
obtain sx tx where "x = (sx, tx)" by (metis surj_pair)
obtain so to where "other = (so, to)" by (metis surj_pair)
then show ?thesis by (simp add: \<open>x = (sx, tx)\<close>)
qed
lemma wf_semiJoin:
assumes "card J \<ge> 1"
assumes "wf_query n J Q Qn"
assumes "non_empty_query Q"
assumes "covering J Q"
assumes "\<forall>X\<in>Q. card (fst X \<inter> J) \<ge> 1"
assumes "QQ = (Set.image (\<lambda>tab. semiJoin tab (st, t)) Q)"
shows "wf_query n J QQ Qn" "non_empty_query QQ" "covering J QQ"
proof -
show "wf_query n J QQ Qn"
proof -
have "\<forall>X\<in>QQ. wf_atable n X"
proof -
have "\<And>X. X\<in>QQ \<Longrightarrow> wf_atable n X"
proof -
fix X assume "X \<in> QQ"
obtain Y where "Y \<in> Q" and "X = semiJoin Y (st, t)" using \<open>X \<in> QQ\<close> assms(6) by blast
then have "wf_atable n Y" using assms(2) wf_query_def by blast
then show "wf_atable n X"
proof -
have "fst X = fst Y"
by (metis \<open>X = semiJoin Y (st, t)\<close> fst_conv prod.collapse semiJoin.simps)
moreover have "snd X \<subseteq> snd Y"
by (metis \<open>X = semiJoin Y (st, t)\<close> member_filter prod.collapse semiJoin.simps snd_conv subsetI)
then have "table n (fst X) (snd X)" by (metis \<open>wf_atable n Y\<close> calculation wf_atable_def wf_atable_subset)
moreover have "finite (fst X)" by (metis \<open>wf_atable n Y\<close> calculation(1) wf_atable_def)
then show ?thesis by (simp add: calculation(2) wf_atable_def)
qed
qed
then show ?thesis by blast
qed
moreover have "wf_set n J" using assms(2) wf_query_def by blast
moreover have "card QQ \<ge> 1"
by (metis One_nat_def Suc_leI assms(2) assms(6) card.infinite card_gt_0_iff finite_imageI image_is_empty wf_query_def)
then show ?thesis using calculation(1) calculation(2) wf_query_def Un_iff assms(2) by metis
qed
show "non_empty_query QQ"
by (metis (no_types, lifting) assms(3) assms(6) image_iff non_empty_query_def same_set_semiJoin)
show "covering J QQ"
proof -
have "(\<Union>(S, X)\<in>Q. S) = (\<Union>(S, X)\<in>QQ. S)" using assms(6) same_set_semiJoin by auto
then show ?thesis by (metis assms(4) covering_def)
qed
qed
lemma newQuery_equiv_def:
"newQuery V Q (st, t) = projectQuery V (Set.image (\<lambda>tab. semiJoin tab (st, t)) Q)"
by (metis image_image newQuery.simps projectQuery.elims)
lemma included_project:
"included V (projectQuery V Q)"
proof -
have "\<And>S X. (S, X)\<in>(projectQuery V Q) \<Longrightarrow> S \<subseteq> V"
proof -
fix S X assume "(S, X)\<in>(projectQuery V Q)"
obtain SS XX where "(S, X) = projectTable V (SS, XX)"
using \<open>(S, X) \<in> projectQuery V Q\<close> by auto
then have "S = SS \<inter> V" by auto
then show "S \<subseteq> V" by simp
qed
then show ?thesis by (metis case_prodI2 included_def)
qed
lemma non_empty_newQuery:
assumes "Q1 = filterQuery J Q0"
assumes "Q2 = newQuery J Q1 (I, t)"
assumes "\<forall>X\<in>Q0. wf_atable n X"
shows "non_empty_query Q2"
proof -
have "\<And>X. X\<in>Q2 \<Longrightarrow> card (fst X) \<ge> 1"
proof -
fix X assume "X \<in> Q2"
obtain X2 where "X = projectTable J X2" and "X2 \<in> Set.image (\<lambda>tab. semiJoin tab (I, t)) Q1"
by (metis (mono_tags, lifting) newQuery.simps \<open>X \<in> Q2\<close> assms(2) image_iff)
then have "card (fst X2 \<inter> J) \<ge> 1"
proof -
obtain X1 where "X1 \<in> Q1" and "X2 = semiJoin X1 (I, t)"
using \<open>X2 \<in> (\<lambda>tab. semiJoin tab (I, t)) ` Q1\<close> by blast
then have "fst X1 = fst X2" by (simp add: same_set_semiJoin)
moreover have "X1 \<in> filterQuery J Q0" using \<open>X1 \<in> Q1\<close> assms(1) by blast
then have "(\<lambda>(s, _). s \<inter> J \<noteq> {}) X1" using Set.is_empty_def by auto
then have "\<not> (Set.is_empty (fst X1 \<inter> J))" by (simp add: Set.is_empty_def case_prod_beta')
then show ?thesis
by (metis filterQuery.elims One_nat_def Set.is_empty_def Suc_leI \<open>X1 \<in> Q1\<close> assms(1)
assms(3) calculation card_gt_0_iff finite_Int member_filter wf_atable_def)
qed
then show "card (fst X) \<ge> 1"
by (metis projectTable.simps \<open>X = projectTable J X2\<close> fst_conv prod.collapse)
qed
then show ?thesis by (simp add: non_empty_query_def)
qed
lemma wf_newQuery:
assumes "card J \<ge> 1"
assumes "wf_query n J Q Qn0"
assumes "non_empty_query Q"
assumes "covering J Q"
assumes "\<forall>X\<in>Q. card (fst X \<inter> J) \<ge> 1"
assumes "QQ = newQuery J Q t"
assumes "QQn = newQuery J Qn t"
assumes "non_empty_query Qn"
assumes "Qn = filterQuery J Qn0"
shows "rwf_query n J QQ QQn"
proof -
obtain tt st where "(st, tt) = t" by (metis surj_pair)
have "QQ = projectQuery J (Set.image (\<lambda>tab. semiJoin tab (st, tt)) Q)"
by (metis \<open>(st, tt) = t\<close> assms(6) newQuery_equiv_def)
define QS where "QS = Set.image (\<lambda>tab. semiJoin tab (st, tt)) Q"
obtain "wf_query n J QS Qn0" "non_empty_query QS" "covering J QS"
by (metis wf_semiJoin(1) wf_semiJoin(2) wf_semiJoin(3) QS_def
assms(1) assms(2) assms(3) assms(4) assms(5))
moreover have "\<forall>X\<in>QS. card (fst X \<inter> J) \<ge> 1" using QS_def assms(5) by auto
then have "\<forall>X\<in>(projectQuery J QS). wf_atable n X"
by (metis (no_types, lifting) projectQuery.simps Un_iff calculation(1) image_iff
wf_projectTable wf_query_def)
then have "wf_query n J QQ QQn"
proof -
have "\<And>X. X\<in>QQn \<Longrightarrow> wf_atable n X"
proof -
fix X assume "X \<in> QQn"
have "QQn = projectQuery J (Set.image (\<lambda>tab. semiJoin tab (st, tt)) Qn)"
using newQuery_equiv_def \<open>(st, tt) = t\<close> assms(7) by blast
then obtain XX where "X = projectTable J XX" "XX \<in> (Set.image (\<lambda>tab. semiJoin tab (st, tt)) Qn)"
using \<open>X \<in> QQn\<close> by auto
then obtain XXX where "XX = semiJoin XXX (st, tt)" "XXX \<in> Qn" by blast
then have "wf_atable n XXX"
by (metis filterQuery.elims Un_iff assms(2) assms(9) member_filter wf_query_def)
then have "wf_atable n XX"
proof -
have "fst XX = fst XXX"
by (simp add: same_set_semiJoin \<open>XX = semiJoin XXX (st, tt)\<close>)
moreover have "snd XX = Set.filter (isSameIntersection tt (fst XX \<inter> st)) (snd XXX)"
by (metis semiJoin.simps \<open>XX = semiJoin XXX (st, tt)\<close> calculation prod.collapse snd_conv)
moreover have "snd XX \<subseteq> snd XXX" using calculation(2) by auto
then show ?thesis
by (metis wf_atable_subset \<open>wf_atable n XXX\<close> calculation(1) wf_atable_def)
qed
then show "wf_atable n X" by (simp add: wf_projectTable \<open>X = projectTable J XX\<close>)
qed
then have "\<forall>X\<in>QQn. wf_atable n X" by blast
then have "\<forall>X\<in>(QQ \<union> QQn). wf_atable n X"
using QS_def \<open>QQ = projectQuery J ((\<lambda>tab. semiJoin tab (st, tt)) ` Q)\<close> \<open>\<forall>X\<in>projectQuery J QS. wf_atable n X\<close> by blast
moreover have "card QQ \<ge> 1"
by (metis (no_types, lifting) newQuery.simps One_nat_def Suc_leI \<open>(st, tt) = t\<close> assms(2)
assms(6) card.infinite card_gt_0_iff finite_imageI image_is_empty wf_query_def)
then show ?thesis using assms(2) calculation wf_query_def by blast
qed
moreover have "included J QQn"
proof -
have "QQn = projectQuery J (Set.image (\<lambda>tab. semiJoin tab (st, tt)) Qn)"
using newQuery_equiv_def \<open>(st, tt) = t\<close> assms(7) by blast
then show ?thesis using included_project by blast
qed
moreover have "covering J QQ"
proof -
have "QQ = projectQuery J ((\<lambda>tab. semiJoin tab (st, tt)) `Q)"
using \<open>QQ = projectQuery J ((\<lambda>tab. semiJoin tab (st, tt)) ` Q)\<close> by blast
then have "covering J ((\<lambda>tab. semiJoin tab (st, tt)) `Q)" using QS_def calculation(3) by blast
then have "J \<subseteq> (\<Union>(S, X)\<in>(((\<lambda>tab. semiJoin tab (st, tt)) `Q)). S)"
by (simp add: covering_def)
then have "J \<subseteq> (\<Union>(S, X)\<in>(((\<lambda>tab. semiJoin tab (st, tt)) `Q)). S) \<inter> J" by blast
moreover have "(\<Union>(S, X)\<in>(((\<lambda>tab. semiJoin tab (st, tt)) `Q)). S) \<inter> J \<subseteq> (\<Union>(S, X)\<in>(((\<lambda>tab. semiJoin tab (st, tt)) `Q)). S \<inter> J)"
using image_cong by auto
then have "(\<Union>(S, X)\<in>((\<lambda>tab. semiJoin tab (st, tt)) `Q). S) \<inter> J \<subseteq> (\<Union>(S, X)\<in>(projectQuery J ((\<lambda>tab. semiJoin tab (st, tt)) `Q)). S)"
by auto
then show ?thesis
by (metis \<open>J \<subseteq> (\<Union>(S, X)\<in>(\<lambda>tab. semiJoin tab (st, tt)) ` Q. S)\<close> \<open>QQ = projectQuery J ((\<lambda>tab. semiJoin tab (st, tt)) ` Q)\<close> covering_def inf_absorb2)
qed
moreover have "non_empty_query QQ" using QS_def \<open>QQ = projectQuery J ((\<lambda>tab. semiJoin tab (st, tt)) ` Q)\<close>
\<open>\<forall>X\<in>QS. 1 \<le> card (fst X \<inter> J)\<close> non_empty_query_def by fastforce
moreover have "non_empty_query QQn"
by (metis non_empty_newQuery Un_iff \<open>(st, tt) = t\<close> assms(7) assms(9) calculation(1) wf_query_def)
then show ?thesis
using included_project \<open>QQ = projectQuery J ((\<lambda>tab. semiJoin tab (st, tt)) ` Q)\<close>
calculation(4) calculation(5) calculation(6) calculation(7) rwf_query_def by blast
qed
lemma subset_Q_neg:
assumes "rwf_query n V Q Qn"
assumes "QQn \<subseteq> Qn"
shows "rwf_query n V Q QQn"
proof -
have "wf_query n V Q QQn"
proof -
have "\<forall>X\<in>QQn. wf_atable n X" by (meson Un_iff assms(1) assms(2) rwf_query_def subsetD wf_query_def)
then show ?thesis
by (meson UnE UnI1 assms(1) rwf_query_def wf_query_def)
qed
moreover have "included V QQn" by (meson assms(1) assms(2) included_def rwf_query_def subsetD)
then show ?thesis by (metis (full_types) assms(2) non_empty_query_def subsetD assms(1) calculation rwf_query_def)
qed
lemma wf_secondRecursiveCalls:
assumes "card V \<ge> 2"
assumes "rwf_query n V Q Qn"
assumes "(I, J) = getIJ Q Qn V"
assumes "Qns \<subseteq> Qn"
assumes "Q_J_neg = filterQuery J Qns"
assumes "Q_J_pos = filterQuery J Q"
shows "rwf_query n J (newQuery J Q_J_pos t) (newQuery J Q_J_neg t)"
proof -
have "\<forall>X\<in>Q_J_pos. card (fst X \<inter> J) \<ge> 1"
using set_filterQuery assms(2) assms(6) rwf_query_def by fastforce
moreover have "card J \<ge> 1" by (metis assms(1) assms(3) getIJ.coreProperties getIJ_axioms)
moreover have "wf_query n J Q_J_pos Qns"
proof -
have "wf_query n J Q Qns"
by (metis subset_Q_neg wf_set_subset assms(1) assms(2) assms(3) assms(4)
getIJ.coreProperties getIJ_axioms rwf_query_def sup_ge2 wf_query_def)
moreover have "Q_J_pos \<subseteq> Q" using assms(6) by auto
then have "\<forall>X\<in>(Q_J_pos \<union> Qns). wf_atable n X" using calculation wf_query_def by fastforce
moreover have "card Q_J_pos \<ge> 1"
by (metis wf_filterQuery(1) assms(1) assms(2) assms(3) assms(6) getIJ.coreProperties
getIJ_axioms sup_ge2 wf_query_def)
then show ?thesis using calculation(1) calculation(2) wf_query_def by blast
qed
moreover have "non_empty_query Q_J_pos"
by (metis wf_filterQuery(2) assms(1) assms(2) assms(3) assms(6) getIJ.coreProperties
getIJ_axioms sup_ge2)
moreover have "covering J Q_J_pos"
by (metis wf_filterQuery(3) assms(1) assms(2) assms(3) assms(6) getIJ.coreProperties
getIJ_axioms sup_ge2)
moreover have "non_empty_query Q_J_neg"
by (metis (no_types, lifting) filterQuery.elims assms(2) assms(4) assms(5) member_filter
non_empty_query_def rwf_query_def subsetD)
then show ?thesis
using wf_newQuery assms(5) calculation(1) calculation(2) calculation(3) calculation(4)
calculation(5) by blast
qed
lemma simple_merge_option:
"merge_option (a, b) = None \<longleftrightarrow> (a = None \<and> b = None)"
using merge_option.elims by blast
lemma wf_merge:
assumes "wf_tuple n I t1"
assumes "wf_tuple n J t2"
assumes "V = I \<union> J"
assumes "t = merge t1 t2"
shows "wf_tuple n V t"
proof -
have "\<And>i. i < n \<Longrightarrow> (t ! i = None \<longleftrightarrow> i \<notin> V)"
proof -
fix i
assume "i < n"
show "t ! i = None \<longleftrightarrow> i \<notin> V"
proof (cases "t ! i = None")
case True
have "t = merge t1 t2" by (simp add: assms(4))
then have "... = map merge_option (zip t1 t2)" by simp
then have "merge_option (t1 ! i, t2 ! i) = None"
by (metis True \<open>i < n\<close> assms(1) assms(2) assms(4) length_zip min_less_iff_conj nth_map nth_zip wf_tuple_def)
obtain "t1 ! i = None" and "t2 ! i = None"
by (meson \<open>merge_option (t1 ! i, t2 ! i) = None\<close> simple_merge_option)
then show ?thesis
using True \<open>i < n\<close> assms(1) assms(2) assms(3) wf_tuple_def by auto
next
case False
have "t = map merge_option (zip t1 t2)" by (simp add: assms(4))
then obtain x where "merge_option (t1 ! i, t2 ! i) = Some x"
by (metis False \<open>i < n\<close> assms(1) assms(2) length_zip merge_option.elims min_less_iff_conj nth_map nth_zip wf_tuple_def)
then show ?thesis
by (metis False UnI1 UnI2 \<open>i < n\<close> assms(1) assms(2) assms(3) option.distinct(1) simple_merge_option wf_tuple_def)
qed
qed
moreover have "length t = n"
proof -
obtain "length t1 = n" and "length t2 = n"
using assms(1) assms(2) wf_tuple_def by blast
then have "length (zip t1 t2) = n" by simp
then show ?thesis by (simp add: assms(4))
qed
then show ?thesis by (simp add: calculation wf_tuple_def)
qed
lemma wf_inter:
assumes "rwf_query n {i} Q Qn"
assumes "(sa, a) \<in> Q"
assumes "(sb, b) \<in> Q"
shows "table n {i} (a \<inter> b)"
proof -
obtain "card sa \<ge> 1" "card sb \<ge> 1"
by (metis assms(1) assms(2) assms(3) fst_conv non_empty_query_def rwf_query_def)
have "included {i} Q" using assms(1) rwf_query_def by blast
then have "(\<forall>(S, X)\<in>Q. S \<subseteq> {i})" by (simp add: included_def)
then obtain "sa \<subseteq> {i}" "sb \<subseteq> {i}" using assms(2) assms(3) by blast
then obtain "sa = {i}" "sb = {i}"
by (metis \<open>1 \<le> card sa\<close> \<open>1 \<le> card sb\<close> card_empty not_one_le_zero subset_singletonD)
then show ?thesis
using assms(1) assms(2) inf_le1 prod.sel(1) prod.sel(2) rwf_query_def wf_atable_def
wf_atable_subset wf_query_def Un_iff by metis
qed
lemma table_subset:
assumes "table n V T"
assumes "S \<subseteq> T"
shows "table n V S"
using wf_atable_subset assms(1) assms(2) by blast
lemma wf_base_case:
assumes "card V = 1"
assumes "rwf_query n V Q Qn"
assumes "R = genericJoin V Q Qn"
shows "table n V R"
proof -
have "wf_query n V Q Qn \<and> included V Q \<and> non_empty_query Q \<Longrightarrow> table n V ((\<Inter>(_, x) \<in> Q. x) - (\<Union>(_, x) \<in> Qn. x))"
proof (induction "card Q - 1" arbitrary: Q)
case 0
have "card Q = 1"
by (metis "0.hyps" "0.prems" One_nat_def le_add_diff_inverse plus_1_eq_Suc wf_query_def)
obtain s x where "Q = {(s, x)}"
by (metis One_nat_def \<open>card Q = 1\<close> card_eq_0_iff card_eq_SucD card_mono finite_insert insertE
nat.simps(3) not_one_le_zero subrelI)
moreover obtain i where "V = {i}" using assms(1) card_1_singletonE by auto
then have "card s \<ge> 1"
proof -
have "(s, x) \<in> Q" by (simp add: calculation)
moreover obtain X where "X = (s, x)" by simp
then show ?thesis
using "0.prems" calculation non_empty_query_def rwf_query_def by fastforce
qed
moreover obtain i where "V = {i}" using \<open>\<And>thesis. (\<And>i. V = {i} \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close> by blast
then have "s = {i}"
proof -
have "included {i} Q" using "0.prems" \<open>V = {i}\<close> rwf_query_def by simp
then show ?thesis
by (metis \<open>V = {i}\<close> assms(1) calculation(1) calculation(2) card_seteq case_prodD finite.emptyI finite.insertI included_def singletonI)
qed
moreover have "table n s x"
using "0.prems" calculation(1) rwf_query_def wf_atable_def wf_query_def
by (simp add: rwf_query_def wf_atable_def wf_query_def)
then show ?case
by (simp add: wf_atable_subset \<open>V = {i}\<close> calculation(1) calculation(3))
next
case (Suc y)
obtain xx where "xx \<in> Q" by (metis Suc.hyps(2) all_not_in_conv card.empty nat.simps(3) zero_diff)
moreover obtain H where "H = Q - {xx}" by simp
then have "card H - 1 = y"
by (metis Suc.hyps(2) calculation card_Diff_singleton card_infinite diff_Suc_1 less_imp_le not_one_le_zero zero_less_Suc zero_less_diff)
moreover have "wf_query n V H Qn \<and> included V H \<and> non_empty_query H"
proof -
have "wf_query n V H Qn"
using DiffD1 Suc.hyps(2) Suc.prems \<open>H = Q - {xx}\<close> calculation(1) card_Diff_singleton
card_infinite le_add1 not_one_le_zero plus_1_eq_Suc wf_query_def
by (metis (no_types, lifting) Un_iff)
then show ?thesis
using DiffD1 Suc.prems \<open>H = Q - {xx}\<close> included_def non_empty_query_def by fastforce
qed
then have "wf_query n V H Qn \<and> included V H \<and> non_empty_query H" by simp
then have "table n V ((\<Inter>(_, x)\<in>H. x) - (\<Union>(_, x)\<in>Qn. x))" using Suc.hyps(1) calculation(2) by simp
moreover obtain sa a where "(sa, a) \<in> H"
by (metis One_nat_def Suc.hyps(2) \<open>H = Q - {xx}\<close> calculation(1) calculation(2) card_empty card_eq_0_iff card_le_Suc0_iff_eq diff_is_0_eq' equals0I insert_Diff le0 nat.simps(3) prod.collapse singletonD)
moreover have "\<not> (Set.is_empty sa)"
by (metis Set.is_empty_def \<open>wf_query n V H Qn \<and> included V H \<and> non_empty_query H\<close> calculation(4)
card_empty non_empty_query_def not_one_le_zero prod.sel(1))
then have "table n V (((\<Inter>(_, x) \<in> H. x) \<inter> (snd xx)) - (\<Union>(_, x)\<in>Qn. x))"
by (metis Diff_Int2 Diff_Int_distrib2 IntE calculation(3) table_def)
then show ?case using INF_insert Int_commute \<open>H = Q - {xx}\<close> calculation(1) insert_Diff snd_def by metis
qed
then show ?thesis
using assms(1) assms(2) assms(3) genericJoin.simps le_numeral_extra(4) rwf_query_def by auto
qed
lemma filter_Q_J_neg_same:
assumes "card V \<ge> 2"
assumes "(I, J) = getIJ Q Qn V"
assumes "Q_I_neg = filterQueryNeg I Qn"
assumes "rwf_query n V Q Qn"
shows "filterQuery J (Qn - Q_I_neg) = Qn - Q_I_neg" (is "?A = ?B")
proof-
have "?A \<subseteq> ?B" by (simp add: subset_iff)
moreover have "?B \<subseteq> ?A"
proof (rule subsetI)
fix x assume "x \<in> Qn - Q_I_neg"
obtain A X where "(A, X) = x" by (metis surj_pair)
have "card (A \<inter> J) \<ge> 1"
proof (rule ccontr)
assume "\<not> (card (A \<inter> J) \<ge> 1)"
have "Set.is_empty (A \<inter> J)"
by (metis One_nat_def Set.is_empty_def Suc_leI Suc_le_lessD \<open>\<not> 1 \<le> card (A \<inter> J)\<close> assms(1)
assms(2) card_gt_0_iff finite_Int getIJ.coreProperties getIJ_axioms)
moreover have "A \<subseteq> I"
proof -
have "(A, X) \<in> Qn" using \<open>(A, X) = x\<close> \<open>x \<in> Qn - Q_I_neg\<close> by auto
then have "included V Qn" using assms(4) rwf_query_def by blast
then have "A \<subseteq> V" using \<open>(A, X) \<in> Qn\<close> included_def by fastforce
then show ?thesis
by (metis Set.is_empty_def UnE assms(1) assms(2) calculation disjoint_iff_not_equal
getIJProperties(5) subsetD subsetI)
qed
then have "(A, X) \<in> Q_I_neg" using \<open>(A, X) = x\<close> \<open>x \<in> Qn - Q_I_neg\<close> assms(3) by auto
then show "False" using \<open>(A, X) = x\<close> \<open>x \<in> Qn - Q_I_neg\<close> by blast
qed
then show "x \<in> ?A" using \<open>(A, X) = x\<close> \<open>x \<in> Qn - Q_I_neg\<close>
by (metis Diff_subset subset_Q_neg assms(4) fst_conv rwf_query_def set_filterQuery)
qed
then show ?thesis by auto
qed
lemma vars_genericJoin:
assumes "card V \<ge> 2"
assumes "(I, J) = getIJ Q Qn V"
assumes "Q_I_pos = projectQuery I (filterQuery I Q)"
assumes "Q_I_neg = filterQueryNeg I Qn"
assumes "R_I = genericJoin I Q_I_pos Q_I_neg"
assumes "Q_J_neg = filterQuery J (Qn - Q_I_neg)"
assumes "Q_J_pos = filterQuery J Q"
assumes "X = {(t, genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) | t . t \<in> R_I}"
assumes "R = (\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x})"
assumes "rwf_query n V Q Qn"
shows "R = genericJoin V Q Qn"
proof -
have "filterQuery J (Qn - Q_I_neg) = Qn - Q_I_neg"
using assms(1) assms(10) assms(2) assms(4) filter_Q_J_neg_same by blast
then have "Q_J_neg = Qn - Q_I_neg" by (simp add: assms(6))
moreover have "genericJoin V Q Qn =
(if card V \<le> 1 then
(\<Inter>(_, x) \<in> Q. x) - (\<Union>(_, x) \<in> Qn. x)
else
let (I, J) = getIJ Q Qn V in
let Q_I_pos = projectQuery I (filterQuery I Q) in
let Q_I_neg = filterQueryNeg I Qn in
let R_I = genericJoin I Q_I_pos Q_I_neg in
let Q_J_neg = Qn - Q_I_neg in
let Q_J_pos = filterQuery J Q in
let X = {(t, genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) | t . t \<in> R_I} in
(\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x}))"
by simp
moreover have "\<not> (card V \<le> 1)" using assms(1) by linarith
then have gen: "genericJoin V Q Qn = (let (I, J) = getIJ Q Qn V in
let Q_I_pos = projectQuery I (filterQuery I Q) in
let Q_I_neg = filterQueryNeg I Qn in
let R_I = genericJoin I Q_I_pos Q_I_neg in
let Q_J_neg = Qn - Q_I_neg in
let Q_J_pos = filterQuery J Q in
let X = {(t, genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) | t . t \<in> R_I} in
(\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x}))"
using assms by simp
then have "... = (
let Q_I_pos = projectQuery I (filterQuery I Q) in
let Q_I_neg = filterQueryNeg I Qn in
let R_I = genericJoin I Q_I_pos Q_I_neg in
let Q_J_neg = Qn - Q_I_neg in
let Q_J_pos = filterQuery J Q in
let X = {(t, genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) | t . t \<in> R_I} in
(\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x}))"
using assms(2) by (metis (no_types, lifting) case_prod_conv)
then show ?thesis using assms by (metis calculation(1) gen)
qed
lemma base_genericJoin:
assumes "card V \<le> 1"
shows "genericJoin V Q Qn = (\<Inter>(_, x) \<in> Q. x) - (\<Union>(_, x) \<in> Qn. x)"
proof -
have "genericJoin V Q Qn =
(if card V \<le> 1 then
(\<Inter>(_, x) \<in> Q. x) - (\<Union>(_, x) \<in> Qn. x)
else
let (I, J) = getIJ Q Qn V in
let Q_I_pos = projectQuery I (filterQuery I Q) in
let Q_I_neg = filterQueryNeg I Qn in
let R_I = genericJoin I Q_I_pos Q_I_neg in
let Q_J_neg = Qn - Q_I_neg in
let Q_J_pos = filterQuery J Q in
let X = {(t, genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) | t . t \<in> R_I} in
(\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x}))"
by simp
then show ?thesis using assms by auto
qed
lemma wf_genericJoin:
"\<lbrakk>rwf_query n V Q Qn; card V \<ge> 1\<rbrakk> \<Longrightarrow> table n V (genericJoin V Q Qn)"
proof (induction V Q Qn rule: genericJoin.induct)
case (1 V Q Qn)
then show ?case
proof (cases "card V \<le> 1")
case True
then show ?thesis using "1.prems"(1) "1.prems"(2) le_antisym wf_base_case by blast
next
case False
obtain I J where "(I, J) = getIJ Q Qn V" by (metis surj_pair)
define Q_I_pos where "Q_I_pos = projectQuery I (filterQuery I Q)"
define Q_I_neg where "Q_I_neg = filterQueryNeg I Qn"
define R_I where "R_I = genericJoin I Q_I_pos Q_I_neg"
define Q_J_neg where "Q_J_neg = filterQuery J (Qn - Q_I_neg)"
define Q_J_pos where "Q_J_pos = filterQuery J Q"
define X where "X = {(t, genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) | t . t \<in> R_I}"
define R where "R = (\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x})"
moreover have "card V \<ge> 2" using False by auto
then have "R = genericJoin V Q Qn"
using vars_genericJoin[where ?V=V and ?I=I and ?J=J and ?Q_I_pos=Q_I_pos and ?Q=Q and ?Qn=Qn and
?Q_I_neg=Q_I_neg and ?R_I=R_I and ?Q_J_neg=Q_J_neg and ?Q_J_pos=Q_J_pos]
using "1.prems"(1) Q_I_neg_def Q_I_pos_def Q_J_neg_def Q_J_pos_def R_I_def X_def \<open>(I, J) = getIJ Q Qn V\<close> calculation by blast
obtain "card I \<ge> 1" "card J \<ge> 1"
using \<open>(I, J) = getIJ Q Qn V\<close> \<open>2 \<le> card V\<close> getIJ.getIJProperties(1) getIJProperties(2) getIJ_axioms by blast
moreover have "rwf_query n I Q_I_pos Q_I_neg"
using "1.prems"(1) Q_I_neg_def Q_I_pos_def \<open>(I, J) = getIJ Q Qn V\<close> \<open>2 \<le> card V\<close> getIJ.wf_firstRecursiveCall getIJ_axioms by blast
moreover have "\<And>t. t\<in>R_I \<Longrightarrow> table n J (genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t)))"
proof -
fix t assume "t \<in> R_I"
have "rwf_query n J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))"
using "1.prems"(1) Q_J_neg_def Q_J_pos_def \<open>(I, J) = getIJ Q Qn V\<close> \<open>2 \<le> card V\<close>
getIJ.wf_secondRecursiveCalls getIJ_axioms by fastforce
then show "table n J (genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t)))"
by (metis "1.IH"(2) "1.prems"(1) False Q_I_neg_def Q_J_neg_def Q_J_pos_def \<open>(I, J) = getIJ Q Qn V\<close>
\<open>2 \<le> card V\<close> calculation(3) filter_Q_J_neg_same)
qed
then have "\<And>t xx. t \<in> R_I \<and> xx \<in> (genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t)))
\<Longrightarrow> wf_tuple n V (merge xx t)"
proof -
fix t xx assume "t \<in> R_I \<and> xx \<in> genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))"
have "V = I \<union> J"
using \<open>(I, J) = getIJ Q Qn V\<close> \<open>2 \<le> card V\<close> getIJ.coreProperties getIJ_axioms by metis
moreover have "wf_tuple n J xx"
using \<open>\<And>t. t \<in> R_I \<Longrightarrow> table n J (genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t)))\<close>
\<open>t \<in> R_I \<and> xx \<in> genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))\<close> table_def by blast
moreover have "wf_tuple n I t"
by (metis "1.IH"(1) False Q_I_neg_def Q_I_pos_def
R_I_def \<open>(I, J) = getIJ Q Qn V\<close> \<open>\<And>thesis. (\<lbrakk>1 \<le> card I; 1 \<le> card J\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close>
\<open>rwf_query n I Q_I_pos Q_I_neg\<close> \<open>t \<in> R_I \<and> xx \<in> genericJoin J (newQuery J Q_J_pos (I, t))
(newQuery J Q_J_neg (I, t))\<close> table_def)
then show "wf_tuple n V (merge xx t)"
by (metis calculation(1) calculation(2) sup_commute wf_merge)
qed
then have "\<forall>t\<in>R_I. \<forall>xx \<in> (genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))).
wf_tuple n V (merge xx t)" by blast
then have "\<forall>x\<in>R. wf_tuple n V x" using R_def X_def by blast
then show ?thesis using \<open>R = genericJoin V Q Qn\<close> table_def by blast
qed
qed
subsection \<open>Correctness\<close>
lemma simple_list_index_equality:
assumes "length a = n"
assumes "length b = n"
assumes "\<forall>i < n. a!i = b!i"
shows "a = b"
using assms(1) assms(2) assms(3) nth_equalityI by force
lemma simple_restrict_none:
assumes "i < length X"
assumes "i \<notin> A"
shows "(restrict A X)!i = None"
by (simp add: assms(1) assms(2) restrict_def)
lemma simple_restrict_some:
assumes "i < length X"
assumes "i \<in> A"
shows "(restrict A X)!i = X!i"
by (simp add: assms(1) assms(2) restrict_def)
lemma merge_restrict:
assumes "A \<inter> J = {}"
assumes "A \<subseteq> I"
assumes "length xx = n"
assumes "length t = n"
assumes "restrict J xx = xx"
shows "restrict A (merge xx t) = restrict A t"
proof -
have "\<And>i. i < n \<Longrightarrow> (restrict A (merge xx t))!i = (restrict A t)!i"
proof -
fix i assume "i < n"
show "(restrict A (merge xx t))!i = (restrict A t)!i"
proof (cases "i \<in> A")
case True
have "(restrict A t)!i = t!i" by (simp add: True \<open>i < n\<close> assms(4) nth_restrict)
moreover have "(restrict A (merge xx t))!i = t!i"
proof -
have "xx!i = None"
by (metis True \<open>i < n\<close> assms(1) assms(3) assms(5) disjoint_iff_not_equal simple_restrict_none)
obtain "length xx = length t" by (simp add: assms(3) assms(4))
moreover have "(merge xx t)!i = merge_option (xx!i, t!i)"
using \<open>i < n\<close> \<open>length xx = length t\<close> assms(3) by auto
moreover have "merge_option (None, t!i) = t!i"
by (metis merge_option.simps(1) merge_option.simps(3) option.exhaust)
then have "(merge xx t)!i = t!i" using \<open>xx ! i = None\<close> calculation(2) by auto
moreover have "(restrict A (merge xx t))!i = (merge xx t)!i"
proof -
have "length (zip xx t) = n" using assms(3) calculation(1) by auto
then have "length (merge xx t) = n" by simp
then show ?thesis by (simp add: True \<open>i < n\<close> nth_restrict)
qed
then show ?thesis using calculation(3) by auto
qed
then show ?thesis by (simp add: calculation)
next
case False
have "(restrict A t)!i = None" by (simp add: False \<open>i < n\<close> assms(4) restrict_def)
obtain "length xx = n" and "length t = n"
by (simp add: assms(3) assms(4))
then have "length (merge xx t) = n" by simp
moreover have "(restrict A (merge xx t))!i = None"
using False \<open>i < n\<close> calculation simple_restrict_none by blast
then show ?thesis by (simp add: \<open>restrict A t ! i = None\<close>)
qed
qed
then have "\<forall>i < n. (restrict A (merge xx t))!i = (restrict A t)!i" by blast
then show ?thesis using simple_list_index_equality[where ?a="restrict A (merge xx t)" and ?b="restrict A t" and ?n="n"]
assms(3) assms(4) by simp
qed
lemma restrict_idle_include:
assumes "wf_tuple n A v"
assumes "A \<subseteq> I"
shows "restrict I v = v"
proof -
have "\<And>i. i < length v \<Longrightarrow> (restrict I v)!i = v!i"
proof -
fix i assume "i < length v"
show "(restrict I v)!i = v!i"
proof (cases "i \<in> A")
case True
then show ?thesis using \<open>i < length v\<close> assms(2) nth_restrict by blast
next
case False
then show ?thesis by (metis \<open>i < length v\<close> assms(1) nth_restrict simple_restrict_none wf_tuple_def)
qed
qed
then show ?thesis by (simp add: list_eq_iff_nth_eq)
qed
lemma merge_index:
assumes "I \<inter> J = {}"
assumes "wf_tuple n I tI"
assumes "wf_tuple n J tJ"
assumes "t = merge tI tJ"
assumes "i < n"
shows "(i \<in> I \<and> t!i = tI!i) \<or> (i \<in> J \<and> t!i = tJ!i) \<or> (i \<notin> I \<and> i \<notin> J \<and> t!i = None)"
proof -
have "t!i = merge_option ((zip tI tJ)!i)"
by (metis (full_types) assms(2) assms(3) assms(4) assms(5) length_zip merge.simps
min_less_iff_conj nth_map wf_tuple_def)
then have "t!i = merge_option (tI!i, tJ!i)" by (metis assms(2) assms(3) assms(5) nth_zip wf_tuple_def)
then show ?thesis
proof (cases "i \<in> I")
case True
have "t!i = tI!i"
proof -
have "tJ!i = None" by (meson True assms(1) assms(3) assms(5) disjoint_iff_not_equal wf_tuple_def)
moreover have "merge_option (tI!i, None) = tI!i"
by (metis True assms(2) assms(5) merge_option.simps(2) option.exhaust wf_tuple_def)
then show ?thesis by (simp add: \<open>t ! i = merge_option (tI ! i, tJ ! i)\<close> calculation)
qed
then show ?thesis using True by blast
next
case False
have "i \<notin> I" by (simp add: False)
then show ?thesis
proof (cases "i \<in> J")
case True
have "t!i = tJ!i"
proof -
have "tI!i = None" using False assms(2) assms(5) wf_tuple_def by blast
moreover have "merge_option (None, tJ!i) = tJ!i"
by (metis True assms(3) assms(5) merge_option.simps(3) option.exhaust wf_tuple_def)
then show ?thesis by (simp add: \<open>t ! i = merge_option (tI ! i, tJ ! i)\<close> calculation)
qed
then show ?thesis using True by blast
next
case False
obtain "tI!i = None" and "tJ!i = None " by (meson False \<open>i \<notin> I\<close> assms(2) assms(3) assms(5) wf_tuple_def)
have "t!i = None"
by (simp add: \<open>t ! i = merge_option (tI ! i, tJ ! i)\<close> \<open>tI ! i = None\<close> \<open>tJ ! i = None\<close>)
then show ?thesis using False \<open>i \<notin> I\<close> by blast
qed
qed
qed
lemma restrict_index_in:
assumes "i < length X"
assumes "i \<in> I"
shows "(restrict I X)!i = X!i"
by (simp add: assms(1) assms(2) nth_restrict)
lemma restrict_index_out:
assumes "i < length X"
assumes "i \<notin> I"
shows "(restrict I X)!i = None"
by (simp add: assms(1) assms(2) simple_restrict_none)
lemma merge_length:
assumes "length a = n"
assumes "length b = n"
shows "length (merge a b) = n"
by (simp add: assms(1) assms(2))
lemma real_restrict_merge:
assumes "I \<inter> J = {}"
assumes "wf_tuple n I tI"
assumes "wf_tuple n J tJ"
shows "restrict I (merge tI tJ) = restrict I tI \<and> restrict J (merge tI tJ) = restrict J tJ"
proof -
have "length (merge tI tJ) = n"
using assms(2) assms(3) merge_length wf_tuple_def by blast
have "\<And>i. i < n \<Longrightarrow> (restrict I (merge tI tJ))!i = (restrict I tI)!i
\<and> (restrict J (merge tI tJ))!i = (restrict J tJ)!i"
proof -
fix i assume "i < n"
show "(restrict I (merge tI tJ))!i = (restrict I tI)!i \<and> (restrict J (merge tI tJ))!i = (restrict J tJ)!i"
proof (cases "i \<in> I")
case True
have "(merge tI tJ)!i = tI!i"
by (meson True \<open>i < n\<close> assms(1) assms(2) assms(3) disjoint_iff_not_equal merge_index)
then have "(restrict I (merge tI tJ))!i = tI!i"
by (metis True \<open>i < n\<close> \<open>length (merge tI tJ) = n\<close> simple_restrict_some)
then show ?thesis
by (metis True \<open>i < n\<close> \<open>length (merge tI tJ) = n\<close> assms(1) assms(2) assms(3) disjoint_iff_not_equal restrict_idle simple_restrict_none wf_tuple_def)
next
case False
have "i \<notin> I" by (simp add: False)
then show ?thesis
proof (cases "i \<in> J")
case True
have "(merge tI tJ)!i = tJ!i"
using True \<open>i < n\<close> assms(1) assms(2) assms(3) merge_index by blast
then show ?thesis
by (metis (no_types, lifting) False \<open>i < n\<close> \<open>length (merge tI tJ) = n\<close> assms(2) assms(3) simple_restrict_none simple_restrict_some wf_tuple_def)
next
case False
have "(merge tI tJ)!i = None" using False \<open>i < n\<close> \<open>i \<notin> I\<close> assms(1) assms(2) assms(3) merge_index by blast
then show ?thesis
by (metis False \<open>i < n\<close> \<open>i \<notin> I\<close> \<open>length (merge tI tJ) = n\<close> assms(2) assms(3) eq_iff equalityD1 restrict_idle_include simple_restrict_none wf_tuple_def wf_tuple_restrict_simple)
qed
qed
qed
then obtain "\<forall>i < n. (restrict I (merge tI tJ))!i = (restrict I tI)!i"
and "\<forall>i < n. (restrict J (merge tI tJ))!i = (restrict J tJ)!i" by blast
moreover have "length (merge tI tJ) = n" by (meson assms(2) assms(3) wf_merge wf_tuple_def)
moreover obtain "length (restrict I tI) = n" and "length (restrict J tJ) = n"
using assms(2) assms(3) wf_tuple_def by auto
then show ?thesis
by (metis \<open>\<And>i. i < n \<Longrightarrow> restrict I (merge tI tJ) ! i = restrict I tI ! i \<and> restrict J (merge tI tJ) ! i = restrict J tJ ! i\<close> calculation(3) length_restrict simple_list_index_equality)
qed
lemma simple_set_image_id:
assumes "\<forall>x\<in>X. f x = x"
shows "Set.image f X = X"
proof -
have "Set.image f X = {f x |x. x \<in> X}" by (simp add: Setcompr_eq_image)
then have "... = {x |x. x \<in> X}" by (simp add: assms)
moreover have "... = X" by simp
then show ?thesis by (simp add: \<open>f ` X = {f x |x. x \<in> X}\<close> calculation)
qed
lemma nested_include_restrict:
assumes "restrict I z = t"
assumes "A \<subseteq> I"
shows "restrict A z = restrict A t"
proof -
have "length (restrict A z) = length (restrict A t)" using assms(1) by auto
moreover have "\<And>i. i < length (restrict A z) \<Longrightarrow> (restrict A z) ! i = (restrict A t) ! i"
proof -
fix i assume "i < length (restrict A z)"
then show "(restrict A z) ! i = (restrict A t) ! i"
proof (cases "i \<in> A")
case True
then show ?thesis
by (metis restrict_index_in \<open>i < length (restrict A z)\<close> assms(1) assms(2) length_restrict subsetD)
next
case False
then show ?thesis
by (metis simple_restrict_none \<open>i < length (restrict A z)\<close> calculation length_restrict)
qed
qed
ultimately show ?thesis by (simp add: list_eq_iff_nth_eq)
qed
lemma restrict_nested:
"restrict A (restrict B x) = restrict (A \<inter> B) x" (is "?lhs = ?rhs")
proof -
have "\<And>i. i < length x \<Longrightarrow> ?lhs!i = ?rhs!i"
by (metis Int_iff length_restrict restrict_index_in simple_restrict_none)
then show ?thesis by (simp add: simple_list_index_equality)
qed
lemma newQuery_equi_dev:
"newQuery V Q (I, t) = Set.image (projectTable V) (Set.image (\<lambda>tab. semiJoin tab (I, t)) Q)"
by (metis newQuery_equiv_def projectQuery.elims)
lemma projectTable_idle:
assumes "table n A X"
assumes "A \<subseteq> I"
shows "projectTable I (A, X) = (A, X)"
proof -
have "projectTable I (A, X) = (A \<inter> I, Set.image (restrict I) X)"
using projectTable.simps by blast
then have "A \<inter> I = A" using assms(2) by blast
have "\<And>x. x \<in> X \<Longrightarrow> (restrict I) x = x"
proof -
fix x assume "x \<in> X"
have "wf_tuple n A x" using \<open>x \<in> X\<close> assms(1) table_def by blast
then show "(restrict I) x = x" using assms(2) restrict_idle_include by blast
qed
then have "\<forall>x \<in> X. (restrict I) x = x" by blast
moreover have "Set.image (restrict I) X = X"
by (simp add: \<open>\<And>x. x \<in> X \<Longrightarrow> restrict I x = x\<close>)
then show ?thesis by (simp add: \<open>A \<inter> I = A\<close>)
qed
lemma restrict_partition_merge:
assumes "I \<union> J = V"
assumes "wf_tuple n V z"
assumes "xx = restrict J z"
assumes "t = restrict I z"
assumes "Set.is_empty (I \<inter> J)"
shows "z = merge xx t"
proof -
have "\<And>i. i < n \<Longrightarrow> z!i = (merge xx t)!i"
proof -
fix i assume "i < n"
show "z!i = (merge xx t)!i"
proof (cases "i \<in> I")
case True
have "z!i = t!i"
by (metis True \<open>i < n\<close> assms(2) assms(4) nth_restrict wf_tuple_def)
moreover have "(merge xx t)!i = t!i"
proof -
have "xx ! i = None"
by (metis simple_restrict_none Set.is_empty_def True \<open>i < n\<close> assms(2) assms(3) assms(5) disjoint_iff_not_equal wf_tuple_length)
moreover have "(merge xx t) ! i = merge_option (xx ! i, t ! i)" using \<open>i < n\<close> assms(2) assms(3) assms(4) wf_tuple_length by fastforce
ultimately show ?thesis
proof (cases "t ! i")
case None
then show ?thesis using \<open>merge xx t ! i = merge_option (xx ! i, t ! i)\<close> \<open>xx ! i = None\<close> by auto
next
case (Some a)
then show ?thesis using \<open>merge xx t ! i = merge_option (xx ! i, t ! i)\<close> \<open>xx ! i = None\<close> by auto
qed
qed
then show ?thesis by (simp add: calculation)
next
case False
have "i \<notin> I" by (simp add: False)
then show ?thesis
proof (cases "i \<in> J")
case True
have "z!i = xx!i"
by (metis True \<open>i < n\<close> assms(2) assms(3) nth_restrict wf_tuple_def)
moreover have "(merge xx t)!i = xx!i"
proof (cases "xx ! i")
case None
then show ?thesis by (metis True UnI1 \<open>i < n\<close> assms(1) assms(2) calculation sup_commute wf_tuple_def)
next
case (Some a)
have "t ! i = None" by (metis False simple_restrict_none \<open>i < n\<close> assms(2) assms(4) wf_tuple_length)
then show ?thesis using Some \<open>i < n\<close> assms(2) assms(3) assms(4) wf_tuple_length by fastforce
qed
then show ?thesis by (simp add: calculation)
next
case False
have "z!i = None" by (metis False UnE \<open>i < n\<close> \<open>i \<notin> I\<close> assms(1) assms(2) wf_tuple_def)
moreover have "(merge xx t)!i = None"
proof -
have "xx ! i = None"
by (metis False New_max.simple_restrict_none \<open>i < n\<close> assms(2) assms(3) wf_tuple_length)
moreover have "t ! i = None"
by (metis New_max.simple_restrict_none \<open>i < n\<close> \<open>i \<notin> I\<close> assms(2) assms(4) wf_tuple_length)
ultimately show ?thesis using \<open>i < n\<close> assms(2) assms(3) assms(4) wf_tuple_length by fastforce
qed
then show ?thesis by (simp add: calculation)
qed
qed
qed
moreover have "length z = n" using assms(2) wf_tuple_def by blast
then show ?thesis
by (simp add: assms(3) assms(4) calculation simple_list_index_equality)
qed
lemma restrict_merge:
assumes "zI = restrict I z"
assumes "zJ = restrict J z"
assumes "restrict (A \<inter> I) zI \<in> Set.image (restrict I) X"
assumes "restrict (A \<inter> J) zJ \<in> Set.image (restrict J) (Set.filter (isSameIntersection zI (A \<inter> I)) X)"
assumes "z = merge zJ zI"
assumes "table n A X"
assumes "A \<subseteq> I \<union> J"
assumes "card (A \<inter> I) \<ge> 1"
assumes "wf_set n (I \<union> J)"
assumes "wf_tuple n (I \<union> J) z"
shows "restrict A z \<in> X"
proof -
define zAJ where "zAJ = restrict (A \<inter> J) zJ"
obtain zz where "zAJ = restrict J zz" "isSameIntersection zI (A \<inter> I) zz" "zz \<in> X"
using assms(4) zAJ_def by auto
then have "restrict (A \<inter> I) zz = restrict A zI"
proof -
have "restrict (A \<inter> I) zI = restrict (A \<inter> I) zz"
proof -
have "wf_set n A" using assms(7) assms(9) wf_set_def by auto
moreover have "wf_tuple n I zI" using assms(1) assms(10) wf_tuple_restrict_simple by auto
moreover have "wf_tuple n A zz" using \<open>zz \<in> X\<close> assms(6) table_def by blast
moreover obtain "A \<inter> I \<subseteq> A" "A \<inter> I \<subseteq> I" by simp
then show ?thesis using isSame_equi_dev[of n _ I zI A zz "A \<inter> I"]
using \<open>isSameIntersection zI (A \<inter> I) zz\<close> assms(7) assms(9) calculation(2) calculation(3) by blast
qed
then show ?thesis
by (simp add: restrict_nested assms(1))
qed
then have "zz = restrict A z"
proof -
have "length zz = n" using \<open>zz \<in> X\<close> assms(6) table_def wf_tuple_def by blast
moreover have "length (restrict A z) = n"
by (metis \<open>restrict (A \<inter> I) zz = restrict A zI\<close> assms(1) calculation length_restrict)
moreover have "\<And>i. i < n \<Longrightarrow> zz!i = (restrict A z)!i"
proof -
fix i assume "i < n"
show "zz!i = (restrict A z)!i"
proof (cases "i \<in> A")
case True
have "i \<in> A" using True by simp
then show ?thesis
proof (cases "i \<in> I")
case True
have "zz!i = (restrict (A \<inter> I) zz)!i"
by (simp add: True \<open>i < n\<close> \<open>i \<in> A\<close> calculation(1) restrict_index_in)
then have "... = (restrict A zI)!i" by (simp add: \<open>restrict (A \<inter> I) zz = restrict A zI\<close>)
then show ?thesis
by (metis True \<open>i < n\<close> \<open>i \<in> A\<close> \<open>zz ! i = restrict (A \<inter> I) zz ! i\<close> assms(1) calculation(2)
length_restrict restrict_index_in)
next
case False
have "zz!i = (restrict (A \<inter> J) zJ)!i"
by (metis False True UnE \<open>i < n\<close> \<open>zAJ = restrict J zz\<close> assms(7) calculation(1)
restrict_index_in subsetD zAJ_def)
then have "... = (restrict A zJ)!i" by (simp add: assms(2) restrict_nested)
then show ?thesis
by (metis False True UnE \<open>i < n\<close> \<open>zz ! i = restrict (A \<inter> J) zJ ! i\<close> assms(2) assms(7)
calculation(2) length_restrict restrict_index_in subsetD)
qed
next
case False
then show ?thesis
by (metis \<open>i < n\<close> \<open>zz \<in> X\<close> assms(6) calculation(2) length_restrict simple_restrict_none table_def wf_tuple_def)
qed
qed
then show ?thesis using calculation(1) calculation(2) simple_list_index_equality by blast
qed
then show ?thesis
using \<open>zz \<in> X\<close> by auto
qed
lemma partial_correctness:
assumes "V = I \<union> J"
assumes "Set.is_empty (I \<inter> J)"
assumes "card I \<ge> 1"
assumes "card J \<ge> 1"
assumes "Q_I_pos = projectQuery I (filterQuery I Q)"
assumes "Q_J_pos = filterQuery J Q"
assumes "Q_I_neg = filterQueryNeg I Qn"
assumes "Q_J_neg = filterQuery J (Qn - Q_I_neg)"
assumes "NQ_pos = newQuery J Q_J_pos (I, t)"
assumes "NQ_neg = newQuery J Q_J_neg (I, t)"
assumes "R_NQ = genericJoin J NQ_pos NQ_neg"
assumes "\<forall>x. (x \<in> R_I \<longleftrightarrow> wf_tuple n I x \<and> (\<forall>(A, X)\<in>Q_I_pos. restrict A x \<in> X) \<and> (\<forall>(A, X)\<in>Q_I_neg. restrict A x \<notin> X))"
assumes "\<forall>y. (y \<in> R_NQ \<longleftrightarrow> wf_tuple n J y \<and> (\<forall>(A, X)\<in>NQ_pos. restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>NQ_neg. restrict A y \<notin> X))"
assumes "z = merge xx t"
assumes "t \<in> R_I"
assumes "xx \<in> R_NQ"
assumes "rwf_query n V Q Qn"
shows "wf_tuple n V z \<and> (\<forall>(A, X)\<in>Q. restrict A z \<in> X) \<and> (\<forall>(A, X)\<in>Qn. restrict A z \<notin> X)"
proof -
obtain "wf_tuple n I t" "wf_tuple n J xx"
using assms(12) assms(13) assms(15) assms(16) by blast
then have "wf_tuple n V z"
by (metis wf_merge assms(1) assms(14) sup_commute)
moreover have "\<And>A X. (A, X) \<in> Qn \<Longrightarrow> restrict A z \<notin> X"
proof -
fix A X assume "(A, X) \<in> Qn"
have "restrict I (merge xx t) = restrict I t"
by (metis (no_types, lifting) Set.is_empty_def \<open>\<And>thesis. (\<lbrakk>wf_tuple n I t; wf_tuple n J xx\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close>
assms(2) merge_restrict restrict_idle sup.cobounded1 wf_tuple_def)
moreover have "restrict J (merge xx t) = restrict J xx"
by (metis Set.is_empty_def \<open>\<And>thesis. (\<lbrakk>wf_tuple n I t; wf_tuple n J xx\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close>
assms(2) inf_commute real_restrict_merge)
moreover have "restrict J xx = xx" using \<open>wf_tuple n J xx\<close> restrict_idle by auto
moreover have "restrict I t = t" using \<open>wf_tuple n I t\<close> restrict_idle by auto
then obtain "restrict I z = t" "restrict J z = xx"
using assms(14) calculation(1) calculation(2) calculation(3) by auto
moreover have "\<forall>(A, X)\<in>Q_I_pos. restrict A t \<in> X" using assms(12) assms(15) by blast
moreover have "\<forall>(A, X)\<in>NQ_pos. restrict A xx \<in> X" using assms(13) assms(16) by blast
moreover have "card A \<ge> 1"
using \<open>(A, X) \<in> Qn\<close> assms(17) non_empty_query_def rwf_query_def by fastforce
then show "restrict A z \<notin> X"
proof (cases "A \<subseteq> I")
case True
have "(A, X) \<in> Q_I_neg" by (simp add: True \<open>(A, X) \<in> Qn\<close> assms(7))
have "table n A X"
proof -
have "wf_query n V Q Qn" using assms(17) rwf_query_def by blast
moreover have "(A, X) \<in> (Q \<union> Qn)" by (simp add: \<open>(A, X) \<in> Qn\<close>)
then show ?thesis by (metis calculation fst_conv snd_conv wf_atable_def wf_query_def)
qed
then have "restrict A t \<notin> X" using \<open>(A, X) \<in> Q_I_neg\<close> assms(12) assms(15) by blast
moreover have "restrict A z = restrict A t" using True \<open>restrict I z = t\<close> nested_include_restrict by blast
then show ?thesis by (simp add: calculation)
next
case False
have "(A, X) \<in> Q_J_neg"
proof -
have "(A, X) \<in> Qn - Q_I_neg" using False \<open>(A, X) \<in> Qn\<close> assms(7) by auto
moreover have "card (A \<inter> J) \<ge> 1"
by (metis (no_types, lifting) False Int_greatest One_nat_def Set.is_empty_def Suc_leI
Suc_le_lessD \<open>(A, X) \<in> Qn\<close> assms(1) assms(17) assms(2) assms(4) card_gt_0_iff case_prodD
finite_Int included_def rwf_query_def sup_ge2 sup_inf_absorb sup_inf_distrib1)
then show ?thesis using assms(8) calculation
by (metis Diff_subset subset_Q_neg assms(17) fst_conv rwf_query_def set_filterQuery)
qed
define AI where "AI = A \<inter> I"
define AJ where "AJ = A \<inter> J"
then have "NQ_neg = projectQuery J (Set.image (\<lambda>tab. semiJoin tab (I, t)) Q_J_neg)"
by (metis newQuery_equi_dev projectQuery.simps assms(10))
then obtain XX where "(A, XX) = (\<lambda>tab. semiJoin tab (I, t)) (A, X)" by simp
then obtain XXX where "(AJ, XXX) \<in> NQ_neg" and "(AJ, XXX) = projectTable J (A, XX)"
by (metis AJ_def newQuery.simps projectTable.simps \<open>(A, X) \<in> Q_J_neg\<close> assms(10) image_eqI)
then have "restrict AJ xx \<notin> XXX"
proof -
have "xx \<in> R_NQ" by (simp add: assms(16))
then have "wf_tuple n J xx \<and> (\<forall>(A, X)\<in>NQ_pos. restrict A xx \<in> X) \<and> (\<forall>(A, X)\<in>NQ_neg. restrict A xx \<notin> X)"
by (simp add: assms(13))
then show ?thesis using \<open>(AJ, XXX) \<in> NQ_neg\<close> by blast
qed
define zA where "zA = restrict A z"
have "zA \<notin> X"
proof (rule ccontr)
assume "\<not> (zA \<notin> X)"
then have "zA \<in> X" by simp
moreover have "restrict (A \<inter> I) zA = restrict (A \<inter> I) t"
by (metis nested_include_restrict \<open>restrict I z = t\<close> inf_le1 inf_le2 zA_def)
then have "isSameIntersection t (A \<inter> I) zA"
proof -
have "wf_set n V" using assms(17) rwf_query_def wf_query_def by blast
moreover obtain "A \<inter> I \<subseteq> A" "A \<inter> I \<subseteq> I" "I \<subseteq> V" using assms(1) by blast
moreover have "A \<subseteq> V" using \<open>(A, X) \<in> Qn\<close> assms(17) included_def rwf_query_def by fastforce
moreover have "wf_tuple n A zA"
using \<open>wf_tuple n V z\<close> calculation(5) wf_tuple_restrict_simple zA_def by blast
then show ?thesis using isSame_equi_dev[of n V A zA I t "A \<inter> I"]
by (simp add: \<open>restrict (A \<inter> I) zA = restrict (A \<inter> I) t\<close> \<open>wf_tuple n I t\<close> calculation(1) calculation(4) calculation(5))
qed
then have "zA \<in> XX" using \<open>(A, XX) = semiJoin (A, X) (I, t)\<close> calculation by auto
then have "restrict J zA \<in> XXX" using \<open>(AJ, XXX) = projectTable J (A, XX)\<close> by auto
moreover have "restrict AJ xx = restrict J zA"
by (metis AJ_def restrict_nested \<open>restrict J z = xx\<close> inf.right_idem inf_commute zA_def)
then show "False" using \<open>restrict AJ xx \<notin> XXX\<close> calculation(2) by auto
qed
then show ?thesis using zA_def by auto
qed
qed
moreover have "\<And>A X. (A, X) \<in> Q \<Longrightarrow> restrict A z \<in> X"
proof -
fix A X assume "(A, X) \<in> Q"
have "restrict I (merge xx t) = restrict I t"
by (metis (no_types, lifting) Set.is_empty_def \<open>\<And>thesis. (\<lbrakk>wf_tuple n I t; wf_tuple n J xx\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close>
assms(2) merge_restrict restrict_idle sup.cobounded1 wf_tuple_def)
moreover have "restrict J (merge xx t) = restrict J xx"
by (metis Set.is_empty_def \<open>\<And>thesis. (\<lbrakk>wf_tuple n I t; wf_tuple n J xx\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close>
assms(2) inf_commute real_restrict_merge)
moreover have "restrict J xx = xx" using \<open>wf_tuple n J xx\<close> restrict_idle by auto
moreover have "restrict I t = t" using \<open>wf_tuple n I t\<close> restrict_idle by auto
then obtain "restrict I z = t" "restrict J z = xx"
using assms(14) calculation(1) calculation(2) calculation(3) by auto
moreover have "\<forall>(A, X)\<in>Q_I_pos. restrict A t \<in> X" using assms(12) assms(15) by blast
moreover have "\<forall>(A, X)\<in>NQ_pos. restrict A xx \<in> X" using assms(13) assms(16) by blast
moreover have "card A \<ge> 1"
using \<open>(A, X) \<in> Q\<close> assms(17) non_empty_query_def rwf_query_def by fastforce
then show "restrict A z \<in> X"
proof (cases "A \<subseteq> I")
case True
have "(A, X) \<in> filterQuery I Q"
proof -
have "A \<inter> I = A" using True by auto
then have "A \<inter> I \<noteq> {}" using \<open>1 \<le> card A\<close> by auto
then have "(\<lambda>(s, _). s \<inter> V \<noteq> {}) (A, X)" using assms(1) by blast
then show ?thesis
by (metis \<open>(A, X) \<in> Q\<close> \<open>1 \<le> card A\<close> \<open>A \<inter> I = A\<close> assms(17) fst_conv rwf_query_def set_filterQuery)
qed
have "table n A X"
proof -
have "wf_query n V Q Qn" using assms(17) rwf_query_def by blast
moreover have "(A, X) \<in> (Q \<union> Qn)" by (simp add: \<open>(A, X) \<in> Q\<close>)
then show ?thesis by (metis calculation fst_conv snd_conv wf_atable_def wf_query_def)
qed
moreover have "projectTable I (A, X) = (A, X)" using True calculation projectTable_idle by blast
then have "(A, X) \<in> Q_I_pos" by (metis \<open>(A, X) \<in> filterQuery I Q\<close> assms(5) image_eqI projectQuery.elims)
then have "restrict A t \<in> X" using \<open>\<forall>(A, X)\<in>Q_I_pos. restrict A t \<in> X\<close> by blast
moreover have "restrict A z = restrict A t" using True \<open>restrict I z = t\<close> nested_include_restrict by blast
then show ?thesis by (simp add: calculation(2))
next
case False
have "A \<subseteq> V"
proof -
have "included V Q" using assms(17) rwf_query_def by blast
then show ?thesis using \<open>(A, X) \<in> Q\<close> included_def by fastforce
qed
then have "card (A \<inter> J) \<ge> 1" by (metis False One_nat_def Suc_leI Suc_le_lessD UnE assms(1)
assms(4) card_gt_0_iff disjoint_iff_not_equal finite_Int subsetD subsetI)
then show ?thesis
proof (cases "card (A \<inter> I) \<ge> 1")
case True
define zI where "zI = restrict I z"
define zJ where "zJ = restrict J z"
obtain "zI = t" "zJ = xx"
by (simp add: calculation(4) calculation(5) zI_def zJ_def)
then have "wf_tuple n I zI \<and> (\<forall>(A, X)\<in>Q_I_pos. restrict A zI \<in> X)"
using \<open>wf_tuple n I t\<close> calculation(6) by blast
moreover have "wf_tuple n J zJ \<and> (\<forall>(A, X)\<in>NQ_pos. restrict A zJ \<in> X)"
using \<open>\<forall>(A, X)\<in>NQ_pos. restrict A xx \<in> X\<close> \<open>wf_tuple n J xx\<close> \<open>zJ = xx\<close> by blast
obtain "(A, X) \<in> (filterQuery I Q)" "(A, X) \<in> Q_J_pos"
using True \<open>(A, X) \<in> Q\<close> \<open>1 \<le> card (A \<inter> J)\<close> assms(6) assms(17) rwf_query_def set_filterQuery by fastforce
define AI where "AI = A\<inter>I"
define XI where "XI = Set.image (restrict I) X"
then have "(AI, XI) = projectTable I (A, X)" using AI_def XI_def by simp
then have "(AI, XI) \<in> Q_I_pos" by (metis \<open>(A, X) \<in> filterQuery I Q\<close> assms(5) image_eqI projectQuery.elims)
then have "restrict AI zI \<in> XI" using \<open>wf_tuple n I zI \<and> (\<forall>(A, X)\<in>Q_I_pos. restrict A zI \<in> X)\<close> by blast
obtain AJ XJ where "(AJ, XJ) = projectTable J (semiJoin (A, X) (I, zI))" by simp
then have "AJ = A \<inter> J" by auto
then have "(AJ, XJ) \<in> NQ_pos"
using \<open>(A, X) \<in> Q_J_pos\<close> \<open>(AJ, XJ) = projectTable J (semiJoin (A, X) (I, zI))\<close> \<open>zI = t\<close> image_iff
using assms(9) by fastforce
then have "restrict AJ zJ \<in> XJ"
using \<open>wf_tuple n J zJ \<and> (\<forall>(A, X)\<in>NQ_pos. restrict A zJ \<in> X)\<close> by blast
have "XJ = Set.image (restrict J) (Set.filter (isSameIntersection zI (A \<inter> I)) X)"
using \<open>(AJ, XJ) = projectTable J (semiJoin (A, X) (I, zI))\<close> by auto
then have "restrict AJ zJ \<in> Set.image (restrict J) (Set.filter (isSameIntersection zI (A \<inter> I)) X)"
using \<open>restrict AJ zJ \<in> XJ\<close> by blast
moreover have "table n A X"
using \<open>(A, X) \<in> Q\<close> assms(17) rwf_query_def wf_atable_def wf_query_def by fastforce
moreover have "A \<subseteq> I \<union> J" using \<open>A \<subseteq> V\<close> assms(1) by auto
then show ?thesis using restrict_merge[of zI I z zJ J A X n] AI_def True XI_def \<open>AJ = A \<inter> J\<close>
\<open>restrict AI zI \<in> XI\<close> \<open>restrict I z = t\<close> \<open>restrict J z = xx\<close> \<open>wf_tuple n V z\<close> assms(1)
assms(14) assms(17) calculation(2) calculation(3) rwf_query_def wf_query_def zI_def zJ_def by blast
next
case False
have "(A, X) \<in> Q_J_pos" using \<open>(A, X) \<in> Q\<close> \<open>1 \<le> card (A \<inter> J)\<close> assms(6) assms(17)
rwf_query_def set_filterQuery by fastforce
moreover have "A \<subseteq> J"
by (metis False One_nat_def Set.is_empty_def Suc_leI Suc_le_lessD \<open>1 \<le> card A\<close> \<open>A \<subseteq> V\<close>
assms(1) assms(2) card_gt_0_iff finite_Int inf.absorb_iff2 inf_commute sup_commute sup_inf_absorb sup_inf_distrib1)
then have "restrict A z = restrict A xx" using \<open>restrict J z = xx\<close> nested_include_restrict by blast
define zI where "zI = restrict I z"
define zJ where "zJ = restrict J z"
have "zJ = xx" by (simp add: \<open>restrict J z = xx\<close> zJ_def)
have "zI = t" by (simp add: \<open>restrict I z = t\<close> zI_def)
have "z = merge zJ zI" by (simp add: \<open>zI = t\<close> \<open>zJ = xx\<close> assms(14))
obtain AA XX where "(AA, XX) = projectTable J (semiJoin (A, X) (I, t))" by simp
have "AA = A \<inter> J"
using \<open>(AA, XX) = projectTable J (semiJoin (A, X) (I, t))\<close> by auto
have "(AA, XX) \<in> NQ_pos"
using \<open>(AA, XX) = projectTable J (semiJoin (A, X) (I, t))\<close> calculation image_iff assms(9)
by fastforce
then have "restrict AA zJ \<in> XX"
using \<open>(AA, XX) \<in> NQ_pos\<close> \<open>\<forall>(A, X)\<in>NQ_pos. restrict A xx \<in> X\<close> \<open>zJ = xx\<close> by blast
then have "restrict A z = restrict A zJ" by (simp add: \<open>restrict A z = restrict A xx\<close> \<open>zJ = xx\<close>)
moreover have "restrict AA zJ = restrict A zJ" by (simp add: \<open>A \<subseteq> J\<close> \<open>AA = A \<inter> J\<close> inf.absorb1)
then have "restrict A z \<in> XX" using \<open>restrict AA zJ \<in> XX\<close> calculation(2) by auto
moreover have "XX \<subseteq> Set.image (restrict J) X"
proof -
obtain AAA XXX where "(AAA, XXX) = semiJoin (A, X) (I, t)" by simp
then have "XXX \<subseteq> X" by auto
then have "XX = Set.image (restrict J) XXX"
using \<open>(AA, XX) = projectTable J (semiJoin (A, X) (I, t))\<close> \<open>(AAA, XXX) = semiJoin (A, X) (I, t)\<close> by auto
then show ?thesis by (simp add: \<open>XXX \<subseteq> X\<close> image_mono)
qed
then have "restrict A z \<in> Set.image (restrict J) X" using calculation(3) by blast
obtain zz where "restrict A z = restrict J zz" "zz \<in> X"
using \<open>restrict A z \<in> restrict J ` X\<close> by blast
then have "restrict A z = restrict A zz"
by (metis Int_absorb2 \<open>A \<subseteq> J\<close> restrict_nested subset_refl)
moreover have "restrict A zz = zz"
proof -
have "(A, X) \<in> Q" by (simp add: \<open>(A, X) \<in> Q\<close>)
then have "table n A X" using assms(17) rwf_query_def wf_atable_def wf_query_def by fastforce
then have "wf_tuple n A zz" using \<open>zz \<in> X\<close> table_def by blast
then show ?thesis using restrict_idle by blast
qed
then have "restrict A zz = zz" using \<open>restrict A z = restrict J zz\<close> calculation(4) by auto
then show ?thesis by (simp add: \<open>zz \<in> X\<close> calculation(4))
qed
qed
qed
then show ?thesis using calculation by blast
qed
lemma simple_set_inter:
assumes "I \<subseteq> (\<Union>X\<in>A. f X)"
shows "I \<subseteq> (\<Union>X\<in>A. (f X) \<inter> I)"
proof -
have "\<And>x. x \<in> I \<Longrightarrow> x \<in> (\<Union>X\<in>A. (f X) \<inter> I)"
proof -
fix x assume "x \<in> I"
obtain X where "X \<in> A" "x \<in> f X" using \<open>x \<in> I\<close> assms by auto
then show "x \<in> (\<Union>X\<in>A. (f X) \<inter> I)" using \<open>x \<in> I\<close> by blast
qed
then show ?thesis by (simp add: subsetI)
qed
lemma union_restrict:
assumes "restrict I z1 = restrict I z2"
assumes "restrict J z1 = restrict J z2"
shows "restrict (I \<union> J) z1 = restrict (I \<union> J) z2"
proof -
define zz1 where "zz1 = restrict (I \<union> J) z1"
define zz2 where "zz2 = restrict (I \<union> J) z2"
have "length z1 = length z2" by (metis assms(2) length_restrict)
have "\<And>i. i < length z1 \<Longrightarrow> zz1!i = zz2!i"
proof -
fix i assume "i < length z1"
then show "zz1!i = zz2!i"
proof (cases "i \<in> I")
case True
then show ?thesis
by (metis simple_restrict_none \<open>i < length z1\<close> \<open>length z1 = length z2\<close> assms(1)
nth_restrict zz1_def zz2_def)
next
case False
then show ?thesis
by (metis simple_restrict_none UnE \<open>i < length z1\<close> \<open>length z1 = length z2\<close> assms(2)
nth_restrict zz1_def zz2_def)
qed
qed
then have "\<forall>i < length z1. (restrict (I \<union> J) z1)!i = (restrict (I \<union> J) z2)!i"
using zz1_def zz2_def by blast
then show ?thesis
by (simp add: simple_list_index_equality \<open>length z1 = length z2\<close>)
qed
lemma partial_correctness_direct:
assumes "V = I \<union> J"
assumes "Set.is_empty (I \<inter> J)"
assumes "card I \<ge> 1"
assumes "card J \<ge> 1"
assumes "Q_I_pos = projectQuery I (filterQuery I Q)"
assumes "Q_J_pos = filterQuery J Q"
assumes "Q_I_neg = filterQueryNeg I Qn"
assumes "Q_J_neg = filterQuery J (Qn - Q_I_neg)"
assumes "R_I = genericJoin I Q_I_pos Q_I_neg"
assumes "X = {(t, genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) | t . t \<in> R_I}"
assumes "R = (\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x})"
assumes "R_NQ = genericJoin J NQ_pos NQ_neg"
assumes "\<forall>x. (x \<in> R_I \<longleftrightarrow> wf_tuple n I x \<and> (\<forall>(A, X)\<in>Q_I_pos. restrict A x \<in> X) \<and> (\<forall>(A, X)\<in>Q_I_neg. restrict A x \<notin> X))"
assumes "\<forall>t\<in>R_I. (\<forall>y. (y \<in> genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t)) \<longleftrightarrow> wf_tuple n J y \<and>
(\<forall>(A, X)\<in>(newQuery J Q_J_pos (I, t)). restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>(newQuery J Q_J_neg (I, t)). restrict A y \<notin> X)))"
assumes "wf_tuple n V z \<and> (\<forall>(A, X)\<in>Q. restrict A z \<in> X) \<and> (\<forall>(A, X)\<in>Qn. restrict A z \<notin> X)"
assumes "rwf_query n V Q Qn"
shows "z \<in> R"
proof -
define CI where "CI = filterQuery I Q"
define zI where "zI = restrict I z"
have "wf_tuple n I zI"
using assms(1) assms(15) wf_tuple_restrict_simple zI_def by auto
have "\<And>A X. ((A, X)\<in>Q_I_pos \<Longrightarrow> restrict A zI \<in> X)"
proof -
fix A X assume "(A, X)\<in>Q_I_pos"
have "(A, X) \<in> projectQuery I Q" using \<open>(A, X) \<in> Q_I_pos\<close> assms(5) by auto
then obtain AA XX where "X = Set.image (restrict I) XX" "(AA, XX) \<in> Q" "A = AA \<inter> I" by auto
moreover have "(restrict AA z) \<in> XX" using assms(15) calculation(2) by blast
then have "restrict I (restrict AA z) \<in> X" by (simp add: calculation(1))
then show "restrict A zI \<in> X"
by (metis calculation(3) inf.right_idem inf_commute restrict_nested zI_def)
qed
moreover have "\<And>A X. ((A, X)\<in>Q_I_neg \<Longrightarrow> restrict A zI \<notin> X)"
proof -
fix A X assume "(A, X)\<in>Q_I_neg"
then have "(A, X) \<in> Qn" by (simp add: assms(7))
then have "restrict A z \<notin> X" using assms(15) by blast
moreover have "A \<subseteq> I" using \<open>(A, X) \<in> Q_I_neg\<close> assms(7) by auto
then have "restrict A z = restrict A zI"
using nested_include_restrict zI_def by metis
then show "restrict A zI \<notin> X" using calculation by auto
qed
then have "zI \<in> R_I" using \<open>wf_tuple n I zI\<close> assms(13) calculation by auto
define zJ where "zJ = restrict J z"
have "wf_tuple n J zJ" using assms(1) assms(15) wf_tuple_restrict_simple zJ_def by auto
have "\<And>A X. ((A, X)\<in>Q_J_pos \<Longrightarrow> restrict A z \<in> X)" using assms(15) assms(6) by auto
define NQ where "NQ = newQuery J Q_J_pos (I, zI)"
have "\<And>A X. ((A, X)\<in>Q_J_pos \<Longrightarrow> (isSameIntersection zI (A \<inter> I) (restrict A z)))"
proof -
fix A X assume "(A, X) \<in> Q_J_pos"
obtain "wf_set n V" "wf_tuple n I zI" using \<open>wf_tuple n I zI\<close> assms(16) rwf_query_def wf_query_def by blast
moreover have "A \<subseteq> V"
proof -
have "included V Q_J_pos"
by (metis filterQuery.elims assms(16) assms(6) included_def member_filter rwf_query_def)
then show ?thesis using \<open>(A, X) \<in> Q_J_pos\<close> included_def by fastforce
qed
moreover have "wf_tuple n A (restrict A z)" by (meson assms(15) calculation(3) wf_tuple_restrict_simple)
then show "isSameIntersection zI (A \<inter> I) (restrict A z)"
using isSame_equi_dev[of n V I zI A "restrict A z" "A \<inter> I"]
by (metis nested_include_restrict assms(1) calculation(1) calculation(2) calculation(3) inf_le1 inf_le2 sup_ge1 zI_def)
qed
then have "\<And>A X. ((A, X)\<in>NQ \<Longrightarrow> restrict A zJ \<in> X)"
proof -
fix A X assume "(A, X)\<in>NQ"
obtain AA XX where "(A, X) = projectTable J (semiJoin (AA, XX) (I, zI))" "(AA, XX) \<in> Q_J_pos"
using NQ_def \<open>(A, X) \<in> NQ\<close> by auto
then have "restrict AA z \<in> XX" using \<open>\<And>X A. (A, X) \<in> Q_J_pos \<Longrightarrow> restrict A z \<in> X\<close> by blast
then have "restrict AA z \<in> snd (semiJoin (AA, XX) (I, zI))"
using \<open>(AA, XX) \<in> Q_J_pos\<close> \<open>\<And>X A. (A, X) \<in> Q_J_pos \<Longrightarrow> isSameIntersection zI (A \<inter> I) (restrict A z)\<close> by auto
then have "restrict J (restrict AA z) \<in> X"
using \<open>(A, X) = projectTable J (semiJoin (AA, XX) (I, zI))\<close> by auto
then show "restrict A zJ \<in> X"
by (metis \<open>(A, X) = projectTable J (semiJoin (AA, XX) (I, zI))\<close> fst_conv inf.idem inf_commute
projectTable.simps restrict_nested semiJoin.simps zJ_def)
qed
moreover have "\<forall>y. (y \<in> genericJoin J (newQuery J Q_J_pos (I, zI)) (newQuery J Q_J_neg (I, zI)) \<longleftrightarrow> wf_tuple n J y \<and>
(\<forall>(A, X)\<in>newQuery J Q_J_pos (I, zI). restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>newQuery J Q_J_neg (I, zI). restrict A y \<notin> X))"
using \<open>zI \<in> R_I\<close> assms(14) by auto
then have "zJ \<in> genericJoin J (newQuery J Q_J_pos (I, zI)) (newQuery J Q_J_neg (I, zI))
\<longleftrightarrow> wf_tuple n J zJ \<and> (\<forall>(A, X)\<in>newQuery J Q_J_pos (I, zI). restrict A zJ \<in> X) \<and>
(\<forall>(A, X)\<in>newQuery J Q_J_neg (I, zI). restrict A zJ \<notin> X)" by blast
moreover have "\<forall>(A, X)\<in>newQuery J Q_J_pos (I, zI). restrict A zJ \<in> X"
using NQ_def calculation(2) by blast
moreover have "\<And>A X. (A, X)\<in>newQuery J Q_J_neg (I, zI) \<Longrightarrow> restrict A zJ \<notin> X"
proof -
fix A X assume "(A, X) \<in> newQuery J Q_J_neg (I, zI)"
then have "(A, X) \<in> (Set.image (\<lambda>tab. projectTable J (semiJoin tab (I, zI))) Q_J_neg)"
using newQuery.simps by blast
then obtain AA XX where "(A, X) = projectTable J (semiJoin (AA, XX) (I, zI))" and "(AA, XX) \<in> Q_J_neg"
by auto
then have "A = AA \<inter> J" by auto
then have "(AA, XX) \<in> Qn" using \<open>(AA, XX) \<in> Q_J_neg\<close> assms(8) by auto
then have "restrict AA z \<notin> XX" using assms(15) by blast
show "restrict A zJ \<notin> X"
proof (rule ccontr)
assume "\<not> (restrict A zJ \<notin> X)"
then have "restrict A zJ \<in> X" by simp
then have "restrict A zJ \<in> Set.image (restrict J) (Set.filter (isSameIntersection zI (I \<inter> AA)) XX)"
by (metis projectTable.simps semiJoin.simps \<open>(A, X) = projectTable J (semiJoin (AA, XX) (I, zI))\<close>
inf_commute snd_conv)
then obtain zz where "restrict A zJ = restrict J zz" and "zz \<in> (Set.filter (isSameIntersection zI (I \<inter> AA)) XX)"
by blast
moreover have "restrict A zJ = restrict AA zJ"
by (simp add: restrict_nested \<open>A = AA \<inter> J\<close> zJ_def)
then have "restrict AA z = zz"
proof -
have "restrict J (restrict AA zz) = restrict J (restrict AA z)"
by (metis (no_types, lifting) restrict_nested \<open>restrict A zJ = restrict AA zJ\<close>
calculation(1) inf_commute inf_left_idem zJ_def)
moreover have "isSameIntersection zI (I \<inter> AA) zz"
using \<open>zz \<in> Set.filter (isSameIntersection zI (I \<inter> AA)) XX\<close> by auto
moreover have "wf_tuple n AA zz"
proof -
have "rwf_query n V Q Qn" by (simp add: assms(16))
moreover have "(AA, XX) \<in> Q \<union> Qn" by (simp add: \<open>(AA, XX) \<in> Qn\<close>)
then have "wf_atable n (AA, XX)" using calculation rwf_query_def wf_query_def by blast
then show ?thesis
using \<open>zz \<in> Set.filter (isSameIntersection zI (I \<inter> AA)) XX\<close> table_def wf_atable_def by fastforce
qed
moreover have "restrict AA zz = zz" using calculation(3) restrict_idle by blast
moreover have "AA \<subseteq> V"
proof -
have "included V Qn" using assms(16) rwf_query_def by blast
then show ?thesis using \<open>(AA, XX) \<in> Qn\<close> included_def by fastforce
qed
moreover have "wf_set n V" using assms(16) rwf_query_def wf_query_def by blast
moreover have "restrict (I \<inter> AA) zz = restrict (I \<inter> AA) zI"
using isSame_equi_dev[of n V AA zz V z "I \<inter> AA"]
by (metis (mono_tags, lifting) isSame_equi_dev \<open>wf_tuple n I zI\<close> assms(1)
calculation(2) calculation(3) calculation(5) calculation(6) inf_le1 inf_le2 sup_ge1)
then have "restrict I (restrict AA zz) = restrict I (restrict AA z)"
by (metis (mono_tags, lifting) restrict_nested inf_le1 nested_include_restrict zI_def)
then have "restrict (I \<union> J) (restrict AA z) = restrict (I \<union> J) (restrict AA zz)"
using union_restrict calculation(1) by fastforce
moreover have "AA \<subseteq> I \<union> J"
by (metis \<open>(AA, XX) \<in> Qn\<close> assms(1) assms(16) case_prodD included_def rwf_query_def)
then show ?thesis
by (metis restrict_nested calculation(4) calculation(7) inf.absorb_iff2)
qed
then show "False" using \<open>restrict AA z \<notin> XX\<close> calculation(2) by auto
qed
qed
then have "zJ \<in> genericJoin J (newQuery J Q_J_pos (I, zI)) (newQuery J Q_J_neg (I, zI))"
using \<open>wf_tuple n J zJ\<close> calculation(3) calculation(4) by blast
have "z = merge zJ zI"
using restrict_partition_merge assms(1) assms(15) assms(2) zI_def zJ_def by fastforce
moreover have "(zI, genericJoin J (newQuery J Q_J_pos (I, zI)) (newQuery J Q_J_neg (I, zI))) \<in> X"
using \<open>zI \<in> R_I\<close> assms(10) by blast
then show ?thesis
using \<open>zJ \<in> genericJoin J (newQuery J Q_J_pos (I, zI)) (newQuery J Q_J_neg (I, zI))\<close> assms(11)
calculation(5) by blast
qed
lemma obvious_forall:
assumes "\<forall>x\<in>X. P x"
assumes "x\<in>X"
shows "P x"
by (simp add: assms(1) assms(2))
lemma correctness:
"\<lbrakk>rwf_query n V Q Qn; card V \<ge> 1\<rbrakk> \<Longrightarrow> (z \<in> genericJoin V Q Qn \<longleftrightarrow> wf_tuple n V z \<and>
(\<forall>(A, X)\<in>Q. restrict A z \<in> X) \<and> (\<forall>(A, X)\<in>Qn. restrict A z \<notin> X))"
proof (induction V Q Qn arbitrary: z rule: genericJoin.induct)
case (1 V Q Qn)
then show ?case
proof (cases "card V \<le> 1")
case True
have "card V = 1" using "1.prems"(2) True le_antisym by blast
then show ?thesis using base_correctness[of V n Q Qn "genericJoin V Q Qn" z] using "1.prems"(1) by blast
next
case False
obtain I J where "(I, J) = getIJ Q Qn V" by (metis surj_pair)
define Q_I_pos where "Q_I_pos = projectQuery I (filterQuery I Q)"
define Q_I_neg where "Q_I_neg = filterQueryNeg I Qn"
define R_I where "R_I = genericJoin I Q_I_pos Q_I_neg"
define Q_J_neg where "Q_J_neg = filterQuery J (Qn - Q_I_neg)"
define Q_J_pos where "Q_J_pos = filterQuery J Q"
define X where "X = {(t, genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) | t . t \<in> R_I}"
define R where "R = (\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x})"
then have "R = genericJoin V Q Qn"
using vars_genericJoin[of V I J Q Qn Q_I_pos Q_I_neg R_I Q_J_neg Q_J_pos X R]
by (metis "1.prems"(1) False Q_I_neg_def Q_I_pos_def Q_J_neg_def Q_J_pos_def R_I_def Suc_1 X_def
\<open>(I, J) = getIJ Q Qn V\<close> not_less_eq_eq)
obtain "rwf_query n I Q_I_pos Q_I_neg" and "card I \<ge> 1"
by (metis "1.prems"(1) False Q_I_neg_def Q_I_pos_def Suc_1 \<open>(I, J) = getIJ Q Qn V\<close> getIJ.getIJProperties(1)
getIJ.wf_firstRecursiveCall getIJ_axioms not_less_eq_eq)
then have "\<forall>x. (x \<in> R_I \<longleftrightarrow>
wf_tuple n I x \<and> (\<forall>(A, X)\<in>Q_I_pos. restrict A x \<in> X) \<and> (\<forall>(A, X)\<in>Q_I_neg. restrict A x \<notin> X))"
using "1.IH"(1) False Q_I_neg_def Q_I_pos_def R_I_def \<open>(I, J) = getIJ Q Qn V\<close> by auto
moreover have "\<forall>t\<in>R_I. (\<forall>y. (y \<in> genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t)) \<longleftrightarrow> wf_tuple n J y \<and>
(\<forall>(A, X)\<in>(newQuery J Q_J_pos (I, t)). restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>(newQuery J Q_J_neg (I, t)). restrict A y \<notin> X)))"
proof
fix t assume "t \<in> R_I"
have "card J \<ge> 1"
by (metis False Suc_1 \<open>(I, J) = getIJ Q Qn V\<close> getIJProperties(2) le_SucE nat_le_linear)
moreover have "rwf_query n J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))"
by (metis "1.prems"(1) Diff_subset False Q_J_neg_def Q_J_pos_def Suc_1 \<open>(I, J) = getIJ Q Qn V\<close>
getIJ.wf_secondRecursiveCalls getIJ_axioms not_less_eq_eq)
define NQ_pos where "NQ_pos = newQuery J Q_J_pos (I, t)"
define NQ_neg where "NQ_neg = newQuery J Q_J_neg (I, t)"
have "\<And>y. y \<in> genericJoin J NQ_pos NQ_neg \<longleftrightarrow>
wf_tuple n J y \<and> (\<forall>(A, X)\<in>NQ_pos. restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>NQ_neg. restrict A y \<notin> X)"
proof -
fix y
have "rwf_query n J NQ_pos NQ_neg"
using NQ_neg_def NQ_pos_def \<open>rwf_query n J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))\<close> by blast
then show "y \<in> genericJoin J NQ_pos NQ_neg \<longleftrightarrow>
wf_tuple n J y \<and> (\<forall>(A, X)\<in>NQ_pos. restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>NQ_neg. restrict A y \<notin> X)"
using "1.IH"(2)[of "(I, J)" I J Q_I_pos Q_I_neg R_I Q_J_neg Q_J_pos t y]
by (metis "1.prems"(1) False NQ_neg_def NQ_pos_def Q_I_neg_def Q_I_pos_def Q_J_neg_def
Q_J_pos_def R_I_def Suc_1 \<open>(I, J) = getIJ Q Qn V\<close> calculation filter_Q_J_neg_same not_less_eq_eq)
qed
then show "\<forall>y. (y \<in> genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t)) \<longleftrightarrow> wf_tuple n J y \<and>
(\<forall>(A, X)\<in>(newQuery J Q_J_pos (I, t)). restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>(newQuery J Q_J_neg (I, t)). restrict A y \<notin> X))"
using NQ_neg_def NQ_pos_def by blast
qed
moreover obtain "V = I \<union> J" "Set.is_empty (I \<inter> J)" "card I \<ge> 1" "card J \<ge> 1"
by (metis False Set.is_empty_def Suc_1 \<open>(I, J) = getIJ Q Qn V\<close> coreProperties not_less_eq_eq)
moreover have "rwf_query n V Q Qn" by (simp add: "1.prems"(1))
then show ?thesis
proof -
have "z \<in> genericJoin V Q Qn \<Longrightarrow> wf_tuple n V z \<and> (\<forall>(A, X)\<in>Q. restrict A z \<in> X) \<and> (\<forall>(A, X)\<in>Qn. restrict A z \<notin> X)"
proof -
fix z assume "z \<in> genericJoin V Q Qn"
have "z \<in> (\<Union>(t, x) \<in> X. {merge xx t | xx . xx \<in> x})"
using R_def \<open>R = genericJoin V Q Qn\<close> \<open>z \<in> genericJoin V Q Qn\<close> by blast
obtain t R_NQ where "z \<in> {merge xx t | xx . xx \<in> R_NQ}" "(t, R_NQ) \<in> X"
using \<open>z \<in> (\<Union>(t, x)\<in>X. {merge xx t |xx. xx \<in> x})\<close> by blast
then have "t \<in> R_I" using X_def by blast
define NQ where "NQ = newQuery J Q_J_pos (I, t)"
define NQ_neg where "NQ_neg = newQuery J Q_J_neg (I, t)"
have "R_NQ = genericJoin J NQ NQ_neg" using NQ_def NQ_neg_def X_def \<open>(t, R_NQ) \<in> X\<close> by blast
obtain xx where "z = merge xx t" "xx \<in> R_NQ"
using \<open>z \<in> {merge xx t |xx. xx \<in> R_NQ}\<close> by blast
have "\<forall>y. (y \<in> R_NQ \<longleftrightarrow> wf_tuple n J y \<and> (\<forall>(A, X)\<in>NQ. restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>NQ_neg. restrict A y \<notin> X))"
proof -
have "\<forall>tt\<in>R_I. (\<forall>x. (x \<in> genericJoin J NQ NQ_neg
\<longleftrightarrow> wf_tuple n J x \<and> (\<forall>(A, X)\<in>NQ. restrict A x \<in> X) \<and> (\<forall>(A, X)\<in>NQ_neg. restrict A x \<notin> X)))"
using NQ_def NQ_neg_def \<open>t \<in> R_I\<close> calculation(2) by auto
moreover have "t\<in>R_I" by (simp add: \<open>t \<in> R_I\<close>)
then have "(\<forall>x. (x \<in> genericJoin J NQ NQ_neg
\<longleftrightarrow> wf_tuple n J x \<and> (\<forall>(A, X)\<in>NQ. restrict A x \<in> X) \<and> (\<forall>(A, X)\<in>NQ_neg. restrict A x \<notin> X)))"
using obvious_forall[where ?x=t and ?X=R_I] calculation by fastforce
then show ?thesis using \<open>R_NQ = genericJoin J NQ NQ_neg\<close> by blast
qed
show "wf_tuple n V z \<and> (\<forall>(A, X)\<in>Q. restrict A z \<in> X) \<and> (\<forall>(A, X)\<in>Qn. restrict A z \<notin> X)"
using partial_correctness[of V I J Q_I_pos Q Q_J_pos Q_I_neg Qn Q_J_neg NQ t NQ_neg R_NQ R_I n z xx]
using "1.prems"(1) NQ_def NQ_neg_def Q_I_neg_def Q_I_pos_def Q_J_neg_def Q_J_pos_def
\<open>R_NQ = genericJoin J NQ NQ_neg\<close> \<open>\<forall>y. (y \<in> R_NQ) = (wf_tuple n J y \<and> (\<forall>(A, X)\<in>NQ. restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>NQ_neg. restrict A y \<notin> X))\<close>
\<open>t \<in> R_I\<close> \<open>xx \<in> R_NQ\<close> \<open>z = merge xx t\<close> calculation(1) calculation(3) calculation(4) calculation(5) calculation(6) by blast
qed
moreover have "wf_tuple n V z \<and> (\<forall>(A, X)\<in>Q. restrict A z \<in> X) \<and> (\<forall>(A, X)\<in>Qn. restrict A z \<notin> X) \<Longrightarrow> z \<in> genericJoin V Q Qn"
proof -
fix z assume "wf_tuple n V z \<and> (\<forall>(A, X)\<in>Q. restrict A z \<in> X) \<and> (\<forall>(A, X)\<in>Qn. restrict A z \<notin> X)"
have "z \<in> R"
using partial_correctness_direct[of V I J Q_I_pos Q Q_J_pos Q_I_neg Qn Q_J_neg R_I X R
_ _ _ n z]
"1.prems"(1) Q_I_neg_def Q_I_pos_def Q_J_neg_def Q_J_pos_def R_I_def R_def X_def
\<open>1 \<le> card I\<close> \<open>1 \<le> card J\<close> \<open>Set.is_empty (I \<inter> J)\<close> \<open>V = I \<union> J\<close>
\<open>\<forall>t\<in>R_I. \<forall>y. (y \<in> genericJoin J (newQuery J Q_J_pos (I, t)) (newQuery J Q_J_neg (I, t))) = (wf_tuple n J y \<and> (\<forall>(A, X)\<in>newQuery J Q_J_pos (I, t). restrict A y \<in> X) \<and> (\<forall>(A, X)\<in>newQuery J Q_J_neg (I, t). restrict A y \<notin> X))\<close>
\<open>\<forall>x. (x \<in> R_I) = (wf_tuple n I x \<and> (\<forall>(A, X)\<in>Q_I_pos. restrict A x \<in> X) \<and> (\<forall>(A, X)\<in>Q_I_neg. restrict A x \<notin> X))\<close>
\<open>wf_tuple n V z \<and> (\<forall>(A, X)\<in>Q. restrict A z \<in> X) \<and> (\<forall>(A, X)\<in>Qn. restrict A z \<notin> X)\<close> by blast
then show "z \<in> genericJoin V Q Qn" using \<open>R = genericJoin V Q Qn\<close> by blast
qed
then show ?thesis using calculation by linarith
qed
qed
qed
lemma wf_set_finite:
assumes "wf_set n A"
shows "finite A"
using assms finite_nat_set_iff_bounded wf_set_def by auto
lemma vars_wrapperGenericJoin:
fixes Q :: "'a query" and Q_pos :: "'a query" and Q_neg :: "'a query"
and V :: "nat set" and Qn :: "'a query"
assumes "Q = Set.filter (\<lambda>(A, _). \<not> Set.is_empty A) Q_pos"
and "V = (\<Union>(A, X)\<in>Q. A)"
and "Qn = Set.filter (\<lambda>(A, _). A \<subseteq> V \<and> card A \<ge> 1) Q_neg"
and "\<not> Set.is_empty Q"
and "\<not>((\<exists>(A, X)\<in>Q_pos. Set.is_empty X) \<or> (\<exists>(A, X)\<in>Q_neg. Set.is_empty A \<and> \<not> Set.is_empty X))"
shows "wrapperGenericJoin Q_pos Q_neg = genericJoin V Q Qn"
using assms wrapperGenericJoin.simps
proof -
let ?r = "wrapperGenericJoin Q_pos Q_neg"
have "?r = (if ((\<exists>(A, X)\<in>Q_pos. Set.is_empty X) \<or> (\<exists>(A, X)\<in>Q_neg. Set.is_empty A \<and> \<not> Set.is_empty X)) then
{}
else
let Q = Set.filter (\<lambda>(A, _). \<not> Set.is_empty A) Q_pos in
if Set.is_empty Q then
(\<Inter>(A, X)\<in>Q_pos. X) - (\<Union>(A, X)\<in>Q_neg. X)
else
let V = (\<Union>(A, X)\<in>Q. A) in
let Qn = Set.filter (\<lambda>(A, _). A \<subseteq> V \<and> card A \<ge> 1) Q_neg in
genericJoin V Q Qn)" by simp
also have "... = (let Q = Set.filter (\<lambda>(A, _). \<not> Set.is_empty A) Q_pos in
if Set.is_empty Q then
(\<Inter>(A, X)\<in>Q_pos. X) - (\<Union>(A, X)\<in>Q_neg. X)
else
let V = (\<Union>(A, X)\<in>Q. A) in
let Qn = Set.filter (\<lambda>(A, _). A \<subseteq> V \<and> card A \<ge> 1) Q_neg in
genericJoin V Q Qn)" using assms(5) by simp
moreover have "\<not> (let Q = Set.filter (\<lambda>(A, _). \<not> Set.is_empty A) Q_pos in Set.is_empty Q)"
using assms(1) assms(4) by auto
ultimately have "(let Q = Set.filter (\<lambda>(A, _). \<not> Set.is_empty A) Q_pos in
if Set.is_empty Q then
(\<Inter>(A, X)\<in>Q_pos. X) - (\<Union>(A, X)\<in>Q_neg. X)
else
let V = (\<Union>(A, X)\<in>Q. A) in
let Qn = Set.filter (\<lambda>(A, _). A \<subseteq> V \<and> card A \<ge> 1) Q_neg in
genericJoin V Q Qn) = (let Q = Set.filter (\<lambda>(A, _). \<not> Set.is_empty A) Q_pos in
let V = (\<Union>(A, X)\<in>Q. A) in
let Qn = Set.filter (\<lambda>(A, _). A \<subseteq> V \<and> card A \<ge> 1) Q_neg in
genericJoin V Q Qn)" by presburger
also have "... = (genericJoin V Q Qn)" using assms(1) assms(2) assms(3) by metis
then show ?thesis using wrapperGenericJoin.simps assms(5) calculation by simp
qed
end
end
|
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright 2019.12.19 Yuki Mitsuta
# Distributed under terms of the MIT license.
"""
the calculation of minimum path that is calculated to gradient down form Transiton state
Available functions:
main: main part of the calculation of minimum path
"""
import os, glob, shutil, re, gc
import time, math, copy, inspect, datetime
import numpy as np
from scipy.optimize import minimize
#from . import const, functions, IOpack
from . import functions, IOpack
def main(tspoint, f, grad, hessian, dirname, SHSrank, SHSroot, SHScomm, const):
"""
main: main part of the calculation of minimum path
Args:
tspoint : Coordinate of ts point
f : function to calculate potential as f(x)
grad : function to calculate gradient as grad(x)
hessian : function to calculate hessian as hessian(x)
dirname : name of directory to calculate minimum path
SHSrank : rank of MPI
SHSroot : root rank of MPI
SHScomm : communicate class of mpi4py
const : class of constants
"""
if SHSrank == SHSroot:
print("start Minimum Path calculation of %s"%dirname)
os.chdir(dirname)
dim = len(tspoint)
TShess = hessian(tspoint)
eigNlist, _eigV = np.linalg.eigh(TShess)
eigVlist = []
for i in range(dim):
eigVlist.append(_eigV[:,i])
pathlist = []
if SHSrank == SHSroot:
for i, pm in enumerate([1, -1]):
writeline = ""
for p in tspoint:
writeline += "% 3.10f, "%p
writeline += ": TS point\n"
with open("./pathlist%s.csv"%i, "a") as wf:
wf.write(writeline)
#pathlist.append(tspoint + pm * const.deltas0 * eigVlist[0])
x = tspoint + pm * const.deltas0 * eigVlist[0]
pathlist.append(x)
writeline = ""
for p in x:
writeline += "% 3.10f, "%p
writeline += ":deltas0 \n"
with open("./pathlist%s.csv"%i, "a") as wf:
wf.write(writeline)
else:
pathlist = None
if const.calc_mpiQ:
pathlist = SHScomm.bcast(pathlist, root = 0)
downQlist = [True, True]
beforeEgradlist = [None, None]
whileN = 0
while any(downQlist):
whileN += 1
if 1000 < whileN:
if SHSrank == SHSroot:
print("in MinimumPath: whileN over 1000")
return []
for i, pm in enumerate([-1, 1]):
if downQlist[i] is False:
continue
x = pathlist[i]
grad_x = grad(x)
if np.linalg.norm(grad_x) < const.threshold * 5.0:
grad_x = pm * eigVlist[0]
else:
Egrad = grad_x / np.linalg.norm(grad_x)
beforeEgradlist[i] = Egrad
downQlist[i] = False
continue
if np.linalg.norm(grad_x) == 0.0:
if SHSrank == SHSroot:
print("ERROR: gradient become 0.0 in %s"%x)
return []
Egrad = grad_x / np.linalg.norm(grad_x)
x -= const.deltas0 * Egrad
beforeEgradlist[i] = Egrad
pathlist[i] = copy.copy(x)
if SHSrank == SHSroot:
writeline = ""
for p in x:
writeline += "% 3.10f, "%p
writeline += ":% 3.10f\n"%np.linalg.norm(grad_x)
with open("./pathlist%s.csv"%i, "a") as wf:
wf.write(writeline)
downQlist = [True, True]
while any(downQlist):
whileN += 1
if 1000 < whileN:
if SHSrank == SHSroot:
print("in MinimumPath: whileN over 1000")
return []
#break
for i in [0, 1]:
if not downQlist[i]:
continue
x = pathlist[i]
grad_x = grad(x)
if np.linalg.norm(grad_x) == 0.0:
if SHSrank == SHSroot:
print("ERROR: gradient become 0.0 in %s"%x)
return []
Egrad = grad_x / np.linalg.norm(grad_x)
if np.dot(Egrad, beforeEgradlist[i]) < 0.0:
#print("find near point of new EQ")
downQlist[i] = False
x -= const.deltas * Egrad
if SHSrank == SHSroot:
writeline = ""
for p in x:
writeline += "% 3.10f, "%p
#writeline += ":% 3.10f\n"%np.dot(Egrad, beforeEgradlist[i])
writeline += ":% 3.10f\n"%np.linalg.norm(grad_x)
with open("./pathlist%s.csv"%i, "a") as wf:
wf.write(writeline)
beforeEgradlist[i] = copy.copy(Egrad)
pathlist[i] = copy.copy(x)
os.chdir("../")
return pathlist
|
! ============================================================================
! Program: AMRClaw
! File: resize_storage_static.f90
! Created: 2009-10-20
! Author: Marsha Berger and Randy LeVeque
! ============================================================================
! Description: For use with compilers that don't support move_alloc.
! Halts with an error message.
! ============================================================================
! NOTE: Older f90 compilers (e.g. gfortran prior to 4.2?)
! may not implement move_alloc and you will need to use this routine
! instead of resize_storage.f90 and set the
! allocation large enough in init_alloc.f90 to avoid running out of space.
subroutine resize_storage(new_size,status)
use amr_module
implicit none
integer, intent(out) :: status
integer, intent(in) :: new_size
status = 1
write(6,*) '*** Ran out of storage for AMR. '
write(6,*) '*** Increase memsize in init_alloc_static.f'
write(6,*) '*** or switch to dynamic memory using init_alloc.f90'
write(6,*) '*** Current memsize = ',memsize
write(6,*) '*** Requested new_size = ',new_size
stop
return
end subroutine resize_storage
|
function [hash_table, hash_coarse] = at_dense_hashtable(cnnfeat1,cnnfeat1fine)
x_coarse_size = size(cnnfeat1,1);
y_coarse_size = size(cnnfeat1,2);
x_fine_size = size(cnnfeat1fine,1);
y_fine_size = size(cnnfeat1fine,2);
% scale = x_fine_size/x_coarse_size;
% if scale ~= whos
% error('aspect ratio should be preserved');
% end
% x_coarse_size = 5;
% y_coarse_size = 4;
% scale = 2;
% x_fine_size = x_coarse_size * scale;
% y_fine_size = y_coarse_size * scale;
% [x_coarse,y_coarse] = meshgrid(1:x_coarse_size,1:y_coarse_size);
hash_coarse = reshape(1:(x_coarse_size*y_coarse_size),x_coarse_size,y_coarse_size);
hash_fine = imresize(hash_coarse,[x_fine_size y_fine_size],'nearest');
[x_fine,y_fine] = meshgrid(1:y_fine_size,1:x_fine_size);
Nhash = max(hash_coarse(:));
hash_table = cell(1,Nhash);
hash_fine = hash_fine(:);
x_fine = x_fine(:);
y_fine = y_fine(:);
for ii=1:Nhash
a = find(hash_fine == ii);
hash_table{ii} = [x_fine(a)'; y_fine(a)'];
end
|
State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
⊢ Continuous g State After: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
⊢ Continuous g Tactic: let Gf : C(X₀, C(Y, Z)) := ContinuousMap.curry ⟨_, hg⟩ State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
⊢ Continuous g State After: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
⊢ Continuous g Tactic: have h : ∀ x : X, Continuous fun y => g (x, y) := by
intro x
obtain ⟨x₀, rfl⟩ := hf.surjective x
exact (Gf x₀).continuous State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
⊢ Continuous g State After: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
G : X → C(Y, Z) := fun x => mk fun y => g (x, y)
⊢ Continuous g Tactic: let G : X → C(Y, Z) := fun x => ⟨_, h x⟩ State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
G : X → C(Y, Z) := fun x => mk fun y => g (x, y)
⊢ Continuous g State After: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
G : X → C(Y, Z) := fun x => mk fun y => g (x, y)
this : Continuous G
⊢ Continuous g Tactic: have : Continuous G := by
rw [hf.continuous_iff]
exact Gf.continuous State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
G : X → C(Y, Z) := fun x => mk fun y => g (x, y)
this : Continuous G
⊢ Continuous g State After: no goals Tactic: exact ContinuousMap.continuous_uncurry_of_continuous ⟨G, this⟩ State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
⊢ ∀ (x : X), Continuous fun y => g (x, y) State After: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
x : X
⊢ Continuous fun y => g (x, y) Tactic: intro x State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
x : X
⊢ Continuous fun y => g (x, y) State After: case intro
X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
x₀ : X₀
⊢ Continuous fun y => g (f x₀, y) Tactic: obtain ⟨x₀, rfl⟩ := hf.surjective x State Before: case intro
X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
x₀ : X₀
⊢ Continuous fun y => g (f x₀, y) State After: no goals Tactic: exact (Gf x₀).continuous State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
G : X → C(Y, Z) := fun x => mk fun y => g (x, y)
⊢ Continuous G State After: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
G : X → C(Y, Z) := fun x => mk fun y => g (x, y)
⊢ Continuous (G ∘ f) Tactic: rw [hf.continuous_iff] State Before: X₀ : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁴ : TopologicalSpace X₀
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : LocallyCompactSpace Y
f : X₀ → X
hf : QuotientMap f
g : X × Y → Z
hg : Continuous fun p => g (f p.fst, p.snd)
Gf : C(X₀, C(Y, Z)) := curry (mk fun p => g (f p.fst, p.snd))
h : ∀ (x : X), Continuous fun y => g (x, y)
G : X → C(Y, Z) := fun x => mk fun y => g (x, y)
⊢ Continuous (G ∘ f) State After: no goals Tactic: exact Gf.continuous
|
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
ImportAll(spiral);
alphai := (n,i,a) -> Cond(
i mod 2 = 0, ( a + Int(i/2)) / n,
i mod 2 = 1, (1-a + Int(i/2)) / n);
#alphai := (n,i,alpha) -> fr(n,i,2*alpha).ev()/2;
cat := Concatenation;
cos := x->CosPi(2*x);
sin := x->SinPi(2*x);
ls := (n,f) -> List([0..n-1], f);
MatRDFT1 := n -> cat(
[ List([0..n-1], x->1), List([0..n-1], x->(-1)^x) ],
cat(List([1..n/2-1], i->
[ ls(n, j -> cos(j*i/n)),
ls(n, j -> sin(j*i/n)) ])));
MatRDFT3 := n ->
cat(List([0..n/2-1], i->
[ ls(n, j -> cos(j*(i+1/2)/n)),
ls(n, j -> sin(j*(i+1/2)/n)) ]));
MatRDFT := (N,a) -> let(n:=N/2,
cat(ls(n, i-> let(aa := alphai(n,i,a), # 2 since we use 2pi*a
[ ls(2*n, j -> cos(j*aa)),
ls(2*n, j -> sin(j*aa)) ]))));
MatrDFT := (N,a) -> let(n:=N/2,
cat(ls(n, i-> let(aa := alphai(n,i,a),
[ cat(ls(n, j->cos(j*aa)), (-1)^i*ls(n, j -> -sin(j*aa))),
cat(ls(n, j->sin(j*aa)), (-1)^i*ls(n, j -> cos(j*aa))) ]))));
MatBRDFT := (N,a) -> MatSPL(BlockMat(let(n:=N/2,
ls(n, i->let(phi := [[0,-1],[1,2*cos(alphai(n,i,a))]],
ls(n, j->Mat(phi^(2*j))))))));
|
# Sympy - Symbolic algebra in Python
J.R. Johansson (jrjohansson at gmail.com)
The latest version of this [IPython notebook](http://ipython.org/notebook.html) lecture is available at [http://github.com/jrjohansson/scientific-python-lectures](http://github.com/jrjohansson/scientific-python-lectures).
The other notebooks in this lecture series are indexed at [http://jrjohansson.github.io](http://jrjohansson.github.io).
```python
%matplotlib inline
import matplotlib.pyplot as plt
```
## Introduction
There are two notable Computer Algebra Systems (CAS) for Python:
* [SymPy](http://sympy.org/en/index.html) - A python module that can be used in any Python program, or in an IPython session, that provides powerful CAS features.
* [Sage](http://www.sagemath.org/) - Sage is a full-featured and very powerful CAS enviroment that aims to provide an open source system that competes with Mathematica and Maple. Sage is not a regular Python module, but rather a CAS environment that uses Python as its programming language.
Sage is in some aspects more powerful than SymPy, but both offer very comprehensive CAS functionality. The advantage of SymPy is that it is a regular Python module and integrates well with the IPython notebook.
In this lecture we will therefore look at how to use SymPy with IPython notebooks. If you are interested in an open source CAS environment I also recommend to read more about Sage.
To get started using SymPy in a Python program or notebook, import the module `sympy`:
```python
from sympy import *
```
To get nice-looking $\LaTeX$ formatted output run:
```python
init_printing()
# or with older versions of sympy/ipython, load the IPython extension
#%load_ext sympy.interactive.ipythonprinting
# or
#%load_ext sympyprinting
```
## Symbolic variables
In SymPy we need to create symbols for the variables we want to work with. We can create a new symbol using the `Symbol` class:
```python
x = Symbol('x')
```
```python
(pi + x)**2
```
```python
# alternative way of defining symbols
a, b, c = symbols("a, b, c")
```
```python
type(a)
```
sympy.core.symbol.Symbol
We can add assumptions to symbols when we create them:
```python
x = Symbol('x', real=True)
```
```python
x.is_imaginary
```
False
```python
x = Symbol('x', positive=True)
```
```python
x > 0
```
### Complex numbers
The imaginary unit is denoted `I` in Sympy.
```python
1+1*I
```
```python
I**2
```
```python
(x * I + 1)**2
```
### Rational numbers
There are three different numerical types in SymPy: `Real`, `Rational`, `Integer`:
```python
r1 = Rational(4,5)
r2 = Rational(5,4)
```
```python
r1
```
```python
r1+r2
```
```python
r1/r2
```
## Numerical evaluation
SymPy uses a library for artitrary precision as numerical backend, and has predefined SymPy expressions for a number of mathematical constants, such as: `pi`, `e`, `oo` for infinity.
To evaluate an expression numerically we can use the `evalf` function (or `N`). It takes an argument `n` which specifies the number of significant digits.
```python
pi.evalf(n=50)
```
```python
y = (x + pi)**2
```
```python
N(y, 5) # same as evalf
```
When we numerically evaluate algebraic expressions we often want to substitute a symbol with a numerical value. In SymPy we do that using the `subs` function:
```python
y.subs(x, 1.5)
```
```python
N(y.subs(x, 1.5))
```
The `subs` function can of course also be used to substitute Symbols and expressions:
```python
y.subs(x, a+pi)
```
We can also combine numerical evolution of expressions with NumPy arrays:
```python
import numpy
```
```python
x_vec = numpy.arange(0, 10, 0.1)
```
```python
y_vec = numpy.array([N(((x + pi)**2).subs(x, xx)) for xx in x_vec])
```
```python
fig, ax = plt.subplots()
ax.plot(x_vec, y_vec);
```
However, this kind of numerical evolution can be very slow, and there is a much more efficient way to do it: Use the function `lambdify` to "compile" a Sympy expression into a function that is much more efficient to evaluate numerically:
```python
f = lambdify([x], (x + pi)**2, 'numpy') # the first argument is a list of variables that
# f will be a function of: in this case only x -> f(x)
```
```python
y_vec = f(x_vec) # now we can directly pass a numpy array and f(x) is efficiently evaluated
```
The speedup when using "lambdified" functions instead of direct numerical evaluation can be significant, often several orders of magnitude. Even in this simple example we get a significant speed up:
```python
%%timeit
y_vec = numpy.array([N(((x + pi)**2).subs(x, xx)) for xx in x_vec])
```
32.6 ms ± 1.45 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
```python
%%timeit
y_vec = f(x_vec)
```
3.3 µs ± 215 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
## Algebraic manipulations
One of the main uses of an CAS is to perform algebraic manipulations of expressions. For example, we might want to expand a product, factor an expression, or simply an expression. The functions for doing these basic operations in SymPy are demonstrated in this section.
### Expand and factor
The first steps in an algebraic manipulation
```python
(x+1)*(x+2)*(x+3)
```
```python
expand((x+1)*(x+2)*(x+3))
```
The `expand` function takes a number of keywords arguments which we can tell the functions what kind of expansions we want to have performed. For example, to expand trigonometric expressions, use the `trig=True` keyword argument:
```python
sin(a+b)
```
```python
expand(sin(a+b), trig=True)
```
See `help(expand)` for a detailed explanation of the various types of expansions the `expand` functions can perform.
The opposite a product expansion is of course factoring. The factor an expression in SymPy use the `factor` function:
```python
factor(x**3 + 6 * x**2 + 11*x + 6)
```
### Simplify
The `simplify` tries to simplify an expression into a nice looking expression, using various techniques. More specific alternatives to the `simplify` functions also exists: `trigsimp`, `powsimp`, `logcombine`, etc.
The basic usages of these functions are as follows:
```python
# simplify expands a product
simplify((x+1)*(x+2)*(x+3))
```
```python
# simplify uses trigonometric identities
simplify(sin(a)**2 + cos(a)**2)
```
```python
simplify(cos(x)/sin(x))
```
### apart and together
To manipulate symbolic expressions of fractions, we can use the `apart` and `together` functions:
```python
f1 = 1/((a+1)*(a+2))
```
```python
f1
```
```python
apart(f1)
```
```python
f2 = 1/(a+2) + 1/(a+3)
```
```python
f2
```
```python
together(f2)
```
Simplify usually combines fractions but does not factor:
```python
simplify(f2)
```
## Calculus
In addition to algebraic manipulations, the other main use of CAS is to do calculus, like derivatives and integrals of algebraic expressions.
### Differentiation
Differentiation is usually simple. Use the `diff` function. The first argument is the expression to take the derivative of, and the second argument is the symbol by which to take the derivative:
```python
y
```
```python
diff(y**2, x)
```
For higher order derivatives we can do:
```python
diff(y**2, x, x)
```
```python
diff(y**2, x, 2) # same as above
```
To calculate the derivative of a multivariate expression, we can do:
```python
x, y, z = symbols("x,y,z")
```
```python
f = sin(x*y) + cos(y*z)
```
$\frac{d^3f}{dxdy^2}$
```python
diff(f, x, 1, y, 2)
```
## Integration
Integration is done in a similar fashion:
```python
f
```
```python
integrate(f, x)
```
$$x \cos{\left (y z \right )} + \begin{cases} 0 & \text{for}\: y = 0 \\- \frac{1}{y} \cos{\left (x y \right )} & \text{otherwise} \end{cases}$$
By providing limits for the integration variable we can evaluate definite integrals:
```python
integrate(f, (x, -1, 1))
```
and also improper integrals
```python
integrate(exp(-x**2), (x, -oo, oo))
```
Remember, `oo` is the SymPy notation for inifinity.
### Sums and products
We can evaluate sums and products using the functions: 'Sum'
```python
n = Symbol("n")
```
```python
Sum(1/n**2, (n, 1, 10))
```
```python
Sum(1/n**2, (n,1, 10)).evalf()
```
```python
Sum(1/n**2, (n, 1, oo)).evalf()
```
Products work much the same way:
```python
Product(n, (n, 1, 10)) # 10!
```
## Limits
Limits can be evaluated using the `limit` function. For example,
```python
limit(sin(x)/x, x, 0)
```
We can use 'limit' to check the result of derivation using the `diff` function:
```python
f
```
```python
diff(f, x)
```
$\displaystyle \frac{\mathrm{d}f(x,y)}{\mathrm{d}x} = \frac{f(x+h,y)-f(x,y)}{h}$
```python
h = Symbol("h")
```
```python
limit((f.subs(x, x+h) - f)/h, h, 0)
```
OK!
We can change the direction from which we approach the limiting point using the `dir` keywork argument:
```python
limit(1/x, x, 0, dir="+")
```
```python
limit(1/x, x, 0, dir="-")
```
## Series
Series expansion is also one of the most useful features of a CAS. In SymPy we can perform a series expansion of an expression using the `series` function:
```python
series(exp(x), x)
```
By default it expands the expression around $x=0$, but we can expand around any value of $x$ by explicitly include a value in the function call:
```python
series(exp(x), x, 1)
```
And we can explicitly define to which order the series expansion should be carried out:
```python
series(exp(x), x, 1, 10)
```
The series expansion includes the order of the approximation, which is very useful for keeping track of the order of validity when we do calculations with series expansions of different order:
```python
s1 = cos(x).series(x, 0, 5)
s1
```
```python
s2 = sin(x).series(x, 0, 2)
s2
```
```python
expand(s1 * s2)
```
If we want to get rid of the order information we can use the `removeO` method:
```python
expand(s1.removeO() * s2.removeO())
```
But note that this is not the correct expansion of $\cos(x)\sin(x)$ to $5$th order:
```python
(cos(x)*sin(x)).series(x, 0, 6)
```
## Linear algebra
### Matrices
Matrices are defined using the `Matrix` class:
```python
m11, m12, m21, m22 = symbols("m11, m12, m21, m22")
b1, b2 = symbols("b1, b2")
```
```python
A = Matrix([[m11, m12],[m21, m22]])
A
```
$$\left[\begin{matrix}m_{11} & m_{12}\\m_{21} & m_{22}\end{matrix}\right]$$
```python
b = Matrix([[b1], [b2]])
b
```
$$\left[\begin{matrix}b_{1}\\b_{2}\end{matrix}\right]$$
With `Matrix` class instances we can do the usual matrix algebra operations:
```python
A**2
```
$$\left[\begin{matrix}m_{11}^{2} + m_{12} m_{21} & m_{11} m_{12} + m_{12} m_{22}\\m_{11} m_{21} + m_{21} m_{22} & m_{12} m_{21} + m_{22}^{2}\end{matrix}\right]$$
```python
A * b
```
$$\left[\begin{matrix}b_{1} m_{11} + b_{2} m_{12}\\b_{1} m_{21} + b_{2} m_{22}\end{matrix}\right]$$
And calculate determinants and inverses, and the like:
```python
A.det()
```
```python
A.inv()
```
$$\left[\begin{matrix}\frac{m_{22}}{m_{11} m_{22} - m_{12} m_{21}} & - \frac{m_{12}}{m_{11} m_{22} - m_{12} m_{21}}\\- \frac{m_{21}}{m_{11} m_{22} - m_{12} m_{21}} & \frac{m_{11}}{m_{11} m_{22} - m_{12} m_{21}}\end{matrix}\right]$$
## Solving equations
For solving equations and systems of equations we can use the `solve` function:
```python
solve(x**2 - 1, x)
```
```python
solve(x**4 - x**2 - 1, x)
```
System of equations:
```python
solve([x + y - 1, x - y - 1], [x,y])
```
In terms of other symbolic expressions:
```python
solve([x + y - a, x - y - c], [x,y])
```
## Further reading
* http://sympy.org/en/index.html - The SymPy projects web page.
* https://github.com/sympy/sympy - The source code of SymPy.
* http://live.sympy.org - Online version of SymPy for testing and demonstrations.
## Versions
```python
%reload_ext version_information
%version_information numpy, matplotlib, sympy
```
<table><tr><th>Software</th><th>Version</th></tr><tr><td>Python</td><td>3.6.3 64bit [GCC 7.2.0]</td></tr><tr><td>IPython</td><td>6.2.1</td></tr><tr><td>OS</td><td>Linux 4.4.86+ x86_64 with Ubuntu 17.10 artful</td></tr><tr><td>numpy</td><td>1.13.1</td></tr><tr><td>matplotlib</td><td>2.0.2</td></tr><tr><td>sympy</td><td>1.1.1</td></tr><tr><td colspan='2'>Sat Jan 20 12:39:59 2018 UTC</td></tr></table>
```python
```
```python
```
```python
```
```python
```
```python
```
```python
```
testing complete; Gopal
```python
```
|
/-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Mario Carneiro, Oliver Nash
! This file was ported from Lean 3 source module data.finset.prod
! leanprover-community/mathlib commit e04043d6bf7264a3c84bc69711dc354958ca4516
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.Data.Finset.Card
/-!
# Finsets in product types
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.
This file defines finset constructions on the product type `α × β`. Beware not to confuse with the
`finset.prod` operation which computes the multiplicative product.
## Main declarations
* `finset.product`: Turns `s : finset α`, `t : finset β` into their product in `finset (α × β)`.
* `finset.diag`: For `s : finset α`, `s.diag` is the `finset (α × α)` of pairs `(a, a)` with
`a ∈ s`.
* `finset.off_diag`: For `s : finset α`, `s.off_diag` is the `finset (α × α)` of pairs `(a, b)` with
`a, b ∈ s` and `a ≠ b`.
-/
open Multiset
variable {α β γ : Type _}
namespace Finset
/-! ### prod -/
section Prod
variable {s s' : Finset α} {t t' : Finset β} {a : α} {b : β}
#print Finset.product /-
/-- `product s t` is the set of pairs `(a, b)` such that `a ∈ s` and `b ∈ t`. -/
protected def product (s : Finset α) (t : Finset β) : Finset (α × β) :=
⟨_, s.Nodup.product t.Nodup⟩
#align finset.product Finset.product
-/
-- mathport name: finset.product
infixr:82
" ×ˢ " =>-- This notation binds more strongly than (pre)images, unions and intersections.
Finset.product
/- warning: finset.product_val -> Finset.product_val is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β}, Eq.{succ (max u1 u2)} (Multiset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.val.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t)) (Multiset.product.{u1, u2} α β (Finset.val.{u1} α s) (Finset.val.{u2} β t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β}, Eq.{max (succ u2) (succ u1)} (Multiset.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.val.{max u2 u1} (Prod.{u2, u1} α β) (Finset.product.{u2, u1} α β s t)) (Multiset.product.{u2, u1} α β (Finset.val.{u2} α s) (Finset.val.{u1} β t))
Case conversion may be inaccurate. Consider using '#align finset.product_val Finset.product_valₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem product_val : (s ×ˢ t).1 = s.1 ×ˢ t.1 :=
rfl
#align finset.product_val Finset.product_val
/- warning: finset.mem_product -> Finset.mem_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} {p : Prod.{u1, u2} α β}, Iff (Membership.Mem.{max u1 u2, max u1 u2} (Prod.{u1, u2} α β) (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasMem.{max u1 u2} (Prod.{u1, u2} α β)) p (Finset.product.{u1, u2} α β s t)) (And (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) (Prod.fst.{u1, u2} α β p) s) (Membership.Mem.{u2, u2} β (Finset.{u2} β) (Finset.hasMem.{u2} β) (Prod.snd.{u1, u2} α β p) t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β} {p : Prod.{u2, u1} α β}, Iff (Membership.mem.{max u2 u1, max u1 u2} (Prod.{u2, u1} α β) (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instMembershipFinset.{max u2 u1} (Prod.{u2, u1} α β)) p (Finset.product.{u2, u1} α β s t)) (And (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) (Prod.fst.{u2, u1} α β p) s) (Membership.mem.{u1, u1} β (Finset.{u1} β) (Finset.instMembershipFinset.{u1} β) (Prod.snd.{u2, u1} α β p) t))
Case conversion may be inaccurate. Consider using '#align finset.mem_product Finset.mem_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem mem_product {p : α × β} : p ∈ s ×ˢ t ↔ p.1 ∈ s ∧ p.2 ∈ t :=
mem_product
#align finset.mem_product Finset.mem_product
/- warning: finset.mk_mem_product -> Finset.mk_mem_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} {a : α} {b : β}, (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) -> (Membership.Mem.{u2, u2} β (Finset.{u2} β) (Finset.hasMem.{u2} β) b t) -> (Membership.Mem.{max u1 u2, max u1 u2} (Prod.{u1, u2} α β) (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasMem.{max u1 u2} (Prod.{u1, u2} α β)) (Prod.mk.{u1, u2} α β a b) (Finset.product.{u1, u2} α β s t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β} {a : α} {b : β}, (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (Membership.mem.{u1, u1} β (Finset.{u1} β) (Finset.instMembershipFinset.{u1} β) b t) -> (Membership.mem.{max u1 u2, max u1 u2} (Prod.{u2, u1} α β) (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instMembershipFinset.{max u2 u1} (Prod.{u2, u1} α β)) (Prod.mk.{u2, u1} α β a b) (Finset.product.{u2, u1} α β s t))
Case conversion may be inaccurate. Consider using '#align finset.mk_mem_product Finset.mk_mem_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem mk_mem_product (ha : a ∈ s) (hb : b ∈ t) : (a, b) ∈ s ×ˢ t :=
mem_product.2 ⟨ha, hb⟩
#align finset.mk_mem_product Finset.mk_mem_product
/- warning: finset.coe_product -> Finset.coe_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} (s : Finset.{u1} α) (t : Finset.{u2} β), Eq.{succ (max u1 u2)} (Set.{max u1 u2} (Prod.{u1, u2} α β)) ((fun (a : Type.{max u1 u2}) (b : Type.{max u1 u2}) [self : HasLiftT.{succ (max u1 u2), succ (max u1 u2)} a b] => self.0) (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Set.{max u1 u2} (Prod.{u1, u2} α β)) (HasLiftT.mk.{succ (max u1 u2), succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Set.{max u1 u2} (Prod.{u1, u2} α β)) (CoeTCₓ.coe.{succ (max u1 u2), succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Set.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.Set.hasCoeT.{max u1 u2} (Prod.{u1, u2} α β)))) (Finset.product.{u1, u2} α β s t)) (Set.prod.{u1, u2} α β ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) (Finset.{u1} α) (Set.{u1} α) (HasLiftT.mk.{succ u1, succ u1} (Finset.{u1} α) (Set.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} (Finset.{u1} α) (Set.{u1} α) (Finset.Set.hasCoeT.{u1} α))) s) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Finset.{u2} β) (Set.{u2} β) (HasLiftT.mk.{succ u2, succ u2} (Finset.{u2} β) (Set.{u2} β) (CoeTCₓ.coe.{succ u2, succ u2} (Finset.{u2} β) (Set.{u2} β) (Finset.Set.hasCoeT.{u2} β))) t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} (s : Finset.{u2} α) (t : Finset.{u1} β), Eq.{max (succ u2) (succ u1)} (Set.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.toSet.{max u2 u1} (Prod.{u2, u1} α β) (Finset.product.{u2, u1} α β s t)) (Set.prod.{u2, u1} α β (Finset.toSet.{u2} α s) (Finset.toSet.{u1} β t))
Case conversion may be inaccurate. Consider using '#align finset.coe_product Finset.coe_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp, norm_cast]
theorem coe_product (s : Finset α) (t : Finset β) : (↑(s ×ˢ t) : Set (α × β)) = s ×ˢ t :=
Set.ext fun x => Finset.mem_product
#align finset.coe_product Finset.coe_product
/- warning: finset.subset_product_image_fst -> Finset.subset_product_image_fst is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} [_inst_1 : DecidableEq.{succ u1} α], HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.hasSubset.{u1} α) (Finset.image.{max u1 u2, u1} (Prod.{u1, u2} α β) α (fun (a : α) (b : α) => _inst_1 a b) (Prod.fst.{u1, u2} α β) (Finset.product.{u1, u2} α β s t)) s
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β} [_inst_1 : DecidableEq.{succ u2} α], HasSubset.Subset.{u2} (Finset.{u2} α) (Finset.instHasSubsetFinset.{u2} α) (Finset.image.{max u1 u2, u2} (Prod.{u2, u1} α β) α (fun (a : α) (b : α) => _inst_1 a b) (Prod.fst.{u2, u1} α β) (Finset.product.{u2, u1} α β s t)) s
Case conversion may be inaccurate. Consider using '#align finset.subset_product_image_fst Finset.subset_product_image_fstₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem subset_product_image_fst [DecidableEq α] : (s ×ˢ t).image Prod.fst ⊆ s := fun i => by
simp (config := { contextual := true }) [mem_image]
#align finset.subset_product_image_fst Finset.subset_product_image_fst
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
#print Finset.subset_product_image_snd /-
theorem subset_product_image_snd [DecidableEq β] : (s ×ˢ t).image Prod.snd ⊆ t := fun i => by
simp (config := { contextual := true }) [mem_image]
#align finset.subset_product_image_snd Finset.subset_product_image_snd
-/
/- warning: finset.product_image_fst -> Finset.product_image_fst is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} [_inst_1 : DecidableEq.{succ u1} α], (Finset.Nonempty.{u2} β t) -> (Eq.{succ u1} (Finset.{u1} α) (Finset.image.{max u1 u2, u1} (Prod.{u1, u2} α β) α (fun (a : α) (b : α) => _inst_1 a b) (Prod.fst.{u1, u2} α β) (Finset.product.{u1, u2} α β s t)) s)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β} [_inst_1 : DecidableEq.{succ u2} α], (Finset.Nonempty.{u1} β t) -> (Eq.{succ u2} (Finset.{u2} α) (Finset.image.{max u1 u2, u2} (Prod.{u2, u1} α β) α (fun (a : α) (b : α) => _inst_1 a b) (Prod.fst.{u2, u1} α β) (Finset.product.{u2, u1} α β s t)) s)
Case conversion may be inaccurate. Consider using '#align finset.product_image_fst Finset.product_image_fstₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_image_fst [DecidableEq α] (ht : t.Nonempty) : (s ×ˢ t).image Prod.fst = s :=
by
ext i
simp [mem_image, ht.bex]
#align finset.product_image_fst Finset.product_image_fst
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
#print Finset.product_image_snd /-
theorem product_image_snd [DecidableEq β] (ht : s.Nonempty) : (s ×ˢ t).image Prod.snd = t :=
by
ext i
simp [mem_image, ht.bex]
#align finset.product_image_snd Finset.product_image_snd
-/
/- warning: finset.subset_product -> Finset.subset_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β] {s : Finset.{max u1 u2} (Prod.{u1, u2} α β)}, HasSubset.Subset.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasSubset.{max u1 u2} (Prod.{u1, u2} α β)) s (Finset.product.{u1, u2} α β (Finset.image.{max u1 u2, u1} (Prod.{u1, u2} α β) α (fun (a : α) (b : α) => _inst_1 a b) (Prod.fst.{u1, u2} α β) s) (Finset.image.{max u1 u2, u2} (Prod.{u1, u2} α β) β (fun (a : β) (b : β) => _inst_2 a b) (Prod.snd.{u1, u2} α β) s))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : DecidableEq.{succ u2} α] [_inst_2 : DecidableEq.{succ u1} β] {s : Finset.{max u1 u2} (Prod.{u2, u1} α β)}, HasSubset.Subset.{max u2 u1} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instHasSubsetFinset.{max u2 u1} (Prod.{u2, u1} α β)) s (Finset.product.{u2, u1} α β (Finset.image.{max u1 u2, u2} (Prod.{u2, u1} α β) α (fun (a : α) (b : α) => _inst_1 a b) (Prod.fst.{u2, u1} α β) s) (Finset.image.{max u1 u2, u1} (Prod.{u2, u1} α β) β (fun (a : β) (b : β) => _inst_2 a b) (Prod.snd.{u2, u1} α β) s))
Case conversion may be inaccurate. Consider using '#align finset.subset_product Finset.subset_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem subset_product [DecidableEq α] [DecidableEq β] {s : Finset (α × β)} :
s ⊆ s.image Prod.fst ×ˢ s.image Prod.snd := fun p hp =>
mem_product.2 ⟨mem_image_of_mem _ hp, mem_image_of_mem _ hp⟩
#align finset.subset_product Finset.subset_product
/- warning: finset.product_subset_product -> Finset.product_subset_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {s' : Finset.{u1} α} {t : Finset.{u2} β} {t' : Finset.{u2} β}, (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.hasSubset.{u1} α) s s') -> (HasSubset.Subset.{u2} (Finset.{u2} β) (Finset.hasSubset.{u2} β) t t') -> (HasSubset.Subset.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasSubset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t'))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {s' : Finset.{u2} α} {t : Finset.{u1} β} {t' : Finset.{u1} β}, (HasSubset.Subset.{u2} (Finset.{u2} α) (Finset.instHasSubsetFinset.{u2} α) s s') -> (HasSubset.Subset.{u1} (Finset.{u1} β) (Finset.instHasSubsetFinset.{u1} β) t t') -> (HasSubset.Subset.{max u1 u2} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instHasSubsetFinset.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s' t'))
Case conversion may be inaccurate. Consider using '#align finset.product_subset_product Finset.product_subset_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_subset_product (hs : s ⊆ s') (ht : t ⊆ t') : s ×ˢ t ⊆ s' ×ˢ t' := fun ⟨x, y⟩ h =>
mem_product.2 ⟨hs (mem_product.1 h).1, ht (mem_product.1 h).2⟩
#align finset.product_subset_product Finset.product_subset_product
/- warning: finset.product_subset_product_left -> Finset.product_subset_product_left is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {s' : Finset.{u1} α} {t : Finset.{u2} β}, (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.hasSubset.{u1} α) s s') -> (HasSubset.Subset.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasSubset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {s' : Finset.{u2} α} {t : Finset.{u1} β}, (HasSubset.Subset.{u2} (Finset.{u2} α) (Finset.instHasSubsetFinset.{u2} α) s s') -> (HasSubset.Subset.{max u1 u2} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instHasSubsetFinset.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s' t))
Case conversion may be inaccurate. Consider using '#align finset.product_subset_product_left Finset.product_subset_product_leftₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_subset_product_left (hs : s ⊆ s') : s ×ˢ t ⊆ s' ×ˢ t :=
product_subset_product hs (Subset.refl _)
#align finset.product_subset_product_left Finset.product_subset_product_left
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
#print Finset.product_subset_product_right /-
theorem product_subset_product_right (ht : t ⊆ t') : s ×ˢ t ⊆ s ×ˢ t' :=
product_subset_product (Subset.refl _) ht
#align finset.product_subset_product_right Finset.product_subset_product_right
-/
/- warning: finset.map_swap_product -> Finset.map_swap_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} (s : Finset.{u1} α) (t : Finset.{u2} β), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.map.{max u2 u1, max u1 u2} (Prod.{u2, u1} β α) (Prod.{u1, u2} α β) (Function.Embedding.mk.{succ (max u2 u1), succ (max u1 u2)} (Prod.{u2, u1} β α) (Prod.{u1, u2} α β) (Prod.swap.{u2, u1} β α) (Prod.swap_injective.{u2, u1} β α)) (Finset.product.{u2, u1} β α t s)) (Finset.product.{u1, u2} α β s t)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} (s : Finset.{u2} α) (t : Finset.{u1} β), Eq.{max (succ u2) (succ u1)} (Finset.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.map.{max u2 u1, max u2 u1} (Prod.{u1, u2} β α) (Prod.{u2, u1} α β) (Function.Embedding.mk.{succ (max u2 u1), succ (max u2 u1)} (Prod.{u1, u2} β α) (Prod.{u2, u1} α β) (Prod.swap.{u1, u2} β α) (Prod.swap_injective.{u2, u1} β α)) (Finset.product.{u1, u2} β α t s)) (Finset.product.{u2, u1} α β s t)
Case conversion may be inaccurate. Consider using '#align finset.map_swap_product Finset.map_swap_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem map_swap_product (s : Finset α) (t : Finset β) :
(t ×ˢ s).map ⟨Prod.swap, Prod.swap_injective⟩ = s ×ˢ t :=
coe_injective <| by
push_cast
exact Set.image_swap_prod _ _
#align finset.map_swap_product Finset.map_swap_product
/- warning: finset.image_swap_product -> Finset.image_swap_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β] (s : Finset.{u1} α) (t : Finset.{u2} β), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.image.{max u2 u1, max u1 u2} (Prod.{u2, u1} β α) (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b) (Prod.swap.{u2, u1} β α) (Finset.product.{u2, u1} β α t s)) (Finset.product.{u1, u2} α β s t)
but is expected to have type
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{max (succ u2) (succ u1)} (Prod.{u1, u2} α β)] (_inst_2 : Finset.{u1} α) (s : Finset.{u2} β), Eq.{max (succ u1) (succ u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.image.{max u1 u2, max u1 u2} (Prod.{u2, u1} β α) (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => _inst_1 a b) (Prod.swap.{u2, u1} β α) (Finset.product.{u2, u1} β α s _inst_2)) (Finset.product.{u1, u2} α β _inst_2 s)
Case conversion may be inaccurate. Consider using '#align finset.image_swap_product Finset.image_swap_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem image_swap_product [DecidableEq α] [DecidableEq β] (s : Finset α) (t : Finset β) :
(t ×ˢ s).image Prod.swap = s ×ˢ t :=
coe_injective <| by
push_cast
exact Set.image_swap_prod _ _
#align finset.image_swap_product Finset.image_swap_product
/- warning: finset.product_eq_bUnion -> Finset.product_eq_bunionᵢ is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β] (s : Finset.{u1} α) (t : Finset.{u2} β), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.bunionᵢ.{u1, max u1 u2} α (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b) s (fun (a : α) => Finset.image.{u2, max u1 u2} β (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b) (fun (b : β) => Prod.mk.{u1, u2} α β a b) t))
but is expected to have type
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{max (succ u2) (succ u1)} (Prod.{u1, u2} α β)] (_inst_2 : Finset.{u1} α) (s : Finset.{u2} β), Eq.{max (succ u1) (succ u2)} (Finset.{max u2 u1} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β _inst_2 s) (Finset.bunionᵢ.{u1, max u2 u1} α (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => _inst_1 a b) _inst_2 (fun (a : α) => Finset.image.{u2, max u2 u1} β (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => _inst_1 a b) (fun (b : β) => Prod.mk.{u1, u2} α β a b) s))
Case conversion may be inaccurate. Consider using '#align finset.product_eq_bUnion Finset.product_eq_bunionᵢₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_eq_bunionᵢ [DecidableEq α] [DecidableEq β] (s : Finset α) (t : Finset β) :
s ×ˢ t = s.bunionᵢ fun a => t.image fun b => (a, b) :=
ext fun ⟨x, y⟩ => by
simp only [mem_product, mem_bUnion, mem_image, exists_prop, Prod.mk.inj_iff, and_left_comm,
exists_and_left, exists_eq_right, exists_eq_left]
#align finset.product_eq_bUnion Finset.product_eq_bunionᵢ
/- warning: finset.product_eq_bUnion_right -> Finset.product_eq_bunionᵢ_right is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β] (s : Finset.{u1} α) (t : Finset.{u2} β), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.bunionᵢ.{u2, max u1 u2} β (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b) t (fun (b : β) => Finset.image.{u1, max u1 u2} α (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b) (fun (a : α) => Prod.mk.{u1, u2} α β a b) s))
but is expected to have type
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{max (succ u2) (succ u1)} (Prod.{u1, u2} α β)] (_inst_2 : Finset.{u1} α) (s : Finset.{u2} β), Eq.{max (succ u1) (succ u2)} (Finset.{max u2 u1} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β _inst_2 s) (Finset.bunionᵢ.{u2, max u2 u1} β (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => _inst_1 a b) s (fun (b : β) => Finset.image.{u1, max u2 u1} α (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => _inst_1 a b) (fun (a : α) => Prod.mk.{u1, u2} α β a b) _inst_2))
Case conversion may be inaccurate. Consider using '#align finset.product_eq_bUnion_right Finset.product_eq_bunionᵢ_rightₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_eq_bunionᵢ_right [DecidableEq α] [DecidableEq β] (s : Finset α) (t : Finset β) :
s ×ˢ t = t.bunionᵢ fun b => s.image fun a => (a, b) :=
ext fun ⟨x, y⟩ => by
simp only [mem_product, mem_bUnion, mem_image, exists_prop, Prod.mk.inj_iff, and_left_comm,
exists_and_left, exists_eq_right, exists_eq_left]
#align finset.product_eq_bUnion_right Finset.product_eq_bunionᵢ_right
/- warning: finset.product_bUnion -> Finset.product_bunionᵢ is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : DecidableEq.{succ u3} γ] (s : Finset.{u1} α) (t : Finset.{u2} β) (f : (Prod.{u1, u2} α β) -> (Finset.{u3} γ)), Eq.{succ u3} (Finset.{u3} γ) (Finset.bunionᵢ.{max u1 u2, u3} (Prod.{u1, u2} α β) γ (fun (a : γ) (b : γ) => _inst_1 a b) (Finset.product.{u1, u2} α β s t) f) (Finset.bunionᵢ.{u1, u3} α γ (fun (a : γ) (b : γ) => _inst_1 a b) s (fun (a : α) => Finset.bunionᵢ.{u2, u3} β γ (fun (a : γ) (b : γ) => _inst_1 a b) t (fun (b : β) => f (Prod.mk.{u1, u2} α β a b))))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} [_inst_1 : DecidableEq.{succ u3} γ] (s : Finset.{u2} α) (t : Finset.{u1} β) (f : (Prod.{u2, u1} α β) -> (Finset.{u3} γ)), Eq.{succ u3} (Finset.{u3} γ) (Finset.bunionᵢ.{max u2 u1, u3} (Prod.{u2, u1} α β) γ (fun (a : γ) (b : γ) => _inst_1 a b) (Finset.product.{u2, u1} α β s t) f) (Finset.bunionᵢ.{u2, u3} α γ (fun (a : γ) (b : γ) => _inst_1 a b) s (fun (a : α) => Finset.bunionᵢ.{u1, u3} β γ (fun (a : γ) (b : γ) => _inst_1 a b) t (fun (b : β) => f (Prod.mk.{u2, u1} α β a b))))
Case conversion may be inaccurate. Consider using '#align finset.product_bUnion Finset.product_bunionᵢₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/-- See also `finset.sup_product_left`. -/
@[simp]
theorem product_bunionᵢ [DecidableEq γ] (s : Finset α) (t : Finset β) (f : α × β → Finset γ) :
(s ×ˢ t).bunionᵢ f = s.bunionᵢ fun a => t.bunionᵢ fun b => f (a, b) := by
classical simp_rw [product_eq_bUnion, bUnion_bUnion, image_bUnion]
#align finset.product_bUnion Finset.product_bunionᵢ
/- warning: finset.card_product -> Finset.card_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} (s : Finset.{u1} α) (t : Finset.{u2} β), Eq.{1} Nat (Finset.card.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t)) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Finset.card.{u1} α s) (Finset.card.{u2} β t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} (s : Finset.{u2} α) (t : Finset.{u1} β), Eq.{1} Nat (Finset.card.{max u1 u2} (Prod.{u2, u1} α β) (Finset.product.{u2, u1} α β s t)) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Finset.card.{u2} α s) (Finset.card.{u1} β t))
Case conversion may be inaccurate. Consider using '#align finset.card_product Finset.card_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem card_product (s : Finset α) (t : Finset β) : card (s ×ˢ t) = card s * card t :=
Multiset.card_product _ _
#align finset.card_product Finset.card_product
/- warning: finset.filter_product -> Finset.filter_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} (p : α -> Prop) (q : β -> Prop) [_inst_1 : DecidablePred.{succ u1} α p] [_inst_2 : DecidablePred.{succ u2} β q], Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.filter.{max u1 u2} (Prod.{u1, u2} α β) (fun (x : Prod.{u1, u2} α β) => And (p (Prod.fst.{u1, u2} α β x)) (q (Prod.snd.{u1, u2} α β x))) (fun (a : Prod.{u1, u2} α β) => And.decidable (p (Prod.fst.{u1, u2} α β a)) (q (Prod.snd.{u1, u2} α β a)) (_inst_1 (Prod.fst.{u1, u2} α β a)) (_inst_2 (Prod.snd.{u1, u2} α β a))) (Finset.product.{u1, u2} α β s t)) (Finset.product.{u1, u2} α β (Finset.filter.{u1} α p (fun (a : α) => _inst_1 a) s) (Finset.filter.{u2} β q (fun (a : β) => _inst_2 a) t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β} (p : α -> Prop) (q : β -> Prop) [_inst_1 : DecidablePred.{succ u2} α p] [_inst_2 : DecidablePred.{succ u1} β q], Eq.{max (succ u2) (succ u1)} (Finset.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.filter.{max u2 u1} (Prod.{u2, u1} α β) (fun (x : Prod.{u2, u1} α β) => And (p (Prod.fst.{u2, u1} α β x)) (q (Prod.snd.{u2, u1} α β x))) (fun (a : Prod.{u2, u1} α β) => instDecidableAnd (p (Prod.fst.{u2, u1} α β a)) (q (Prod.snd.{u2, u1} α β a)) (_inst_1 (Prod.fst.{u2, u1} α β a)) (_inst_2 (Prod.snd.{u2, u1} α β a))) (Finset.product.{u2, u1} α β s t)) (Finset.product.{u2, u1} α β (Finset.filter.{u2} α p (fun (a : α) => _inst_1 a) s) (Finset.filter.{u1} β q (fun (a : β) => _inst_2 a) t))
Case conversion may be inaccurate. Consider using '#align finset.filter_product Finset.filter_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem filter_product (p : α → Prop) (q : β → Prop) [DecidablePred p] [DecidablePred q] :
((s ×ˢ t).filterₓ fun x : α × β => p x.1 ∧ q x.2) = s.filterₓ p ×ˢ t.filterₓ q :=
by
ext ⟨a, b⟩
simp only [mem_filter, mem_product]
exact and_and_and_comm (a ∈ s) (b ∈ t) (p a) (q b)
#align finset.filter_product Finset.filter_product
/- warning: finset.filter_product_left -> Finset.filter_product_left is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} (p : α -> Prop) [_inst_1 : DecidablePred.{succ u1} α p], Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.filter.{max u1 u2} (Prod.{u1, u2} α β) (fun (x : Prod.{u1, u2} α β) => p (Prod.fst.{u1, u2} α β x)) (fun (a : Prod.{u1, u2} α β) => _inst_1 (Prod.fst.{u1, u2} α β a)) (Finset.product.{u1, u2} α β s t)) (Finset.product.{u1, u2} α β (Finset.filter.{u1} α p (fun (a : α) => _inst_1 a) s) t)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β} (p : α -> Prop) [_inst_1 : DecidablePred.{succ u2} α p], Eq.{max (succ u2) (succ u1)} (Finset.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.filter.{max u2 u1} (Prod.{u2, u1} α β) (fun (x : Prod.{u2, u1} α β) => p (Prod.fst.{u2, u1} α β x)) (fun (a : Prod.{u2, u1} α β) => _inst_1 (Prod.fst.{u2, u1} α β a)) (Finset.product.{u2, u1} α β s t)) (Finset.product.{u2, u1} α β (Finset.filter.{u2} α p (fun (a : α) => _inst_1 a) s) t)
Case conversion may be inaccurate. Consider using '#align finset.filter_product_left Finset.filter_product_leftₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem filter_product_left (p : α → Prop) [DecidablePred p] :
((s ×ˢ t).filterₓ fun x : α × β => p x.1) = s.filterₓ p ×ˢ t := by
simpa using filter_product p fun _ => True
#align finset.filter_product_left Finset.filter_product_left
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
#print Finset.filter_product_right /-
theorem filter_product_right (q : β → Prop) [DecidablePred q] :
((s ×ˢ t).filterₓ fun x : α × β => q x.2) = s ×ˢ t.filterₓ q := by
simpa using filter_product (fun _ : α => True) q
#align finset.filter_product_right Finset.filter_product_right
-/
/- warning: finset.filter_product_card -> Finset.filter_product_card is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} (s : Finset.{u1} α) (t : Finset.{u2} β) (p : α -> Prop) (q : β -> Prop) [_inst_1 : DecidablePred.{succ u1} α p] [_inst_2 : DecidablePred.{succ u2} β q], Eq.{1} Nat (Finset.card.{max u1 u2} (Prod.{u1, u2} α β) (Finset.filter.{max u1 u2} (Prod.{u1, u2} α β) (fun (x : Prod.{u1, u2} α β) => Iff (p (Prod.fst.{u1, u2} α β x)) (q (Prod.snd.{u1, u2} α β x))) (fun (a : Prod.{u1, u2} α β) => Iff.decidable (p (Prod.fst.{u1, u2} α β a)) (q (Prod.snd.{u1, u2} α β a)) (_inst_1 (Prod.fst.{u1, u2} α β a)) (_inst_2 (Prod.snd.{u1, u2} α β a))) (Finset.product.{u1, u2} α β s t))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Finset.card.{u1} α (Finset.filter.{u1} α p (fun (a : α) => _inst_1 a) s)) (Finset.card.{u2} β (Finset.filter.{u2} β q (fun (a : β) => _inst_2 a) t))) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Finset.card.{u1} α (Finset.filter.{u1} α (Function.comp.{succ u1, 1, 1} α Prop Prop Not p) (fun (a : α) => Not.decidable (p a) (_inst_1 a)) s)) (Finset.card.{u2} β (Finset.filter.{u2} β (Function.comp.{succ u2, 1, 1} β Prop Prop Not q) (fun (a : β) => Not.decidable (q a) (_inst_2 a)) t))))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} (s : Finset.{u2} α) (t : Finset.{u1} β) (p : α -> Prop) (q : β -> Prop) [_inst_1 : DecidablePred.{succ u2} α p] [_inst_2 : DecidablePred.{succ u1} β q], Eq.{1} Nat (Finset.card.{max u2 u1} (Prod.{u2, u1} α β) (Finset.filter.{max u2 u1} (Prod.{u2, u1} α β) (fun (x : Prod.{u2, u1} α β) => Eq.{1} Prop (p (Prod.fst.{u2, u1} α β x)) (q (Prod.snd.{u2, u1} α β x))) (fun (a : Prod.{u2, u1} α β) => instDecidableEqProp (p (Prod.fst.{u2, u1} α β a)) (q (Prod.snd.{u2, u1} α β a)) (instDecidableIff (p (Prod.fst.{u2, u1} α β a)) (q (Prod.snd.{u2, u1} α β a)) (_inst_1 (Prod.fst.{u2, u1} α β a)) (_inst_2 (Prod.snd.{u2, u1} α β a)))) (Finset.product.{u2, u1} α β s t))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Finset.card.{u2} α (Finset.filter.{u2} α p (fun (a : α) => _inst_1 a) s)) (Finset.card.{u1} β (Finset.filter.{u1} β q (fun (a : β) => _inst_2 a) t))) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Finset.card.{u2} α (Finset.filter.{u2} α (fun ([email protected]._hyg.1940 : α) => Not (p [email protected]._hyg.1940)) (fun (a : α) => instDecidableNot (p a) (_inst_1 a)) s)) (Finset.card.{u1} β (Finset.filter.{u1} β (fun ([email protected]._hyg.1956 : β) => Not (q [email protected]._hyg.1956)) (fun (a : β) => instDecidableNot (q a) (_inst_2 a)) t))))
Case conversion may be inaccurate. Consider using '#align finset.filter_product_card Finset.filter_product_cardₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem filter_product_card (s : Finset α) (t : Finset β) (p : α → Prop) (q : β → Prop)
[DecidablePred p] [DecidablePred q] :
((s ×ˢ t).filterₓ fun x : α × β => p x.1 ↔ q x.2).card =
(s.filterₓ p).card * (t.filterₓ q).card +
(s.filterₓ (Not ∘ p)).card * (t.filterₓ (Not ∘ q)).card :=
by
classical
rw [← card_product, ← card_product, ← filter_product, ← filter_product, ← card_union_eq]
· apply congr_arg
ext ⟨a, b⟩
simp only [filter_union_right, mem_filter, mem_product]
constructor <;> intro h <;> use h.1
simp only [Function.comp_apply, and_self_iff, h.2, em (q b)]
cases h.2 <;>
· try simp at h_1
simp [h_1]
· apply Finset.disjoint_filter_filter'
exact (disjoint_compl_right.inf_left _).inf_right _
#align finset.filter_product_card Finset.filter_product_card
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
#print Finset.empty_product /-
theorem empty_product (t : Finset β) : (∅ : Finset α) ×ˢ t = ∅ :=
rfl
#align finset.empty_product Finset.empty_product
-/
/- warning: finset.product_empty -> Finset.product_empty is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} (s : Finset.{u1} α), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s (EmptyCollection.emptyCollection.{u2} (Finset.{u2} β) (Finset.hasEmptyc.{u2} β))) (EmptyCollection.emptyCollection.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasEmptyc.{max u1 u2} (Prod.{u1, u2} α β)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} (s : Finset.{u2} α), Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β s (EmptyCollection.emptyCollection.{u1} (Finset.{u1} β) (Finset.instEmptyCollectionFinset.{u1} β))) (EmptyCollection.emptyCollection.{max u2 u1} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instEmptyCollectionFinset.{max u2 u1} (Prod.{u2, u1} α β)))
Case conversion may be inaccurate. Consider using '#align finset.product_empty Finset.product_emptyₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_empty (s : Finset α) : s ×ˢ (∅ : Finset β) = ∅ :=
eq_empty_of_forall_not_mem fun x h => (Finset.mem_product.1 h).2
#align finset.product_empty Finset.product_empty
/- warning: finset.nonempty.product -> Finset.Nonempty.product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β}, (Finset.Nonempty.{u1} α s) -> (Finset.Nonempty.{u2} β t) -> (Finset.Nonempty.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β}, (Finset.Nonempty.{u2} α s) -> (Finset.Nonempty.{u1} β t) -> (Finset.Nonempty.{max u2 u1} (Prod.{u2, u1} α β) (Finset.product.{u2, u1} α β s t))
Case conversion may be inaccurate. Consider using '#align finset.nonempty.product Finset.Nonempty.productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem Nonempty.product (hs : s.Nonempty) (ht : t.Nonempty) : (s ×ˢ t).Nonempty :=
let ⟨x, hx⟩ := hs
let ⟨y, hy⟩ := ht
⟨(x, y), mem_product.2 ⟨hx, hy⟩⟩
#align finset.nonempty.product Finset.Nonempty.product
/- warning: finset.nonempty.fst -> Finset.Nonempty.fst is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β}, (Finset.Nonempty.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t)) -> (Finset.Nonempty.{u1} α s)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β}, (Finset.Nonempty.{max u2 u1} (Prod.{u2, u1} α β) (Finset.product.{u2, u1} α β s t)) -> (Finset.Nonempty.{u2} α s)
Case conversion may be inaccurate. Consider using '#align finset.nonempty.fst Finset.Nonempty.fstₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem Nonempty.fst (h : (s ×ˢ t).Nonempty) : s.Nonempty :=
let ⟨xy, hxy⟩ := h
⟨xy.1, (mem_product.1 hxy).1⟩
#align finset.nonempty.fst Finset.Nonempty.fst
/- warning: finset.nonempty.snd -> Finset.Nonempty.snd is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β}, (Finset.Nonempty.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t)) -> (Finset.Nonempty.{u2} β t)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β}, (Finset.Nonempty.{max u2 u1} (Prod.{u2, u1} α β) (Finset.product.{u2, u1} α β s t)) -> (Finset.Nonempty.{u1} β t)
Case conversion may be inaccurate. Consider using '#align finset.nonempty.snd Finset.Nonempty.sndₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem Nonempty.snd (h : (s ×ˢ t).Nonempty) : t.Nonempty :=
let ⟨xy, hxy⟩ := h
⟨xy.2, (mem_product.1 hxy).2⟩
#align finset.nonempty.snd Finset.Nonempty.snd
/- warning: finset.nonempty_product -> Finset.nonempty_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β}, Iff (Finset.Nonempty.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t)) (And (Finset.Nonempty.{u1} α s) (Finset.Nonempty.{u2} β t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β}, Iff (Finset.Nonempty.{max u2 u1} (Prod.{u2, u1} α β) (Finset.product.{u2, u1} α β s t)) (And (Finset.Nonempty.{u2} α s) (Finset.Nonempty.{u1} β t))
Case conversion may be inaccurate. Consider using '#align finset.nonempty_product Finset.nonempty_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem nonempty_product : (s ×ˢ t).Nonempty ↔ s.Nonempty ∧ t.Nonempty :=
⟨fun h => ⟨h.fst, h.snd⟩, fun h => h.1.product h.2⟩
#align finset.nonempty_product Finset.nonempty_product
/- warning: finset.product_eq_empty -> Finset.product_eq_empty is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β}, Iff (Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (EmptyCollection.emptyCollection.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasEmptyc.{max u1 u2} (Prod.{u1, u2} α β)))) (Or (Eq.{succ u1} (Finset.{u1} α) s (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.hasEmptyc.{u1} α))) (Eq.{succ u2} (Finset.{u2} β) t (EmptyCollection.emptyCollection.{u2} (Finset.{u2} β) (Finset.hasEmptyc.{u2} β))))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β}, Iff (Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β s t) (EmptyCollection.emptyCollection.{max u2 u1} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instEmptyCollectionFinset.{max u2 u1} (Prod.{u2, u1} α β)))) (Or (Eq.{succ u2} (Finset.{u2} α) s (EmptyCollection.emptyCollection.{u2} (Finset.{u2} α) (Finset.instEmptyCollectionFinset.{u2} α))) (Eq.{succ u1} (Finset.{u1} β) t (EmptyCollection.emptyCollection.{u1} (Finset.{u1} β) (Finset.instEmptyCollectionFinset.{u1} β))))
Case conversion may be inaccurate. Consider using '#align finset.product_eq_empty Finset.product_eq_emptyₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem product_eq_empty {s : Finset α} {t : Finset β} : s ×ˢ t = ∅ ↔ s = ∅ ∨ t = ∅ := by
rw [← not_nonempty_iff_eq_empty, nonempty_product, not_and_or, not_nonempty_iff_eq_empty,
not_nonempty_iff_eq_empty]
#align finset.product_eq_empty Finset.product_eq_empty
/- warning: finset.singleton_product -> Finset.singleton_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {t : Finset.{u2} β} {a : α}, Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) a) t) (Finset.map.{u2, max u1 u2} β (Prod.{u1, u2} α β) (Function.Embedding.mk.{succ u2, succ (max u1 u2)} β (Prod.{u1, u2} α β) (Prod.mk.{u1, u2} α β a) (Prod.mk.inj_left.{u1, u2} α β a)) t)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {t : Finset.{u1} β} {a : α}, Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β (Singleton.singleton.{u2, u2} α (Finset.{u2} α) (Finset.instSingletonFinset.{u2} α) a) t) (Finset.map.{u1, max u1 u2} β (Prod.{u2, u1} α β) (Function.Embedding.mk.{succ u1, succ (max u1 u2)} β (Prod.{u2, u1} α β) (Prod.mk.{u2, u1} α β a) (Prod.mk.inj_left.{u1, u2} α β a)) t)
Case conversion may be inaccurate. Consider using '#align finset.singleton_product Finset.singleton_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem singleton_product {a : α} : ({a} : Finset α) ×ˢ t = t.map ⟨Prod.mk a, Prod.mk.inj_left _⟩ :=
by
ext ⟨x, y⟩
simp [and_left_comm, eq_comm]
#align finset.singleton_product Finset.singleton_product
/- warning: finset.product_singleton -> Finset.product_singleton is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {b : β}, Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s (Singleton.singleton.{u2, u2} β (Finset.{u2} β) (Finset.hasSingleton.{u2} β) b)) (Finset.map.{u1, max u1 u2} α (Prod.{u1, u2} α β) (Function.Embedding.mk.{succ u1, succ (max u1 u2)} α (Prod.{u1, u2} α β) (fun (i : α) => Prod.mk.{u1, u2} α β i b) (Prod.mk.inj_right.{u1, u2} α β b)) s)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {b : β}, Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β s (Singleton.singleton.{u1, u1} β (Finset.{u1} β) (Finset.instSingletonFinset.{u1} β) b)) (Finset.map.{u2, max u1 u2} α (Prod.{u2, u1} α β) (Function.Embedding.mk.{succ u2, succ (max u1 u2)} α (Prod.{u2, u1} α β) (fun (i : α) => Prod.mk.{u2, u1} α β i b) (Prod.mk.inj_right.{u1, u2} α β b)) s)
Case conversion may be inaccurate. Consider using '#align finset.product_singleton Finset.product_singletonₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem product_singleton {b : β} : s ×ˢ {b} = s.map ⟨fun i => (i, b), Prod.mk.inj_right _⟩ :=
by
ext ⟨x, y⟩
simp [and_left_comm, eq_comm]
#align finset.product_singleton Finset.product_singleton
/- warning: finset.singleton_product_singleton -> Finset.singleton_product_singleton is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {a : α} {b : β}, Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) a) (Singleton.singleton.{u2, u2} β (Finset.{u2} β) (Finset.hasSingleton.{u2} β) b)) (Singleton.singleton.{max u1 u2, max u1 u2} (Prod.{u1, u2} α β) (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasSingleton.{max u1 u2} (Prod.{u1, u2} α β)) (Prod.mk.{u1, u2} α β a b))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {a : α} {b : β}, Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β (Singleton.singleton.{u2, u2} α (Finset.{u2} α) (Finset.instSingletonFinset.{u2} α) a) (Singleton.singleton.{u1, u1} β (Finset.{u1} β) (Finset.instSingletonFinset.{u1} β) b)) (Singleton.singleton.{max u1 u2, max u2 u1} (Prod.{u2, u1} α β) (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instSingletonFinset.{max u2 u1} (Prod.{u2, u1} α β)) (Prod.mk.{u2, u1} α β a b))
Case conversion may be inaccurate. Consider using '#align finset.singleton_product_singleton Finset.singleton_product_singletonₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem singleton_product_singleton {a : α} {b : β} :
({a} : Finset α) ×ˢ ({b} : Finset β) = {(a, b)} := by
simp only [product_singleton, Function.Embedding.coeFn_mk, map_singleton]
#align finset.singleton_product_singleton Finset.singleton_product_singleton
/- warning: finset.union_product -> Finset.union_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {s' : Finset.{u1} α} {t : Finset.{u2} β} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β], Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β (Union.union.{u1} (Finset.{u1} α) (Finset.hasUnion.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s s') t) (Union.union.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasUnion.{max u1 u2} (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {s' : Finset.{u2} α} {t : Finset.{u1} β} [_inst_1 : DecidableEq.{succ u2} α] [_inst_2 : DecidableEq.{succ u1} β], Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β (Union.union.{u2} (Finset.{u2} α) (Finset.instUnionFinset.{u2} α (fun (a : α) (b : α) => _inst_1 a b)) s s') t) (Union.union.{max u1 u2} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instUnionFinset.{max u2 u1} (Prod.{u2, u1} α β) (fun (a : Prod.{u2, u1} α β) (b : Prod.{u2, u1} α β) => instDecidableEqProd.{u2, u1} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s' t))
Case conversion may be inaccurate. Consider using '#align finset.union_product Finset.union_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem union_product [DecidableEq α] [DecidableEq β] : (s ∪ s') ×ˢ t = s ×ˢ t ∪ s' ×ˢ t :=
by
ext ⟨x, y⟩
simp only [or_and_right, mem_union, mem_product]
#align finset.union_product Finset.union_product
/- warning: finset.product_union -> Finset.product_union is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} {t' : Finset.{u2} β} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β], Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s (Union.union.{u2} (Finset.{u2} β) (Finset.hasUnion.{u2} β (fun (a : β) (b : β) => _inst_2 a b)) t t')) (Union.union.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasUnion.{max u1 u2} (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s t'))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β} {t' : Finset.{u1} β} [_inst_1 : DecidableEq.{succ u2} α] [_inst_2 : DecidableEq.{succ u1} β], Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β s (Union.union.{u1} (Finset.{u1} β) (Finset.instUnionFinset.{u1} β (fun (a : β) (b : β) => _inst_2 a b)) t t')) (Union.union.{max u1 u2} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instUnionFinset.{max u2 u1} (Prod.{u2, u1} α β) (fun (a : Prod.{u2, u1} α β) (b : Prod.{u2, u1} α β) => instDecidableEqProd.{u2, u1} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s t'))
Case conversion may be inaccurate. Consider using '#align finset.product_union Finset.product_unionₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem product_union [DecidableEq α] [DecidableEq β] : s ×ˢ (t ∪ t') = s ×ˢ t ∪ s ×ˢ t' :=
by
ext ⟨x, y⟩
simp only [and_or_left, mem_union, mem_product]
#align finset.product_union Finset.product_union
/- warning: finset.inter_product -> Finset.inter_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {s' : Finset.{u1} α} {t : Finset.{u2} β} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β], Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β (Inter.inter.{u1} (Finset.{u1} α) (Finset.hasInter.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s s') t) (Inter.inter.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasInter.{max u1 u2} (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {s' : Finset.{u2} α} {t : Finset.{u1} β} [_inst_1 : DecidableEq.{succ u2} α] [_inst_2 : DecidableEq.{succ u1} β], Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β (Inter.inter.{u2} (Finset.{u2} α) (Finset.instInterFinset.{u2} α (fun (a : α) (b : α) => _inst_1 a b)) s s') t) (Inter.inter.{max u1 u2} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instInterFinset.{max u2 u1} (Prod.{u2, u1} α β) (fun (a : Prod.{u2, u1} α β) (b : Prod.{u2, u1} α β) => instDecidableEqProd.{u2, u1} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s' t))
Case conversion may be inaccurate. Consider using '#align finset.inter_product Finset.inter_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem inter_product [DecidableEq α] [DecidableEq β] : (s ∩ s') ×ˢ t = s ×ˢ t ∩ s' ×ˢ t :=
by
ext ⟨x, y⟩
simp only [← and_and_right, mem_inter, mem_product]
#align finset.inter_product Finset.inter_product
/- warning: finset.product_inter -> Finset.product_inter is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} {t' : Finset.{u2} β} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β], Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s (Inter.inter.{u2} (Finset.{u2} β) (Finset.hasInter.{u2} β (fun (a : β) (b : β) => _inst_2 a b)) t t')) (Inter.inter.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasInter.{max u1 u2} (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s t'))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {t : Finset.{u1} β} {t' : Finset.{u1} β} [_inst_1 : DecidableEq.{succ u2} α] [_inst_2 : DecidableEq.{succ u1} β], Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β s (Inter.inter.{u1} (Finset.{u1} β) (Finset.instInterFinset.{u1} β (fun (a : β) (b : β) => _inst_2 a b)) t t')) (Inter.inter.{max u1 u2} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instInterFinset.{max u2 u1} (Prod.{u2, u1} α β) (fun (a : Prod.{u2, u1} α β) (b : Prod.{u2, u1} α β) => instDecidableEqProd.{u2, u1} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s t'))
Case conversion may be inaccurate. Consider using '#align finset.product_inter Finset.product_interₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_inter [DecidableEq α] [DecidableEq β] : s ×ˢ (t ∩ t') = s ×ˢ t ∩ s ×ˢ t' :=
by
ext ⟨x, y⟩
simp only [← and_and_left, mem_inter, mem_product]
#align finset.product_inter Finset.product_inter
/- warning: finset.product_inter_product -> Finset.product_inter_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {s' : Finset.{u1} α} {t : Finset.{u2} β} {t' : Finset.{u2} β} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β], Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Inter.inter.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.hasInter.{max u1 u2} (Prod.{u1, u2} α β) (fun (a : Prod.{u1, u2} α β) (b : Prod.{u1, u2} α β) => Prod.decidableEq.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t')) (Finset.product.{u1, u2} α β (Inter.inter.{u1} (Finset.{u1} α) (Finset.hasInter.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s s') (Inter.inter.{u2} (Finset.{u2} β) (Finset.hasInter.{u2} β (fun (a : β) (b : β) => _inst_2 a b)) t t'))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {s' : Finset.{u2} α} {t : Finset.{u1} β} {t' : Finset.{u1} β} [_inst_1 : DecidableEq.{succ u2} α] [_inst_2 : DecidableEq.{succ u1} β], Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Inter.inter.{max u1 u2} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.instInterFinset.{max u2 u1} (Prod.{u2, u1} α β) (fun (a : Prod.{u2, u1} α β) (b : Prod.{u2, u1} α β) => instDecidableEqProd.{u2, u1} α β (fun (a : α) (b : α) => _inst_1 a b) (fun (a : β) (b : β) => _inst_2 a b) a b)) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s' t')) (Finset.product.{u2, u1} α β (Inter.inter.{u2} (Finset.{u2} α) (Finset.instInterFinset.{u2} α (fun (a : α) (b : α) => _inst_1 a b)) s s') (Inter.inter.{u1} (Finset.{u1} β) (Finset.instInterFinset.{u1} β (fun (a : β) (b : β) => _inst_2 a b)) t t'))
Case conversion may be inaccurate. Consider using '#align finset.product_inter_product Finset.product_inter_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_inter_product [DecidableEq α] [DecidableEq β] :
s ×ˢ t ∩ s' ×ˢ t' = (s ∩ s') ×ˢ (t ∩ t') :=
by
ext ⟨x, y⟩
simp only [and_assoc', and_left_comm, mem_inter, mem_product]
#align finset.product_inter_product Finset.product_inter_product
/- warning: finset.disjoint_product -> Finset.disjoint_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {s' : Finset.{u1} α} {t : Finset.{u2} β} {t' : Finset.{u2} β}, Iff (Disjoint.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.partialOrder.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.orderBot.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t')) (Or (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.orderBot.{u1} α) s s') (Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.orderBot.{u2} β) t t'))
but is expected to have type
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {s' : Finset.{u1} α} {t : Finset.{u2} β} {t' : Finset.{u2} β}, Iff (Disjoint.{max u2 u1} (Finset.{max u2 u1} (Prod.{u1, u2} α β)) (Finset.partialOrder.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t')) (Or (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} α) s s') (Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u2} β) t t'))
Case conversion may be inaccurate. Consider using '#align finset.disjoint_product Finset.disjoint_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem disjoint_product : Disjoint (s ×ˢ t) (s' ×ˢ t') ↔ Disjoint s s' ∨ Disjoint t t' := by
simp_rw [← disjoint_coe, coe_product, Set.disjoint_prod]
#align finset.disjoint_product Finset.disjoint_product
/- warning: finset.disj_union_product -> Finset.disjUnion_product is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {s' : Finset.{u1} α} {t : Finset.{u2} β} (hs : Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.orderBot.{u1} α) s s'), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β (Finset.disjUnion.{u1} α s s' hs) t) (Finset.disjUnion.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t) (Iff.mpr (Disjoint.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.partialOrder.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.orderBot.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s' t)) (Or (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.orderBot.{u1} α) s s') (Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.orderBot.{u2} β) t t)) (Finset.disjoint_product.{u1, u2} α β s s' t t) (Or.inl (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.orderBot.{u1} α) s s') (Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.orderBot.{u2} β) t t) hs)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {s : Finset.{u2} α} {s' : Finset.{u2} α} {t : Finset.{u1} β} (hs : Disjoint.{u2} (Finset.{u2} α) (Finset.partialOrder.{u2} α) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u2} α) s s'), Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β (Finset.disjUnion.{u2} α s s' hs) t) (Finset.disjUnion.{max u2 u1} (Prod.{u2, u1} α β) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s' t) (Iff.mpr (Disjoint.{max u1 u2} (Finset.{max u1 u2} (Prod.{u2, u1} α β)) (Finset.partialOrder.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{max u2 u1} (Prod.{u2, u1} α β)) (Finset.product.{u2, u1} α β s t) (Finset.product.{u2, u1} α β s' t)) (Or (Disjoint.{u2} (Finset.{u2} α) (Finset.partialOrder.{u2} α) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u2} α) s s') (Disjoint.{u1} (Finset.{u1} β) (Finset.partialOrder.{u1} β) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} β) t t)) (Finset.disjoint_product.{u2, u1} α β s s' t t) (Or.inl (Disjoint.{u2} (Finset.{u2} α) (Finset.partialOrder.{u2} α) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u2} α) s s') (Disjoint.{u1} (Finset.{u1} β) (Finset.partialOrder.{u1} β) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} β) t t) hs)))
Case conversion may be inaccurate. Consider using '#align finset.disj_union_product Finset.disjUnion_productₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem disjUnion_product (hs : Disjoint s s') :
s.disjUnion s' hs ×ˢ t = (s ×ˢ t).disjUnion (s' ×ˢ t) (disjoint_product.mpr <| Or.inl hs) :=
eq_of_veq <| Multiset.add_product _ _ _
#align finset.disj_union_product Finset.disjUnion_product
/- warning: finset.product_disj_union -> Finset.product_disjUnion is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} {t' : Finset.{u2} β} (ht : Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.orderBot.{u2} β) t t'), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s (Finset.disjUnion.{u2} β t t' ht)) (Finset.disjUnion.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s t') (Iff.mpr (Disjoint.{max u1 u2} (Finset.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.partialOrder.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.orderBot.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s t')) (Or (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.orderBot.{u1} α) s s) (Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.orderBot.{u2} β) t t')) (Finset.disjoint_product.{u1, u2} α β s s t t') (Or.inr (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.orderBot.{u1} α) s s) (Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.orderBot.{u2} β) t t') ht)))
but is expected to have type
forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {t : Finset.{u2} β} {t' : Finset.{u2} β} (ht : Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u2} β) t t'), Eq.{max (succ u1) (succ u2)} (Finset.{max u2 u1} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s (Finset.disjUnion.{u2} β t t' ht)) (Finset.disjUnion.{max u1 u2} (Prod.{u1, u2} α β) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s t') (Iff.mpr (Disjoint.{max u2 u1} (Finset.{max u2 u1} (Prod.{u1, u2} α β)) (Finset.partialOrder.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{max u1 u2} (Prod.{u1, u2} α β)) (Finset.product.{u1, u2} α β s t) (Finset.product.{u1, u2} α β s t')) (Or (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} α) s s) (Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u2} β) t t')) (Finset.disjoint_product.{u1, u2} α β s s t t') (Or.inr (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} α) s s) (Disjoint.{u2} (Finset.{u2} β) (Finset.partialOrder.{u2} β) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u2} β) t t') ht)))
Case conversion may be inaccurate. Consider using '#align finset.product_disj_union Finset.product_disjUnionₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem product_disjUnion (ht : Disjoint t t') :
s ×ˢ t.disjUnion t' ht = (s ×ˢ t).disjUnion (s ×ˢ t') (disjoint_product.mpr <| Or.inr ht) :=
eq_of_veq <| Multiset.product_add _ _ _
#align finset.product_disj_union Finset.product_disjUnion
end Prod
section Diag
variable [DecidableEq α] (s t : Finset α)
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
#print Finset.diag /-
/-- Given a finite set `s`, the diagonal, `s.diag` is the set of pairs of the form `(a, a)` for
`a ∈ s`. -/
def diag :=
(s ×ˢ s).filterₓ fun a : α × α => a.fst = a.snd
#align finset.diag Finset.diag
-/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
#print Finset.offDiag /-
/-- Given a finite set `s`, the off-diagonal, `s.off_diag` is the set of pairs `(a, b)` with `a ≠ b`
for `a, b ∈ s`. -/
def offDiag :=
(s ×ˢ s).filterₓ fun a : α × α => a.fst ≠ a.snd
#align finset.off_diag Finset.offDiag
-/
variable {s} {x : α × α}
#print Finset.mem_diag /-
@[simp]
theorem mem_diag : x ∈ s.diag ↔ x.1 ∈ s ∧ x.1 = x.2 :=
by
simp only [diag, mem_filter, mem_product]
constructor <;> intro h <;> simp only [h, and_true_iff, eq_self_iff_true, and_self_iff]
rw [← h.2]
exact h.1
#align finset.mem_diag Finset.mem_diag
-/
#print Finset.mem_offDiag /-
@[simp]
theorem mem_offDiag : x ∈ s.offDiag ↔ x.1 ∈ s ∧ x.2 ∈ s ∧ x.1 ≠ x.2 :=
by
simp only [off_diag, mem_filter, mem_product]
constructor <;> intro h <;> simp only [h, Ne.def, not_false_iff, and_self_iff]
#align finset.mem_off_diag Finset.mem_offDiag
-/
variable (s)
#print Finset.coe_offDiag /-
@[simp, norm_cast]
theorem coe_offDiag : (s.offDiag : Set (α × α)) = (s : Set α).offDiag :=
Set.ext fun _ => mem_offDiag
#align finset.coe_off_diag Finset.coe_offDiag
-/
#print Finset.diag_card /-
@[simp]
theorem diag_card : (diag s).card = s.card :=
by
suffices diag s = s.image fun a => (a, a) by
rw [this]
apply card_image_of_inj_on
exact fun x1 h1 x2 h2 h3 => (Prod.mk.inj h3).1
ext ⟨a₁, a₂⟩
rw [mem_diag]
constructor <;> intro h <;> rw [Finset.mem_image] at *
· use a₁, h.1, prod.mk.inj_iff.mpr ⟨rfl, h.2⟩
· rcases h with ⟨a, h1, h2⟩
have h := Prod.mk.inj h2
rw [← h.1, ← h.2]
use h1
#align finset.diag_card Finset.diag_card
-/
#print Finset.offDiag_card /-
@[simp]
theorem offDiag_card : (offDiag s).card = s.card * s.card - s.card :=
by
suffices (diag s).card + (off_diag s).card = s.card * s.card
by
nth_rw 3 [← s.diag_card]
simp only [diag_card] at *
rw [tsub_eq_of_eq_add_rev]
rw [this]
rw [← card_product]
apply filter_card_add_filter_neg_card_eq_card
#align finset.off_diag_card Finset.offDiag_card
-/
#print Finset.diag_mono /-
@[mono]
theorem diag_mono : Monotone (diag : Finset α → Finset (α × α)) := fun s t h x hx =>
mem_diag.2 <| And.imp_left (@h _) <| mem_diag.1 hx
#align finset.diag_mono Finset.diag_mono
-/
#print Finset.offDiag_mono /-
@[mono]
theorem offDiag_mono : Monotone (offDiag : Finset α → Finset (α × α)) := fun s t h x hx =>
mem_offDiag.2 <| And.imp (@h _) (And.imp_left <| @h _) <| mem_offDiag.1 hx
#align finset.off_diag_mono Finset.offDiag_mono
-/
#print Finset.diag_empty /-
@[simp]
theorem diag_empty : (∅ : Finset α).diag = ∅ :=
rfl
#align finset.diag_empty Finset.diag_empty
-/
#print Finset.offDiag_empty /-
@[simp]
theorem offDiag_empty : (∅ : Finset α).offDiag = ∅ :=
rfl
#align finset.off_diag_empty Finset.offDiag_empty
-/
/- warning: finset.diag_union_off_diag -> Finset.diag_union_offDiag is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasUnion.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)) (Finset.product.{u1, u1} α α s s)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instUnionFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)) (Finset.product.{u1, u1} α α s s)
Case conversion may be inaccurate. Consider using '#align finset.diag_union_off_diag Finset.diag_union_offDiagₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@[simp]
theorem diag_union_offDiag : s.diag ∪ s.offDiag = s ×ˢ s :=
filter_union_filter_neg_eq _ _
#align finset.diag_union_off_diag Finset.diag_union_offDiag
/- warning: finset.disjoint_diag_off_diag -> Finset.disjoint_diag_offDiag is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Disjoint.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.partialOrder.{u1} (Prod.{u1, u1} α α)) (Finset.orderBot.{u1} (Prod.{u1, u1} α α)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Disjoint.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.partialOrder.{u1} (Prod.{u1, u1} α α)) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} (Prod.{u1, u1} α α)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)
Case conversion may be inaccurate. Consider using '#align finset.disjoint_diag_off_diag Finset.disjoint_diag_offDiagₓ'. -/
@[simp]
theorem disjoint_diag_offDiag : Disjoint s.diag s.offDiag :=
disjoint_filter_filter_neg _ _ _
#align finset.disjoint_diag_off_diag Finset.disjoint_diag_offDiag
/- warning: finset.product_sdiff_diag -> Finset.product_sdiff_diag is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (SDiff.sdiff.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasSdiff.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.product.{u1, u1} α α s s) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (SDiff.sdiff.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instSDiffFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.product.{u1, u1} α α s s) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)
Case conversion may be inaccurate. Consider using '#align finset.product_sdiff_diag Finset.product_sdiff_diagₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_sdiff_diag : s ×ˢ s \ s.diag = s.offDiag := by
rw [← diag_union_off_diag, union_comm, union_sdiff_self,
sdiff_eq_self_of_disjoint (disjoint_diag_off_diag _).symm]
#align finset.product_sdiff_diag Finset.product_sdiff_diag
/- warning: finset.product_sdiff_off_diag -> Finset.product_sdiff_offDiag is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (SDiff.sdiff.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasSdiff.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.product.{u1, u1} α α s s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (SDiff.sdiff.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instSDiffFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.product.{u1, u1} α α s s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s)
Case conversion may be inaccurate. Consider using '#align finset.product_sdiff_off_diag Finset.product_sdiff_offDiagₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem product_sdiff_offDiag : s ×ˢ s \ s.offDiag = s.diag := by
rw [← diag_union_off_diag, union_sdiff_self, sdiff_eq_self_of_disjoint (disjoint_diag_off_diag _)]
#align finset.product_sdiff_off_diag Finset.product_sdiff_offDiag
/- warning: finset.diag_inter -> Finset.diag_inter is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (t : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Inter.inter.{u1} (Finset.{u1} α) (Finset.hasInter.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s t)) (Inter.inter.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasInter.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) t))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (t : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Inter.inter.{u1} (Finset.{u1} α) (Finset.instInterFinset.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s t)) (Inter.inter.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instInterFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) t))
Case conversion may be inaccurate. Consider using '#align finset.diag_inter Finset.diag_interₓ'. -/
theorem diag_inter : (s ∩ t).diag = s.diag ∩ t.diag :=
ext fun x => by simpa only [mem_diag, mem_inter] using and_and_right _ _ _
#align finset.diag_inter Finset.diag_inter
/- warning: finset.off_diag_inter -> Finset.offDiag_inter is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (t : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Inter.inter.{u1} (Finset.{u1} α) (Finset.hasInter.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s t)) (Inter.inter.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasInter.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) t))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (t : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Inter.inter.{u1} (Finset.{u1} α) (Finset.instInterFinset.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s t)) (Inter.inter.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instInterFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) t))
Case conversion may be inaccurate. Consider using '#align finset.off_diag_inter Finset.offDiag_interₓ'. -/
theorem offDiag_inter : (s ∩ t).offDiag = s.offDiag ∩ t.offDiag :=
coe_injective <| by
push_cast
exact Set.offDiag_inter _ _
#align finset.off_diag_inter Finset.offDiag_inter
/- warning: finset.diag_union -> Finset.diag_union is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (t : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Union.union.{u1} (Finset.{u1} α) (Finset.hasUnion.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s t)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasUnion.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) t))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (t : Finset.{u1} α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Union.union.{u1} (Finset.{u1} α) (Finset.instUnionFinset.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s t)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instUnionFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) t))
Case conversion may be inaccurate. Consider using '#align finset.diag_union Finset.diag_unionₓ'. -/
theorem diag_union : (s ∪ t).diag = s.diag ∪ t.diag :=
by
ext ⟨i, j⟩
simp only [mem_diag, mem_union, or_and_right]
#align finset.diag_union Finset.diag_union
variable {s t}
/- warning: finset.off_diag_union -> Finset.offDiag_union is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] {s : Finset.{u1} α} {t : Finset.{u1} α}, (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.orderBot.{u1} α) s t) -> (Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Union.union.{u1} (Finset.{u1} α) (Finset.hasUnion.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s t)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasUnion.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasUnion.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasUnion.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) t)) (Finset.product.{u1, u1} α α s t)) (Finset.product.{u1, u1} α α t s)))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] {s : Finset.{u1} α} {t : Finset.{u1} α}, (Disjoint.{u1} (Finset.{u1} α) (Finset.partialOrder.{u1} α) (Finset.instOrderBotFinsetToLEToPreorderPartialOrder.{u1} α) s t) -> (Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Union.union.{u1} (Finset.{u1} α) (Finset.instUnionFinset.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) s t)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instUnionFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instUnionFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instUnionFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) t)) (Finset.product.{u1, u1} α α s t)) (Finset.product.{u1, u1} α α t s)))
Case conversion may be inaccurate. Consider using '#align finset.off_diag_union Finset.offDiag_unionₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem offDiag_union (h : Disjoint s t) :
(s ∪ t).offDiag = s.offDiag ∪ t.offDiag ∪ s ×ˢ t ∪ t ×ˢ s :=
coe_injective <| by
push_cast
exact Set.offDiag_union (disjoint_coe.2 h)
#align finset.off_diag_union Finset.offDiag_union
variable (a : α)
#print Finset.offDiag_singleton /-
@[simp]
theorem offDiag_singleton : ({a} : Finset α).offDiag = ∅ := by simp [← Finset.card_eq_zero]
#align finset.off_diag_singleton Finset.offDiag_singleton
-/
#print Finset.diag_singleton /-
theorem diag_singleton : ({a} : Finset α).diag = {(a, a)} := by
rw [← product_sdiff_off_diag, off_diag_singleton, sdiff_empty, singleton_product_singleton]
#align finset.diag_singleton Finset.diag_singleton
-/
/- warning: finset.diag_insert -> Finset.diag_insert is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] {s : Finset.{u1} α} (a : α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Insert.insert.{u1, u1} α (Finset.{u1} α) (Finset.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a s)) (Insert.insert.{u1, u1} (Prod.{u1, u1} α α) (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasInsert.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Prod.mk.{u1, u1} α α a a) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] {s : Finset.{u1} α} (a : α), Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Insert.insert.{u1, u1} α (Finset.{u1} α) (Finset.instInsertFinset.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a s)) (Insert.insert.{u1, u1} (Prod.{u1, u1} α α) (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instInsertFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Prod.mk.{u1, u1} α α a a) (Finset.diag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s))
Case conversion may be inaccurate. Consider using '#align finset.diag_insert Finset.diag_insertₓ'. -/
theorem diag_insert : (insert a s).diag = insert (a, a) s.diag := by
rw [insert_eq, insert_eq, diag_union, diag_singleton]
#align finset.diag_insert Finset.diag_insert
/- warning: finset.off_diag_insert -> Finset.offDiag_insert is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] {s : Finset.{u1} α} (a : α), (Not (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s)) -> (Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Insert.insert.{u1, u1} α (Finset.{u1} α) (Finset.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a s)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasUnion.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.hasUnion.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => Prod.decidableEq.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.product.{u1, u1} α α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) a) s)) (Finset.product.{u1, u1} α α s (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) a))))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] {s : Finset.{u1} α} (a : α), (Not (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) a s)) -> (Eq.{succ u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Insert.insert.{u1, u1} α (Finset.{u1} α) (Finset.instInsertFinset.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a s)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instUnionFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Union.union.{u1} (Finset.{u1} (Prod.{u1, u1} α α)) (Finset.instUnionFinset.{u1} (Prod.{u1, u1} α α) (fun (a : Prod.{u1, u1} α α) (b : Prod.{u1, u1} α α) => instDecidableEqProd.{u1, u1} α α (fun (a : α) (b : α) => _inst_1 a b) (fun (a : α) (b : α) => _inst_1 a b) a b)) (Finset.offDiag.{u1} α (fun (a : α) (b : α) => _inst_1 a b) s) (Finset.product.{u1, u1} α α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) a) s)) (Finset.product.{u1, u1} α α s (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) a))))
Case conversion may be inaccurate. Consider using '#align finset.off_diag_insert Finset.offDiag_insertₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem offDiag_insert (has : a ∉ s) : (insert a s).offDiag = s.offDiag ∪ {a} ×ˢ s ∪ s ×ˢ {a} := by
rw [insert_eq, union_comm, off_diag_union (disjoint_singleton_right.2 has), off_diag_singleton,
union_empty, union_right_comm]
#align finset.off_diag_insert Finset.offDiag_insert
end Diag
end Finset
|
If a sequence converges to a limit $l$, then $l$ is the only limit point of the sequence.
|
module Control.JS.Async
export
data Async : Type -> Type where
Pure : a -> Async a
LiftIO : PrimIO a -> Async a
Asyn : ((a -> PrimIO ()) -> PrimIO ()) -> Async a
Par : Async (a -> b) -> Async a -> Async b
Bind : Async a -> (a -> Async b) -> Async b
export
Functor Async where
map f (Pure x) = Pure $ f x
map f (LiftIO g) = LiftIO $ \w => let MkIORes x w' = g w in MkIORes (f x) w'
map f (Asyn g) = Asyn $ \k, w => g (\x, w' => k (f x) w') w
map f (Par mf mx) = Par (map (f .) mf) mx
map f (Bind mx g) = Bind mx $ \x => map f $ g x
export
Applicative Async where
pure = Pure
mf <*> mx = Bind mf $ \f => map f mx
export
[Parallel] Applicative Async where
pure = Pure
(<*>) = Par
export
Monad Async where
(>>=) = Bind
export
HasIO Async where
liftIO act = LiftIO (toPrim act)
export %inline
parallel : Traversable t => t (Async a) -> Async (t a)
parallel = sequence @{Parallel}
export %inline
parallelMap : Traversable t => (a -> Async b) -> t a -> Async (t b)
parallelMap = traverse @{%search} @{Parallel}
export %inline
prim__async : ((a -> PrimIO ()) -> PrimIO ()) -> Async a
prim__async = Asyn
export %inline
async : ((a -> IO ()) -> IO ()) -> Async a
async f = prim__async (\k, w => toPrim (f (\x => fromPrim (k x))) w)
data Promise : Type -> Type where [external]
%foreign "javascript:support:pure,async"
promise__pure : {0 a : _} -> a -> PrimIO (Promise a)
%foreign "javascript:support:liftIO,async"
promise__liftIO : {0 a : _} -> PrimIO a -> PrimIO (Promise a)
%foreign "javascript:support:async,async"
promise__async : {0 a : _} -> ((a -> PrimIO ()) -> PrimIO ()) -> PrimIO (Promise a)
%foreign "javascript:support:par_app,async"
promise__par_app : {0 a, b : _} -> Promise (a -> b) -> Promise a -> PrimIO (Promise b)
%foreign "javascript:support:bind,async"
promise__bind :{0 a, b : _} -> Promise a -> (a -> PrimIO (Promise b)) -> PrimIO (Promise b)
export
toPromise : Async a -> IO (Promise a)
toPromise (Pure x) = fromPrim $ promise__pure x
toPromise (LiftIO f) = fromPrim $ promise__liftIO f
toPromise (Asyn f) = fromPrim $ promise__async f
toPromise (Par x y) = fromPrim $ promise__par_app !(toPromise x) !(toPromise y)
toPromise (Bind x f) = fromPrim $ promise__bind !(toPromise x) (\x => toPrim $ toPromise (f x))
export
launch : Async a -> IO ()
launch = ignore . toPromise
|
(* seplog (c) AIST 2005-2013. R. Affeldt, N. Marti, et al. GNU GPLv3. *)
(* seplog (c) AIST 2014-2018. R. Affeldt et al. GNU GPLv3. *)
Require Import ssreflect.
From mathcomp Require Import eqtype.
Require Import bipl ZArith.
Require Import expr_b_dp.
Require Import topsy_hm.
Import seplog_Z_m.assert_m.expr_m.
Import seplog_Z_m.
Local Open Scope seplog_expr_scope.
Local Open Scope seplog_cmd_scope.
(*
65 Error hmInit(Address addr)
66 {
67 start = (HmEntry)addr;
68 start->next = (HmEntry)((unsigned long)addr + KERNELHEAPSIZE +
69 sizeof(HmEntryDesc));
70 start->status = HM_FREED;
71
72 end = start->next;
73 end->next = NULL;
74 end->status = HM_ALLOCATED;
75
76 hmLock = &hmLockDesc;
77 lockInit( hmLock);
78
79 return HM_INITOK;
80 }
*)
(** global variable *)
Definition hmEnd : var.v := 1%nat.
Definition hmInit (adr sz : nat) :=
hmStart <- nat_e adr ;
hmStart -.> next *<- nat_e adr \+ nat_e sz \- cst_e 2%Z ;
hmStart -.> status *<- Free ;
hmEnd <-* hmStart -.> next ;
hmEnd -.> next *<- cst_e 0%Z ;
hmEnd -.> status *<- Allocated.
|
[STATEMENT]
lemma lambda_enc_4:
"[\<lparr>(\<^bold>\<lambda> x . \<lbrace>x\<^sup>P, F\<rbrace>), x\<^sup>P\<rparr> in v] = (\<exists> y . \<nu>\<upsilon> y = \<nu>\<upsilon> x \<and> [\<lbrace>y\<^sup>P, F\<rbrace> in v])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. [\<lparr>\<^bold>\<lambda>x. \<lbrace>x\<^sup>P,F\<rbrace>,x\<^sup>P\<rparr> in v] = (\<exists>y. \<nu>\<upsilon> y = \<nu>\<upsilon> x \<and> [\<lbrace>y\<^sup>P,F\<rbrace> in v])
[PROOF STEP]
by (simp add: meta_defs meta_aux)
|
/-
Copyright (c) 2019 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison, Bhavik Mehta, Adam Topaz
! This file was ported from Lean 3 source module category_theory.monad.basic
! leanprover-community/mathlib commit cb3ceec8485239a61ed51d944cb9a95b68c6bafc
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.CategoryTheory.Functor.Category
import Mathbin.CategoryTheory.Functor.FullyFaithful
import Mathbin.CategoryTheory.Functor.ReflectsIsomorphisms
/-!
# Monads
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.
We construct the categories of monads and comonads, and their forgetful functors to endofunctors.
(Note that these are the category theorist's monads, not the programmers monads.
For the translation, see the file `category_theory.monad.types`.)
For the fact that monads are "just" monoids in the category of endofunctors, see the file
`category_theory.monad.equiv_mon`.
-/
namespace CategoryTheory
open Category
universe v₁ u₁
-- morphism levels before object levels. See note [category_theory universes].
variable (C : Type u₁) [Category.{v₁} C]
#print CategoryTheory.Monad /-
/- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`η'] [] -/
/- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`μ'] [] -/
/-- The data of a monad on C consists of an endofunctor T together with natural transformations
η : 𝟭 C ⟶ T and μ : T ⋙ T ⟶ T satisfying three equations:
- T μ_X ≫ μ_X = μ_(TX) ≫ μ_X (associativity)
- η_(TX) ≫ μ_X = 1_X (left unit)
- Tη_X ≫ μ_X = 1_X (right unit)
-/
structure Monad extends C ⥤ C where
η' : 𝟭 _ ⟶ to_functor
μ' : to_functor ⋙ to_functor ⟶ to_functor
assoc' : ∀ X, to_functor.map (NatTrans.app μ' X) ≫ μ'.app _ = μ'.app _ ≫ μ'.app _ := by obviously
left_unit' : ∀ X : C, η'.app (to_functor.obj X) ≫ μ'.app _ = 𝟙 _ := by obviously
right_unit' : ∀ X : C, to_functor.map (η'.app X) ≫ μ'.app _ = 𝟙 _ := by obviously
#align category_theory.monad CategoryTheory.Monad
-/
#print CategoryTheory.Comonad /-
/- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`ε'] [] -/
/- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`δ'] [] -/
/-- The data of a comonad on C consists of an endofunctor G together with natural transformations
ε : G ⟶ 𝟭 C and δ : G ⟶ G ⋙ G satisfying three equations:
- δ_X ≫ G δ_X = δ_X ≫ δ_(GX) (coassociativity)
- δ_X ≫ ε_(GX) = 1_X (left counit)
- δ_X ≫ G ε_X = 1_X (right counit)
-/
structure Comonad extends C ⥤ C where
ε' : to_functor ⟶ 𝟭 _
δ' : to_functor ⟶ to_functor ⋙ to_functor
coassoc' : ∀ X, NatTrans.app δ' _ ≫ to_functor.map (δ'.app X) = δ'.app _ ≫ δ'.app _ := by
obviously
left_counit' : ∀ X : C, δ'.app X ≫ ε'.app (to_functor.obj X) = 𝟙 _ := by obviously
right_counit' : ∀ X : C, δ'.app X ≫ to_functor.map (ε'.app X) = 𝟙 _ := by obviously
#align category_theory.comonad CategoryTheory.Comonad
-/
variable {C} (T : Monad C) (G : Comonad C)
#print CategoryTheory.coeMonad /-
instance coeMonad : Coe (Monad C) (C ⥤ C) :=
⟨fun T => T.toFunctor⟩
#align category_theory.coe_monad CategoryTheory.coeMonad
-/
#print CategoryTheory.coeComonad /-
instance coeComonad : Coe (Comonad C) (C ⥤ C) :=
⟨fun G => G.toFunctor⟩
#align category_theory.coe_comonad CategoryTheory.coeComonad
-/
@[simp]
theorem monad_toFunctor_eq_coe : T.toFunctor = T :=
rfl
#align category_theory.monad_to_functor_eq_coe CategoryTheory.monad_toFunctor_eq_coe
@[simp]
theorem comonad_toFunctor_eq_coe : G.toFunctor = G :=
rfl
#align category_theory.comonad_to_functor_eq_coe CategoryTheory.comonad_toFunctor_eq_coe
#print CategoryTheory.Monad.η /-
/-- The unit for the monad `T`. -/
def Monad.η : 𝟭 _ ⟶ (T : C ⥤ C) :=
T.η'
#align category_theory.monad.η CategoryTheory.Monad.η
-/
#print CategoryTheory.Monad.μ /-
/-- The multiplication for the monad `T`. -/
def Monad.μ : (T : C ⥤ C) ⋙ (T : C ⥤ C) ⟶ T :=
T.μ'
#align category_theory.monad.μ CategoryTheory.Monad.μ
-/
#print CategoryTheory.Comonad.ε /-
/-- The counit for the comonad `G`. -/
def Comonad.ε : (G : C ⥤ C) ⟶ 𝟭 _ :=
G.ε'
#align category_theory.comonad.ε CategoryTheory.Comonad.ε
-/
#print CategoryTheory.Comonad.δ /-
/-- The comultiplication for the comonad `G`. -/
def Comonad.δ : (G : C ⥤ C) ⟶ (G : C ⥤ C) ⋙ G :=
G.δ'
#align category_theory.comonad.δ CategoryTheory.Comonad.δ
-/
#print CategoryTheory.Monad.Simps.coe /-
/-- A custom simps projection for the functor part of a monad, as a coercion. -/
def Monad.Simps.coe :=
(T : C ⥤ C)
#align category_theory.monad.simps.coe CategoryTheory.Monad.Simps.coe
-/
#print CategoryTheory.Monad.Simps.η /-
/-- A custom simps projection for the unit of a monad, in simp normal form. -/
def Monad.Simps.η : 𝟭 _ ⟶ (T : C ⥤ C) :=
T.η
#align category_theory.monad.simps.η CategoryTheory.Monad.Simps.η
-/
#print CategoryTheory.Monad.Simps.μ /-
/-- A custom simps projection for the multiplication of a monad, in simp normal form. -/
def Monad.Simps.μ : (T : C ⥤ C) ⋙ (T : C ⥤ C) ⟶ (T : C ⥤ C) :=
T.μ
#align category_theory.monad.simps.μ CategoryTheory.Monad.Simps.μ
-/
#print CategoryTheory.Comonad.Simps.coe /-
/-- A custom simps projection for the functor part of a comonad, as a coercion. -/
def Comonad.Simps.coe :=
(G : C ⥤ C)
#align category_theory.comonad.simps.coe CategoryTheory.Comonad.Simps.coe
-/
#print CategoryTheory.Comonad.Simps.ε /-
/-- A custom simps projection for the counit of a comonad, in simp normal form. -/
def Comonad.Simps.ε : (G : C ⥤ C) ⟶ 𝟭 _ :=
G.ε
#align category_theory.comonad.simps.ε CategoryTheory.Comonad.Simps.ε
-/
#print CategoryTheory.Comonad.Simps.δ /-
/-- A custom simps projection for the comultiplication of a comonad, in simp normal form. -/
def Comonad.Simps.δ : (G : C ⥤ C) ⟶ (G : C ⥤ C) ⋙ (G : C ⥤ C) :=
G.δ
#align category_theory.comonad.simps.δ CategoryTheory.Comonad.Simps.δ
-/
initialize_simps_projections category_theory.monad (toFunctor → coe, η' → η, μ' → μ)
initialize_simps_projections category_theory.comonad (toFunctor → coe, ε' → ε, δ' → δ)
/- warning: category_theory.monad.assoc -> CategoryTheory.Monad.assoc is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (T : CategoryTheory.Monad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X) (CategoryTheory.Functor.map.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (T : CategoryTheory.Monad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T))) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T))) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X) (Prefunctor.map.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T))) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X))
Case conversion may be inaccurate. Consider using '#align category_theory.monad.assoc CategoryTheory.Monad.assocₓ'. -/
@[reassoc.1]
theorem Monad.assoc (T : Monad C) (X : C) :
(T : C ⥤ C).map (T.μ.app X) ≫ T.μ.app _ = T.μ.app _ ≫ T.μ.app _ :=
T.assoc' X
#align category_theory.monad.assoc CategoryTheory.Monad.assoc
/- warning: category_theory.monad.left_unit -> CategoryTheory.Monad.left_unit is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (T : CategoryTheory.Monad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X)) (CategoryTheory.CategoryStruct.id.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (T : CategoryTheory.Monad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 T) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X)) (CategoryTheory.CategoryStruct.id.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X))
Case conversion may be inaccurate. Consider using '#align category_theory.monad.left_unit CategoryTheory.Monad.left_unitₓ'. -/
@[simp, reassoc.1]
theorem Monad.left_unit (T : Monad C) (X : C) :
T.η.app ((T : C ⥤ C).obj X) ≫ T.μ.app X = 𝟙 ((T : C ⥤ C).obj X) :=
T.left_unit' X
#align category_theory.monad.left_unit CategoryTheory.Monad.left_unit
/- warning: category_theory.monad.right_unit -> CategoryTheory.Monad.right_unit is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (T : CategoryTheory.Monad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X) (CategoryTheory.Functor.map.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 T) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X)) (CategoryTheory.CategoryStruct.id.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T) X))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (T : CategoryTheory.Monad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X) (Prefunctor.map.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 T) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 T) X)) (CategoryTheory.CategoryStruct.id.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T)) X))
Case conversion may be inaccurate. Consider using '#align category_theory.monad.right_unit CategoryTheory.Monad.right_unitₓ'. -/
@[simp, reassoc.1]
theorem Monad.right_unit (T : Monad C) (X : C) :
(T : C ⥤ C).map (T.η.app X) ≫ T.μ.app X = 𝟙 ((T : C ⥤ C).obj X) :=
T.right_unit' X
#align category_theory.monad.right_unit CategoryTheory.Monad.right_unit
/- warning: category_theory.comonad.coassoc -> CategoryTheory.Comonad.coassoc is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (G : CategoryTheory.Comonad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) X))) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X) (CategoryTheory.Functor.map.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X))) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X)))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (G : CategoryTheory.Comonad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G))) X))) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G))) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X) (Prefunctor.map.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G))) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X))) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G))) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X)))
Case conversion may be inaccurate. Consider using '#align category_theory.comonad.coassoc CategoryTheory.Comonad.coassocₓ'. -/
@[reassoc.1]
theorem Comonad.coassoc (G : Comonad C) (X : C) :
G.δ.app _ ≫ (G : C ⥤ C).map (G.δ.app X) = G.δ.app _ ≫ G.δ.app _ :=
G.coassoc' X
#align category_theory.comonad.coassoc CategoryTheory.Comonad.coassoc
/- warning: category_theory.comonad.left_counit -> CategoryTheory.Comonad.left_counit is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (G : CategoryTheory.Comonad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X))) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X))) (CategoryTheory.CategoryStruct.id.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (G : CategoryTheory.Comonad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X))) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 G) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X))) (CategoryTheory.CategoryStruct.id.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X))
Case conversion may be inaccurate. Consider using '#align category_theory.comonad.left_counit CategoryTheory.Comonad.left_counitₓ'. -/
@[simp, reassoc.1]
theorem Comonad.left_counit (G : Comonad C) (X : C) :
G.δ.app X ≫ G.ε.app ((G : C ⥤ C).obj X) = 𝟙 ((G : C ⥤ C).obj X) :=
G.left_counit' X
#align category_theory.comonad.left_counit CategoryTheory.Comonad.left_counit
/- warning: category_theory.comonad.right_counit -> CategoryTheory.Comonad.right_counit is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (G : CategoryTheory.Comonad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X))) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X) (CategoryTheory.Functor.map.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 G) X))) (CategoryTheory.CategoryStruct.id.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) G) X))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (G : CategoryTheory.Comonad.{u1, u2} C _inst_1) (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X))) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 G) X) (Prefunctor.map.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 G) X))) (CategoryTheory.CategoryStruct.id.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 G)) X))
Case conversion may be inaccurate. Consider using '#align category_theory.comonad.right_counit CategoryTheory.Comonad.right_counitₓ'. -/
@[simp, reassoc.1]
theorem Comonad.right_counit (G : Comonad C) (X : C) :
G.δ.app X ≫ (G : C ⥤ C).map (G.ε.app X) = 𝟙 ((G : C ⥤ C).obj X) :=
G.right_counit' X
#align category_theory.comonad.right_counit CategoryTheory.Comonad.right_counit
#print CategoryTheory.MonadHom /-
/-- A morphism of monads is a natural transformation compatible with η and μ. -/
@[ext]
structure MonadHom (T₁ T₂ : Monad C) extends NatTrans (T₁ : C ⥤ C) T₂ where
app_η' : ∀ X, T₁.η.app X ≫ app X = T₂.η.app X := by obviously
app_μ' : ∀ X, T₁.μ.app X ≫ app X = ((T₁ : C ⥤ C).map (app X) ≫ app _) ≫ T₂.μ.app X := by obviously
#align category_theory.monad_hom CategoryTheory.MonadHom
-/
#print CategoryTheory.ComonadHom /-
/-- A morphism of comonads is a natural transformation compatible with ε and δ. -/
@[ext]
structure ComonadHom (M N : Comonad C) extends NatTrans (M : C ⥤ C) N where
app_ε' : ∀ X, app X ≫ N.ε.app X = M.ε.app X := by obviously
app_δ' : ∀ X, app X ≫ N.δ.app X = M.δ.app X ≫ app _ ≫ (N : C ⥤ C).map (app X) := by obviously
#align category_theory.comonad_hom CategoryTheory.ComonadHom
-/
restate_axiom monad_hom.app_η'
restate_axiom monad_hom.app_μ'
attribute [simp, reassoc.1] monad_hom.app_η monad_hom.app_μ
restate_axiom comonad_hom.app_ε'
restate_axiom comonad_hom.app_δ'
attribute [simp, reassoc.1] comonad_hom.app_ε comonad_hom.app_δ
instance : Category (Monad C) where
Hom := MonadHom
id M := { toNatTrans := 𝟙 (M : C ⥤ C) }
comp _ _ _ f g :=
{
toNatTrans :=
{ app := fun X => f.app X ≫ g.app X
naturality' := fun X Y h => by rw [assoc, f.1.naturality_assoc, g.1.naturality] } }
id_comp' _ _ _ := by
ext
apply id_comp
comp_id' _ _ _ := by
ext
apply comp_id
assoc' _ _ _ _ _ _ _ := by
ext
apply assoc
instance : Category (Comonad C) where
Hom := ComonadHom
id M := { toNatTrans := 𝟙 (M : C ⥤ C) }
comp _ _ _ f g :=
{
toNatTrans :=
{ app := fun X => f.app X ≫ g.app X
naturality' := fun X Y h => by rw [assoc, f.1.naturality_assoc, g.1.naturality] } }
id_comp' _ _ _ := by
ext
apply id_comp
comp_id' _ _ _ := by
ext
apply comp_id
assoc' _ _ _ _ _ _ _ := by
ext
apply assoc
instance {T : Monad C} : Inhabited (MonadHom T T) :=
⟨𝟙 T⟩
#print CategoryTheory.MonadHom.id_toNatTrans /-
@[simp]
theorem MonadHom.id_toNatTrans (T : Monad C) : (𝟙 T : T ⟶ T).toNatTrans = 𝟙 (T : C ⥤ C) :=
rfl
#align category_theory.monad_hom.id_to_nat_trans CategoryTheory.MonadHom.id_toNatTrans
-/
/- warning: category_theory.monad_hom.comp_to_nat_trans -> CategoryTheory.MonadHom.comp_toNatTrans is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {T₁ : CategoryTheory.Monad.{u1, u2} C _inst_1} {T₂ : CategoryTheory.Monad.{u1, u2} C _inst_1} {T₃ : CategoryTheory.Monad.{u1, u2} C _inst_1} (f : Quiver.Hom.{succ (max u2 u1), max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1))) T₁ T₂) (g : Quiver.Hom.{succ (max u2 u1), max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1))) T₂ T₃), Eq.{succ (max u2 u1)} (CategoryTheory.NatTrans.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T₁) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T₃)) (CategoryTheory.MonadHom.toNatTrans.{u1, u2} C _inst_1 T₁ T₃ (CategoryTheory.CategoryStruct.comp.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1)) T₁ T₂ T₃ f g)) (CategoryTheory.CategoryStruct.comp.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T₁) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T₂) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) T₃) (CategoryTheory.MonadHom.toNatTrans.{u1, u2} C _inst_1 T₁ T₂ f) (CategoryTheory.MonadHom.toNatTrans.{u1, u2} C _inst_1 T₂ T₃ g))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {T₁ : CategoryTheory.Monad.{u1, u2} C _inst_1} {T₂ : CategoryTheory.Monad.{u1, u2} C _inst_1} {T₃ : CategoryTheory.Monad.{u1, u2} C _inst_1} (f : Quiver.Hom.{max (succ u2) (succ u1), max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1))) T₁ T₂) (g : Quiver.Hom.{max (succ u2) (succ u1), max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1))) T₂ T₃), Eq.{max (succ u2) (succ u1)} (CategoryTheory.NatTrans.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T₁) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T₃)) (CategoryTheory.MonadHom.toNatTrans.{u1, u2} C _inst_1 T₁ T₃ (CategoryTheory.CategoryStruct.comp.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1)) T₁ T₂ T₃ f g)) (CategoryTheory.CategoryStruct.comp.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T₁) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T₂) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 T₃) (CategoryTheory.MonadHom.toNatTrans.{u1, u2} C _inst_1 T₁ T₂ f) (CategoryTheory.MonadHom.toNatTrans.{u1, u2} C _inst_1 T₂ T₃ g))
Case conversion may be inaccurate. Consider using '#align category_theory.monad_hom.comp_to_nat_trans CategoryTheory.MonadHom.comp_toNatTransₓ'. -/
@[simp]
theorem MonadHom.comp_toNatTrans {T₁ T₂ T₃ : Monad C} (f : T₁ ⟶ T₂) (g : T₂ ⟶ T₃) :
(f ≫ g).toNatTrans = ((f.toNatTrans : _ ⟶ (T₂ : C ⥤ C)) ≫ g.toNatTrans : (T₁ : C ⥤ C) ⟶ T₃) :=
rfl
#align category_theory.monad_hom.comp_to_nat_trans CategoryTheory.MonadHom.comp_toNatTrans
instance {G : Comonad C} : Inhabited (ComonadHom G G) :=
⟨𝟙 G⟩
#print CategoryTheory.ComonadHom.id_toNatTrans /-
@[simp]
theorem ComonadHom.id_toNatTrans (T : Comonad C) : (𝟙 T : T ⟶ T).toNatTrans = 𝟙 (T : C ⥤ C) :=
rfl
#align category_theory.comonad_hom.id_to_nat_trans CategoryTheory.ComonadHom.id_toNatTrans
-/
/- warning: category_theory.comp_to_nat_trans -> CategoryTheory.comp_toNatTrans is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {T₁ : CategoryTheory.Comonad.{u1, u2} C _inst_1} {T₂ : CategoryTheory.Comonad.{u1, u2} C _inst_1} {T₃ : CategoryTheory.Comonad.{u1, u2} C _inst_1} (f : Quiver.Hom.{succ (max u2 u1), max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1))) T₁ T₂) (g : Quiver.Hom.{succ (max u2 u1), max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1))) T₂ T₃), Eq.{succ (max u2 u1)} (CategoryTheory.NatTrans.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) T₁) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) T₃)) (CategoryTheory.ComonadHom.toNatTrans.{u1, u2} C _inst_1 T₁ T₃ (CategoryTheory.CategoryStruct.comp.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1)) T₁ T₂ T₃ f g)) (CategoryTheory.CategoryStruct.comp.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) T₁) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) T₂) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) T₃) (CategoryTheory.ComonadHom.toNatTrans.{u1, u2} C _inst_1 T₁ T₂ f) (CategoryTheory.ComonadHom.toNatTrans.{u1, u2} C _inst_1 T₂ T₃ g))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {T₁ : CategoryTheory.Comonad.{u1, u2} C _inst_1} {T₂ : CategoryTheory.Comonad.{u1, u2} C _inst_1} {T₃ : CategoryTheory.Comonad.{u1, u2} C _inst_1} (f : Quiver.Hom.{max (succ u2) (succ u1), max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1))) T₁ T₂) (g : Quiver.Hom.{max (succ u2) (succ u1), max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1))) T₂ T₃), Eq.{max (succ u2) (succ u1)} (CategoryTheory.NatTrans.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 T₁) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 T₃)) (CategoryTheory.ComonadHom.toNatTrans.{u1, u2} C _inst_1 T₁ T₃ (CategoryTheory.CategoryStruct.comp.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1)) T₁ T₂ T₃ f g)) (CategoryTheory.CategoryStruct.comp.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1)) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 T₁) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 T₂) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 T₃) (CategoryTheory.ComonadHom.toNatTrans.{u1, u2} C _inst_1 T₁ T₂ f) (CategoryTheory.ComonadHom.toNatTrans.{u1, u2} C _inst_1 T₂ T₃ g))
Case conversion may be inaccurate. Consider using '#align category_theory.comp_to_nat_trans CategoryTheory.comp_toNatTransₓ'. -/
@[simp]
theorem comp_toNatTrans {T₁ T₂ T₃ : Comonad C} (f : T₁ ⟶ T₂) (g : T₂ ⟶ T₃) :
(f ≫ g).toNatTrans = ((f.toNatTrans : _ ⟶ (T₂ : C ⥤ C)) ≫ g.toNatTrans : (T₁ : C ⥤ C) ⟶ T₃) :=
rfl
#align category_theory.comp_to_nat_trans CategoryTheory.comp_toNatTrans
/- warning: category_theory.monad_iso.mk -> CategoryTheory.MonadIso.mk is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Monad.{u1, u2} C _inst_1} {N : CategoryTheory.Monad.{u1, u2} C _inst_1} (f : CategoryTheory.Iso.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N)), (forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 M) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) f) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 N) X)) -> (forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 M) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) f) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.Functor.map.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) f) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) f) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X))) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 N) X))) -> (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1) M N)
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Monad.{u1, u2} C _inst_1} {N : CategoryTheory.Monad.{u1, u2} C _inst_1} (f : CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)), (forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 M) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) f) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 N) X)) -> (forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 M) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) f) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (Prefunctor.map.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) f) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) f) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X))) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 N) X))) -> (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1) M N)
Case conversion may be inaccurate. Consider using '#align category_theory.monad_iso.mk CategoryTheory.MonadIso.mkₓ'. -/
/-- Construct a monad isomorphism from a natural isomorphism of functors where the forward
direction is a monad morphism. -/
@[simps]
def MonadIso.mk {M N : Monad C} (f : (M : C ⥤ C) ≅ N) (f_η f_μ) : M ≅ N
where
Hom :=
{ toNatTrans := f.Hom
app_η' := f_η
app_μ' := f_μ }
inv :=
{ toNatTrans := f.inv
app_η' := fun X => by simp [← f_η]
app_μ' := fun X => by
rw [← nat_iso.cancel_nat_iso_hom_right f]
simp only [nat_trans.naturality, iso.inv_hom_id_app, assoc, comp_id, f_μ,
nat_trans.naturality_assoc, iso.inv_hom_id_app_assoc, ← functor.map_comp_assoc]
simp }
#align category_theory.monad_iso.mk CategoryTheory.MonadIso.mk
/- warning: category_theory.comonad_iso.mk -> CategoryTheory.ComonadIso.mk is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Comonad.{u1, u2} C _inst_1} {N : CategoryTheory.Comonad.{u1, u2} C _inst_1} (f : CategoryTheory.Iso.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)), (forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) f) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 N) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 M) X)) -> (forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) f) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 N) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 M) X) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) f) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X)) (CategoryTheory.Functor.map.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) f) X))))) -> (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1) M N)
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Comonad.{u1, u2} C _inst_1} {N : CategoryTheory.Comonad.{u1, u2} C _inst_1} (f : CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)), (forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) f) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 N) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 M) X)) -> (forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N))) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N))) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) f) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 N) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 M) X) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) f) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X)) (Prefunctor.map.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) f) X))))) -> (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1) M N)
Case conversion may be inaccurate. Consider using '#align category_theory.comonad_iso.mk CategoryTheory.ComonadIso.mkₓ'. -/
/-- Construct a comonad isomorphism from a natural isomorphism of functors where the forward
direction is a comonad morphism. -/
@[simps]
def ComonadIso.mk {M N : Comonad C} (f : (M : C ⥤ C) ≅ N) (f_ε f_δ) : M ≅ N
where
Hom :=
{ toNatTrans := f.Hom
app_ε' := f_ε
app_δ' := f_δ }
inv :=
{ toNatTrans := f.inv
app_ε' := fun X => by simp [← f_ε]
app_δ' := fun X => by
rw [← nat_iso.cancel_nat_iso_hom_left f]
simp only [reassoc_of (f_δ X), iso.hom_inv_id_app_assoc, nat_trans.naturality_assoc]
rw [← functor.map_comp, iso.hom_inv_id_app, Functor.map_id]
apply (comp_id _).symm }
#align category_theory.comonad_iso.mk CategoryTheory.ComonadIso.mk
variable (C)
/- warning: category_theory.monad_to_functor -> CategoryTheory.monadToFunctor is a dubious translation:
lean 3 declaration is
forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C], CategoryTheory.Functor.{max u2 u1, max u2 u1, max u2 u1, max u1 u2} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1)
but is expected to have type
forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C], CategoryTheory.Functor.{max u2 u1, max u2 u1, max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1)
Case conversion may be inaccurate. Consider using '#align category_theory.monad_to_functor CategoryTheory.monadToFunctorₓ'. -/
/-- The forgetful functor from the category of monads to the category of endofunctors.
-/
@[simps]
def monadToFunctor : Monad C ⥤ C ⥤ C where
obj T := T
map M N f := f.toNatTrans
#align category_theory.monad_to_functor CategoryTheory.monadToFunctor
instance : Faithful (monadToFunctor C) where
/- warning: category_theory.monad_to_functor_map_iso_monad_iso_mk -> CategoryTheory.monadToFunctor_mapIso_monad_iso_mk is a dubious translation:
lean 3 declaration is
forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Monad.{u1, u2} C _inst_1} {N : CategoryTheory.Monad.{u1, u2} C _inst_1} (f : CategoryTheory.Iso.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N)) (f_η : forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 M) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) f) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 N) X)) (f_μ : forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 M) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) f) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X)) (CategoryTheory.Functor.map.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) f) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) f) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) X))) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N)) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 N) X))), Eq.{succ (max u2 u1)} (CategoryTheory.Iso.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.obj.{max u2 u1, max u2 u1, max u2 u1, max u1 u2} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.monadToFunctor.{u1, u2} C _inst_1) M) (CategoryTheory.Functor.obj.{max u2 u1, max u2 u1, max u2 u1, max u1 u2} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.monadToFunctor.{u1, u2} C _inst_1) N)) (CategoryTheory.Functor.mapIso.{max u2 u1, max u2 u1, max u1 u2, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.monadToFunctor.{u1, u2} C _inst_1) M N (CategoryTheory.MonadIso.mk.{u1, u2} C _inst_1 M N f f_η f_μ)) f
but is expected to have type
forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Monad.{u1, u2} C _inst_1} {N : CategoryTheory.Monad.{u1, u2} C _inst_1} (f : CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) (f_η : forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 M) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) f) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Monad.η.{u1, u2} C _inst_1 N) X)) (f_μ : forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 M) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) f) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X)) (Prefunctor.map.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) f) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) f) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) X))) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N)) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Monad.μ.{u1, u2} C _inst_1 N) X))), Eq.{max (succ u2) (succ u1)} (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (Prefunctor.obj.{succ (max u2 u1), succ (max u2 u1), max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1))) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1))) (CategoryTheory.Functor.toPrefunctor.{max u2 u1, max u2 u1, max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.monadToFunctor.{u1, u2} C _inst_1)) M) (Prefunctor.obj.{succ (max u2 u1), succ (max u2 u1), max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1))) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1))) (CategoryTheory.Functor.toPrefunctor.{max u2 u1, max u2 u1, max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.monadToFunctor.{u1, u2} C _inst_1)) N)) (CategoryTheory.Functor.mapIso.{max u2 u1, max u2 u1, max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.monadToFunctor.{u1, u2} C _inst_1) M N (CategoryTheory.MonadIso.mk.{u1, u2} C _inst_1 M N f f_η f_μ)) f
Case conversion may be inaccurate. Consider using '#align category_theory.monad_to_functor_map_iso_monad_iso_mk CategoryTheory.monadToFunctor_mapIso_monad_iso_mkₓ'. -/
@[simp]
theorem monadToFunctor_mapIso_monad_iso_mk {M N : Monad C} (f : (M : C ⥤ C) ≅ N) (f_η f_μ) :
(monadToFunctor _).mapIso (MonadIso.mk f f_η f_μ) = f :=
by
ext
rfl
#align category_theory.monad_to_functor_map_iso_monad_iso_mk CategoryTheory.monadToFunctor_mapIso_monad_iso_mk
instance : ReflectsIsomorphisms (monadToFunctor C)
where reflects M N f i := by
skip
convert is_iso.of_iso (monad_iso.mk (as_iso ((monad_to_functor C).map f)) f.app_η f.app_μ)
ext <;> rfl
/- warning: category_theory.comonad_to_functor -> CategoryTheory.comonadToFunctor is a dubious translation:
lean 3 declaration is
forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C], CategoryTheory.Functor.{max u2 u1, max u2 u1, max u2 u1, max u1 u2} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1)
but is expected to have type
forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C], CategoryTheory.Functor.{max u2 u1, max u2 u1, max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1)
Case conversion may be inaccurate. Consider using '#align category_theory.comonad_to_functor CategoryTheory.comonadToFunctorₓ'. -/
/-- The forgetful functor from the category of comonads to the category of endofunctors.
-/
@[simps]
def comonadToFunctor : Comonad C ⥤ C ⥤ C where
obj G := G
map M N f := f.toNatTrans
#align category_theory.comonad_to_functor CategoryTheory.comonadToFunctor
instance : Faithful (comonadToFunctor C) where
/- warning: category_theory.comonad_to_functor_map_iso_comonad_iso_mk -> CategoryTheory.comonadToFunctor_mapIso_comonad_iso_mk is a dubious translation:
lean 3 declaration is
forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Comonad.{u1, u2} C _inst_1} {N : CategoryTheory.Comonad.{u1, u2} C _inst_1} (f : CategoryTheory.Iso.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) (f_ε : forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) f) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 N) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 M) X)) (f_δ : forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) f) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 N) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 M) X) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M)) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X)) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) f) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X)) (CategoryTheory.Functor.map.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) X) (CategoryTheory.Functor.obj.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) (CategoryTheory.Iso.hom.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N) f) X))))), Eq.{succ (max u2 u1)} (CategoryTheory.Iso.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.obj.{max u2 u1, max u2 u1, max u2 u1, max u1 u2} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.comonadToFunctor.{u1, u2} C _inst_1) M) (CategoryTheory.Functor.obj.{max u2 u1, max u2 u1, max u2 u1, max u1 u2} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.comonadToFunctor.{u1, u2} C _inst_1) N)) (CategoryTheory.Functor.mapIso.{max u2 u1, max u2 u1, max u1 u2, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.comonadToFunctor.{u1, u2} C _inst_1) M N (CategoryTheory.ComonadIso.mk.{u1, u2} C _inst_1 M N f f_ε f_δ)) f
but is expected to have type
forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Comonad.{u1, u2} C _inst_1} {N : CategoryTheory.Comonad.{u1, u2} C _inst_1} (f : CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (f_ε : forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.id.{u1, u2} C _inst_1)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) f) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 N) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Functor.id.{u1, u2} C _inst_1) (CategoryTheory.Comonad.ε.{u1, u2} C _inst_1 M) X)) (f_δ : forall (X : C), Eq.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N))) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N))) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) f) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 N) X)) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) (CategoryTheory.Comonad.δ.{u1, u2} C _inst_1 M) X) (CategoryTheory.CategoryStruct.comp.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Functor.comp.{u1, u1, u1, u2, u2, u2} C _inst_1 C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M))) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X)) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) f) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X)) (Prefunctor.map.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M)) X) (Prefunctor.obj.{succ u1, succ u1, u2, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) (CategoryTheory.Functor.toPrefunctor.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N)) X) (CategoryTheory.NatTrans.app.{u1, u1, u2, u2} C _inst_1 C _inst_1 (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) (CategoryTheory.Iso.hom.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N) f) X))))), Eq.{max (succ u2) (succ u1)} (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (Prefunctor.obj.{succ (max u2 u1), succ (max u2 u1), max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1))) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1))) (CategoryTheory.Functor.toPrefunctor.{max u2 u1, max u2 u1, max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.comonadToFunctor.{u1, u2} C _inst_1)) M) (Prefunctor.obj.{succ (max u2 u1), succ (max u2 u1), max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1))) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.CategoryStruct.toQuiver.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Category.toCategoryStruct.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1))) (CategoryTheory.Functor.toPrefunctor.{max u2 u1, max u2 u1, max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.comonadToFunctor.{u1, u2} C _inst_1)) N)) (CategoryTheory.Functor.mapIso.{max u2 u1, max u2 u1, max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.comonadToFunctor.{u1, u2} C _inst_1) M N (CategoryTheory.ComonadIso.mk.{u1, u2} C _inst_1 M N f f_ε f_δ)) f
Case conversion may be inaccurate. Consider using '#align category_theory.comonad_to_functor_map_iso_comonad_iso_mk CategoryTheory.comonadToFunctor_mapIso_comonad_iso_mkₓ'. -/
@[simp]
theorem comonadToFunctor_mapIso_comonad_iso_mk {M N : Comonad C} (f : (M : C ⥤ C) ≅ N) (f_ε f_δ) :
(comonadToFunctor _).mapIso (ComonadIso.mk f f_ε f_δ) = f :=
by
ext
rfl
#align category_theory.comonad_to_functor_map_iso_comonad_iso_mk CategoryTheory.comonadToFunctor_mapIso_comonad_iso_mk
instance : ReflectsIsomorphisms (comonadToFunctor C)
where reflects M N f i := by
skip
convert is_iso.of_iso (comonad_iso.mk (as_iso ((comonad_to_functor C).map f)) f.app_ε f.app_δ)
ext <;> rfl
variable {C}
/- warning: category_theory.monad_iso.to_nat_iso -> CategoryTheory.MonadIso.toNatIso is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Monad.{u1, u2} C _inst_1} {N : CategoryTheory.Monad.{u1, u2} C _inst_1}, (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Monad.category.{u1, u2} C _inst_1) M N) -> (CategoryTheory.Iso.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeMonad.{u1, u2} C _inst_1)))) N))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Monad.{u1, u2} C _inst_1} {N : CategoryTheory.Monad.{u1, u2} C _inst_1}, (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Monad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryMonad.{u1, u2} C _inst_1) M N) -> (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Monad.toFunctor.{u1, u2} C _inst_1 N))
Case conversion may be inaccurate. Consider using '#align category_theory.monad_iso.to_nat_iso CategoryTheory.MonadIso.toNatIsoₓ'. -/
/-- An isomorphism of monads gives a natural isomorphism of the underlying functors.
-/
@[simps (config := { rhsMd := semireducible })]
def MonadIso.toNatIso {M N : Monad C} (h : M ≅ N) : (M : C ⥤ C) ≅ N :=
(monadToFunctor C).mapIso h
#align category_theory.monad_iso.to_nat_iso CategoryTheory.MonadIso.toNatIso
/- warning: category_theory.comonad_iso.to_nat_iso -> CategoryTheory.ComonadIso.toNatIso is a dubious translation:
lean 3 declaration is
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Comonad.{u1, u2} C _inst_1} {N : CategoryTheory.Comonad.{u1, u2} C _inst_1}, (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Comonad.category.{u1, u2} C _inst_1) M N) -> (CategoryTheory.Iso.{max u2 u1, max u1 u2} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) M) ((fun (a : Sort.{max (succ u2) (succ u1)}) (b : Type.{max u1 u2}) [self : HasLiftT.{max (succ u2) (succ u1), succ (max u1 u2)} a b] => self.0) (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (HasLiftT.mk.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CoeTCₓ.coe.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (coeBase.{max (succ u2) (succ u1), succ (max u1 u2)} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.coeComonad.{u1, u2} C _inst_1)))) N))
but is expected to have type
forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] {M : CategoryTheory.Comonad.{u1, u2} C _inst_1} {N : CategoryTheory.Comonad.{u1, u2} C _inst_1}, (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Comonad.{u1, u2} C _inst_1) (CategoryTheory.instCategoryComonad.{u1, u2} C _inst_1) M N) -> (CategoryTheory.Iso.{max u2 u1, max u2 u1} (CategoryTheory.Functor.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Functor.category.{u1, u1, u2, u2} C _inst_1 C _inst_1) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 M) (CategoryTheory.Comonad.toFunctor.{u1, u2} C _inst_1 N))
Case conversion may be inaccurate. Consider using '#align category_theory.comonad_iso.to_nat_iso CategoryTheory.ComonadIso.toNatIsoₓ'. -/
/-- An isomorphism of comonads gives a natural isomorphism of the underlying functors.
-/
@[simps (config := { rhsMd := semireducible })]
def ComonadIso.toNatIso {M N : Comonad C} (h : M ≅ N) : (M : C ⥤ C) ≅ N :=
(comonadToFunctor C).mapIso h
#align category_theory.comonad_iso.to_nat_iso CategoryTheory.ComonadIso.toNatIso
variable (C)
namespace Monad
#print CategoryTheory.Monad.id /-
/-- The identity monad. -/
@[simps]
def id : Monad C where
toFunctor := 𝟭 C
η' := 𝟙 (𝟭 C)
μ' := 𝟙 (𝟭 C)
#align category_theory.monad.id CategoryTheory.Monad.id
-/
instance : Inhabited (Monad C) :=
⟨Monad.id C⟩
end Monad
namespace Comonad
#print CategoryTheory.Comonad.id /-
/-- The identity comonad. -/
@[simps]
def id : Comonad C where
toFunctor := 𝟭 _
ε' := 𝟙 (𝟭 C)
δ' := 𝟙 (𝟭 C)
#align category_theory.comonad.id CategoryTheory.Comonad.id
-/
instance : Inhabited (Comonad C) :=
⟨Comonad.id C⟩
end Comonad
end CategoryTheory
|
#pragma once
//=====================================================================//
/*! @file
@brief イグナイター・クライアント・クラス
@author 平松邦仁 ([email protected])
@copyright Copyright (C) 2017 Kunihito Hiramatsu @n
Released under the MIT license @n
https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=====================================================================//
#include <iostream>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <queue>
#include <string>
#include "utils/format.hpp"
#include "utils/string_utils.hpp"
// #include <boost/asio/detail/winsock_init.hpp>
// boost::asio::detail::winsock_init<>::manual manual_winsock_init
// __attribute__ ((init_priority (101)));
namespace asio = boost::asio;
namespace ip = asio::ip;
namespace net {
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
/*!
@brief Ignitor Client クラス
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
class ign_client {
asio::io_service& io_service_;
ip::tcp::socket socket_;
// asio::deadline_timer connect_timer_;
bool connect_;
asio::streambuf send_;
asio::streambuf recv_;
std::string ips_;
typedef std::queue<std::string> SQUEUE;
SQUEUE rmsg_;
uint32_t crcd_;
uint32_t crrd_;
uint32_t wdm_ch_;
uint32_t wdm_pos_;
uint16_t wdm_buff_[2048];
std::string back_;
void send_end_(const boost::system::error_code& error)
{
if(send_.size() > 0) {
// std::cout << "request : " << asio::buffer_cast<const char*>(send_.data()) << std::endl;
send_.consume(send_.size());
}
}
void async_send_(const std::string& request)
{
std::ostream os(&send_);
os << request;
asio::async_write(socket_, send_.data(),
boost::bind(&ign_client::send_end_, this, _1));
}
void recv_end_(const boost::system::error_code& error)
{
if(recv_.size() > 0) {
/// std::cout << "response : " << asio::buffer_cast<const char*>(recv_.data()) << std::endl;
rmsg_.emplace(asio::buffer_cast<const char*>(recv_.data()));
recv_.consume(recv_.size());
async_recv_();
}
}
void async_recv_()
{
asio::async_read_until(socket_, recv_, '\n',
boost::bind(&ign_client::recv_end_, this, _1));
}
void on_connect_(const boost::system::error_code& error)
{
if(error) {
const std::string& in = error.message();
auto out = utils::sjis_to_utf8(in);
std::cout << "connect failed: " << out << std::endl;
socket_.close();
} else {
// connect_timer_.cancel();
connect_ = true;
// std::cout << "connected" << std::endl;
}
}
void on_connect_timeout_(const boost::system::error_code& error)
{
socket_.close();
// 接続タイムアウト
}
public:
//-----------------------------------------------------------------//
/*!
@brief コンストラクター
*/
//-----------------------------------------------------------------//
ign_client(asio::io_service& ios) :
io_service_(ios), socket_(ios), /* connect_timer_(ios), */
connect_(false), crcd_(0), crrd_(0)
{ }
//-----------------------------------------------------------------//
/*!
@brief デストラクター
*/
//-----------------------------------------------------------------//
~ign_client()
{
}
uint32_t get_crcd() const { return crcd_; }
uint32_t get_crrd() const { return crrd_; }
const uint16_t* get_wdm(uint32_t ch) const { return wdm_buff_; }
//-----------------------------------------------------------------//
/*!
@brief 接続状態の確認
@return 接続なら「true」
*/
//-----------------------------------------------------------------//
bool probe() const { return connect_; }
//-----------------------------------------------------------------//
/*!
@brief 開始
@param[in] ip IP アドレス
@param[in] pn ポート番号
*/
//-----------------------------------------------------------------//
void start(const std::string& ip, uint16_t pn)
{
if(connect_) {
socket_.close();
}
connect_ = false;
ips_ = "127.0.0.1";
if(!ip.empty()) ips_ = ip;
/// socket_.async_connect(ip::tcp::endpoint(ip::address::from_string(ips_), pn),
socket_.async_connect(ip::tcp::endpoint(ip::address::from_string("192.168.0.20"), pn),
boost::bind(&ign_client::on_connect_, this, _1));
// boost::bind(&ign_client::on_connect_, this, asio::placeholders::error));
// connect_timer_.expires_from_now(boost::posix_time::seconds(20));
// connect_timer_.async_wait(boost::bind(&ign_client::on_connect_timeout_, this, _1));
}
//-----------------------------------------------------------------//
/*!
@brief サービス
*/
//-----------------------------------------------------------------//
void service()
{
if(!connect_) return;
async_recv_();
// 読み込みデータ処理
while(!rmsg_.empty()) {
auto s = rmsg_.front();
rmsg_.pop();
if(s.find("CRCD") == 0) {
auto t = s.substr(4, 4);
int v = 0;
if((utils::input("%x", t.c_str()) % v).status()) {
crcd_ = v;
}
} else if(s.find("CRRD") == 0) {
auto t = s.substr(4, 4);
int v = 0;
if((utils::input("%x", t.c_str()) % v).status()) {
crrd_ = v;
}
} else if(s.find("WDCH") == 0) { // WDM チャネル
auto t = s.substr(4);
int v = 0;
utils::input("%d", t.c_str()) % v;
wdm_ch_ = v;
wdm_pos_ = 0;
///std::cout << "WDM ch: %d" << v << std::endl;
} else if(s.find("WDMW") == 0) { // WDM 波形
auto t = s.substr(4);
// std::cout << wdm_pos_ << ": ";
while(t.size() > 4) {
auto d = t.substr(4);
t[4] = 0;
int v;
utils::input("%x", t.c_str()) % v;
wdm_buff_[wdm_pos_ % 2048] = v;
// std::cout << v << ", ";
++wdm_pos_;
t = d;
}
// std::cout << std::endl;
}
}
}
//-----------------------------------------------------------------//
/*!
@brief 送信
@param[in] text 送信文字列
*/
//-----------------------------------------------------------------//
void send(const std::string& text)
{
if(text.empty()) return;
async_send_(text);
}
};
}
|
\section{Integer Linear Programming}
Integer Linear Program (ILP): $max\{c^Tx:x \in P \cap Z^n\}$ with $P = \{x \in R^n : Ax \leq b\}$ \\
\textit{All variables are integer}
\begin{figure}[H]
\centering
\includegraphics[width=0.4\textwidth]{figures/integerlp.png}
\caption{ILP}
\end{figure}
Mixed Integer LP (MIP): $max\{c^T x:x\in P \cap Z_K^n\}$ with $P = \{x \in R^n : Ax \leq b\}$ where $K \subseteq \{1, ..., n\}$ and $Z_K^n = \{x \in R^n : x_j \in Z$ for $j \in K\}$ \\
\textit{Some variables are integer, others are not}
\begin{figure}[H]
\centering
\includegraphics[width=0.4\textwidth]{figures/mlp.png}
\caption{MIP}
\end{figure}
It is not possible to just run a linear programming algorithm and then round the result up or down.
\begin{itemize}
\item Problem 1: Rounding the LP Solution may yield a non-feasible solution.
\item Problem 2: The optimal LP Solution is maybe far away from the optimal ILP solution.
\end{itemize}
\clearpage
\subsection{Relaxations}
\begin{figure}[H]
\centering
\includegraphics[width=0.5\textwidth]{figures/relaxations.png}
\caption{Relaxations}
\end{figure}
$\Rightarrow f'(x)$ need to be higher or equal to $f(x)$ within the solution space.
\subsection{Branch and Bound Method}
Branch-and-Bound (B\&B) is a general solution method (independent from ILP).
Basic Procedure
\begin{enumerate}
\item Split solution space iteratively into smaller subspaces ("Branch"). In each subproblem:
\item Calculate an upper bound ("Bound") e.g. through relaxation
\item Calculate a feasible solution $\Rightarrow$ Lower Bound ("Bound").
\item Then use this information to "cut away" ("prune") certain subproblems.
\end{enumerate}
\clearpage
\subsubsection{Himmalaya Example}
\begin{itemize}
\item We seperate the full solution space in several subspaces
\item We send some helicopters to find the upper bound of these subspaces
\item From the bottom, there are searching some sherpas for the lower bound
\item At the end, we compare the values we got from each subspace.
\end{itemize}
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{figures/himmalayaExample.png}
\caption{Branch and Bound - Himmalaya Example}
\end{figure}
\begin{itemize}
\item Stopping by Dominance means, that the upper bound is already lower than an already found maximum in the queue.
\item Stopping by Optimum means, that we found the optimum in this area (upper and lower bound are the same).
\end{itemize}
\clearpage
\subsubsection{Knap-Sack Problem Example}
\begin{itemize}
\item Items $j \in J$ have a volume $a_j$ and a benefit $c_j$.
\item The knapsack has a capacity of $b$
\item $max\{c^Tx:a^Tx\leq b, x \in \{0,1\}^j\}$
\end{itemize}
LP Solution easy:
\begin{enumerate}
\item Sort the items by decreasing benefit per volume $\frac{c_j}{a_j}$
\item Choose items in this order, until the knapsack is full. The last item fractionally.
\item After doing this, create two new branches. One branch with $x = 0$ for the fractional item and one branch with $x = 1$ for the fractional item. Continue until you discovered all options.
\end{enumerate}
\begin{figure}[H]
\centering
\includegraphics[width=1\textwidth]{figures/bbknapsack.png}
\caption{Branch and Bound - Knapsack Example}
\end{figure}
\clearpage
\subsection{Cutting Plane Method}
\begin{itemize}
\item Let $P$ and $P'$ be two formulations for the ILP: $max\{c^Tx:x\in P \subseteq Z^n\}$. $P'$ is called a better solution is $P' \subseteq P$.
\item And if $P' \subseteq P$ then $max\{c^Tx:x \in P'\} \leq max\{c^Tx:x \in P\}$
\end{itemize}
\begin{figure}[H]
\centering
\includegraphics[width=0.4\textwidth]{figures/optimalilpsolution.png}
\caption{Cutting Plane Method - Optimal ILP Solution}
\end{figure}
\textbf{The best formulation for $P'$} would be the convex hull, which is the thightest polyhedrun around $P$, but this is nearly impossible to find.
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{figures/convexhull.png}
\caption{Cutting Plane Method - Behavior Convex Hull}
\end{figure}
\textbf{The integer hull of a polyhedrun is the convex hull, but only with integers.}
\begin{figure}[H]
\centering
\includegraphics[width=1\textwidth]{figures/cuttingplanemethod.png}
\caption{Cutting Plane Method}
\end{figure}
\subsubsection{Gomory-Chvatal-Cut}
\begin{figure}[H]
\centering
\includegraphics[width=1\textwidth]{figures/gomory.png}
\caption{Gomory-Chvatal-Cut}
\end{figure}
\clearpage
|
r=359.32
https://sandbox.dams.library.ucdavis.edu/fcrepo/rest/collection/sherry-lehmann/catalogs/d7tg71/media/images/d7tg71-004/svc:tesseract/full/full/359.32/default.jpg Accept:application/hocr+xml
|
Illinois beat No. 9 Michigan State, 79-74, at home on Tuesday, and has now won three of its last four, all as an underdog, with two victories over top-15 opponents. The Illini, who were getting 10.5 points against the Spartans, blew a 14-point lead in the second half, but they never trailed after Ayo Dosunmu hit 3-pointers on back-to-back possessions.
Illinois beat No. 9 Michigan State, [79-74, at home on Tuesday](http://www.espn.com/mens-college-basketball/recap?gameId=401082353), and has now won three of its last four, all as an underdog, with two victories over top-15 opponents. The Illini, who [closed as 10.5-point underdogs](https://www.betchicago.com/college-basketball-betting-lines-odds-predictions-kansas-state-favored) against the ninth-ranked Spartans, blew a 14-point lead in the second half, but they never trailed after Ayo Dosunmu hit 3-pointers on back-to-back possessions, the second with 1:57 left after his steal gave Illinois back possession. Dosunmu scored a game-high 24 points, scoring 8-of-14 from the field. <a href="https://www.youtube.com/watch?v=M3SUP-bh4bo" class="embedly-card" data-card-width="100%" data-card-controls="0">Embedded content: https://www.youtube.com/watch?v=M3SUP-bh4bo</a> The Illini (8-15, 4-8 Big Ten, 10-13 against the spread) haven't had much to celebrate this season, but the fans in Champaign got to storm the court for the first time since 2013, giving their moneyline bettors an 5/1 payout. <a href="https://twitter.com/betchicago1/status/1092973517602058240" class="embedly-card" data-card-width="100%" data-card-controls="0">Embedded content: https://twitter.com/betchicago1/status/1092973517602058240</a> Illinois beat then-No. 13 Maryland by 11 on Jan. 26 at Madison Square Garden as 8.5-point dogs, and then, after an 11-point loss at Minnesota getting 7.5, the Illini beat Nebraska at home, 71-64, taking 2.5. The Spartans (18-5, 9-3 Big Ten, 16-7 ATS) have now [lost three in a row](https://www.betchicago.com/saturday-college-basketball-betting-recap-february-2) SU and ATS following a 13-game winning streak (12-1 ATS). The game also went OVER its total of 148, the second straight OVER in a Michigan State game following six straight UNDERs. __MORE:__ [Iowa State bettors crushed by Oklahoma 3-pointer that shouldn't have counted](https://www.betchicago.com/college-basketball-bad-beat-iowa-state-bettors-crushed-oklahoma-feb-4) ## Boston College-Duke bad beat The Eagles, 23.5-point underdogs, lost at Duke, 80-55. BC held a halftime lead and trailed by 16 with 3:50 left. But the second-ranked Blue Devils (20-2, 8-1 ACC, 14-8 ATS) finished the game on a 12-3 run, including Alex O'Connell jumper with 41 seconds left that were the final points of the game. The Eagles (11-10, 2-7 ACC, 10-11 ATS) missed two 3-point attempts in the final half-minute. ## N.C. State's offense bounces back, but Wolfpack still fail to cover North Carolina State had a [historically bad performance Saturday](https://www.betchicago.com/saturday-college-basketball-betting-recap-february-2), scoring only 24 points in a home loss to Virginia Tech, the worst offensive output int he shot-clock era. The Wolfpack increased their point total by a whopping 72 points Tuesday at Chapel Hill ... and still couldn't cover a 10.5-point spread in a 113-96 loss to No. 8 North Carolina. ## Marquette loses rare one in Milwaukee The Golden Eagles share the new Fiserv Forum with the Bucks, and they had won all 14 of their games their until Tuesday, a 70-69 loss to St. John's. No. 10 Marquette (19-4) now has two Big East losses, and both have come against the Red Storm, which was getting seven points on Tuesday. St. John's blew a 15-point, second-half lead, but junior guard Shamorie Ponds (game-high 28 points) made a layup with 20 seconds left, and Markus Howard missed a jumper at the other end. Howard, Marquette's star junior guard who is averaging 25 points per game, has shot 7-for-32 (22 percent) from the floor in two games against St. John's this season. ## Kansas State breaks skid against Kansas The Wildcats snapped an eight-game losing streak against its rival, earning a 74-67 win as a 3-point favorite over the visiting Jayhawks. No. 13 Kansas has now lost six of seven ATS. ## Other top-25 favorites that covered Tuesday No. 5 KENTUCKY (-16) over South Caroina, 76-48 No. 7 Michigan (-9.5) over RUTGERS, 77-65 No. 20 Florida State was a 3-point underdog at Syracuse, and dominated the Orange at the Carrier Dome, 80-62. Top-ranked Tennessee cruised to its 17th straight win, but couldn't cover a 19-point spread in a 72-60 win over visiting Missouri. __PLAY:__ Our [free contests to win BetChicago prize packs](https://betchicago.chalkline.com). Pick NBA, college hoops, hockey and UFC 234 in Melbourne for a shot to win.
|
function V2=tform(T,V)
%%
nDim_T=size(T,2);
nDim_V=size(V,2);
if nDim_T==(nDim_V+1)
VV=V;
VV(:,end+1)=1;
V2=(T*VV')';
V2=V2(:,[1 2 3]);
elseif nDim_T==nDim_V
V2=(T*V')';
end
%%
%%
% _*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/>.
|
[STATEMENT]
lemma WT_converterD':
assumes "\<I>, \<I>' \<turnstile>\<^sub>C conv \<surd>" "q \<in> outs_\<I> \<I>"
shows "\<I>' \<turnstile>g run_converter conv q \<surd> \<and> (\<forall>(r, conv') \<in> results_gpv \<I>' (run_converter conv q). r \<in> responses_\<I> \<I> q \<and> \<I>, \<I>' \<turnstile>\<^sub>C conv' \<surd>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<I>' \<turnstile>g run_converter conv q \<surd> \<and> (\<forall>(r, conv')\<in>results_gpv \<I>' (run_converter conv q). r \<in> responses_\<I> \<I> q \<and> \<I>, \<I>' \<turnstile>\<^sub>C conv' \<surd>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<I>, \<I>' \<turnstile>\<^sub>C conv \<surd>
q \<in> outs_\<I> \<I>
goal (1 subgoal):
1. \<I>' \<turnstile>g run_converter conv q \<surd> \<and> (\<forall>(r, conv')\<in>results_gpv \<I>' (run_converter conv q). r \<in> responses_\<I> \<I> q \<and> \<I>, \<I>' \<turnstile>\<^sub>C conv' \<surd>)
[PROOF STEP]
by(auto elim: WT_converter.cases)
|
Formal statement is: lemma homotopy_eqv_homotopic_triviality_null_imp: fixes S :: "'a::real_normed_vector set" and T :: "'b::real_normed_vector set" and U :: "'c::real_normed_vector set" assumes "S homotopy_eqv T" and f: "continuous_on U f" "f ` U \<subseteq> T" and homSU: "\<And>f. \<lbrakk>continuous_on U f; f ` U \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>c. homotopic_with_canon (\<lambda>x. True) U S f (\<lambda>x. c)" shows "\<exists>c. homotopic_with_canon (\<lambda>x. True) U T f (\<lambda>x. c)" Informal statement is: If $S$ and $T$ are homotopy equivalent, and $f$ is a continuous map from $U$ to $T$ such that any continuous map from $U$ to $S$ is homotopic to a constant map, then $f$ is homotopic to a constant map.
|
module Prelude.Vec where
open import Prelude.Nat
open import Prelude.Fin
open import Prelude.Unit
open import Prelude.List using (List ; [] ; _::_)
infixr 40 _::_
data Vec (A : Set) : Nat -> Set where
_::_ : forall {n} -> A -> Vec A n -> Vec A (S n)
[] : Vec A Z
infixr 30 _++_
_++_ : {A : Set}{m n : Nat} -> Vec A m -> Vec A n -> Vec A (m + n)
[] ++ ys = ys
(x :: xs) ++ ys = x :: (xs ++ ys)
snoc : {A : Set}{n : Nat} -> Vec A n -> A -> Vec A (S n)
snoc [] e = e :: []
snoc (x :: xs) e = x :: snoc xs e
length : {A : Set}{n : Nat} -> Vec A n -> Nat
length [] = Z
length (x :: xs) = 1 + length xs
length' : {A : Set}{n : Nat} -> Vec A n -> Nat
length' {n = n} _ = n
zipWith3 : ∀ {A B C D n} -> (A -> B -> C -> D) -> Vec A n -> Vec B n -> Vec C n -> Vec D n
zipWith3 f [] [] [] = []
zipWith3 f (x :: xs) (y :: ys) (z :: zs) = f x y z :: zipWith3 f xs ys zs
zipWith : ∀ {A B C n} -> (A -> B -> C) -> Vec A n -> Vec B n -> {u : Unit} -> Vec C n
zipWith _ [] [] = []
zipWith f (x :: xs) (y :: ys) = f x y :: zipWith f xs ys {u = unit}
_!_ : ∀ {A n} -> Vec A n -> Fin n -> A
x :: xs ! fz = x
_ :: xs ! fs n = xs ! n
[] ! ()
_[_]=_ : {A : Set}{n : Nat} -> Vec A n -> Fin n -> A -> Vec A n
(a :: as) [ fz ]= e = e :: as
(a :: as) [ fs n ]= e = a :: (as [ n ]= e)
[] [ () ]= e
map : ∀ {A B n}(f : A -> B)(xs : Vec A n) -> Vec B n
map f [] = []
map f (x :: xs) = f x :: map f xs
forgetL : {A : Set}{n : Nat} -> Vec A n -> List A
forgetL [] = []
forgetL (x :: xs) = x :: forgetL xs
rem : {A : Set}(xs : List A) -> Vec A (Prelude.List.length xs)
rem [] = []
rem (x :: xs) = x :: rem xs
|
-- example 3.22
import Statistics.Distribution
import Statistics.Distribution.Poisson
-- three accidents per month means six accidents per two-months:
pd :: PoissonDistribution
pd = poisson 6.0
p :: Int -> Double
p = probability pd
main = do
putStrLn $ "the mean = " ++ show (mean pd)
putStrLn $ "the stdDev = " ++ show (stdDev pd)
putStrLn $ "the probability of ten accidents in two months: " ++ show (p 10)
|
itis.taxa.to.tsn = function( tx, itaxa=itis.db( "itaxa" ) ) {
# merge taxa to itis using all possible avenues, including partial matches
out = NA
txs = unlist( strsplit( tolower( tx), "[[:space:]]+" ) )
txs = txs[ which( nchar(txs)>1 ) ]
if ( length(txs)==0 ) return( NA )
e0 = 1:nrow( itaxa )
if ( length(txs)==1 ) { # single noun ..
# exact matches
e1 = intersect( e0, which( tolower(itaxa$unit_name1) == txs ) ) # case insensitive
if ( length(e1)==1 ) {
out = e1
} else {
# there must be no subcategories as there is only a single noun
e2 = which( itaxa$unit_name2 =="" )
ex = intersect( e1, e2 )
if ( length(ex)==1 ) {
out = ex
} else {
tx.grep = paste("^", txs, sep="")
e02 = intersect(e0, e2)
# try partial matches .. ^ = make sure it begins with the same sequence
o1 = grep( tx.grep, itaxa$unit_name1, ignore.case=T, perl=T )
ox = intersect( e02, o1 )
if (length(ox)==1 ) {
out = ox
} else {
# last try .. partial matches using agrep .. slow/expensive .. no regex
p1 = agrep( txs, itaxa$unit_name1, ignore.case=T, max.distance =0.1 ) # perl=T to override multibyte characters
px = intersect( e02, p1 )
if ( length(px)==1 ) {
out = px
} else { # return all possible matches and give up
qx = grep( paste("\\<",txs[1], sep=""), itaxa$completename, ignore.case=T )
if( length(qx)==1 ) {
out=qx
} else {
out = c(ex, px, ox)
}
}
}
}
}
} # end if single
if (length(txs)==2) {
# most likely a genus and species combination:
# first scan for exact matches
e1 = which( tolower(itaxa$unit_name1) == txs[1] ) # case insensitive
e2 = which( tolower(itaxa$unit_name2) == txs[2] ) # case insensitive
ec = intersect( e1, e2 )
if ( length(ec)==1 ) {
out = ec
} else {
# there must be no subcategories as there is only a single noun
ec2 = which( itaxa$unit_name3 =="" )
ex = intersect( ec, ec2 )
if ( length(ex)==1 ) {
out = ex
} else {
tx.grep1 = paste("^", txs[1], sep="")
tx.grep2 = paste("^", txs[2], sep="")
e02 = intersect(e0, ec2)
# try partial matches .. ^ = make sure it begins with the same sequence
o1 = grep( tx.grep1, itaxa$unit_name1, ignore.case=T, perl=T )
o2 = grep( tx.grep2, itaxa$unit_name2, ignore.case=T, perl=T )
ox = intersect( o1, o2 )
if (length(ox)==1 ) {
out=ox
} else {
ox = intersect( e02, ox )
if (length(ox)==1 ) {
out = ox
} else {
# last try .. partial matches using agrep .. slow/expensive no regex
p1 = agrep( txs[1], itaxa$unit_name1, ignore.case=T, max.distance =0.1 )
p2 = agrep( txs[2], itaxa$unit_name2, ignore.case=T, max.distance =0.1 )
px = intersect( p1, p2 )
if ( length(px)==1 ) {
out = px
} else {
px = intersect( e02, px )
if( length(px)==1 ) {
out=px
} else {
q1 = grep( paste("\\<",txs[1], sep=""), itaxa$completename, ignore.case=T )
q2 = grep( paste("\\<",txs[2], sep=""), itaxa$completename, ignore.case=T )
qx = intersect ( q1, q2 )
if( length(qx)==1 ) {
out=qx
} else {
# return all possible matches and give up
# include exact matches of species names as there may
# have been a genus name change
out = c(e1,e2, px, ox)
}
}
}
}
}
}
}
} # end if # txs=2
if (length(txs)==3) {
# most likely a genus, species and subspecies combination:
# first scan for exact matches
e1 = which( tolower(itaxa$unit_name1) == txs[1] ) # case insensitive
e2 = which( tolower(itaxa$unit_name2) == txs[2] ) # case insensitive
ec = intersect( e1, e2 )
if ( length(ec)==1 ) {
# see if a genus-species combination is sufficient
out = ec
} else {
e3 = which( tolower(itaxa$unit_name3) == txs[3] ) # case insensitive
ec = intersect( ec, e3 )
if ( length( ec )==1 ) {
out = ec
} else {
tx.grep1 = paste("^", txs[1], sep="")
tx.grep2 = paste("^", txs[2], sep="")
tx.grep3 = paste("^", txs[3], sep="")
# try partial matches .. ^ = make sure it begins with the same sequence
o1 = grep( tx.grep1, itaxa$unit_name1, ignore.case=T, perl=T )
o2 = grep( tx.grep2, itaxa$unit_name2, ignore.case=T, perl=T )
ox = intersect( o1, o2 )
if (length(ox)==1 ) {
out = ox
} else {
o3 = grep( tx.grep3, itaxa$unit_name3, ignore.case=T, perl=T )
ox = intersect( ox, o3 )
if (length(ox)==1 ) {
out = ox
} else {
# try .. partial matches using agrep .. slow/expensive .. no regex
p1 = agrep( txs[1], itaxa$unit_name1, ignore.case=T, max.distance =0.1 )
p2 = agrep( txs[2], itaxa$unit_name2, ignore.case=T, max.distance =0.1 )
px = intersect( p1, p2 )
if ( length(px)==1 ) {
out = px
} else {
p3 = agrep( txs[3], itaxa$unit_name3, ignore.case=T, max.distance =0.1 )
px = intersect( px, p3 )
if( length(px)==1 ) {
out=px
} else {
#match beginning of each word in case there has been a name change .. the root usually stays the same
q1 = grep( paste("\\<",txs[1], sep=""), itaxa$completename, ignore.case=T )
q2 = grep( paste("\\<",txs[2], sep=""), itaxa$completename, ignore.case=T )
q3 = grep( paste("\\<",txs[3], sep=""), itaxa$completename, ignore.case=T )
qx = intersect ( q1, q2 )
qx = intersect ( qx, q3 )
if( length(qx)==1 ) {
out=qx
} else {
# return all possible matches and give up
# include exact matches of species names as there may
# have been a genus name change
out = c(e1, e2, e3, px, ox)
}
}
}
}
}
}
}
} # end if # txs=3
# out contains candidate row indices of itaxa
# now refine search using
res = itis.refine.search( out, itaxa )
if (is.data.frame( res) ) {
res = res$tsn
} else {
res = NA
}
return (res)
}
|
# Swaggy Jenkins
#
# Jenkins API clients generated from Swagger / Open API specification
#
# OpenAPI spec version: 1.1.1
# Contact: [email protected]
# Generated by: https://openapi-generator.tech
#' PipelineActivities Class
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PipelineActivities <- R6::R6Class(
'PipelineActivities',
public = list(
initialize = function(){
},
toJSON = function() {
PipelineActivitiesObject <- list()
PipelineActivitiesObject
},
fromJSON = function(PipelineActivitiesJson) {
PipelineActivitiesObject <- jsonlite::fromJSON(PipelineActivitiesJson)
},
toJSONString = function() {
sprintf(
'{
}',
)
},
fromJSONString = function(PipelineActivitiesJson) {
PipelineActivitiesObject <- jsonlite::fromJSON(PipelineActivitiesJson)
}
)
)
|
/-
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 Mathlib.PrePort
import Mathlib.Lean3Lib.init.default
import Mathlib.category_theory.category.default
import Mathlib.PostPort
universes u v l
namespace Mathlib
/-!
# 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).
-/
namespace category_theory
/-- `bundled` is a type bundled with a type class instance for that type. Only
the type class is exposed as a parameter. -/
structure bundled (c : Type u → Type v)
where
α : Type u
str : autoParam (c α)
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.tactic.apply_instance")
(Lean.Name.mkStr (Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "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 :=
mk α
protected instance has_coe_to_sort {c : Type u → Type v} : has_coe_to_sort (bundled c) :=
has_coe_to_sort.mk (Type u) α
@[simp] theorem coe_mk {c : Type u → Type v} (α : Type u) (str : autoParam (c α)
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.tactic.apply_instance")
(Lean.Name.mkStr (Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "tactic") "apply_instance") [])) : ↥(mk α) = α :=
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 -/
def map {c : Type u → Type v} {d : Type u → Type v} (f : {α : Type u} → c α → d α) (b : bundled c) : bundled d :=
mk ↥b
|
# Makes a decreasing sorted vector of all unique vals
# TODO: Use this for is_itinerant() function to compare top two modes
make_mode_vec_uniques <- function (v) with(rle(sort(v)), values[order(lengths, decreasing = TRUE)])
# IN PROGRESS
# Makes a sorted mode vector.
# Will be useful for obtaining the second most common element
# if the most active tower during a customer’s respective timeframe criteria
# has less than 30% more activity than the second-most-active tower,
# then the record is removed.
#is_itinerant <- function(cell_ids) {
# if (length(cell_ids) == 1) {
# return(FALSE)
# }
# new_vec <- as.vector(cell_ids)
# mode_vec_uniques <- make_mode_vec_uniques(new_vec)
# num_instances_most_active_tower <- length(which(cell_ids == mode_vec_uniques[1]))
# num_instances_second_most_active_tower <- sum(cell_ids == mode_vec_uniques[2] )
# print(paste("num instances most act is ", num_instances_most_active_tower))
# if (is.na(num_instances_second_most_active_tower) | (num_instances_second_most_active_tower == 0))
# return(FALSE)
# print(paste("num instances 2nd most act is ", num_instances_second_most_active_tower))
# tot <- (num_instances_most_active_tower) + (num_instances_second_most_active_tower)
# diff_in_percent <- (num_instances_second_most_active_tower) / (tot)
# print(paste("percent active is ", 1 - diff_in_percent))
# if (diff_in_percent < 0.30) {
# print(paste("ANUMBER with this cellID is itinerant", cell_ids))
# return(FALSE)
# }
# return(TRUE)
#}
is_work_time <- function(call_start_time, k_options) {
# Determines whether a call_start_time occurs during typical work hours.
#
# Args:
# call_start_time: The time at the start of a call for a given record.
# k_options: The data frame containing a set of user-defined
# constants.
#
# Returns:
# TRUE if during work time, FALSE otherwise
if ((get_hour(call_start_time) >= k_options$k_work_start) & (get_hour(call_start_time) <= k_options$k_work_end))
return(TRUE)
else
return(FALSE)
}
home_or_work <- function(call_start_time, k_options) {
# Determines whether a given call time occurs during work or home hours.
#
# Args:
# call_start_time: The time at the start of a call for a given record.
# k_options: The data frame containing a set of user-defined
# constants.
#
# Returns:
# Since ifelse tests conditions for each vector, it writes "Home" or
# "Work" to each element accordingly.
ifelse(!is_work_time(call_start_time, k_options), "Home", "Work")
}
get_mode <- function(v) {
# Gets the mode of vector v
uniqv <- unique(v)
uniqv[which.max(tabulate(match(v, uniqv)))]
}
get_home_or_work_loc_by_label <- function(possible_locs, home_and_work_vec, label) {
# Gets the mode of a set of CELL_IDs to determine which is the most likely
# home/work id.
#
# Args:
# possible_locs: A single-column dframe of possible_locs. Depending on
# value set in k_options, possible vals could be a
# dframe of cell_ids, munis, or depts.
# home_and_work_vec: A single-column dframe with values of "Home" and
# "Work", which are classified as such by time of
# day and correspond to the values in possible_locs.
# label: The label (can be either "Home" or "Work") which is used to
# filter all possible_locs. E.g. if the input label == "Home",
# Then this function will take all possible_locs, subset all
# vals such that their corresponding home_work_vec val ==
# "Home", and find the mode of possible_locs.
#
# Returns:
# The most probable home/work location.
possible_locs <- as.data.frame(possible_locs)
home_and_work_vec <- as.data.frame(home_and_work_vec)
filt <- data.frame(possible_locs, home_and_work_vec) %>%
filter(home_and_work_vec == label)
#if(isItinerant(filt$CELL_ID)) {
#return() # returns <NA> (I think)
#print("found itinerant record")
#}
probable_home_or_work_loc = get_mode(filt$possible_locs)
return(probable_home_or_work_loc)
}
# TODO: Can use get_id_by_label instead?
get_home_id <- function(fcdr, HOME_TYPE, number) {
# Gets the home_id of a given number.
#
# Args:
# HOME_TYPE: The user-defined home type (muni, dept, or cell_id).
# fcdr: The filtered cdr data frame.
# number: The number for which to get home_id (ANUMBER or BNUMBER).
#
# Returns:
# The home_id.
filt <- fcdr %>%
filter(ANUMBER == number)
ID <- filt$HOME_ID
return(as.character(ID))
}
# TODO: Can use get_id_by_label instead?
get_work_id <- function(fcdr, number) {
# Same as get_home_id but work_id.
filt <- fcdr %>%
filter(ANUMBER == number)
ID = filt$WORK_ID
return(as.character(ID))
}
# IN PROGRESS
# option: either "city" or "state"
#get_geo_info_by_coords <- function(option, lat, lon) {
# geo_information <- revgeo(lat, lon, output = "frame")
# if(option == "city")
# return(geo_information$city)
# else if(option == "state")
# return(geo_information$state)
# else
# stop("Error in getGeoInfoByCoords() call.\n
# Must specifiy option for first param.\n
# Option choices: city or state")
#}
get_coords <- function(tower_id, towers) {
# Gets the lat/lon coords for a given tower.
#
# Args:
# tower_id: The tower whose lat/lon coords are to be obtained.
# towers: The data frame consisting of all towers and lat/lons.
#
# Returns:
# The coordinates of the tower.
coords <- filter(towers, CELL_ID == tower_id) %>%
select(LATITUDE, LONGITUDE)
lat <- coords[1, 1]
lon <- coords[1, 2]
return(paste(lat, lon, sep = ","))
}
# Calculates driving distance in km between two points
# From https://stackoverflow.com/questions/16863018/getting-driving-distance-between-two-points-lat-lon-using-r-and-google-map-ap€‹
driving_distance <- function(origin, destination){
xml.url <- paste0('http://maps.googleapis.com/maps/api/distancematrix/xml?origins=',origin,'&destinations=',destination,'&mode=driving&sensor=false')
xmlfile <- xmlParse(getURL(xml.url))
dist <- xmlValue(xmlChildren(xpathApply(xmlfile,"//distance")[[1]])$value)
distance <- as.numeric(sub(" km","",dist))
#ft <- distance*3.28084 # FROM METER TO FEET
km <- distance/1000.0 # from meters to km
return(km)
}
get_distance <- function(fcdr, towers) {
# Creates a data frame containing the distances between home and work
# towers.
#
# Args:
# fcdr: The filtered cdr.
# towers: The data frame consisting of all tower data.
#
# Returns:
# The data frame of fcdr with an added column of driving distances
# between home and work.
dist <- group_by(fcdr, ANUMBER) %>%
summarise(distCommute = driving_distance(get_coords(get_home_id(fcdr, k_options$HOME_TYPE, ANUMBER), towers), get_coords(get_work_id(fcdr, ANUMBER), towers)))
return(dist)
}
show_home_and_work_towers <- function(data, towers, k_options) {
# Creates a data frame which shows the home/work towers for each
# ANUMBER.
#
# Args:
# data: The cdr.
# towers: The tower data.
# k_options: The data frame containing a set of user-defined
# constants.
#
# Returns:
# The data frame with all home and work towers for each ANUMBER.
probable_place <- group_by(data, ANUMBER, START_DATE_TIME, CELL_ID) %>%
summarise(PLACE = home_or_work(START_DATE_TIME, k_options)) %>%
group_by(ANUMBER) %>%
summarise(HOME_ID = get_home_or_work_loc_by_label(CELL_ID, PLACE, "Home"),
WORK_ID = get_home_or_work_loc_by_label(CELL_ID, PLACE, "Work")) %>%
return()
}
show_home_by_label <- function(data, towers, k_options) {
# Shows the type of home_id based on user-defined constant.
#
# Args:
# data: The cdr.
# towers: The tower data.
# k_options: The data frame containing a set of user-defined
# constants.
#
# Returns:
# The filtered cdr with the home shown for each ANUMBER.
label <- k_options$k_home_type[1]
# if home_type is tower
if (label == 1) {
probable_place <- group_by(data, ANUMBER, START_DATE_TIME, CELL_ID) %>%
summarise(PLACE = home_or_work(START_DATE_TIME, k_options)) %>%
group_by(ANUMBER) %>%
summarise(HOME_ID = get_home_or_work_loc_by_label(CELL_ID, PLACE, "Home")) %>%
return()
}
# home_type is city
else if (label == 2) {
print("data is:")
print(head(data))
probable_place <- group_by(data, ANUMBER, START_DATE_TIME, CITY) %>%
summarise(PLACE = home_or_work(START_DATE_TIME, k_options)) %>%
group_by(ANUMBER) %>%
summarise(HOME_ID = get_home_or_work_loc_by_label(CITY, PLACE, "Home")) %>%
return()
}
# home_type is state
else if (label == 3) {
probable_place <- group_by(data, ANUMBER, START_DATE_TIME, STATE) %>%
summarise(PLACE = home_or_work(START_DATE_TIME, k_options)) %>%
group_by(ANUMBER) %>%
summarise(HOME_ID = get_home_or_work_loc_by_label(STATE, PLACE, "Home")) %>%
return()
}
}
find_and_remove_records_with_no_home_work_pair <- function(data, towers, k_options) {
# Removes all records that do not have home/work pairs.
#
# Args:
# data: The cdr.
# towers: The tower data.
# k_options: k_options: The data frame containing a set of user-defined
# constants.
#
# Returns:
# The filtered cdr containing only records that have home/work pairs.
print("Removing records with no home/work pairs...")
orig_num <- nrow(data) # get orig num records
#redefine cdr with only pairs
filt_cdr <- show_home_and_work_towers(data, towers, k_options) %>%
filter(!is.na(HOME_ID) & !is.na(WORK_ID))
# get new num records after removing records w/o home and work locs
new_num <- nrow(filt_cdr)
print(paste("raw data: ", orig_num, " record(s)", sep = ""))
print(paste("filtered data: ", new_num, " record(s)", sep = ""))
print(paste("percentage removed", 100 - (orig_num / new_num)))
return(filt_cdr)
}
# TODO: Split functions such that, in main(), show_home_and_work_towers()
# passes its return value into remove_records_with_no_home()
find_and_remove_records_with_no_home <- function(data, towers, k_options) {
# Removes all records that do not have home_ids.
#
# Args:
# See above.
#
# Returns:
# The filtered cdr containing only records that have homes.
print("Removing records with no home...")
orig_num <- nrow(data) # get orig num records
#redefine cdr showing only recs with homes
filt_cdr <- show_home_by_label(data, towers, k_options) %>%
filter(!is.na(HOME_ID) & (HOME_ID != "NOT APPLICABLE") &
(HOME_ID != "TO BE DETERMINED" &
(HOME_ID != "NIVEL DEPARTAMENTAL")))
# get new num records after removing records w/o home
new_num <- nrow(filt_cdr)
print(paste("raw data: ", orig_num, " record(s)", sep = ""))
print(paste("num records with homes: ", new_num, " record(s)", sep = ""))
print(paste("percentage removed", 100 - (orig_num / new_num)))
return(filt_cdr)
}
get_data <- function(PATHS) {
# Load all data into a vector of data frames.
#
# Args:
# PATHS: The vector of paths containing user-defined file paths.
#
# Returns:
# A list of three data frames (cdr, towers, and elec_data).
cdr_raw <- read.csv(PATHS[1]) # import call detail records
print("Loaded raw data")
towers <- read.csv(PATHS[2]) # import tower locations
print("Loaded tower data")
cdr <- merge(cdr_raw, towers, by="CELL_ID") # merge data into one table
print("Merged tower and cell data")
elec_data <- read.csv(PATHS[3]) # import 2015 secondary election data
print("Loaded election data")
# make a list of three data frames (cdr, towers, elec_data)
df.cdr <- data.frame(cdr)
df.towers <- data.frame(towers)
df.elec_data <- data.frame(elec_data)
return(list("cdr" = df.cdr, "towers" = df.towers, "elec_data" = df.elec_data))
}
# init file paths
init_paths <- function() {
CDR_DATA <- "/Users/tedhadges/Projects/guatemala/raw_data/Filtered_Sample.csv"
TOWER_DATA <- "/Users/tedhadges/Projects/guatemala/raw_data/tower_data.csv"
ELECTION_DATA <- "../../mapping/data/elecData2015.csv"
PATHS <- c(CDR_DATA, TOWER_DATA, ELECTION_DATA)
return(PATHS)
}
set_options<- function() {
# Creates a data frame of user-defined constants to be used in other
# functions. Manually set all params here.
k_work_start_time <- 8 # set work start time here
k_work_end_time <- 18 # set work end time here
# use k_home_id_type to define how to classify home_id
# opts: tower: 1, city: 2, state: 3
k_home_id_type <- 2
k_options_frame <- data.frame("k_work_start", "k_work_end", "k_home_type")
k_options_frame$k_work_start <- k_work_start_time
k_options_frame$k_work_end <- k_work_end_time
k_options_frame$k_home_type <- k_home_id_type
return(k_options_frame)
}
# check if packs installed and load them
load_packs <- function() {
source("timeParser.r")
list_of_packages <- c("dplyr", "modeest", "lubridate", "XML", "bitops", "RCurl", "profvis", "ggmap", "reshape")
new_packages <- list_of_packages[!(list_of_packages %in% installed.packages()[,"Package"])]
if(length(new_packages)) install.packages(new_packages)
# load the packs
library(dplyr)
library(modeest)
library(lubridate)
library(XML)
library(bitops)
library(RCurl)
library(reshape)
}
# dframe is a two-column dframe with ANUMBER HOME_ID
# Returns a data frame whose columns are "HOME_ID" and "n", where n is the
# number of callers who have that home_id.
group_by_home_loc <- function(dframe) {
groupedFrame <- group_by(dframe, HOME_ID) %>%
tally() %>%
return()
}
# IN PROGRESS
#plot_by_home_id <- function(dframe) {
#plot(x, axes = FALSE,
#axis(side = 1, at = c(1,5,10))
#axis(side = 2, at = c(1,3,7,10))
#main="Number of Callers by Home Location",
#xlab="Home IDs",
#ylab="Number of Callers",
#type="b",
#col="blue")
#lines(x,col="red")
#fill=c("blue")
#}
main_commute <- function() {
load_packs() # install (if necessary) and load packages
PATHS <- init_paths() # init file paths
k_options <- set_options() # dframe with all params/options
data_list <- get_data(PATHS)
cdr <- data_list$cdr
towers <- data_list$towers
#fcdr <- removeRecordsWithNoHomeWorkPair(cdr, towers, threshs)
fcdr <- find_and_remove_records_with_no_home(cdr, towers, k_options)
#fcdr_dist <- get_distance(fcdr, towers)
cdr_for_plotting<- group_by_home_loc(fcdr)
return(cdr_for_plotting)
}
|
Formal statement is: lemma measurable_comp: "f \<in> measurable M N \<Longrightarrow> g \<in> measurable N L \<Longrightarrow> g \<circ> f \<in> measurable M L" Informal statement is: If $f$ is a measurable function from $M$ to $N$ and $g$ is a measurable function from $N$ to $L$, then $g \circ f$ is a measurable function from $M$ to $L$.
|
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
s : Set E
⊢ EMetric.diam (c • s) = ‖c‖₊ • EMetric.diam s
[PROOFSTEP]
refine' le_antisymm (ediam_smul_le c s) _
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
s : Set E
⊢ ‖c‖₊ • EMetric.diam s ≤ EMetric.diam (c • s)
[PROOFSTEP]
obtain rfl | hc := eq_or_ne c 0
[GOAL]
case inl
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
s : Set E
⊢ ‖0‖₊ • EMetric.diam s ≤ EMetric.diam (0 • s)
[PROOFSTEP]
obtain rfl | hs := s.eq_empty_or_nonempty
[GOAL]
case inl.inl
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
⊢ ‖0‖₊ • EMetric.diam ∅ ≤ EMetric.diam (0 • ∅)
[PROOFSTEP]
simp
[GOAL]
case inl.inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
s : Set E
hs : Set.Nonempty s
⊢ ‖0‖₊ • EMetric.diam s ≤ EMetric.diam (0 • s)
[PROOFSTEP]
simp [zero_smul_set hs, ← Set.singleton_zero]
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
s : Set E
hc : c ≠ 0
⊢ ‖c‖₊ • EMetric.diam s ≤ EMetric.diam (c • s)
[PROOFSTEP]
have := (lipschitzWith_smul c⁻¹).ediam_image_le (c • s)
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
s : Set E
hc : c ≠ 0
this : EMetric.diam ((fun x x_1 => x • x_1) c⁻¹ '' (c • s)) ≤ ↑‖c⁻¹‖₊ * EMetric.diam (c • s)
⊢ ‖c‖₊ • EMetric.diam s ≤ EMetric.diam (c • s)
[PROOFSTEP]
rwa [← smul_eq_mul, ← ENNReal.smul_def, Set.image_smul, inv_smul_smul₀ hc s, nnnorm_inv,
ENNReal.le_inv_smul_iff (nnnorm_ne_zero_iff.mpr hc)] at this
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
x : Set E
⊢ diam (c • x) = ‖c‖ * diam x
[PROOFSTEP]
simp_rw [diam, ediam_smul₀, ENNReal.toReal_smul, NNReal.smul_def, coe_nnnorm, smul_eq_mul]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
⊢ EMetric.infEdist (c • x) (c • s) = ‖c‖₊ • EMetric.infEdist x s
[PROOFSTEP]
simp_rw [EMetric.infEdist]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
⊢ ⨅ (y : E) (_ : y ∈ c • s), edist (c • x) y = ‖c‖₊ • ⨅ (y : E) (_ : y ∈ s), edist x y
[PROOFSTEP]
have : Function.Surjective ((c • ·) : E → E) := Function.RightInverse.surjective (smul_inv_smul₀ hc)
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
this : Function.Surjective fun x => c • x
⊢ ⨅ (y : E) (_ : y ∈ c • s), edist (c • x) y = ‖c‖₊ • ⨅ (y : E) (_ : y ∈ s), edist x y
[PROOFSTEP]
trans ⨅ (y) (_ : y ∈ s), ‖c‖₊ • edist x y
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
this : Function.Surjective fun x => c • x
⊢ ⨅ (y : E) (_ : y ∈ c • s), edist (c • x) y = ⨅ (y : E) (_ : y ∈ s), ‖c‖₊ • edist x y
[PROOFSTEP]
refine' (this.iInf_congr _ fun y => _).symm
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
this : Function.Surjective fun x => c • x
y : E
⊢ ⨅ (_ : c • y ∈ c • s), edist (c • x) (c • y) = ⨅ (_ : y ∈ s), ‖c‖₊ • edist x y
[PROOFSTEP]
simp_rw [smul_mem_smul_set_iff₀ hc, edist_smul₀]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
this : Function.Surjective fun x => c • x
⊢ ⨅ (y : E) (_ : y ∈ s), ‖c‖₊ • edist x y = ‖c‖₊ • ⨅ (y : E) (_ : y ∈ s), edist x y
[PROOFSTEP]
have : (‖c‖₊ : ENNReal) ≠ 0 := by simp [hc]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
this : Function.Surjective fun x => c • x
⊢ ↑‖c‖₊ ≠ 0
[PROOFSTEP]
simp [hc]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
this✝ : Function.Surjective fun x => c • x
this : ↑‖c‖₊ ≠ 0
⊢ ⨅ (y : E) (_ : y ∈ s), ‖c‖₊ • edist x y = ‖c‖₊ • ⨅ (y : E) (_ : y ∈ s), edist x y
[PROOFSTEP]
simp_rw [ENNReal.smul_def, smul_eq_mul, ENNReal.mul_iInf_of_ne this ENNReal.coe_ne_top]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedDivisionRing 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
c : 𝕜
hc : c ≠ 0
s : Set E
x : E
⊢ infDist (c • x) (c • s) = ‖c‖ * infDist x s
[PROOFSTEP]
simp_rw [Metric.infDist, infEdist_smul₀ hc s, ENNReal.toReal_smul, NNReal.smul_def, coe_nnnorm, smul_eq_mul]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
⊢ c • ball x r = ball (c • x) (‖c‖ * r)
[PROOFSTEP]
ext y
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
⊢ y ∈ c • ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)
[PROOFSTEP]
rw [mem_smul_set_iff_inv_smul_mem₀ hc]
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
⊢ c⁻¹ • y ∈ ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)
[PROOFSTEP]
conv_lhs => rw [← inv_smul_smul₀ hc x]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
| c⁻¹ • y ∈ ball x r
[PROOFSTEP]
rw [← inv_smul_smul₀ hc x]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
| c⁻¹ • y ∈ ball x r
[PROOFSTEP]
rw [← inv_smul_smul₀ hc x]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
| c⁻¹ • y ∈ ball x r
[PROOFSTEP]
rw [← inv_smul_smul₀ hc x]
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
⊢ c⁻¹ • y ∈ ball (c⁻¹ • c • x) r ↔ y ∈ ball (c • x) (‖c‖ * r)
[PROOFSTEP]
simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
⊢ c • ball 0 1 = ball 0 ‖c‖
[PROOFSTEP]
rw [_root_.smul_ball hc, smul_zero, mul_one]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
⊢ c • sphere x r = sphere (c • x) (‖c‖ * r)
[PROOFSTEP]
ext y
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
⊢ y ∈ c • sphere x r ↔ y ∈ sphere (c • x) (‖c‖ * r)
[PROOFSTEP]
rw [mem_smul_set_iff_inv_smul_mem₀ hc]
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
⊢ c⁻¹ • y ∈ sphere x r ↔ y ∈ sphere (c • x) (‖c‖ * r)
[PROOFSTEP]
conv_lhs => rw [← inv_smul_smul₀ hc x]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
| c⁻¹ • y ∈ sphere x r
[PROOFSTEP]
rw [← inv_smul_smul₀ hc x]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
| c⁻¹ • y ∈ sphere x r
[PROOFSTEP]
rw [← inv_smul_smul₀ hc x]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
| c⁻¹ • y ∈ sphere x r
[PROOFSTEP]
rw [← inv_smul_smul₀ hc x]
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
y : E
⊢ c⁻¹ • y ∈ sphere (c⁻¹ • c • x) r ↔ y ∈ sphere (c • x) (‖c‖ * r)
[PROOFSTEP]
simp only [mem_sphere, dist_smul₀, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne', mul_comm r]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
hc : c ≠ 0
x : E
r : ℝ
⊢ c • closedBall x r = closedBall (c • x) (‖c‖ * r)
[PROOFSTEP]
simp only [← ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
⊢ ∀ᶠ (r : 𝕜) in 𝓝 0, {x} + r • s ⊆ u
[PROOFSTEP]
obtain ⟨ε, εpos, hε⟩ : ∃ ε : ℝ, 0 < ε ∧ closedBall x ε ⊆ u := nhds_basis_closedBall.mem_iff.1 hu
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
⊢ ∀ᶠ (r : 𝕜) in 𝓝 0, {x} + r • s ⊆ u
[PROOFSTEP]
obtain ⟨R, Rpos, hR⟩ : ∃ R : ℝ, 0 < R ∧ s ⊆ closedBall 0 R := hs.subset_ball_lt 0 0
[GOAL]
case intro.intro.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
⊢ ∀ᶠ (r : 𝕜) in 𝓝 0, {x} + r • s ⊆ u
[PROOFSTEP]
have : Metric.closedBall (0 : 𝕜) (ε / R) ∈ 𝓝 (0 : 𝕜) := closedBall_mem_nhds _ (div_pos εpos Rpos)
[GOAL]
case intro.intro.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
⊢ ∀ᶠ (r : 𝕜) in 𝓝 0, {x} + r • s ⊆ u
[PROOFSTEP]
filter_upwards [this] with r hr
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
⊢ {x} + r • s ⊆ u
[PROOFSTEP]
simp only [image_add_left, singleton_add]
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
⊢ (fun x_1 => -x + x_1) ⁻¹' (r • s) ⊆ u
[PROOFSTEP]
intro y hy
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
y : E
hy : y ∈ (fun x_1 => -x + x_1) ⁻¹' (r • s)
⊢ y ∈ u
[PROOFSTEP]
obtain ⟨z, zs, hz⟩ : ∃ z : E, z ∈ s ∧ r • z = -x + y := by simpa [mem_smul_set] using hy
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
y : E
hy : y ∈ (fun x_1 => -x + x_1) ⁻¹' (r • s)
⊢ ∃ z, z ∈ s ∧ r • z = -x + y
[PROOFSTEP]
simpa [mem_smul_set] using hy
[GOAL]
case h.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
y : E
hy : y ∈ (fun x_1 => -x + x_1) ⁻¹' (r • s)
z : E
zs : z ∈ s
hz : r • z = -x + y
⊢ y ∈ u
[PROOFSTEP]
have I : ‖r • z‖ ≤ ε :=
calc
‖r • z‖ = ‖r‖ * ‖z‖ := norm_smul _ _
_ ≤ ε / R * R :=
(mul_le_mul (mem_closedBall_zero_iff.1 hr) (mem_closedBall_zero_iff.1 (hR zs)) (norm_nonneg _)
(div_pos εpos Rpos).le)
_ = ε := by field_simp [Rpos.ne']
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
y : E
hy : y ∈ (fun x_1 => -x + x_1) ⁻¹' (r • s)
z : E
zs : z ∈ s
hz : r • z = -x + y
⊢ ε / R * R = ε
[PROOFSTEP]
field_simp [Rpos.ne']
[GOAL]
case h.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
y : E
hy : y ∈ (fun x_1 => -x + x_1) ⁻¹' (r • s)
z : E
zs : z ∈ s
hz : r • z = -x + y
I : ‖r • z‖ ≤ ε
⊢ y ∈ u
[PROOFSTEP]
have : y = x + r • z := by simp only [hz, add_neg_cancel_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
y : E
hy : y ∈ (fun x_1 => -x + x_1) ⁻¹' (r • s)
z : E
zs : z ∈ s
hz : r • z = -x + y
I : ‖r • z‖ ≤ ε
⊢ y = x + r • z
[PROOFSTEP]
simp only [hz, add_neg_cancel_left]
[GOAL]
case h.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this✝ : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
y : E
hy : y ∈ (fun x_1 => -x + x_1) ⁻¹' (r • s)
z : E
zs : z ∈ s
hz : r • z = -x + y
I : ‖r • z‖ ≤ ε
this : y = x + r • z
⊢ y ∈ u
[PROOFSTEP]
apply hε
[GOAL]
case h.intro.intro.a
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
s : Set E
hs : Metric.Bounded s
u : Set E
hu : u ∈ 𝓝 x
ε : ℝ
εpos : 0 < ε
hε : closedBall x ε ⊆ u
R : ℝ
Rpos : 0 < R
hR : s ⊆ closedBall 0 R
this✝ : closedBall 0 (ε / R) ∈ 𝓝 0
r : 𝕜
hr : r ∈ closedBall 0 (ε / R)
y : E
hy : y ∈ (fun x_1 => -x + x_1) ⁻¹' (r • s)
z : E
zs : z ∈ s
hz : r • z = -x + y
I : ‖r • z‖ ≤ ε
this : y = x + r • z
⊢ y ∈ closedBall x ε
[PROOFSTEP]
simpa only [this, dist_eq_norm, add_sub_cancel', mem_closedBall] using I
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε r : ℝ
hr : 0 < r
⊢ r • ball 0 1 = ball 0 r
[PROOFSTEP]
rw [smul_unitBall hr.ne', Real.norm_of_nonneg hr.le]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
x z : E
a b : ℝ
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
⊢ ∃ y, dist x y = b * dist x z ∧ dist y z = a * dist x z
[PROOFSTEP]
use a • x + b • z
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
x z : E
a b : ℝ
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
⊢ dist x (a • x + b • z) = b * dist x z ∧ dist (a • x + b • z) z = a * dist x z
[PROOFSTEP]
nth_rw 1 [← one_smul ℝ x]
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
x z : E
a b : ℝ
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
⊢ dist (1 • x) (a • x + b • z) = b * dist x z ∧ dist (a • x + b • z) z = a * dist x z
[PROOFSTEP]
nth_rw 4 [← one_smul ℝ z]
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
x z : E
a b : ℝ
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
⊢ dist (1 • x) (a • x + b • z) = b * dist x z ∧ dist (a • x + b • z) (1 • z) = a * dist x z
[PROOFSTEP]
simp [dist_eq_norm, ← hab, add_smul, ← smul_sub, norm_smul_of_nonneg, ha, hb]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : dist x z ≤ ε + δ
⊢ ∃ y, dist x y ≤ δ ∧ dist y z ≤ ε
[PROOFSTEP]
obtain rfl | hε' := hε.eq_or_lt
[GOAL]
case inl
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ 0
h : dist x z ≤ 0 + δ
⊢ ∃ y, dist x y ≤ δ ∧ dist y z ≤ 0
[PROOFSTEP]
exact ⟨z, by rwa [zero_add] at h , (dist_self _).le⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ 0
h : dist x z ≤ 0 + δ
⊢ dist x z ≤ δ
[PROOFSTEP]
rwa [zero_add] at h
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : dist x z ≤ ε + δ
hε' : 0 < ε
⊢ ∃ y, dist x y ≤ δ ∧ dist y z ≤ ε
[PROOFSTEP]
have hεδ := add_pos_of_pos_of_nonneg hε' hδ
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : dist x z ≤ ε + δ
hε' : 0 < ε
hεδ : 0 < ε + δ
⊢ ∃ y, dist x y ≤ δ ∧ dist y z ≤ ε
[PROOFSTEP]
refine'
(exists_dist_eq x z (div_nonneg hε <| add_nonneg hε hδ) (div_nonneg hδ <| add_nonneg hε hδ) <| by
rw [← add_div, div_self hεδ.ne']).imp
fun y hy => _
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : dist x z ≤ ε + δ
hε' : 0 < ε
hεδ : 0 < ε + δ
⊢ ε / (ε + δ) + δ / (ε + δ) = 1
[PROOFSTEP]
rw [← add_div, div_self hεδ.ne']
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : dist x z ≤ ε + δ
hε' : 0 < ε
hεδ : 0 < ε + δ
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x y ≤ δ ∧ dist y z ≤ ε
[PROOFSTEP]
rw [hy.1, hy.2, div_mul_comm, div_mul_comm ε]
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : dist x z ≤ ε + δ
hε' : 0 < ε
hεδ : 0 < ε + δ
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x z / (ε + δ) * δ ≤ δ ∧ dist x z / (ε + δ) * ε ≤ ε
[PROOFSTEP]
rw [← div_le_one hεδ] at h
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : dist x z / (ε + δ) ≤ 1
hε' : 0 < ε
hεδ : 0 < ε + δ
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x z / (ε + δ) * δ ≤ δ ∧ dist x z / (ε + δ) * ε ≤ ε
[PROOFSTEP]
exact ⟨mul_le_of_le_one_left hδ h, mul_le_of_le_one_left hε h⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 < ε
h : dist x z < ε + δ
⊢ ∃ y, dist x y ≤ δ ∧ dist y z < ε
[PROOFSTEP]
refine'
(exists_dist_eq x z (div_nonneg hε.le <| add_nonneg hε.le hδ) (div_nonneg hδ <| add_nonneg hε.le hδ) <| by
rw [← add_div, div_self (add_pos_of_pos_of_nonneg hε hδ).ne']).imp
fun y hy => _
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 < ε
h : dist x z < ε + δ
⊢ ε / (ε + δ) + δ / (ε + δ) = 1
[PROOFSTEP]
rw [← add_div, div_self (add_pos_of_pos_of_nonneg hε hδ).ne']
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 < ε
h : dist x z < ε + δ
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x y ≤ δ ∧ dist y z < ε
[PROOFSTEP]
rw [hy.1, hy.2, div_mul_comm, div_mul_comm ε]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 < ε
h : dist x z < ε + δ
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x z / (ε + δ) * δ ≤ δ ∧ dist x z / (ε + δ) * ε < ε
[PROOFSTEP]
rw [← div_lt_one (add_pos_of_pos_of_nonneg hε hδ)] at h
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 < ε
h : dist x z / (ε + δ) < 1
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x z / (ε + δ) * δ ≤ δ ∧ dist x z / (ε + δ) * ε < ε
[PROOFSTEP]
exact ⟨mul_le_of_le_one_left hδ h.le, mul_lt_of_lt_one_left hε h⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
h : dist x z < ε + δ
⊢ ∃ y, dist x y < δ ∧ dist y z ≤ ε
[PROOFSTEP]
obtain ⟨y, yz, xy⟩ := exists_dist_le_lt hε hδ (show dist z x < δ + ε by simpa only [dist_comm, add_comm] using h)
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
h : dist x z < ε + δ
⊢ dist z x < δ + ε
[PROOFSTEP]
simpa only [dist_comm, add_comm] using h
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
h : dist x z < ε + δ
y : E
yz : dist z y ≤ ε
xy : dist y x < δ
⊢ ∃ y, dist x y < δ ∧ dist y z ≤ ε
[PROOFSTEP]
exact ⟨y, by simp [dist_comm x y, dist_comm y z, *]⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
h : dist x z < ε + δ
y : E
yz : dist z y ≤ ε
xy : dist y x < δ
⊢ dist x y < δ ∧ dist y z ≤ ε
[PROOFSTEP]
simp [dist_comm x y, dist_comm y z, *]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : dist x z < ε + δ
⊢ ∃ y, dist x y < δ ∧ dist y z < ε
[PROOFSTEP]
refine'
(exists_dist_eq x z (div_nonneg hε.le <| add_nonneg hε.le hδ.le) (div_nonneg hδ.le <| add_nonneg hε.le hδ.le) <| by
rw [← add_div, div_self (add_pos hε hδ).ne']).imp
fun y hy => _
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : dist x z < ε + δ
⊢ ε / (ε + δ) + δ / (ε + δ) = 1
[PROOFSTEP]
rw [← add_div, div_self (add_pos hε hδ).ne']
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : dist x z < ε + δ
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x y < δ ∧ dist y z < ε
[PROOFSTEP]
rw [hy.1, hy.2, div_mul_comm, div_mul_comm ε]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : dist x z < ε + δ
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x z / (ε + δ) * δ < δ ∧ dist x z / (ε + δ) * ε < ε
[PROOFSTEP]
rw [← div_lt_one (add_pos hε hδ)] at h
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y✝ z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : dist x z / (ε + δ) < 1
y : E
hy : dist x y = δ / (ε + δ) * dist x z ∧ dist y z = ε / (ε + δ) * dist x z
⊢ dist x z / (ε + δ) * δ < δ ∧ dist x z / (ε + δ) * ε < ε
[PROOFSTEP]
exact ⟨mul_lt_of_lt_one_left hδ h, mul_lt_of_lt_one_left hε h⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
⊢ Disjoint (ball x δ) (ball y ε) ↔ δ + ε ≤ dist x y
[PROOFSTEP]
refine' ⟨fun h => le_of_not_lt fun hxy => _, ball_disjoint_ball⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : Disjoint (ball x δ) (ball y ε)
hxy : dist x y < δ + ε
⊢ False
[PROOFSTEP]
rw [add_comm] at hxy
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : Disjoint (ball x δ) (ball y ε)
hxy : dist x y < ε + δ
⊢ False
[PROOFSTEP]
obtain ⟨z, hxz, hzy⟩ := exists_dist_lt_lt hδ hε hxy
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z✝ : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : Disjoint (ball x δ) (ball y ε)
hxy : dist x y < ε + δ
z : E
hxz : dist x z < δ
hzy : dist z y < ε
⊢ False
[PROOFSTEP]
rw [dist_comm] at hxz
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z✝ : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 < ε
h : Disjoint (ball x δ) (ball y ε)
hxy : dist x y < ε + δ
z : E
hxz : dist z x < δ
hzy : dist z y < ε
⊢ False
[PROOFSTEP]
exact h.le_bot ⟨hxz, hzy⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
⊢ Disjoint (ball x δ) (closedBall y ε) ↔ δ + ε ≤ dist x y
[PROOFSTEP]
refine' ⟨fun h => le_of_not_lt fun hxy => _, ball_disjoint_closedBall⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
h : Disjoint (ball x δ) (closedBall y ε)
hxy : dist x y < δ + ε
⊢ False
[PROOFSTEP]
rw [add_comm] at hxy
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
h : Disjoint (ball x δ) (closedBall y ε)
hxy : dist x y < ε + δ
⊢ False
[PROOFSTEP]
obtain ⟨z, hxz, hzy⟩ := exists_dist_lt_le hδ hε hxy
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z✝ : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
h : Disjoint (ball x δ) (closedBall y ε)
hxy : dist x y < ε + δ
z : E
hxz : dist x z < δ
hzy : dist z y ≤ ε
⊢ False
[PROOFSTEP]
rw [dist_comm] at hxz
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z✝ : E
δ ε : ℝ
hδ : 0 < δ
hε : 0 ≤ ε
h : Disjoint (ball x δ) (closedBall y ε)
hxy : dist x y < ε + δ
z : E
hxz : dist z x < δ
hzy : dist z y ≤ ε
⊢ False
[PROOFSTEP]
exact h.le_bot ⟨hxz, hzy⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 < ε
⊢ Disjoint (closedBall x δ) (ball y ε) ↔ δ + ε ≤ dist x y
[PROOFSTEP]
rw [disjoint_comm, disjoint_ball_closedBall_iff hε hδ, add_comm, dist_comm]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
⊢ Disjoint (closedBall x δ) (closedBall y ε) ↔ δ + ε < dist x y
[PROOFSTEP]
refine' ⟨fun h => lt_of_not_ge fun hxy => _, closedBall_disjoint_closedBall⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : Disjoint (closedBall x δ) (closedBall y ε)
hxy : δ + ε ≥ dist x y
⊢ False
[PROOFSTEP]
rw [add_comm] at hxy
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : Disjoint (closedBall x δ) (closedBall y ε)
hxy : ε + δ ≥ dist x y
⊢ False
[PROOFSTEP]
obtain ⟨z, hxz, hzy⟩ := exists_dist_le_le hδ hε hxy
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z✝ : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : Disjoint (closedBall x δ) (closedBall y ε)
hxy : ε + δ ≥ dist x y
z : E
hxz : dist x z ≤ δ
hzy : dist z y ≤ ε
⊢ False
[PROOFSTEP]
rw [dist_comm] at hxz
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z✝ : E
δ ε : ℝ
hδ : 0 ≤ δ
hε : 0 ≤ ε
h : Disjoint (closedBall x δ) (closedBall y ε)
hxy : ε + δ ≥ dist x y
z : E
hxz : dist z x ≤ δ
hzy : dist z y ≤ ε
⊢ False
[PROOFSTEP]
exact h.le_bot ⟨hxz, hzy⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
⊢ infEdist x (thickening δ s) = infEdist x s - ENNReal.ofReal δ
[PROOFSTEP]
obtain hs | hs := lt_or_le (infEdist x s) (ENNReal.ofReal δ)
[GOAL]
case inl
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : infEdist x s < ENNReal.ofReal δ
⊢ infEdist x (thickening δ s) = infEdist x s - ENNReal.ofReal δ
[PROOFSTEP]
rw [infEdist_zero_of_mem, tsub_eq_zero_of_le hs.le]
[GOAL]
case inl
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : infEdist x s < ENNReal.ofReal δ
⊢ x ∈ thickening δ s
[PROOFSTEP]
exact hs
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
⊢ infEdist x (thickening δ s) = infEdist x s - ENNReal.ofReal δ
[PROOFSTEP]
refine' (tsub_le_iff_right.2 infEdist_le_infEdist_thickening_add).antisymm' _
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
⊢ infEdist x (thickening δ s) ≤ infEdist x s - ENNReal.ofReal δ
[PROOFSTEP]
refine' le_sub_of_add_le_right ofReal_ne_top _
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
⊢ infEdist x (thickening δ s) + ENNReal.ofReal δ ≤ infEdist x s
[PROOFSTEP]
refine' le_infEdist.2 fun z hz => le_of_forall_lt' fun r h => _
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : ℝ≥0∞
h : edist x z < r
⊢ infEdist x (thickening δ s) + ENNReal.ofReal δ < r
[PROOFSTEP]
cases' r with r
[GOAL]
case inr.none
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
h : edist x z < none
⊢ infEdist x (thickening δ s) + ENNReal.ofReal δ < none
[PROOFSTEP]
exact add_lt_top.2 ⟨lt_top_iff_ne_top.2 <| infEdist_ne_top ⟨z, self_subset_thickening hδ _ hz⟩, ofReal_lt_top⟩
[GOAL]
case inr.some
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : edist x z < Option.some r
⊢ infEdist x (thickening δ s) + ENNReal.ofReal δ < Option.some r
[PROOFSTEP]
have hr : 0 < ↑r - δ := by
refine' sub_pos_of_lt _
have := hs.trans_lt ((infEdist_le_edist_of_mem hz).trans_lt h)
rw [ofReal_eq_coe_nnreal hδ.le, some_eq_coe] at this
exact_mod_cast this
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : edist x z < Option.some r
⊢ 0 < ↑r - δ
[PROOFSTEP]
refine' sub_pos_of_lt _
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : edist x z < Option.some r
⊢ δ < ↑r
[PROOFSTEP]
have := hs.trans_lt ((infEdist_le_edist_of_mem hz).trans_lt h)
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : edist x z < Option.some r
this : ENNReal.ofReal δ < Option.some r
⊢ δ < ↑r
[PROOFSTEP]
rw [ofReal_eq_coe_nnreal hδ.le, some_eq_coe] at this
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : edist x z < Option.some r
this : ↑{ val := δ, property := (_ : 0 ≤ δ) } < ↑r
⊢ δ < ↑r
[PROOFSTEP]
exact_mod_cast this
[GOAL]
case inr.some
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : edist x z < Option.some r
hr : 0 < ↑r - δ
⊢ infEdist x (thickening δ s) + ENNReal.ofReal δ < Option.some r
[PROOFSTEP]
rw [some_eq_coe, edist_lt_coe, ← dist_lt_coe, ← add_sub_cancel'_right δ ↑r] at h
[GOAL]
case inr.some
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : dist x z < δ + (↑r - δ)
hr : 0 < ↑r - δ
⊢ infEdist x (thickening δ s) + ENNReal.ofReal δ < Option.some r
[PROOFSTEP]
obtain ⟨y, hxy, hyz⟩ := exists_dist_lt_lt hr hδ h
[GOAL]
case inr.some.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y✝ z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : dist x z < δ + (↑r - δ)
hr : 0 < ↑r - δ
y : E
hxy : dist x y < ↑r - δ
hyz : dist y z < δ
⊢ infEdist x (thickening δ s) + ENNReal.ofReal δ < Option.some r
[PROOFSTEP]
refine'
(ENNReal.add_lt_add_right ofReal_ne_top <|
infEdist_lt_iff.2 ⟨_, mem_thickening_iff.2 ⟨_, hz, hyz⟩, edist_lt_ofReal.2 hxy⟩).trans_le
_
[GOAL]
case inr.some.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y✝ z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : dist x z < δ + (↑r - δ)
hr : 0 < ↑r - δ
y : E
hxy : dist x y < ↑r - δ
hyz : dist y z < δ
⊢ ENNReal.ofReal (↑r - δ) + ENNReal.ofReal δ ≤ Option.some r
[PROOFSTEP]
rw [← ofReal_add hr.le hδ.le, sub_add_cancel, ofReal_coe_nnreal]
[GOAL]
case inr.some.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y✝ z✝ : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
x : E
hs : ENNReal.ofReal δ ≤ infEdist x s
z : E
hz : z ∈ s
r : NNReal
h : dist x z < δ + (↑r - δ)
hr : 0 < ↑r - δ
y : E
hxy : dist x y < ↑r - δ
hyz : dist y z < δ
⊢ ↑r ≤ Option.some r
[PROOFSTEP]
exact le_rfl
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 < δ
s : Set E
x : E
⊢ x ∈ thickening (ε + δ) s → x ∈ thickening ε (thickening δ s)
[PROOFSTEP]
simp_rw [mem_thickening_iff]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 < δ
s : Set E
x : E
⊢ (∃ z, z ∈ s ∧ dist x z < ε + δ) → ∃ z, (∃ z_1, z_1 ∈ s ∧ dist z z_1 < δ) ∧ dist x z < ε
[PROOFSTEP]
rintro ⟨z, hz, hxz⟩
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 < δ
s : Set E
x z : E
hz : z ∈ s
hxz : dist x z < ε + δ
⊢ ∃ z, (∃ z_1, z_1 ∈ s ∧ dist z z_1 < δ) ∧ dist x z < ε
[PROOFSTEP]
rw [add_comm] at hxz
[GOAL]
case intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z✝ : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 < δ
s : Set E
x z : E
hz : z ∈ s
hxz : dist x z < δ + ε
⊢ ∃ z, (∃ z_1, z_1 ∈ s ∧ dist z z_1 < δ) ∧ dist x z < ε
[PROOFSTEP]
obtain ⟨y, hxy, hyz⟩ := exists_dist_lt_lt hε hδ hxz
[GOAL]
case intro.intro.intro.intro
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y✝ z✝ : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 < δ
s : Set E
x z : E
hz : z ∈ s
hxz : dist x z < δ + ε
y : E
hxy : dist x y < ε
hyz : dist y z < δ
⊢ ∃ z, (∃ z_1, z_1 ∈ s ∧ dist z z_1 < δ) ∧ dist x z < ε
[PROOFSTEP]
exact ⟨y, ⟨_, hz, hyz⟩, hxy⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 ≤ ε
hδ : 0 < δ
s : Set E
x : E
⊢ x ∈ cthickening (ε + δ) s → x ∈ cthickening ε (thickening δ s)
[PROOFSTEP]
simp_rw [mem_cthickening_iff, ENNReal.ofReal_add hε hδ.le, infEdist_thickening hδ]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 ≤ ε
hδ : 0 < δ
s : Set E
x : E
⊢ infEdist x s ≤ ENNReal.ofReal ε + ENNReal.ofReal δ → infEdist x s - ENNReal.ofReal δ ≤ ENNReal.ofReal ε
[PROOFSTEP]
exact tsub_le_iff_right.2
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hδ : 0 < δ
s : Set E
⊢ closure (thickening δ s) = cthickening δ s
[PROOFSTEP]
rw [← cthickening_zero, cthickening_thickening le_rfl hδ, zero_add]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ✝ ε δ : ℝ
s : Set E
x : E
⊢ infEdist x (cthickening δ s) = infEdist x s - ENNReal.ofReal δ
[PROOFSTEP]
obtain hδ | hδ := le_or_lt δ 0
[GOAL]
case inl
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ✝ ε δ : ℝ
s : Set E
x : E
hδ : δ ≤ 0
⊢ infEdist x (cthickening δ s) = infEdist x s - ENNReal.ofReal δ
[PROOFSTEP]
rw [cthickening_of_nonpos hδ, infEdist_closure, ofReal_of_nonpos hδ, tsub_zero]
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ✝ ε δ : ℝ
s : Set E
x : E
hδ : 0 < δ
⊢ infEdist x (cthickening δ s) = infEdist x s - ENNReal.ofReal δ
[PROOFSTEP]
rw [← closure_thickening hδ, infEdist_closure, infEdist_thickening hδ]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 ≤ δ
s : Set E
⊢ thickening ε (cthickening δ s) = thickening (ε + δ) s
[PROOFSTEP]
obtain rfl | hδ := hδ.eq_or_lt
[GOAL]
case inl
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
ε : ℝ
hε : 0 < ε
s : Set E
hδ : 0 ≤ 0
⊢ thickening ε (cthickening 0 s) = thickening (ε + 0) s
[PROOFSTEP]
rw [cthickening_zero, thickening_closure, add_zero]
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hε : 0 < ε
hδ✝ : 0 ≤ δ
s : Set E
hδ : 0 < δ
⊢ thickening ε (cthickening δ s) = thickening (ε + δ) s
[PROOFSTEP]
rw [← closure_thickening hδ, thickening_closure, thickening_thickening hε hδ]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 ≤ ε
hδ : 0 ≤ δ
s : Set E
x : E
⊢ x ∈ cthickening (ε + δ) s → x ∈ cthickening ε (cthickening δ s)
[PROOFSTEP]
simp_rw [mem_cthickening_iff, ENNReal.ofReal_add hε hδ, infEdist_cthickening]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 ≤ ε
hδ : 0 ≤ δ
s : Set E
x : E
⊢ infEdist x s ≤ ENNReal.ofReal ε + ENNReal.ofReal δ → infEdist x s - ENNReal.ofReal δ ≤ ENNReal.ofReal ε
[PROOFSTEP]
exact tsub_le_iff_right.2
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 < δ
x : E
⊢ thickening ε (Metric.ball x δ) = Metric.ball x (ε + δ)
[PROOFSTEP]
rw [← thickening_singleton, thickening_thickening hε hδ, thickening_singleton]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 ≤ δ
x : E
⊢ thickening ε (Metric.closedBall x δ) = Metric.ball x (ε + δ)
[PROOFSTEP]
rw [← cthickening_singleton _ hδ, thickening_cthickening hε hδ, thickening_singleton]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 ≤ ε
hδ : 0 < δ
x : E
⊢ cthickening ε (Metric.ball x δ) = Metric.closedBall x (ε + δ)
[PROOFSTEP]
rw [← thickening_singleton, cthickening_thickening hε hδ, cthickening_singleton _ (add_nonneg hε hδ.le)]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x✝ y z : E
δ ε : ℝ
hε : 0 ≤ ε
hδ : 0 ≤ δ
x : E
⊢ cthickening ε (Metric.closedBall x δ) = Metric.closedBall x (ε + δ)
[PROOFSTEP]
rw [← cthickening_singleton _ hδ, cthickening_cthickening hε hδ, cthickening_singleton _ (add_nonneg hε hδ)]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 < δ
a b : E
⊢ Metric.ball a ε + Metric.ball b δ = Metric.ball (a + b) (ε + δ)
[PROOFSTEP]
rw [ball_add, thickening_ball hε hδ b, Metric.vadd_ball, vadd_eq_add]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 < δ
a b : E
⊢ Metric.ball a ε - Metric.ball b δ = Metric.ball (a - b) (ε + δ)
[PROOFSTEP]
simp_rw [sub_eq_add_neg, neg_ball, ball_add_ball hε hδ]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 ≤ δ
a b : E
⊢ Metric.ball a ε + Metric.closedBall b δ = Metric.ball (a + b) (ε + δ)
[PROOFSTEP]
rw [ball_add, thickening_closedBall hε hδ b, Metric.vadd_ball, vadd_eq_add]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hε : 0 < ε
hδ : 0 ≤ δ
a b : E
⊢ Metric.ball a ε - Metric.closedBall b δ = Metric.ball (a - b) (ε + δ)
[PROOFSTEP]
simp_rw [sub_eq_add_neg, neg_closedBall, ball_add_closedBall hε hδ]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hε : 0 ≤ ε
hδ : 0 < δ
a b : E
⊢ Metric.closedBall a ε + Metric.ball b δ = Metric.ball (a + b) (ε + δ)
[PROOFSTEP]
rw [add_comm, ball_add_closedBall hδ hε b, add_comm, add_comm δ]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : SeminormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
hε : 0 ≤ ε
hδ : 0 < δ
a b : E
⊢ Metric.closedBall a ε - Metric.ball b δ = Metric.ball (a - b) (ε + δ)
[PROOFSTEP]
simp_rw [sub_eq_add_neg, neg_ball, closedBall_add_ball hε hδ]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : SeminormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
inst✝ : ProperSpace E
hε : 0 ≤ ε
hδ : 0 ≤ δ
a b : E
⊢ Metric.closedBall a ε + Metric.closedBall b δ = Metric.closedBall (a + b) (ε + δ)
[PROOFSTEP]
rw [(isCompact_closedBall _ _).add_closedBall hδ b, cthickening_closedBall hδ hε a, Metric.vadd_closedBall, vadd_eq_add,
add_comm, add_comm δ]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : SeminormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
x y z : E
δ ε : ℝ
inst✝ : ProperSpace E
hε : 0 ≤ ε
hδ : 0 ≤ δ
a b : E
⊢ Metric.closedBall a ε - Metric.closedBall b δ = Metric.closedBall (a - b) (ε + δ)
[PROOFSTEP]
rw [sub_eq_add_neg, neg_closedBall, closedBall_add_closedBall hε hδ, sub_eq_add_neg]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
x : E
r : ℝ
hr : 0 ≤ r
⊢ c • closedBall x r = closedBall (c • x) (‖c‖ * r)
[PROOFSTEP]
rcases eq_or_ne c 0 with (rfl | hc)
[GOAL]
case inl
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
x : E
r : ℝ
hr : 0 ≤ r
⊢ 0 • closedBall x r = closedBall (0 • x) (‖0‖ * r)
[PROOFSTEP]
simp [hr, zero_smul_set, Set.singleton_zero, ← nonempty_closedBall]
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
x : E
r : ℝ
hr : 0 ≤ r
hc : c ≠ 0
⊢ c • closedBall x r = closedBall (c • x) (‖c‖ * r)
[PROOFSTEP]
exact smul_closedBall' hc x r
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
c : 𝕜
⊢ c • closedBall 0 1 = closedBall 0 ‖c‖
[PROOFSTEP]
rw [smul_closedBall _ _ zero_le_one, smul_zero, mul_one]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
r : ℝ
hr : 0 ≤ r
⊢ r • closedBall 0 1 = closedBall 0 r
[PROOFSTEP]
rw [smul_closedUnitBall, Real.norm_of_nonneg hr]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
x : E
r : ℝ
⊢ Set.Nonempty (sphere x r) ↔ 0 ≤ r
[PROOFSTEP]
obtain ⟨y, hy⟩ := exists_ne x
[GOAL]
case intro
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
x : E
r : ℝ
y : E
hy : y ≠ x
⊢ Set.Nonempty (sphere x r) ↔ 0 ≤ r
[PROOFSTEP]
refine' ⟨fun h => nonempty_closedBall.1 (h.mono sphere_subset_closedBall), fun hr => ⟨r • ‖y - x‖⁻¹ • (y - x) + x, _⟩⟩
[GOAL]
case intro
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
x : E
r : ℝ
y : E
hy : y ≠ x
hr : 0 ≤ r
⊢ r • ‖y - x‖⁻¹ • (y - x) + x ∈ sphere x r
[PROOFSTEP]
have : ‖y - x‖ ≠ 0 := by simpa [sub_eq_zero]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
x : E
r : ℝ
y : E
hy : y ≠ x
hr : 0 ≤ r
⊢ ‖y - x‖ ≠ 0
[PROOFSTEP]
simpa [sub_eq_zero]
[GOAL]
case intro
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
x : E
r : ℝ
y : E
hy : y ≠ x
hr : 0 ≤ r
this : ‖y - x‖ ≠ 0
⊢ r • ‖y - x‖⁻¹ • (y - x) + x ∈ sphere x r
[PROOFSTEP]
simp [norm_smul, this, Real.norm_of_nonneg hr]
[GOAL]
case intro
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
x : E
r : ℝ
y : E
hy : y ≠ x
hr : 0 ≤ r
this : ‖y - x‖ ≠ 0
⊢ |r| * (‖y - x‖⁻¹ * ‖y - x‖) = r
[PROOFSTEP]
rw [inv_mul_cancel this, mul_one, abs_eq_self.mpr hr]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
c : 𝕜
x : E
r : ℝ
hr : 0 ≤ r
⊢ c • sphere x r = sphere (c • x) (‖c‖ * r)
[PROOFSTEP]
rcases eq_or_ne c 0 with (rfl | hc)
[GOAL]
case inl
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
x : E
r : ℝ
hr : 0 ≤ r
⊢ 0 • sphere x r = sphere (0 • x) (‖0‖ * r)
[PROOFSTEP]
simp [zero_smul_set, Set.singleton_zero, hr]
[GOAL]
case inr
𝕜 : Type u_1
E : Type u_2
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : Nontrivial E
c : 𝕜
x : E
r : ℝ
hr : 0 ≤ r
hc : c ≠ 0
⊢ c • sphere x r = sphere (c • x) (‖c‖ * r)
[PROOFSTEP]
exact smul_sphere' hc x r
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
r : ℝ
hr : 0 < r
x : E
⊢ x +ᵥ r • ball 0 1 = ball x r
[PROOFSTEP]
rw [smul_unitBall_of_pos hr, vadd_ball_zero]
[GOAL]
𝕜 : Type u_1
E : Type u_2
inst✝³ : NormedField 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace 𝕜 E
inst✝ : NormedSpace ℝ E
r : ℝ
hr : 0 ≤ r
x : E
⊢ x +ᵥ r • closedBall 0 1 = closedBall x r
[PROOFSTEP]
rw [smul_closedUnitBall, Real.norm_of_nonneg hr, vadd_closedBall_zero]
|
function [jump_list, lid_ko, data, running_mean] = getJumps(data, rate_scale)
% Return outliers in a relatively constant time series
%
% INPUT
% data data (column, eventually it can have a second column containing std)
% rate_scale 24/rate_scale => used for scaling window size (1 => daily, 24 => hourly ...)
%
% OUTPUT
%
% SYNTAX
% [jump_list, id_ko, data, running_mean] = getJumps(data, rate_scale)
%
%--- * --. --- --. .--. ... * ---------------------------------------------
% ___ ___ ___
% __ _ ___ / __| _ | __|
% / _` / _ \ (_ | _|__ \
% \__, \___/\___|_| |___/
% |___/ v 1.0RC1
%
%--------------------------------------------------------------------------
% Copyright (C) 2021 Geomatics Research & Development srl (GReD)
% Written by: Andrea Gatti
% Contributors: Andrea Gatti
% A list of all the historical goGPS contributors is in CREDITS.nfo
%--------------------------------------------------------------------------
%
% 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/>.
%
%--------------------------------------------------------------------------
% 01100111 01101111 01000111 01010000 01010011
%--------------------------------------------------------------------------
flag_smooth = true; % Apply a spline smoothing to rate (duration 3 days)
spline_base = 7; % in days
if size(data,2) == 2
data_std = data(:,2);
data = data(:,1);
else
data_std = 0;
end
med_data = median(data, 'omitnan');
data = data - med_data;
% Compute thresholds - empirical but it works (outliers should be less than 75% percent)
thr_perc = 0.75;
tmp = diff(data);
tmp(abs(tmp) > 3 * perc(noNaN(abs(tmp)), thr_perc)) = nan;
thr = std(tmp, 'omitnan');
clear tmp;
% Outlier detection
if any(data_std)
[lid_ko, data] = getOutliers([data data_std], thr);
else
[lid_ko, data] = getOutliers(data, thr);
end
flag_running = true;
% Initialization
% Jump parameters
run_win = 5 * rate_scale; % window size for running mean
cumsum_thr = 2; % above this threshold, cumulate residuals
cum_thr = 6; % above this threshold the cumulate TRIGGERS A JUMP
% Recompute a running_threshold
% when the noise is higher the discrimination of jumps is lower
thr = movstd(diff(data), run_win, 'omitnan');
if not(any(thr))
thr(:) = nan2zero(std(data, 'omitnan'));
end
q_win = floor(run_win / 2);
thr((q_win + 1) : end - q_win) = min(thr((2*q_win +1):end), thr(1:end - (2*q_win)));
mthr = median(thr, 'omitnan');
thr(isnan(zero2nan(thr))) = mthr;
run_win_variable = round(max(1,sqrt((thr - mthr)/mthr)) * run_win);
run_win_variable = [run_win_variable; run_win_variable(end)];
%thr = mthr + 0.1 * (thr - mthr);
mu = data(1); % initial mean
i = 1 + find(not(isnan(data(2:end))), 1, 'first'); % running index on observations
[s_plus, s_minus] = deal(zeros(size(data,1),1)); % sensors
[n_plus, n_minus] = deal(uint16(zeros(size(data,1),1))); % epochs since sensor cumulation started
running_mean = data; % running mean
j = 1; % running index on jumps
jump_list = 0; % list of jumps
while i <= length(data)
% if jumps are not detected
if isnan(data(i))
s_plus(i) = s_plus(i-1); % keep the old sensor
s_minus(i) = s_minus(i-1); % keep the old sensor
n_plus(i) = iif(s_plus(i) > 0, n_plus(i-1) + 1, 0);
n_minus(i) = iif(s_minus(i) < 0, n_minus(i-1) + 1, 0);
running_mean(i) = mu;
i = i + 1;
else
% while no jumps are detected and i is running on observations
while i <= length(data) && s_plus(i-1) <= (cum_thr * thr(i-1)) && s_minus(i-1) >= -(cum_thr * thr(i-1))
val = iif(abs(data(i) - mu) > 0.9*(cum_thr * thr(i-1)), mu, data(i));
s_plus(i) = max(0, s_plus(i-1) + (data(i) - mu) - (cumsum_thr * thr(i-1)));
s_minus(i) = min(0, s_minus(i-1) + (data(i) - mu) + (cumsum_thr * thr(i-1)));
n_plus(i) = iif(s_plus(i) > 0 , n_plus(i-1) + 1, 0);
n_minus(i) = iif(s_minus(i) < 0 , n_minus(i-1) + 1, 0);
if flag_running
mu = nan2zero(mean(data(max(jump_list(j)+1, i + 1 - run_win_variable(i)):i), 'omitnan'));
end
running_mean(i) = mu;
i = i + 1;
end
if i <= length(data)
n_d = i - 1;
j = j + 1;
jump_list(j) = iif(s_plus(n_d) > (cum_thr * thr(i-1)), n_d - n_plus(n_d), n_d - n_minus(i-1));
mu = nan2zero(mean(data(max(jump_list(j)+1, n_d - run_win_variable(n_d)):(n_d)), 'omitnan'));
jmp_magnitude = running_mean(jump_list(j)) - mu;
Core.getLogger.addMessage(sprintf('Jump detected at epoch %d, it happened in epoch %d, length: %d, old mean %f.2, new mean %f.2, for a jump of %.2f\n', n_d, jump_list(j), n_d - jump_list(j) + 1, running_mean(jump_list(j)), mu, jmp_magnitude),100);
if (i <= length(data))
[s_plus(i-1), s_minus(i-1)] = deal(0);
[n_plus(i-1), n_minus(i-1)] = deal(0);
end
end
end
mu = nan2zero(mean(data(max(jump_list(j)+1, i - run_win_variable(i-1)):(i-1)), 'omitnan'));
running_mean(i-1) = mu;
end
% compute running mean backwords
if flag_running
running_smooth = running_mean;
robustness_perc = 0.90;
n_sigma = 6;
% flag small jumps (1-2 epochs are too small to be considered "real jumps"
for j = fliplr(find(diff(jump_list) < 3))
id_ko = jump_list(j)+1:jump_list(j+1);
data(id_ko) = nan;
lid_ko(id_ko) = true;
jump_list(j) = jump_list(j+1);
jump_list(j+1) = [];
end
last_win_id = jump_list(j)+1 : size(data,1); % last window
% Compute a trend "robust" using the robustness_perc of data
%step_median(last_win_id) = median(data(last_win_id), 'omitnan');
[tmp, trend] = strongDeTrend(data(last_win_id), robustness_perc, 1-((1-robustness_perc)/2), n_sigma);
if flag_smooth && sum(not(isnan((data(last_win_id))))) > 5
if any(trend); running_mean(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
try
[~, ~, ~, running_smooth(last_win_id)] = splinerMat(1:numel(last_win_id), data(last_win_id), ceil(spline_base * rate_scale), 1e-5, 1:numel(last_win_id)); % medium splines
catch
if any(trend); running_smooth(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
end
else
if any(trend); running_smooth(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
end
for j = 2 : numel(jump_list)
last_win_id = jump_list(j-1)+1 : (jump_list(j));
%step_median(last_win_id) = median(data(last_win_id), 'omitnan');
[tmp, trend] = strongDeTrend(data(last_win_id), robustness_perc, 1-((1-robustness_perc)/2), n_sigma);
if flag_smooth && sum(not(isnan((data(last_win_id))))) > 5
if any(trend); running_mean(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
try
[~, ~, ~, running_smooth(last_win_id)] = splinerMat(1:numel(last_win_id), data(last_win_id), ceil(spline_base * rate_scale), 1e-5, 1:numel(last_win_id)); % medium splines
catch
if any(trend); running_smooth(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
end
else
if any(trend); running_smooth(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
end
end
% remove very small jumps - recursive
flag_rem_jmp = true;
while flag_rem_jmp
% Check the magnitude of the jump, with both moving mean and splines, if it is too small is a false alarm
jmp_magnitude = min(diff(running_mean(jump_list(2:end) + repmat([0 1]', 1, numel(jump_list)-1))), ...
diff(running_smooth(jump_list(2:end) + repmat([0 1]', 1, numel(jump_list)-1))));
% Jump smaller than half the noise in that window of data will be ignored
id_small_jmp = abs(jmp_magnitude)' < max(0.4,(thr(jump_list(2:end))));
if any(id_small_jmp)
jump_list(find(id_small_jmp) + 1) = []; % remove jmp
% recompute running mean
last_win_id = jump_list(end)+1 : size(data,1);
%step_median(last_win_id) = median(data(last_win_id), 'omitnan');
% remove the trend before computing the running mean (this help in case of very steep intervals of data)
[tmp, trend] = strongDeTrend(data(last_win_id), robustness_perc, 1-((1-robustness_perc)/2), n_sigma);
if flag_smooth && sum(not(isnan((data(last_win_id))))) > 5
if any(trend); running_mean(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
try
[~, ~, ~, running_smooth(last_win_id)] = splinerMat(1:numel(last_win_id), data(last_win_id), ceil(spline_base * rate_scale), 1e-5, 1:numel(last_win_id)); % medium splines
catch
running_smooth(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend;
end
else
if any(trend); running_smooth(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
end
for j = 2 : numel(jump_list)
last_win_id = jump_list(j-1)+1 : (jump_list(j));
[tmp, trend] = strongDeTrend(data(last_win_id), robustness_perc, 1-((1-robustness_perc)/2), n_sigma);
if flag_smooth && sum(not(isnan((data(last_win_id))))) > 5
if any(trend); running_mean(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
try
[~, ~, ~, running_smooth(last_win_id)] = splinerMat(1:numel(last_win_id), data(last_win_id), ceil(spline_base * rate_scale), 1e-5, 1:numel(last_win_id)); % medium splines
catch
if any(trend); running_smooth(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
end
else
if any(trend); running_smooth(last_win_id) = movmean(tmp, run_win, 'omitnan') + trend; end
end
end
else
flag_rem_jmp = false;
end
end
running_mean = running_smooth;
else
last_win_id = jump_list(j)+1 : size(data,1);
running_mean(last_win_id) = mean(data(last_win_id), 'omitnan');
end
running_mean = running_mean + med_data;
data = data + med_data;
% figure; plot(-s_minus); hold on; plot(s_plus); hold on; plot(cum_thr * thr)
end
|
(*
Title: Galois Connections
Author: Georg Struth
Maintainer: Georg Struth <[email protected]>
*)
section \<open>Galois Connections\<close>
theory Galois_Connections
imports Order_Lattice_Props
begin
subsection \<open>Definitions and Basic Properties\<close>
text \<open>The approach follows the Compendium of Continuous Lattices~\<^cite>\<open>"GierzHKLMS80"\<close>, without attempting completeness.
First, left and right adjoints of a Galois connection are defined.\<close>
definition adj :: "('a::ord \<Rightarrow> 'b::ord) \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> bool" (infixl "\<stileturn>" 70) where
"(f \<stileturn> g) = (\<forall>x y. (f x \<le> y) = (x \<le> g y))"
definition "ladj (g::'a::Inf \<Rightarrow> 'b::ord) = (\<lambda>x. \<Sqinter>{y. x \<le> g y})"
definition "radj (f::'a::Sup \<Rightarrow> 'b::ord) = (\<lambda>y. \<Squnion>{x. f x \<le> y})"
lemma ladj_radj_dual:
fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::ord_with_dual"
shows "ladj f x = \<partial> (radj (\<partial>\<^sub>F f) (\<partial> x))"
proof-
have "ladj f x = \<partial> (\<Squnion>(\<partial> ` {y. \<partial> (f y) \<le> \<partial> x}))"
unfolding ladj_def by (metis (no_types, lifting) Collect_cong Inf_dual_var dual_dual_ord dual_iff)
also have "... = \<partial> (\<Squnion>{\<partial> y|y. \<partial> (f y) \<le> \<partial> x})"
by (simp add: setcompr_eq_image)
ultimately show ?thesis
unfolding ladj_def radj_def map_dual_def comp_def
by (smt Collect_cong invol_dual_var)
qed
lemma radj_ladj_dual:
fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::ord_with_dual"
shows "radj f x = \<partial> (ladj (\<partial>\<^sub>F f) (\<partial> x))"
by (metis fun_dual5 invol_dual_var ladj_radj_dual map_dual_def)
lemma ladj_prop:
fixes g :: "'b::Inf \<Rightarrow> 'a::ord_with_dual"
shows "ladj g = Inf \<circ> (-`) g \<circ> \<up>"
unfolding ladj_def vimage_def upset_prop fun_eq_iff comp_def by simp
lemma radj_prop:
fixes f :: "'b::Sup \<Rightarrow> 'a::ord"
shows "radj f = Sup \<circ> (-`) f \<circ> \<down>"
unfolding radj_def vimage_def downset_prop fun_eq_iff comp_def by simp
text \<open>The first set of properties holds without any sort assumptions.\<close>
lemma adj_iso1: "f \<stileturn> g \<Longrightarrow> mono f"
unfolding adj_def mono_def by (meson dual_order.refl dual_order.trans)
lemma adj_iso2: "f \<stileturn> g \<Longrightarrow> mono g"
unfolding adj_def mono_def by (meson dual_order.refl dual_order.trans)
lemma adj_comp: "f \<stileturn> g \<Longrightarrow> adj h k \<Longrightarrow> (f \<circ> h) \<stileturn> (k \<circ> g)"
by (simp add: adj_def)
lemma adj_dual:
fixes f :: "'a::ord_with_dual \<Rightarrow> 'b::ord_with_dual"
shows "f \<stileturn> g = (\<partial>\<^sub>F g) \<stileturn> (\<partial>\<^sub>F f)"
unfolding adj_def map_dual_def comp_def by (metis (mono_tags, opaque_lifting) dual_dual_ord invol_dual_var)
subsection \<open>Properties for (Pre)Orders\<close>
text \<open>The next set of properties holds in preorders or orders.\<close>
lemma adj_cancel1:
fixes f :: "'a::preorder \<Rightarrow> 'b::ord"
shows "f \<stileturn> g \<Longrightarrow> f \<circ> g \<le> id"
by (simp add: adj_def le_funI)
lemma adj_cancel2:
fixes f :: "'a::ord \<Rightarrow> 'b::preorder"
shows "f \<stileturn> g \<Longrightarrow> id \<le> g \<circ> f"
by (simp add: adj_def eq_iff le_funI)
lemma adj_prop:
fixes f :: "'a::preorder \<Rightarrow>'a"
shows "f \<stileturn> g \<Longrightarrow> f \<circ> g \<le> g \<circ> f"
using adj_cancel1 adj_cancel2 order_trans by blast
lemma adj_cancel_eq1:
fixes f :: "'a::preorder \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> f \<circ> g \<circ> f = f"
unfolding adj_def comp_def fun_eq_iff by (meson eq_iff order_refl order_trans)
lemma adj_cancel_eq2:
fixes f :: "'a::order \<Rightarrow> 'b::preorder"
shows "f \<stileturn> g \<Longrightarrow> g \<circ> f \<circ> g = g"
unfolding adj_def comp_def fun_eq_iff by (meson eq_iff order_refl order_trans)
lemma adj_idem1:
fixes f :: "'a::preorder \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> (f \<circ> g) \<circ> (f \<circ> g) = f \<circ> g"
by (simp add: adj_cancel_eq1 rewriteL_comp_comp)
lemma adj_idem2:
fixes f :: "'a::order \<Rightarrow> 'b::preorder"
shows "f \<stileturn> g \<Longrightarrow> (g \<circ> f) \<circ> (g \<circ> f) = g \<circ> f"
by (simp add: adj_cancel_eq2 rewriteL_comp_comp)
lemma adj_iso3:
fixes f :: "'a::order \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> mono (f \<circ> g)"
by (simp add: adj_iso1 adj_iso2 monoD monoI)
lemma adj_iso4:
fixes f :: "'a::order \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> mono (g \<circ> f)"
by (simp add: adj_iso1 adj_iso2 monoD monoI)
lemma adj_canc1:
fixes f :: "'a::order \<Rightarrow> 'b::ord"
shows "f \<stileturn> g \<Longrightarrow> ((f \<circ> g) x = (f \<circ> g) y \<longrightarrow> g x = g y)"
unfolding adj_def comp_def by (metis eq_iff)
lemma adj_canc2:
fixes f :: "'a::ord \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> ((g \<circ> f) x = (g \<circ> f) y \<longrightarrow> f x = f y)"
unfolding adj_def comp_def by (metis eq_iff)
lemma adj_sur_inv:
fixes f :: "'a::preorder \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> ((surj f) = (f \<circ> g = id))"
unfolding adj_def surj_def comp_def by (metis eq_id_iff eq_iff order_refl order_trans)
lemma adj_surj_inj:
fixes f :: "'a::order \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> ((surj f) = (inj g))"
unfolding adj_def inj_def surj_def by (metis eq_iff order_trans)
lemma adj_inj_inv:
fixes f :: "'a::preorder \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> ((inj f) = (g \<circ> f = id))"
by (metis adj_cancel_eq1 eq_id_iff inj_def o_apply)
lemma adj_inj_surj:
fixes f :: "'a::order \<Rightarrow> 'b::order"
shows "f \<stileturn> g \<Longrightarrow> ((inj f) = (surj g))"
unfolding adj_def inj_def surj_def by (metis eq_iff order_trans)
lemma surj_id_the_inv: "surj f \<Longrightarrow> g \<circ> f = id \<Longrightarrow> g = the_inv f"
by (metis comp_apply id_apply inj_on_id inj_on_imageI2 surj_fun_eq the_inv_f_f)
lemma inj_id_the_inv: "inj f \<Longrightarrow> f \<circ> g = id \<Longrightarrow> f = the_inv g"
proof -
assume a1: "inj f"
assume "f \<circ> g = id"
hence "\<forall>x. the_inv g x = f x"
using a1 by (metis (no_types) comp_apply eq_id_iff inj_on_id inj_on_imageI2 the_inv_f_f)
thus ?thesis
by presburger
qed
subsection \<open>Properties for Complete Lattices\<close>
text \<open>The next laws state that a function between complete lattices preserves infs
if and only if it has a lower adjoint.\<close>
lemma radj_Inf_pres:
fixes g :: "'b::complete_lattice \<Rightarrow> 'a::complete_lattice"
shows "(\<exists>f. f \<stileturn> g) \<Longrightarrow> Inf_pres g"
apply (rule antisym, simp_all add: le_fun_def adj_def, safe)
apply (meson INF_greatest Inf_lower dual_order.refl dual_order.trans)
by (meson Inf_greatest dual_order.refl le_INF_iff)
lemma ladj_Sup_pres:
fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual"
shows "(\<exists>g. f \<stileturn> g) \<Longrightarrow> Sup_pres f"
using Sup_pres_map_dual_var adj_dual radj_Inf_pres by blast
lemma radj_adj:
fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
shows "f \<stileturn> g \<Longrightarrow> g = (radj f)"
unfolding adj_def radj_def by (metis (mono_tags, lifting) cSup_eq_maximum eq_iff mem_Collect_eq)
lemma ladj_adj:
fixes g :: "'b::complete_lattice_with_dual \<Rightarrow> 'a::complete_lattice_with_dual"
shows "f \<stileturn> g \<Longrightarrow> f = (ladj g)"
unfolding adj_def ladj_def by (metis (no_types, lifting) cInf_eq_minimum eq_iff mem_Collect_eq)
lemma Inf_pres_radj_aux:
fixes g :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
shows "Inf_pres g \<Longrightarrow> (ladj g) \<stileturn> g"
proof-
assume a: "Inf_pres g"
{fix x y
assume b: "ladj g x \<le> y"
hence "g (ladj g x) \<le> g y"
by (simp add: Inf_subdistl_iso a monoD)
hence "\<Sqinter>{g y |y. x \<le> g y} \<le> g y"
by (metis a comp_eq_dest_lhs setcompr_eq_image ladj_def)
hence "x \<le> g y"
using dual_order.trans le_Inf_iff by blast
hence "ladj g x \<le> y \<longrightarrow> x \<le> g y"
by simp}
thus ?thesis
unfolding adj_def ladj_def by (meson CollectI Inf_lower)
qed
lemma Sup_pres_ladj_aux:
fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual"
shows "Sup_pres f \<Longrightarrow> f \<stileturn> (radj f)"
by (metis (no_types, opaque_lifting) Inf_pres_radj_aux Sup_pres_map_dual_var adj_dual fun_dual5 map_dual_def radj_adj)
lemma Inf_pres_radj:
fixes g :: "'b::complete_lattice \<Rightarrow> 'a::complete_lattice"
shows "Inf_pres g \<Longrightarrow> (\<exists>f. f \<stileturn> g)"
using Inf_pres_radj_aux by fastforce
lemma Sup_pres_ladj:
fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual"
shows "Sup_pres f \<Longrightarrow> (\<exists>g. f \<stileturn> g)"
using Sup_pres_ladj_aux by fastforce
lemma Inf_pres_upper_adj_eq:
fixes g :: "'b::complete_lattice \<Rightarrow> 'a::complete_lattice"
shows "(Inf_pres g) = (\<exists>f. f \<stileturn> g)"
using radj_Inf_pres Inf_pres_radj by blast
lemma Sup_pres_ladj_eq:
fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual"
shows "(Sup_pres f) = (\<exists>g. f \<stileturn> g)"
using Sup_pres_ladj ladj_Sup_pres by blast
lemma Sup_downset_adj: "(Sup::'a::complete_lattice set \<Rightarrow> 'a) \<stileturn> \<down>"
unfolding adj_def downset_prop Sup_le_iff by force
lemma Sup_downset_adj_var: "(Sup (X::'a::complete_lattice set) \<le> y) = (X \<subseteq> \<down>y)"
using Sup_downset_adj adj_def by auto
text \<open>Once again many statements arise by duality, which Isabelle usually picks up.\<close>
end
|
# Manual definition of Feynman-Kac models
It is not particularly difficult to define manually your own `FeynmanKac` classes. Consider the following problem: we would like to approximate the probability that $X_t \in [a,b]$ for all $0\leq t < T$, where $(X_t)$ is a random walk: $X_0\sim N(0,1)$, and
$$ X_t | X_{t-1} = x_{t-1} \sim N(x_{t-1}, 1).$$
This probability, at time $t$, equals $L_t$, the normalising constant of the following Feynman-Kac sequence of distributions:
\begin{equation}
\mathbb{Q}_t(dx_{0:t}) = \frac{1}{L_t} M_0(dx_0)\prod_{s=1}^t M_s(x_{s-1},dx_s)
\prod_{s=0}^t G_s(x_{s-1}, x_s)
\end{equation}
where:
* $M_0(dx_0)$ is the $N(0,1)$ distribution;
* $M_s(x_{s-1},dx_s)$ is the $N(x_{s-1}, 1)$ distribution;
* $G_s(x_{s-1}, x_s)= \mathbb{1}_{[0,\epsilon]}(x_s)$
Let's define the corresponding `FeymanKac` object:
```python
%matplotlib inline
import warnings; warnings.simplefilter('ignore') # hide warnings
from matplotlib import pyplot as plt
import seaborn as sb
import numpy as np
from scipy import stats
import particles
class GaussianProb(particles.FeynmanKac):
def __init__(self, a=0., b=1., T=10):
self.a, self.b, self.T = a, b, T
def M0(self, N):
return stats.norm.rvs(size=N)
def M(self, t, xp):
return stats.norm.rvs(loc=xp, size=xp.shape)
def logG(self, t, xp, x):
return np.where((x < self.b) & (x > self.a), 0., -np.inf)
```
The class above defines:
* the initial distribution, $M_0(dx_0)$ and the kernels $M_t(x_{t-1}, dx_t)$, through methods `M0(self, N)` and `M(self, t, xp)`. In fact, these methods simulate $N$ random variables from the corresponding distributions.
* Function `logG(self, t, xp, x)` returns the log of function $G_t(x_{t-1}, x_t)$.
Methods `M0` and `M` also define implicitly how the $N$ particles should be represented internally: as a (N,) numpy array. Indeed, at time $0$, method `M0` generates a (N,) numpy array, and at times $t\geq 1$, method `M` takes as an input (`xp`) and returns as an output arrays of shape (N,). We could use another type of object to represent our $N$ particles; for instance, the `smc_samplers` module defines a `ThetaParticles` class for storing $N$ particles representing $N$ parameter values (and associated information).
Now let's run the corresponding SMC algorithm:
```python
fk_gp = GaussianProb(a=0., b=1., T=30)
alg = particles.SMC(fk=fk_gp, N=100)
alg.run()
plt.style.use('ggplot')
plt.plot(alg.summaries.logLts)
plt.xlabel('t')
plt.ylabel(r'log-probability');
```
That was not so hard. However our implementation suffers from several limitations:
1. The SMC sampler we ran may be quite inefficient when interval $[a,b]$ is small; in that case many particles should get a zero weight at each iteration.
2. We cannot currently run the SQMC algorithm (the quasi Monte Carlo version of SMC); to do so, we need to specify the Markov kernels $M_t$ in a different way: not as simulators, but as deterministic functions that take as inputs uniform variates (see below).
Let's address the second point:
```python
class GaussianProb(particles.FeynmanKac):
du = 1 # dimension of uniform variates
def __init__(self, a=0., b=1., T=10):
self.a, self.b, self.T = a, b, T
def M0(self, N):
return stats.norm.rvs(size=N)
def M(self, t, xp):
return stats.norm.rvs(loc=xp, size=xp.shape)
def Gamma0(self, u):
return stats.norm.ppf(u)
def Gamma(self, t, xp, u):
return stats.norm.ppf(u, loc=xp)
def logG(self, t, xp, x):
return np.where((x < self.b) & (x > self.a), 0., -np.inf)
fk_gp = GaussianProb(a=0., b=1., T=30)
```
We have added:
* methods `Gamma0` and `Gamma`, which define the deterministic functions $\Gamma_0$ and $\Gamma$ we mentioned above. Mathematically, for $U\sim \mathcal{U}([0,1]^{d_u})$, then $\Gamma_0(U)$ is distributed according to $M_0(dx_0)$, and $\Gamma_t(x_{t-1}, U)$ is distributed according to $M_t(x_{t-1}, dx_t)$.
* class attribute `du`, i.e. $d_u$, the dimension of the $u$-argument of functions $\Gamma_0$ and $\Gamma_t$.
We are now able to run both the SMC and the SQMC algorithms that corresponds to the Feyman-Kac model of interest; let's compare their respective performance. (Recall that function ``multiSMC`` runs several algorithms multiple times, possibly with varying parameters; here we vary parameter `qmc`, which determines whether we run SMC or SMQC.)
```python
results = particles.multiSMC(fk=fk_gp, qmc={'smc': False, 'sqmc': True}, N=100, nruns=10)
sb.boxplot(x=[r['qmc'] for r in results], y=[r['output'].logLt for r in results]);
```
We do get some variance reduction, but not so much. Let's see if we can do better by addressing point 1 above.
The considered problem has the structure of a state-space model, where process $(X_t)$ is a random walk, $Y_t = \mathbb{1}_{[a,b]}(X_t)$, and $y_t=1$ for all $t$'s. This remark leads us to define alternative Feynman-Kac models, that would correspond to *guided* and *auxiliary* formalisms of that state-space model. In particular, for the guided filter, the optimal proposal distribution, i.e. the distribution of $X_t|X_{t-1}, Y_t$, is simply a Gaussian distribution truncated to interval $[a, b]$; let's implement the corresponding Feynman-Kac class.
```python
def logprobint(a, b, x):
""" returns log probability that X_t\in[a,b] conditional on X_{t-1}=x
"""
return np.log(stats.norm.cdf(b - x) - stats.norm.cdf(a - x))
class Guided_GP(GaussianProb):
def Gamma(self, t, xp, u):
au = stats.norm.cdf(self.a - xp)
bu = stats.norm.cdf(self.b - xp)
return xp + stats.norm.ppf(au + u * (bu - au))
def Gamma0(self, u):
return self.Gamma(0, 0., u)
def M(self, t, xp):
return self.Gamma(t, xp, stats.uniform.rvs(size=xp.shape))
def M0(self, N):
return self.Gamma0(stats.uniform.rvs(size=N))
def logG(self, t, xp, x):
if t == 0:
return np.full(x.shape, logprobint(self.a, self.b, 0.))
else:
return logprobint(self.a, self.b, xp)
fk_guided = Guided_GP(a=0., b=1., T=30)
```
In this particular case, it is a bit more convenient to define methods `Gamma0` and `Gamma` first, and then define methods `M0` and `M`.
To derive the APF version, we must define the auxiliary functions (functions $\eta_t$ in Chapter 10 of the book) that modify the resampling probabilities; in practice, we define the log of these functions,
as follows:
```python
class APF_GP(Guided_GP):
def logeta(self, t, x):
return logprobint(self.a, self.b, x)
fk_apf = APF_GP(a=0., b=1., T=30)
```
Ok, now everything is set! We can do a 3x2 comparison of SMC versus SQMC, for the 3 considered Feynman-Kac models.
```python
results = particles.multiSMC(fk={'boot':fk_gp, 'guided':fk_guided, 'apf': fk_apf},
N=100, qmc={'smc': False, 'sqmc': True}, nruns=20)
sb.boxplot(x=['%s-%s'%(r['fk'], r['qmc']) for r in results], y=[r['output'].logLt for r in results]);
```
Let's discard the bootstrap algorithms to better visualise the results for the other algorithms:
```python
res_noboot = [r for r in results if r['fk']!='boot']
sb.boxplot(x=['%s-%s'%(r['fk'], r['qmc']) for r in res_noboot], y=[r['output'].logLt for r in res_noboot]);
```
Voilà!
|
# This is a test/example rd file
Display "Beautiful Picture" "Screen" "rgbobject"
Format 640 480
ObjectBegin "Pedestal"
XformPush # Pedestal Base
Scale 1 1 0.1
Translate 0 0 1
Cube
XformPop # Pedestal Base
# Column
XformPush
Translate 0 0 0.2
Scale 0.5 0.5 4
Cylinder 1.0 0.0 1.0 360.0
XformPop
XformPush # Pedestal Top
Translate 0 0 4.2
Scale 1 1 0.1
Translate 0 0 1
Cube
XformPop # Pedestal Top
ObjectEnd
ObjectBegin "Tetrahedron"
# Tetrahedron
PolySet "P"
4 # Vertices
4 # Faces
# Vertex points
1.0 1.0 1.0
1.0 -1.0 -1.0
-1.0 1.0 -1.0
-1.0 -1.0 1.0
# Face indices
3 2 1 -1
2 3 0 -1
1 0 3 -1
0 1 2 -1
ObjectEnd # Tetrahedron
ObjectBegin "Octahedron"
# Octahedron
PolySet "P"
6 # Vertices
8 # Faces
# Vertex points
1.0 0.0 0.0
-1.0 0.0 0.0
0.0 1.0 0.0
0.0 -1.0 0.0
0.0 0.0 1.0
0.0 0.0 -1.0
# Face indices
0 2 4 -1
2 0 5 -1
3 0 4 -1
0 3 5 -1
2 1 4 -1
1 2 5 -1
1 3 4 -1
3 1 5 -1
ObjectEnd # Octahedron
ObjectBegin "Icosahedron"
# Icosahedron
PolySet "P"
12 # Vertices
20 # Faces
# Vertex points
1.618034 1.0 0.0
-1.618034 1.0 0.0
1.618034 -1.0 0.0
-1.618034 -1.0 0.0
1.0 0.0 1.618034
1.0 0.0 -1.618034
-1.0 0.0 1.618034
-1.0 0.0 -1.618034
0.0 1.618034 1.0
0.0 -1.618034 1.0
0.0 1.618034 -1.0
0.0 -1.618034 -1.0
# Face indices
0 8 4 -1
0 5 10 -1
2 4 9 -1
2 11 5 -1
1 6 8 -1
1 10 7 -1
3 9 6 -1
3 7 11 -1
0 10 8 -1
1 8 10 -1
2 9 11 -1
3 11 9 -1
4 2 0 -1
5 0 2 -1
6 1 3 -1
7 3 1 -1
8 6 4 -1
9 4 6 -1
10 5 7 -1
11 7 5 -1
ObjectEnd # Icosahedron
ObjectBegin "Dodecahedron"
# Dodecahedron
PolySet "P"
20 # Vertices
12 # Faces
# Vertex points
1.0 1.0 1.0
1.0 1.0 -1.0
1.0 -1.0 1.0
1.0 -1.0 -1.0
-1.0 1.0 1.0
-1.0 1.0 -1.0
-1.0 -1.0 1.0
-1.0 -1.0 -1.0
0.618034 1.618034 0.0
-0.618034 1.618034 0.0
0.618034 -1.618034 0.0
-0.618034 -1.618034 0.0
1.618034 0.0 0.618034
1.618034 0.0 -0.618034
-1.618034 0.0 0.618034
-1.618034 0.0 -0.618034
0.0 0.618034 1.618034
0.0 -0.618034 1.618034
0.0 0.618034 -1.618034
0.0 -0.618034 -1.618034
# Face indices
1 8 0 12 13 -1
4 9 5 15 14 -1
2 10 3 13 12 -1
7 11 6 14 15 -1
2 12 0 16 17 -1
1 13 3 19 18 -1
4 14 6 17 16 -1
7 15 5 18 19 -1
4 16 0 8 9 -1
2 17 6 11 10 -1
1 18 5 9 8 -1
7 19 3 10 11 -1
ObjectEnd # Dodecahdron
FrameBegin 1
CameraEye -25.0 -30.0 20.0
CameraAt 0.0 0.0 3.0
CameraUp 0 0 1
CameraFOV 30.0
WorldBegin
# Lights
#FarLight 0 1 -1 1.0 1.0 0.9 1.0
PointLight 0 0 6 1.0 1.0 1.0 100
# Visual representation of light
Surface "matte"
Ka 1
Kd 0
Ks 0
XformPush
Translate 0 0 6
Scale 0.3 0.3 0.3
Sphere 1.0 -1.0 1.0 360.0
XformPop
# Put a point light in the middle of each displayed object to
# get a nice glow off of the pedastal surface
PointLight 0 10 6 1.0 0.0 0.0 5.0
PointLight -7.81 6.23 6 0.0 0.0 1.0 5.0
PointLight -9.75 -2.23 6 0.0 1.0 0.0 5.0
PointLight -4.34 -9.01 6 0.5 0.3 0.0 5.0
PointLight 4.34 -9.01 6 0.7 0.0 0.8 5.0
PointLight 9.75 -2.23 6 1.0 0.7 0.7 5.0
PointLight 7.81 6.23 6 1.0 1.0 0.0 5.0
XformPush # Star Pattern on Floor
Surface "matte"
Ka 1.0
Kd 0.0
Scale 8.5 8.5 1
Color 1.0 0.7 0.3
Line 0.000 1.000 0 0.975 -0.223 0
Line 0.975 -0.223 0 -0.434 -0.901 0
Line -0.434 -0.901 0 -0.782 0.623 0
Line -0.782 0.623 0 0.782 0.623 0
Line 0.782 0.623 0 0.434 -0.901 0
Line 0.434 -0.901 0 -0.975 -0.223 0
Line -0.975 -0.233 0 0.000 1.000 0
XformPop
Surface "plastic"
Ka 0.3
Kd 0.5
Ks 0.5
XformPush # Sphere 1.0 -1.0 1.0 360.0 on Pedestal
Rotate "Z" 0
Translate 0 10 0
Color 0.5 0.5 0.5
ObjectInstance "Pedestal"
Color 1.0 0.0 0.0
Translate 0 0 6
Sphere 1.0 -1.0 1.0 360.0
XformPop # Sphere 1.0 -1.0 1.0 360.0 on Pedestal
XformPush # Cube on Pedestal
Rotate "Z" 51.43
Translate 0 10 0
Color 0.5 0.5 0.5
ObjectInstance "Pedestal"
Color 0.0 0.0 1.0
Translate 0 0 6.5
Rotate "X" 35.26
Rotate "Y" 45
Cube
XformPop # Cube on Pedestal
XformPush # Cone on Pedestal
Rotate "Z" 102.86
Translate 0 10 0
Color 0.5 0.5 0.5
ObjectInstance "Pedestal"
Color 0.0 1.0 0.0
Translate 0 0 5
Scale 1 1 2
Cone 1.0 1.0 360.0
XformPop # Cone on Pedestal
XformPush # Tetrahedron on Pedestal
Rotate "Z" 154.29
Translate 0 10 0
Color 0.5 0.5 0.5
ObjectInstance "Pedestal"
Color 0.5 0.3 0.0
Translate 0 0 6
Rotate "X" -35.2644
Rotate "Y" 45
ObjectInstance "Tetrahedron"
XformPop # Tetrahedron on Pedestal
XformPush # Octahedron on Pedestal
Rotate "Z" 205.71
Translate 0 10 0
Color 0.5 0.5 0.5
ObjectInstance "Pedestal"
Color 0.7 0.0 0.8
Translate 0 0 6
Rotate "X" -35.2644
Rotate "Y" 45
ObjectInstance "Octahedron"
XformPop # Octahedron on Pedestal
XformPush # Icosahedron on Pedestal
Rotate "Z" 257.14
Translate 0 10 0
Color 0.5 0.5 0.5
ObjectInstance "Pedestal"
Color 1.0 0.7 0.7
Translate 0 0 6
Rotate "X" -20.9051
ObjectInstance "Icosahedron"
XformPop # Icosahedron on Pedestal
XformPush # Dodecahedron on Pedestal
Rotate "Z" 308.57
Translate 0 10 0
Color 0.5 0.5 0.5
ObjectInstance "Pedestal"
Color 1.0 1.0 0.0
Translate 0 0 6
Rotate "X" -58.2825
ObjectInstance "Dodecahedron"
XformPop # Dodecahedron on Pedestal
WorldEnd
FrameEnd
|
theory ARMv7A_Mem_Write_Read_Ref
imports ARMv7A_Address_Translate_Ref
begin
lemma mmu_write_rel:
"\<lbrakk>mmu_write_size (val,va, sz) s = ((), s')\<rbrakk> \<Longrightarrow> s' = s \<lparr> non_det_tlb := non_det_tlb s' , MEM:= MEM s' , exception:= exception s' \<rparr>"
apply (clarsimp simp: mmu_write_size_non_det_tlb_state_ext_def Let_def, cases "mmu_translate va s", clarsimp split: if_split_asm)
apply (drule write_mem_rel, cases "mmu_translate va s" , clarsimp)
apply (drule mmu_rel, cases s, cases s', case_tac b, clarsimp)
apply (clarsimp simp: mmu_translate_non_det_tlb_state_ext_def Let_def split: lookup_type.splits)
by (clarsimp simp: Let_def raise'exception_def split:if_split_asm)+
lemma mmu_write_sat_tlb_disj:
"\<lbrakk> mmu_write_size (val,va, sz) s = ((), s') \<rbrakk> \<Longrightarrow>
fst(non_det_tlb s') = fst(pairsub (non_det_tlb s) (tlb_evict (typ_non_det_tlb s))) \<or> fst(non_det_tlb s') = fst(pairsub (non_det_tlb s) (tlb_evict (typ_non_det_tlb s))) \<union> {the (pt_walk (ASID s) (MEM s) (TTBR0 s) va)} \<or>
fst(non_det_tlb s') = fst(pairsub (non_det_tlb s) (tlb_evict (typ_non_det_tlb s))) \<union> the ` (\<lambda>x. pde_tlb_entry x (MEM s) va) ` {x. lookup_pdc (snd (pairsub (non_det_tlb s) (tlb_evict (typ_non_det_tlb s)))) (ASID s) va = Hit x }"
apply (clarsimp simp: mmu_write_size_non_det_tlb_state_ext_def mmu_translate_non_det_tlb_state_ext_def split_def Let_def write_mem_eq_TLB raise'exception_def
split: lookup_type.splits split: if_split_asm)
apply (drule write_mem_eq_TLB state.defs)
apply (cases s , cases s' ; clarsimp)
apply (drule write_mem_eq_TLB state.defs)
apply (cases s , cases s' ; clarsimp)
apply (drule write_mem_eq_TLB state.defs)
by (cases s , cases s' ; clarsimp)
lemma mmu_write_sat_pdc_disj:
"\<lbrakk> mmu_write_size (val,va, sz) s = ((), s') \<rbrakk> \<Longrightarrow>
snd(non_det_tlb s') = snd (pairsub (non_det_tlb s) (tlb_evict (typ_non_det_tlb s))) \<or>
snd(non_det_tlb s') = snd(pairsub (non_det_tlb s) (tlb_evict (typ_non_det_tlb s))) \<union> {the (pdc_walk (ASID s) (MEM s) (TTBR0 s) va)}"
apply (clarsimp simp: mmu_write_size_non_det_tlb_state_ext_def mmu_translate_non_det_tlb_state_ext_def split_def Let_def write_mem_eq_TLB raise'exception_def
split: lookup_type.splits split: if_split_asm)
apply (drule write_mem_eq_TLB state.defs)
apply (cases s , cases s' ; clarsimp)
apply (drule write_mem_eq_TLB state.defs)
apply (cases s , cases s' ; clarsimp)
apply (drule write_mem_eq_TLB state.defs)
by (cases s , cases s' ; clarsimp)
(**************************************************************)
lemma mmu_write_saturated_state:
"\<lbrakk>mmu_write_size (val,va,sz) s = ((), t) \<rbrakk> \<Longrightarrow> saturated (typ_sat_tlb t)"
apply (clarsimp simp: mmu_write_size_sat_tlb_state_ext_def Let_def)
apply (case_tac "mmu_translate va s" , clarsimp)
apply (clarsimp split: if_split_asm)
apply (case_tac "write'mem1 (val, a, sz) b" , clarsimp)
apply (subgoal_tac "ASID s = ASID ba \<and> TTBR0 s = TTBR0 ba ")
apply (clarsimp simp: saturated_def)
apply (subgoal_tac "ASID s = ASID b \<and> TTBR0 s = TTBR0 b")
apply clarsimp
apply (clarsimp simp: write'mem1_def Let_def)
apply (clarsimp split: if_split_asm)
apply (clarsimp simp: raise'exception_def)
apply (clarsimp simp: mmu_translate_sat_tlb_state_ext_def Let_def raise'exception_def split:lookup_type.splits if_split_asm)
using mmu_translate_saturated_state surjective_pairing by blast
lemma mmu_wrtie_sat_rel:
"\<lbrakk>mmu_write_size (val,va, sz) s = ((), s')\<rbrakk> \<Longrightarrow>
s' = s \<lparr> sat_tlb := sat_tlb s' , MEM:= MEM s' , exception:= exception s' \<rparr>"
apply (clarsimp simp: mmu_write_size_sat_tlb_state_ext_def Let_def)
apply (cases "mmu_translate va s" , clarsimp)
apply (clarsimp split: if_split_asm)
apply (case_tac " write'mem1 (val, a, sz) b", clarsimp)
apply (drule write_mem_rel)
apply (drule mmu_sat_rel)
apply (cases s, cases s', case_tac a, case_tac b, case_tac ba)
apply clarsimp
apply (clarsimp simp: mmu_translate_sat_tlb_state_ext_def Let_def split: lookup_type.splits)
apply (clarsimp simp: raise'exception_def split:if_split_asm)
by (clarsimp simp: raise'exception_def split:if_split_asm)
lemma mmu_write_tlb_subset:
"\<lbrakk> mmu_write_size (val,va, sz) s = ((), s'); tlb_rel_sat (typ_non_det_tlb s) (typ_sat_tlb t) ; consistent (typ_sat_tlb t) va ;
mmu_write_size (val,va, sz) t = ((), t') \<rbrakk> \<Longrightarrow>
fst (non_det_tlb s') \<subseteq> fst(sat_tlb t') \<and> snd (non_det_tlb s') \<subseteq> snd (sat_tlb t')"
apply (frule tlb_rel_satD)
apply (clarsimp simp: mmu_write_size_non_det_tlb_state_ext_def , cases "mmu_translate va s" , clarsimp)
apply (clarsimp simp: mmu_write_size_sat_tlb_state_ext_def , cases "mmu_translate va t" , clarsimp)
apply (frule_tac t' = ba and s' = b and t = t and s = s and pa' = aa in mmu_translate_non_det_sat_subset_rel; simp?)
apply (subgoal_tac "non_det_tlb b = non_det_tlb s'", clarsimp split: if_split_asm)
apply (case_tac "write'mem1 (val, aa, sz) ba", clarsimp simp:)
apply (subgoal_tac "state.more bb = state.more ba")
apply force
apply (drule write_mem_eq_TLB)
apply (drule write_mem_eq_TLB)
apply (clarsimp simp: typ_sat_tlb_def)
apply (case_tac "write'mem1 (val, aa, sz) ba", simp)
apply (subgoal_tac "state.more ba = state.more b")
apply force
apply (drule write_mem_eq_TLB)
apply (clarsimp simp: typ_sat_tlb_def)
apply (clarsimp split: if_split_asm)
apply (drule write_mem_eq_TLB)
apply (cases s' , case_tac b, clarsimp simp:)
apply (drule write_mem_eq_TLB)
by (cases s' , case_tac b, clarsimp simp:)
lemma mmu_write_non_det_sat_mem:
"\<lbrakk> mmu_write_size (val,va, sz) s = ((), s'); tlb_rel_sat (typ_non_det_tlb s) (typ_sat_tlb t) ; consistent (typ_sat_tlb t) va;
mmu_write_size (val,va, sz) t = ((), t') \<rbrakk> \<Longrightarrow> MEM s' = MEM t'"
apply (frule tlb_rel_satD)
apply (clarsimp simp: mmu_write_size_non_det_tlb_state_ext_def , cases "mmu_translate va s" , clarsimp)
apply (clarsimp simp: mmu_write_size_sat_tlb_state_ext_def , cases "mmu_translate va t" , clarsimp)
apply (subgoal_tac "MEM ba = MEM b \<and> exception ba = exception b")
prefer 2
apply (frule_tac t = t and t' = ba in mmu_translate_non_det_sat_mem_excp; simp)
apply (subgoal_tac "a = aa")
prefer 2
apply (frule mmu_translate_non_det_sat_pa; simp)
apply simp
apply (clarsimp split: if_split_asm)
apply (case_tac "write'mem1 (val, aa, sz) ba", simp)
apply (frule_tac t = ba and t' = bb in write_same_mem, simp, simp)
by (case_tac bb, cases t', simp)
lemma mmu_write_size_non_det_sat_state_trunc:
"\<lbrakk>mmu_write_size (val,va, sz) s = ((), s'); tlb_rel_sat (typ_non_det_tlb s) (typ_sat_tlb t) ; consistent (typ_sat_tlb t) va;
mmu_write_size (val,va, sz) t = ((), t')\<rbrakk> \<Longrightarrow> state.truncate t' = state.truncate s'"
apply (frule (3) mmu_write_non_det_sat_mem)
apply (frule tlb_rel_satD, clarsimp)
apply (frule mmu_write_rel)
apply (rotate_tac)
apply (frule mmu_wrtie_sat_rel)
apply (clarsimp simp: tlb_rel_sat_def)
apply (subgoal_tac "exception s' = exception t'")
apply (cases s, cases t, cases s' , cases t')
apply (clarsimp simp: state.defs)
apply (clarsimp simp: mmu_write_size_sat_tlb_state_ext_def mmu_write_size_non_det_tlb_state_ext_def Let_def)
apply (case_tac "mmu_translate va t" , case_tac "write'mem1 (val, a, sz) b" , clarsimp)
apply (case_tac "mmu_translate va s" , clarsimp)
apply (subgoal_tac "exception b = exception bb \<and> a = aa")
apply (clarsimp split: if_split_asm)
apply (subgoal_tac "MEM b = MEM bb ")
apply (frule_tac s="bb" and s'="s'" and t = b and t' = ba in write_same_mem_excep ; clarsimp)
apply (frule_tac s="s" and s'="bb" and t = t and t' = b and p' = aa in mmu_translate_non_det_sat_mem_excp ; clarsimp simp: consistent0_def tlb_rel_sat_def)
apply (rule conjI)
apply (frule_tac s = "s" and s' = "bb" and t = "t" and t' = "b" in mmu_translate_non_det_sat_excp ; clarsimp simp: tlb_rel_sat_def)
by (frule_tac t= t and pa' = a and t' = b in mmu_translate_non_det_sat_pa ; clarsimp simp: tlb_rel_sat_def) +
lemma mmu_write_non_det_sat_refine:
"\<lbrakk> mmu_write_size (val,va, sz) s = ((), s'); tlb_rel_sat (typ_non_det_tlb s) (typ_sat_tlb t) ; consistent (typ_sat_tlb t) va;
mmu_write_size (val,va, sz) t = ((), t') \<rbrakk> \<Longrightarrow> tlb_rel_sat (typ_non_det_tlb s') (typ_sat_tlb t') "
apply (clarsimp simp: tlb_rel_sat_def)
apply (clarsimp simp: mmu_write_saturated_state)
apply (rule conjI)
prefer 2
apply (frule_tac s = s and s' = s' and t = t and t' = t' in mmu_write_tlb_subset; clarsimp simp: tlb_rel_sat_def)
by (frule_tac s="s" and s'="s'" and t="t" and t'="t'" in mmu_write_size_non_det_sat_state_trunc; clarsimp simp: tlb_rel_sat_def)
(* refinement between saturated and second abstracted model *)
lemma mmu_write_incon_set_rel:
"\<lbrakk> saturated (typ_sat_tlb s) ;
inconsistent_vaddrs (typ_sat_tlb s) \<subseteq> iset(set_tlb t) ; incoherrent_vaddrs (typ_sat_tlb s) \<subseteq> iset(set_tlb t) ; ASID s = ASID r ; TTBR0 s = TTBR0 r\<rbrakk> \<Longrightarrow>
inconsistent_vaddrs (typ_sat_tlb (r\<lparr>sat_tlb := pairunion (sat_tlb s) (the ` {e \<in> range (pt_walk (ASID r) (MEM q) (TTBR0 r)). \<not> is_fault e},
the ` {e \<in> range (pdc_walk (ASID r) (MEM q) (TTBR0 r)). \<not> is_fault e})\<rparr>))
\<subseteq> iset (set_tlb t) \<union> incon_comp (ASID r) (ASID r) (MEM s) (MEM q) (TTBR0 r) (TTBR0 r)"
apply (clarsimp)
apply (clarsimp simp: inconsistent_vaddrs_def incon_comp_def ptable_comp_def incoherrent_vaddrs_def)
apply (erule disjE)
apply (drule union_asid_tlb_incon_cases)
apply (erule disjE, clarsimp simp: asid_tlb_lookup_range_pt_walk_not_incon)
apply (erule disjE, clarsimp simp: entry_leq_def)
apply (erule disjE)
apply (subgoal_tac "is_fault (pt_walk (ASID r) (MEM s) (TTBR0 r) x)")
apply blast
apply (clarsimp simp: pt_walk_new_fault_pt_walk_fault)
apply (erule disjE)
apply (subgoal_tac "the (pt_walk (ASID r) (MEM q) (TTBR0 r) xc) = the (pt_walk (ASID r) (MEM s) (TTBR0 r) x)")
apply (case_tac "\<not> is_fault (pt_walk (ASID r) (MEM s) (TTBR0 r) x)")
using saturatd_lookup_hit_no_fault apply fastforce
apply blast
apply (subgoal_tac "the (pt_walk (ASID r) (MEM q) (TTBR0 r) xc) = the (pt_walk (ASID r) (MEM q) (TTBR0 r) x)")
apply (drule pt_walk_new_equal_pt_walk, simp add: is_fault_def)
apply (frule asid_tlb_lookup_range_fault_pt_walk)
apply (drule_tac x = x in bspec; clarsimp simp: lookup_asid_tlb_hit_entry_range)
apply (subgoal_tac "is_fault (pt_walk (ASID r) (MEM s) (TTBR0 r) x)")
apply blast
apply clarsimp
apply (simp add: pt_walk_new_par_fault_pt_walk_fault)
using asid_tlb_lookup_range_pt_walk_not_incon apply blast
apply (drule union_asid_pdc_incon_cases)
apply (erule disjE, clarsimp simp: lookup_pdc_walk_not_incon)
apply (erule disjE)
apply clarsimp
apply (simp add: entry_leq_def)
apply (erule disjE)
apply (subgoal_tac "is_fault (pdc_walk (ASID r) (MEM s) (TTBR0 r) x)")
apply blast
apply (clarsimp simp: pt_walk_new_fault_pde_walk_fault)
apply (erule disjE)
apply (subgoal_tac "the (pdc_walk (ASID r) (MEM q) (TTBR0 r) xc) = the (pdc_walk (ASID r) (MEM s) (TTBR0 r) x)")
prefer 2
apply (subgoal_tac "the (pdc_walk (ASID r) (MEM q) (TTBR0 r) xc) = the (pdc_walk (ASID r) (MEM q) (TTBR0 r) x)")
apply clarsimp
apply (drule pt_walk_new_equal_pdc_walk, simp add: is_fault_def)
apply (frule lookup_pdc_range_fault_pt_walk)
apply (drule_tac x = x in bspec; clarsimp simp: lookup_asid_pdc_hit_entry_range)
apply (case_tac "\<not> is_fault (pdc_walk (ASID r) (MEM s) (TTBR0 r) x)")
apply clarsimp
using saturatd_lookup_pdc_hit_no_fault apply fastforce
apply blast
apply (subgoal_tac "the(pdc_walk (ASID r) (MEM q) (TTBR0 r) xc) = the(pdc_walk (ASID r) (MEM s) (TTBR0 r) x)" )
apply (case_tac "is_fault (pdc_walk (ASID r) (MEM s) (TTBR0 r) x)")
apply blast
using saturatd_lookup_pdc_hit_no_fault apply fastforce
apply (subgoal_tac " the (pdc_walk (ASID r) (MEM q) (TTBR0 r) xc) = the(pdc_walk (ASID r) (MEM q) (TTBR0 r) x)")
apply clarsimp
apply (simp add: pt_walk_partial_full_pdc_walk_eq)
apply (meson lookup_asid_pdc_hit_entry_range lookup_pdc_range_fault_pt_walk
lookup_pdc_range_pt_walk_hit)
using lookup_pdc_walk_not_incon by blast
lemma mmu_write_asid_ptcomp_rel:
"\<lbrakk>saturated (typ_sat_tlb s) ; ASID t = ASID s; MEM t = MEM r; TTBR0 t = TTBR0 s ;
inconsistent_vaddrs (typ_sat_tlb s) \<subseteq> iset (set_tlb q) ; incoherrent_vaddrs (typ_sat_tlb s) \<subseteq> iset(set_tlb q)\<rbrakk> \<Longrightarrow>
incoherrent_vaddrs (typ_sat_tlb (t\<lparr>sat_tlb := pairunion (sat_tlb s) (the ` {e \<in> range (pt_walk (ASID t) (MEM r) (TTBR0 t)). \<not> is_fault e},
the ` {e \<in> range (pdc_walk (ASID t) (MEM r) (TTBR0 t)). \<not> is_fault e})\<rparr>)) \<subseteq> iset (set_tlb q) \<union> incon_comp (ASID t) (ASID t) (MEM s) (MEM r) (TTBR0 t) (TTBR0 t)"
apply rule
apply (clarsimp simp: incoherrent_vaddrs_def inconsistent_vaddrs_def )
apply (erule disjE; clarsimp)
apply (drule lookup_asid_tlb_hit_union_cases')
apply (erule disjE)
apply (clarsimp simp: incon_comp_def ptable_comp_def entry_leq_def Let_def)
apply (subgoal_tac "is_fault (pt_walk (ASID s) (MEM s) (TTBR0 s) x)")
apply blast
apply (metis (mono_tags, hide_lams) pt_walk_new_equal_pt_walk pt_walk_new_fault_pt_walk_fault pt_walk_new_par_fault_pt_walk_fault)
apply (clarsimp simp: asid_tlb_lookup_miss_is_fault_intro)
apply (drule lookup_asid_pdc_hit_union_cases')
apply (erule disjE)
apply (clarsimp simp: incon_comp_def ptable_comp_def entry_leq_def Let_def)
apply (subgoal_tac "is_fault (pdc_walk (ASID s) (MEM s) (TTBR0 s) x)")
apply blast
apply (metis (mono_tags, hide_lams) pt_walk_new_equal_pdc_walk pt_walk_new_fault_pde_walk_fault pt_walk_partial_full_pdc_walk_eq)
by (clarsimp simp: lookup_pdc_miss_is_fault_intro)
lemma mmu_write_sat_incon_refine:
"\<lbrakk> mmu_write_size (val,va, sz) s = ((), s'); mmu_write_size (val,va, sz) t = ((), t'); va \<notin> iset (set_tlb t);
tlb_rel_abs (typ_sat_tlb s) (typ_set_tlb t) \<rbrakk> \<Longrightarrow>
tlb_rel_abs (typ_sat_tlb s') (typ_set_tlb t')"
apply (frule_tac s = s in tlb_rel_abs_consistent; clarsimp )
apply (frule tlb_rel_absD, clarsimp)
apply (clarsimp simp: mmu_write_size_sat_tlb_state_ext_def mmu_write_size_set_tlb_state_ext_def)
apply (cases "mmu_translate va s", cases "mmu_translate va t", clarsimp)
apply (frule_tac t=t and pa'= aa and t' = ba in mmu_translate_sat_incon_refine; clarsimp)
apply (clarsimp simp: tlb_rel_abs_def)
apply (subgoal_tac "exception b = exception ba")
prefer 2 apply (case_tac b , case_tac ba , clarsimp simp: state.defs)
apply (clarsimp split: if_split_asm)
apply (case_tac "write'mem1 (val, aa, sz) b " , case_tac "write'mem1 (val, aa, sz) ba" , clarsimp simp: Let_def)
apply (subgoal_tac "state.truncate bb = state.truncate bc")
prefer 2
using write_mem_state_trun_equal apply blast
apply (rule conjI , clarsimp simp: state.defs)
apply (subgoal_tac "MEM bb = MEM bc \<and> MEM s = MEM b" , simp)
apply (subgoal_tac "ASID s = ASID b \<and> TTBR0 s = TTBR0 b" , simp)
apply (subgoal_tac "saturated (typ_sat_tlb b)")
prefer 2 apply blast
prefer 2 using mmu_sat_eq_asid_root_mem apply blast
prefer 2
apply (rule conjI)
apply (clarsimp simp: state.defs)
using mmu_sat_eq_asid_root_mem
apply blast
apply (subgoal_tac "ASID b = ASID bb \<and> TTBR0 b = TTBR0 bb")
apply (rule conjI)
apply (clarsimp simp: saturated_def)
apply (simp only: incon_addrs_def)
apply simp
apply (rule conjI)
apply (drule_tac s = b and t = ba and q = bc and r = bb in mmu_write_incon_set_rel; clarsimp)
apply (rule conjI)
apply (frule_tac t = bb and r = bc and q = ba and s = b in mmu_write_asid_ptcomp_rel ; clarsimp simp: )
prefer 2
apply (clarsimp simp: write'mem1_def raise'exception_def split: if_split_asm)
apply (rule conjI)
apply (clarsimp simp: global_range_def)
apply (rule conjI)
apply (simp only: global_entries_union)
apply clarsimp
apply fastforce
apply (simp only: global_entries_union_pdc)
apply clarsimp
apply (rule conjI)
apply force
using global_entr_pdc_subset_global_entries apply fastforce
apply clarsimp
apply (rule conjI)
apply (clarsimp simp: non_global_to_global [symmetric])
apply (subgoal_tac "lookup'' (non_global_entries (fst (sat_tlb b) \<union> the ` {e \<in> range (pt_walk (ASID t) (MEM bc) (TTBR0 bb)). \<not> is_fault e})) a v =
lookup'' (non_global_entries (fst (sat_tlb b))) a v")
apply force
apply (rule lookup_non_global_union_asid_unequal, simp)
apply (clarsimp simp: non_global_to_global_pdc [symmetric])
apply (subgoal_tac "lookup_pdc (non_global_entries_pdc (snd (sat_tlb b) \<union> the ` {e \<in> range (pdc_walk (ASID t) (MEM bc) (TTBR0 bb)). \<not> is_fault e})) a v =
lookup_pdc (non_global_entries_pdc (snd (sat_tlb b))) a v")
apply force
by (rule lookup_non_global_union_asid_unequal_pdc, simp)
(* refinement for read theroems *)
lemma mem_read1_consistent_tlb_rel_non_det:
" \<lbrakk>mem_read1 (a, sz) s = (val, s'); mem_read1 (a, sz) t = (val', t');
consistent0' (MEM t) (ASID t) (TTBR0 t) (fst (sat_tlb t)) (snd (sat_tlb t)) va; tlb_rel_sat (typ_non_det_tlb s) (typ_sat_tlb t)\<rbrakk>
\<Longrightarrow> consistent0' (MEM t') (ASID t') (TTBR0 t') (fst (sat_tlb t')) (snd (sat_tlb t')) va \<and> tlb_rel_sat (typ_non_det_tlb s') (typ_sat_tlb t')"
apply (rule conjI)
apply (subgoal_tac "MEM t = MEM t' \<and> ASID t = ASID t' \<and> TTBR0 t = TTBR0 t' \<and> sat_tlb t = sat_tlb t'")
apply (clarsimp simp: consistent0_def)
prefer 2
apply (subgoal_tac " exception s' = exception t'")
apply (drule mem1_read_exception)
apply (drule mem1_read_exception)
apply (clarsimp simp: tlb_rel_sat_def)
apply (clarsimp simp: saturated_def state.truncate_def)
apply (cases s', cases t')
apply clarsimp
apply (subgoal_tac "MEM s = MEM t \<and> exception s = exception t")
apply (thin_tac "consistent0' (MEM t) (ASID t) (TTBR0 t) (fst (sat_tlb t)) (snd (sat_tlb t)) va")
apply (thin_tac "tlb_rel_sat (typ_non_det_tlb s) (typ_sat_tlb t)")
apply (clarsimp simp: mem_read1_def)
apply (clarsimp split: if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
subgoal
by (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: tlb_rel_sat_def state.defs)
apply (drule mem1_read_exception)
apply (drule mem1_read_exception)
apply (cases t, cases t' , clarsimp)
done
lemma mmu_read_non_det_sat_rel_cons:
"\<lbrakk> mmu_read_size (va, sz) s = (val, s'); tlb_rel_sat (typ_non_det_tlb s) (typ_sat_tlb t);
consistent (typ_sat_tlb t) va; mmu_read_size (va, sz) t = (val', t') \<rbrakk> \<Longrightarrow>
consistent (typ_sat_tlb t') va \<and> tlb_rel_sat (typ_non_det_tlb s') (typ_sat_tlb t') "
apply (clarsimp simp: mmu_read_size_sat_tlb_state_ext_def mmu_read_size_non_det_tlb_state_ext_def Let_def)
apply (cases "mmu_translate va s", cases "mmu_translate va t", clarsimp)
apply (drule_tac t = t in mmu_translate_non_det_sat_refine ; clarsimp simp: Let_def mem_read1_consistent_tlb_rel_non_det)
done
lemma same_mem_read_equal:
"\<lbrakk>MEM s = MEM t; mem_read1 (pa, sz) s = (val, s'); mem_read1 (pa, sz) t = (val', t') \<rbrakk> \<Longrightarrow> val = val'"
apply (clarsimp simp: mem_read1_def)
apply (clarsimp split: if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
subgoal
by (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: raise'exception_def split: option.splits if_split_asm)
done
lemma mmu_read_non_det_sat_refine:
"\<lbrakk>mmu_read_size (va, sz) s = (val, s'); mmu_read_size (va, sz) t = (val', t');
tlb_rel_sat (typ_non_det_tlb s) (typ_sat_tlb t); consistent (typ_sat_tlb t) va\<rbrakk> \<Longrightarrow>
val = val' \<and> tlb_rel_sat (typ_non_det_tlb s') (typ_sat_tlb t') \<and> consistent (typ_sat_tlb t') va "
apply (rule conjI)
apply (clarsimp simp: mmu_read_size_sat_tlb_state_ext_def mmu_read_size_non_det_tlb_state_ext_def Let_def)
apply (cases "mmu_translate va s", cases "mmu_translate va t", clarsimp)
apply (rename_tac pa s'' pa' t'')
apply (subgoal_tac "pa = pa'", clarsimp)
apply (subgoal_tac "MEM s'' = MEM t''")
apply (clarsimp simp: same_mem_read_equal)
using mmu_translate_non_det_sat_mem_excp apply force
using mmu_translate_non_det_sat_pa apply force
apply (frule_tac t = t and t' =t' in mmu_read_non_det_sat_rel_cons; simp)
done
lemma mmu_read_sat_const_inter [simp]:
"saturated (typ_sat_tlb s) \<Longrightarrow> fst(sat_tlb (snd (mmu_read_size v s))) = fst(sat_tlb s) \<and>
snd(sat_tlb (snd (mmu_read_size v s))) = snd(sat_tlb s)"
by (clarsimp simp: mmu_read_size_sat_tlb_state_ext_def split_def Let_def
mem_read1_def raise'exception_def split: if_split_asm)
lemma mem_read1_consistent_tlb_rel_incon:
"\<lbrakk>mem_read1 (a, sz) s = (val, s'); mem_read1 (a, sz) t = (val', t');
va \<notin> iset (set_tlb t); tlb_rel_abs (typ_sat_tlb s) (typ_set_tlb t)\<rbrakk>
\<Longrightarrow> va \<notin> iset (set_tlb t') \<and> tlb_rel_abs (typ_sat_tlb s') (typ_set_tlb t')"
apply (rule conjI)
apply (subgoal_tac "ASID t = ASID t' \<and> iset (set_tlb t) = iset (set_tlb t')")
apply clarsimp
apply (drule mem1_read_exception)
apply (drule mem1_read_exception)
apply (cases t, cases t')
apply clarsimp
apply (subgoal_tac "exception s' = exception t'")
apply (drule mem1_read_exception)
apply (drule mem1_read_exception)
apply (clarsimp simp: tlb_rel_abs_def)
apply (rule conjI)
apply (clarsimp simp: state.defs)
apply (cases s', cases t')
apply clarsimp
apply (rule conjI)
apply (clarsimp simp: saturated_def)
apply (rule conjI)
apply (clarsimp simp: incon_addrs_def inconsistent_vaddrs_def incoherrent_vaddrs_def)
apply (cases s', cases t')
apply clarsimp
apply (rule conjI)
apply (clarsimp simp: global_range_def)
apply (cases s', cases t')
apply clarsimp
apply (cases s', cases t')
apply clarsimp
apply (subgoal_tac "MEM s = MEM t \<and> exception s = exception t")
apply (thin_tac " va \<notin> iset (set_tlb t)")
apply (thin_tac " tlb_rel_abs (typ_sat_tlb s) (typ_set_tlb t)")
apply (clarsimp simp: mem_read1_def)
apply (clarsimp split: if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
subgoal
by (clarsimp simp: mem1_def raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: raise'exception_def split: option.splits if_split_asm)
apply (clarsimp simp: tlb_rel_abs_def state.defs)
done
find_consts "'a option set \<Rightarrow> 'a option"
lemma mmu_read_sat_incon_rel_con:
"\<lbrakk> mmu_read_size (va, sz) s = (val, s'); tlb_rel_abs (typ_sat_tlb s) (typ_set_tlb t);
va \<notin> iset (set_tlb t); mmu_read_size (va, sz) t = (val', t') \<rbrakk> \<Longrightarrow>
va \<notin> iset (set_tlb t') \<and> tlb_rel_abs (typ_sat_tlb s') (typ_set_tlb t') "
apply (clarsimp simp: mmu_read_size_sat_tlb_state_ext_def mmu_read_size_set_tlb_state_ext_def Let_def)
apply (cases "mmu_translate va s", cases "mmu_translate va t", clarsimp)
apply (drule_tac t = t and pa' = aa and t' = ba in mmu_translate_sat_incon_refine ; clarsimp simp: Let_def mem_read1_consistent_tlb_rel_incon)
done
lemma mmu_read_sat_incon_refine:
"\<lbrakk> mmu_read_size (va, sz) s = (val, s'); mmu_read_size (va, sz) t = (val', t');
tlb_rel_abs (typ_sat_tlb s) (typ_set_tlb t); va \<notin> iset (set_tlb t) \<rbrakk> \<Longrightarrow>
val = val' \<and> tlb_rel_abs (typ_sat_tlb s') (typ_set_tlb t') \<and> va \<notin> iset (set_tlb t')"
apply (rule conjI)
apply (clarsimp simp: mmu_read_size_sat_tlb_state_ext_def mmu_read_size_set_tlb_state_ext_def Let_def)
apply (cases "mmu_translate va s", cases "mmu_translate va t", clarsimp)
apply (rename_tac pa s'' pa' t'')
apply (subgoal_tac "pa = pa'", clarsimp)
apply (subgoal_tac "MEM s'' = MEM t''")
apply (clarsimp simp: same_mem_read_equal)
using mmu_translate_sat_incon_mem_excp apply force
using mmu_translate_sat_incon_refine apply force
by (frule_tac t = t and t' =t' in mmu_read_sat_incon_rel_con; simp)
end
|
% !TEX root = ../00_thesis.tex
%-------------------------------------------------------------------------------
\subsection{Simulated Worst-Case Performance}
\label{subsec:simulation}
In \cref{subsec:perf_model}, we derived the optimal performance achievable according to our \DRP's model.
However, this model is based on a worst-case analysis of message latency throughout the system.
Because such an analysis is inherently pessimistic, it is important to estimate how pessimist the analysis is. In other words, how tight are the latency bounds given by the model?
In this section, we investigate this question using a discrete event simulation.
\fakepar{Procedure}
We simulate the run-time behavior of \DRP using the values and parameters from our implementations~(\cref{table:simulation_parameters}).
The simulation framework tracks the latency of each individual message through the entire system, \ie all \APs, \CPs, \bolt and the wireless communication network.
Concretely, the simulation is implemented using Matlab scripts (openly available -- \cref{append:drp_artifacts}).
\blink computes the round schedules assuming that the first message of each flow is available for communication at $t = 0\s$. The actual epoch at which the \APs write the first packet of each flow is randomized between $0\s$ and the flow's minimal message interval $T$; subsequent packets are sent with period $T$.
The random seed is fixed for reproduciblility.
\squarepar{%
\fakepar{Scenario}
Node 1 acts as the sink and communicates with all other nodes in the network. As described in \cref{sec:designDetailed}, \DRP is initialized with a set of control flows $\mathcal{F}_{control}$, which is necessary in order to register subsequent flows%
}
\[
\mathcal{F}_{control} =
\left\lbrace
\begin{tabular}{@{\,}l@{\,}}
(1\,, n\,, \periodany = 10\s\,, \jitterany = 0\s\,, \deadlineany = 30\s )\\
(n\,, 1\,, \periodany = 10\s\,, \jitterany = 0\s\,, \deadlineany = 30\s )\\
\end{tabular}
\right\rbrace
\]
for $n \in ($2$ .. $20$)$. In practice, such flows can also be used to send low-priority data (\eg status data) regularly to the sink.
An event from the environment (\eg a rock crack~\cite{meyer2019IPSN}) is co-detected by nodes 2 to 5, which consequently emit a request for a new flow to the sink node. In order to transfer the event data as fast as possible, the message interval is chosen as small as possible
(\ie equal to $T_f^s$, the flushing interval of $\cp$ -- Refer to \eqref{eq:design_flush_period_source}, \eqref{eq:design_round_period} and \eqref{eq:ndeadline_constraint_period}),
\[
\mathcal{F}_{new} =
\left\lbrace
\begin{tabular}{@{}l@{}}
(n\,, 1\,, \periodany = 1.074\s\,, \jitterany = 0\s\,, \deadlineany = 10\s )\\
\end{tabular}
\right\rbrace
\]
for $n \in ($2$ .. $5$)$. We record the end-to-end latency of all packets during two minutes, during which about 900 messages are transmitted through the system.
\fakepar{Results}
\cref{fig:latency} shows the distribution of end-to-end latency of messages, shown as percentage of the analytical worst-case latency (given by \cref{thm:delta}).
We see that a few messages indeed experience a latency up to 97\,\% of the analytic worst-case bound.
The simulation also indicates that, in many cases, the worst-case buffer sizes of $\cp$ and \bolt are reached.
Overall, these results support our analysis of \DRP. They show that our worst-case bounds are tight; therefore, we can conclude that the performance derived using \DRP's model~(\cref{subsec:perf_model}) is representative of the performance that can be truly guaranteed by the system.
\begin{figure}
\centering
\href{\drpfig{Figure-11}}{%
\includegraphics[scale=1]{lat_simu}}
\caption{Distribution of end-to-end latency of messages, shown as percentage of the analytical worst-case latency.
\capt{Some messages experience a latency very close to their worst-case bound (97\,\%), which demonstrates the tightness of the analysis.}
}
\label{fig:latency}
\end{figure}
%-------------------------------------------------------------------------------
\subsection{Real-World Performance}
\label{subsec:flocklab}
\begin{table}
\caption{Flow sets used in the end-to-end latency evaluation of \DRP.
\capt{The \blink utilization is computed assuming a strictly periodic release of messages.}}
{\smaller\input{\PathTab/flow_set.csv}}
\label{tab:flow_set}
\end{table}
% Some intro about why we do real tests
We now consider the performance of our implementation of \DRP on embedded hardware: We use the first-generation DPP, which features a TI MSP432P401R as \AP and a TI CC430F5147 as \CP~(\cref{append:dpp}).
The software is based on the publicly available implementation of LWB~\cite{Code_LWB}; it is written in C and uses Contiki 2.7~\cite{contiki} as operating system.
The implementation of \blink on the \AP is built upon~\cite{acevedo2016Realtime}.
%
We discuss our implementation performance in terms of memory usage, computation workload, and message latency.
\squarepar{%
\fakepar{Memory usage}
\DRP requires both \AP and \CP to store some state information related to the currently running flows, as well message queues and buffers. The available RAM on both processors is shown in \cref{table:memory}.%
}
The 64\kB of the \AP are largely sufficient; it would supports hundreds of flows. The \CP is more limited: With a payload size of 32\bytes, \CP is capped to a maximum for 40 flows~(\cref{table:memory}). For a regular node, this will likely be sufficient for most applications; however, on the host node, this seriously limits the scalability of the system.
One possible solution is to use the embedded external memory (128\kB); this would solve the memory limitation issue, but it may also introduce additional delays, which are currently not accounted for. Or we could use another processor as \CP with more than 4\kB of RAM.
\begin{table}
\centering
\caption{Memory available and required for our implementation of \DRP.
\capt{%
The difference between ``total'' and ``available'' memory corresponds to the memory taken by the firmware only. $L$ is the message payload.}
}
\label{table:memory}
{\smaller\input{\PathTab/memory.csv}}
\end{table}
\pagebreak
\squarepar{%
\fakepar{Computation}
The most extensive computations in \DRP are the computations of the \blink schedules and admission tests. The evaluation of these computations on embedded hardware is discussed in depth in~\cite{zimmerling2017Blink}.%
}
In addition to \blink computations, the \APs must perform \DRP admission tests. These are simple operations~(\cref{thm:CP} and \ref{thm:AP}) which can be implemented efficiently. In our experiments, an admission test takes typically around 30\ms to complete (maximum observed execution time: 130\ms).
\DRP admission tests are performed only once per flow (when a new flow is requested). Thus, we can conclude that the computational workload induced by \DRP (in addition to \blink) is negligible.
\afterpage{
\begin{figure}
\centering
\begin{subfigure}{\linewidth}
\captionsetup{labelformat=empty}
\href{\drpfig{Figure-12}}{%
\includegraphics[scale=1]{lat_real_low}}
\caption{}
\end{subfigure}\\[10pt]
\begin{subfigure}{\linewidth}
\captionsetup{labelformat=empty}
\href{\drpfig{Figure-12}}{%
\includegraphics[scale=1]{lat_real_medium}}
\caption{}
\end{subfigure}\\[10pt]
\begin{subfigure}{\linewidth}
\captionsetup{labelformat=empty}
\href{\drpfig{Figure-12}}{%
\includegraphics[scale=1]{lat_real_high}}
\caption{}
\end{subfigure}
\caption{%
Distribution of end-to-end latency of messages, shown as percentage of the analytical worst-case latency for a \DRP run using different flow sets~(\cref{tab:flow_set}).
\capt{%
Top -- Low utilization.
Middle -- Medium utilization.
Bottom -- High utilization.}
}
\label{fig:lat_real_all}
\end{figure}
}
\fakepar{End-to-end latency}
We investigate the experienced end-to-end latency of messages. We use a network of 10 source nodes and one host, and run experiments on the FlockLab testbed~\cite{lim2013FlockLab}. In addition to the control flows, each source node request a data flow toward the host with a pseudo-random period and end-to-end deadline.
Once the flow is admitted, the source \APs release new packets periodically.
The different flow sets used are listed in \cref{tab:flow_set}. \DRP is configured with a deadline ratio $r=0.5$, a round length $\rlength = 1\s$, and a maximum of $\nslotsmax = 5$ slots per round.
\begin{table}
\centering
\caption{Experienced latency of messages, expressed as percentage of the flow's end-to-end deadline.
\capt{The tightness correspond to the ratio of the experienced latency with the analytical upper-bound given by~\cref{thm:delta}.}}
{\smaller\input{\PathTab/latency.csv}}
\label{tab:latency}
\end{table}
The results are summarized in \cref{tab:latency} and \cref{fig:lat_real_all}, reporting data from one run for each flow set.
The first observation is that all messages that are successfully transmitted over the wireless network do meet their end-to-end deadline.
However, compared to the simulation experiment~(\cref{subsec:simulation}), we do not encounter so much analytical corner cases: the observed latency is often much smaller than the analytical upper-bound~(\cref{fig:lat_real_all}).
On the other hand, this means that the actual runtime performance is better that what is guaranteed: even with large end-to-end deadlines (around 60\s), the experience message latency is most of the time between 5\s to 15\s.
Such ``short'' average latency can be explained by the nature of the flow set. The \emph{network} deadline, enforced by \blink, must be smaller than the flow period~\cref{sec:designDetailed}. Since the period are small compared to the \emph{end-to-end deadlines}, these end-to-end deadlines do not constraint the \DRP contracts: the experience latency correlates with the flow period.
It is interesting to observe that the average end-to-end latency is smaller for the high utilization flow set than for the low and middle ones. Again, this is due to the flow set. To meet the network deadline, \blink schedule at least one round per period. Thus, a flow set with shorter period results in more frequent rounds. Once a round is scheduled, it is filled with any message ready for transmission. Thus, flows are opportunistically served earlier than necessary to meet their end-to-end deadline. Conclusion: having a flow with a small period reduces the average latency experienced by all flows in the system. This is an interesting (and unforeseen) consequence of \DRP mechanism.
\squarepar{%
\fakepar{Conclusions}
The performance evaluation presented in this section validates the design of \DRP and our implementation: we showcased that we can run a wireless \CPS that meet end-to-end deadlines between distributed applications~(\cref{subsec:simulation} and \ref{subsec:flocklab}).
In addition, we derived the theoretical optimal performance achievable based on \DRP's model~(\cref{subsec:perf_model}).%
}
A more thorough investigation of the actual system performance across different scenarios and environments remains to be performed.
For such a performance evaluation, using \triscale~(\cref{ch:triscale}) would be natural.
%
Chronologically, \triscale is the last piece of work of this dissertation. In hindsight, our evaluation of \DRP appears a bit naive and simple. Still, we argue that it successfully demonstrates the soundness of \DRP's design.% and supports our claims.
|
Require Import ExtLib.Tactics.
Require Import MirrorCore.Util.Forwardy.
Require Import MirrorCore.TypesI.
Require Import MirrorCore.SymI.
Require Import MirrorCore.Views.FuncView.
Require Import MirrorCore.Views.Ptrns.
Require Import MirrorCore.RTac.RTac.
Require Import MirrorCore.Lambda.Expr.
Require Import MirrorCore.Lambda.Ptrns.
Require Import MirrorCore.Lambda.RedAll.
Require Import MirrorCore.Lambda.ExprVariables.
Require Import MirrorCore.Lambda.ExprTac.
Require Import MirrorCore.Lambda.Rtac.
Require Import McExamples.Hoare.Imp.
Require Import McExamples.Hoare.ILogicFunc.
Set Universe Polymorphism.
Set Printing Universes.
Section parametric.
Context {typ func : Set}.
Context {RType_typ : RType typ}.
Context {RTypeOk_typ : RTypeOk}.
Context {Typ2_RFun : Typ2 RType_typ RFun}.
Context {Typ2Ok_RFun : Typ2Ok Typ2_RFun}.
Context {Typ0_Prop : Typ0 RType_typ Prop}.
Context {Typ0Ok_Prop : Typ0Ok Typ0_Prop}.
Context {RSym_func : RSym func}.
Context {RSymOk_func : RSymOk RSym_func}.
Context {FV : PartialView func (ilfunc typ)}.
Variable ilo : @logic_ops _ _.
Variable eo : @embed_ops _ _.
Context {iloOk : logic_opsOk ilo}.
Context {FVO : FuncViewOk FV RSym_func (RSym_ilfunc (RelDec_eq_typ) ilo eo _ _) }.
Context {ilo_Prop : ilo (typ0 (F:=Prop)) =
lSome match eq_sym (typ0_cast (F:=Prop)) in _ = X
return ILogic.ILogicOps X with
| eq_refl => ILogic.ILogicOps_Prop
end}.
Definition bin_op {T U V W : Type} (f : T -> U -> V -> W)
(t : ptrn func T) (l : ptrn (expr typ func) U) (r : ptrn (expr typ func) V)
: ptrn (expr typ func) W :=
appl (appl (inj t) (pmap (fun t x => (x,t)) l))
(pmap (fun v tx => let '(t,x) := tx in f t x v) r).
Instance ptrn_ok_bin_op : ltac:(PtrnOk @bin_op) := _.
Definition ptrn_entails@{A X P} {T U V : Type@{A}}
(t : ptrn@{Set A X P} typ V)
(a : ptrn@{Set A X P} (expr typ func) (V -> T))
(b : ptrn@{Set A X P} (expr typ func) (T -> U))
: ptrn@{Set A X P} (expr typ func) U :=
appl (appl (inj (ptrn_view _ (fptrn_lentails@{A X P} t))) a) b.
Instance ptrn_entails_ok : ltac:(PtrnOk @ptrn_entails) := _.
Definition intro_ptrn_all : ptrn (expr typ func) (OpenAs typ (expr typ func))
:=
por
(appl (inj (ptrn_view FV (fptrn_lforall get (fun t => pmap (fun _ => t) ignore))))
(pmap (fun body t => SimpleOpen_to_OpenAs (sAsAl t body)) get))
(ptrn_entails get (pmap (fun G t => (G,t)) get)
(appl (inj (ptrn_view FV (fptrn_lforall get (fun t => pmap (fun _ => t) ignore))))
(pmap (fun body t Gt =>
let '(G,l) := Gt in
AsAl t (fun arg =>
App (App (Inj (f_insert (ilf_entails l))) G)
(Red.beta (App body arg)))) get))).
Definition intro_ptrn_hyp : ptrn (expr typ func) (OpenAs typ (expr typ func))
:=
bin_op (fun _ P Q => AsHy P Q)
(ptrn_view _ (fptrn_limpl ignore)) get get.
Local Existing Instance RSym_ilfunc.
Local Existing Instance RSym_func.
Local Existing Instance RType_typ.
Theorem Succeeds_bin_op {T U V W : Type} f t l r e res
: ptrn_ok t -> ptrn_ok l -> ptrn_ok r ->
Succeeds e (@bin_op T U V W f t l r) res ->
exists ef el er rf rl rr,
e = App (App (Inj ef) el) er /\
res = f rf rl rr /\
Succeeds ef t rf /\
Succeeds el l rl /\
Succeeds er r rr.
Proof.
unfold bin_op. intros. ptrn_elim; subst.
do 6 eexists.
repeat (split; [ reflexivity | ]); auto.
Qed.
Theorem Succeeds_ptrn_entails@{A X P} {T U V : Type@{A}}
(e : expr typ func) (t : ptrn@{Set A X P} _ _) (a : ptrn@{Set A X P} _ _) (b : ptrn@{Set A X P} _ _) r
: ptrn_ok@{Set A X P} a -> ptrn_ok@{Set A X P} b -> ptrn_ok@{Set A X P} t ->
Succeeds@{Set A X P} e (@ptrn_entails@{A X P} T U V t a b) r ->
exists te ta tb tr ar br,
e = App (App (Inj (f_insert (ilf_entails te))) ta) tb /\
r = br (ar tr) /\
Succeeds@{Set A X P} te t tr /\
Succeeds@{Set A X P} ta a ar /\
Succeeds@{Set A X P} tb b br.
Proof.
unfold ptrn_entails. intros.
ptrn_elim; subst.
do 6 eexists; split; eauto.
Qed.
Let Expr_expr := @Expr_expr _ _ RType_typ _ RSym_func.
Local Existing Instance Expr_expr.
Let ExprOk_expr : ExprOk Expr_expr :=
@ExprOk_expr _ _ RType_typ _ RSym_func _ _ _.
Local Existing Instance ExprOk_expr.
Local Opaque Red.beta.
Hint Opaque pmap appl appr inj ptrn_view get ignore : typeclass_instances.
Theorem intro_ptrn_hyp_sound : open_ptrn_sound intro_ptrn_hyp.
Proof.
red; intros.
unfold intro_ptrn_hyp in H.
eapply Succeeds_bin_op in H; eauto with typeclass_instances.
forward_reason. subst.
ptrn_elim; subst.
red.
unfold propD, exprD_typ0.
red_exprD. intros.
forwardy; inv_all; subst.
assert (x = typ0 (F:=Prop) /\ x2 = typ0 (F:=Prop) /\ x6 = typ0 (F:=Prop)).
{ unfold symAs in H; simpl in H.
destruct (ilo x6); try congruence.
forwardy. clear H0 H.
apply typ2_inj in y; eauto; destruct y.
apply typ2_inj in H0; eauto; destruct H0.
unfold Rty in *. subst. clear. tauto. }
destruct H0 as [ ? [ ? ? ] ]; subst.
rewrite H2. rewrite H1.
do 2 eexists; split; [ reflexivity | split; [ reflexivity | ] ].
clear H2 H1.
unfold symAs in H; simpl in H.
rewrite ilo_Prop in H.
rewrite type_cast_refl in H; eauto.
inv_all; subst.
simpl.
unfold AbsAppI.exprT_App, typ2_cast_bin.
clear ilo_Prop.
generalize (typ0_cast (F:=Prop)).
generalize (typ2_cast (typ0 (F:=Prop)) (typ0 (F:=Prop))).
generalize (typ2_cast (typ0 (F:=Prop))
(typ2 (typ0 (F:=Prop)) (typ0 (F:=Prop)))).
generalize dependent (typD (typ0 (F:=Prop))).
generalize dependent (typD (typ2 (typ0 (F:=Prop)) (typ0 (F:=Prop)))).
generalize dependent (typD
(typ2 (typ0 (F:=Prop)) (typ2 (typ0 (F:=Prop)) (typ0 (F:=Prop))))).
do 8 intro; subst. simpl.
clear. tauto.
Qed.
Theorem intro_ptrn_all_sound : open_ptrn_sound intro_ptrn_all.
Proof.
red. intros.
unfold intro_ptrn_all in H.
eapply Succeeds_por in H; eauto 100 with typeclass_instances.
destruct H.
- ptrn_elim; subst.
eapply SimpleOpen_to_OpenAs_sound; eauto.
simpl. unfold propD, exprD_typ0. simpl. intros.
forwardy.
inv_all. subst.
unfold symAs in H. simpl in H.
forward. inv_all; subst.
destruct (decompose_Rty_typ2 _ _ r) as [ ? [ ? ? ] ].
subst.
destruct x2.
red in x0. subst x.
eexists; split; eauto.
intros.
simpl.
specialize (iloOk (typ0 (F:=Prop))).
rewrite H in *; clear H.
inversion ilo_Prop; clear ilo_Prop; subst.
revert iloOk.
clear - H2.
revert H2.
unfold typ2_cast_quant, castD in *. simpl.
generalize dependent (typ0_cast (F:=Prop)).
generalize dependent (typ0 (F:=Prop)).
intro.
generalize dependent (typ2_cast x7 t).
unfold AbsAppI.exprT_App, exprT_Inj.
generalize dependent (typ2_cast (typ2 x7 t) t).
generalize dependent (typD (typ2 x7 t)).
generalize dependent (typD t).
generalize dependent (typD (typ2 (typ2 x7 t) t)).
intros; subst; simpl in *. auto.
- ptrn_elim; subst.
simpl.
unfold propD, exprD_typ0. simpl.
intros.
forwardy; inv_all; subst.
assert (x2 = typ2 x19 x18 /\ x = x18 /\ x7 = x4 /\ x = x4).
{ clear - H H3 RTypeOk_typ Typ2Ok_RFun.
unfold symAs in *.
simpl in *.
destruct (ilo x18); try congruence.
destruct (ilo x4); try congruence.
forwardy. clear H2 H1 H H0.
apply typ2_inj in y; eauto.
eapply typ2_inj in y0; eauto.
destruct y; destruct y0.
eapply typ2_inj in H2; eauto.
unfold Rty in *. destruct H2.
tauto. }
destruct H2 as [ ? [ ? [ ? ? ] ] ]; subst. subst.
eapply exprD_weakenV with (Expr_expr:=Expr_expr)(tvs':=x19::nil) in H6; eauto.
eapply exprD_weakenV with (Expr_expr:=Expr_expr)(tvs':=x19::nil) in H4; eauto.
forward_reason.
erewrite ExprTac.lambda_exprD_AppL; eauto.
Focus 2.
erewrite ExprTac.lambda_exprD_AppR; eauto.
red_exprD.
rewrite <- (@fv_compat _ _ _ _ _ _ _ FVO).
rewrite H. reflexivity.
generalize (Red.beta_sound tus (tvs ++ x19 :: nil) (App x21 e') x4).
erewrite lambda_exprD_App_both_cases; eauto.
intros; forwardy.
rewrite H7. eexists; split; [ reflexivity | ].
intros.
unfold symAs in H, H3. simpl in H, H3.
destruct (ilo x4) eqn:Hilo; try congruence.
specialize (iloOk x4).
rewrite Hilo in iloOk.
rewrite type_cast_refl in *; eauto.
inv_all; subst.
simpl in *.
generalize (H6 us vs); clear H6.
generalize (H5 us vs); clear H5.
generalize (H8 us); clear H8.
revert H9.
unfold AbsAppI.exprT_App.
clear H7 H2 H4 H0.
unfold typ2_cast_quant.
generalize (typ0_cast (F:=Prop)).
generalize (typ2_cast x4 (typ2 x4 (typ0 (F:=Prop)))).
generalize (typ2_cast x4 (typ0 (F:=Prop))).
generalize (typ2_cast x19 x4).
generalize (typ2_cast (typ2 x19 x4) x4).
clear ilo_Prop.
repeat match goal with
| |- context [ @eq Type ?X _ ] => generalize dependent X
end.
do 12 intro; subst; simpl.
intros.
eapply ILogic.lforallR.
intros.
rewrite (H2 (HList.Hcons x1 HList.Hnil)); clear H2.
rewrite (H0 (HList.Hcons x1 HList.Hnil)); clear H0.
specialize (H (HList.hlist_app vs (HList.Hcons x1 HList.Hnil))).
specialize (H9 x1).
rewrite H1 in *.
rewrite H. assumption.
Qed.
Definition INTRO_all : rtac typ (expr typ func) :=
INTRO_ptrn intro_ptrn_all.
Instance RtacSound_INTRO_all : RtacSound INTRO_all.
Proof.
eapply INTRO_ptrn_sound; eauto.
- eauto 100 with typeclass_instances.
- eapply intro_ptrn_all_sound.
Qed.
Definition INTRO_hyp : rtac typ (expr typ func) :=
INTRO_ptrn intro_ptrn_hyp.
Instance RtacSound_INTRO_hyp : RtacSound INTRO_hyp.
Proof.
unfold INTRO_hyp.
unfold Expr_expr.
eapply INTRO_ptrn_sound; eauto.
- eauto with typeclass_instances.
- eapply intro_ptrn_hyp_sound.
Qed.
End parametric.
|
5 is monomeric . SbF
|
import CodeAction.Interface
import StatementAutoformalisation.Translate
import StatementAutoformalisation.Config.FixedPrompts
namespace SuggestName
def LLMParams : LLM.Params :=
{
openAIModel := "gpt-3.5-turbo",
temperature := 4,
n := 5,
maxTokens := 200,
stopTokens := #["\n\n"],
systemMessage := "Please suggest a suitable name for the given theorem written in Lean."
}
def PromptParams : Prompt.Params :=
{
toLLMParams := LLMParams,
toSentenceSimilarityParams := #[],
toKeywordExtractionParams := #[],
fixedPrompts := leanChatPrompts,
useNames := #[],
useModules := #[],
useMainCtx? := false,
printMessage := fun decl => #[mkMessage "user" decl.printType, mkMessage "assistant" (decl.name.getD "none")],
mkSuffix := id,
processCompletion := fun type name => s!"/-- -/ {name} {type}"
}
def InterfaceParams : Interface.Params DeclarationWithDocstring :=
{
-- Use this code action by selecting the arguments and type of the declaration for which the name is to be generated.
title := "Suggest a suitable name for the selected type.",
useSelection? := true,
extractText? := some,
action := fun stmt =>
Prompt.translate ⟨PromptParams, stmt⟩ >>= fun (_, suggestions) => return suggestions[0]!,
postProcess := fun type decl => s!"{decl.name.getD ""} {type}"
}
@[codeActionProvider] def Action := performCodeAction InterfaceParams
end SuggestName
|
module Data.Colist1
import Data.Colist
import Data.List
import Data.List1
import Data.Nat
import Data.Stream
import public Data.Zippable
%default total
||| A possibly finite, non-empty Stream.
public export
data Colist1 : (a : Type) -> Type where
(:::) : a -> Colist a -> Colist1 a
--------------------------------------------------------------------------------
-- Creating Colist1
--------------------------------------------------------------------------------
||| Convert a `List1` to a `Colist1`.
public export
fromList1 : List1 a -> Colist1 a
fromList1 (h ::: t) = h ::: fromList t
||| Convert a stream to a `Colist1`.
public export
fromStream : Stream a -> Colist1 a
fromStream (x :: xs) = x ::: fromStream xs
||| Try to convert a `Colist` to a `Colist1`. Returns `Nothing` if
||| the given `Colist` is empty.
public export
fromColist : Colist a -> Maybe (Colist1 a)
fromColist Nil = Nothing
fromColist (x :: xs) = Just (x ::: xs)
||| Try to convert a list to a `Colist1`. Returns `Nothing` if
||| the given list is empty.
public export
fromList : List a -> Maybe (Colist1 a)
fromList = fromColist . fromList
||| Create a `Colist1` of only a single element.
public export
singleton : a -> Colist1 a
singleton a = a ::: Nil
||| An infinite `Colist1` of repetitions of the same element.
public export
repeat : a -> Colist1 a
repeat v = v ::: repeat v
||| Create a `Colist1` of `n` replications of the given element.
public export
replicate : (n : Nat) -> {auto 0 prf : IsSucc n} -> a -> Colist1 a
replicate 0 _ impossible
replicate (S k) x = x ::: replicate k x
||| Produce a `Colist1` by repeating a sequence
public export
cycle : List1 a -> Colist1 a
cycle (x ::: xs) = x ::: cycle (xs ++ [x])
||| Generate an infinite `Colist1` by repeatedly applying a function.
public export
iterate : (f : a -> a) -> a -> Colist1 a
iterate f a = a ::: iterate f (f a)
||| Generate a `Colist1` by repeatedly applying a function.
||| This stops once the function returns `Nothing`.
public export
iterateMaybe : (f : a -> Maybe a) -> a -> Colist1 a
iterateMaybe f a = a ::: iterateMaybe f (f a)
||| Generate a `Colist1` by repeatedly applying a function
||| to a seed value.
||| This stops once the function returns `Nothing`.
public export
unfold : (f : s -> Maybe (s,a)) -> s -> a -> Colist1 a
unfold f s a = a ::: unfold f s
--------------------------------------------------------------------------------
-- Basic Functions
--------------------------------------------------------------------------------
||| Convert a `Colist1` to a `Colist`
public export
forget : Colist1 a -> Colist a
forget (h ::: t) = h :: t
||| Convert an `Inf (Colist1 a)` to an `Inf (Colist a)`
public export
forgetInf : Inf (Colist1 a) -> Inf (Colist a)
forgetInf (h ::: t) = h :: t
||| Prepends an element to a `Colist1`.
public export
cons : (x : a) -> (xs : Colist1 a) -> Colist1 a
cons x xs = x ::: forget xs
||| Concatenate two `Colist1`s
public export
append : Colist1 a -> Colist1 a -> Colist1 a
append (h ::: t) ys = h ::: append t (forget ys)
||| Append a `Colist1` to a `List`.
public export
lappend : List a -> Colist1 a -> Colist1 a
lappend Nil ys = ys
lappend (x :: xs) ys = x ::: lappend xs (forget ys)
||| Append a `List` to a `Colist1`.
public export
appendl : Colist1 a -> List a -> Colist1 a
appendl (x ::: xs) ys = x ::: appendl xs ys
||| Take a `Colist1` apart
public export
uncons : Colist1 a -> (a, Colist a)
uncons (h ::: tl) = (h, tl)
||| Extract the first element from a `Colist1`
public export
head : Colist1 a -> a
head (h ::: _) = h
||| Drop the first element from a `Colist1`
public export
tail : Colist1 a -> Colist a
tail (_ ::: t) = t
||| Take up to `n` elements from a `Colist1`
public export
take : (n : Nat) -> {auto 0 prf : IsSucc n} -> Colist1 a -> List1 a
take 0 _ impossible
take (S k) (x ::: xs) = x ::: take k xs
||| Take elements from a `Colist1` up to and including the
||| first element, for which `p` returns `True`.
public export
takeUntil : (p : a -> Bool) -> Colist1 a -> Colist1 a
takeUntil p (x ::: xs) = if p x then singleton x else x ::: takeUntil p xs
||| Take elements from a `Colist1` up to (but not including) the
||| first element, for which `p` returns `True`.
public export
takeBefore : (p : a -> Bool) -> Colist1 a -> Colist a
takeBefore p = takeBefore p . forget
||| Take elements from a `Colist1` while the given predicate `p`
||| returns `True`.
public export
takeWhile : (p : a -> Bool) -> Colist1 a -> Colist a
takeWhile p = takeWhile p . forget
||| Extract all values wrapped in `Just` from the beginning
||| of a `Colist1`. This stops, once the first `Nothing` is encountered.
public export
takeWhileJust : Colist1 (Maybe a) -> Colist a
takeWhileJust = takeWhileJust . forget
||| Drop up to `n` elements from the beginning of the `Colist1`.
public export
drop : (n : Nat) -> Colist1 a -> Colist a
drop n = drop n . forget
||| Try to extract the `n`-th element from a `Colist1`.
public export
index : (n : Nat) -> Colist1 a -> Maybe a
index n = index n . forget
||| Produce a `Colist1` of left folds of prefixes of the given `Colist1`.
||| @ f the combining function
||| @ acc the initial value
||| @ xs the `Colist1` to process
export
scanl : (f : a -> b -> a) -> (acc : a) -> (xs : Colist1 b) -> Colist1 a
scanl f acc (x ::: xs) = acc ::: scanl f (f acc x) xs
--------------------------------------------------------------------------------
-- Interfaces
--------------------------------------------------------------------------------
public export
Semigroup (Colist1 a) where
(<+>) = append
public export
Functor Colist1 where
map f (x ::: xs) = f x ::: map f xs
public export
Applicative Colist1 where
pure = repeat
(f ::: fs) <*> (a ::: as) = f a ::: (fs <*> as)
public export
Zippable Colist1 where
zipWith f (x ::: xs) (y ::: ys) = f x y ::: zipWith f xs ys
zipWith3 f (x ::: xs) (y ::: ys) (z ::: zs) =
f x y z ::: zipWith3 f xs ys zs
unzip xs = (map fst xs, map snd xs)
unzip3 xs = ( map (\(a,_,_) => a) xs
, map (\(_,b,_) => b) xs
, map (\(_,_,c) => c) xs
)
unzipWith f = unzip . map f
unzipWith3 f = unzip3 . map f
--------------------------------------------------------------------------------
-- Interleavings
--------------------------------------------------------------------------------
-- zig, zag, and cantor are taken from the paper
-- Applications of Applicative Proof Search
-- by Liam O'Connor
public export
zig : List1 (Colist1 a) -> Colist (Colist1 a) -> Colist a
public export
zag : List1 a -> List (Colist1 a) -> Colist (Colist1 a) -> Colist a
zig xs = zag (head <$> xs) (mapMaybe (fromColist . tail) $ forget xs)
zag (x ::: []) [] [] = x :: []
zag (x ::: []) (z :: zs) [] = x :: zig (z ::: zs) []
zag (x ::: []) zs (l :: ls) = x :: zig (l ::: zs) ls
zag (x ::: (y :: xs)) zs ls = x :: zag (y ::: xs) zs ls
public export
cantor : Colist1 (Colist1 a) -> Colist1 a
cantor (xxs ::: []) = xxs
cantor ((x ::: xs) ::: (yys :: zzss))
= x ::: zig (yys ::: mapMaybe fromColist [xs]) zzss
namespace Colist
public export
cantor : List (Colist a) -> Colist a
cantor xs =
let Just (l ::: ls) = List.toList1' $ mapMaybe fromColist xs
| Nothing => []
in zig (l ::: []) (fromList ls)
-- Exploring the (truncated) Nat*Nat top right quadrant of the plane
-- using Cantor's zig-zag traversal:
example :
let nats : Colist Nat; nats = fromStream Stream.nats in
take 10 (Colist.cantor [ map (0,) nats
, map (1,) nats
, map (2,) nats
, map (3,) nats])
=== [ (0, 0)
, (1, 0), (0, 1)
, (2, 0), (1, 1), (0, 2)
, (3, 0), (2, 1), (1, 2), (0, 3)
]
example = Refl
namespace DPair
||| Explore the plane corresponding to all possible pairings
||| using Cantor's zig zag traversal
public export
planeWith : {0 p : a -> Type} ->
((x : a) -> p x -> c) ->
Colist1 a -> ((x : a) -> Colist1 (p x)) ->
Colist1 c
planeWith k as f = cantor (map (\ x => map (k x) (f x)) as)
||| Explore the plane corresponding to all possible pairings
||| using Cantor's zig zag traversal
public export
plane : {0 p : a -> Type} ->
Colist1 a -> ((x : a) -> Colist1 (p x)) ->
Colist1 (x : a ** p x)
plane = planeWith (\ x, prf => (x ** prf))
namespace Pair
||| Explore the plane corresponding to all possible pairings
||| using Cantor's zig zag traversal
public export
planeWith : (a -> b -> c) ->
Colist1 a -> (a -> Colist1 b) ->
Colist1 c
planeWith k as f = cantor (map (\ x => map (k x) (f x)) as)
||| Explore the plane corresponding to all possible pairings
||| using Cantor's zig zag traversal
public export
plane : Colist1 a -> (a -> Colist1 b) -> Colist1 (a, b)
plane = Pair.planeWith (,)
--------------------------------------------------------------------------------
-- Example
--------------------------------------------------------------------------------
-- Exploring the Nat*Nat top right quadrant of the plane
-- using Cantor's zig-zag traversal:
example :
let nats1 = fromStream Stream.nats in
Colist1.take 10 (Pair.plane nats1 (const nats1))
=== (0, 0) :::
[ (1, 0), (0, 1)
, (2, 0), (1, 1), (0, 2)
, (3, 0), (2, 1), (1, 2), (0, 3)
]
example = Refl
|
-- |
-- Module : BattleHack.Utilities.Vector
-- Description :
-- Copyright : (c) Jonatan H Sundqvist, 2015
-- License : MIT
-- Maintainer : Jonatan H Sundqvist
-- Stability : experimental|stable
-- Portability : POSIX (not sure)
--
-- Created September 14 2015
-- TODO | - Is it silly to use Complex Double for everything because of Cairo (yes it is; fixed) (✓)
-- - Many of these functions should probably be moved to Southpaw
-- SPEC | -
-- -
--------------------------------------------------------------------------------------------------------------------------------------------
-- GHC Pragmas
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
-- API
--------------------------------------------------------------------------------------------------------------------------------------------
module BattleHack.Utilities.Vector where
--------------------------------------------------------------------------------------------------------------------------------------------
-- We'll need these
--------------------------------------------------------------------------------------------------------------------------------------------
import Data.Complex
import BattleHack.Types
import BattleHack.Lenses
--------------------------------------------------------------------------------------------------------------------------------------------
-- Functions
--------------------------------------------------------------------------------------------------------------------------------------------
-- |
dotwise :: (a -> a -> a) -> Complex a -> Complex a -> Complex a
dotwise f (x:+y) (x':+y') = f x x':+f y y'
-- |
dotmap :: (a -> a) -> Complex a -> Complex a
dotmap f (x:+y) = f x:+f y
-- |
toscalar :: (a -> a -> a) -> Complex a -> a
toscalar f (x:+y) = f x y
-- | Converts a 2-tuple to a vector
tovector :: (a, a) -> Complex a
tovector = uncurry (:+)
-- |
vectorise :: RealFloat f => (f -> f -> a) -> Complex f -> a
vectorise f (x:+y) = f x y
|
(* Title: Uint32.thy
Author: Andreas Lochbihler, ETH Zurich
*)
header {* Unsigned words of 32 bits *}
theory Uint32 imports
Word_Misc
Bits_Integer
begin
declare prod.Quotient[transfer_rule]
section {* Type definition and primitive operations *}
typedef uint32 = "UNIV :: 32 word set" ..
setup_lifting type_definition_uint32
text {* Use an abstract type for code generation to disable pattern matching on @{term Abs_uint32}. *}
declare Rep_uint32_inverse[code abstype]
declare Quotient_uint32[transfer_rule]
instantiation uint32 :: "{neg_numeral, Divides.div, comm_monoid_mult, comm_ring}" begin
lift_definition zero_uint32 :: uint32 is "0 :: 32 word" .
lift_definition one_uint32 :: uint32 is "1" .
lift_definition plus_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32" is "op + :: 32 word \<Rightarrow> _" .
lift_definition minus_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32" is "op -" .
lift_definition uminus_uint32 :: "uint32 \<Rightarrow> uint32" is uminus .
lift_definition times_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32" is "op *" .
lift_definition div_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32" is "op div" .
lift_definition mod_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32" is "op mod" .
instance by default (transfer, simp add: algebra_simps)+
end
instantiation uint32 :: linorder begin
lift_definition less_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> bool" is "op <" .
lift_definition less_eq_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> bool" is "op \<le>" .
instance by(default)(transfer, simp add: less_le_not_le linear)+
end
lemmas [code] = less_uint32.rep_eq less_eq_uint32.rep_eq
instantiation uint32 :: bitss begin
lift_definition bitNOT_uint32 :: "uint32 \<Rightarrow> uint32" is bitNOT .
lift_definition bitAND_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32" is bitAND .
lift_definition bitOR_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32" is bitOR .
lift_definition bitXOR_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32" is bitXOR .
lift_definition test_bit_uint32 :: "uint32 \<Rightarrow> nat \<Rightarrow> bool" is test_bit .
lift_definition set_bit_uint32 :: "uint32 \<Rightarrow> nat \<Rightarrow> bool \<Rightarrow> uint32" is set_bit .
lift_definition set_bits_uint32 :: "(nat \<Rightarrow> bool) \<Rightarrow> uint32" is "set_bits" .
lift_definition lsb_uint32 :: "uint32 \<Rightarrow> bool" is lsb .
lift_definition shiftl_uint32 :: "uint32 \<Rightarrow> nat \<Rightarrow> uint32" is shiftl .
lift_definition shiftr_uint32 :: "uint32 \<Rightarrow> nat \<Rightarrow> uint32" is shiftr .
lift_definition msb_uint32 :: "uint32 \<Rightarrow> bool" is msb .
instance ..
end
lemmas [code] = test_bit_uint32.rep_eq lsb_uint32.rep_eq msb_uint32.rep_eq
instantiation uint32 :: equal begin
lift_definition equal_uint32 :: "uint32 \<Rightarrow> uint32 \<Rightarrow> bool" is "equal_class.equal" .
instance by default(transfer, simp add: equal_eq)
end
lemmas [code] = equal_uint32.rep_eq
instantiation uint32 :: size begin
lift_definition size_uint32 :: "uint32 \<Rightarrow> nat" is "size" .
instance ..
end
lemmas [code] = size_uint32.rep_eq
lift_definition sshiftr_uint32 :: "uint32 \<Rightarrow> nat \<Rightarrow> uint32" (infixl ">>>" 55) is sshiftr .
lift_definition uint32_of_int :: "int \<Rightarrow> uint32" is "word_of_int" .
definition uint32_of_nat :: "nat \<Rightarrow> uint32"
where "uint32_of_nat = uint32_of_int \<circ> int"
lift_definition int_of_uint32 :: "uint32 \<Rightarrow> int" is "uint" .
lift_definition nat_of_uint32 :: "uint32 \<Rightarrow> nat" is "unat" .
definition integer_of_uint32 :: "uint32 \<Rightarrow> integer"
where "integer_of_uint32 = integer_of_int o int_of_uint32"
lemma bitval_integer_transfer [transfer_rule]:
"(rel_fun op = pcr_integer) of_bool of_bool"
by(auto simp add: of_bool_def integer.pcr_cr_eq cr_integer_def split: bit.split)
text {* Use pretty numerals from integer for pretty printing *}
context includes integer.lifting begin
lift_definition Uint32 :: "integer \<Rightarrow> uint32" is "word_of_int" .
lemma Rep_uint32_numeral [simp]: "Rep_uint32 (numeral n) = numeral n"
by(induction n)(simp_all add: one_uint32_def Abs_uint32_inverse numeral.simps plus_uint32_def)
lemma numeral_uint32_transfer [transfer_rule]:
"(rel_fun op = cr_uint32) numeral numeral"
by(auto simp add: cr_uint32_def)
lemma numeral_uint32 [code_unfold]: "numeral n = Uint32 (numeral n)"
by transfer simp
lemma Rep_uint32_neg_numeral [simp]: "Rep_uint32 (- numeral n) = - numeral n"
by(simp only: uminus_uint32_def)(simp add: Abs_uint32_inverse)
lemma neg_numeral_uint32 [code_unfold]: "- numeral n = Uint32 (- numeral n)"
by transfer(simp add: cr_uint32_def)
end
lemma Abs_uint32_numeral [code_post]: "Abs_uint32 (numeral n) = numeral n"
by(induction n)(simp_all add: one_uint32_def numeral.simps plus_uint32_def Abs_uint32_inverse)
lemma Abs_uint32_0 [code_post]: "Abs_uint32 0 = 0"
by(simp add: zero_uint32_def)
lemma Abs_uint32_1 [code_post]: "Abs_uint32 1 = 1"
by(simp add: one_uint32_def)
section {* Code setup *}
code_printing code_module Uint32 \<rightharpoonup> (SML)
{*(* Test that words can handle numbers between 0 and 31 *)
val _ = if 5 <= Word.wordSize then () else raise (Fail ("wordSize less than 5"));
structure Uint32 : sig
val set_bit : Word32.word -> IntInf.int -> bool -> Word32.word
val shiftl : Word32.word -> IntInf.int -> Word32.word
val shiftr : Word32.word -> IntInf.int -> Word32.word
val shiftr_signed : Word32.word -> IntInf.int -> Word32.word
val test_bit : Word32.word -> IntInf.int -> bool
end = struct
fun set_bit x n b =
let val mask = Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n))
in if b then Word32.orb (x, mask)
else Word32.andb (x, Word32.notb mask)
end
fun shiftl x n =
Word32.<< (x, Word.fromLargeInt (IntInf.toLarge n))
fun shiftr x n =
Word32.>> (x, Word.fromLargeInt (IntInf.toLarge n))
fun shiftr_signed x n =
Word32.~>> (x, Word.fromLargeInt (IntInf.toLarge n))
fun test_bit x n =
Word32.andb (x, Word32.<< (0wx1, Word.fromLargeInt (IntInf.toLarge n))) <> Word32.fromInt 0
end; (* struct Uint32 *)*}
code_reserved SML Uint32
code_printing code_module Uint32 \<rightharpoonup> (Haskell)
{*import qualified Data.Word;
import qualified Data.Int;
type Int32 = Data.Int.Int32;
type Word32 = Data.Word.Word32;*}
code_reserved Haskell Uint32
text {*
OCaml and Scala provide only signed 32bit numbers, so we use these and
implement sign-sensitive operations like comparisons manually.
*}
code_printing code_module "Uint32" \<rightharpoonup> (OCaml)
{*module Uint32 : sig
val less : int32 -> int32 -> bool
val less_eq : int32 -> int32 -> bool
val set_bit : int32 -> Big_int.big_int -> bool -> int32
val shiftl : int32 -> Big_int.big_int -> int32
val shiftr : int32 -> Big_int.big_int -> int32
val shiftr_signed : int32 -> Big_int.big_int -> int32
val test_bit : int32 -> Big_int.big_int -> bool
end = struct
(* negative numbers have their highest bit set,
so they are greater than positive ones *)
let less x y =
if Int32.compare x Int32.zero < 0 then
Int32.compare y Int32.zero < 0 && Int32.compare x y < 0
else Int32.compare y Int32.zero < 0 || Int32.compare x y < 0;;
let less_eq x y =
if Int32.compare x Int32.zero < 0 then
Int32.compare y Int32.zero < 0 && Int32.compare x y <= 0
else Int32.compare y Int32.zero < 0 || Int32.compare x y <= 0;;
let set_bit x n b =
let mask = Int32.shift_left Int32.one (Big_int.int_of_big_int n)
in if b then Int32.logor x mask
else Int32.logand x (Int32.lognot mask);;
let shiftl x n = Int32.shift_left x (Big_int.int_of_big_int n);;
let shiftr x n = Int32.shift_right_logical x (Big_int.int_of_big_int n);;
let shiftr_signed x n = Int32.shift_right x (Big_int.int_of_big_int n);;
let test_bit x n =
Int32.compare
(Int32.logand x (Int32.shift_left Int32.one (Big_int.int_of_big_int n)))
Int32.zero
<> 0;;
end;; (*struct Uint32*)*}
code_reserved OCaml Uint32
code_printing code_module Uint32 \<rightharpoonup> (Scala)
{*object Uint32 {
def less(x: Int, y: Int) : Boolean =
if (x < 0) y < 0 && x < y
else y < 0 || x < y
def less_eq(x: Int, y: Int) : Boolean =
if (x < 0) y < 0 && x <= y
else y < 0 || x <= y
def set_bit(x: Int, n: BigInt, b: Boolean) : Int =
if (b)
x | (1 << n.intValue)
else
x & (1 << n.intValue).unary_~
def shiftl(x: Int, n: BigInt) : Int = x << n.intValue
def shiftr(x: Int, n: BigInt) : Int = x >>> n.intValue
def shiftr_signed(x: Int, n: BigInt) : Int = x >> n.intValue
def test_bit(x: Int, n: BigInt) : Boolean =
(x & (1 << n.intValue)) != 0
} /* object Uint32 */*}
code_reserved Scala Uint32
text {*
OCaml's conversion from Big\_int to int32 demands that the value fits int a signed 32-bit integer.
The following justifies the implementation.
*}
definition Uint32_signed :: "integer \<Rightarrow> uint32"
where "Uint32_signed i = (if i < -(0x80000000) \<or> i \<ge> 0x80000000 then undefined Uint32 i else Uint32 i)"
lemma Uint32_code [code]:
"Uint32 i =
(let i' = i AND 0xFFFFFFFF
in if i' !! 31 then Uint32_signed (i' - 0x100000000) else Uint32_signed i')"
including undefined_transfer integer.lifting unfolding Uint32_signed_def
by transfer(rule word_of_int_via_signed, simp_all add: bin_mask_numeral)
lemma Uint32_signed_code [code abstract]:
"Rep_uint32 (Uint32_signed i) =
(if i < -(0x80000000) \<or> i \<ge> 0x80000000 then Rep_uint32 (undefined Uint32 i) else word_of_int (int_of_integer_symbolic i))"
unfolding Uint32_signed_def Uint32_def int_of_integer_symbolic_def word_of_integer_def
by(simp add: Abs_uint32_inverse)
text {*
Avoid @{term Abs_uint32} in generated code, use @{term Rep_uint32'} instead.
The symbolic implementations for code\_simp use @{term Rep_uint32}.
The new destructor @{term Rep_uint32'} is executable.
As the simplifier is given the [code abstract] equations literally,
we cannot implement @{term Rep_uint32} directly, because that makes code\_simp loop.
If code generation raises Match, some equation probably contains @{term Rep_uint32}
([code abstract] equations for @{typ uint32} may use @{term Rep_uint32} because
these instances will be folded away.)
To convert @{typ "32 word"} values into @{typ uint32}, use @{term "Abs_uint32'"}.
*}
definition Rep_uint32' where [simp]: "Rep_uint32' = Rep_uint32"
lemma Rep_uint32'_transfer [transfer_rule]:
"rel_fun cr_uint32 op = (\<lambda>x. x) Rep_uint32'"
unfolding Rep_uint32'_def by(rule uint32.rep_transfer)
lemma Rep_uint32'_code [code]: "Rep_uint32' x = (BITS n. x !! n)"
by transfer simp
lift_definition Abs_uint32' :: "32 word \<Rightarrow> uint32" is "\<lambda>x :: 32 word. x" .
lemma Abs_uint32'_code [code]:
"Abs_uint32' x = Uint32 (integer_of_int (uint x))"
including integer.lifting by transfer simp
lemma [code, code del]: "term_of_class.term_of = (term_of_class.term_of :: uint32 \<Rightarrow> _)" ..
lemma term_of_uint32_code [code]:
defines "TR \<equiv> typerep.Typerep" and "bit0 \<equiv> STR ''Numeral_Type.bit0''"
shows
"term_of_class.term_of x =
Code_Evaluation.App (Code_Evaluation.Const (STR ''Uint32.Abs_uint32'') (TR (STR ''fun'') [TR (STR ''Word.word'') [TR bit0 [TR bit0 [TR bit0 [TR bit0 [TR bit0 [TR (STR ''Numeral_Type.num1'') []]]]]]], TR (STR ''Uint32.uint32'') []]))
(term_of_class.term_of (Rep_uint32' x))"
by(simp add: term_of_anything)
code_printing
type_constructor uint32 \<rightharpoonup>
(SML) "Word32.word" and
(Haskell) "Uint32.Word32" and
(OCaml) "int32" and
(Scala) "Int" and
(Eval) "Word32.word"
| constant Uint32 \<rightharpoonup>
(SML) "Word32.fromLargeInt (IntInf.toLarge _)" and
(Haskell) "(Prelude.fromInteger _ :: Uint32.Word32)" and
(Haskell_Quickcheck) "(Prelude.fromInteger (Prelude.toInteger _) :: Uint32.Word32)" and
(Scala) "_.intValue"
| constant Uint32_signed \<rightharpoonup>
(OCaml) "Big'_int.int32'_of'_big'_int"
| constant "0 :: uint32" \<rightharpoonup>
(SML) "(Word32.fromInt 0)" and
(Haskell) "(0 :: Uint32.Word32)" and
(OCaml) "Int32.zero" and
(Scala) "0"
| constant "1 :: uint32" \<rightharpoonup>
(SML) "(Word32.fromInt 1)" and
(Haskell) "(1 :: Uint32.Word32)" and
(OCaml) "Int32.one" and
(Scala) "1"
| constant "plus :: uint32 \<Rightarrow> _ " \<rightharpoonup>
(SML) "Word32.+ ((_), (_))" and
(Haskell) infixl 6 "+" and
(OCaml) "Int32.add" and
(Scala) infixl 7 "+"
| constant "uminus :: uint32 \<Rightarrow> _" \<rightharpoonup>
(SML) "Word32.~" and
(Haskell) "negate" and
(OCaml) "Int32.neg" and
(Scala) "!(- _)"
| constant "minus :: uint32 \<Rightarrow> _" \<rightharpoonup>
(SML) "Word32.- ((_), (_))" and
(Haskell) infixl 6 "-" and
(OCaml) "Int32.sub" and
(Scala) infixl 7 "-"
| constant "times :: uint32 \<Rightarrow> _ \<Rightarrow> _" \<rightharpoonup>
(SML) "Word32.* ((_), (_))" and
(Haskell) infixl 7 "*" and
(OCaml) "Int32.mul" and
(Scala) infixl 8 "*"
| constant "HOL.equal :: uint32 \<Rightarrow> _ \<Rightarrow> bool" \<rightharpoonup>
(SML) "!((_ : Word32.word) = _)" and
(Haskell) infix 4 "==" and
(OCaml) "(Int32.compare _ _ = 0)" and
(Scala) infixl 5 "=="
| class_instance uint32 :: equal \<rightharpoonup>
(Haskell) -
| constant "less_eq :: uint32 \<Rightarrow> _ \<Rightarrow> bool" \<rightharpoonup>
(SML) "Word32.<= ((_), (_))" and
(Haskell) infix 4 "<=" and
(OCaml) "Uint32.less'_eq" and
(Scala) "Uint32.less'_eq"
| constant "less :: uint32 \<Rightarrow> _ \<Rightarrow> bool" \<rightharpoonup>
(SML) "Word32.< ((_), (_))" and
(Haskell) infix 4 "<" and
(OCaml) "Uint32.less" and
(Scala) "Uint32.less"
| constant "bitNOT :: uint32 \<Rightarrow> _" \<rightharpoonup>
(SML) "Word32.notb" and
(Haskell) "Data'_Bits.complement" and
(OCaml) "Int32.lognot" and
(Scala) "_.unary'_~"
| constant "bitAND :: uint32 \<Rightarrow> _" \<rightharpoonup>
(SML) "Word32.andb ((_),/ (_))" and
(Haskell) infixl 7 "Data_Bits..&." and
(OCaml) "Int32.logand" and
(Scala) infixl 3 "&"
| constant "bitOR :: uint32 \<Rightarrow> _" \<rightharpoonup>
(SML) "Word32.orb ((_),/ (_))" and
(Haskell) infixl 5 "Data_Bits..|." and
(OCaml) "Int32.logor" and
(Scala) infixl 1 "|"
| constant "bitXOR :: uint32 \<Rightarrow> _" \<rightharpoonup>
(SML) "Word32.xorb ((_),/ (_))" and
(Haskell) "Data'_Bits.xor" and
(OCaml) "Int32.logxor" and
(Scala) infixl 2 "^"
definition uint32_divmod :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32 \<times> uint32" where
"uint32_divmod x y =
(if y = 0 then (undefined (op div :: uint32 \<Rightarrow> _) x (0 :: uint32), undefined (op mod :: uint32 \<Rightarrow> _) x (0 :: uint32))
else (x div y, x mod y))"
definition uint32_div :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32"
where "uint32_div x y = fst (uint32_divmod x y)"
definition uint32_mod :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32"
where "uint32_mod x y = snd (uint32_divmod x y)"
lemma div_uint32_code [code]: "x div y = (if y = 0 then 0 else uint32_div x y)"
including undefined_transfer unfolding uint32_divmod_def uint32_div_def
by transfer(simp add: word_div_def)
lemma mod_uint32_code [code]: "x mod y = (if y = 0 then x else uint32_mod x y)"
including undefined_transfer unfolding uint32_mod_def uint32_divmod_def
by transfer(simp add: word_mod_def)
definition uint32_sdiv :: "uint32 \<Rightarrow> uint32 \<Rightarrow> uint32"
where [code del]:
"uint32_sdiv x y =
(if y = 0 then undefined (op div :: uint32 \<Rightarrow> _) x (0 :: uint32)
else Abs_uint32 (Rep_uint32 x sdiv Rep_uint32 y))"
definition div0_uint32 :: "uint32 \<Rightarrow> uint32"
where [code del]: "div0_uint32 x = undefined (op div :: uint32 \<Rightarrow> _) x (0 :: uint32)"
declare [[code abort: div0_uint32]]
definition mod0_uint32 :: "uint32 \<Rightarrow> uint32"
where [code del]: "mod0_uint32 x = undefined (op mod :: uint32 \<Rightarrow> _) x (0 :: uint32)"
declare [[code abort: mod0_uint32]]
lemma uint32_divmod_code [code]:
"uint32_divmod x y =
(if 0x80000000 \<le> y then if x < y then (0, x) else (1, x - y)
else if y = 0 then (div0_uint32 x, mod0_uint32 x)
else let q = (uint32_sdiv (x >> 1) y) << 1;
r = x - q * y
in if r \<ge> y then (q + 1, r - y) else (q, r))"
including undefined_transfer unfolding uint32_divmod_def uint32_sdiv_def div0_uint32_def mod0_uint32_def
by transfer(simp add: divmod_via_sdivmod)
lemma uint32_sdiv_code [code abstract]:
"Rep_uint32 (uint32_sdiv x y) =
(if y = 0 then Rep_uint32 (undefined (op div :: uint32 \<Rightarrow> _) x (0 :: uint32))
else Rep_uint32 x sdiv Rep_uint32 y)"
unfolding uint32_sdiv_def by(simp add: Abs_uint32_inverse)
text {*
Note that we only need a translation for signed division, but not for the remainder
because @{thm uint32_divmod_code} computes both with division only.
*}
code_printing
constant uint32_div \<rightharpoonup>
(SML) "Word32.div ((_), (_))" and
(Haskell) "Prelude.div"
| constant uint32_mod \<rightharpoonup>
(SML) "Word32.mod ((_), (_))" and
(Haskell) "Prelude.mod"
| constant uint32_divmod \<rightharpoonup>
(Haskell) "divmod"
| constant uint32_sdiv \<rightharpoonup>
(OCaml) "Int32.div" and
(Scala) "_ '/ _"
definition uint32_test_bit :: "uint32 \<Rightarrow> integer \<Rightarrow> bool"
where [code del]:
"uint32_test_bit x n =
(if n < 0 \<or> 31 < n then undefined (test_bit :: uint32 \<Rightarrow> _) x n
else x !! (nat_of_integer n))"
lemma test_bit_uint32_code [code]:
"test_bit x n \<longleftrightarrow> n < 32 \<and> uint32_test_bit x (integer_of_nat n)"
including undefined_transfer integer.lifting unfolding uint32_test_bit_def
by transfer(auto cong: conj_cong dest: test_bit_size simp add: word_size)
lemma uint32_test_bit_code [code]:
"uint32_test_bit w n =
(if n < 0 \<or> 31 < n then undefined (test_bit :: uint32 \<Rightarrow> _) w n else Rep_uint32 w !! nat_of_integer n)"
unfolding uint32_test_bit_def
by(simp add: test_bit_uint32.rep_eq)
code_printing constant uint32_test_bit \<rightharpoonup>
(SML) "Uint32.test'_bit" and
(Haskell) "Data'_Bits.testBitBounded" and
(OCaml) "Uint32.test'_bit" and
(Scala) "Uint32.test'_bit"
definition uint32_set_bit :: "uint32 \<Rightarrow> integer \<Rightarrow> bool \<Rightarrow> uint32"
where [code del]:
"uint32_set_bit x n b =
(if n < 0 \<or> 31 < n then undefined (set_bit :: uint32 \<Rightarrow> _) x n b
else set_bit x (nat_of_integer n) b)"
lemma set_bit_uint32_code [code]:
"set_bit x n b = (if n < 32 then uint32_set_bit x (integer_of_nat n) b else x)"
including undefined_transfer integer.lifting unfolding uint32_set_bit_def
by(transfer)(auto cong: conj_cong simp add: not_less set_bit_beyond word_size)
lemma uint32_set_bit_code [code abstract]:
"Rep_uint32 (uint32_set_bit w n b) =
(if n < 0 \<or> 31 < n then Rep_uint32 (undefined (set_bit :: uint32 \<Rightarrow> _) w n b)
else set_bit (Rep_uint32 w) (nat_of_integer n) b)"
including undefined_transfer unfolding uint32_set_bit_def by transfer simp
code_printing constant uint32_set_bit \<rightharpoonup>
(SML) "Uint32.set'_bit" and
(Haskell) "Data'_Bits.setBitBounded" and
(OCaml) "Uint32.set'_bit" and
(Scala) "Uint32.set'_bit"
lift_definition uint32_set_bits :: "(nat \<Rightarrow> bool) \<Rightarrow> uint32 \<Rightarrow> nat \<Rightarrow> uint32" is set_bits_aux .
lemma uint32_set_bits_code [code]:
"uint32_set_bits f w n =
(if n = 0 then w
else let n' = n - 1 in uint32_set_bits f ((w << 1) OR (if f n' then 1 else 0)) n')"
by(transfer fixing: n)(cases n, simp_all)
lemma set_bits_uint32 [code]:
"(BITS n. f n) = uint32_set_bits f 0 32"
by transfer(simp add: set_bits_conv_set_bits_aux)
lemma lsb_code [code]: fixes x :: uint32 shows "lsb x = x !! 0"
by transfer(simp add: word_lsb_def word_test_bit_def)
definition uint32_shiftl :: "uint32 \<Rightarrow> integer \<Rightarrow> uint32"
where [code del]:
"uint32_shiftl x n = (if n < 0 \<or> 32 \<le> n then undefined (shiftl :: uint32 \<Rightarrow> _) x n else x << (nat_of_integer n))"
lemma shiftl_uint32_code [code]: "x << n = (if n < 32 then uint32_shiftl x (integer_of_nat n) else 0)"
including undefined_transfer integer.lifting unfolding uint32_shiftl_def
by transfer(simp add: not_less shiftl_zero_size word_size)
lemma uint32_shiftl_code [code abstract]:
"Rep_uint32 (uint32_shiftl w n) =
(if n < 0 \<or> 32 \<le> n then Rep_uint32 (undefined (shiftl :: uint32 \<Rightarrow> _) w n) else Rep_uint32 w << (nat_of_integer n))"
including undefined_transfer unfolding uint32_shiftl_def by transfer simp
code_printing constant uint32_shiftl \<rightharpoonup>
(SML) "Uint32.shiftl" and
(Haskell) "Data'_Bits.shiftlBounded" and
(OCaml) "Uint32.shiftl" and
(Scala) "Uint32.shiftl"
definition uint32_shiftr :: "uint32 \<Rightarrow> integer \<Rightarrow> uint32"
where [code del]:
"uint32_shiftr x n = (if n < 0 \<or> 32 \<le> n then undefined (shiftr :: uint32 \<Rightarrow> _) x n else x >> (nat_of_integer n))"
lemma shiftr_uint32_code [code]: "x >> n = (if n < 32 then uint32_shiftr x (integer_of_nat n) else 0)"
including undefined_transfer integer.lifting unfolding uint32_shiftr_def
by transfer(simp add: not_less shiftr_zero_size word_size)
lemma uint32_shiftr_code [code abstract]:
"Rep_uint32 (uint32_shiftr w n) =
(if n < 0 \<or> 32 \<le> n then Rep_uint32 (undefined (shiftr :: uint32 \<Rightarrow> _) w n) else Rep_uint32 w >> nat_of_integer n)"
including undefined_transfer unfolding uint32_shiftr_def by transfer simp
code_printing constant uint32_shiftr \<rightharpoonup>
(SML) "Uint32.shiftr" and
(Haskell) "Data'_Bits.shiftrBounded" and
(OCaml) "Uint32.shiftr" and
(Scala) "Uint32.shiftr"
definition uint32_sshiftr :: "uint32 \<Rightarrow> integer \<Rightarrow> uint32"
where [code del]:
"uint32_sshiftr x n =
(if n < 0 \<or> 32 \<le> n then undefined sshiftr_uint32 x n else sshiftr_uint32 x (nat_of_integer n))"
lemma sshiftr_beyond: fixes x :: "'a :: len word" shows
"size x \<le> n \<Longrightarrow> x >>> n = (if x !! (size x - 1) then -1 else 0)"
by(rule word_eqI)(simp add: nth_sshiftr word_size)
lemma sshiftr_uint32_code [code]:
"x >>> n =
(if n < 32 then uint32_sshiftr x (integer_of_nat n) else if x !! 31 then -1 else 0)"
including undefined_transfer integer.lifting unfolding uint32_sshiftr_def
by transfer(simp add: not_less sshiftr_beyond word_size)
lemma uint32_sshiftr_code [code abstract]:
"Rep_uint32 (uint32_sshiftr w n) =
(if n < 0 \<or> 32 \<le> n then Rep_uint32 (undefined sshiftr_uint32 w n) else Rep_uint32 w >>> (nat_of_integer n))"
including undefined_transfer unfolding uint32_sshiftr_def by transfer simp
code_printing constant uint32_sshiftr \<rightharpoonup>
(SML) "Uint32.shiftr'_signed" and
(Haskell)
"(Prelude.fromInteger (Prelude.toInteger (Data'_Bits.shiftrBounded (Prelude.fromInteger (Prelude.toInteger _) :: Uint32.Int32) _)) :: Uint32.Word32)" and
(OCaml) "Uint32.shiftr'_signed" and
(Scala) "Uint32.shiftr'_signed"
lemma uint32_msb_test_bit: "msb x \<longleftrightarrow> (x :: uint32) !! 31"
by transfer(simp add: msb_nth)
lemma msb_uint32_code [code]: "msb x \<longleftrightarrow> uint32_test_bit x 31"
by(simp add: uint32_test_bit_def uint32_msb_test_bit)
lemma uint32_of_int_code [code]: "uint32_of_int i = Uint32 (integer_of_int i)"
including integer.lifting by transfer simp
lemma int_of_uint32_code [code]:
"int_of_uint32 x = int_of_integer (integer_of_uint32 x)"
by(simp add: integer_of_uint32_def)
lemma nat_of_uint32_code [code]:
"nat_of_uint32 x = nat_of_integer (integer_of_uint32 x)"
unfolding integer_of_uint32_def including integer.lifting by transfer (simp add: unat_def)
definition integer_of_uint32_signed :: "uint32 \<Rightarrow> integer"
where
"integer_of_uint32_signed n = (if n !! 31 then undefined integer_of_uint32 n else integer_of_uint32 n)"
lemma integer_of_uint32_signed_code [code]:
"integer_of_uint32_signed n =
(if n !! 31 then undefined integer_of_uint32 n else integer_of_int (uint (Rep_uint32' n)))"
unfolding integer_of_uint32_signed_def integer_of_uint32_def
including undefined_transfer by transfer simp
lemma integer_of_uint32_code [code]:
"integer_of_uint32 n =
(if n !! 31 then integer_of_uint32_signed (n AND 0x7FFFFFFF) OR 0x80000000 else integer_of_uint32_signed n)"
unfolding integer_of_uint32_def integer_of_uint32_signed_def o_def
including undefined_transfer integer.lifting
by transfer(auto simp add: word_ao_nth uint_and_mask_or_full mask_numeral mask_Suc_0 intro!: uint_and_mask_or_full[symmetric])
code_printing
constant "integer_of_uint32" \<rightharpoonup>
(SML) "IntInf.fromLarge (Word32.toLargeInt _) : IntInf.int" and
(Haskell) "Prelude.toInteger"
| constant "integer_of_uint32_signed" \<rightharpoonup>
(OCaml) "Big'_int.big'_int'_of'_int32" and
(Scala) "BigInt"
section {* Quickcheck setup *}
definition uint32_of_natural :: "natural \<Rightarrow> uint32"
where "uint32_of_natural x \<equiv> Uint32 (integer_of_natural x)"
instantiation uint32 :: "{random, exhaustive, full_exhaustive}" begin
definition "random_uint32 \<equiv> qc_random_cnv uint32_of_natural"
definition "exhaustive_uint32 \<equiv> qc_exhaustive_cnv uint32_of_natural"
definition "full_exhaustive_uint32 \<equiv> qc_full_exhaustive_cnv uint32_of_natural"
instance ..
end
instantiation uint32 :: narrowing begin
interpretation quickcheck_narrowing_samples
"\<lambda>i. let x = Uint32 i in (x, 0xFFFFFFFF - x)" "0"
"Typerep.Typerep (STR ''Uint32.uint32'') []" .
definition "narrowing_uint32 d = qc_narrowing_drawn_from (narrowing_samples d) d"
declare [[code drop: "partial_term_of :: uint32 itself \<Rightarrow> _"]]
lemmas partial_term_of_uint32 [code] = partial_term_of_code
instance ..
end
no_notation sshiftr_uint32 (infixl ">>>" 55)
end
|
import numpy as np
from scipy import constants
from siliconproperties.python_files.getMobility import get_mobility
def get_resistivity(n_eff, is_n_type=True, temperature=300, e_field=1e3):
# Calculate the resitivity from:
# The effective doping concentration n_eff [10^12 / cm^3]
# the mobility [cm^2/Vs]
# for n- and p-type silicon.
#
# The mobility istself is a
# function of the temperature [K] and the electric field [V/cm].
# From http://ecee.colorado.edu/~bart/book/mobility.htm
# TODO: If you take the mobility[E_field] equation seriously, then there is no constant
# resitivity since the mobility depends also on the electric field. For low E-Fields <= 1000 V/cm
# the mobility is independent of the E flied and thus the resistivity. Likely this parameter
# is always given in low field approximation?! Source needed!
mobility = get_mobility(e_field, temperature, is_electron=is_n_type)
return 1. / (constants.e * n_eff * mobility * 1e12)
if __name__ == '__main__':
import matplotlib.pylab as plt
n_eff = np.logspace(11., 15., 1000.)
# Plot trapping rate (1 / s)
plt.plot(n_eff, get_resistivity(n_eff / 1e12, is_n_type=True), label='n-type')
plt.plot(n_eff, get_resistivity(n_eff / 1e12, is_n_type=False), label='p-type')
plt.title('Resistivity of silicon (low e-field approximation)')
plt.xlabel('Effective doping concentration [$\mathrm{cm^3}}$]')
plt.ylabel('Resistivity [$\mathrm{\Omega - cm}$]')
plt.legend(loc=0)
plt.xscale('log')
plt.yscale('log')
plt.grid()
plt.savefig('Resistivity.pdf', layout='tight')
plt.show()
|
(* Title: The Applicative Recursive Path Order for Lambda-Free Higher-Order Terms
Author: Jasmin Blanchette <jasmin.blanchette at inria.fr>, 2016
Maintainer: Jasmin Blanchette <jasmin.blanchette at inria.fr>
*)
section \<open>The Applicative Recursive Path Order for Lambda-Free Higher-Order Terms\<close>
theory Lambda_Free_RPO_App
imports Lambda_Free_Term Extension_Orders
abbrevs ">t" = ">\<^sub>t"
and "\<ge>t" = "\<ge>\<^sub>t"
begin
text \<open>
This theory defines the applicative recursive path order (RPO), a variant of RPO
for \<open>\<lambda>\<close>-free higher-order terms. It corresponds to the order obtained by
applying the standard first-order RPO on the applicative encoding of higher-order
terms and assigning the lowest precedence to the application symbol.
\<close>
locale rpo_app = gt_sym "(>\<^sub>s)"
for gt_sym :: "'s \<Rightarrow> 's \<Rightarrow> bool" (infix ">\<^sub>s" 50) +
fixes ext :: "(('s, 'v) tm \<Rightarrow> ('s, 'v) tm \<Rightarrow> bool) \<Rightarrow> ('s, 'v) tm list \<Rightarrow> ('s, 'v) tm list \<Rightarrow> bool"
assumes
ext_ext_trans_before_irrefl: "ext_trans_before_irrefl ext" and
ext_ext_compat_list: "ext_compat_list ext"
begin
lemma ext_mono[mono]: "gt \<le> gt' \<Longrightarrow> ext gt \<le> ext gt'"
by (simp add: ext.mono ext_ext_compat_list[unfolded ext_compat_list_def, THEN conjunct1])
inductive gt :: "('s, 'v) tm \<Rightarrow> ('s, 'v) tm \<Rightarrow> bool" (infix ">\<^sub>t" 50) where
gt_sub: "is_App t \<Longrightarrow> (fun t >\<^sub>t s \<or> fun t = s) \<or> (arg t >\<^sub>t s \<or> arg t = s) \<Longrightarrow> t >\<^sub>t s"
| gt_sym_sym: "g >\<^sub>s f \<Longrightarrow> Hd (Sym g) >\<^sub>t Hd (Sym f)"
| gt_sym_app: "Hd (Sym g) >\<^sub>t s1 \<Longrightarrow> Hd (Sym g) >\<^sub>t s2 \<Longrightarrow> Hd (Sym g) >\<^sub>t App s1 s2"
| gt_app_app: "ext (>\<^sub>t) [t1, t2] [s1, s2] \<Longrightarrow> App t1 t2 >\<^sub>t s1 \<Longrightarrow> App t1 t2 >\<^sub>t s2 \<Longrightarrow>
App t1 t2 >\<^sub>t App s1 s2"
abbreviation ge :: "('s, 'v) tm \<Rightarrow> ('s, 'v) tm \<Rightarrow> bool" (infix "\<ge>\<^sub>t" 50) where
"t \<ge>\<^sub>t s \<equiv> t >\<^sub>t s \<or> t = s"
end
end
|
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ 𝟙 X✝ ≫ f = f
[PROOFSTEP]
simp [dite_comp]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ f ≫ 𝟙 Y✝ = f
[PROOFSTEP]
simp [comp_dite]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
W✝ X✝ Y✝ Z✝ : Mat_ C
f : W✝ ⟶ X✝
g : X✝ ⟶ Y✝
h : Y✝ ⟶ Z✝
⊢ (f ≫ g) ≫ h = f ≫ g ≫ h
[PROOFSTEP]
apply DMatrix.ext
[GOAL]
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
W✝ X✝ Y✝ Z✝ : Mat_ C
f : W✝ ⟶ X✝
g : X✝ ⟶ Y✝
h : Y✝ ⟶ Z✝
⊢ ∀ (i : W✝.ι) (j : Z✝.ι), ((f ≫ g) ≫ h) i j = (f ≫ g ≫ h) i j
[PROOFSTEP]
intros
[GOAL]
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
W✝ X✝ Y✝ Z✝ : Mat_ C
f : W✝ ⟶ X✝
g : X✝ ⟶ Y✝
h : Y✝ ⟶ Z✝
i✝ : W✝.ι
j✝ : Z✝.ι
⊢ ((f ≫ g) ≫ h) i✝ j✝ = (f ≫ g ≫ h) i✝ j✝
[PROOFSTEP]
simp_rw [Hom.comp, sum_comp, comp_sum, Category.assoc]
[GOAL]
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
W✝ X✝ Y✝ Z✝ : Mat_ C
f : W✝ ⟶ X✝
g : X✝ ⟶ Y✝
h : Y✝ ⟶ Z✝
i✝ : W✝.ι
j✝ : Z✝.ι
⊢ ∑ x : Y✝.ι, ∑ x_1 : X✝.ι, f i✝ x_1 ≫ g x_1 x ≫ h x j✝ = ∑ x : X✝.ι, ∑ j : Y✝.ι, f i✝ x ≫ g x j ≫ h j j✝
[PROOFSTEP]
rw [Finset.sum_comm]
-- porting note: added because `DMatrix.ext` is not triggered automatically
-- See https://github.com/leanprover-community/mathlib4/issues/5229
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i : M.ι
⊢ 𝟙 M i i = 𝟙 (X M i)
[PROOFSTEP]
simp [id_apply]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
h : i ≠ j
⊢ 𝟙 M i j = 0
[PROOFSTEP]
simp [id_apply, h]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M N : Mat_ C
⊢ AddCommGroup (M ⟶ N)
[PROOFSTEP]
change AddCommGroup (DMatrix M.ι N.ι _)
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M N : Mat_ C
⊢ AddCommGroup (DMatrix M.ι N.ι fun i j => (fun i j => X M i ⟶ X N j) i j)
[PROOFSTEP]
infer_instance
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M N K : Mat_ C
f f' : M ⟶ N
g : N ⟶ K
⊢ (f + f') ≫ g = f ≫ g + f' ≫ g
[PROOFSTEP]
ext
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M N K : Mat_ C
f f' : M ⟶ N
g : N ⟶ K
i✝ : M.ι
j✝ : K.ι
⊢ ((f + f') ≫ g) i✝ j✝ = (f ≫ g + f' ≫ g) i✝ j✝
[PROOFSTEP]
simp [Finset.sum_add_distrib]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M N K : Mat_ C
f : M ⟶ N
g g' : N ⟶ K
⊢ f ≫ (g + g') = f ≫ g + f ≫ g'
[PROOFSTEP]
ext
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M N K : Mat_ C
f : M ⟶ N
g g' : N ⟶ K
i✝ : M.ι
j✝ : K.ι
⊢ (f ≫ (g + g')) i✝ j✝ = (f ≫ g + f ≫ g') i✝ j✝
[PROOFSTEP]
simp [Finset.sum_add_distrib]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
y : (f j).ι
⊢ (fun i j_1 => X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) i ⟶ X (f j) j_1) x y
[PROOFSTEP]
refine' if h : x.1 = j then _ else 0
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
y : (f j).ι
h : x.fst = j
⊢ (fun i j_1 => X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) i ⟶ X (f j) j_1) x y
[PROOFSTEP]
refine' if h' : @Eq.ndrec (Fin n) x.1 (fun j => (f j).ι) x.2 _ h = y then _ else 0
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
y : (f j).ι
h : x.fst = j
h' : h ▸ x.snd = y
⊢ (fun i j_1 => X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) i ⟶ X (f j) j_1) x y
[PROOFSTEP]
apply eqToHom
[GOAL]
case p
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
y : (f j).ι
h : x.fst = j
h' : h ▸ x.snd = y
⊢ X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) x = X (f j) y
[PROOFSTEP]
substs h h'
[GOAL]
case p
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
x : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
⊢ X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) x = X (f x.fst) ((_ : x.fst = x.fst) ▸ x.snd)
[PROOFSTEP]
rfl
-- Notice we were careful not to use `subst` until we had a goal in `Prop`.
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (f j).ι
y : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
⊢ (fun i j_1 => X (f j) i ⟶ X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) j_1) x y
[PROOFSTEP]
refine' if h : y.1 = j then _ else 0
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (f j).ι
y : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
h : y.fst = j
⊢ (fun i j_1 => X (f j) i ⟶ X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) j_1) x y
[PROOFSTEP]
refine' if h' : @Eq.ndrec _ y.1 (fun j => (f j).ι) y.2 _ h = x then _ else 0
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (f j).ι
y : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
h : y.fst = j
h' : h ▸ y.snd = x
⊢ (fun i j_1 => X (f j) i ⟶ X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) j_1) x y
[PROOFSTEP]
apply eqToHom
[GOAL]
case p
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (f j).ι
y : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
h : y.fst = j
h' : h ▸ y.snd = x
⊢ X (f j) x = X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) y
[PROOFSTEP]
substs h h'
[GOAL]
case p
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
y : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι
⊢ X (f y.fst) ((_ : y.fst = y.fst) ▸ y.snd) = X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) y
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
⊢ (fun j x y =>
if h : y.fst = j then
if h' : h ▸ y.snd = x then
eqToHom (_ : X (f j) x = X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) y)
else 0
else 0)
j ≫
(fun j x y =>
if h : x.fst = j then
if h' : h ▸ x.snd = y then
eqToHom (_ : X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) x = X (f j) y)
else 0
else 0)
j' =
if h : j = j' then eqToHom (_ : f j = f j') else 0
[PROOFSTEP]
ext x y
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
⊢ ((fun j x y =>
if h : y.fst = j then
if h' : h ▸ y.snd = x then
eqToHom (_ : X (f j) x = X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) y)
else 0
else 0)
j ≫
(fun j x y =>
if h : x.fst = j then
if h' : h ▸ x.snd = y then
eqToHom (_ : X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) x = X (f j) y)
else 0
else 0)
j')
x y =
dite (j = j') (fun h => eqToHom (_ : f j = f j')) (fun h => 0) x y
[PROOFSTEP]
dsimp
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
⊢ (∑ j_1 : (j : Fin n) × (f j).ι,
(if h : j_1.fst = j then if h' : h ▸ j_1.snd = x then eqToHom (_ : X (f j) x = X (f j_1.fst) j_1.snd) else 0
else 0) ≫
if h : j_1.fst = j' then if h' : h ▸ j_1.snd = y then eqToHom (_ : X (f j_1.fst) j_1.snd = X (f j') y) else 0
else 0) =
dite (j = j') (fun h => eqToHom (_ : f j = f j')) (fun h => 0) x y
[PROOFSTEP]
simp_rw [dite_comp, comp_dite]
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
⊢ (∑ x_1 : (j : Fin n) × (f j).ι,
if h : x_1.fst = j then
if h_1 : (_ : x_1.fst = j) ▸ x_1.snd = x then
if h_2 : x_1.fst = j' then
if h_3 : (_ : x_1.fst = j') ▸ x_1.snd = y then
eqToHom (_ : X (f j) x = X (f x_1.fst) x_1.snd) ≫ eqToHom (_ : X (f x_1.fst) x_1.snd = X (f j') y)
else eqToHom (_ : X (f j) x = X (f x_1.fst) x_1.snd) ≫ 0
else eqToHom (_ : X (f j) x = X (f x_1.fst) x_1.snd) ≫ 0
else
if h : x_1.fst = j' then
if h_2 : (_ : x_1.fst = j') ▸ x_1.snd = y then 0 ≫ eqToHom (_ : X (f x_1.fst) x_1.snd = X (f j') y)
else 0 ≫ 0
else 0 ≫ 0
else
if h : x_1.fst = j' then
if h_1 : (_ : x_1.fst = j') ▸ x_1.snd = y then 0 ≫ eqToHom (_ : X (f x_1.fst) x_1.snd = X (f j') y) else 0 ≫ 0
else 0 ≫ 0) =
dite (j = j') (fun h => eqToHom (_ : f j = f j')) (fun h => 0) x y
[PROOFSTEP]
simp only [ite_self, dite_eq_ite, dif_ctx_congr, Limits.comp_zero, Limits.zero_comp, eqToHom_trans, Finset.sum_congr]
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
⊢ (∑ x_1 : (j : Fin n) × (f j).ι,
if h : x_1.fst = j then
if h_1 : (_ : x_1.fst = j) ▸ x_1.snd = x then
if h_2 : x_1.fst = j' then
if h_3 : (_ : x_1.fst = j') ▸ x_1.snd = y then eqToHom (_ : X (f j) x = X (f j') y) else 0
else 0
else 0
else 0) =
dite (j = j') (fun h => eqToHom (_ : f j = f j')) (fun h => 0) x y
[PROOFSTEP]
erw [Finset.sum_sigma]
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
⊢ (∑ a : Fin n,
∑ s in (fun x => Finset.univ) a,
if h : { fst := a, snd := s }.fst = j then
if h_1 : (_ : { fst := a, snd := s }.fst = j) ▸ { fst := a, snd := s }.snd = x then
if h_2 : { fst := a, snd := s }.fst = j' then
if h_3 : (_ : { fst := a, snd := s }.fst = j') ▸ { fst := a, snd := s }.snd = y then
eqToHom (_ : X (f j) x = X (f j') y)
else 0
else 0
else 0
else 0) =
dite (j = j') (fun h => eqToHom (_ : f j = f j')) (fun h => 0) x y
[PROOFSTEP]
dsimp
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
⊢ (∑ a : Fin n,
∑ s : (f a).ι,
if h : a = j then
if h_1 : (_ : a = j) ▸ s = x then
if h_2 : a = j' then if h_3 : (_ : a = j') ▸ s = y then eqToHom (_ : X (f j) x = X (f j') y) else 0 else 0
else 0
else 0) =
dite (j = j') (fun h => eqToHom (_ : f j = f j')) (fun h => 0) x y
[PROOFSTEP]
simp only [if_congr, if_true, dif_ctx_congr, Finset.sum_dite_irrel, Finset.mem_univ, Finset.sum_const_zero,
Finset.sum_congr, Finset.sum_dite_eq']
[GOAL]
case H
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
⊢ (if h : j = j' then if h_1 : (_ : j = j') ▸ x = y then eqToHom (_ : X (f j) x = X (f j') y) else 0 else 0) =
dite (j = j') (fun h => eqToHom (_ : f j = f j')) (fun h => 0) x y
[PROOFSTEP]
split_ifs with h h'
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
h : j = j'
h' : (_ : j = j') ▸ x = y
⊢ eqToHom (_ : X (f j) x = X (f j') y) = eqToHom (_ : f j = f j') x y
[PROOFSTEP]
substs h h'
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x : (f j).ι
⊢ eqToHom (_ : X (f j) x = X (f j) ((_ : j = j) ▸ x)) = eqToHom (_ : f j = f j) x ((_ : j = j) ▸ x)
[PROOFSTEP]
simp only [CategoryTheory.eqToHom_refl, CategoryTheory.Mat_.id_apply_self]
[GOAL]
case neg
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
h : j = j'
h' : ¬(_ : j = j') ▸ x = y
⊢ 0 = eqToHom (_ : f j = f j') x y
[PROOFSTEP]
subst h
[GOAL]
case neg
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j : Fin n
x y : (f j).ι
h' : ¬(_ : j = j) ▸ x = y
⊢ 0 = eqToHom (_ : f j = f j) x y
[PROOFSTEP]
rw [eqToHom_refl, id_apply_of_ne _ _ _ h']
[GOAL]
case neg
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
j j' : Fin n
x : (f j).ι
y : (f j').ι
h : ¬j = j'
⊢ 0 = OfNat.ofNat 0 x y
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
⊢ ∑ j : Fin n,
Bicone.π
(Bicone.mk (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd)
(fun j x y =>
if h : x.fst = j then
if h' : h ▸ x.snd = y then
eqToHom (_ : X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) x = X (f j) y)
else 0
else 0)
fun j x y =>
if h : y.fst = j then
if h' : h ▸ y.snd = x then
eqToHom (_ : X (f j) x = X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) y)
else 0
else 0)
j ≫
Bicone.ι
(Bicone.mk (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd)
(fun j x y =>
if h : x.fst = j then
if h' : h ▸ x.snd = y then
eqToHom (_ : X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) x = X (f j) y)
else 0
else 0)
fun j x y =>
if h : y.fst = j then
if h' : h ▸ y.snd = x then
eqToHom (_ : X (f j) x = X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) y)
else 0
else 0)
j =
𝟙
(Bicone.mk (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd)
(fun j x y =>
if h : x.fst = j then
if h' : h ▸ x.snd = y then
eqToHom (_ : X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) x = X (f j) y)
else 0
else 0)
fun j x y =>
if h : y.fst = j then
if h' : h ▸ y.snd = x then
eqToHom (_ : X (f j) x = X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) y)
else 0
else 0).pt
[PROOFSTEP]
dsimp
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
⊢ (∑ j : Fin n,
(fun x y =>
if h : x.fst = j then if h' : h ▸ x.snd = y then eqToHom (_ : X (f x.fst) x.snd = X (f j) y) else 0 else 0) ≫
fun x y =>
if h : y.fst = j then if h' : h ▸ y.snd = x then eqToHom (_ : X (f j) x = X (f y.fst) y.snd) else 0 else 0) =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd)
[PROOFSTEP]
ext1 ⟨i, j⟩
[GOAL]
case H.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
⊢ ∀ (j_1 : (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd).ι),
Finset.sum Finset.univ
(fun j =>
(fun x y =>
if h : x.fst = j then if h' : h ▸ x.snd = y then eqToHom (_ : X (f x.fst) x.snd = X (f j) y) else 0
else 0) ≫
fun x y =>
if h : y.fst = j then if h' : h ▸ y.snd = x then eqToHom (_ : X (f j) x = X (f y.fst) y.snd) else 0 else 0)
{ fst := i, snd := j } j_1 =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } j_1
[PROOFSTEP]
rintro ⟨i', j'⟩
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ Finset.sum Finset.univ
(fun j =>
(fun x y =>
if h : x.fst = j then if h' : h ▸ x.snd = y then eqToHom (_ : X (f x.fst) x.snd = X (f j) y) else 0
else 0) ≫
fun x y =>
if h : y.fst = j then if h' : h ▸ y.snd = x then eqToHom (_ : X (f j) x = X (f y.fst) y.snd) else 0 else 0)
{ fst := i, snd := j } { fst := i', snd := j' } =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } { fst := i', snd := j' }
[PROOFSTEP]
rw [Finset.sum_apply, Finset.sum_apply]
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ∑ c : Fin n,
((fun x y =>
if h : x.fst = c then if h' : h ▸ x.snd = y then eqToHom (_ : X (f x.fst) x.snd = X (f c) y) else 0
else 0) ≫
fun x y =>
if h : y.fst = c then if h' : h ▸ y.snd = x then eqToHom (_ : X (f c) x = X (f y.fst) y.snd) else 0 else 0)
{ fst := i, snd := j } { fst := i', snd := j' } =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } { fst := i', snd := j' }
[PROOFSTEP]
dsimp
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ (∑ c : Fin n,
∑ j_1 : (f c).ι,
(if h : i = c then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f c) j_1) else 0 else 0) ≫
if h : i' = c then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f c) j_1 = X (f i') j') else 0 else 0) =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } { fst := i', snd := j' }
[PROOFSTEP]
rw [Finset.sum_eq_single i]
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ (∑ j_1 : (f i).ι,
(if h : i = i then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f i) j_1) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f i) j_1 = X (f i') j') else 0 else 0) =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } { fst := i', snd := j' }
case H.mk.mk.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ∀ (b : Fin n),
b ∈ Finset.univ →
b ≠ i →
(∑ j_1 : (f b).ι,
(if h : i = b then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f b) j_1) else 0 else 0) ≫
if h : i' = b then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f b) j_1 = X (f i') j') else 0 else 0) =
0
case H.mk.mk.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ¬i ∈ Finset.univ →
(∑ j_1 : (f i).ι,
(if h : i = i then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f i) j_1) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f i) j_1 = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
rotate_left
[GOAL]
case H.mk.mk.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ∀ (b : Fin n),
b ∈ Finset.univ →
b ≠ i →
(∑ j_1 : (f b).ι,
(if h : i = b then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f b) j_1) else 0 else 0) ≫
if h : i' = b then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f b) j_1 = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
intro b _ hb
[GOAL]
case H.mk.mk.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
b : Fin n
a✝ : b ∈ Finset.univ
hb : b ≠ i
⊢ (∑ j_1 : (f b).ι,
(if h : i = b then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f b) j_1) else 0 else 0) ≫
if h : i' = b then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f b) j_1 = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
apply Finset.sum_eq_zero
[GOAL]
case H.mk.mk.h₀.h
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
b : Fin n
a✝ : b ∈ Finset.univ
hb : b ≠ i
⊢ ∀ (x : (f b).ι),
x ∈ Finset.univ →
((if h : i = b then if h' : h ▸ j = x then eqToHom (_ : X (f i) j = X (f b) x) else 0 else 0) ≫
if h : i' = b then if h' : h ▸ j' = x then eqToHom (_ : X (f b) x = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
intro x _
[GOAL]
case H.mk.mk.h₀.h
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
b : Fin n
a✝¹ : b ∈ Finset.univ
hb : b ≠ i
x : (f b).ι
a✝ : x ∈ Finset.univ
⊢ ((if h : i = b then if h' : h ▸ j = x then eqToHom (_ : X (f i) j = X (f b) x) else 0 else 0) ≫
if h : i' = b then if h' : h ▸ j' = x then eqToHom (_ : X (f b) x = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
rw [dif_neg hb.symm, zero_comp]
[GOAL]
case H.mk.mk.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ¬i ∈ Finset.univ →
(∑ j_1 : (f i).ι,
(if h : i = i then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f i) j_1) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f i) j_1 = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
intro hi
[GOAL]
case H.mk.mk.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
hi : ¬i ∈ Finset.univ
⊢ (∑ j_1 : (f i).ι,
(if h : i = i then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f i) j_1) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f i) j_1 = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
simp at hi
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ (∑ j_1 : (f i).ι,
(if h : i = i then if h' : h ▸ j = j_1 then eqToHom (_ : X (f i) j = X (f i) j_1) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j_1 then eqToHom (_ : X (f i) j_1 = X (f i') j') else 0 else 0) =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } { fst := i', snd := j' }
[PROOFSTEP]
rw [Finset.sum_eq_single j]
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ((if h : i = i then if h' : h ▸ j = j then eqToHom (_ : X (f i) j = X (f i) j) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } { fst := i', snd := j' }
case H.mk.mk.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ∀ (b : (f i).ι),
b ∈ Finset.univ →
b ≠ j →
((if h : i = i then if h' : h ▸ j = b then eqToHom (_ : X (f i) j = X (f i) b) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = b then eqToHom (_ : X (f i) b = X (f i') j') else 0 else 0) =
0
case H.mk.mk.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ¬j ∈ Finset.univ →
((if h : i = i then if h' : h ▸ j = j then eqToHom (_ : X (f i) j = X (f i) j) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
rotate_left
[GOAL]
case H.mk.mk.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ∀ (b : (f i).ι),
b ∈ Finset.univ →
b ≠ j →
((if h : i = i then if h' : h ▸ j = b then eqToHom (_ : X (f i) j = X (f i) b) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = b then eqToHom (_ : X (f i) b = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
intro b _ hb
[GOAL]
case H.mk.mk.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
b : (f i).ι
a✝ : b ∈ Finset.univ
hb : b ≠ j
⊢ ((if h : i = i then if h' : h ▸ j = b then eqToHom (_ : X (f i) j = X (f i) b) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = b then eqToHom (_ : X (f i) b = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
rw [dif_pos rfl, dif_neg, zero_comp]
[GOAL]
case H.mk.mk.h₀.hnc
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
b : (f i).ι
a✝ : b ∈ Finset.univ
hb : b ≠ j
⊢ ¬(_ : i = i) ▸ j = b
[PROOFSTEP]
simp only
[GOAL]
case H.mk.mk.h₀.hnc
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
b : (f i).ι
a✝ : b ∈ Finset.univ
hb : b ≠ j
⊢ ¬j = b
[PROOFSTEP]
tauto
[GOAL]
case H.mk.mk.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ¬j ∈ Finset.univ →
((if h : i = i then if h' : h ▸ j = j then eqToHom (_ : X (f i) j = X (f i) j) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
intro hj
[GOAL]
case H.mk.mk.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
hj : ¬j ∈ Finset.univ
⊢ ((if h : i = i then if h' : h ▸ j = j then eqToHom (_ : X (f i) j = X (f i) j) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
0
[PROOFSTEP]
simp at hj
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ ((if h : i = i then if h' : h ▸ j = j then eqToHom (_ : X (f i) j = X (f i) j) else 0 else 0) ≫
if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
𝟙 (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } { fst := i', snd := j' }
[PROOFSTEP]
simp only [eqToHom_refl, dite_eq_ite, ite_true, Category.id_comp, ne_eq, Sigma.mk.inj_iff, not_and, id_def]
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ (if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
if h : i = i' ∧ HEq j j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
by_cases i' = i
[GOAL]
case H.mk.mk
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
⊢ (if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
if h : i = i' ∧ HEq j j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
by_cases i' = i
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
h : i' = i
⊢ (if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
if h : i = i' ∧ HEq j j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
subst h
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i' : Fin n
j' j : (f i').ι
⊢ (if h : i' = i' then if h' : h ▸ j' = j then eqToHom (_ : X (f i') j = X (f i') j') else 0 else 0) =
if h : i' = i' ∧ HEq j j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
rw [dif_pos rfl]
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i' : Fin n
j' j : (f i').ι
⊢ (if h' : (_ : i' = i') ▸ j' = j then eqToHom (_ : X (f i') j = X (f i') j') else 0) =
if h : i' = i' ∧ HEq j j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
simp only [heq_eq_eq, true_and]
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i' : Fin n
j' j : (f i').ι
⊢ (if h' : j' = j then eqToHom (_ : X (f i') j = X (f i') j') else 0) =
if h : j = j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
by_cases j' = j
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i' : Fin n
j' j : (f i').ι
⊢ (if h' : j' = j then eqToHom (_ : X (f i') j = X (f i') j') else 0) =
if h : j = j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
by_cases j' = j
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i' : Fin n
j' j : (f i').ι
h : j' = j
⊢ (if h' : j' = j then eqToHom (_ : X (f i') j = X (f i') j') else 0) =
if h : j = j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
subst h
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i' : Fin n
j' : (f i').ι
⊢ (if h' : j' = j' then eqToHom (_ : X (f i') j' = X (f i') j') else 0) =
if h : j' = j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
simp
[GOAL]
case neg
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i' : Fin n
j' j : (f i').ι
h : ¬j' = j
⊢ (if h' : j' = j then eqToHom (_ : X (f i') j = X (f i') j') else 0) =
if h : j = j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
rw [dif_neg h, dif_neg (Ne.symm h)]
[GOAL]
case neg
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
h : ¬i' = i
⊢ (if h : i' = i then if h' : h ▸ j' = j then eqToHom (_ : X (f i) j = X (f i') j') else 0 else 0) =
if h : i = i' ∧ HEq j j' then
eqToHom
(_ :
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i, snd := j } =
X (mk ((j : Fin n) × (f j).ι) fun p => X (f p.fst) p.snd) { fst := i', snd := j' })
else 0
[PROOFSTEP]
rw [dif_neg h, dif_neg]
[GOAL]
case neg.hnc
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
n : ℕ
f : Fin n → Mat_ C
i : Fin n
j : (f i).ι
i' : Fin n
j' : (f i').ι
h : ¬i' = i
⊢ ¬(i = i' ∧ HEq j j')
[PROOFSTEP]
tauto
[GOAL]
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : Preadditive C
D : Type u_1
inst✝¹ : Category.{v₁, u_1} D
inst✝ : Preadditive D
M : Mat_ C
⊢ (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M
[PROOFSTEP]
cases M
[GOAL]
case mk
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : Preadditive C
D : Type u_1
inst✝¹ : Category.{v₁, u_1} D
inst✝ : Preadditive D
ι✝ : Type
F✝ : Fintype ι✝
X✝ : ι✝ → C
⊢ (mapMat_ (𝟭 C)).obj (Mat_.mk ι✝ X✝) = (𝟭 (Mat_ C)).obj (Mat_.mk ι✝ X✝)
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : Preadditive C
D : Type u_1
inst✝¹ : Category.{v₁, u_1} D
inst✝ : Preadditive D
M N : Mat_ C
f : M ⟶ N
⊢ (mapMat_ (𝟭 C)).map f ≫ ((fun M => eqToIso (_ : (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M)) N).hom =
((fun M => eqToIso (_ : (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M)) M).hom ≫ (𝟭 (Mat_ C)).map f
[PROOFSTEP]
ext
[GOAL]
case H
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : Preadditive C
D : Type u_1
inst✝¹ : Category.{v₁, u_1} D
inst✝ : Preadditive D
M N : Mat_ C
f : M ⟶ N
i✝ : ((mapMat_ (𝟭 C)).obj M).ι
j✝ : ((𝟭 (Mat_ C)).obj N).ι
⊢ ((mapMat_ (𝟭 C)).map f ≫ ((fun M => eqToIso (_ : (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M)) N).hom) i✝ j✝ =
(((fun M => eqToIso (_ : (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M)) M).hom ≫ (𝟭 (Mat_ C)).map f) i✝ j✝
[PROOFSTEP]
cases M
[GOAL]
case H.mk
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : Preadditive C
D : Type u_1
inst✝¹ : Category.{v₁, u_1} D
inst✝ : Preadditive D
N : Mat_ C
j✝ : ((𝟭 (Mat_ C)).obj N).ι
ι✝ : Type
F✝ : Fintype ι✝
X✝ : ι✝ → C
f : Mat_.mk ι✝ X✝ ⟶ N
i✝ : ((mapMat_ (𝟭 C)).obj (Mat_.mk ι✝ X✝)).ι
⊢ ((mapMat_ (𝟭 C)).map f ≫ ((fun M => eqToIso (_ : (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M)) N).hom) i✝ j✝ =
(((fun M => eqToIso (_ : (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M)) (Mat_.mk ι✝ X✝)).hom ≫ (𝟭 (Mat_ C)).map f) i✝
j✝
[PROOFSTEP]
cases N
[GOAL]
case H.mk.mk
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : Preadditive C
D : Type u_1
inst✝¹ : Category.{v₁, u_1} D
inst✝ : Preadditive D
ι✝¹ : Type
F✝¹ : Fintype ι✝¹
X✝¹ : ι✝¹ → C
i✝ : ((mapMat_ (𝟭 C)).obj (Mat_.mk ι✝¹ X✝¹)).ι
ι✝ : Type
F✝ : Fintype ι✝
X✝ : ι✝ → C
j✝ : ((𝟭 (Mat_ C)).obj (Mat_.mk ι✝ X✝)).ι
f : Mat_.mk ι✝¹ X✝¹ ⟶ Mat_.mk ι✝ X✝
⊢ ((mapMat_ (𝟭 C)).map f ≫ ((fun M => eqToIso (_ : (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M)) (Mat_.mk ι✝ X✝)).hom) i✝
j✝ =
(((fun M => eqToIso (_ : (mapMat_ (𝟭 C)).obj M = (𝟭 (Mat_ C)).obj M)) (Mat_.mk ι✝¹ X✝¹)).hom ≫ (𝟭 (Mat_ C)).map f)
i✝ j✝
[PROOFSTEP]
simp [comp_dite, dite_comp]
[GOAL]
C : Type u₁
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Preadditive C
D : Type u_1
inst✝⁵ : Category.{v₁, u_1} D
inst✝⁴ : Preadditive D
E : Type u_2
inst✝³ : Category.{v₁, u_2} E
inst✝² : Preadditive E
F : C ⥤ D
inst✝¹ : Additive F
G : D ⥤ E
inst✝ : Additive G
M : Mat_ C
⊢ (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M
[PROOFSTEP]
cases M
[GOAL]
case mk
C : Type u₁
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Preadditive C
D : Type u_1
inst✝⁵ : Category.{v₁, u_1} D
inst✝⁴ : Preadditive D
E : Type u_2
inst✝³ : Category.{v₁, u_2} E
inst✝² : Preadditive E
F : C ⥤ D
inst✝¹ : Additive F
G : D ⥤ E
inst✝ : Additive G
ι✝ : Type
F✝ : Fintype ι✝
X✝ : ι✝ → C
⊢ (mapMat_ (F ⋙ G)).obj (Mat_.mk ι✝ X✝) = (mapMat_ F ⋙ mapMat_ G).obj (Mat_.mk ι✝ X✝)
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Preadditive C
D : Type u_1
inst✝⁵ : Category.{v₁, u_1} D
inst✝⁴ : Preadditive D
E : Type u_2
inst✝³ : Category.{v₁, u_2} E
inst✝² : Preadditive E
F : C ⥤ D
inst✝¹ : Additive F
G : D ⥤ E
inst✝ : Additive G
M N : Mat_ C
f : M ⟶ N
⊢ (mapMat_ (F ⋙ G)).map f ≫ ((fun M => eqToIso (_ : (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M)) N).hom =
((fun M => eqToIso (_ : (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M)) M).hom ≫
(mapMat_ F ⋙ mapMat_ G).map f
[PROOFSTEP]
ext
[GOAL]
case H
C : Type u₁
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Preadditive C
D : Type u_1
inst✝⁵ : Category.{v₁, u_1} D
inst✝⁴ : Preadditive D
E : Type u_2
inst✝³ : Category.{v₁, u_2} E
inst✝² : Preadditive E
F : C ⥤ D
inst✝¹ : Additive F
G : D ⥤ E
inst✝ : Additive G
M N : Mat_ C
f : M ⟶ N
i✝ : ((mapMat_ (F ⋙ G)).obj M).ι
j✝ : ((mapMat_ F ⋙ mapMat_ G).obj N).ι
⊢ ((mapMat_ (F ⋙ G)).map f ≫ ((fun M => eqToIso (_ : (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M)) N).hom)
i✝ j✝ =
(((fun M => eqToIso (_ : (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M)) M).hom ≫
(mapMat_ F ⋙ mapMat_ G).map f)
i✝ j✝
[PROOFSTEP]
cases M
[GOAL]
case H.mk
C : Type u₁
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Preadditive C
D : Type u_1
inst✝⁵ : Category.{v₁, u_1} D
inst✝⁴ : Preadditive D
E : Type u_2
inst✝³ : Category.{v₁, u_2} E
inst✝² : Preadditive E
F : C ⥤ D
inst✝¹ : Additive F
G : D ⥤ E
inst✝ : Additive G
N : Mat_ C
j✝ : ((mapMat_ F ⋙ mapMat_ G).obj N).ι
ι✝ : Type
F✝ : Fintype ι✝
X✝ : ι✝ → C
f : Mat_.mk ι✝ X✝ ⟶ N
i✝ : ((mapMat_ (F ⋙ G)).obj (Mat_.mk ι✝ X✝)).ι
⊢ ((mapMat_ (F ⋙ G)).map f ≫ ((fun M => eqToIso (_ : (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M)) N).hom)
i✝ j✝ =
(((fun M => eqToIso (_ : (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M)) (Mat_.mk ι✝ X✝)).hom ≫
(mapMat_ F ⋙ mapMat_ G).map f)
i✝ j✝
[PROOFSTEP]
cases N
[GOAL]
case H.mk.mk
C : Type u₁
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Preadditive C
D : Type u_1
inst✝⁵ : Category.{v₁, u_1} D
inst✝⁴ : Preadditive D
E : Type u_2
inst✝³ : Category.{v₁, u_2} E
inst✝² : Preadditive E
F : C ⥤ D
inst✝¹ : Additive F
G : D ⥤ E
inst✝ : Additive G
ι✝¹ : Type
F✝¹ : Fintype ι✝¹
X✝¹ : ι✝¹ → C
i✝ : ((mapMat_ (F ⋙ G)).obj (Mat_.mk ι✝¹ X✝¹)).ι
ι✝ : Type
F✝ : Fintype ι✝
X✝ : ι✝ → C
j✝ : ((mapMat_ F ⋙ mapMat_ G).obj (Mat_.mk ι✝ X✝)).ι
f : Mat_.mk ι✝¹ X✝¹ ⟶ Mat_.mk ι✝ X✝
⊢ ((mapMat_ (F ⋙ G)).map f ≫
((fun M => eqToIso (_ : (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M)) (Mat_.mk ι✝ X✝)).hom)
i✝ j✝ =
(((fun M => eqToIso (_ : (mapMat_ (F ⋙ G)).obj M = (mapMat_ F ⋙ mapMat_ G).obj M)) (Mat_.mk ι✝¹ X✝¹)).hom ≫
(mapMat_ F ⋙ mapMat_ G).map f)
i✝ j✝
[PROOFSTEP]
simp [comp_dite, dite_comp]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
x✝ : C
⊢ { obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.map (𝟙 x✝) =
𝟙 ({ obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.obj x✝)
[PROOFSTEP]
ext ⟨⟩
[GOAL]
case H.unit
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
x✝ : C
j✝ : ({ obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.obj x✝).ι
⊢ { obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.map (𝟙 x✝) PUnit.unit j✝ =
𝟙 ({ obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.obj x✝) PUnit.unit j✝
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
X✝ Y✝ Z✝ : C
x✝¹ : X✝ ⟶ Y✝
x✝ : Y✝ ⟶ Z✝
⊢ { obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.map (x✝¹ ≫ x✝) =
{ obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.map x✝¹ ≫
{ obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.map x✝
[PROOFSTEP]
ext ⟨⟩
[GOAL]
case H.unit
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
X✝ Y✝ Z✝ : C
x✝¹ : X✝ ⟶ Y✝
x✝ : Y✝ ⟶ Z✝
j✝ : ({ obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.obj Z✝).ι
⊢ { obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.map (x✝¹ ≫ x✝) PUnit.unit j✝ =
({ obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.map x✝¹ ≫
{ obj := fun X => mk PUnit fun x => X, map := fun {X Y} f x x => f }.map x✝)
PUnit.unit j✝
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
⊢ ((biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
biproduct.desc fun i j k => if h : i = k then eqToHom (_ : X M i = X M k) else 0) =
𝟙 M
[PROOFSTEP]
simp only [biproduct.lift_desc]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
⊢ (∑ j : M.ι,
(fun j_1 k => if h : j_1 = j then eqToHom (_ : X M j_1 = X M j) else 0) ≫ fun j_1 k =>
if h : j = k then eqToHom (_ : X M j = X M k) else 0) =
𝟙 M
[PROOFSTEP]
funext i j
[GOAL]
case h.h
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ Finset.sum Finset.univ
(fun j =>
(fun j_1 k => if h : j_1 = j then eqToHom (_ : X M j_1 = X M j) else 0) ≫ fun j_1 k =>
if h : j = k then eqToHom (_ : X M j = X M k) else 0)
i j =
𝟙 M i j
[PROOFSTEP]
dsimp [id_def]
[GOAL]
case h.h
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ Finset.sum Finset.univ
(fun j =>
(fun j_1 k => if h : j_1 = j then eqToHom (_ : X M j_1 = X M j) else 0) ≫ fun j_1 k =>
if h : j = k then eqToHom (_ : X M j = X M k) else 0)
i j =
if h : i = j then eqToHom (_ : X M i = X M j) else 0
[PROOFSTEP]
rw [Finset.sum_apply, Finset.sum_apply, Finset.sum_eq_single i]
[GOAL]
case h.h
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ ((fun j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫ fun j k =>
if h : i = k then eqToHom (_ : X M i = X M k) else 0)
i j =
if h : i = j then eqToHom (_ : X M i = X M j) else 0
case h.h.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ ∀ (b : M.ι),
b ∈ Finset.univ →
b ≠ i →
((fun j k => if h : j = b then eqToHom (_ : X M j = X M b) else 0) ≫ fun j k =>
if h : b = k then eqToHom (_ : X M b = X M k) else 0)
i j =
0
case h.h.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ ¬i ∈ Finset.univ →
((fun j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫ fun j k =>
if h : i = k then eqToHom (_ : X M i = X M k) else 0)
i j =
0
[PROOFSTEP]
rotate_left
[GOAL]
case h.h.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ ∀ (b : M.ι),
b ∈ Finset.univ →
b ≠ i →
((fun j k => if h : j = b then eqToHom (_ : X M j = X M b) else 0) ≫ fun j k =>
if h : b = k then eqToHom (_ : X M b = X M k) else 0)
i j =
0
[PROOFSTEP]
intro b _ hb
[GOAL]
case h.h.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j b : M.ι
a✝ : b ∈ Finset.univ
hb : b ≠ i
⊢ ((fun j k => if h : j = b then eqToHom (_ : X M j = X M b) else 0) ≫ fun j k =>
if h : b = k then eqToHom (_ : X M b = X M k) else 0)
i j =
0
[PROOFSTEP]
dsimp
[GOAL]
case h.h.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j b : M.ι
a✝ : b ∈ Finset.univ
hb : b ≠ i
⊢ (∑ j_1 in {PUnit.unit},
(if h : i = b then eqToHom (_ : X M i = X M b) else 0) ≫ if h : b = j then eqToHom (_ : X M b = X M j) else 0) =
0
[PROOFSTEP]
simp only [Finset.sum_const, Finset.card_singleton, one_smul]
[GOAL]
case h.h.h₀
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j b : M.ι
a✝ : b ∈ Finset.univ
hb : b ≠ i
⊢ ((if h : i = b then eqToHom (_ : X M i = X M b) else 0) ≫ if h : b = j then eqToHom (_ : X M b = X M j) else 0) = 0
[PROOFSTEP]
rw [dif_neg hb.symm, zero_comp]
[GOAL]
case h.h.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ ¬i ∈ Finset.univ →
((fun j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫ fun j k =>
if h : i = k then eqToHom (_ : X M i = X M k) else 0)
i j =
0
[PROOFSTEP]
intro h
[GOAL]
case h.h.h₁
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
h : ¬i ∈ Finset.univ
⊢ ((fun j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫ fun j k =>
if h : i = k then eqToHom (_ : X M i = X M k) else 0)
i j =
0
[PROOFSTEP]
simp at h
[GOAL]
case h.h
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ ((fun j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫ fun j k =>
if h : i = k then eqToHom (_ : X M i = X M k) else 0)
i j =
if h : i = j then eqToHom (_ : X M i = X M j) else 0
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
⊢ ((biproduct.desc fun i j k => if h : i = k then eqToHom (_ : X M i = X M k) else 0) ≫
biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) =
𝟙 (⨁ fun i => (embedding C).obj (X M i))
[PROOFSTEP]
apply biproduct.hom_ext
[GOAL]
case w
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
⊢ ∀ (j : M.ι),
((biproduct.desc fun i j k => if h : i = k then eqToHom (_ : X M i = X M k) else 0) ≫
biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
biproduct.π (fun i => (embedding C).obj (X M i)) j =
𝟙 (⨁ fun i => (embedding C).obj (X M i)) ≫ biproduct.π (fun i => (embedding C).obj (X M i)) j
[PROOFSTEP]
intro i
[GOAL]
case w
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i : M.ι
⊢ ((biproduct.desc fun i j k => if h : i = k then eqToHom (_ : X M i = X M k) else 0) ≫
biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
biproduct.π (fun i => (embedding C).obj (X M i)) i =
𝟙 (⨁ fun i => (embedding C).obj (X M i)) ≫ biproduct.π (fun i => (embedding C).obj (X M i)) i
[PROOFSTEP]
apply biproduct.hom_ext'
[GOAL]
case w.w
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i : M.ι
⊢ ∀ (j : M.ι),
biproduct.ι (fun i => (embedding C).obj (X M i)) j ≫
((biproduct.desc fun i j k => if h : i = k then eqToHom (_ : X M i = X M k) else 0) ≫
biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
biproduct.π (fun i => (embedding C).obj (X M i)) i =
biproduct.ι (fun i => (embedding C).obj (X M i)) j ≫
𝟙 (⨁ fun i => (embedding C).obj (X M i)) ≫ biproduct.π (fun i => (embedding C).obj (X M i)) i
[PROOFSTEP]
intro j
[GOAL]
case w.w
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ biproduct.ι (fun i => (embedding C).obj (X M i)) j ≫
((biproduct.desc fun i j k => if h : i = k then eqToHom (_ : X M i = X M k) else 0) ≫
biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
biproduct.π (fun i => (embedding C).obj (X M i)) i =
biproduct.ι (fun i => (embedding C).obj (X M i)) j ≫
𝟙 (⨁ fun i => (embedding C).obj (X M i)) ≫ biproduct.π (fun i => (embedding C).obj (X M i)) i
[PROOFSTEP]
simp only [Category.id_comp, Category.assoc, biproduct.lift_π, biproduct.ι_desc_assoc, biproduct.ι_π]
[GOAL]
case w.w
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ ((fun j_1 k => if h : j = k then eqToHom (_ : X M j = X M k) else 0) ≫ fun j k =>
if h : j = i then eqToHom (_ : X M j = X M i) else 0) =
if h : j = i then eqToHom (_ : (embedding C).obj (X M j) = (embedding C).obj (X M i)) else 0
[PROOFSTEP]
ext ⟨⟩ ⟨⟩
[GOAL]
case w.w.H.unit.unit
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ ((fun j_1 k => if h : j = k then eqToHom (_ : X M j = X M k) else 0) ≫ fun j k =>
if h : j = i then eqToHom (_ : X M j = X M i) else 0)
PUnit.unit PUnit.unit =
dite (j = i) (fun h => eqToHom (_ : (embedding C).obj (X M j) = (embedding C).obj (X M i))) (fun h => 0) PUnit.unit
PUnit.unit
[PROOFSTEP]
simp only [embedding, comp_apply, comp_dite, dite_comp, comp_zero, zero_comp, Finset.sum_dite_eq', Finset.mem_univ,
ite_true, eqToHom_refl, Category.comp_id]
[GOAL]
case w.w.H.unit.unit
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
⊢ (if h : j = i then eqToHom (_ : X M j = X M i) else 0) =
dite (j = i) (fun h => eqToHom (_ : (embedding C).obj (X M j) = (embedding C).obj (X M i))) (fun h => 0) PUnit.unit
PUnit.unit
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
h : j = i
⊢ eqToHom (_ : X M j = X M i) =
eqToHom (_ : (embedding C).obj (X M j) = (embedding C).obj (X M i)) PUnit.unit PUnit.unit
[PROOFSTEP]
subst h
[GOAL]
case pos
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
j : M.ι
⊢ eqToHom (_ : X M j = X M j) =
eqToHom (_ : (embedding C).obj (X M j) = (embedding C).obj (X M j)) PUnit.unit PUnit.unit
[PROOFSTEP]
simp
[GOAL]
case neg
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
M : Mat_ C
i j : M.ι
h : ¬j = i
⊢ 0 = OfNat.ofNat 0 PUnit.unit PUnit.unit
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Preadditive C
D : Type u₁
inst✝² : Category.{v₁, u₁} D
inst✝¹ : Preadditive D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M : Mat_ C
i : M.ι
⊢ (additiveObjIsoBiproduct F M).hom ≫ biproduct.π (fun i => F.obj ((embedding C).obj (X M i))) i =
F.map ((isoBiproductEmbedding M).hom ≫ biproduct.π (fun i => (embedding C).obj (X M i)) i)
[PROOFSTEP]
dsimp [additiveObjIsoBiproduct]
[GOAL]
C : Type u₁
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Preadditive C
D : Type u₁
inst✝² : Category.{v₁, u₁} D
inst✝¹ : Preadditive D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M : Mat_ C
i : M.ι
⊢ (F.map (biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
biproduct.lift (Functor.mapBicone F (biproduct.bicone fun i => (embedding C).obj (X M i))).π) ≫
biproduct.π (fun i => F.obj ((embedding C).obj (X M i))) i =
F.map
((biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
biproduct.π (fun i => (embedding C).obj (X M i)) i)
[PROOFSTEP]
rw [biproduct.lift_π, Category.assoc]
[GOAL]
C : Type u₁
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Preadditive C
D : Type u₁
inst✝² : Category.{v₁, u₁} D
inst✝¹ : Preadditive D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M : Mat_ C
i : M.ι
⊢ F.map (biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
biproduct.lift (Functor.mapBicone F (biproduct.bicone fun i => (embedding C).obj (X M i))).π ≫
biproduct.π (fun i => F.obj ((embedding C).obj (X M i))) i =
F.map fun j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0
[PROOFSTEP]
erw [biproduct.lift_π, ← F.map_comp]
[GOAL]
C : Type u₁
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Preadditive C
D : Type u₁
inst✝² : Category.{v₁, u₁} D
inst✝¹ : Preadditive D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M : Mat_ C
i : M.ι
⊢ F.map
((biproduct.lift fun i j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0) ≫
Bicone.π (biproduct.bicone fun i => (embedding C).obj (X M i)) i) =
F.map fun j k => if h : j = i then eqToHom (_ : X M j = X M i) else 0
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Preadditive C
D : Type u₁
inst✝² : Category.{v₁, u₁} D
inst✝¹ : Preadditive D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M : Mat_ C
i : M.ι
⊢ biproduct.ι (fun i => F.obj ((embedding C).obj (X M i))) i ≫ (additiveObjIsoBiproduct F M).inv =
F.map (biproduct.ι (fun i => (embedding C).obj (X M i)) i ≫ (isoBiproductEmbedding M).inv)
[PROOFSTEP]
dsimp [additiveObjIsoBiproduct, Functor.mapBiproduct, Functor.mapBicone]
[GOAL]
C : Type u₁
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Preadditive C
D : Type u₁
inst✝² : Category.{v₁, u₁} D
inst✝¹ : Preadditive D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M : Mat_ C
i : M.ι
⊢ biproduct.ι (fun i => F.obj ((embedding C).obj (X M i))) i ≫
(biproduct.desc fun j => F.map (biproduct.ι (fun i => (embedding C).obj (X M i)) j)) ≫
F.map (biproduct.desc fun i j k => if h : i = k then eqToHom (_ : X M i = X M k) else 0) =
F.map
(biproduct.ι (fun i => (embedding C).obj (X M i)) i ≫
biproduct.desc fun i j k => if h : i = k then eqToHom (_ : X M i = X M k) else 0)
[PROOFSTEP]
simp only [biproduct.ι_desc, biproduct.ι_desc_assoc, ← F.map_comp]
[GOAL]
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M N : Mat_ C
f : M ⟶ N
⊢ F.map f ≫ (additiveObjIsoBiproduct F N).hom =
(additiveObjIsoBiproduct F M).hom ≫ biproduct.matrix fun i j => F.map ((embedding C).map (f i j))
[PROOFSTEP]
ext i : 1
[GOAL]
case w
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M N : Mat_ C
f : M ⟶ N
i : N.ι
⊢ (F.map f ≫ (additiveObjIsoBiproduct F N).hom) ≫ biproduct.π (fun i => F.obj ((embedding C).obj (X N i))) i =
((additiveObjIsoBiproduct F M).hom ≫ biproduct.matrix fun i j => F.map ((embedding C).map (f i j))) ≫
biproduct.π (fun i => F.obj ((embedding C).obj (X N i))) i
[PROOFSTEP]
simp only [Category.assoc, additiveObjIsoBiproduct_hom_π, isoBiproductEmbedding_hom, embedding_obj_ι, embedding_obj_X,
biproduct.lift_π, biproduct.matrix_π, ← cancel_epi (additiveObjIsoBiproduct F M).inv, Iso.inv_hom_id_assoc]
[GOAL]
case w
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M N : Mat_ C
f : M ⟶ N
i : N.ι
⊢ ((additiveObjIsoBiproduct F M).inv ≫
F.map f ≫ F.map fun j k => if h : j = i then eqToHom (_ : X N j = X N i) else 0) =
biproduct.desc fun j => F.map ((embedding C).map (f j i))
[PROOFSTEP]
ext j : 1
[GOAL]
case w.w
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M N : Mat_ C
f : M ⟶ N
i : N.ι
j : M.ι
⊢ (biproduct.ι (fun i => F.obj ((embedding C).obj (X M i))) j ≫
(additiveObjIsoBiproduct F M).inv ≫
F.map f ≫ F.map fun j k => if h : j = i then eqToHom (_ : X N j = X N i) else 0) =
biproduct.ι (fun i => F.obj ((embedding C).obj (X M i))) j ≫
biproduct.desc fun j => F.map ((embedding C).map (f j i))
[PROOFSTEP]
simp only [ι_additiveObjIsoBiproduct_inv_assoc, isoBiproductEmbedding_inv, biproduct.ι_desc, ← F.map_comp]
[GOAL]
case w.w
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M N : Mat_ C
f : M ⟶ N
i : N.ι
j : M.ι
⊢ F.map
((fun j_1 k => if h : j = k then eqToHom (_ : X M j = X M k) else 0) ≫
f ≫ fun j k => if h : j = i then eqToHom (_ : X N j = X N i) else 0) =
F.map ((embedding C).map (f j i))
[PROOFSTEP]
congr 1
[GOAL]
case w.w.e_a
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M N : Mat_ C
f : M ⟶ N
i : N.ι
j : M.ι
⊢ ((fun j_1 k => if h : j = k then eqToHom (_ : X M j = X M k) else 0) ≫
f ≫ fun j k => if h : j = i then eqToHom (_ : X N j = X N i) else 0) =
(embedding C).map (f j i)
[PROOFSTEP]
funext ⟨⟩ ⟨⟩
[GOAL]
case w.w.e_a.h.h
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M N : Mat_ C
f : M ⟶ N
i : N.ι
j : M.ι
⊢ ((fun j_1 k => if h : j = k then eqToHom (_ : X M j = X M k) else 0) ≫
f ≫ fun j k => if h : j = i then eqToHom (_ : X N j = X N i) else 0)
PUnit.unit PUnit.unit =
(embedding C).map (f j i) PUnit.unit PUnit.unit
[PROOFSTEP]
simp [comp_apply, dite_comp, comp_dite]
[GOAL]
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : Mat_ C ⥤ D
inst✝ : Functor.Additive F
M N : Mat_ C
f : M ⟶ N
⊢ (additiveObjIsoBiproduct F M).inv ≫ F.map f =
(biproduct.matrix fun i j => F.map ((embedding C).map (f i j))) ≫ (additiveObjIsoBiproduct F N).inv
[PROOFSTEP]
rw [Iso.inv_comp_eq, ← Category.assoc, Iso.eq_comp_inv, additiveObjIsoBiproduct_naturality]
[GOAL]
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : C ⥤ D
inst✝ : Functor.Additive F
X : Mat_ C
⊢ { obj := fun X => ⨁ fun i => F.obj (CategoryTheory.Mat_.X X i),
map := fun {X Y} f => biproduct.matrix fun i j => F.map (f i j) }.map
(𝟙 X) =
𝟙
({ obj := fun X => ⨁ fun i => F.obj (CategoryTheory.Mat_.X X i),
map := fun {X Y} f => biproduct.matrix fun i j => F.map (f i j) }.obj
X)
[PROOFSTEP]
dsimp
[GOAL]
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : C ⥤ D
inst✝ : Functor.Additive F
X : Mat_ C
⊢ (biproduct.matrix fun i j => F.map (𝟙 X i j)) = 𝟙 (⨁ fun i => F.obj (CategoryTheory.Mat_.X X i))
[PROOFSTEP]
ext i j
[GOAL]
case w.w
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : C ⥤ D
inst✝ : Functor.Additive F
X : Mat_ C
i j : X.ι
⊢ biproduct.ι (fun i => F.obj (CategoryTheory.Mat_.X X i)) j ≫
(biproduct.matrix fun i j => F.map (𝟙 X i j)) ≫ biproduct.π (fun i => F.obj (CategoryTheory.Mat_.X X i)) i =
biproduct.ι (fun i => F.obj (CategoryTheory.Mat_.X X i)) j ≫
𝟙 (⨁ fun i => F.obj (CategoryTheory.Mat_.X X i)) ≫ biproduct.π (fun i => F.obj (CategoryTheory.Mat_.X X i)) i
[PROOFSTEP]
by_cases h : j = i
[GOAL]
case pos
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : C ⥤ D
inst✝ : Functor.Additive F
X : Mat_ C
i j : X.ι
h : j = i
⊢ biproduct.ι (fun i => F.obj (CategoryTheory.Mat_.X X i)) j ≫
(biproduct.matrix fun i j => F.map (𝟙 X i j)) ≫ biproduct.π (fun i => F.obj (CategoryTheory.Mat_.X X i)) i =
biproduct.ι (fun i => F.obj (CategoryTheory.Mat_.X X i)) j ≫
𝟙 (⨁ fun i => F.obj (CategoryTheory.Mat_.X X i)) ≫ biproduct.π (fun i => F.obj (CategoryTheory.Mat_.X X i)) i
[PROOFSTEP]
subst h
[GOAL]
case pos
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : C ⥤ D
inst✝ : Functor.Additive F
X : Mat_ C
j : X.ι
⊢ biproduct.ι (fun i => F.obj (CategoryTheory.Mat_.X X i)) j ≫
(biproduct.matrix fun i j => F.map (𝟙 X i j)) ≫ biproduct.π (fun i => F.obj (CategoryTheory.Mat_.X X i)) j =
biproduct.ι (fun i => F.obj (CategoryTheory.Mat_.X X i)) j ≫
𝟙 (⨁ fun i => F.obj (CategoryTheory.Mat_.X X i)) ≫ biproduct.π (fun i => F.obj (CategoryTheory.Mat_.X X i)) j
[PROOFSTEP]
simp
[GOAL]
case neg
C : Type u₁
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Preadditive C
D : Type u₁
inst✝³ : Category.{v₁, u₁} D
inst✝² : Preadditive D
inst✝¹ : HasFiniteBiproducts D
F : C ⥤ D
inst✝ : Functor.Additive F
X : Mat_ C
i j : X.ι
h : ¬j = i
⊢ biproduct.ι (fun i => F.obj (CategoryTheory.Mat_.X X i)) j ≫
(biproduct.matrix fun i j => F.map (𝟙 X i j)) ≫ biproduct.π (fun i => F.obj (CategoryTheory.Mat_.X X i)) i =
biproduct.ι (fun i => F.obj (CategoryTheory.Mat_.X X i)) j ≫
𝟙 (⨁ fun i => F.obj (CategoryTheory.Mat_.X X i)) ≫ biproduct.π (fun i => F.obj (CategoryTheory.Mat_.X X i)) i
[PROOFSTEP]
simp [h]
[GOAL]
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ L.map f ≫
((fun M =>
additiveObjIsoBiproduct L M ≪≫
(biproduct.mapIso fun i => α.app (X M i)) ≪≫
(biproduct.mapIso fun i => (embeddingLiftIso F).symm.app (X M i)) ≪≫
(additiveObjIsoBiproduct (lift F) M).symm)
Y✝).hom =
((fun M =>
additiveObjIsoBiproduct L M ≪≫
(biproduct.mapIso fun i => α.app (X M i)) ≪≫
(biproduct.mapIso fun i => (embeddingLiftIso F).symm.app (X M i)) ≪≫
(additiveObjIsoBiproduct (lift F) M).symm)
X✝).hom ≫
(lift F).map f
[PROOFSTEP]
dsimp only [Iso.trans_hom, Iso.symm_hom, biproduct.mapIso_hom]
[GOAL]
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ L.map f ≫
(additiveObjIsoBiproduct L Y✝).hom ≫
(biproduct.map fun b => (α.app (X Y✝ b)).hom) ≫
(biproduct.map fun b => ((embeddingLiftIso F).symm.app (X Y✝ b)).hom) ≫
(additiveObjIsoBiproduct (lift F) Y✝).inv =
((additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.map fun b => (α.app (X X✝ b)).hom) ≫
(biproduct.map fun b => ((embeddingLiftIso F).symm.app (X X✝ b)).hom) ≫
(additiveObjIsoBiproduct (lift F) X✝).inv) ≫
(lift F).map f
[PROOFSTEP]
simp only [additiveObjIsoBiproduct_naturality_assoc]
[GOAL]
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ (additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.matrix fun i j => L.map ((embedding C).map (f i j))) ≫
(biproduct.map fun b => (α.app (X Y✝ b)).hom) ≫
(biproduct.map fun b => ((embeddingLiftIso F).symm.app (X Y✝ b)).hom) ≫
(additiveObjIsoBiproduct (lift F) Y✝).inv =
((additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.map fun b => (α.app (X X✝ b)).hom) ≫
(biproduct.map fun b => ((embeddingLiftIso F).symm.app (X X✝ b)).hom) ≫
(additiveObjIsoBiproduct (lift F) X✝).inv) ≫
(lift F).map f
[PROOFSTEP]
simp only [biproduct.matrix_map_assoc, Category.assoc]
[GOAL]
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ (additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.matrix fun j k =>
L.map ((embedding C).map (f j k)) ≫ (α.app (X Y✝ k)).hom ≫ ((embeddingLiftIso F).symm.app (X Y✝ k)).hom) ≫
(additiveObjIsoBiproduct (lift F) Y✝).inv =
(additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.map fun b => (α.app (X X✝ b)).hom) ≫
(biproduct.map fun b => ((embeddingLiftIso F).symm.app (X X✝ b)).hom) ≫
(additiveObjIsoBiproduct (lift F) X✝).inv ≫ (lift F).map f
[PROOFSTEP]
simp only [additiveObjIsoBiproduct_naturality']
[GOAL]
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ (additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.matrix fun j k =>
L.map ((embedding C).map (f j k)) ≫ (α.app (X Y✝ k)).hom ≫ ((embeddingLiftIso F).symm.app (X Y✝ k)).hom) ≫
(additiveObjIsoBiproduct (lift F) Y✝).inv =
(additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.map fun b => (α.app (X X✝ b)).hom) ≫
(biproduct.map fun b => ((embeddingLiftIso F).symm.app (X X✝ b)).hom) ≫
(biproduct.matrix fun i j => (lift F).map ((embedding C).map (f i j))) ≫
(additiveObjIsoBiproduct (lift F) Y✝).inv
[PROOFSTEP]
simp only [biproduct.map_matrix_assoc, Category.assoc]
[GOAL]
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ (additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.matrix fun j k =>
L.map ((embedding C).map (f j k)) ≫ (α.app (X Y✝ k)).hom ≫ ((embeddingLiftIso F).symm.app (X Y✝ k)).hom) ≫
(additiveObjIsoBiproduct (lift F) Y✝).inv =
(additiveObjIsoBiproduct L X✝).hom ≫
(biproduct.matrix fun j k =>
(α.app (X X✝ j)).hom ≫
((embeddingLiftIso F).symm.app (X X✝ j)).hom ≫ (lift F).map ((embedding C).map (f j k))) ≫
(additiveObjIsoBiproduct (lift F) Y✝).inv
[PROOFSTEP]
congr 3
[GOAL]
case e_a.e_a.e_m
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
⊢ (fun j k => L.map ((embedding C).map (f j k)) ≫ (α.app (X Y✝ k)).hom ≫ ((embeddingLiftIso F).symm.app (X Y✝ k)).hom) =
fun j k =>
(α.app (X X✝ j)).hom ≫ ((embeddingLiftIso F).symm.app (X X✝ j)).hom ≫ (lift F).map ((embedding C).map (f j k))
[PROOFSTEP]
ext j k
[GOAL]
case e_a.e_a.e_m.h.h
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
j : X✝.ι
k : Y✝.ι
⊢ L.map ((embedding C).map (f j k)) ≫ (α.app (X Y✝ k)).hom ≫ ((embeddingLiftIso F).symm.app (X Y✝ k)).hom =
(α.app (X X✝ j)).hom ≫ ((embeddingLiftIso F).symm.app (X X✝ j)).hom ≫ (lift F).map ((embedding C).map (f j k))
[PROOFSTEP]
apply biproduct.hom_ext
[GOAL]
case e_a.e_a.e_m.h.h.w
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
j : X✝.ι
k : Y✝.ι
⊢ ∀ (j_1 : ((embedding C).obj (X Y✝ k)).ι),
(L.map ((embedding C).map (f j k)) ≫ (α.app (X Y✝ k)).hom ≫ ((embeddingLiftIso F).symm.app (X Y✝ k)).hom) ≫
biproduct.π (fun i => F.obj (X ((embedding C).obj (X Y✝ k)) i)) j_1 =
((α.app (X X✝ j)).hom ≫ ((embeddingLiftIso F).symm.app (X X✝ j)).hom ≫ (lift F).map ((embedding C).map (f j k))) ≫
biproduct.π (fun i => F.obj (X ((embedding C).obj (X Y✝ k)) i)) j_1
[PROOFSTEP]
rintro ⟨⟩
[GOAL]
case e_a.e_a.e_m.h.h.w.unit
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
j : X✝.ι
k : Y✝.ι
⊢ (L.map ((embedding C).map (f j k)) ≫ (α.app (X Y✝ k)).hom ≫ ((embeddingLiftIso F).symm.app (X Y✝ k)).hom) ≫
biproduct.π (fun i => F.obj (X ((embedding C).obj (X Y✝ k)) i)) PUnit.unit =
((α.app (X X✝ j)).hom ≫ ((embeddingLiftIso F).symm.app (X X✝ j)).hom ≫ (lift F).map ((embedding C).map (f j k))) ≫
biproduct.π (fun i => F.obj (X ((embedding C).obj (X Y✝ k)) i)) PUnit.unit
[PROOFSTEP]
dsimp
[GOAL]
case e_a.e_a.e_m.h.h.w.unit
C : Type u₁
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Preadditive C
D : Type u₁
inst✝⁴ : Category.{v₁, u₁} D
inst✝³ : Preadditive D
inst✝² : HasFiniteBiproducts D
F : C ⥤ D
inst✝¹ : Functor.Additive F
L : Mat_ C ⥤ D
inst✝ : Functor.Additive L
α : embedding C ⋙ L ≅ F
X✝ Y✝ : Mat_ C
f : X✝ ⟶ Y✝
j : X✝.ι
k : Y✝.ι
⊢ (L.map ((embedding C).map (f j k)) ≫ NatTrans.app α.hom (X Y✝ k) ≫ biproduct.lift fun x => 𝟙 (F.obj (X Y✝ k))) ≫
biproduct.π (fun i => F.obj (X Y✝ k)) PUnit.unit =
(NatTrans.app α.hom (X X✝ j) ≫
(biproduct.lift fun x => 𝟙 (F.obj (X X✝ j))) ≫ biproduct.matrix fun i j_1 => F.map (f j k)) ≫
biproduct.π (fun i => F.obj (X Y✝ k)) PUnit.unit
[PROOFSTEP]
simpa using α.hom.naturality (f j k)
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
R : Type u
⊢ Inhabited (Mat R)
[PROOFSTEP]
dsimp [Mat]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : Preadditive C
R : Type u
⊢ Inhabited FintypeCat
[PROOFSTEP]
infer_instance
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type u
inst✝ : Semiring R
⊢ ∀ {W X Y Z : Mat R} (f : W ⟶ X) (g : X ⟶ Y) (h : Y ⟶ Z), (f ≫ g) ≫ h = f ≫ g ≫ h
[PROOFSTEP]
intros
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type u
inst✝ : Semiring R
W✝ X✝ Y✝ Z✝ : Mat R
f✝ : W✝ ⟶ X✝
g✝ : X✝ ⟶ Y✝
h✝ : Y✝ ⟶ Z✝
⊢ (f✝ ≫ g✝) ≫ h✝ = f✝ ≫ g✝ ≫ h✝
[PROOFSTEP]
simp [Matrix.mul_assoc]
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type u
inst✝ : Semiring R
M : Mat R
i : ↑M
⊢ 𝟙 M i i = 1
[PROOFSTEP]
simp [id_apply]
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type u
inst✝ : Semiring R
M : Mat R
i j : ↑M
h : i ≠ j
⊢ 𝟙 M i j = 0
[PROOFSTEP]
simp [id_apply, h]
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X : Mat_ (SingleObj Rᵐᵒᵖ)
⊢ { obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.map (𝟙 X) =
𝟙 ({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj X)
[PROOFSTEP]
ext
[GOAL]
case h
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X : Mat_ (SingleObj Rᵐᵒᵖ)
i✝ j✝ : ↑({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj X)
⊢ { obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.map (𝟙 X) i✝ j✝ =
𝟙 ({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj X) i✝ j✝
[PROOFSTEP]
simp only [Mat_.id_def, id_def]
[GOAL]
case h
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X : Mat_ (SingleObj Rᵐᵒᵖ)
i✝ j✝ : ↑({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj X)
⊢ MulOpposite.unop (if h : i✝ = j✝ then eqToHom (_ : Mat_.X X i✝ = Mat_.X X j✝) else 0) = if i✝ = j✝ then 1 else 0
[PROOFSTEP]
split_ifs
[GOAL]
case pos
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X : Mat_ (SingleObj Rᵐᵒᵖ)
i✝ j✝ : ↑({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj X)
h✝ : i✝ = j✝
⊢ MulOpposite.unop (eqToHom (_ : Mat_.X X i✝ = Mat_.X X j✝)) = 1
[PROOFSTEP]
rfl
[GOAL]
case neg
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X : Mat_ (SingleObj Rᵐᵒᵖ)
i✝ j✝ : ↑({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj X)
h✝ : ¬i✝ = j✝
⊢ MulOpposite.unop 0 = 0
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X✝ Y✝ Z✝ : Mat_ (SingleObj Rᵐᵒᵖ)
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
⊢ { obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.map (f ≫ g) =
{ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.map f ≫
{ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.map g
[PROOFSTEP]
ext
[GOAL]
case h
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X✝ Y✝ Z✝ : Mat_ (SingleObj Rᵐᵒᵖ)
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
i✝ : ↑({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj X✝)
j✝ : ↑({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj Z✝)
⊢ { obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.map (f ≫ g) i✝ j✝ =
({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.map f ≫
{ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.map g)
i✝ j✝
[PROOFSTEP]
simp only [Mat_.comp_apply, comp_apply]
[GOAL]
case h
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X✝ Y✝ Z✝ : Mat_ (SingleObj Rᵐᵒᵖ)
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
i✝ : ↑({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj X✝)
j✝ : ↑({ obj := fun X => FintypeCat.of X.ι, map := fun {X Y} f i j => MulOpposite.unop (f i j) }.obj Z✝)
⊢ MulOpposite.unop (∑ j : Y✝.ι, f i✝ j ≫ g j j✝) =
∑ j : ↑(FintypeCat.of Y✝.ι), MulOpposite.unop (f i✝ j) * MulOpposite.unop (g j j✝)
[PROOFSTEP]
apply Finset.unop_sum
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X✝ Y✝ : Mat_ (SingleObj Rᵐᵒᵖ)
a₁✝ a₂✝ : X✝ ⟶ Y✝
w : (equivalenceSingleObjInverse R).map a₁✝ = (equivalenceSingleObjInverse R).map a₂✝
⊢ a₁✝ = a₂✝
[PROOFSTEP]
ext
[GOAL]
case H
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X✝ Y✝ : Mat_ (SingleObj Rᵐᵒᵖ)
a₁✝ a₂✝ : X✝ ⟶ Y✝
w : (equivalenceSingleObjInverse R).map a₁✝ = (equivalenceSingleObjInverse R).map a₂✝
i✝ : X✝.ι
j✝ : Y✝.ι
⊢ a₁✝ i✝ j✝ = a₂✝ i✝ j✝
[PROOFSTEP]
apply_fun MulOpposite.unop using MulOpposite.unop_injective
[GOAL]
case H
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X✝ Y✝ : Mat_ (SingleObj Rᵐᵒᵖ)
a₁✝ a₂✝ : X✝ ⟶ Y✝
w : (equivalenceSingleObjInverse R).map a₁✝ = (equivalenceSingleObjInverse R).map a₂✝
i✝ : X✝.ι
j✝ : Y✝.ι
⊢ MulOpposite.unop (a₁✝ i✝ j✝) = MulOpposite.unop (a₂✝ i✝ j✝)
[PROOFSTEP]
exact congr_fun (congr_fun w _) _
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X : Mat R
⊢ (equivalenceSingleObjInverse R).obj (Mat_.mk ↑X fun x => PUnit.unit) = X
[PROOFSTEP]
dsimp
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X : Mat R
⊢ FintypeCat.of ↑X = X
[PROOFSTEP]
cases X
[GOAL]
case mk
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
α✝ : Type
str✝ : Fintype α✝
⊢ FintypeCat.of ↑(Bundled.mk α✝) = Bundled.mk α✝
[PROOFSTEP]
congr
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X Y : Mat R
⊢ AddCommGroup (X ⟶ Y)
[PROOFSTEP]
change AddCommGroup (Matrix X Y R)
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Preadditive C
R : Type
inst✝ : Ring R
X Y : Mat R
⊢ AddCommGroup (Matrix (↑X) (↑Y) R)
[PROOFSTEP]
infer_instance
|
`is_element/EP/Fbar` := (N::posint) -> (A::set) -> (TT) -> proc(x)
global reason;
local TT1,C,P,Q,T;
TT1 := `big_sets/trees`(TT);
if not is_table_on(TT1)(x) then
reason := [convert(procname,string),"x is not a table on TT1",x,TT1];
return false;
fi;
C := children_map(TT);
for T in TT1 do
Q := C[T];
P := select(U -> nops(U) > 1,Q);
if not `is_element/D/Fbar`(N)(P,Q)(x[T]) then
reason := [convert(procname,string),"x[T] is not in D/Fbar(N)(P,Q)",x[T],P,Q,reason];
return false;
fi;
od;
return true;
end:
######################################################################
`is_equal/EP/Fbar` := (N::posint) -> (A::set) -> (TT) -> proc(x,y)
local TT1,C,P,Q,T,U;
TT1 := `big_sets/trees`(TT);
C := children_map(TT);
for T in TT1 do
Q := C[T];
P := select(U -> nops(U) > 1,Q);
if not `is_equal/E/Fbar`(N)(P,Q)(x[T],y[T]) then
return false;
fi;
od;
return true;
end:
######################################################################
`theta/EP/tree_Fbar_alt` := (N::posint) -> (A::set) -> (TT) -> proc(x)
local TT1,C,P,Q,T,U,y;
TT1 := `big_sets/trees`(TT);
y := table();
C := children_map(TT);
for T in TT1 do
Q := C[T];
P := select(U -> nops(U) > 1,Q);
y[T] := `theta/E/Fbar`(N)(P,Q)(x[T],y[T]);
od;
return eval(y);
end:
######################################################################
`phi/EP/tree_Fbar` := (N::posint) -> (A::set) -> (TT) -> proc(tpqx)
local s,t,p,q,x,y,z,t0,x0,C,P,TT1,UU,VV,T,U,V,u,y0,n0,r;
t := table();
p := table();
q := table();
x := table();
C := children_map(TT);
P := parent_map(TT);
TT1 := `big_sets/trees`(TT);
for T in TT1 do
t0[T],p[T],q[T],x0[T] := op(tpqx[T]);
for U in C[T] do
x[U] := x0[T][U];
if nops(U) > 1 then t[U] := t0[T][U]; fi;
od;
od;
s := table();
for T in TT1 do
UU := select(U -> (U minus T = {}),TT1);
for U in UU do
VV := select(V -> (U minus V = {}),UU);
VV := sort([op(VV)],(V1,V2) -> evalb(nops(V1) < nops(V2)));
r := nops(VV) - 1;
s[T,U] := q[U] * mul(p[VV[i]],i=2..r+1) * mul(t[V[i]],i=1..r);
od;
od;
y := table();
for T in TT do
y[T] := table();
for u in A do y[T][u] := 0; od;
for U in C[T] do
for u in U do
y[T][u] := x[T][U];
od;
od;
y0 := `sum/vector_function`(N)(T)(y[T]) /~ nops(T);
for u in T do y[T][u] := y[T][u] -~ y0; od;
n0 := `norm/vector_functions`(y[T]);
for u in T do y[T][u] := y[T][u] /~ n0; od;
od;
z := table();
for T in TT1 do
z[T] := table();
for u in T do z[T][u] := [0$N]; od:
UU := select(U -> (U minus T = {}),TT1);
for U in UU do
for u in U do
z[T][u] := z[T][u] +~ s[T,U] *~ y[U][u];
od;
od;
od;
return eval(z);
end:
|
theory CKA
imports "$AFP/Kleene_Algebra/Kleene_Algebra"
begin
no_notation
Transitive_Closure.trancl ("(_\<^sup>+)" [1000] 999)
context kleene_algebra begin
definition trancl :: "'a \<Rightarrow> 'a" ("_\<^sup>+" [101] 100) where
"x\<^sup>+ \<equiv> x\<^sup>\<star>\<cdot>x"
lemma trancl_ext: "x \<le> x\<^sup>+"
by (metis mult_oner star_slide_var star_unfoldl_eq subdistl trancl_def)
lemma trancl_unfoldr: "x + x\<^sup>+\<cdot>x = x\<^sup>+"
by (metis add_0_left add_commute mult_onel star_slide_var star_zero trancl_def troeger)
lemma trancl_inductr: "z + y\<cdot>x \<le> y \<Longrightarrow> z\<cdot>x\<^sup>+ \<le> y"
by (metis add_ub2 distrib_left order_trans star_inductr star_slide_var star_unfoldl_eq trancl_def)
lemma trancl_unfoldl: "x + x\<cdot>x\<^sup>+ = x\<^sup>+"
by (metis mult_assoc star_slide_var trancl_def trancl_unfoldr)
lemma trancl_inductl: "z + x\<cdot>y \<le> y \<Longrightarrow> x\<^sup>+\<cdot>z \<le> y"
by (metis add_lub mult_assoc order_prop star_inductl subdistl trancl_def)
lemma star_trancl: "x\<^sup>+ = x \<cdot> x\<^sup>\<star>"
by (metis star_slide_var trancl_def)
lemma star_trancl2: "x\<^sup>\<star> = 1 + x\<^sup>+"
by (metis star_trancl star_unfoldl_eq)
end
class par_dioid = join_semilattice_zero + one +
fixes par :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<parallel>" 70)
assumes par_assoc: "(x\<parallel>y)\<parallel>z = x\<parallel>(y\<parallel>z)"
and par_comm: "x\<parallel>y = y\<parallel>x"
and par_distl: "x\<parallel>(y+z) = x\<parallel>y+x\<parallel>z"
and par_unitl: "1\<parallel>x = x"
and par_annil: "0\<parallel>x = 0"
begin
(* Parallel operator *)
lemma par_comml: "y\<parallel>(x\<parallel>z) = x\<parallel>(y\<parallel>z)"
by (metis par_assoc par_comm)
lemma par_distr: "(x+y)\<parallel>z = x\<parallel>z+y\<parallel>z"
by (metis par_comm par_distl)
lemma par_isor: "x \<le> y \<Longrightarrow> x\<parallel>z \<le> y\<parallel>z"
by (metis less_eq_def par_distr)
lemma par_isol: "x \<le> y \<Longrightarrow> z\<parallel>x \<le> z\<parallel>y"
by (metis less_eq_def par_distl)
lemma par_unitr: "x\<parallel>1 = x"
by (metis par_comm par_unitl)
lemma par_annir: "x\<parallel>0 = 0"
by (metis par_annil par_comm)
lemma par_subdistl: "x\<parallel>z \<le> (x + y)\<parallel>z"
by (metis order_prop par_distr)
lemma par_subdistr: "z\<parallel>x \<le> z\<parallel>(x + y)"
by (metis par_comm par_subdistl)
lemma par_double_iso: "w \<le> x \<and> y \<le> z \<longrightarrow> w\<parallel>y \<le> x\<parallel>z"
by (metis order_trans par_isol par_isor)
end
class trioid = dioid + par_dioid
class cka = trioid + kleene_algebra +
assumes exchange: "(w\<parallel>x)\<cdot>(y\<parallel>z) \<le> (w\<cdot>y)\<parallel>(x\<cdot>z)"
begin
lemma mult_incl: "x\<cdot>y \<le> x\<parallel>y"
by (metis par_unitl par_unitr exchange mult_onel mult_oner)
lemma small_exchange1: "(x\<parallel>y)\<cdot>z \<le> x\<parallel>(y\<cdot>z)"
by (metis par_unitl exchange mult_oner)
lemma small_exchange2: "x\<cdot>(y\<parallel>z) \<le> (x\<cdot>y)\<parallel>z"
by (metis par_unitr exchange mult_onel)
end
class ckat = cka +
fixes B :: "'a set"
assumes test_idem: "p \<in> B \<Longrightarrow> p\<cdot>p = p"
and test_top: "p \<in> B \<Longrightarrow> p \<le> 1"
and test_exchangel: "\<lbrakk>p \<in> B; q \<in> B\<rbrakk> \<Longrightarrow> (p\<parallel>q)\<cdot>(x\<parallel>y) = (p\<cdot>x)\<parallel>(q\<cdot>y)"
and test_exchanger: "\<lbrakk>p \<in> B; q \<in> B\<rbrakk> \<Longrightarrow> (x\<parallel>y)\<cdot>(p\<parallel>q) = (x\<cdot>p)\<parallel>(y\<cdot>q)"
and test_eq: "\<lbrakk>p \<in> B; q \<in> B\<rbrakk> \<Longrightarrow> p\<parallel>q = p\<cdot>q"
and test_add_closed: "\<lbrakk>p \<in> B; q \<in> B\<rbrakk> \<Longrightarrow> (p + q) \<in> B"
and test_mult_closed: "\<lbrakk>p \<in> B; q \<in> B\<rbrakk> \<Longrightarrow> (p \<cdot> q) \<in> B"
and test_par_closed: "\<lbrakk>p \<in> B; q \<in> B\<rbrakk> \<Longrightarrow> (p \<parallel> q) \<in> B"
begin
lemma everything_preserves_tests:
assumes test_one_closed: "1 \<in> B"
and p_test: "p \<in> B"
shows "p\<cdot>x = x\<cdot>p"
proof -
have "p\<cdot>x = (1\<parallel>p)\<cdot>(x\<parallel>1)"
by (metis par_unitl par_unitr)
also have "... = (1\<cdot>x)\<parallel>(p\<cdot>1)"
by (metis p_test test_exchangel test_one_closed)
also have "... = (1\<cdot>p)\<parallel>(x\<cdot>1)"
by (metis mult_onel mult_oner par_comm)
also have "... = x\<cdot>p"
by (metis p_test par_unitl par_unitr test_exchanger test_one_closed)
finally show ?thesis .
qed
lemma "p\<cdot>x \<le> x\<cdot>q"
lemma "p \<in> B \<Longrightarrow> p\<parallel>p = p"
by (metis test_eq test_idem)
lemma test_comm: "\<lbrakk>p \<in> B; q \<in> B\<rbrakk> \<Longrightarrow> p\<cdot>q = q\<cdot>p"
by (metis par_comm test_eq)
lemma "\<lbrakk>p \<in> B; q \<in> B; p\<cdot>x = p\<cdot>x\<cdot>q\<rbrakk> \<Longrightarrow> p\<cdot>x \<le> q"
nitpick oops
lemma test_assocl: "p \<in> B \<Longrightarrow> p\<cdot>(x\<parallel>y) \<le> (p\<cdot>x)\<parallel>(p\<cdot>y)"
by (metis test_eq test_exchangel test_idem)
lemma test_assocr: "p \<in> B \<Longrightarrow> (x\<parallel>y)\<cdot>p \<le> (x\<cdot>p)\<parallel>(y\<cdot>p)"
by (metis test_eq test_exchanger test_idem)
lemma encoding_eq: "\<lbrakk>p \<in> B; q \<in> B\<rbrakk> \<Longrightarrow> p\<cdot>x = p\<cdot>x\<cdot>q \<longleftrightarrow> p\<cdot>x \<le> x\<cdot>q"
proof (default, metis mult_assoc mult_isor mult_onel test_top)
assume assm: "p \<in> B" "q \<in> B" "p\<cdot>x \<le> x\<cdot>q"
have "p\<cdot>x \<le> p\<cdot>x\<cdot>q"
by (metis assm(1) assm(3) mult_assoc mult_isol test_idem)
moreover have "p\<cdot>x\<cdot>q \<le> p\<cdot>x"
by (metis (full_types) assm(2) mult_isol mult_oner test_top)
finally show "p \<in> B \<Longrightarrow> q \<in> B \<Longrightarrow> p \<cdot> x \<le> x \<cdot> q \<Longrightarrow> p \<cdot> x = p \<cdot> x \<cdot> q"
by metis
qed
end
end
|
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace G
A : E →L[𝕜] F
x : E
y : F
⊢ inner (↑(↑adjointAux A) y) x = inner y (↑A x)
[PROOFSTEP]
rw [adjointAux_apply, toDual_symm_apply, toSesqForm_apply_coe, coe_comp', innerSL_apply_coe, Function.comp_apply]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace G
A : E →L[𝕜] F
x : E
y : F
⊢ inner x (↑(↑adjointAux A) y) = inner (↑A x) y
[PROOFSTEP]
rw [← inner_conj_symm, adjointAux_inner_left, inner_conj_symm]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
⊢ ↑adjointAux (↑adjointAux A) = A
[PROOFSTEP]
ext v
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
v : E
⊢ ↑(↑adjointAux (↑adjointAux A)) v = ↑A v
[PROOFSTEP]
refine' ext_inner_left 𝕜 fun w => _
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
v : E
w : (fun x => F) v
⊢ inner w (↑(↑adjointAux (↑adjointAux A)) v) = inner w (↑A v)
[PROOFSTEP]
rw [adjointAux_inner_right, adjointAux_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
⊢ ‖↑adjointAux A‖ = ‖A‖
[PROOFSTEP]
refine' le_antisymm _ _
[GOAL]
case refine'_1
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
⊢ ‖↑adjointAux A‖ ≤ ‖A‖
[PROOFSTEP]
refine' ContinuousLinearMap.op_norm_le_bound _ (norm_nonneg _) fun x => _
[GOAL]
case refine'_1
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
x : F
⊢ ‖↑(↑adjointAux A) x‖ ≤ ‖A‖ * ‖x‖
[PROOFSTEP]
rw [adjointAux_apply, LinearIsometryEquiv.norm_map]
[GOAL]
case refine'_1
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
x : F
⊢ ‖↑(↑toSesqForm A) x‖ ≤ ‖A‖ * ‖x‖
[PROOFSTEP]
exact toSesqForm_apply_norm_le
[GOAL]
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
⊢ ‖A‖ ≤ ‖↑adjointAux A‖
[PROOFSTEP]
nth_rw 1 [← adjointAux_adjointAux A]
[GOAL]
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
⊢ ‖↑adjointAux (↑adjointAux A)‖ ≤ ‖↑adjointAux A‖
[PROOFSTEP]
refine' ContinuousLinearMap.op_norm_le_bound _ (norm_nonneg _) fun x => _
[GOAL]
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
x : E
⊢ ‖↑(↑adjointAux (↑adjointAux A)) x‖ ≤ ‖↑adjointAux A‖ * ‖x‖
[PROOFSTEP]
rw [adjointAux_apply, LinearIsometryEquiv.norm_map]
[GOAL]
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
x : E
⊢ ‖↑(↑toSesqForm (↑adjointAux A)) x‖ ≤ ‖↑adjointAux A‖ * ‖x‖
[PROOFSTEP]
exact toSesqForm_apply_norm_le
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : F →L[𝕜] G
B : E →L[𝕜] F
⊢ ↑adjoint (comp A B) = comp (↑adjoint B) (↑adjoint A)
[PROOFSTEP]
ext v
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : F →L[𝕜] G
B : E →L[𝕜] F
v : G
⊢ ↑(↑adjoint (comp A B)) v = ↑(comp (↑adjoint B) (↑adjoint A)) v
[PROOFSTEP]
refine' ext_inner_left 𝕜 fun w => _
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : F →L[𝕜] G
B : E →L[𝕜] F
v : G
w : (fun x => E) v
⊢ inner w (↑(↑adjoint (comp A B)) v) = inner w (↑(comp (↑adjoint B) (↑adjoint A)) v)
[PROOFSTEP]
simp only [adjoint_inner_right, ContinuousLinearMap.coe_comp', Function.comp_apply]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ ‖↑A x‖ ^ 2 = ↑re (inner (↑(↑adjoint A * A) x) x)
[PROOFSTEP]
have h : ⟪(A† * A) x, x⟫ = ⟪A x, A x⟫ := by rw [← adjoint_inner_left]; rfl
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ inner (↑(↑adjoint A * A) x) x = inner (↑A x) (↑A x)
[PROOFSTEP]
rw [← adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ inner (↑(↑adjoint A * A) x) x = inner (↑(↑adjoint A) (↑A x)) x
[PROOFSTEP]
rfl
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
h : inner (↑(↑adjoint A * A) x) x = inner (↑A x) (↑A x)
⊢ ‖↑A x‖ ^ 2 = ↑re (inner (↑(↑adjoint A * A) x) x)
[PROOFSTEP]
rw [h, ← inner_self_eq_norm_sq (𝕜 := 𝕜) _]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ ‖↑A x‖ = Real.sqrt (↑re (inner (↑(↑adjoint A * A) x) x))
[PROOFSTEP]
rw [← apply_norm_sq_eq_inner_adjoint_left, Real.sqrt_sq (norm_nonneg _)]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ ‖↑A x‖ ^ 2 = ↑re (inner x (↑(↑adjoint A * A) x))
[PROOFSTEP]
have h : ⟪x, (A† * A) x⟫ = ⟪A x, A x⟫ := by rw [← adjoint_inner_right]; rfl
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ inner x (↑(↑adjoint A * A) x) = inner (↑A x) (↑A x)
[PROOFSTEP]
rw [← adjoint_inner_right]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ inner x (↑(↑adjoint A * A) x) = inner x (↑(↑adjoint A) (↑A x))
[PROOFSTEP]
rfl
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
h : inner x (↑(↑adjoint A * A) x) = inner (↑A x) (↑A x)
⊢ ‖↑A x‖ ^ 2 = ↑re (inner x (↑(↑adjoint A * A) x))
[PROOFSTEP]
rw [h, ← inner_self_eq_norm_sq (𝕜 := 𝕜) _]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ ‖↑A x‖ = Real.sqrt (↑re (inner x (↑(↑adjoint A * A) x)))
[PROOFSTEP]
rw [← apply_norm_sq_eq_inner_adjoint_right, Real.sqrt_sq (norm_nonneg _)]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
B : F →L[𝕜] E
⊢ A = ↑adjoint B ↔ ∀ (x : E) (y : (fun x => F) x), inner (↑A x) y = inner x (↑B y)
[PROOFSTEP]
refine' ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => _⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
B : F →L[𝕜] E
h : A = ↑adjoint B
x : E
y : (fun x => F) x
⊢ inner (↑A x) y = inner x (↑B y)
[PROOFSTEP]
rw [h, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
B : F →L[𝕜] E
h : ∀ (x : E) (y : (fun x => F) x), inner (↑A x) y = inner x (↑B y)
⊢ A = ↑adjoint B
[PROOFSTEP]
ext x
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
B : F →L[𝕜] E
h : ∀ (x : E) (y : (fun x => F) x), inner (↑A x) y = inner x (↑B y)
x : E
⊢ ↑A x = ↑(↑adjoint B) x
[PROOFSTEP]
exact ext_inner_right 𝕜 fun y => by simp only [adjoint_inner_left, h x y]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] F
B : F →L[𝕜] E
h : ∀ (x : E) (y : (fun x => F) x), inner (↑A x) y = inner x (↑B y)
x : E
y : (fun x => F) x
⊢ inner (↑A x) y = inner (↑(↑adjoint B) x) y
[PROOFSTEP]
simp only [adjoint_inner_left, h x y]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
⊢ ↑adjoint (id 𝕜 E) = id 𝕜 E
[PROOFSTEP]
refine' Eq.symm _
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
⊢ id 𝕜 E = ↑adjoint (id 𝕜 E)
[PROOFSTEP]
rw [eq_adjoint_iff]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
⊢ ∀ (x : E) (y : (fun x => E) x), inner (↑(id 𝕜 E) x) y = inner x (↑(id 𝕜 E) y)
[PROOFSTEP]
simp
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
inst✝³ : CompleteSpace E
inst✝² : CompleteSpace G
inst✝¹ : CompleteSpace F
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
⊢ ↑adjoint (Submodule.subtypeL U) = orthogonalProjection U
[PROOFSTEP]
symm
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
inst✝³ : CompleteSpace E
inst✝² : CompleteSpace G
inst✝¹ : CompleteSpace F
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
⊢ orthogonalProjection U = ↑adjoint (Submodule.subtypeL U)
[PROOFSTEP]
rw [eq_adjoint_iff]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
inst✝³ : CompleteSpace E
inst✝² : CompleteSpace G
inst✝¹ : CompleteSpace F
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
⊢ ∀ (x : E) (y : (fun x => { x // x ∈ U }) x),
inner (↑(orthogonalProjection U) x) y = inner x (↑(Submodule.subtypeL U) y)
[PROOFSTEP]
intro x u
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
inst✝³ : CompleteSpace E
inst✝² : CompleteSpace G
inst✝¹ : CompleteSpace F
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
x : E
u : { x // x ∈ U }
⊢ inner (↑(orthogonalProjection U) x) u = inner x (↑(Submodule.subtypeL U) u)
[PROOFSTEP]
rw [U.coe_inner, inner_orthogonalProjection_left_eq_right, orthogonalProjection_mem_subspace_eq_self]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
inst✝³ : CompleteSpace E
inst✝² : CompleteSpace G
inst✝¹ : CompleteSpace F
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
x : E
u : { x // x ∈ U }
⊢ inner x ↑u = inner x (↑(Submodule.subtypeL U) u)
[PROOFSTEP]
rfl
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
inst✝³ : CompleteSpace E
inst✝² : CompleteSpace G
inst✝¹ : CompleteSpace F
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
⊢ ↑adjoint (orthogonalProjection U) = Submodule.subtypeL U
[PROOFSTEP]
rw [← U.adjoint_subtypeL, adjoint_adjoint]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
⊢ ∀ {x : E →L[𝕜] E}, ‖star x * x‖ = ‖x‖ * ‖x‖
[PROOFSTEP]
intro A
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
⊢ ‖star A * A‖ = ‖A‖ * ‖A‖
[PROOFSTEP]
rw [star_eq_adjoint]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
⊢ ‖↑adjoint A * A‖ = ‖A‖ * ‖A‖
[PROOFSTEP]
refine' le_antisymm _ _
[GOAL]
case refine'_1
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
⊢ ‖↑adjoint A * A‖ ≤ ‖A‖ * ‖A‖
[PROOFSTEP]
calc
‖A† * A‖ ≤ ‖A†‖ * ‖A‖ := op_norm_comp_le _ _
_ = ‖A‖ * ‖A‖ := by rw [LinearIsometryEquiv.norm_map]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
⊢ ‖↑adjoint A‖ * ‖A‖ = ‖A‖ * ‖A‖
[PROOFSTEP]
rw [LinearIsometryEquiv.norm_map]
[GOAL]
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
⊢ ‖A‖ * ‖A‖ ≤ ‖↑adjoint A * A‖
[PROOFSTEP]
rw [← sq, ← Real.sqrt_le_sqrt_iff (norm_nonneg _), Real.sqrt_sq (norm_nonneg _)]
[GOAL]
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
⊢ ‖A‖ ≤ Real.sqrt ‖↑adjoint A * A‖
[PROOFSTEP]
refine' op_norm_le_bound _ (Real.sqrt_nonneg _) fun x => _
[GOAL]
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
⊢ ‖↑A x‖ ≤ Real.sqrt ‖↑adjoint A * A‖ * ‖x‖
[PROOFSTEP]
have :=
calc
re ⟪(A† * A) x, x⟫ ≤ ‖(A† * A) x‖ * ‖x‖ := re_inner_le_norm _ _
_ ≤ ‖A† * A‖ * ‖x‖ * ‖x‖ := mul_le_mul_of_nonneg_right (le_op_norm _ _) (norm_nonneg _)
[GOAL]
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
this : ↑re (inner (↑(↑adjoint A * A) x) x) ≤ ‖↑adjoint A * A‖ * ‖x‖ * ‖x‖
⊢ ‖↑A x‖ ≤ Real.sqrt ‖↑adjoint A * A‖ * ‖x‖
[PROOFSTEP]
calc
‖A x‖ = Real.sqrt (re ⟪(A† * A) x, x⟫) := by rw [apply_norm_eq_sqrt_inner_adjoint_left]
_ ≤ Real.sqrt (‖A† * A‖ * ‖x‖ * ‖x‖) := (Real.sqrt_le_sqrt this)
_ = Real.sqrt ‖A† * A‖ * ‖x‖ := by
simp_rw [mul_assoc, Real.sqrt_mul (norm_nonneg _) (‖x‖ * ‖x‖), Real.sqrt_mul_self (norm_nonneg x)]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
this : ↑re (inner (↑(↑adjoint A * A) x) x) ≤ ‖↑adjoint A * A‖ * ‖x‖ * ‖x‖
⊢ ‖↑A x‖ = Real.sqrt (↑re (inner (↑(↑adjoint A * A) x) x))
[PROOFSTEP]
rw [apply_norm_eq_sqrt_inner_adjoint_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace G
inst✝ : CompleteSpace F
A : E →L[𝕜] E
x : E
this : ↑re (inner (↑(↑adjoint A * A) x) x) ≤ ‖↑adjoint A * A‖ * ‖x‖ * ‖x‖
⊢ Real.sqrt (‖↑adjoint A * A‖ * ‖x‖ * ‖x‖) = Real.sqrt ‖↑adjoint A * A‖ * ‖x‖
[PROOFSTEP]
simp_rw [mul_assoc, Real.sqrt_mul (norm_nonneg _) (‖x‖ * ‖x‖), Real.sqrt_mul_self (norm_nonneg x)]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁵ : IsROrC 𝕜
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedAddCommGroup F
inst✝¹² : NormedAddCommGroup G
inst✝¹¹ : InnerProductSpace 𝕜 E
inst✝¹⁰ : InnerProductSpace 𝕜 F
inst✝⁹ : InnerProductSpace 𝕜 G
inst✝⁸ : CompleteSpace E
inst✝⁷ : CompleteSpace G
inst✝⁶ : CompleteSpace F
E' : Type u_5
F' : Type u_6
inst✝⁵ : NormedAddCommGroup E'
inst✝⁴ : NormedAddCommGroup F'
inst✝³ : InnerProductSpace ℝ E'
inst✝² : InnerProductSpace ℝ F'
inst✝¹ : CompleteSpace E'
inst✝ : CompleteSpace F'
A : E' →L[ℝ] F'
⊢ LinearMap.IsAdjointPair sesqFormOfInner sesqFormOfInner ↑A ↑(↑adjoint A)
[PROOFSTEP]
intro x y
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁵ : IsROrC 𝕜
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedAddCommGroup F
inst✝¹² : NormedAddCommGroup G
inst✝¹¹ : InnerProductSpace 𝕜 E
inst✝¹⁰ : InnerProductSpace 𝕜 F
inst✝⁹ : InnerProductSpace 𝕜 G
inst✝⁸ : CompleteSpace E
inst✝⁷ : CompleteSpace G
inst✝⁶ : CompleteSpace F
E' : Type u_5
F' : Type u_6
inst✝⁵ : NormedAddCommGroup E'
inst✝⁴ : NormedAddCommGroup F'
inst✝³ : InnerProductSpace ℝ E'
inst✝² : InnerProductSpace ℝ F'
inst✝¹ : CompleteSpace E'
inst✝ : CompleteSpace F'
A : E' →L[ℝ] F'
x : E'
y : F'
⊢ ↑(↑sesqFormOfInner (↑↑A x)) y = ↑(↑sesqFormOfInner x) (↑↑(↑adjoint A) y)
[PROOFSTEP]
simp only [sesqFormOfInner_apply_apply, adjoint_inner_left, coe_coe]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
A : E →L[𝕜] E
hA : IsSelfAdjoint A
⊢ LinearMap.IsSymmetric ↑A
[PROOFSTEP]
intro x y
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
A : E →L[𝕜] E
hA : IsSelfAdjoint A
x y : E
⊢ inner (↑↑A x) y = inner x (↑↑A y)
[PROOFSTEP]
rw_mod_cast [← A.adjoint_inner_right, hA.adjoint_eq]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
T : E →L[𝕜] E
hT : IsSelfAdjoint T
S : E →L[𝕜] F
⊢ IsSelfAdjoint (comp S (comp T (↑adjoint S)))
[PROOFSTEP]
rw [isSelfAdjoint_iff'] at hT ⊢
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
T : E →L[𝕜] E
hT : ↑adjoint T = T
S : E →L[𝕜] F
⊢ ↑adjoint (comp S (comp T (↑adjoint S))) = comp S (comp T (↑adjoint S))
[PROOFSTEP]
simp only [hT, adjoint_comp, adjoint_adjoint]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
T : E →L[𝕜] E
hT : ↑adjoint T = T
S : E →L[𝕜] F
⊢ comp (comp S T) (↑adjoint S) = comp S (comp T (↑adjoint S))
[PROOFSTEP]
exact ContinuousLinearMap.comp_assoc _ _ _
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
T : E →L[𝕜] E
hT : IsSelfAdjoint T
S : F →L[𝕜] E
⊢ IsSelfAdjoint (comp (↑adjoint S) (comp T S))
[PROOFSTEP]
rw [isSelfAdjoint_iff'] at hT ⊢
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
T : E →L[𝕜] E
hT : ↑adjoint T = T
S : F →L[𝕜] E
⊢ ↑adjoint (comp (↑adjoint S) (comp T S)) = comp (↑adjoint S) (comp T S)
[PROOFSTEP]
simp only [hT, adjoint_comp, adjoint_adjoint]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
T : E →L[𝕜] E
hT : ↑adjoint T = T
S : F →L[𝕜] E
⊢ comp (comp (↑adjoint S) T) S = comp (↑adjoint S) (comp T S)
[PROOFSTEP]
exact ContinuousLinearMap.comp_assoc _ _ _
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁸ : IsROrC 𝕜
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : InnerProductSpace 𝕜 E
inst✝³ : InnerProductSpace 𝕜 F
inst✝² : InnerProductSpace 𝕜 G
inst✝¹ : CompleteSpace E
inst✝ : CompleteSpace F
A : E →L[𝕜] E
hA : LinearMap.IsSymmetric ↑A
⊢ IsSelfAdjoint A
[PROOFSTEP]
rwa [← ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric] at hA
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
T : E →L[𝕜] E
hT : IsSelfAdjoint T
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
⊢ IsSelfAdjoint
(comp (Submodule.subtypeL U)
(comp (orthogonalProjection U) (comp T (comp (Submodule.subtypeL U) (orthogonalProjection U)))))
[PROOFSTEP]
rw [← ContinuousLinearMap.comp_assoc]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
T : E →L[𝕜] E
hT : IsSelfAdjoint T
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
⊢ IsSelfAdjoint
(comp (comp (Submodule.subtypeL U) (orthogonalProjection U))
(comp T (comp (Submodule.subtypeL U) (orthogonalProjection U))))
[PROOFSTEP]
nth_rw 1 [← (orthogonalProjection_isSelfAdjoint U).adjoint_eq]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
T : E →L[𝕜] E
hT : IsSelfAdjoint T
U : Submodule 𝕜 E
inst✝ : CompleteSpace { x // x ∈ U }
⊢ IsSelfAdjoint
(comp (↑adjoint (comp (Submodule.subtypeL U) (orthogonalProjection U)))
(comp T (comp (Submodule.subtypeL U) (orthogonalProjection U))))
[PROOFSTEP]
refine' hT.adjoint_conj _
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
x : E
y : F
⊢ inner (↑(↑adjoint A) y) x = inner y (↑A x)
[PROOFSTEP]
rw [← coe_toContinuousLinearMap A, adjoint_eq_toClm_adjoint]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
x : E
y : F
⊢ inner (↑↑(↑ContinuousLinearMap.adjoint (↑toContinuousLinearMap ↑(↑toContinuousLinearMap A))) y) x =
inner y (↑↑(↑toContinuousLinearMap A) x)
[PROOFSTEP]
exact ContinuousLinearMap.adjoint_inner_left _ x y
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
x : E
y : F
⊢ inner x (↑(↑adjoint A) y) = inner (↑A x) y
[PROOFSTEP]
rw [← coe_toContinuousLinearMap A, adjoint_eq_toClm_adjoint]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
x : E
y : F
⊢ inner x (↑↑(↑ContinuousLinearMap.adjoint (↑toContinuousLinearMap ↑(↑toContinuousLinearMap A))) y) =
inner (↑↑(↑toContinuousLinearMap A) x) y
[PROOFSTEP]
exact ContinuousLinearMap.adjoint_inner_right _ x y
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
⊢ ↑adjoint (↑adjoint A) = A
[PROOFSTEP]
ext v
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
v : E
⊢ ↑(↑adjoint (↑adjoint A)) v = ↑A v
[PROOFSTEP]
refine' ext_inner_left 𝕜 fun w => _
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
v : E
w : (fun x => F) v
⊢ inner w (↑(↑adjoint (↑adjoint A)) v) = inner w (↑A v)
[PROOFSTEP]
rw [adjoint_inner_right, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : F →ₗ[𝕜] G
B : E →ₗ[𝕜] F
⊢ ↑adjoint (comp A B) = comp (↑adjoint B) (↑adjoint A)
[PROOFSTEP]
ext v
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : F →ₗ[𝕜] G
B : E →ₗ[𝕜] F
v : G
⊢ ↑(↑adjoint (comp A B)) v = ↑(comp (↑adjoint B) (↑adjoint A)) v
[PROOFSTEP]
refine' ext_inner_left 𝕜 fun w => _
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : F →ₗ[𝕜] G
B : E →ₗ[𝕜] F
v : G
w : (fun x => E) v
⊢ inner w (↑(↑adjoint (comp A B)) v) = inner w (↑(comp (↑adjoint B) (↑adjoint A)) v)
[PROOFSTEP]
simp only [adjoint_inner_right, LinearMap.coe_comp, Function.comp_apply]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
⊢ A = ↑adjoint B ↔ ∀ (x : E) (y : (fun x => F) x), inner (↑A x) y = inner x (↑B y)
[PROOFSTEP]
refine' ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => _⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : A = ↑adjoint B
x : E
y : (fun x => F) x
⊢ inner (↑A x) y = inner x (↑B y)
[PROOFSTEP]
rw [h, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (x : E) (y : (fun x => F) x), inner (↑A x) y = inner x (↑B y)
⊢ A = ↑adjoint B
[PROOFSTEP]
ext x
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (x : E) (y : (fun x => F) x), inner (↑A x) y = inner x (↑B y)
x : E
⊢ ↑A x = ↑(↑adjoint B) x
[PROOFSTEP]
exact ext_inner_right 𝕜 fun y => by simp only [adjoint_inner_left, h x y]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (x : E) (y : (fun x => F) x), inner (↑A x) y = inner x (↑B y)
x : E
y : (fun x => F) x
⊢ inner (↑A x) y = inner (↑(↑adjoint B) x) y
[PROOFSTEP]
simp only [adjoint_inner_left, h x y]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι₁ : Type u_5
ι₂ : Type u_6
b₁ : Basis ι₁ 𝕜 E
b₂ : Basis ι₂ 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
⊢ A = ↑adjoint B ↔ ∀ (i₁ : ι₁) (i₂ : ι₂), inner (↑A (↑b₁ i₁)) (↑b₂ i₂) = inner (↑b₁ i₁) (↑B (↑b₂ i₂))
[PROOFSTEP]
refine' ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => _⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι₁ : Type u_5
ι₂ : Type u_6
b₁ : Basis ι₁ 𝕜 E
b₂ : Basis ι₂ 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : A = ↑adjoint B
x : ι₁
y : ι₂
⊢ inner (↑A (↑b₁ x)) (↑b₂ y) = inner (↑b₁ x) (↑B (↑b₂ y))
[PROOFSTEP]
rw [h, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι₁ : Type u_5
ι₂ : Type u_6
b₁ : Basis ι₁ 𝕜 E
b₂ : Basis ι₂ 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (i₁ : ι₁) (i₂ : ι₂), inner (↑A (↑b₁ i₁)) (↑b₂ i₂) = inner (↑b₁ i₁) (↑B (↑b₂ i₂))
⊢ A = ↑adjoint B
[PROOFSTEP]
refine' Basis.ext b₁ fun i₁ => _
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι₁ : Type u_5
ι₂ : Type u_6
b₁ : Basis ι₁ 𝕜 E
b₂ : Basis ι₂ 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (i₁ : ι₁) (i₂ : ι₂), inner (↑A (↑b₁ i₁)) (↑b₂ i₂) = inner (↑b₁ i₁) (↑B (↑b₂ i₂))
i₁ : ι₁
⊢ ↑A (↑b₁ i₁) = ↑(↑adjoint B) (↑b₁ i₁)
[PROOFSTEP]
exact ext_inner_right_basis b₂ fun i₂ => by simp only [adjoint_inner_left, h i₁ i₂]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι₁ : Type u_5
ι₂ : Type u_6
b₁ : Basis ι₁ 𝕜 E
b₂ : Basis ι₂ 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (i₁ : ι₁) (i₂ : ι₂), inner (↑A (↑b₁ i₁)) (↑b₂ i₂) = inner (↑b₁ i₁) (↑B (↑b₂ i₂))
i₁ : ι₁
i₂ : ι₂
⊢ inner (↑A (↑b₁ i₁)) (↑b₂ i₂) = inner (↑(↑adjoint B) (↑b₁ i₁)) (↑b₂ i₂)
[PROOFSTEP]
simp only [adjoint_inner_left, h i₁ i₂]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 E
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
⊢ A = ↑adjoint B ↔ ∀ (i : ι) (y : (fun x => F) (↑b i)), inner (↑A (↑b i)) y = inner (↑b i) (↑B y)
[PROOFSTEP]
refine' ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => Basis.ext b fun i => _⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 E
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : A = ↑adjoint B
x : ι
y : (fun x => F) (↑b x)
⊢ inner (↑A (↑b x)) y = inner (↑b x) (↑B y)
[PROOFSTEP]
rw [h, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 E
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (i : ι) (y : (fun x => F) (↑b i)), inner (↑A (↑b i)) y = inner (↑b i) (↑B y)
i : ι
⊢ ↑A (↑b i) = ↑(↑adjoint B) (↑b i)
[PROOFSTEP]
exact ext_inner_right 𝕜 fun y => by simp only [h i, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 E
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (i : ι) (y : (fun x => F) (↑b i)), inner (↑A (↑b i)) y = inner (↑b i) (↑B y)
i : ι
y : (fun x => F) (↑b i)
⊢ inner (↑A (↑b i)) y = inner (↑(↑adjoint B) (↑b i)) y
[PROOFSTEP]
simp only [h i, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
⊢ A = ↑adjoint B ↔ ∀ (i : ι) (x : E), inner (↑A x) (↑b i) = inner x (↑B (↑b i))
[PROOFSTEP]
refine' ⟨fun h x y => by rw [h, adjoint_inner_left], fun h => _⟩
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : A = ↑adjoint B
x : ι
y : E
⊢ inner (↑A y) (↑b x) = inner y (↑B (↑b x))
[PROOFSTEP]
rw [h, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (i : ι) (x : E), inner (↑A x) (↑b i) = inner x (↑B (↑b i))
⊢ A = ↑adjoint B
[PROOFSTEP]
ext x
[GOAL]
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (i : ι) (x : E), inner (↑A x) (↑b i) = inner x (↑B (↑b i))
x : E
⊢ ↑A x = ↑(↑adjoint B) x
[PROOFSTEP]
refine' ext_inner_right_basis b fun i => by simp only [h i, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
ι : Type u_5
b : Basis ι 𝕜 F
A : E →ₗ[𝕜] F
B : F →ₗ[𝕜] E
h : ∀ (i : ι) (x : E), inner (↑A x) (↑b i) = inner x (↑B (↑b i))
x : E
i : ι
⊢ inner (↑A x) (↑b i) = inner (↑(↑adjoint B) x) (↑b i)
[PROOFSTEP]
simp only [h i, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] E
⊢ IsSymmetric A ↔ IsSelfAdjoint A
[PROOFSTEP]
rw [isSelfAdjoint_iff', IsSymmetric, ← LinearMap.eq_adjoint_iff]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
A : E →ₗ[𝕜] E
⊢ A = ↑adjoint A ↔ ↑adjoint A = A
[PROOFSTEP]
exact eq_comm
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁵ : IsROrC 𝕜
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedAddCommGroup F
inst✝¹² : NormedAddCommGroup G
inst✝¹¹ : InnerProductSpace 𝕜 E
inst✝¹⁰ : InnerProductSpace 𝕜 F
inst✝⁹ : InnerProductSpace 𝕜 G
inst✝⁸ : FiniteDimensional 𝕜 E
inst✝⁷ : FiniteDimensional 𝕜 F
inst✝⁶ : FiniteDimensional 𝕜 G
E' : Type u_5
F' : Type u_6
inst✝⁵ : NormedAddCommGroup E'
inst✝⁴ : NormedAddCommGroup F'
inst✝³ : InnerProductSpace ℝ E'
inst✝² : InnerProductSpace ℝ F'
inst✝¹ : FiniteDimensional ℝ E'
inst✝ : FiniteDimensional ℝ F'
A : E' →ₗ[ℝ] F'
⊢ IsAdjointPair sesqFormOfInner sesqFormOfInner A (↑adjoint A)
[PROOFSTEP]
intro x y
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁵ : IsROrC 𝕜
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedAddCommGroup F
inst✝¹² : NormedAddCommGroup G
inst✝¹¹ : InnerProductSpace 𝕜 E
inst✝¹⁰ : InnerProductSpace 𝕜 F
inst✝⁹ : InnerProductSpace 𝕜 G
inst✝⁸ : FiniteDimensional 𝕜 E
inst✝⁷ : FiniteDimensional 𝕜 F
inst✝⁶ : FiniteDimensional 𝕜 G
E' : Type u_5
F' : Type u_6
inst✝⁵ : NormedAddCommGroup E'
inst✝⁴ : NormedAddCommGroup F'
inst✝³ : InnerProductSpace ℝ E'
inst✝² : InnerProductSpace ℝ F'
inst✝¹ : FiniteDimensional ℝ E'
inst✝ : FiniteDimensional ℝ F'
A : E' →ₗ[ℝ] F'
x : E'
y : F'
⊢ ↑(↑sesqFormOfInner (↑A x)) y = ↑(↑sesqFormOfInner x) (↑(↑adjoint A) y)
[PROOFSTEP]
simp only [sesqFormOfInner_apply_apply, adjoint_inner_left]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
T : E →ₗ[𝕜] E
⊢ IsSymmetric (↑adjoint T * T)
[PROOFSTEP]
intro x y
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
T : E →ₗ[𝕜] E
x y : E
⊢ inner (↑(↑adjoint T * T) x) y = inner x (↑(↑adjoint T * T) y)
[PROOFSTEP]
simp only [mul_apply, adjoint_inner_left, adjoint_inner_right]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
T : E →ₗ[𝕜] E
x : E
⊢ 0 ≤ ↑re (inner x (↑(↑adjoint T * T) x))
[PROOFSTEP]
simp only [mul_apply, adjoint_inner_right, inner_self_eq_norm_sq_to_K]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
T : E →ₗ[𝕜] E
x : E
⊢ 0 ≤ ↑re (↑‖↑T x‖ ^ 2)
[PROOFSTEP]
norm_cast
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
T : E →ₗ[𝕜] E
x : E
⊢ 0 ≤ ‖↑T x‖ ^ 2
[PROOFSTEP]
exact sq_nonneg _
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
T : E →ₗ[𝕜] E
x : E
⊢ ↑im (inner x (↑(↑adjoint T) (↑T x))) = 0
[PROOFSTEP]
simp only [mul_apply, adjoint_inner_right, inner_self_eq_norm_sq_to_K]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁹ : IsROrC 𝕜
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : InnerProductSpace 𝕜 E
inst✝⁴ : InnerProductSpace 𝕜 F
inst✝³ : InnerProductSpace 𝕜 G
inst✝² : FiniteDimensional 𝕜 E
inst✝¹ : FiniteDimensional 𝕜 F
inst✝ : FiniteDimensional 𝕜 G
T : E →ₗ[𝕜] E
x : E
⊢ ↑im (↑‖↑T x‖ ^ 2) = 0
[PROOFSTEP]
norm_cast
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
m : Type u_5
n : Type u_6
inst✝³ : Fintype m
inst✝² : DecidableEq m
inst✝¹ : Fintype n
inst✝ : DecidableEq n
A : Matrix m n 𝕜
⊢ ↑toEuclideanLin Aᴴ = ↑LinearMap.adjoint (↑toEuclideanLin A)
[PROOFSTEP]
rw [LinearMap.eq_adjoint_iff]
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
m : Type u_5
n : Type u_6
inst✝³ : Fintype m
inst✝² : DecidableEq m
inst✝¹ : Fintype n
inst✝ : DecidableEq n
A : Matrix m n 𝕜
⊢ ∀ (x : EuclideanSpace 𝕜 m) (y : (fun x => EuclideanSpace 𝕜 n) x),
inner (↑(↑toEuclideanLin Aᴴ) x) y = inner x (↑(↑toEuclideanLin A) y)
[PROOFSTEP]
intro x y
[GOAL]
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝¹⁰ : IsROrC 𝕜
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : InnerProductSpace 𝕜 E
inst✝⁵ : InnerProductSpace 𝕜 F
inst✝⁴ : InnerProductSpace 𝕜 G
m : Type u_5
n : Type u_6
inst✝³ : Fintype m
inst✝² : DecidableEq m
inst✝¹ : Fintype n
inst✝ : DecidableEq n
A : Matrix m n 𝕜
x : EuclideanSpace 𝕜 m
y : EuclideanSpace 𝕜 n
⊢ inner (↑(↑toEuclideanLin Aᴴ) x) y = inner x (↑(↑toEuclideanLin A) y)
[PROOFSTEP]
simp_rw [EuclideanSpace.inner_eq_star_dotProduct, piLp_equiv_toEuclideanLin, toLin'_apply, star_mulVec,
conjTranspose_conjTranspose, dotProduct_mulVec]
|
lemma Re_csqrt: "0 \<le> Re (csqrt z)"
|
[STATEMENT]
lemma isLbD2a: "isLb R S x \<Longrightarrow> x \<in> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. isLb R S x \<Longrightarrow> x \<in> R
[PROOF STEP]
by (simp add: isLb_def)
|
box::use(utils[tail])
#' @export
global_path = tail(box:::mod_search_path(environment()), 1L)
#' @export
path_in_fun = function () {
tail(box:::mod_search_path(environment()), 1L)
}
#' @export
path_in_nested_fun = function () {
f = function () {
tail(box:::mod_search_path(environment()), 1L)
}
f()
}
|
import Data.Fuel
%default covering -- total
interface X a where
ls : Fuel -> List a
mutual
X Nat where
ls Dry = []
ls (More f) = [length $ the (List Bool) $ ls f]
X Bool where
ls Dry = []
ls (More f) = [null $ the (List Nat) $ ls f]
main : IO Unit
main =
putStrLn $ show $ the (List Nat) $ ls $ limit 6
|
######################################################################
`eta/stasheff_trees` := proc(A::set)
if nops(A) = 1 then
return [`eta/ord`(A),`eta/trees`(A)];
else
return FAIL;
fi;
end;
`gamma/stasheff_trees` := (A::set,B::set) -> (p) -> proc(Y,XX)
local R,TT,SS,UUUU,b;
R,TT := op(Y);
SS := table();
UUUU := table();
for b in B do
SS[b],UUUU[b] := op(XX[b]);
od;
return [`gamma/ord`(A,B)(p)(R,SS),
`gamma/trees`(A,B)(p)(TT,UUUU)];
end;
|
(*
* Copyright 2014, General Dynamics C4 Systems
*
* SPDX-License-Identifier: GPL-2.0-only
*)
(*
VSpace refinement
*)
theory VSpacePre_AI
imports "$L4V_ARCH/ArchTcbAcc_AI"
begin
context begin interpretation Arch .
requalify_facts
cap_master_cap_tcb_cap_valid_arch
end
lemma throw_on_false_wp[wp]:
"\<lbrace>P\<rbrace> f \<lbrace>\<lambda>rv s. (rv \<longrightarrow> Q () s) \<and> (\<not> rv \<longrightarrow> E x s)\<rbrace>
\<Longrightarrow> \<lbrace>P\<rbrace> throw_on_false x f \<lbrace>Q\<rbrace>,\<lbrace>E\<rbrace>"
apply (simp add: throw_on_false_def unlessE_def)
apply wp
apply simp
apply simp
done
crunch_ignore (add: throw_on_false)
definition
"is_arch_update cap cap' \<equiv> is_arch_cap cap \<and> cap_master_cap cap = cap_master_cap cap'"
lemma dmo_asid_map [wp]:
"\<lbrace>valid_asid_map\<rbrace> do_machine_op f \<lbrace>\<lambda>_. valid_asid_map\<rbrace>"
apply (simp add: do_machine_op_def split_def)
apply wp
apply simp
done
crunch caps_of_state[wp]: do_machine_op "\<lambda>s. P (caps_of_state s)"
interpretation dmo: non_vspace_non_cap_op "do_machine_op f"
by (unfold_locales; wp)
declare not_Some_eq_tuple[simp]
lemma valid_irq_states_arch_state_update[simp]:
"valid_irq_states (s\<lparr>arch_state := x\<rparr>) = valid_irq_states s"
by(auto simp: valid_irq_states_def)
lemma pull_out_P:
"P s \<and> (\<forall>c. caps_of_state s p = Some c \<longrightarrow> Q s c) \<longrightarrow> (\<forall>c. caps_of_state s p = Some c \<longrightarrow> P s \<and> Q s c)"
by blast
lemma upto_enum_step_subtract:
"x \<le> z \<Longrightarrow> [x, y .e. z] = (map ((+) x) [0, y - x .e. z - x])"
by (auto simp add: upto_enum_step_def)
(* FIXME: move *)
lemma returnOk_E': "\<lbrace>P\<rbrace> returnOk r -,\<lbrace>E\<rbrace>"
by (clarsimp simp: returnOk_def validE_E_def validE_def valid_def return_def)
lemma throwError_R': "\<lbrace>P\<rbrace> throwError e \<lbrace>Q\<rbrace>,-"
by (clarsimp simp:throwError_def validE_R_def validE_def valid_def return_def)
lemma invs_valid_irq_states[elim!]:
"invs s \<Longrightarrow> valid_irq_states s"
by(auto simp: invs_def valid_state_def)
lemma bool_function_four_cases:
"f = Not \<or> f = id \<or> f = (\<lambda>_. True) \<or> f = (\<lambda>_. False)"
by (auto simp add: fun_eq_iff all_bool_eq)
lemma uint_ucast:
"(x :: ('a :: len) word) < 2 ^ len_of TYPE ('b)
\<Longrightarrow> uint (ucast x :: ('b :: len) word) = uint x"
apply (simp add: ucast_def)
apply (subst word_uint.Abs_inverse)
apply (simp add: uints_num word_less_alt word_le_def)
apply (frule impI[where P="True"])
apply (subst(asm) uint_2p)
apply (clarsimp simp only: word_neq_0_conv[symmetric])
apply simp_all
done
(* FIXME: move *)
lemma inj_on_domD: "\<lbrakk>inj_on f (dom f); f x = Some z; f y = Some z\<rbrakk> \<Longrightarrow> x = y"
by (erule inj_onD) clarsimp+
lemma hoare_name_pre_state2:
"(\<And>s. \<lbrace>P and ((=) s)\<rbrace> f \<lbrace>Q\<rbrace>) \<Longrightarrow> \<lbrace>P\<rbrace> f \<lbrace>Q\<rbrace>"
by (auto simp: valid_def intro: hoare_name_pre_state)
lemma pd_casting_shifting:
"size x + n < len_of TYPE('a) \<Longrightarrow>
ucast (ucast x << n >> n :: ('a :: len) word) = x"
apply (rule word_eqI)
apply (simp add: nth_ucast nth_shiftr nth_shiftl word_size)
done
lemma aligned_already_mask:
"is_aligned x n \<Longrightarrow> is_aligned (x && msk) n"
apply (simp add: is_aligned_mask word_bw_assocs)
apply (subst word_bw_comms, subst word_bw_assocs[symmetric])
apply simp
done
lemma set_upto_enum_step_4:
"set [0, 4 .e. x :: word32]
= (\<lambda>x. x << 2) ` {.. x >> 2}"
by (auto simp: upto_enum_step_def shiftl_t2n shiftr_div_2n_w
word_size mult.commute)
lemma set_upto_enum_step_8:
"set [0, 8 .e. x :: word32]
= (\<lambda>x. x << 3) ` {.. x >> 3}"
by (auto simp: upto_enum_step_def shiftl_t2n shiftr_div_2n_w
word_size mult.commute)
lemma arch_update_cap_zombies:
"\<lbrace>\<lambda>s. cte_wp_at (is_arch_update cap) p s \<and> zombies_final s\<rbrace> set_cap cap p \<lbrace>\<lambda>rv s. zombies_final s\<rbrace>"
apply (simp add: zombies_final_def2 cte_wp_at_caps_of_state del: split_paired_All)
apply wp
apply (intro allI impI)
apply (elim conjE exE)
apply (simp del: split_paired_All add: is_arch_update_def split: if_split_asm)
apply (erule_tac x=p in allE)
apply (erule_tac x=p' in allE)
apply simp
apply (frule master_cap_obj_refs)
apply (drule cap_master_cap_zombie)
apply clarsimp
apply (erule_tac x=pa in allE)
apply (erule_tac x=p in allE)
apply simp
apply (frule master_cap_obj_refs)
apply (drule cap_master_cap_zombie)
apply clarsimp
done
lemma arch_update_cap_pspace:
"\<lbrace>cte_wp_at (is_arch_update cap and
(\<lambda>c. is_valid_vtable_root c \<longrightarrow> is_valid_vtable_root cap)) p
and valid_pspace and valid_cap cap\<rbrace>
set_cap cap p
\<lbrace>\<lambda>rv. valid_pspace\<rbrace>"
apply (simp add: valid_pspace_def)
apply (rule hoare_pre)
apply (wp set_cap_valid_objs update_cap_iflive arch_update_cap_zombies)
apply clarsimp
apply (clarsimp simp: cte_wp_at_caps_of_state is_arch_update_def)
apply (frule cap_master_cap_zobj_refs)
apply clarsimp
apply (drule caps_of_state_cteD)
apply (drule (1) cte_wp_tcb_cap_valid)
apply (clarsimp simp: cap_master_cap_tcb_cap_valid_arch)
done
lemma arch_update_cap_valid_mdb:
"\<lbrace>cte_wp_at (is_arch_update cap) p and valid_mdb\<rbrace> set_cap cap p \<lbrace>\<lambda>rv. valid_mdb\<rbrace>"
apply (simp add: valid_mdb_def2 pred_conj_def)
apply (rule hoare_lift_Pf2 [where f=cdt])
prefer 2
apply wp[1]
apply (rule hoare_lift_Pf2 [where f=is_original_cap])
prefer 2
apply wp[1]
apply (rule hoare_pre)
apply wp
apply (clarsimp simp: cte_wp_at_caps_of_state)
apply (rule conjI)
apply (clarsimp simp: mdb_cte_at_def is_arch_update_def)
apply (fastforce simp: is_cap_simps)
apply (rule conjI)
apply (clarsimp simp: untyped_mdb_def is_arch_update_def)
apply (rule conjI)
apply (fastforce simp: is_cap_simps)
apply clarsimp
apply (drule master_cap_obj_refs)
apply fastforce
apply (rule conjI)
apply (erule(1) descendants_inc_minor)
apply (clarsimp simp:is_arch_update_def)
apply (frule master_cap_class)
apply (clarsimp dest!:master_cap_cap_range)
apply (rule conjI)
apply (clarsimp simp: untyped_inc_def is_arch_update_def)
subgoal by (fastforce simp: is_cap_simps)
apply (rule conjI)
apply (clarsimp simp: ut_revocable_def)
apply (clarsimp simp: is_arch_update_def is_cap_simps)
apply (rule conjI)
apply (clarsimp simp: irq_revocable_def is_arch_update_def is_cap_simps simp del: split_paired_All)
apply (rule conjI)
apply (clarsimp simp: reply_master_revocable_def is_arch_update_def is_cap_simps)
apply (clarsimp simp: reply_mdb_def is_arch_update_def)
apply (rule conjI)
apply (clarsimp simp: reply_caps_mdb_def is_cap_simps cap_master_cap_def
simp del: split_paired_Ex split_paired_All)
apply (fastforce elim!: exEI)
apply (rule conjI, fastforce simp: is_cap_simps cap_master_cap_def reply_masters_mdb_def)
by (erule (2) valid_arch_mdb_same_master_cap[simplified fun_upd_def])
lemma set_cap_arch_obj:
"\<lbrace>ko_at (ArchObj ao) p and cte_at p'\<rbrace> set_cap cap p' \<lbrace>\<lambda>_. ko_at (ArchObj ao) p\<rbrace>"
apply (wp set_cap_obj_at_other)
apply (clarsimp simp: obj_at_def cte_wp_at_cases)
done
lemma set_mrs_typ_at[wp]:
"\<lbrace>\<lambda>s. P (typ_at T p s)\<rbrace> set_mrs t buf mrs \<lbrace>\<lambda>rv s. P (typ_at T p s)\<rbrace>"
apply (simp add: set_mrs_def zipWithM_x_mapM split_def
store_word_offs_def set_object_def get_object_def
cong: option.case_cong
split del: if_split)
apply (wp hoare_vcg_split_case_option)
apply (rule mapM_wp [where S=UNIV, simplified])
apply (wp | simp)+
apply (clarsimp simp: obj_at_def a_type_def
dest!: get_tcb_SomeD)
done
lemma set_mrs_tcb[wp]:
"\<lbrace> tcb_at t \<rbrace> set_mrs receiver recv_buf mrs \<lbrace>\<lambda>rv. tcb_at t \<rbrace>"
by (simp add: tcb_at_typ, wp)
lemma set_mrs_ntfn_at[wp]:
"\<lbrace> ntfn_at p \<rbrace> set_mrs receiver recv_buf mrs \<lbrace>\<lambda>rv. ntfn_at p \<rbrace>"
by (simp add: ntfn_at_typ, wp)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.