text
stringlengths 0
3.34M
|
---|
{- This file describes properties of computable relations. -}
open import bool
open import level
open import eq
open import product
open import product-thms
open import negation
module relations where
-- Decidable relations.
-- This was taken from the Agda STDLIB.
data Dec {p} (P : Set p) : Set p where
yes : ( p : P) → Dec P
no : (¬p : ¬ P) → Dec P
module relationsOld {ℓ ℓ' : level}{A : Set ℓ} (_≥A_ : A → A → Set ℓ') where
reflexive : Set (ℓ ⊔ ℓ')
reflexive = ∀ {a : A} → a ≥A a
transitive : Set (ℓ ⊔ ℓ')
transitive = ∀ {a b c : A} → a ≥A b → b ≥A c → a ≥A c
preorder : Set (ℓ ⊔ ℓ')
preorder = reflexive ∧ transitive
_iso_ : A → A → Set ℓ'
d iso d' = d ≥A d' ∧ d' ≥A d
iso-intro : ∀{x y : A} → x ≥A y → y ≥A x → x iso y
iso-intro p1 p2 = p1 , p2
|
\problemname{Flight Plan Evaluation}
%\illustration{0.42}{sample1}{The second sample input}
When flying between two places, constructing a good flight plan is
important. In general there is a wide range of different factors to
consider, the most important being fuel consumption and weather
forecasts (especially winds). In this problem, we will evaluate
flight plans with respect to a third statistic, namely how much of the
flight is over water, and how much is over ground. This statistic is
not relevant per se, yet many passengers seem to prefer flying over
land -- either because they are afraid of flying over water, or simply
because the view tends to be slightly more interesting when flying
over land.
For this problem, we assume that the earth is a perfect sphere with
radius $6370$ km. We model each continent of the earth as a polygon
on this sphere -- a closed sequence of line segments, where a line
segment between two points consists of the shortest spherical arc
between these two points. The two end-points of a line segment can
not be the same point, or antipodal (diametrically opposite) points.
Similarly a flight route is modeled as a sequence of waypoints
connected by line segments, but unlike the line segments of a polygon
these line segments may cross themselves and will not necessarily end
up where they started.
\begin{figure}[!h]
\centering
\includegraphics[width=0.55\textwidth]{sample1}
\caption{The second sample input}
\end{figure}
In order to simplify the problem, we additionally make the following
two assumptions:
\begin{itemize}
\item No waypoint of a flight route lies within $0.1$ km of any shoreline (a line segment that is part of a polygon).
\item No vertex of any continent polygon lies within $0.1$ km of the flight route.
\end{itemize}
All coordinates on the sphere are represented as a pair of latitude and
longitude (both in degrees). A point with latitude $\pm 90$ is the
north/south pole, and points with latitude $0$ are the points on the
equator.
\section*{Input}
The input consists of:
\begin{itemize}
\item one line with an integer $1 \le c \le 30$, the number of continents;
\item $c$ lines, each describing a continent. Each such line starts
with an integer $3 \le n \le 30$, the number of vertices in the
polygon describing the continent. This is followed by $n$ pairs of
integers $\phi_1, \lambda_1, \ldots, \phi_n, \lambda_n$, where $-90
\le \phi_i \le 90$ and $0 \le \lambda_i \le 359$ are the latitude and
longitude of the $i$th vertex of the continent;
\item one line describing the flight plan. The line starts with an
integer $2 \le m \le 30$, the number of waypoints. This is followed
by $m$ pairs of integers $\phi_1, \lambda_1, \ldots, \phi_m,
\lambda_m$, where $-90 \le \phi_i \le 90$ and $0 \le \lambda_i \le
359$ are the latitude and longitude of the $i$th waypoint of the
route.
\end{itemize}
A continent cannot cross itself. No continent will touch or contain
any other continent. Continents are given in counterclockwise order,
in the sense that
if you go from the first vertex of the polygon to
the second one, the interior of the continent is on your left hand
side.
%if the first point of a continent is $P$, and the
%second one is $Q$, then the interior of the continent is on the left
%side when going from $P$ to $Q$.
The first and last waypoints of the route will always be inside a
continent (but not necessarily the same continent).
\section*{Output}
Output two real numbers $l$ and $w$, where $l$ is
the total length of the flight (in km), and $w$ is the percentage of
the flight that is over water. The numbers should be accurate to an
absolute or relative error of at most $10^{-6}$.
|
-- Let-definitions cannot pattern match (or be recursive). Use where for that.
module NotAValidLetBinding where
data N : Set where
z : N
s : N -> N
bad = let pred : N -> N
pred z = z
pred (s n) = n
in pred (s (s z))
|
function[blobs] = rpUijlings2013(image, varargin)
% [blobs] = rpUijlings2013(image, varargin)
%
% Create a list of region proposals (blobs) of an image using the method of Uijlings2013.
%
% For information on the returned blobs see blob().
%
% Copyright by Holger Caesar, 2014
% Parse input
p = inputParser;
% Default settings suggested by Jasper
addParameter(p, 'ks', [50, 100]);
addParameter(p, 'sigma', 0.8);
addParameter(p, 'colorTypes', {'Hsv', 'Lab'});
addParameter(p, 'simFunctionHandles', {@SSSimColourTextureSizeFillOrig, @SSSimTextureSizeFill});
parse(p, varargin{:});
ks = p.Results.ks;
sigma = p.Results.sigma;
colorTypes = p.Results.colorTypes;
simFunctionHandles = p.Results.simFunctionHandles;
% Init SS
hierarchyCount = numel(ks) * numel(colorTypes) * numel(simFunctionHandles);
blobs = cell(hierarchyCount, 1);
priorities = cell(hierarchyCount, 1);
hBlobsInd = 1;
% Perform Selective Search on all parameter combinations
for ksInd = 1 : numel(ks),
for colorTypeInd = 1 : numel(colorTypes),
for simHndsI = 1 : numel(simFunctionHandles),
% Compute hierarchical grouping with current settings
[~, blobIndIm, blobBoxesInIm, hierarchy, priority] = Image2HierarchicalGrouping(image, sigma, ks(ksInd), ks(ksInd), colorTypes{colorTypeInd}, simFunctionHandles(simHndsI));
% Convert boxes to blobs (when there is only one blob, we can't
% create a hierarchy, i.e. for k=400)
if isempty(hierarchy),
blobs{hBlobsInd} = RecreateBlobHierarchyIndIm(blobIndIm, blobBoxesInIm, []);
else
blobs{hBlobsInd} = RecreateBlobHierarchyIndIm(blobIndIm, blobBoxesInIm, hierarchy{1});
end;
% Store priority
priorities{hBlobsInd} = priority;
hBlobsInd = hBlobsInd + 1;
end;
end;
end;
% Put all parameter results in a single cell array
blobs = flattenCellArray(blobs);
priorities = flattenCellArray(priorities);
% Do pseudo random sorting as in paper
priorities = priorities .* rand(size(priorities));
[~, sortIds] = sort(priorities, 'ascend');
blobs = blobs(sortIds, :);
% Convert to col struct
blobs = [blobs{:}];
blobs = blobs(:); |
subroutine taylor(kmax ,kmxdt ,kmxt ,np ,nfreqs , &
& luniwe ,wsp10 ,siglim ,wvlbed ,wvlsur , &
& frcbed ,frcsur ,ustbx ,ustby ,ustwix , &
& ustwiy ,sig ,thick ,zeta ,dps , &
& dudz ,dvdz ,rich ,bruvai ,rtur0 , &
& vicww ,u0 ,v0 ,tkepro ,tkedis , &
& fuiwe ,fviwe ,d2u0 ,d2v0 ,atg , &
& btg ,ctg ,utg ,vtg ,d2u , &
& d2v ,bv2 ,qz ,r1tg ,tke , &
& eps ,dijdij ,edvis ,zlw ,tlw , &
& ttkiw ,tiwtk ,futg ,fvtg ,freqlo , &
& frequp ,gdp )
!----- GPL ---------------------------------------------------------------------
!
! Copyright (C) Stichting Deltares, 2011-2016.
!
! 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 version 3.
!
! 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/>.
!
! contact: [email protected]
! Stichting Deltares
! P.O. Box 177
! 2600 MH Delft, The Netherlands
!
! All indications and logos of, and references to, "Delft3D" and "Deltares"
! are registered trademarks of Stichting Deltares, and remain the property of
! Stichting Deltares. All rights reserved.
!
!-------------------------------------------------------------------------------
! $Id: taylor.f90 5717 2016-01-12 11:35:24Z mourits $
! $HeadURL: https://svn.oss.deltares.nl/repos/delft3d/tags/6686/src/engines_gpl/flow2d3d/packages/kernel/src/taylor/taylor.f90 $
!!--description-----------------------------------------------------------------
!
! Function:-Turbulence production,
! -turbulence dissipation,
! -turbulence diffusion and
! -momentum exchange (not yet installed)
! due to Internal Waves (IW's) generated
!
! -internally by turbulence or
! -externally by surface perturbations or
! -externally by bed topography.
!
! These processes are estimated by solving real-
! valued eigenmodes of the Taylor-Goldstein second-
! order differential equation for internal waves in
! an arbitrary shear flow.
!
!
!!--pseudo code and references--------------------------------------------------
! NONE
!!--declarations----------------------------------------------------------------
use precision
!
use globaldata
!
implicit none
!
type(globdat),target :: gdp
!
! The following list of pointer parameters is used to point inside the gdp structure
!
real(fp) , pointer :: alfaz
real(fp) , pointer :: xmu0
real(fp) , pointer :: viscof
integer , pointer :: nrange
logical , pointer :: iwedia
real(fp) , pointer :: ag
real(fp) , pointer :: vonkar
!
! Global variables
!
integer :: kmax ! Description and declaration in esm_alloc_int.f90
integer :: kmxdt ! Description and declaration in dimens.igs
integer :: kmxt ! Description and declaration in dimens.igs
integer :: luniwe !! Unit number for diagnostic reports of this subprogram as well as called subroutines
integer :: nfreqs ! Description and declaration in dimens.igs
integer :: np !! Dimension for IWE frequency arrays MAX (1,NFREQS)
real(prec) :: dps ! Description and declaration in esm_alloc_real.f90
real(fp) :: frcbed ! Description and declaration in iwepar.igs
real(fp) :: frcsur ! Description and declaration in iwepar.igs
real(fp) :: siglim ! Description and declaration in iwepar.igs
real(fp) :: ustbx !! X/u-component of bed-shear stress velocity (zeta point)
real(fp) :: ustby !! Y/v-component of bed-shear stress velocity (zeta point)
real(fp) :: ustwix !! X/u-component of wind-shear stress velocity
real(fp) :: ustwiy !! Y/v-component of wind-shear stress velocity
real(fp) :: wsp10 !! Windspeed at 10 m
real(fp) , intent(in) :: wvlbed ! Description and declaration in iwepar.igs
real(fp) , intent(in) :: wvlsur ! Description and declaration in iwepar.igs
real(fp) :: zeta !! Water surface elevation
real(fp) , dimension(0:kmax) :: bruvai ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(0:kmax) :: d2u0
real(fp) , dimension(0:kmax) :: d2v0
real(fp) , dimension(0:kmax) :: dudz ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(0:kmax) :: dvdz ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(0:kmax) :: rich ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(0:kmax) :: vicww ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(0:kmax, 2) :: rtur0 ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(0:kmxdt) :: atg
real(fp) , dimension(0:kmxdt) :: btg
real(fp) , dimension(0:kmxdt) :: bv2
real(fp) , dimension(0:kmxdt) :: ctg
real(fp) , dimension(0:kmxdt) :: d2u
real(fp) , dimension(0:kmxdt) :: d2v
real(fp) , dimension(0:kmxdt) :: dijdij
real(fp) , dimension(0:kmxdt) :: edvis
real(fp) , dimension(0:kmxdt) :: eps ! Description and declaration in numeco.igs
real(fp) , dimension(0:kmxdt) :: futg
real(fp) , dimension(0:kmxdt) :: fvtg
real(fp) , dimension(0:kmxdt) :: qz
real(fp) , dimension(0:kmxdt) :: r1tg
real(fp) , dimension(0:kmxdt) :: tiwtk
real(fp) , dimension(0:kmxdt) :: tke
real(fp) , dimension(0:kmxdt) :: tlw
real(fp) , dimension(0:kmxdt) :: ttkiw
real(fp) , dimension(0:kmxdt) :: utg
real(fp) , dimension(0:kmxdt) :: vtg
real(fp) , dimension(0:kmxdt) :: zlw
real(fp) , dimension(kmax) :: fuiwe ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(kmax) :: fviwe ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(kmax) :: sig ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(kmax) :: thick ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(kmax) :: tkedis ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(kmax) :: tkepro ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(kmax) :: u0 ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(kmax) :: v0 ! Description and declaration in esm_alloc_real.f90
real(fp) , dimension(np, 2) :: freqlo
real(fp) , dimension(np, 2) :: frequp
!
!
! Local variables
!
integer :: k
integer :: kbed ! K-value on TG grid: upper level stratified layer
integer :: kcrit ! K-value on TG grid of the critical level associated with a given IW own mode (R1TG)
integer :: ktg
integer :: ktgcd ! KTG-value of upper most critical level
integer :: ktgcu ! KTG-value of lowest critical level
integer :: ktop ! K-value on TG grid: lower level stratified layer
integer :: n
integer :: ncrit
integer :: nd
integer :: ndir ! If NDIR=1 then horizontal Direction of IW propagation is in wavenumber direction, and in opposite direction for NDIR=2
integer :: nr
integer :: nrd
integer :: nru
integer :: nu
integer , dimension(2, 2) :: kcri ! K-value on TG grid of most upper and lower critical levels of turbulence- generated IW's
integer , dimension(2, 2) :: ncri ! Number of critical layers found per minimal or maximal K-value as well as sign of frequency of turbulence- generated IW's
logical :: barcli ! presence of subgrid barcolcinic modes
logical :: frfind ! If .true. then find root of TG equation as function of angular frequency, else find root as function of angle of horizontal wave number vector
logical :: singul ! Indicator of singular solution of TG equation
logical :: tgfind ! Indicator for instructing subroutine TG to yield the eigen mode for given input
logical :: top ! Indicator for instructing subroutine TG to yield the eigen mode by sweeping from surface to bed, or vice versa
logical :: useref ! Switch instructing INTPOL using reference velocity
logical , dimension(2, 2) :: sing ! Indicator of singular solutions of TG equation
real(fp) :: angle ! Angle [degrees] between horizontal IW wavenumber vector and x-u-axis
real(fp) :: az
real(fp) :: azmax ! Maximal rms IW vertical displacement amplitude
real(fp) :: bvav ! Mean bouyancy frequency
real(fp) :: bvmx ! Maximal buoyancy frequency
real(fp) :: bz ! Bandwidth of IW vertical wavenumber components
real(fp) :: crit ! Minimal value found after convergence of root-finding procedure ZBRENT
real(fp) :: cs2
real(fp) :: delf ! Increment in non-dimensional angular frequency
real(fp) :: epsiwe ! Depth integral of IWE dissipation rate
real(fp) :: factor
real(fp) :: frlo ! Left bracket of frequency interval with largest root of TG equation
real(fp) :: frup ! Right bracket of frequency interval with largest root of TG equation
real(fp) :: h0 ! Water depth
real(fp) :: hstrat ! Thickness of stratified layer
real(fp) :: omeg ! Angular frequency of IW with respect to ground (root of TG equation)
real(fp) :: pi2
real(fp) :: ratiod ! Ratio between depth-averaged kin. energy in internal wave and kin. energy of vertical motions, based on lowest critical layer
real(fp) :: ratiou ! Ratio between depth-averaged kin. energy in internal wave and kin. energy of vertical motions, based on upper critical layer
real(fp) :: ratiow ! Mean ratio between depth-averaged kin energy in internal wave and kin. energy of vertical motions
real(fp) :: riav ! Mean value of all RICH with RICH > RICRIT
real(fp) :: rilz ! Vertical interval with RICH > RICRIT
real(fp) :: scale ! Length scale for scaling
real(fp) :: term
real(fp) :: umag
real(fp) :: umean ! Depth-average of u-velocity component
real(fp) :: ustmx
real(fp) :: vmean ! Depth-average of v-velocity component
real(fp) :: wvltke ! First estimate of typical wave length of the turbulence that excites IW's
real(fp) :: xk ! Magnitude of horizntal wave number vector, in [m^-1]
real(fp) :: xkh ! Non-dimensional XK
real(fp) :: zlo ! Ozmidov length scale, depth-averaged over stratified layer
real(fp) :: zzlu
character(132) :: stage ! Text string to define in which part of the calibration we are
!
!
!! executable statements -------------------------------------------------------
!
!
ag => gdp%gdphysco%ag
vonkar => gdp%gdphysco%vonkar
alfaz => gdp%gdiwearr%alfaz
xmu0 => gdp%gdiwearr%xmu0
viscof => gdp%gdiwearr%viscof
nrange => gdp%gdiwearr%nrange
iwedia => gdp%gdiwearr%iwedia
!
pi2 = 8.*atan(1.)
!
! Initialise IWE-TKE exchange rates:
!
do k = 1, kmxt
ttkiw(k) = 0.0
tiwtk(k) = 0.0
enddo
do k = 1, kmax
tkepro(k) = 0.0
tkedis(k) = 0.0
enddo
!
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
! IWE generation by turbulence implying internal +
! re-distribution of TKE. +
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
h0 = zeta + real(dps,fp)
zzlu = vonkar*h0/8
wvltke = pi2*zzlu
xk = pi2/wvltke
useref = .true.
!
call intpol(kmax ,kmxdt ,kmxt ,h0 ,zeta , &
& dps ,siglim ,barcli ,riav ,rilz , &
& xk ,u0 ,dudz ,d2u0 ,ustbx , &
& ustwix ,v0 ,dvdz ,d2v0 ,ustby , &
& ustwiy ,sig ,thick ,rich ,bruvai , &
& rtur0 ,vicww ,scale ,bvav ,bvmx , &
& xkh ,kbed ,ktop ,umean ,vmean , &
& utg ,vtg ,d2u ,d2v ,bv2 , &
& tke ,eps ,edvis ,zlw ,tlw , &
& zlo ,useref ,gdp )
!
hstrat = max(1, kbed - ktop)*h0/kmxt
!
! Diagnostics
!
if (iwedia) then
write (luniwe, *)
write (luniwe, '(a)') '++++++++++++++++++++++++++++++++++'
write (luniwe, '(a)') ' TAYLOR :'
write (luniwe, '(a,1x,g9.2)') ' Mean Ri in layer [-]:', riav
write (luniwe, '(a,1x,g9.2)') ' Interval with Ri>0.25 [m]:', rilz
endif
!
if (.not.barcli) then
if (iwedia) write (luniwe, '(a)') &
& ' TAYLOR : IWE model not applied'
goto 9999
else
if (iwedia) then
write (luniwe, '(a,1x,g9.2)') ' Upper level stratified layer [m]:', &
& h0*(1. - ktop/real(kmxt,sp))
write (luniwe, '(a,1x,g9.2)') ' Lower level stratified layer [m]:', &
& h0*(1. - kbed/real(kmxt,sp))
write (luniwe, '(a,1x,g9.2)') ' Thickness strat. layer [m]:', &
& hstrat
write (luniwe, '(a,1x,g9.2)') ' Mean Ozmidov length scale [m]:', &
& zlo
write (luniwe, '(a,1x,g9.2)') ' Minimal IW period [s]:', &
& pi2/(bvav*bvmx)
endif
!
! IW vertical displacement amplitude and IWE-dissipation rate:
!
bz = hstrat/(xmu0*zlo)
if (bz>1.01) then
term = 0.5*(1. - 1./(bz*bz))/log(bz)
azmax = hstrat*alfaz*sqrt(term)/pi2
cs2 = 5.6
factor = viscof*cs2*(bvav**2)*log(bz)*h0/kmxt
!
epsiwe = 0.0
do ktg = 1, kmxt - 1
if (ktop<=ktg .and. ktg<=kbed) then
epsiwe = epsiwe + bv2(ktg)
endif
enddo
epsiwe = epsiwe*factor
!
!
if (iwedia) then
write (luniwe, '(a,1x,g9.2)') &
& ' Maximal rms IWE Z-ampl. [m]:', azmax
write (luniwe, '(a,1x,g9.2)') &
& ' Bandwidth vertical wave numbers :', bz
write (luniwe, '(a,1x,g9.2)') &
& ' Integral of IWE diss. [m^3/s^3]:', epsiwe
endif
elseif (iwedia) then
write (luniwe, '(a,1x,g9.2)') ' Bandwidth vertical wave numbers :', bz
write (luniwe, '(2a )') &
& ' Therefore no bandwidth of vertical IWE modes', &
& ' inside stratified layer'
else
endif
endif
!
! Detect upper and lower critical layers:
!
call disper(kmxdt ,kmxt ,np ,nfreqs ,angle , &
& bvmx ,freqlo ,frequp ,kcri ,ncri , &
& sing ,umean ,vmean ,atg ,btg , &
& bv2 ,ctg ,d2u ,d2v ,h0 , &
& kbed ,ktop ,qz ,r1tg ,scale , &
& utg ,vtg ,xkh ,gdp )
!
!
! Find most upper and lowest levels with critical layers
! defined by:
! - KTGCU is KTG-level of highest critical layer
! (nearest to water surface)
! - KTGCD is KTG-level of lowest critical layer
! (nearest to the bed)
!
ktgcu = kmxt
ktgcd = 0
ncrit = 0
!
nrd = 0
nru = 0
!
do nr = 1, 2
do ndir = 1, 2
if (sing(nr, ndir)) then
ncrit = ncrit + 1
if (ktgcu>kcri(nr, ndir)) then
ktgcu = kcri(nr, ndir)
nru = nr
nu = ncri(nr, ndir)
endif
if (ktgcd<kcri(nr, ndir)) then
ktgcd = kcri(nr, ndir)
nrd = nr
nd = ncri(nr, ndir)
endif
endif
enddo
enddo
!
! Upper most critical layer (ktgcu):
!
if (nru>0) then
n = nu
nr = nru
top = .true.
frfind = .true.
!
stage = ' Upper most critical layer, first step'
!
call zbrent(kmxdt ,kmxt ,omeg ,angle ,frfind , &
& tgfind ,stage ,freqlo(n, nr) ,frequp(n, nr) ,atg , &
& btg ,bv2 ,ctg ,crit ,d2u , &
& d2v ,h0 ,kbed ,ktop ,qz , &
& r1tg ,scale ,top ,utg ,vtg , &
& xkh ,luniwe ,gdp )
!
! Force normalisation:
!
tgfind = .true.
call tg(kmxdt ,kmxt ,angle ,atg ,btg , &
& bv2 ,ctg ,crit ,d2u ,d2v , &
& h0 ,kbed ,ktop ,omeg ,qz , &
& r1tg ,scale ,tgfind ,top ,utg , &
& vtg ,xkh ,gdp )
!
!
call seliwe(angle ,kbed ,ktop ,kmxt ,omeg , &
& r1tg ,utg ,vtg ,xkh ,singul , &
& top ,kcrit ,gdp )
!
!
if (singul .and. .not.top) then
!
stage = ' Upper most critical layer, second step'
!
call zbrent(kmxdt ,kmxt ,omeg ,angle ,frfind , &
& tgfind ,stage ,freqlo(n, nr) ,frequp(n, nr) ,atg , &
& btg ,bv2 ,ctg ,crit ,d2u , &
& d2v ,h0 ,kbed ,ktop ,qz , &
& r1tg ,scale ,top ,utg ,vtg , &
& xkh ,luniwe ,gdp )
!
! Force normalisation:
!
tgfind = .true.
call tg(kmxdt ,kmxt ,angle ,atg ,btg , &
& bv2 ,ctg ,crit ,d2u ,d2v , &
& h0 ,kbed ,ktop ,omeg ,qz , &
& r1tg ,scale ,tgfind ,top ,utg , &
& vtg ,xkh ,gdp )
!
!
call seliwe(angle ,kbed ,ktop ,kmxt ,omeg , &
& r1tg ,utg ,vtg ,xkh ,singul , &
& top ,kcrit ,gdp )
!
!
endif
!
! Optional, correction on position upper most critical layer:
!
if (singul) ktgcu = min(ktgcu, kcrit)
!
call totiwe(kmxdt ,kmxt ,ratiou ,singul ,top , &
& r1tg ,h0 ,scale ,kcrit ,xkh )
endif
!
! Lowest critical layer (ktgcd):
!
if (nrd>0) then
n = nd
nr = nrd
top = .true.
frfind = .true.
!
stage = ' Lowest critical layer, first step'
!
call zbrent(kmxdt ,kmxt ,omeg ,angle ,frfind , &
& tgfind ,stage ,freqlo(n, nr) ,frequp(n, nr) ,atg , &
& btg ,bv2 ,ctg ,crit ,d2u , &
& d2v ,h0 ,kbed ,ktop ,qz , &
& r1tg ,scale ,top ,utg ,vtg , &
& xkh ,luniwe ,gdp )
!
! Force normalisation:
!
tgfind = .true.
call tg(kmxdt ,kmxt ,angle ,atg ,btg , &
& bv2 ,ctg ,crit ,d2u ,d2v , &
& h0 ,kbed ,ktop ,omeg ,qz , &
& r1tg ,scale ,tgfind ,top ,utg , &
& vtg ,xkh ,gdp )
!
!
call seliwe(angle ,kbed ,ktop ,kmxt ,omeg , &
& r1tg ,utg ,vtg ,xkh ,singul , &
& top ,kcrit ,gdp )
!
!
if (singul .and. .not.top) then
!
stage = ' Lowest critical layer, second step'
!
call zbrent(kmxdt ,kmxt ,omeg ,angle ,frfind , &
& tgfind ,stage ,freqlo(n, nr) ,frequp(n, nr) ,atg , &
& btg ,bv2 ,ctg ,crit ,d2u , &
& d2v ,h0 ,kbed ,ktop ,qz , &
& r1tg ,scale ,top ,utg ,vtg , &
& xkh ,luniwe ,gdp )
!
! Force normalisation:
!
tgfind = .true.
call tg(kmxdt ,kmxt ,angle ,atg ,btg , &
& bv2 ,ctg ,crit ,d2u ,d2v , &
& h0 ,kbed ,ktop ,omeg ,qz , &
& r1tg ,scale ,tgfind ,top ,utg , &
& vtg ,xkh ,gdp )
!
!
call seliwe(angle ,kbed ,ktop ,kmxt ,omeg , &
& r1tg ,utg ,vtg ,xkh ,singul , &
& top ,kcrit ,gdp )
!
!
endif
!
! Optional correction on position lowest critical layer:
!
if (singul) ktgcd = max(ktgcd, kcrit)
!
call totiwe(kmxdt ,kmxt ,ratiod ,singul ,top , &
& r1tg ,h0 ,scale ,kcrit ,xkh )
endif
!
! In case of turbulence-generated critical layers:
!
if (ncrit>=2) then
ktgcu = max(1, ktgcu)
ktgcd = min(kmxt - 1, ktgcd)
!ratiow = SQRT (ratiod*ratiou)
ratiow = 2.0
call turiwe(kmxdt ,kmxt ,h0 ,scale ,bvav , &
& xkh ,utg ,vtg ,ratiow ,kbed , &
& ktop ,ktgcd ,ktgcu ,tke ,zlw , &
& tlw ,ttkiw ,tiwtk ,luniwe ,gdp )
!
!
! Without turbulence-generated critical layers:
!
else
ktgcu = ktop
ktgcd = kbed
ratiow = 2.0
call turiwe(kmxdt ,kmxt ,h0 ,scale ,bvav , &
& xkh ,utg ,vtg ,ratiow ,kbed , &
& ktop ,ktgcd ,ktgcu ,tke ,zlw , &
& tlw ,ttkiw ,tiwtk ,luniwe ,gdp )
!
if (iwedia) write (luniwe, '(a)') ' No turb.-gen. crit. layers '
endif
!
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
! IWE generation by bed topograhy; using +
! zero reference velocity +
! minimal velocity for notable wave generation set at +
! 1 [cm/s]/15, see below: +
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
umag = ustbx*ustbx + ustby*ustby
umag = sqrt(umag)
ustmx = 0.01/15.
if (frcbed<1E-10 .or. umag<ustmx) goto 300
!
xk = pi2/wvlbed
useref = .false.
!
call intpol(kmax ,kmxdt ,kmxt ,h0 ,zeta , &
& dps ,siglim ,barcli ,riav ,rilz , &
& xk ,u0 ,dudz ,d2u0 ,ustbx , &
& ustwix ,v0 ,dvdz ,d2v0 ,ustby , &
& ustwiy ,sig ,thick ,rich ,bruvai , &
& rtur0 ,vicww ,scale ,bvav ,bvmx , &
& xkh ,kbed ,ktop ,umean ,vmean , &
& utg ,vtg ,d2u ,d2v ,bv2 , &
& tke ,eps ,edvis ,zlw ,tlw , &
& zlo ,useref ,gdp )
!
!
! Bracketing of angle intervals with lee waves i.e. with OMEG=0,
! the relevant angle intervals are stored in FREQLO(N,1) and FREQUP(N,1).
!
call brkbed(kmxdt ,kmxt ,np ,nfreqs ,atg , &
& btg ,bv2 ,ctg ,d2u ,d2v , &
& h0 ,kbed ,ktop ,qz ,r1tg , &
& scale ,tgfind ,utg ,vtg ,xkh , &
& freqlo ,frequp ,luniwe ,gdp )
!
!
if (.not.tgfind) goto 300
!
! Start from last bracketed angle interval (phase speed most
! oppposite to currebt speed) and search for solution which is either:
! - non-singular or, if singular,
! - has critical layer from bed upwards.
!
nr = 1
n = 0
!
310 continue
n = n + 1
top = .false.
frfind = .false.
!
stage = ' Lee wave'
!
call zbrent(kmxdt ,kmxt ,omeg ,angle ,frfind , &
& tgfind ,stage ,freqlo(n, nr) ,frequp(n, nr) ,atg , &
& btg ,bv2 ,ctg ,crit ,d2u , &
& d2v ,h0 ,kbed ,ktop ,qz , &
& r1tg ,scale ,top ,utg ,vtg , &
& xkh ,luniwe ,gdp )
!
! Force normalisation:
!
tgfind = .true.
call tg(kmxdt ,kmxt ,angle ,atg ,btg , &
& bv2 ,ctg ,crit ,d2u ,d2v , &
& h0 ,kbed ,ktop ,omeg ,qz , &
& r1tg ,scale ,tgfind ,top ,utg , &
& vtg ,xkh ,gdp )
!
!
call seliwe(angle ,kbed ,ktop ,kmxt ,omeg , &
& r1tg ,utg ,vtg ,xkh ,singul , &
& top ,kcrit ,gdp )
!
!
if (top .and. n<nrange) goto 310
if (top) then
write (luniwe, '(a)') 'TAYLOR : no bed-generated IW?'
else
!
call bediwe(kmax ,kmxdt ,kmxt ,h0 ,scale , &
& bvav ,xkh ,angle ,singul ,kbed , &
& ktop ,kcrit ,thick ,ustbx ,ustby , &
& d2u ,d2v ,dudz ,dvdz ,utg , &
& vtg ,frcbed ,edvis ,qz ,r1tg , &
& dijdij ,ttkiw ,tiwtk ,az ,atg , &
& btg ,luniwe ,gdp )
!
!
endif
!
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
! IWE generation by surface perturbations. +
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
300 continue
umag = ustwix*ustwix + ustwiy*ustwiy
umag = sqrt(umag)
if (frcsur<1E-10 .or. umag<1.E-6) goto 400
!
xk = pi2/wvlsur
useref = .true.
!
call intpol(kmax ,kmxdt ,kmxt ,h0 ,zeta , &
& dps ,siglim ,barcli ,riav ,rilz , &
& xk ,u0 ,dudz ,d2u0 ,ustbx , &
& ustwix ,v0 ,dvdz ,d2v0 ,ustby , &
& ustwiy ,sig ,thick ,rich ,bruvai , &
& rtur0 ,vicww ,scale ,bvav ,bvmx , &
& xkh ,kbed ,ktop ,umean ,vmean , &
& utg ,vtg ,d2u ,d2v ,bv2 , &
& tke ,eps ,edvis ,zlw ,tlw , &
& zlo ,useref ,gdp )
!
!
! Loop until IW is found which is either non-singular or
! singular with critical layer extending down from water surface:
!
frup = bvmx
delf = bvmx/nfreqs
410 continue
call brksur(kmxdt ,kmxt ,nfreqs ,angle ,atg , &
& btg ,bv2 ,ctg ,d2u ,d2v , &
& h0 ,kbed ,ktop ,qz ,r1tg , &
& scale ,tgfind ,utg ,vtg ,xkh , &
& ustwix ,ustwiy ,frlo ,frup ,bvmx , &
& luniwe ,gdp )
!
!
top = .true.
frfind = .true.
!
stage = ' Wind-generated internal waves'
!
call zbrent(kmxdt ,kmxt ,omeg ,angle ,frfind , &
& tgfind ,stage ,frlo ,frup ,atg , &
& btg ,bv2 ,ctg ,crit ,d2u , &
& d2v ,h0 ,kbed ,ktop ,qz , &
& r1tg ,scale ,top ,utg ,vtg , &
& xkh ,luniwe ,gdp )
!
! Force normalisation:
!
tgfind = .true.
call tg(kmxdt ,kmxt ,angle ,atg ,btg , &
& bv2 ,ctg ,crit ,d2u ,d2v , &
& h0 ,kbed ,ktop ,omeg ,qz , &
& r1tg ,scale ,tgfind ,top ,utg , &
& vtg ,xkh ,gdp )
!
!
call seliwe(angle ,kbed ,ktop ,kmxt ,omeg , &
& r1tg ,utg ,vtg ,xkh ,singul , &
& top ,kcrit ,gdp )
!
!
if (frlo>delf .and. .not.top) then
frup = frlo
goto 410
elseif (.not.top) then
write (luniwe, '(a)') 'TAYLOR : no wind-generated IW ?'
else
!
call suriwe(kmax ,kmxdt ,kmxt ,h0 ,scale , &
& bvav ,xkh ,angle ,omeg ,singul , &
& kbed ,ktop ,kcrit ,wsp10 ,ustwix , &
& ustwiy ,utg ,vtg ,frcsur ,edvis , &
& qz ,r1tg ,dijdij ,ttkiw ,tiwtk , &
& az ,atg ,btg ,luniwe ,gdp )
!
!
endif
!
!
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
! The collected transfer rates are redistributed along +
! the DPM grid and used in TRATUR for the k-e model: +
! +
! Currently, the momentum fluxes/forces FUTG-FUIWE +
! and FVTG-FVIWE are not yet installed. +
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
400 continue
call distri(ttkiw ,tiwtk ,tkepro ,tkedis ,futg , &
& fvtg ,fuiwe ,fviwe ,h0 ,thick , &
& bv2 ,ktop ,kbed ,kmax ,kmxdt , &
& kmxt ,luniwe ,gdp )
!
!
9999 continue
end subroutine taylor
|
(* Title: HOL/Auth/n_flash_lemma_on_inv__18.thy
Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
*)
header{*The n_flash Protocol Case Study*}
theory n_flash_lemma_on_inv__18 imports n_flash_base
begin
section{*All lemmas on causal relation between inv__18 and some rule r*}
lemma n_PI_Remote_GetVsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_PI_Remote_Get src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_PI_Remote_Get src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_PI_Remote_GetXVsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_PI_Remote_GetX src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_PI_Remote_GetX src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_NakVsinv__18:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Nak dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Nak dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Nak__part__0Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__0 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__0 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Nak__part__1Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__1 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__1 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Nak__part__2Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__2 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__2 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Get__part__0Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Get__part__0 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Get__part__0 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Get__part__1Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Get__part__1 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Get__part__1 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Put_HeadVsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put_Head N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put_Head N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_PutVsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Put_DirtyVsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put_Dirty src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put_Dirty src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_Get_NakVsinv__18:
assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Nak src dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Nak src dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_Get_Nak_HomeVsinv__18:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Get_Nak_Home dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_Get_Nak_Home dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_Get_PutVsinv__18:
assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Put src dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Put src dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_Get_Put_HomeVsinv__18:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Get_Put_Home dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_Get_Put_Home dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_Nak__part__0Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__0 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__0 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_Nak__part__1Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__1 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__1 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_Nak__part__2Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__2 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__2 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_GetX__part__0Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__0 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__0 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_GetX__part__1Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__1 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__1 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_1Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_1 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_1 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_2Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_2 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_2 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_3Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_3 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_3 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_4Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_4 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_4 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_5Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_5 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_5 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_6Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_6 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_6 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_7__part__0Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__0 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__0 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_7__part__1Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__1 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__1 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_7_NODE_Get__part__0Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__0 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__0 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_7_NODE_Get__part__1Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__1 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__1 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_8_HomeVsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''HomeShrSet'')) (Const true)))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_8_Home_NODE_GetVsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home_NODE_Get N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home_NODE_Get N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''HomeShrSet'')) (Const true)))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_8Vsinv__18:
assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8 N src pp)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8 N src pp" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_8_NODE_GetVsinv__18:
assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8_NODE_Get N src pp)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8_NODE_Get N src pp" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_9__part__0Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__0 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__0 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_9__part__1Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__1 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__1 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_10_HomeVsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_10_Home N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_10_Home N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''HomeShrSet'')) (Const true)))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_10Vsinv__18:
assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_10 N src pp)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_10 N src pp" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Dirty'')) (Const false)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_11Vsinv__18:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_11 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_11 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX)) (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Local'')) (Const true))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_GetX_NakVsinv__18:
assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_Nak src dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_Nak src dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_GetX_Nak_HomeVsinv__18:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_GetX_Nak_Home dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_GetX_Nak_Home dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_GetX_PutXVsinv__18:
assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_PutX src dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_PutX src dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') dst) ''CacheState'')) (Const CACHE_E)) (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_GetX_PutX_HomeVsinv__18:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_GetX_PutX_Home dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_GetX_PutX_Home dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''UniMsg'') p__Inv4) ''Cmd'')) (Const UNI_PutX)) (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') p__Inv4) ''CacheState'')) (Const CACHE_E))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') dst) ''CacheState'')) (Const CACHE_E)) (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''UniMsg'') p__Inv4) ''Cmd'')) (Const UNI_PutX))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_PutVsinv__18:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Put dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_Put dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_PutXVsinv__18:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_PutX dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_PutX dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_PI_Local_Get_GetVsinv__18:
assumes a1: "(r=n_PI_Local_Get_Get )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_PI_Local_GetX_GetX__part__0Vsinv__18:
assumes a1: "(r=n_PI_Local_GetX_GetX__part__0 )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_PI_Local_GetX_GetX__part__1Vsinv__18:
assumes a1: "(r=n_PI_Local_GetX_GetX__part__1 )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_NI_Nak_HomeVsinv__18:
assumes a1: "(r=n_NI_Nak_Home )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_NI_Local_PutVsinv__18:
assumes a1: "(r=n_NI_Local_Put )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_NI_Local_PutXAcksDoneVsinv__18:
assumes a1: "(r=n_NI_Local_PutXAcksDone )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__18 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_PI_Local_GetX_PutX__part__0Vsinv__18:
assumes a1: "r=n_PI_Local_GetX_PutX__part__0 " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_WbVsinv__18:
assumes a1: "r=n_NI_Wb " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_StoreVsinv__18:
assumes a1: "\<exists> src data. src\<le>N\<and>data\<le>N\<and>r=n_Store src data" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_3Vsinv__18:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_3 N src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_1Vsinv__18:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_1 N src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Remote_ReplaceVsinv__18:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_PI_Remote_Replace src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_Store_HomeVsinv__18:
assumes a1: "\<exists> data. data\<le>N\<and>r=n_Store_Home data" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_ReplaceVsinv__18:
assumes a1: "r=n_PI_Local_Replace " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_existsVsinv__18:
assumes a1: "\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_InvAck_exists src pp" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Remote_PutXVsinv__18:
assumes a1: "\<exists> dst. dst\<le>N\<and>r=n_PI_Remote_PutX dst" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvVsinv__18:
assumes a1: "\<exists> dst. dst\<le>N\<and>r=n_NI_Inv dst" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_PutXVsinv__18:
assumes a1: "r=n_PI_Local_PutX " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_Get_PutVsinv__18:
assumes a1: "r=n_PI_Local_Get_Put " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_ShWbVsinv__18:
assumes a1: "r=n_NI_ShWb N " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_GetX_PutX_HeadVld__part__0Vsinv__18:
assumes a1: "r=n_PI_Local_GetX_PutX_HeadVld__part__0 N " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_ReplaceVsinv__18:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_Replace src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_GetX_PutX__part__1Vsinv__18:
assumes a1: "r=n_PI_Local_GetX_PutX__part__1 " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_exists_HomeVsinv__18:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_exists_Home src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_Replace_HomeVsinv__18:
assumes a1: "r=n_NI_Replace_Home " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_Nak_ClearVsinv__18:
assumes a1: "r=n_NI_Nak_Clear " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_2Vsinv__18:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_2 N src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_GetX_PutX_HeadVld__part__1Vsinv__18:
assumes a1: "r=n_PI_Local_GetX_PutX_HeadVld__part__1 N " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_FAckVsinv__18:
assumes a1: "r=n_NI_FAck " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__18 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
end
|
CONVCC is a hosted and distributed platform. You can use CONVCC as a complete web service without any hardware and software investment. Also you can use management modules with your own PBX system at your own location. You can develop your own agent screen or management interface using web services of CONVCC platform. |
-- --------------------------------------------------------- [ Interactive.idr ]
-- Module : Exercises.Test.Interactive
-- Description : Test covering the Chapter 3 exercises in Edwin Brady's
-- book, "Type-Driven Development with Idris."
-- --------------------------------------------------------------------- [ EOH ]
module Exercises.Test.Interactive
import Exercises.Interactive
import Test.Helpers
import Data.Vect
%hide Data.Vect.overLength
%access export
testLength : IO Bool
testLength = "my_length" `assertEqual'` 10 $ my_length [1..10]
testReverse : IO Bool
testReverse = "my_reverse" `assertEqual'` [10,9..1] $ my_reverse [1..10]
testMap : IO Bool
testMap = "my_map" `assertEqual'` [2,4..20] $ my_map (*2) [1..10]
testVectMap : IO Bool
testVectMap =
"my_vect_map" `assertEqual'` the (Vect _ Nat) [3, 3, 7, 4] $
my_vect_map length ["Hot", "Dog", "Jumping", "Frog"]
testAddMatrix : (Eq elem, Num elem, Show elem) =>
(a, b, expected : Vect n (Vect m elem)) ->
IO Bool
testAddMatrix {n} {m} a b expected =
unwords ["addMatrix", show n, "x", show m] `assertEqual'` expected $
addMatrix a b
testMultMatrix : (Eq elem, Num elem, Show elem) =>
Vect n (Vect m elem) -> Vect m (Vect p elem) ->
Vect n (Vect p elem) ->
IO Bool
testMultMatrix {n} {m} {p} a b expected =
unwords ["multMatrix (", show n, "x", show m, ") (", show m, "x", show p, ")"]
`assertEqual'` expected $ multMatrix a b
testTransposeMat : (Eq elem, Show elem) =>
Vect n (Vect m elem) -> Vect m (Vect n elem) ->
IO Bool
testTransposeMat {n} {m} toTranspose expected =
unwords ["transpose_mat", show n, "x", show m] `assertEqual'` expected $
transpose_mat toTranspose
allTests : List (IO Bool)
allTests = [ testLength
, testReverse
, testMap
, testVectMap
, testTransposeMat [ [1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12] ]
[ [1, 5, 9],
[2, 6, 10],
[3, 7, 11],
[4, 8, 12] ]
, testTransposeMat [ [1, 2],
[3, 4],
[5, 6] ]
[ [1, 3, 5],
[2, 4, 6] ]
, testAddMatrix [ [1, 2],
[3, 4] ]
[ [5, 6],
[7, 8] ]
[ [ 6, 8],
[10, 12] ]
, testMultMatrix [ [ 1, 2],
[ 3, 4],
[ 5, 6] ]
[ [ 7, 8, 9, 10],
[ 11, 12, 13, 14] ]
[ [ 29, 32, 35, 38],
[ 65, 72, 79, 86],
[101, 112, 123, 134] ]
]
runTests : IO (Vect (length Interactive.allTests) Bool)
runTests = testChapter "3: Interactive development with types" allTests
-- --------------------------------------------------------------------- [ EOF ]
|
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
Import(compiler, code, fpgen);
# temporary fix to declare variables used in _mm_loadl_xx/_mm_loadh_xx
CellCompileStrategyVector := Concatenation(
# [ c -> vref.setNoScalar(c) ], # must be at the begin; otherwise subvector access breaks
BaseCS,
[
BinSplit, CSE,
# MarkDefUse, FFTWScheduleAssignments, CopyPropagate, <- NOTE: breaks
# MarkDefUse, DFSChain, # currently not used
CopyPropagate,
Compile.declareVars,
(c,opts) -> opts.vector.isa.fixProblems(c, opts),
(c, opts) -> ESReduce(c, opts)
# c -> DeadCodeElim(c),
# c -> vref.resetNoScalar(c) # must be at the end right before declaring the missing vars!!
#DeclareVars
]);
CellCompileStrategyVectorFP := (bits, fracbits) -> Concatenation(
CellCompileStrategyVector,
[ c -> FixedPointCode(c, bits, fracbits) ]
);
|
(*
Copyright (C) 2017 M.A.L. Marques
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)
(* type: gga_exc *)
# Not that the files have to be included in this specific order
$define gga_x_pw91_params
$include "gga_x_pw91.mpl"
$include "op.mpl"
op_qab := 2.3706:
op_enhancement := xs -> pw91_f(xs):
|
(*
* Copyright 2014, General Dynamics C4 Systems
*
* SPDX-License-Identifier: GPL-2.0-only
*)
theory ArchUntyped_AI
imports "../Untyped_AI"
begin
context Arch begin global_naming ARM_HYP
named_theorems Untyped_AI_assms
lemma of_bl_nat_to_cref[Untyped_AI_assms]:
"\<lbrakk> x < 2 ^ bits; bits < word_bits \<rbrakk>
\<Longrightarrow> (of_bl (nat_to_cref bits x) :: machine_word) = of_nat x"
apply (clarsimp intro!: less_mask_eq
simp: nat_to_cref_def of_drop_to_bl
word_size word_less_nat_alt word_bits_def)
apply (subst unat_of_nat)
apply (erule order_le_less_trans [OF mod_less_eq_dividend])
done
lemma cnode_cap_ex_cte[Untyped_AI_assms]:
"\<lbrakk> is_cnode_cap cap; cte_wp_at (\<lambda>c. \<exists>m. cap = mask_cap m c) p s;
(s::'state_ext::state_ext state) \<turnstile> cap; valid_objs s; pspace_aligned s \<rbrakk> \<Longrightarrow>
ex_cte_cap_wp_to is_cnode_cap (obj_ref_of cap, nat_to_cref (bits_of cap) x) s"
apply (simp only: ex_cte_cap_wp_to_def)
apply (rule exI, erule cte_wp_at_weakenE)
apply (clarsimp simp: is_cap_simps bits_of_def)
apply (case_tac c, simp_all add: mask_cap_def cap_rights_update_def split:bool.splits)
apply (clarsimp simp: nat_to_cref_def word_bits_def)
apply (erule(2) valid_CNodeCapE)
apply (simp add: word_bits_def cte_level_bits_def)
done
lemma inj_on_nat_to_cref[Untyped_AI_assms]:
"bits < word_bits \<Longrightarrow> inj_on (nat_to_cref bits) {..< 2 ^ bits}"
apply (rule inj_onI)
apply (drule arg_cong[where f="\<lambda>x. replicate (word_bits - bits) False @ x"])
apply (subst(asm) word_bl.Abs_inject[where 'a=32, symmetric])
apply (simp add: nat_to_cref_def word_bits_def)
apply (simp add: nat_to_cref_def word_bits_def)
apply (simp add: of_bl_rep_False of_bl_nat_to_cref)
apply (erule word_unat.Abs_eqD)
apply (simp only: unats_def mem_simps)
apply (erule order_less_le_trans)
apply (rule power_increasing, simp_all add: word_bits_def)
apply (simp only: unats_def mem_simps)
apply (erule order_less_le_trans)
apply (rule power_increasing, simp+)
done
lemma data_to_obj_type_sp[Untyped_AI_assms]:
"\<lbrace>P\<rbrace> data_to_obj_type x \<lbrace>\<lambda>ts (s::'state_ext::state_ext state). ts \<noteq> ArchObject ASIDPoolObj \<and> P s\<rbrace>, -"
unfolding data_to_obj_type_def
apply (rule hoare_pre)
apply (wp|wpc)+
apply clarsimp
apply (simp add: arch_data_to_obj_type_def split: if_split_asm)
done
lemma dui_inv_wf[wp, Untyped_AI_assms]:
"\<lbrace>invs and cte_wp_at ((=) (cap.UntypedCap dev w sz idx)) slot
and (\<lambda>(s::'state_ext::state_ext state). \<forall>cap \<in> set cs. is_cnode_cap cap
\<longrightarrow> (\<forall>r\<in>cte_refs cap (interrupt_irq_node s). ex_cte_cap_wp_to is_cnode_cap r s))
and (\<lambda>s. \<forall>x \<in> set cs. s \<turnstile> x)\<rbrace>
decode_untyped_invocation label args slot (cap.UntypedCap dev w sz idx) cs
\<lbrace>valid_untyped_inv\<rbrace>,-"
proof -
have inj: "\<And>node_cap s. \<lbrakk>is_cnode_cap node_cap;
unat (args ! 5) \<le> 2 ^ bits_of node_cap - unat (args ! 4);valid_cap node_cap s\<rbrakk> \<Longrightarrow>
inj_on (Pair (obj_ref_of node_cap) \<circ> nat_to_cref (bits_of node_cap))
{unat (args ! 4)..<unat (args ! 4) + unat (args ! 5)}"
apply (simp add: comp_def)
apply (rule inj_on_split)
apply (rule subset_inj_on [OF inj_on_nat_to_cref])
apply (clarsimp simp: is_cap_simps bits_of_def valid_cap_def word_bits_def cap_aligned_def)
apply clarsimp
apply (rule less_le_trans)
apply assumption
apply (simp add: le_diff_conv2)
done
have nasty_strengthen:
"\<And>S a f s. (\<forall>x\<in>S. cte_wp_at ((=) cap.NullCap) (a, f x) s)
\<Longrightarrow> cte_wp_at (\<lambda>c. c \<noteq> cap.NullCap) slot s
\<longrightarrow> slot \<notin> (Pair a \<circ> f) ` S"
by (auto simp: cte_wp_at_caps_of_state)
show ?thesis
apply (simp add: decode_untyped_invocation_def unlessE_def[symmetric]
unlessE_whenE
split del: if_split)
apply (rule validE_R_sp[OF whenE_throwError_sp]
validE_R_sp[OF data_to_obj_type_sp]
validE_R_sp[OF dui_sp_helper] validE_R_sp[OF map_ensure_empty])+
apply clarsimp
apply (rule hoare_pre)
apply (wp whenE_throwError_wp[THEN validE_validE_R] check_children_wp map_ensure_empty_wp)
apply (clarsimp simp: distinct_map cases_imp_eq)
apply (subgoal_tac "s \<turnstile> node_cap")
prefer 2
apply (erule disjE)
apply (drule bspec [where x = "cs ! 0"],clarsimp)+
apply fastforce
apply clarsimp
apply (clarsimp simp: cte_wp_at_caps_of_state)
apply (drule(1) caps_of_state_valid[rotated])+
apply simp
apply (subgoal_tac "\<forall>r\<in>cte_refs node_cap (interrupt_irq_node s). ex_cte_cap_wp_to is_cnode_cap r s")
apply (clarsimp simp: cte_wp_at_caps_of_state)
apply (frule(1) caps_of_state_valid[rotated])
apply (clarsimp simp: not_less)
apply (frule(2) inj)
apply (clarsimp simp: comp_def)
apply (frule(1) caps_of_state_valid)
apply (simp add: nasty_strengthen[unfolded o_def] cte_wp_at_caps_of_state)
apply (intro conjI)
apply (intro impI)
apply (frule range_cover_stuff[where w=w and rv = 0 and sz = sz], simp_all)[1]
apply (clarsimp simp: valid_cap_simps cap_aligned_def)+
apply (frule alignUp_idem[OF is_aligned_weaken,where a = w])
apply (erule range_cover.sz)
apply (simp add: range_cover_def)
apply (clarsimp simp: get_free_ref_def empty_descendants_range_in)
apply (rule conjI[rotated], blast, clarsimp)
apply (drule_tac x = "(obj_ref_of node_cap,nat_to_cref (bits_of node_cap) slota)" in bspec)
apply (clarsimp simp: is_cap_simps nat_to_cref_def word_bits_def
bits_of_def valid_cap_simps cap_aligned_def)+
apply (simp add: free_index_of_def)
apply (frule(1) range_cover_stuff[where sz = sz])
apply (clarsimp dest!: valid_cap_aligned simp:cap_aligned_def word_bits_def)+
apply simp+
apply (clarsimp simp: get_free_ref_def)
apply (erule disjE)
apply (drule_tac x= "cs!0" in bspec)
subgoal by clarsimp
subgoal by simp
apply (clarsimp simp: cte_wp_at_caps_of_state ex_cte_cap_wp_to_def)
apply (rule_tac x=aa in exI,rule exI,rule exI)
apply (rule conjI, assumption)
apply simp
done
qed
lemma asid_bits_ge_0:
"(0::word32) < 2 ^ asid_bits" by (simp add: asid_bits_def)
lemma retype_ret_valid_caps_captable[Untyped_AI_assms]:
"\<lbrakk>pspace_no_overlap_range_cover ptr sz (s::'state_ext::state_ext state) \<and> 0 < us
\<and> range_cover ptr sz (obj_bits_api CapTableObject us) n \<and> ptr \<noteq> 0
\<rbrakk>
\<Longrightarrow> \<forall>y\<in>{0..<n}. s
\<lparr>kheap := foldr (\<lambda>p kh. kh(p \<mapsto> default_object CapTableObject dev us)) (map (\<lambda>p. ptr_add ptr (p * 2 ^ obj_bits_api CapTableObject us)) [0..<n])
(kheap s)\<rparr> \<turnstile> CNodeCap (ptr_add ptr (y * 2 ^ obj_bits_api CapTableObject us)) us []"
by ((clarsimp simp:valid_cap_def default_object_def cap_aligned_def
cte_level_bits_def slot_bits_def is_obj_defs well_formed_cnode_n_def empty_cnode_def
dom_def arch_default_cap_def ptr_add_def | rule conjI | intro conjI obj_at_foldr_intro imageI
| rule is_aligned_add_multI[OF _ le_refl],
(simp add:range_cover_def word_bits_def obj_bits_api_def slot_bits_def)+)+)[1]
lemma retype_ret_valid_caps_aobj[Untyped_AI_assms]:
"\<And>ptr sz (s::'state_ext::state_ext state) x6 us n.
\<lbrakk>pspace_no_overlap_range_cover ptr sz s \<and> x6 \<noteq> ASIDPoolObj \<and>
range_cover ptr sz (obj_bits_api (ArchObject x6) us) n \<and> ptr \<noteq> 0\<rbrakk>
\<Longrightarrow> \<forall>y\<in>{0..<n}. s
\<lparr>kheap := foldr (\<lambda>p kh. kh(p \<mapsto> default_object (ArchObject x6) dev us)) (map (\<lambda>p. ptr_add ptr (p * 2 ^ obj_bits_api (ArchObject x6) us)) [0..<n])
(kheap s)\<rparr> \<turnstile> ArchObjectCap (ARM_A.arch_default_cap x6 (ptr_add ptr (y * 2 ^ obj_bits_api (ArchObject x6) us)) us dev)"
apply (rename_tac aobject_type us n)
apply (case_tac aobject_type)
by (clarsimp simp:valid_cap_def default_object_def cap_aligned_def
cte_level_bits_def slot_bits_def is_obj_defs well_formed_cnode_n_def empty_cnode_def
dom_def arch_default_cap_def ptr_add_def | intro conjI obj_at_foldr_intro
imageI valid_vm_rights_def
| rule is_aligned_add_multI[OF _ le_refl]
| fastforce simp:range_cover_def obj_bits_api_def
default_arch_object_def valid_vm_rights_def word_bits_def a_type_def)+
lemma copy_global_mappings_hoare_lift:(*FIXME: arch_split \<rightarrow> these do not seem to be used globally *)
assumes wp: "\<And>ptr val. \<lbrace>Q\<rbrace> store_pde ptr val \<lbrace>\<lambda>rv. Q\<rbrace>"
shows "\<lbrace>Q\<rbrace> copy_global_mappings pd \<lbrace>\<lambda>rv. Q\<rbrace>"
apply (simp add: copy_global_mappings_def)
done
lemma init_arch_objects_hoare_lift:
assumes wp: "\<And>oper. \<lbrace>(P::'state_ext::state_ext state\<Rightarrow>bool)\<rbrace> do_machine_op oper \<lbrace>\<lambda>rv :: unit. Q\<rbrace>"
"\<And>ptr val. \<lbrace>P\<rbrace> store_pde ptr val \<lbrace>\<lambda>rv. P\<rbrace>"
shows "\<lbrace>P and Q\<rbrace> init_arch_objects tp ptr sz us adds \<lbrace>\<lambda>rv. Q\<rbrace>"
proof -
have pres: "\<And>oper. \<lbrace>P and Q\<rbrace> do_machine_op oper \<lbrace>\<lambda>rv :: unit. Q\<rbrace>"
"\<lbrace>P and Q\<rbrace> return () \<lbrace>\<lambda>rv. Q\<rbrace>"
by (wp wp | simp)+
show ?thesis
apply (simp add: init_arch_objects_def
pres reserve_region_def
split: Structures_A.apiobject_type.split
aobject_type.split)
apply clarsimp
apply (rule hoare_pre)
apply (wp mapM_x_wp' copy_global_mappings_hoare_lift wp)
apply simp
done
qed
crunch pdistinct[wp]: do_machine_op "pspace_distinct"
crunch vmdb[wp]: do_machine_op "valid_mdb"
crunch mdb[wp]: do_machine_op "\<lambda>s. P (cdt s)"
crunch cte_wp_at[wp]: do_machine_op "\<lambda>s. P (cte_wp_at P' p s)"
lemma cap_refs_in_kernel_windowD2:
"\<lbrakk> cte_wp_at P p (s::'state_ext::state_ext state); cap_refs_in_kernel_window s \<rbrakk>
\<Longrightarrow> \<exists>cap. P cap \<and> region_in_kernel_window (cap_range cap) s"
apply (clarsimp simp: cte_wp_at_caps_of_state region_in_kernel_window_def)
apply (drule(1) cap_refs_in_kernel_windowD)
apply fastforce
done
lemma init_arch_objects_descendants_range[wp,Untyped_AI_assms]:
"\<lbrace>\<lambda>(s::'state_ext::state_ext state). descendants_range x cref s \<rbrace> init_arch_objects ty ptr n us y
\<lbrace>\<lambda>rv s. descendants_range x cref s\<rbrace>"
apply (simp add:descendants_range_def)
apply (rule hoare_pre)
apply (wp retype_region_mdb init_arch_objects_hoare_lift)
apply (wps do_machine_op_mdb)
apply (wp hoare_vcg_ball_lift)
apply (rule hoare_pre)
apply (wps store_pde_mdb_inv)
apply wp
apply simp
apply fastforce
done
lemma init_arch_objects_caps_overlap_reserved[wp,Untyped_AI_assms]:
"\<lbrace>\<lambda>(s::'state_ext::state_ext state). caps_overlap_reserved S s\<rbrace>
init_arch_objects ty ptr n us y
\<lbrace>\<lambda>rv s. caps_overlap_reserved S s\<rbrace>"
apply (simp add:caps_overlap_reserved_def)
apply (rule hoare_pre)
apply (wp retype_region_mdb init_arch_objects_hoare_lift)
apply fastforce
done
lemma set_untyped_cap_invs_simple[Untyped_AI_assms]:
"\<lbrace>\<lambda>s. descendants_range_in {ptr .. ptr+2^sz - 1} cref s \<and> pspace_no_overlap_range_cover ptr sz s \<and> invs s
\<and> cte_wp_at (\<lambda>c. is_untyped_cap c \<and> cap_bits c = sz \<and> obj_ref_of c = ptr \<and> cap_is_device c = dev) cref s \<and> idx \<le> 2^ sz\<rbrace>
set_cap (cap.UntypedCap dev ptr sz idx) cref
\<lbrace>\<lambda>rv s. invs s\<rbrace>"
apply (rule hoare_name_pre_state)
apply (clarsimp simp: cte_wp_at_caps_of_state invs_def valid_state_def)
apply (rule hoare_pre)
apply (wp set_free_index_valid_pspace_simple set_cap_valid_mdb_simple
set_cap_idle update_cap_ifunsafe)
apply (simp add:valid_irq_node_def)
apply wps
apply (wp hoare_vcg_all_lift set_cap_irq_handlers set_cap_valid_arch_caps
set_cap_irq_handlers cap_table_at_lift_valid set_cap_typ_at
set_untyped_cap_refs_respects_device_simple)
apply (clarsimp simp:cte_wp_at_caps_of_state is_cap_simps)
apply (intro conjI, clarsimp)
apply (rule ext, clarsimp simp:is_cap_simps)
apply (clarsimp split:cap.splits simp:is_cap_simps appropriate_cte_cap_def)
apply (drule(1) if_unsafe_then_capD[OF caps_of_state_cteD])
apply clarsimp
apply (clarsimp simp:is_cap_simps ex_cte_cap_wp_to_def appropriate_cte_cap_def cte_wp_at_caps_of_state)
apply (clarsimp dest!:valid_global_refsD2 simp:cap_range_def)
apply (simp add:valid_irq_node_def)
apply (clarsimp simp:valid_irq_node_def)
apply (clarsimp simp:no_cap_to_obj_with_diff_ref_def cte_wp_at_caps_of_state vs_cap_ref_def)
apply (case_tac cap)
apply (simp_all add:vs_cap_ref_def table_cap_ref_def)
apply (rename_tac arch_cap)
apply (case_tac arch_cap)
apply simp_all
apply (clarsimp simp:cap_refs_in_kernel_window_def
valid_refs_def simp del:split_paired_All)
apply (drule_tac x = cref in spec)
apply (clarsimp simp:cte_wp_at_caps_of_state)
apply fastforce
done
lemma pbfs_atleast_pageBits':
"pageBits \<le> pageBitsForSize sz"by (cases sz, simp_all add: pageBits_def)
lemma pbfs_less_wb':
"pageBitsForSize sz < word_bits"by (cases sz, simp_all add: word_bits_conv pageBits_def)
lemma delete_objects_rewrite[Untyped_AI_assms]:
"\<lbrakk>word_size_bits \<le> sz; sz \<le> word_bits; ptr && ~~ mask sz = ptr\<rbrakk>
\<Longrightarrow> delete_objects ptr sz =
do y \<leftarrow> modify (clear_um {ptr + of_nat k |k. k < 2 ^ sz});
modify (detype {ptr && ~~ mask sz..ptr + 2 ^ sz - 1})
od"
apply (clarsimp simp: delete_objects_def freeMemory_def)
apply (subgoal_tac "is_aligned (ptr &&~~ mask sz) sz")
apply (subst mapM_storeWord_clear_um)
apply (simp)
apply simp
apply (simp add:range_cover_def)
apply clarsimp
apply (rule is_aligned_neg_mask)
apply simp
done
declare store_pde_pred_tcb_at [wp]
(* nonempty_table *)
definition
nonempty_table :: "machine_word set \<Rightarrow> Structures_A.kernel_object \<Rightarrow> bool"
where
"nonempty_table S ko \<equiv>
(a_type ko = AArch APageTable \<or> a_type ko = AArch APageDirectory)
\<and> \<not> empty_table S ko"
lemma reachable_pg_cap_exst_update[simp]:
"reachable_pg_cap x (trans_state f (s::'state_ext::state_ext state)) = reachable_pg_cap x s"
by (simp add:reachable_pg_cap_def vs_lookup_pages_def
vs_lookup_pages1_def obj_at_def)
lemma create_cap_valid_arch_caps[wp, Untyped_AI_assms]:
"\<lbrace>valid_arch_caps
and valid_cap (default_cap tp oref sz dev)
and (\<lambda>(s::'state_ext::state_ext state). \<forall>r\<in>obj_refs (default_cap tp oref sz dev).
(\<forall>p'. \<not> cte_wp_at (\<lambda>cap. r \<in> obj_refs cap) p' s)
\<and> \<not> obj_at (nonempty_table (set (second_level_tables (arch_state s)))) r s)
and cte_wp_at ((=) cap.NullCap) cref
and K (tp \<noteq> ArchObject ASIDPoolObj)\<rbrace>
create_cap tp sz p dev (cref, oref) \<lbrace>\<lambda>rv. valid_arch_caps\<rbrace>"
apply (simp add: create_cap_def set_cdt_def)
apply (wp set_cap_valid_arch_caps hoare_vcg_disj_lift
hoare_vcg_conj_lift hoare_vcg_all_lift hoare_vcg_imp_lift
| simp add: trans_state_update[symmetric] del: trans_state_update split_paired_All split_paired_Ex imp_disjL split del: if_split)+
apply (clarsimp simp del: split_paired_All split_paired_Ex
imp_disjL
simp: cte_wp_at_caps_of_state)
apply (rule conjI)
apply (clarsimp simp: no_cap_to_obj_with_diff_ref_def
cte_wp_at_caps_of_state)
apply (case_tac "\<exists>x. x \<in> obj_refs cap")
apply (clarsimp dest!: obj_ref_elemD)
apply (case_tac cref, fastforce)
apply (simp add: obj_ref_none_no_asid)
apply (rule conjI)
apply (auto simp: is_cap_simps valid_cap_def second_level_tables_def
obj_at_def nonempty_table_def a_type_simps)[1]
apply (clarsimp simp del: imp_disjL)
apply (case_tac "\<exists>x. x \<in> obj_refs cap")
apply (clarsimp dest!: obj_ref_elemD)
apply fastforce
apply (auto simp: is_cap_simps)[1]
done
lemma create_cap_cap_refs_in_kernel_window[wp, Untyped_AI_assms]:
"\<lbrace>cap_refs_in_kernel_window and cte_wp_at (\<lambda>c. cap_range (default_cap tp oref sz dev) \<subseteq> cap_range c) p\<rbrace>
create_cap tp sz p dev (cref, oref) \<lbrace>\<lambda>rv. cap_refs_in_kernel_window\<rbrace>"
apply (simp add: create_cap_def)
apply (wp | simp)+
apply (clarsimp simp: cte_wp_at_caps_of_state)
apply (drule(1) cap_refs_in_kernel_windowD)
apply blast
done
crunch irq_node[wp]: store_pde "\<lambda>s. P (interrupt_irq_node s)"
(wp: crunch_wps)
(* make these available in the generic theory? *)
lemma init_arch_objects_irq_node[wp]:
"\<lbrace>\<lambda>s. P (interrupt_irq_node s)\<rbrace> init_arch_objects tp ptr bits us refs \<lbrace>\<lambda>rv s. P (interrupt_irq_node s)\<rbrace>"
by (wp init_arch_objects_hoare_lift, simp)
lemma init_arch_objects_excap[wp]:
"\<lbrace>ex_cte_cap_wp_to P p\<rbrace> init_arch_objects tp ptr bits us refs \<lbrace>\<lambda>rv. ex_cte_cap_wp_to P p\<rbrace>"
by (wp ex_cte_cap_to_pres init_arch_objects_irq_node init_arch_objects_cte_wp_at)
(**)
crunch nonempty_table[wp]: do_machine_op
"\<lambda>s. P' (obj_at (nonempty_table (set (second_level_tables (arch_state s)))) r s)"
lemma store_pde_weaken:
"\<lbrace>\<lambda>s. page_directory_at (p && ~~ mask pd_bits) s \<longrightarrow> P s\<rbrace> store_pde p e \<lbrace>Q\<rbrace> =
\<lbrace>P\<rbrace> store_pde p e \<lbrace>Q\<rbrace>"
apply (rule iffI)
apply (simp add: valid_def)
apply (erule allEI)
apply clarsimp
apply (simp add: valid_def)
apply (erule allEI)
apply clarsimp
apply (rule use_valid, assumption)
apply (simp add: store_pde_def set_pd_def set_object_def)
apply (wp get_object_wp)
apply (clarsimp simp: obj_at_def a_type_simps vspace_bits_defs)
apply (drule bspec, assumption)
apply (simp add: simpler_store_pde_def obj_at_def fun_upd_def vspace_bits_defs
split: Structures_A.kernel_object.splits arch_kernel_obj.splits)
done
(* ARMHYP not needed anymore?
lemma store_pde_nonempty_table:
"\<lbrace>\<lambda>s. \<not> (obj_at (nonempty_table {}) r s)
\<and> (\<forall>rf. pde_ref pde = Some rf \<longrightarrow>
rf \<in> {})
\<and> valid_pde_mappings pde\<rbrace>
store_pde pde_ptr pde
\<lbrace>\<lambda>rv s. \<not> (obj_at (nonempty_table {}) r s)\<rbrace>"
apply (simp add: store_pde_def set_pd_def set_object_def)
apply (wp get_object_wp)
apply (clarsimp simp: obj_at_def nonempty_table_def a_type_def)
apply (clarsimp simp add: empty_table_def vspace_bits_defs)
done *)
(*
lemma valid_arch_state_global_pd: (* ARMHYP restate? *)
"\<lbrakk> valid_arch_state s; pspace_aligned s \<rbrakk>
\<Longrightarrow> obj_at (\<lambda>ko. \<exists>pd. ko = ArchObj (PageDirectory pd)) (arm_global_pd (arch_state s)) s
\<and> is_aligned (arm_global_pd (arch_state s)) pd_bits"
apply (clarsimp simp: valid_arch_state_def a_type_def
pd_aligned pd_bits_def pageBits_def
elim!: obj_at_weakenE)
apply (clarsimp split: Structures_A.kernel_object.split_asm
arch_kernel_obj.split_asm if_split_asm)
done
*)
lemma pd_shifting':
"is_aligned (pd :: word32) pd_bits \<Longrightarrow> pd + (vptr >> pageBits + pt_bits - pte_bits << pde_bits) && ~~ mask pd_bits = pd"
by (rule pd_shifting, simp add: vspace_bits_defs)
lemma copy_global_mappings_nonempty_table: (* ARMHYP need change *)
"is_aligned pd pd_bits \<Longrightarrow>
\<lbrace>\<lambda>s. \<not> (obj_at (nonempty_table (set (second_level_tables (arch_state s)))) r s) \<and>
valid_arch_state s \<and> pspace_aligned s\<rbrace>
copy_global_mappings pd
\<lbrace>\<lambda>rv s. \<not> (obj_at (nonempty_table
(set (second_level_tables (arch_state s)))) r s) \<and>
valid_arch_state s \<and> pspace_aligned s\<rbrace>"
apply (simp add: copy_global_mappings_def)
done
lemma mapM_copy_global_mappings_nonempty_table[wp]:
"\<lbrace>(\<lambda>s. \<not> (obj_at (nonempty_table (set (second_level_tables (arch_state s)))) r s)
\<and> valid_arch_state s \<and> pspace_aligned s) and
K (\<forall>pd\<in>set pds. is_aligned pd pd_bits)\<rbrace>
mapM_x copy_global_mappings pds
\<lbrace>\<lambda>rv s. \<not> (obj_at (nonempty_table (set (second_level_tables (arch_state s)))) r s)\<rbrace>"
apply (rule hoare_gen_asm)
apply (rule hoare_strengthen_post)
apply (rule mapM_x_wp', rule copy_global_mappings_nonempty_table)
apply simp_all
done
lemma init_arch_objects_nonempty_table[Untyped_AI_assms, wp]:
"\<lbrace>(\<lambda>s. \<not> (obj_at (nonempty_table (set (second_level_tables (arch_state s)))) r s)
\<and> valid_global_objs s \<and> valid_arch_state s \<and> pspace_aligned s) and
K (\<forall>ref\<in>set refs. is_aligned ref (obj_bits_api tp us))\<rbrace>
init_arch_objects tp ptr bits us refs
\<lbrace>\<lambda>rv s. \<not> (obj_at (nonempty_table (set (second_level_tables (arch_state s)))) r s)\<rbrace>"
apply (rule hoare_gen_asm)
apply (simp add: init_arch_objects_def split del: if_split)
apply (rule hoare_pre)
apply (wp hoare_unless_wp | wpc | simp add: reserve_region_def)+
apply (clarsimp simp: obj_bits_api_def default_arch_object_def pd_bits_def pageBits_def)
done
lemma nonempty_table_caps_of[Untyped_AI_assms]:
"nonempty_table S ko \<Longrightarrow> caps_of ko = {}"
by (auto simp: caps_of_def cap_of_def nonempty_table_def a_type_def
split: Structures_A.kernel_object.split if_split_asm)
lemma nonempty_default[simp, Untyped_AI_assms]:
"tp \<noteq> Untyped \<Longrightarrow> \<not> nonempty_table S (default_object tp dev us)"
apply (case_tac tp, simp_all add: default_object_def nonempty_table_def
a_type_def)
apply (rename_tac aobject_type)
apply (case_tac aobject_type, simp_all add: default_arch_object_def)
apply (simp_all add: empty_table_def pde_ref_def valid_pde_mappings_def)
done
lemma set_pd_cte_wp_at_iin[wp]:
"\<lbrace>\<lambda>s. P (cte_wp_at (P' (interrupt_irq_node s)) p s)\<rbrace>
set_pd q pd
\<lbrace>\<lambda>_ s. P (cte_wp_at (P' (interrupt_irq_node s)) p s)\<rbrace>"
apply (simp add: set_pd_def set_object_def a_type_def)
apply (wp get_object_wp)
apply (clarsimp simp: obj_at_def cte_wp_at_caps_of_state
split: Structures_A.kernel_object.splits arch_kernel_obj.splits)
apply (subst caps_of_state_after_update)
apply (simp add: obj_at_def)+
done
crunch cte_wp_at_iin[wp]: init_arch_objects
"\<lambda>s. P (cte_wp_at (P' (interrupt_irq_node s)) p s)"
(ignore: clearMemory wp: crunch_wps)
lemmas init_arch_objects_ex_cte_cap_wp_to
= init_arch_objects_excap
lemma obj_is_device_vui_eq[Untyped_AI_assms]:
"valid_untyped_inv ui s
\<Longrightarrow> case ui of Retype slot reset ptr_base ptr tp us slots dev
\<Rightarrow> obj_is_device tp dev = dev"
apply (cases ui, clarsimp)
apply (clarsimp simp: obj_is_device_def
split: apiobject_type.split)
apply (intro impI conjI allI, simp_all add: is_frame_type_def default_object_def)
apply (simp add: default_arch_object_def split: aobject_type.split)
apply (auto simp: arch_is_frame_type_def)
done
lemma create_cap_ioports[wp, Untyped_AI_assms]:
"\<lbrace>valid_ioports and cte_wp_at (\<lambda>_. True) cref\<rbrace> create_cap tp sz p dev (cref,oref) \<lbrace>\<lambda>rv. valid_ioports\<rbrace>"
by wpsimp
end
global_interpretation Untyped_AI? : Untyped_AI
where nonempty_table = ARM_HYP.nonempty_table
proof goal_cases
interpret Arch .
case 1 show ?case
by (unfold_locales; (fact Untyped_AI_assms)?)
qed
end
|
lemma linear_conv_bounded_linear: fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" shows "linear f \<longleftrightarrow> bounded_linear f" |
(* Title: HOL/Auth/n_germanSymIndex_lemma_on_inv__47.thy
Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
*)
header{*The n_germanSymIndex Protocol Case Study*}
theory n_germanSymIndex_lemma_on_inv__47 imports n_germanSymIndex_base
begin
section{*All lemmas on causal relation between inv__47 and some rule r*}
lemma n_RecvReqSVsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvReqS N i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvReqS N i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Ident ''CurCmd'')) (Const Empty)) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv0) ''Cmd'')) (Const Inv))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Ident ''CurCmd'')) (Const Empty)) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv0) ''Cmd'')) (Const Inv))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Ident ''CurCmd'')) (Const Empty)) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv0) ''Cmd'')) (Const Inv))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_RecvReqEVsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvReqE N i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvReqE N i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendInv__part__0Vsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInv__part__0 i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInv__part__0 i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendInv__part__1Vsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInv__part__1 i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInv__part__1 i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (andForm (eqn (IVar (Ident ''CurCmd'')) (Const ReqS)) (eqn (IVar (Field (Para (Ident ''Chan3'') p__Inv2) ''Cmd'')) (Const InvAck))) (eqn (IVar (Para (Ident ''InvSet'') p__Inv0)) (Const true))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendInvAckVsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInvAck i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInvAck i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (andForm (eqn (IVar (Ident ''CurCmd'')) (Const ReqS)) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv2) ''Cmd'')) (Const Inv))) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv0) ''Cmd'')) (Const Inv))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_RecvInvAckVsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvInvAck i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvInvAck i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendGntSVsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendGntS i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendGntS i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendGntEVsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendGntE N i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendGntE N i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_RecvGntSVsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvGntS i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvGntS i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_RecvGntEVsinv__47:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvGntE i)" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvGntE i" apply fastforce done
from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2" apply fastforce done
have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv0)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendReqE__part__1Vsinv__47:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqE__part__1 i" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_StoreVsinv__47:
assumes a1: "\<exists> i d. i\<le>N\<and>d\<le>N\<and>r=n_Store i d" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_SendReqE__part__0Vsinv__47:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqE__part__0 i" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_SendReqSVsinv__47:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqS i" and
a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__47 p__Inv0 p__Inv2)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
end
|
- Feedback from Trev on our great service.
"I think what is good about this agency is that they do not charge an admin fee. Also, I just need to pay the teacher for the lessons, it is fuss-free and not so troublesome. The teacher they recommended was reliable and the agency found a teacher for me within 24 hours. So I feel their service is good!
"I found out about SG Piano Music Agency via the internet and am pleased with the service I have gotten from them. The person from the agency whom I liaised with was very helpful in finding me a suitable teacher for my child.
Thank you very much and I will definitely recommend you to my other friends who are looking for piano teachers."
"I have always wanted to learn the piano since I was a child but didn't have the chance to do so. So now that I'm married and my children are all working, I decided to get a piano and looked for a piano teacher via SG Piano Music Agency.
The agency shortlisted some teachers for me to choose from and I have been taught by Ms Ng for the past 2 years. I am happy that finally I can play the instrument I always wanted to learn since I was young. Thank you to Jamie and the agency for your help!" |
/-
Copyright (c) 2022 Yuma Mizuno. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yuma Mizuno
! This file was ported from Lean 3 source module category_theory.bicategory.locally_discrete
! leanprover-community/mathlib commit c9c9fa15fec7ca18e9ec97306fb8764bfe988a7e
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.CategoryTheory.DiscreteCategory
import Mathlib.CategoryTheory.Bicategory.Functor
import Mathlib.CategoryTheory.Bicategory.Strict
/-!
# Locally discrete bicategories
A category `C` can be promoted to a strict bicategory `LocallyDiscrete C`. The objects and the
1-morphisms in `LocallyDiscrete C` are the same as the objects and the morphisms, respectively,
in `C`, and the 2-morphisms in `LocallyDiscrete C` are the equalities between 1-morphisms. In
other words, the category consisting of the 1-morphisms between each pair of objects `X` and `Y`
in `LocallyDiscrete C` is defined as the discrete category associated with the type `X ⟶ Y`.
-/
namespace CategoryTheory
open Bicategory Discrete
open Bicategory
universe w₂ v v₁ v₂ u u₁ u₂
variable {C : Type u}
/-- A type synonym for promoting any type to a category,
with the only morphisms being equalities.
-/
def LocallyDiscrete (C : Type u) :=
C
#align category_theory.locally_discrete CategoryTheory.LocallyDiscrete
namespace LocallyDiscrete
instance [Inhabited C] : Inhabited (LocallyDiscrete C) := ⟨(default : C)⟩
instance [CategoryStruct.{v} C] : CategoryStruct (LocallyDiscrete C)
where
Hom := fun X Y : C => Discrete (X ⟶ Y)
id := fun X : C => ⟨𝟙 X⟩
comp f g := ⟨f.as ≫ g.as⟩
variable [CategoryStruct.{v} C]
instance (priority := 900) homSmallCategory (X Y : LocallyDiscrete C) : SmallCategory (X ⟶ Y) :=
let X' : C := X
let Y' : C := Y
CategoryTheory.discreteCategory (X' ⟶ Y')
#align category_theory.locally_discrete.hom_small_category CategoryTheory.LocallyDiscrete.homSmallCategory
-- Porting note: Manually adding this instance (inferInstance doesn't work)
instance subsingleton2Hom {X Y : LocallyDiscrete C} (f g : X ⟶ Y) : Subsingleton (f ⟶ g) :=
let X' : C := X
let Y' : C := Y
let f' : Discrete (X' ⟶ Y') := f
let g' : Discrete (X' ⟶ Y') := g
show Subsingleton (f' ⟶ g') from inferInstance
/-- Extract the equation from a 2-morphism in a locally discrete 2-category. -/
theorem eq_of_hom {X Y : LocallyDiscrete C} {f g : X ⟶ Y} (η : f ⟶ g) : f = g :=
Discrete.ext _ _ η.1.1
#align category_theory.locally_discrete.eq_of_hom CategoryTheory.LocallyDiscrete.eq_of_hom
end LocallyDiscrete
variable (C) [Category.{v} C]
/-- The locally discrete bicategory on a category is a bicategory in which the objects and the
1-morphisms are the same as those in the underlying category, and the 2-morphisms are the
equalities between 1-morphisms.
-/
instance locallyDiscreteBicategory : Bicategory (LocallyDiscrete C)
where
whiskerLeft f g h η := eqToHom (congr_arg₂ (· ≫ ·) rfl (LocallyDiscrete.eq_of_hom η))
whiskerRight η h := eqToHom (congr_arg₂ (· ≫ ·) (LocallyDiscrete.eq_of_hom η) rfl)
associator f g h :=
eqToIso <| by
apply Discrete.ext
change (f.as ≫ g.as) ≫ h.as = f.as ≫ (g.as ≫ h.as)
rw [Category.assoc]
leftUnitor f :=
eqToIso <| by
apply Discrete.ext
change 𝟙 _ ≫ _ = _
rw [Category.id_comp]
rightUnitor f :=
eqToIso <| by
apply Discrete.ext
change _ ≫ 𝟙 _ = _
rw [Category.comp_id]
#align category_theory.locally_discrete_bicategory CategoryTheory.locallyDiscreteBicategory
/-- A locally discrete bicategory is strict. -/
instance locallyDiscreteBicategory.strict : Strict (LocallyDiscrete C)
where
id_comp := by
intros
apply Discrete.ext
apply Category.id_comp
comp_id := by
intros
apply Discrete.ext
apply Category.comp_id
assoc := by
intros
apply Discrete.ext
apply Category.assoc
#align category_theory.locally_discrete_bicategory.strict CategoryTheory.locallyDiscreteBicategory.strict
variable {I : Type u₁} [Category.{v₁} I] {B : Type u₂} [Bicategory.{w₂, v₂} B] [Strict B]
/--
If `B` is a strict bicategory and `I` is a (1-)category, any functor (of 1-categories) `I ⥤ B` can
be promoted to an oplax functor from `LocallyDiscrete I` to `B`.
-/
@[simps]
def Functor.toOplaxFunctor (F : I ⥤ B) : OplaxFunctor (LocallyDiscrete I) B
where
obj := F.obj
map f := F.map f.as
map₂ η := eqToHom (congr_arg _ (LocallyDiscrete.eq_of_hom η))
mapId i := eqToHom (F.map_id i)
mapComp f g := eqToHom (F.map_comp f.as g.as)
#align category_theory.functor.to_oplax_functor CategoryTheory.Functor.toOplaxFunctor
end CategoryTheory
|
In a relatively short time Crosspoint has become a renowned company in the Belgian Broadcast and professional audiovisual industry.
As a distribitor Crosspoint provides its customers reliable solutions from industry leading manufacturers.
Customer satisfaction is Crosspoints main concern, aiming to give excellent service and offering quality products through an honest approach. |
(* Title: HOL/Auth/Guard/Guard.thy
Author: Frederic Blanqui, University of Cambridge Computer Laboratory
Copyright 2002 University of Cambridge
*)
section\<open>Protocol-Independent Confidentiality Theorem on Nonces\<close>
theory Guard imports Analz Extensions begin
(******************************************************************************
messages where all the occurrences of Nonce n are
in a sub-message of the form Crypt (invKey K) X with K:Ks
******************************************************************************)
inductive_set
guard :: "nat \<Rightarrow> key set \<Rightarrow> msg set"
for n :: nat and Ks :: "key set"
where
No_Nonce [intro]: "Nonce n \<notin> parts {X} \<Longrightarrow> X \<in> guard n Ks"
| Guard_Nonce [intro]: "invKey K \<in> Ks \<Longrightarrow> Crypt K X \<in> guard n Ks"
| Crypt [intro]: "X \<in> guard n Ks \<Longrightarrow> Crypt K X \<in> guard n Ks"
| Pair [intro]: "\<lbrakk>X \<in> guard n Ks; Y \<in> guard n Ks\<rbrakk> \<Longrightarrow> \<lbrace>X,Y\<rbrace> \<in> guard n Ks"
subsection\<open>basic facts about \<^term>\<open>guard\<close>\<close>
lemma Key_is_guard [iff]: "Key K \<in> guard n Ks"
by auto
lemma Agent_is_guard [iff]: "Agent A \<in> guard n Ks"
by auto
lemma Number_is_guard [iff]: "Number r \<in> guard n Ks"
by auto
lemma Nonce_notin_guard: "X \<in> guard n Ks \<Longrightarrow> X \<noteq> Nonce n"
by (erule guard.induct, auto)
lemma Nonce_notin_guard_iff [iff]: "Nonce n \<notin> guard n Ks"
by (auto dest: Nonce_notin_guard)
lemma guard_has_Crypt [rule_format]: "X \<in> guard n Ks \<Longrightarrow> Nonce n \<in> parts {X}
\<longrightarrow> (\<exists>K Y. Crypt K Y \<in> kparts {X} \<and> Nonce n \<in> parts {Y})"
by (erule guard.induct, auto)
lemma Nonce_notin_kparts_msg: "X \<in> guard n Ks \<Longrightarrow> Nonce n \<notin> kparts {X}"
by (erule guard.induct, auto)
lemma Nonce_in_kparts_imp_no_guard: "Nonce n \<in> kparts H
\<Longrightarrow> \<exists>X. X \<in> H \<and> X \<notin> guard n Ks"
apply (drule in_kparts, clarify)
apply (rule_tac x=X in exI, clarify)
by (auto dest: Nonce_notin_kparts_msg)
lemma guard_kparts [rule_format]: "X \<in> guard n Ks \<Longrightarrow>
Y \<in> kparts {X} \<longrightarrow> Y \<in> guard n Ks"
by (erule guard.induct, auto)
lemma guard_Crypt: "\<lbrakk>Crypt K Y \<in> guard n Ks; K \<notin> invKey`Ks\<rbrakk> \<Longrightarrow> Y \<in> guard n Ks"
by (ind_cases "Crypt K Y \<in> guard n Ks") (auto intro!: image_eqI)
lemma guard_MPair [iff]: "(\<lbrace>X,Y\<rbrace> \<in> guard n Ks) = (X \<in> guard n Ks \<and> Y \<in> guard n Ks)"
by (auto, (ind_cases "\<lbrace>X,Y\<rbrace> \<in> guard n Ks", auto)+)
lemma guard_not_guard [rule_format]: "X \<in> guard n Ks \<Longrightarrow>
Crypt K Y \<in> kparts {X} \<longrightarrow> Nonce n \<in> kparts {Y} \<longrightarrow> Y \<notin> guard n Ks"
by (erule guard.induct, auto dest: guard_kparts)
lemma guard_extand: "\<lbrakk>X \<in> guard n Ks; Ks \<subseteq> Ks'\<rbrakk> \<Longrightarrow> X \<in> guard n Ks'"
by (erule guard.induct, auto)
subsection\<open>guarded sets\<close>
definition Guard :: "nat \<Rightarrow> key set \<Rightarrow> msg set \<Rightarrow> bool" where
"Guard n Ks H \<equiv> \<forall>X. X \<in> H \<longrightarrow> X \<in> guard n Ks"
subsection\<open>basic facts about \<^term>\<open>Guard\<close>\<close>
lemma Guard_empty [iff]: "Guard n Ks {}"
by (simp add: Guard_def)
lemma notin_parts_Guard [intro]: "Nonce n \<notin> parts G \<Longrightarrow> Guard n Ks G"
apply (unfold Guard_def, clarify)
apply (subgoal_tac "Nonce n \<notin> parts {X}")
by (auto dest: parts_sub)
lemma Nonce_notin_kparts [simplified]: "Guard n Ks H \<Longrightarrow> Nonce n \<notin> kparts H"
by (auto simp: Guard_def dest: in_kparts Nonce_notin_kparts_msg)
lemma Guard_must_decrypt: "\<lbrakk>Guard n Ks H; Nonce n \<in> analz H\<rbrakk> \<Longrightarrow>
\<exists>K Y. Crypt K Y \<in> kparts H \<and> Key (invKey K) \<in> kparts H"
apply (drule_tac P="\<lambda>G. Nonce n \<in> G" in analz_pparts_kparts_substD, simp)
by (drule must_decrypt, auto dest: Nonce_notin_kparts)
lemma Guard_kparts [intro]: "Guard n Ks H \<Longrightarrow> Guard n Ks (kparts H)"
by (auto simp: Guard_def dest: in_kparts guard_kparts)
lemma Guard_mono: "\<lbrakk>Guard n Ks H; G <= H\<rbrakk> \<Longrightarrow> Guard n Ks G"
by (auto simp: Guard_def)
lemma Guard_insert [iff]: "Guard n Ks (insert X H)
= (Guard n Ks H \<and> X \<in> guard n Ks)"
by (auto simp: Guard_def)
lemma Guard_Un [iff]: "Guard n Ks (G Un H) = (Guard n Ks G & Guard n Ks H)"
by (auto simp: Guard_def)
lemma Guard_synth [intro]: "Guard n Ks G \<Longrightarrow> Guard n Ks (synth G)"
by (auto simp: Guard_def, erule synth.induct, auto)
lemma Guard_analz [intro]: "\<lbrakk>Guard n Ks G; \<forall>K. K \<in> Ks \<longrightarrow> Key K \<notin> analz G\<rbrakk>
\<Longrightarrow> Guard n Ks (analz G)"
apply (auto simp: Guard_def)
apply (erule analz.induct, auto)
by (ind_cases "Crypt K Xa \<in> guard n Ks" for K Xa, auto)
lemma in_Guard [dest]: "\<lbrakk>X \<in> G; Guard n Ks G\<rbrakk> \<Longrightarrow> X \<in> guard n Ks"
by (auto simp: Guard_def)
lemma in_synth_Guard: "\<lbrakk>X \<in> synth G; Guard n Ks G\<rbrakk> \<Longrightarrow> X \<in> guard n Ks"
by (drule Guard_synth, auto)
lemma in_analz_Guard: "\<lbrakk>X \<in> analz G; Guard n Ks G;
\<forall>K. K \<in> Ks \<longrightarrow> Key K \<notin> analz G\<rbrakk> \<Longrightarrow> X \<in> guard n Ks"
by (drule Guard_analz, auto)
lemma Guard_keyset [simp]: "keyset G \<Longrightarrow> Guard n Ks G"
by (auto simp: Guard_def)
lemma Guard_Un_keyset: "\<lbrakk>Guard n Ks G; keyset H\<rbrakk> \<Longrightarrow> Guard n Ks (G \<union> H)"
by auto
lemma in_Guard_kparts: "\<lbrakk>X \<in> G; Guard n Ks G; Y \<in> kparts {X}\<rbrakk> \<Longrightarrow> Y \<in> guard n Ks"
by blast
lemma in_Guard_kparts_neq: "\<lbrakk>X \<in> G; Guard n Ks G; Nonce n' \<in> kparts {X}\<rbrakk>
\<Longrightarrow> n \<noteq> n'"
by (blast dest: in_Guard_kparts)
lemma in_Guard_kparts_Crypt: "\<lbrakk>X \<in> G; Guard n Ks G; is_MPair X;
Crypt K Y \<in> kparts {X}; Nonce n \<in> kparts {Y}\<rbrakk> \<Longrightarrow> invKey K \<in> Ks"
apply (drule in_Guard, simp)
apply (frule guard_not_guard, simp+)
apply (drule guard_kparts, simp)
by (ind_cases "Crypt K Y \<in> guard n Ks", auto)
lemma Guard_extand: "\<lbrakk>Guard n Ks G; Ks \<subseteq> Ks'\<rbrakk> \<Longrightarrow> Guard n Ks' G"
by (auto simp: Guard_def dest: guard_extand)
lemma guard_invKey [rule_format]: "\<lbrakk>X \<in> guard n Ks; Nonce n \<in> kparts {Y}\<rbrakk> \<Longrightarrow>
Crypt K Y \<in> kparts {X} \<longrightarrow> invKey K \<in> Ks"
by (erule guard.induct, auto)
lemma Crypt_guard_invKey [rule_format]: "\<lbrakk>Crypt K Y \<in> guard n Ks;
Nonce n \<in> kparts {Y}\<rbrakk> \<Longrightarrow> invKey K \<in> Ks"
by (auto dest: guard_invKey)
subsection\<open>set obtained by decrypting a message\<close>
abbreviation (input)
decrypt :: "msg set => key => msg => msg set" where
"decrypt H K Y == insert Y (H - {Crypt K Y})"
lemma analz_decrypt: "\<lbrakk>Crypt K Y \<in> H; Key (invKey K) \<in> H; Nonce n \<in> analz H\<rbrakk>
\<Longrightarrow> Nonce n \<in> analz (decrypt H K Y)"
apply (drule_tac P="\<lambda>H. Nonce n \<in> analz H" in ssubst [OF insert_Diff])
apply assumption
apply (simp only: analz_Crypt_if, simp)
done
lemma parts_decrypt: "\<lbrakk>Crypt K Y \<in> H; X \<in> parts (decrypt H K Y)\<rbrakk> \<Longrightarrow> X \<in> parts H"
by (erule parts.induct, auto intro: parts.Fst parts.Snd parts.Body)
subsection\<open>number of Crypt's in a message\<close>
fun crypt_nb :: "msg => nat"
where
"crypt_nb (Crypt K X) = Suc (crypt_nb X)"
| "crypt_nb \<lbrace>X,Y\<rbrace> = crypt_nb X + crypt_nb Y"
| "crypt_nb X = 0" (* otherwise *)
subsection\<open>basic facts about \<^term>\<open>crypt_nb\<close>\<close>
lemma non_empty_crypt_msg: "Crypt K Y \<in> parts {X} \<Longrightarrow> crypt_nb X \<noteq> 0"
by (induct X, simp_all, safe, simp_all)
subsection\<open>number of Crypt's in a message list\<close>
primrec cnb :: "msg list => nat"
where
"cnb [] = 0"
| "cnb (X#l) = crypt_nb X + cnb l"
subsection\<open>basic facts about \<^term>\<open>cnb\<close>\<close>
lemma cnb_app [simp]: "cnb (l @ l') = cnb l + cnb l'"
by (induct l, auto)
lemma mem_cnb_minus: "x \<in> set l \<Longrightarrow> cnb l = crypt_nb x + (cnb l - crypt_nb x)"
by (induct l) auto
lemmas mem_cnb_minus_substI = mem_cnb_minus [THEN ssubst]
lemma cnb_minus [simp]: "x \<in> set l \<Longrightarrow> cnb (remove l x) = cnb l - crypt_nb x"
apply (induct l, auto)
apply (erule_tac l=l and x=x in mem_cnb_minus_substI)
apply simp
done
lemma parts_cnb: "Z \<in> parts (set l) \<Longrightarrow>
cnb l = (cnb l - crypt_nb Z) + crypt_nb Z"
by (erule parts.induct, auto simp: in_set_conv_decomp)
lemma non_empty_crypt: "Crypt K Y \<in> parts (set l) \<Longrightarrow> cnb l \<noteq> 0"
by (induct l, auto dest: non_empty_crypt_msg parts_insert_substD)
subsection\<open>list of kparts\<close>
lemma kparts_msg_set: "\<exists>l. kparts {X} = set l \<and> cnb l = crypt_nb X"
apply (induct X, simp_all)
apply (rename_tac agent, rule_tac x="[Agent agent]" in exI, simp)
apply (rename_tac nat, rule_tac x="[Number nat]" in exI, simp)
apply (rename_tac nat, rule_tac x="[Nonce nat]" in exI, simp)
apply (rename_tac nat, rule_tac x="[Key nat]" in exI, simp)
apply (rename_tac X, rule_tac x="[Hash X]" in exI, simp)
apply (clarify, rule_tac x="l@la" in exI, simp)
by (clarify, rename_tac nat X y, rule_tac x="[Crypt nat X]" in exI, simp)
lemma kparts_set: "\<exists>l'. kparts (set l) = set l' \<and> cnb l' = cnb l"
apply (induct l)
apply (rule_tac x="[]" in exI, simp, clarsimp)
apply (rename_tac a b l')
apply (subgoal_tac "\<exists>l''. kparts {a} = set l'' \<and> cnb l'' = crypt_nb a", clarify)
apply (rule_tac x="l''@l'" in exI, simp)
apply (rule kparts_insert_substI, simp)
by (rule kparts_msg_set)
subsection\<open>list corresponding to "decrypt"\<close>
definition decrypt' :: "msg list => key => msg => msg list" where
"decrypt' l K Y == Y # remove l (Crypt K Y)"
declare decrypt'_def [simp]
subsection\<open>basic facts about \<^term>\<open>decrypt'\<close>\<close>
lemma decrypt_minus: "decrypt (set l) K Y <= set (decrypt' l K Y)"
by (induct l, auto)
subsection\<open>if the analyse of a finite guarded set gives n then it must also gives
one of the keys of Ks\<close>
lemma Guard_invKey_by_list [rule_format]: "\<forall>l. cnb l = p
\<longrightarrow> Guard n Ks (set l) \<longrightarrow> Nonce n \<in> analz (set l)
\<longrightarrow> (\<exists>K. K \<in> Ks \<and> Key K \<in> analz (set l))"
apply (induct p)
(* case p=0 *)
apply (clarify, drule Guard_must_decrypt, simp, clarify)
apply (drule kparts_parts, drule non_empty_crypt, simp)
(* case p>0 *)
apply (clarify, frule Guard_must_decrypt, simp, clarify)
apply (drule_tac P="\<lambda>G. Nonce n \<in> G" in analz_pparts_kparts_substD, simp)
apply (frule analz_decrypt, simp_all)
apply (subgoal_tac "\<exists>l'. kparts (set l) = set l' \<and> cnb l' = cnb l", clarsimp)
apply (drule_tac G="insert Y (set l' - {Crypt K Y})"
and H="set (decrypt' l' K Y)" in analz_sub, rule decrypt_minus)
apply (rule_tac analz_pparts_kparts_substI, simp)
apply (case_tac "K \<in> invKey`Ks")
(* K:invKey`Ks *)
apply (clarsimp, blast)
(* K ~:invKey`Ks *)
apply (subgoal_tac "Guard n Ks (set (decrypt' l' K Y))")
apply (drule_tac x="decrypt' l' K Y" in spec, simp)
apply (subgoal_tac "Crypt K Y \<in> parts (set l)")
apply (drule parts_cnb, rotate_tac -1, simp)
apply (clarify, drule_tac X="Key Ka" and H="insert Y (set l')" in analz_sub)
apply (rule insert_mono, rule set_remove)
apply (simp add: analz_insertD, blast)
(* Crypt K Y:parts (set l) *)
apply (blast dest: kparts_parts)
(* Guard n Ks (set (decrypt' l' K Y)) *)
apply (rule_tac H="insert Y (set l')" in Guard_mono)
apply (subgoal_tac "Guard n Ks (set l')", simp)
apply (rule_tac K=K in guard_Crypt, simp add: Guard_def, simp)
apply (drule_tac t="set l'" in sym, simp)
apply (rule Guard_kparts, simp, simp)
apply (rule_tac B="set l'" in subset_trans, rule set_remove, blast)
by (rule kparts_set)
lemma Guard_invKey_finite: "\<lbrakk>Nonce n \<in> analz G; Guard n Ks G; finite G\<rbrakk>
\<Longrightarrow> \<exists>K. K \<in> Ks \<and> Key K \<in> analz G"
apply (drule finite_list, clarify)
by (rule Guard_invKey_by_list, auto)
lemma Guard_invKey: "\<lbrakk>Nonce n \<in> analz G; Guard n Ks G\<rbrakk>
\<Longrightarrow> \<exists>K. K \<in> Ks \<and> Key K \<in> analz G"
by (auto dest: analz_needs_only_finite Guard_invKey_finite)
subsection\<open>if the analyse of a finite guarded set and a (possibly infinite) set of keys
gives n then it must also gives Ks\<close>
lemma Guard_invKey_keyset: "\<lbrakk>Nonce n \<in> analz (G \<union> H); Guard n Ks G; finite G;
keyset H\<rbrakk> \<Longrightarrow> \<exists>K. K \<in> Ks \<and> Key K \<in> analz (G \<union> H)"
apply (frule_tac P="\<lambda>G. Nonce n \<in> G" and G=G in analz_keyset_substD, simp_all)
apply (drule_tac G="G Un (H Int keysfor G)" in Guard_invKey_finite)
by (auto simp: Guard_def intro: analz_sub)
end
|
Formal statement is: lemma interior_mono: "S \<subseteq> T \<Longrightarrow> interior S \<subseteq> interior T" Informal statement is: If $S \subseteq T$, then $\operatorname{int}(S) \subseteq \operatorname{int}(T)$. |
Formal statement is: lemma lim_infinity_imp_sequentially: "(f \<longlongrightarrow> l) at_infinity \<Longrightarrow> ((\<lambda>n. f(n)) \<longlongrightarrow> l) sequentially" Informal statement is: If $f$ converges to $l$ at infinity, then the sequence $(f(n))$ converges to $l$. |
[STATEMENT]
lemma subspace_dim_equal:
assumes "subspace S"
and "subspace T"
and "S \<subseteq> T"
and "dim S \<ge> dim T"
shows "S = T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. S = T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. S = T
[PROOF STEP]
obtain B where B: "B \<le> S" "independent B \<and> S \<subseteq> span B" "card B = dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>B. \<lbrakk>B \<subseteq> S; independent B \<and> S \<subseteq> span B; card B = dim S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using basis_exists[of S]
[PROOF STATE]
proof (prove)
using this:
(\<And>B. \<lbrakk>B \<subseteq> S; independent B; S \<subseteq> span B; card B = dim S\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
goal (1 subgoal):
1. (\<And>B. \<lbrakk>B \<subseteq> S; independent B \<and> S \<subseteq> span B; card B = dim S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
B \<subseteq> S
independent B \<and> S \<subseteq> span B
card B = dim S
goal (1 subgoal):
1. S = T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<subseteq> S
independent B \<and> S \<subseteq> span B
card B = dim S
[PROOF STEP]
have "span B \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> S
independent B \<and> S \<subseteq> span B
card B = dim S
goal (1 subgoal):
1. span B \<subseteq> S
[PROOF STEP]
using span_mono[of B S] span_eq_iff[of S] assms
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> S
independent B \<and> S \<subseteq> span B
card B = dim S
B \<subseteq> S \<Longrightarrow> span B \<subseteq> span S
(span S = S) = subspace S
subspace S
subspace T
S \<subseteq> T
dim T \<le> dim S
goal (1 subgoal):
1. span B \<subseteq> S
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
span B \<subseteq> S
goal (1 subgoal):
1. S = T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
span B \<subseteq> S
[PROOF STEP]
have "span B = S"
[PROOF STATE]
proof (prove)
using this:
span B \<subseteq> S
goal (1 subgoal):
1. span B = S
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
span B \<subseteq> S
B \<subseteq> S
independent B \<and> S \<subseteq> span B
card B = dim S
goal (1 subgoal):
1. span B = S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
span B = S
goal (1 subgoal):
1. S = T
[PROOF STEP]
have "dim S = dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dim S = dim T
[PROOF STEP]
using assms dim_subset[of S T]
[PROOF STATE]
proof (prove)
using this:
subspace S
subspace T
S \<subseteq> T
dim T \<le> dim S
S \<subseteq> T \<Longrightarrow> dim S \<le> dim T
goal (1 subgoal):
1. dim S = dim T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim S = dim T
goal (1 subgoal):
1. S = T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim S = dim T
[PROOF STEP]
have "T \<subseteq> span B"
[PROOF STATE]
proof (prove)
using this:
dim S = dim T
goal (1 subgoal):
1. T \<subseteq> span B
[PROOF STEP]
using card_eq_dim[of B T] B finiteI_independent assms
[PROOF STATE]
proof (prove)
using this:
dim S = dim T
\<lbrakk>B \<subseteq> T; card B = dim T; finite B\<rbrakk> \<Longrightarrow> independent B = (T \<subseteq> span B)
B \<subseteq> S
independent B \<and> S \<subseteq> span B
card B = dim S
independent ?B \<Longrightarrow> finite ?B
subspace S
subspace T
S \<subseteq> T
dim T \<le> dim S
goal (1 subgoal):
1. T \<subseteq> span B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T \<subseteq> span B
goal (1 subgoal):
1. S = T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T \<subseteq> span B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> span B
goal (1 subgoal):
1. S = T
[PROOF STEP]
using assms \<open>span B = S\<close>
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> span B
subspace S
subspace T
S \<subseteq> T
dim T \<le> dim S
span B = S
goal (1 subgoal):
1. S = T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S = T
goal:
No subgoals!
[PROOF STEP]
qed |
.*warning: no input section rule matches .lower.text in linker script
|
function y = testfunctions(varargin)
% TESTFUNCTIONS Integration test functions of A. Genz
% Y = TESTFUNCTIONS(X1, X2, ..., XD, TYPE, C, W) Evaluates test
% function TYPE at the point (X1,...,XN). C and W are arrays of
% constants defining the test function (see below). The test
% functions are defined according to A. Genz: A package for
% testing multiple integration subroutines, in Numerical
% Integration, P. Keast and G. Fairweather (Eds.), D. Riedel,
% pp. 337-340, 1987. The functions are defined on [0 1]^d.
%
% TYPE = 'oscillatory' | TYPE = 1:
% f(x) = cos(2*pi*w_1 + sum_{i=1}^d ( c_i * x_i ) )
%
% TYPE = 'product peak' | TYPE = 2:
% f(x) = prod_{i=1}^d ( c_i^{-2} + (x_i - w_i)^2 )^{-1}
%
% TYPE = 'corner peak' | TYPE = 3:
% f(x) = ( 1 + sum_{i=1}^d (c_i * x_i) )^(-(d+1))
%
% TYPE = 'gaussian' | TYPE = 4:
% f(x) = exp( - sum_{i=1}^d c_i^2 * (x_i - w_i)^2 )
%
% TYPE = 'continuous' | TYPE = 5:
% f(x) = exp( - sum_{i=1}^d c_i * abs(x_i - w_i) )
%
% TYPE = 'discontinuous' | TYPE = 6:
% f(x) = { 0 , if x_1>w_1 or x_2>w_2,
% { exp( sum_{i=1}^d c_i * x_i ) , otherwise
%
% With the parameters c = (c_1, ..., c_d) and w = (w_1, ..., w_d).
% d denotes the dimension of the function.
%
% Examples:
% testfunctions(0.5, 0.5, 'product peak', [2, 5.25], [0.2, 0.7])
% testfunctions(0.5, 0.5, 2, [2, 5.25], [0.2, 0.7])
%
% x = linspace(0,1,20);
% [X,Y] = meshgrid(x,x);
% surf(X,Y, ...
% testfunctions(X, Y, 'product peak', [2, 5.25], [0.2 0.7]));
% Author : Andreas Klimke, Universitaet Stuttgart
% Version: 1.0
% Date : August 2, 2003
% ------------------------------------------------------------
% Sparse Grid Interpolation Toolbox
% Copyright (c) 2006 W. Andreas Klimke, Universitaet Stuttgart
% Copyright (c) 2007-2008 W. A. Klimke. All Rights Reserved.
% See LICENSE.txt for license.
% email: [email protected]
% web : http://www.ians.uni-stuttgart.de/spinterp
% ------------------------------------------------------------
type = varargin{end-2};
c = varargin{end-1};
w = varargin{end};
if isa(type, 'char')
fnames = {'oscillatory', 'product peak', 'corner peak', 'gaussian', ...
'continuous', 'discontinuous'};
for k = 1:length(fnames)
if strcmp(fnames{k},type)
type = k;
break
end
end
end
d = length(c);
switch type
case 1 % oscillatory
temp = 2*pi*w(1);
for i = 1:d
temp = temp + c(i).*varargin{i};
end
y = cos(temp);
case 2 % product peak
temp = 1;
for i = 1:d
temp = temp .* (c(i)^(-2)+(varargin{i}-w(i)).^2);
end
y = 1./temp;
case 3 % corner peak
temp = 1;
for i = 1:d
temp = temp + c(i).*varargin{i};
end
y = temp .^ (-(d+1));
case 4 % gaussian
temp = 0;
for i = 1:d
temp = temp + c(i)^2 .* (varargin{i} - w(i)).^2;
end
y = exp(-temp);
case 5 % continuous
temp = 0;
for i = 1:d
temp = temp + c(i) .* abs(varargin{i} - w(i));
end
y = exp(-temp);
case 6 % discontinuous
temp = 0;
if d >= 2
mask = varargin{1} > w(1) | varargin{2} > w(2);
else
mask = varargin{1} > w(1);
end
for i = 1:d
temp = temp + (c(i) .* varargin{i});
end
y = exp(temp) .* (~mask);
end
|
library(cummeRbund)
args <- commandArgs(trailingOnly=TRUE)
error_file <- file(args[1], open="wt")
sink(error_file, type="message")
cuff <- readCufflinks() |
module Cast
%default total
{-
interface Cast from to where
caset : (orig : from) -> to
-}
Cast (Maybe elem) (List elem) where
cast Nothing = []
cast (Just x) = [x]
foo : List Integer
foo = cast (Just 100)
bar : List Integer
bar = cast (the (Maybe Integer) Nothing)
Cast (List elem) (Maybe elem) where
cast [] = Nothing
cast (x :: xs) = Just x
baz : Maybe Int
baz = cast (the (List Int) [99])
quux : Maybe Int
quux = cast (the (List Int) [])
-- there is nothing special about the Cast interface. We can define our own version
interface Mould from to where
mould : (oig : from) -> to
Mould (Maybe elem) (List elem) where
mould Nothing = []
mould (Just x) = [x]
foofoo : List String
foofoo = mould (the (Maybe String) (Just "Hello"))
barbar : List String
barbar = mould (the (Maybe String) Nothing)
Mould (List elem) (Maybe elem) where
mould [] = Nothing
mould (x :: xs) = Just x
bazbaz : Maybe String
bazbaz = mould (the (List String) ["world"])
quuxquux : Maybe String
quuxquux = mould (the (List String) []) |
[GOAL]
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X Y : C
f g : X ⟶ Y
w : f = g
Z : C
h : Y ⟶ Z
⊢ f ≫ h = g ≫ h
[PROOFSTEP]
rw [w]
|
State Before: R : Type u_1
A : Type u_3
B : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : Algebra R B
inst✝¹ : Algebra A B
inst✝ : IsIntegralClosure A R B
h : optParam (IsIntegral R 1) (_ : IsIntegral R 1)
⊢ ↑(algebraMap A B) (mk' A 1 h) = ↑(algebraMap A B) 1 State After: no goals Tactic: rw [algebraMap_mk', RingHom.map_one] |
-- ----------------------------------------------------------------------
-- The Agda Descriptor Library
--
-- Natural transformations on indexed families (predicates)
-- ----------------------------------------------------------------------
module Relation.Unary.Predicate.Transformation where
open import Data.Empty.Polymorphic using (⊥)
open import Data.Product using (_×_)
open import Data.Sum using (_⊎_; inj₁; inj₂)
open import Data.Unit.Polymorphic using (⊤)
open import Function using (_∘_)
open import Level using (Level; _⊔_; 0ℓ)
open import Relation.Unary
private
variable
a b c d ℓ₁ ℓ₂ ℓ₃ ℓ₄ : Level
A : Set a
B : Set b
C : Set c
D : Set d
-- ----------------------------------------------------------------------
-- Definition
-- A predicate transformation is a morphism between 2 predicates
-- indexed by A and B (w/ levels ℓ₁ ℓ₂ for universe polymorphism)
infixr 0 _▷_ _►_
_▷_ : Set a → Set b → (ℓ₁ ℓ₂ : Level) → Set _
(A ▷ B) ℓ₁ ℓ₂ = Pred A ℓ₁ → Pred B ℓ₂
_►_ : Set a → Set b → Set _
(A ► B) = Pred A 0ℓ → Pred B 0ℓ
-- ----------------------------------------------------------------------
-- Composition and Identity
id : (A ▷ A) ℓ₁ ℓ₁
id = Function.id
_○_ : (B ▷ C) ℓ₂ ℓ₃ → (A ▷ B) ℓ₁ ℓ₂ → (A ▷ C) ℓ₁ _
X ○ Y = X ∘ Y
-- TODO: Cateogrical view
-- ----------------------------------------------------------------------
-- Special transformations
empty : (A ▷ B) ℓ₁ ℓ₂
empty = λ _ _ → ⊥
univ : (A ▷ B) ℓ₁ ℓ₂
univ = λ _ _ → ⊤
-- ----------------------------------------------------------------------
-- Operations on transformations
infixr 8 _⇉_
infixl 7 _⋏_
infixl 6 _⋎_
-- Negation
∼ : (A ▷ B) ℓ₁ ℓ₂ → (A ▷ B) ℓ₁ ℓ₂
∼ X = ∁ ∘ X
-- Implication
_⇉_ : (A ▷ B) ℓ₁ ℓ₂ → (A ▷ B) ℓ₁ ℓ₂ → (A ▷ B) ℓ₁ ℓ₂
X ⇉ Y = λ P → X P ⇒ Y P
-- Intersection
_⋏_ : (A ▷ B) ℓ₁ ℓ₂ → (A ▷ B) ℓ₁ ℓ₂ → (A ▷ B) ℓ₁ ℓ₂
X ⋏ Y = λ P → X P ∩ Y P
-- Union
_⋎_ : (A ▷ B) ℓ₁ ℓ₂ → (A ▷ B) ℓ₁ ℓ₂ → (A ▷ B) ℓ₁ ℓ₂
X ⋎ Y = λ P → X P ∪ Y P
-- TODO: Infinitary union + intersection
-- ----------------------------------------------------------------------
-- Combinators on transformations
-- Disjoint sum
_∣∣_ : (A ▷ C) ℓ₁ ℓ₂ → (B ▷ D) ℓ₁ ℓ₂ → (A ⊎ B ▷ C ⊎ D) ℓ₁ ℓ₂
(X ∣∣ Y) P (inj₁ x) = X (P ∘ inj₁) x
(X ∣∣ Y) P (inj₂ y) = Y (P ∘ inj₂) y
-- TODO: Product, etc
|
import os
import sys
import os.path as op
import argparse
import numpy as np
import pandas as pd
from scipy import ndimage
from scipy.stats import zscore
import nibabel as nib
import subprocess as sp
from sklearn.linear_model import LogisticRegression
from sklearn.cross_validation import LeaveOneLabelOut
from nilearn.decoding import SearchLight
import lyman
project = lyman.gather_project_info()
data_dir = project["data_dir"]
analysis_dir = project["analysis_dir"]
def main(arglist):
args = parse_args(arglist)
if args.subjects is None:
args.subjects = lyman.determine_subjects()
for subj in args.subjects:
print "Running subject", subj
searchlight_dir = op.join(analysis_dir, "dksort", subj,
"mvpa/searchlight")
if not op.exists(searchlight_dir):
os.mkdir(searchlight_dir)
vol_fname = op.join(searchlight_dir, "dimension_dksort_pfc.nii.gz")
if "fit" in args.do and (not op.exists(vol_fname) or args.overwrite):
print " Doing searchlight"
mask_img, X, y, runs = load_data(subj)
s = SearchLight(mask_img, radius=10, n_jobs=10,
estimator=LogisticRegression(),
cv=LeaveOneLabelOut(runs))
s.fit(X, y)
out_img = nib.Nifti1Image(s.scores_, s.mask_img.get_affine())
out_img.to_filename(vol_fname)
surf_fnames = [op.join(searchlight_dir, "lh.dimension_dksort_pfc.mgz"),
op.join(searchlight_dir, "rh.dimension_dksort_pfc.mgz")]
if "surf" in args.do and (not all(map(op.exists, surf_fnames))
or args.overwrite):
print " Doing surfreg"
reg_fname = op.join(analysis_dir, "dksort", subj,
"preproc/run_1/func2anat_tkreg.dat")
for i, hemi in enumerate(["lh", "rh"]):
cmdline = ["mri_vol2surf",
"--mov", vol_fname,
"--reg", reg_fname,
"--trgsubject", "fsaverage",
"--projfrac-avg", "0", "1", ".1",
"--surf-fwhm", "5",
"--hemi", hemi,
"--o", surf_fnames[i]]
sp.check_output(" ".join(cmdline), shell=True)
def load_data(subj):
design = pd.read_csv(op.join(data_dir, subj, "design/dimension.csv"))
mask_img = nib.load(op.join(data_dir, subj, "masks/dksort_all_pfc.nii.gz"))
mean_img = nib.load(op.join(analysis_dir, "dksort", subj,
"preproc/run_1/mean_func.nii.gz"))
orig_mask_data = mask_img.get_data()
mask_data = ndimage.binary_dilation(orig_mask_data, iterations=2)
mask_img = nib.Nifti1Image(mask_data.astype(int),
mask_img.get_affine(),
mask_img.get_header())
mask_img.to_filename(op.join(analysis_dir, "dksort", subj,
"mvpa/searchlight/dksort_pfc_mask.nii.gz"))
X_data = []
for run in range(1, 5):
ts_img = nib.load(op.join(analysis_dir, "dksort", subj, "reg/epi",
"unsmoothed/run_%d" % run, "timeseries_xfm.nii.gz"))
ts_data = ts_img.get_data()
onsets = design.loc[design.run == run, "onset"].values
indices = np.round(onsets / 2).astype(int)
frame1 = ts_data[..., indices + 2]
frame2 = ts_data[..., indices + 3]
X_run = np.mean([frame1, frame2], axis=0)
X_run = zscore(X_run, axis=-1)
X_data.append(X_run)
X = nib.Nifti1Image(np.concatenate(X_data, axis=-1),
mean_img.get_affine(), mean_img.get_header())
y = design["condition"].values
runs = design["run"].values
return mask_img, X, y, runs
def parse_args(arglist):
parser = argparse.ArgumentParser()
parser.add_argument("-subjects", nargs="*")
parser.add_argument("-do", nargs="*", default=[])
parser.add_argument("-overwrite", action="store_true")
args = parser.parse_args(arglist)
return args
if __name__ == "__main__":
main(sys.argv[1:])
|
# Run vic for all watersheds and resolutions
using IcanProj
opt = get_options()
path_sim = opt["target_folder"]
watersheds = opt["stat_sel"]
resolutions = opt["resolutions"]
for watershed in watersheds
resolutions = ["1km", "5km", "10km", "25km", "50km"]
for resolution in resolutions
info("Running vic for $(watershed) at $(resolution) resolution")
run(`/felles/jmg/VIC.4.2.d/src/./vicNl -g $(joinpath(path_sim, watershed, resolution, "params/global_param"))`)
end
end
|
“Do you really think you’re perfect?” The preacher asked.
Some people act like they’re perfect. Or our faulty memory thinks our loved ones are or were perfect.
I recently read a facebook post by a friend who was told by a fellow Christian that he rarely sinned. He opined that he was not a sinner, but a saint. Actually, as my friend observed we can be both sinners and saints at the same time. Saints can and do sin.
As Christians we are not perfect, but we are pardoned. We’re not sinless, but we’re sanctified. We’re not faultless, but we’re forgiven. We learn that our failures don’t have to be final or fatal.
I might be well to remember that some of God’s greatest heroes failed. Some miserably.
Yet, they didn’t quit. They didn’t allow failure to define them, discourage them or defeat them. Their failures were forgiven. And they pressed on toward the prize. That’s what we must do.
We must be willing to admit our failures. Confess our shortcomings. And repent of our sins. We are a work in progress. Ever striving to be conformed to Christ instead of our culture (Rom. 8:29; 12:1-2).
The late and legendary basketball coach John Wooden reminds us, “Failure isn’t fatal, but failure to change might be.” Or as the great British statesman, Winston Churchill observed, “Success is not final, failure is not fatal: it is the courage to continue that counts.” The Christian life is about change. Growth. And persistence.
Like the apostle Peter, we can begin again. We can put together the broken pieces. Refocus our eyes on Jesus. And even with our past flaws be restored to faithful service. Let us pray as David did: “Restore to me the joy of your salvation, and uphold me with a willing spirit” (Ps 51:12).
There is hope. There is help. There is healing.
There is a forgiving and gracious God.
Ken, thanks for this. I’m sure I needed it more than anyone else this morning…. |
State Before: l : Type ?u.1220689
m : Type u_2
n : Type u_1
o : Type ?u.1220698
m' : o → Type ?u.1220703
n' : o → Type ?u.1220708
R : Type ?u.1220711
S : Type ?u.1220714
α : Type v
β : Type w
γ : Type ?u.1220721
M : Matrix m n α
i : m
j : n
b : n → α
c : m → α
inst✝ : DecidableEq n
j' : n
⊢ updateColumn M j c i j' = if j' = j then c i else M i j' State After: case pos
l : Type ?u.1220689
m : Type u_2
n : Type u_1
o : Type ?u.1220698
m' : o → Type ?u.1220703
n' : o → Type ?u.1220708
R : Type ?u.1220711
S : Type ?u.1220714
α : Type v
β : Type w
γ : Type ?u.1220721
M : Matrix m n α
i : m
j : n
b : n → α
c : m → α
inst✝ : DecidableEq n
j' : n
h : j' = j
⊢ updateColumn M j c i j' = if j' = j then c i else M i j'
case neg
l : Type ?u.1220689
m : Type u_2
n : Type u_1
o : Type ?u.1220698
m' : o → Type ?u.1220703
n' : o → Type ?u.1220708
R : Type ?u.1220711
S : Type ?u.1220714
α : Type v
β : Type w
γ : Type ?u.1220721
M : Matrix m n α
i : m
j : n
b : n → α
c : m → α
inst✝ : DecidableEq n
j' : n
h : ¬j' = j
⊢ updateColumn M j c i j' = if j' = j then c i else M i j' Tactic: by_cases j' = j State Before: case pos
l : Type ?u.1220689
m : Type u_2
n : Type u_1
o : Type ?u.1220698
m' : o → Type ?u.1220703
n' : o → Type ?u.1220708
R : Type ?u.1220711
S : Type ?u.1220714
α : Type v
β : Type w
γ : Type ?u.1220721
M : Matrix m n α
i : m
j : n
b : n → α
c : m → α
inst✝ : DecidableEq n
j' : n
h : j' = j
⊢ updateColumn M j c i j' = if j' = j then c i else M i j' State After: no goals Tactic: rw [h, updateColumn_self, if_pos rfl] State Before: case neg
l : Type ?u.1220689
m : Type u_2
n : Type u_1
o : Type ?u.1220698
m' : o → Type ?u.1220703
n' : o → Type ?u.1220708
R : Type ?u.1220711
S : Type ?u.1220714
α : Type v
β : Type w
γ : Type ?u.1220721
M : Matrix m n α
i : m
j : n
b : n → α
c : m → α
inst✝ : DecidableEq n
j' : n
h : ¬j' = j
⊢ updateColumn M j c i j' = if j' = j then c i else M i j' State After: no goals Tactic: rw [updateColumn_ne h, if_neg h] |
If $f$ is a function from the natural numbers to the measurable sets of a measure space, then the measure of the union of the sets in the range of $f$ is less than or equal to the sum of the measures of the sets in the range of $f$. |
[STATEMENT]
lemma poly_compat: "\<lbrakk>p1 \<ge>p p2; p2 >p p3\<rbrakk> \<Longrightarrow> p1 >p p3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>p1 \<ge>p p2; p2 >p p3\<rbrakk> \<Longrightarrow> p1 >p p3
[PROOF STEP]
unfolding poly_ge_def poly_gt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>\<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p2 \<le> eval_poly \<alpha> p1; \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p2 \<succ> eval_poly \<alpha> p3\<rbrakk> \<Longrightarrow> \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p1 \<succ> eval_poly \<alpha> p3
[PROOF STEP]
using compat
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<le> ?x; ?y \<succ> ?z\<rbrakk> \<Longrightarrow> ?x \<succ> ?z
goal (1 subgoal):
1. \<lbrakk>\<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p2 \<le> eval_poly \<alpha> p1; \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p2 \<succ> eval_poly \<alpha> p3\<rbrakk> \<Longrightarrow> \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p1 \<succ> eval_poly \<alpha> p3
[PROOF STEP]
by blast |
(* Title: HOL/Auth/n_germanSimp_lemma_on_inv__6.thy
Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
*)
header{*The n_germanSimp Protocol Case Study*}
theory n_germanSimp_lemma_on_inv__6 imports n_germanSimp_base
begin
section{*All lemmas on causal relation between inv__6 and some rule r*}
lemma n_SendInv__part__0Vsinv__6:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInv__part__0 i)" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInv__part__0 i" apply fastforce done
from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv3)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendInv__part__1Vsinv__6:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInv__part__1 i)" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInv__part__1 i" apply fastforce done
from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv3)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendInvAckVsinv__6:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInvAck i)" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInvAck i" apply fastforce done
from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv3)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendGntSVsinv__6:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendGntS i)" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendGntS i" apply fastforce done
from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv3)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendGntEVsinv__6:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendGntE N i)" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendGntE N i" apply fastforce done
from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv3)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (neg (eqn (IVar (Field (Para (Ident ''Cache'') p__Inv4) ''State'')) (Const I))) (eqn (IVar (Para (Ident ''ShrSet'') p__Inv4)) (Const false))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_RecvGntSVsinv__6:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvGntS i)" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvGntS i" apply fastforce done
from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv4) ''Cmd'')) (Const GntS)) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv3) ''Cmd'')) (Const GntE))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv3)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_RecvGntEVsinv__6:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvGntE i)" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvGntE i" apply fastforce done
from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv3) ''Cmd'')) (Const GntE)) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv4) ''Cmd'')) (Const GntE))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i=p__Inv3)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_StoreVsinv__6:
assumes a1: "\<exists> i d. i\<le>N\<and>d\<le>N\<and>r=n_Store i d" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_RecvInvAckVsinv__6:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvInvAck i" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_RecvReqE__part__0Vsinv__6:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvReqE__part__0 N i" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_RecvReqE__part__1Vsinv__6:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvReqE__part__1 N i" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_RecvReqSVsinv__6:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvReqS N i" and
a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__6 p__Inv3 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
end
|
FUNCTION:NAME
mmap:entry
-- @@stderr --
dtrace: script 'test/unittest/syscall/tst.entry.d' matched NNN probes
|
If $f$ is analytic on $S$, then $-f$ is analytic on $S$. |
module CIFAR
# package code goes here
export traindata,
testdata
include("get.jl")
include("load.jl")
end # module
|
> module SequentialDecisionProblems.StochasticDefaults
> -- import Data.List
> -- import Data.List.Quantifiers
> import SequentialDecisionProblems.CoreTheory
> import SequentialDecisionProblems.Utils
> import SimpleProb.SimpleProb
> import SimpleProb.MonadicOperations
> import SimpleProb.MonadicProperties
> -- import List.Operations
> -- import List.Properties
> %default total
> %auto_implicits off
In stochastic SDPs, |M = SimpleProb|:
> SequentialDecisionProblems.CoreTheory.M =
> SimpleProb
Thus, |M| is a functor:
> SequentialDecisionProblems.CoreTheory.fmap =
> SimpleProb.MonadicOperations.fmap
, |M| is a monad:
> SequentialDecisionProblems.Utils.ret =
> SimpleProb.MonadicOperations.ret
> SequentialDecisionProblems.Utils.bind =
> SimpleProb.MonadicOperations.bind
Moreover, |M| is a container monad
> SequentialDecisionProblems.CoreTheory.Elem =
> SimpleProb.MonadicOperations.Elem
> SequentialDecisionProblems.CoreTheory.NotEmpty =
> SimpleProb.MonadicOperations.NonEmpty
> SequentialDecisionProblems.CoreTheory.All =
> SimpleProb.MonadicOperations.All
> SequentialDecisionProblems.CoreTheory.elemNotEmptySpec0 =
> SimpleProb.MonadicProperties.elemNonEmptySpec0
> SequentialDecisionProblems.CoreTheory.elemNotEmptySpec1 =
> SimpleProb.MonadicProperties.elemNonEmptySpec1
> SequentialDecisionProblems.CoreTheory.tagElem =
> SimpleProb.MonadicOperations.tagElem
> SequentialDecisionProblems.CoreTheory.allElemSpec0 =
> SimpleProb.MonadicProperties.containerMonadSpec3
and |All| and |NotEmpty| are finite and decidable:
> SequentialDecisionProblems.Utils.finiteAll =
> SimpleProb.MonadicProperties.finiteAll
> SequentialDecisionProblems.Utils.finiteNotEmpty =
> SimpleProb.MonadicProperties.finiteNonEmpty
> SequentialDecisionProblems.Utils.decidableAll =
> SimpleProb.MonadicProperties.decidableAll
> SequentialDecisionProblems.Utils.decidableNotEmpty =
> SimpleProb.MonadicProperties.decidableNonEmpty
> {-
> ---}
|
[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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
⊢ IsOpen (A f L r ε)
[PROOFSTEP]
rw [Metric.isOpen_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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
⊢ ∀ (x : E), x ∈ A f L r ε → ∃ ε_1, ε_1 > 0 ∧ ball x ε_1 ⊆ A f L r ε
[PROOFSTEP]
rintro x ⟨r', r'_mem, hr'⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
x : E
r' : ℝ
r'_mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
⊢ ∃ ε_1, ε_1 > 0 ∧ ball x ε_1 ⊆ A f L r ε
[PROOFSTEP]
obtain ⟨s, s_gt, s_lt⟩ : ∃ s : ℝ, r / 2 < s ∧ s < r' := exists_between r'_mem.1
[GOAL]
case intro.intro.intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
x : E
r' : ℝ
r'_mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
⊢ ∃ ε_1, ε_1 > 0 ∧ ball x ε_1 ⊆ A f L r ε
[PROOFSTEP]
have : s ∈ Ioc (r / 2) r := ⟨s_gt, le_of_lt (s_lt.trans_le r'_mem.2)⟩
[GOAL]
case intro.intro.intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
x : E
r' : ℝ
r'_mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
⊢ ∃ ε_1, ε_1 > 0 ∧ ball x ε_1 ⊆ A f L r ε
[PROOFSTEP]
refine' ⟨r' - s, by linarith, fun x' hx' => ⟨s, this, _⟩⟩
[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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
x : E
r' : ℝ
r'_mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
⊢ r' - s > 0
[PROOFSTEP]
linarith
[GOAL]
case intro.intro.intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
x : E
r' : ℝ
r'_mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
x' : E
hx' : x' ∈ ball x (r' - s)
⊢ ∀ (y : E), y ∈ ball x' s → ∀ (z : E), z ∈ ball x' s → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
[PROOFSTEP]
have B : ball x' s ⊆ ball x r' := ball_subset (le_of_lt hx')
[GOAL]
case intro.intro.intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
x : E
r' : ℝ
r'_mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
x' : E
hx' : x' ∈ ball x (r' - s)
B : ball x' s ⊆ ball x r'
⊢ ∀ (y : E), y ∈ ball x' s → ∀ (z : E), z ∈ ball x' s → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
[PROOFSTEP]
intro y hy z hz
[GOAL]
case intro.intro.intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε : ℝ
x : E
r' : ℝ
r'_mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
x' : E
hx' : x' ∈ ball x (r' - s)
B : ball x' s ⊆ ball x r'
y : E
hy : y ∈ ball x' s
z : E
hz : z ∈ ball x' s
⊢ ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
[PROOFSTEP]
exact hr' y (B hy) z (B hz)
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
r s ε : ℝ
⊢ IsOpen (B f K r s ε)
[PROOFSTEP]
simp only [B]
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
r s ε : ℝ
⊢ IsOpen (⋃ (L : E →L[𝕜] F) (_ : L ∈ K), A f L r ε ∩ A f L s ε)
[PROOFSTEP]
exact isOpen_iUnion fun _ => isOpen_iUnion fun _ => (isOpen_a _ _ _).inter (isOpen_a _ _ _)
[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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε δ : ℝ
h : ε ≤ δ
⊢ A f L r ε ⊆ A f L r δ
[PROOFSTEP]
rintro x ⟨r', r'r, hr'⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε δ : ℝ
h : ε ≤ δ
x : E
r' : ℝ
r'r : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
⊢ x ∈ A f L r δ
[PROOFSTEP]
refine' ⟨r', r'r, fun y hy z hz => (hr' y hy z hz).trans (mul_le_mul_of_nonneg_right h _)⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
L : E →L[𝕜] F
r ε δ : ℝ
h : ε ≤ δ
x : E
r' : ℝ
r'r : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
y : E
hy : y ∈ ball x r'
z : E
hz : z ∈ ball x r'
⊢ 0 ≤ r
[PROOFSTEP]
linarith [mem_ball.1 hy, r'r.2, @dist_nonneg _ _ y x]
[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
f : E → F
K : Set (E →L[𝕜] F)
r ε : ℝ
L : E →L[𝕜] F
x : E
hx : x ∈ A f L r ε
y z : E
hy : y ∈ closedBall x (r / 2)
hz : z ∈ closedBall x (r / 2)
⊢ ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
[PROOFSTEP]
rcases hx with ⟨r', r'mem, hr'⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
r ε : ℝ
L : E →L[𝕜] F
x y z : E
hy : y ∈ closedBall x (r / 2)
hz : z ∈ closedBall x (r / 2)
r' : ℝ
r'mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : E), y ∈ ball x r' → ∀ (z : E), z ∈ ball x r' → ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
⊢ ‖f z - f y - ↑L (z - y)‖ ≤ ε * r
[PROOFSTEP]
exact hr' _ ((mem_closedBall.1 hy).trans_lt r'mem.1) _ ((mem_closedBall.1 hz).trans_lt r'mem.1)
[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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
⊢ ∃ R, R > 0 ∧ ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ε
[PROOFSTEP]
have := hx.hasFDerivAt
[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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this : HasFDerivAt f (fderiv 𝕜 f x) x
⊢ ∃ R, R > 0 ∧ ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ε
[PROOFSTEP]
simp only [HasFDerivAt, HasFDerivAtFilter, isLittleO_iff] at this
[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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
⊢ ∃ R, R > 0 ∧ ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ε
[PROOFSTEP]
rcases eventually_nhds_iff_ball.1 (this (half_pos hε)) with ⟨R, R_pos, hR⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
⊢ ∃ R, R > 0 ∧ ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ε
[PROOFSTEP]
refine' ⟨R, R_pos, fun r hr => _⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
⊢ x ∈ A f (fderiv 𝕜 f x) r ε
[PROOFSTEP]
have : r ∈ Ioc (r / 2) r := ⟨half_lt_self hr.1, le_rfl⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
⊢ x ∈ A f (fderiv 𝕜 f x) r ε
[PROOFSTEP]
refine' ⟨r, this, fun y hy z hz => _⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
y : E
hy : y ∈ ball x r
z : E
hz : z ∈ ball x r
⊢ ‖f z - f y - ↑(fderiv 𝕜 f x) (z - y)‖ ≤ ε * r
[PROOFSTEP]
calc
‖f z - f y - (fderiv 𝕜 f x) (z - y)‖ = ‖f z - f x - (fderiv 𝕜 f x) (z - x) - (f y - f x - (fderiv 𝕜 f x) (y - x))‖ :=
by congr 1; simp only [ContinuousLinearMap.map_sub]; abel
_ ≤ ‖f z - f x - (fderiv 𝕜 f x) (z - x)‖ + ‖f y - f x - (fderiv 𝕜 f x) (y - x)‖ := (norm_sub_le _ _)
_ ≤ ε / 2 * ‖z - x‖ + ε / 2 * ‖y - x‖ :=
(add_le_add (hR _ (lt_trans (mem_ball.1 hz) hr.2)) (hR _ (lt_trans (mem_ball.1 hy) hr.2)))
_ ≤ ε / 2 * r + ε / 2 * r := by rw [mem_ball_iff_norm] at hz hy ; gcongr
_ = ε * r := by ring
[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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
y : E
hy : y ∈ ball x r
z : E
hz : z ∈ ball x r
⊢ ‖f z - f y - ↑(fderiv 𝕜 f x) (z - y)‖ = ‖f z - f x - ↑(fderiv 𝕜 f x) (z - x) - (f y - f x - ↑(fderiv 𝕜 f x) (y - x))‖
[PROOFSTEP]
congr 1
[GOAL]
case e_a
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
y : E
hy : y ∈ ball x r
z : E
hz : z ∈ ball x r
⊢ f z - f y - ↑(fderiv 𝕜 f x) (z - y) = f z - f x - ↑(fderiv 𝕜 f x) (z - x) - (f y - f x - ↑(fderiv 𝕜 f x) (y - x))
[PROOFSTEP]
simp only [ContinuousLinearMap.map_sub]
[GOAL]
case e_a
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
y : E
hy : y ∈ ball x r
z : E
hz : z ∈ ball x r
⊢ f z - f y - (↑(fderiv 𝕜 f x) z - ↑(fderiv 𝕜 f x) y) =
f z - f x - (↑(fderiv 𝕜 f x) z - ↑(fderiv 𝕜 f x) x) - (f y - f x - (↑(fderiv 𝕜 f x) y - ↑(fderiv 𝕜 f x) x))
[PROOFSTEP]
abel
[GOAL]
case e_a
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
y : E
hy : y ∈ ball x r
z : E
hz : z ∈ ball x r
⊢ f z - f y - (↑(fderiv 𝕜 f x) z - ↑(fderiv 𝕜 f x) y) =
f z - f x - (↑(fderiv 𝕜 f x) z - ↑(fderiv 𝕜 f x) x) - (f y - f x - (↑(fderiv 𝕜 f x) y - ↑(fderiv 𝕜 f x) 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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
y : E
hy : y ∈ ball x r
z : E
hz : z ∈ ball x r
⊢ ε / 2 * ‖z - x‖ + ε / 2 * ‖y - x‖ ≤ ε / 2 * r + ε / 2 * r
[PROOFSTEP]
rw [mem_ball_iff_norm] at hz hy
[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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
y : E
hy : ‖y - x‖ < r
z : E
hz : ‖z - x‖ < r
⊢ ε / 2 * ‖z - x‖ + ε / 2 * ‖y - x‖ ≤ ε / 2 * r + ε / 2 * r
[PROOFSTEP]
gcongr
[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
f : E → F
K : Set (E →L[𝕜] F)
ε : ℝ
hε : 0 < ε
x : E
hx : DifferentiableAt 𝕜 f x
this✝ : ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 x, ‖f x_1 - f x - ↑(fderiv 𝕜 f x) (x_1 - x)‖ ≤ c * ‖x_1 - x‖
R : ℝ
R_pos : R > 0
hR : ∀ (y : E), y ∈ ball x R → ‖f y - f x - ↑(fderiv 𝕜 f x) (y - x)‖ ≤ ε / 2 * ‖y - x‖
r : ℝ
hr : r ∈ Ioo 0 R
this : r ∈ Ioc (r / 2) r
y : E
hy : y ∈ ball x r
z : E
hz : z ∈ ball x r
⊢ ε / 2 * r + ε / 2 * r = ε * r
[PROOFSTEP]
ring
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ ‖L₁ - L₂‖ ≤ 4 * ‖c‖ * ε
[PROOFSTEP]
have : 0 ≤ 4 * ‖c‖ * ε := mul_nonneg (mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) (norm_nonneg _)) hε.le
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ 0 ≤ 4
[PROOFSTEP]
norm_num
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
⊢ ‖L₁ - L₂‖ ≤ 4 * ‖c‖ * ε
[PROOFSTEP]
refine' op_norm_le_of_shell (half_pos hr) this hc _
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
⊢ ∀ (x : E), r / 2 / ‖c‖ ≤ ‖x‖ → ‖x‖ < r / 2 → ‖↑(L₁ - L₂) x‖ ≤ 4 * ‖c‖ * ε * ‖x‖
[PROOFSTEP]
intro y ley ylt
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r / 2 / ‖c‖ ≤ ‖y‖
ylt : ‖y‖ < r / 2
⊢ ‖↑(L₁ - L₂) y‖ ≤ 4 * ‖c‖ * ε * ‖y‖
[PROOFSTEP]
rw [div_div, div_le_iff' (mul_pos (by norm_num : (0 : ℝ) < 2) (zero_lt_one.trans hc))] at ley
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r / (2 * ‖c‖) ≤ ‖y‖
ylt : ‖y‖ < r / 2
⊢ 0 < 2
[PROOFSTEP]
norm_num
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ ‖↑(L₁ - L₂) y‖ ≤ 4 * ‖c‖ * ε * ‖y‖
[PROOFSTEP]
calc
‖(L₁ - L₂) y‖ = ‖f (x + y) - f x - L₂ (x + y - x) - (f (x + y) - f x - L₁ (x + y - x))‖ := by simp
_ ≤ ‖f (x + y) - f x - L₂ (x + y - x)‖ + ‖f (x + y) - f x - L₁ (x + y - x)‖ := (norm_sub_le _ _)
_ ≤ ε * r + ε * r := by
apply add_le_add
· apply le_of_mem_a h₂
· simp only [le_of_lt (half_pos hr), mem_closedBall, dist_self]
· simp only [dist_eq_norm, add_sub_cancel', mem_closedBall, ylt.le]
· apply le_of_mem_a h₁
· simp only [le_of_lt (half_pos hr), mem_closedBall, dist_self]
· simp only [dist_eq_norm, add_sub_cancel', mem_closedBall, ylt.le]
_ = 2 * ε * r := by ring
_ ≤ 2 * ε * (2 * ‖c‖ * ‖y‖) := (mul_le_mul_of_nonneg_left ley (mul_nonneg (by norm_num) hε.le))
_ = 4 * ‖c‖ * ε * ‖y‖ := by ring
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ ‖↑(L₁ - L₂) y‖ = ‖f (x + y) - f x - ↑L₂ (x + y - x) - (f (x + y) - f x - ↑L₁ (x + y - x))‖
[PROOFSTEP]
simp
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ ‖f (x + y) - f x - ↑L₂ (x + y - x)‖ + ‖f (x + y) - f x - ↑L₁ (x + y - x)‖ ≤ ε * r + ε * r
[PROOFSTEP]
apply add_le_add
[GOAL]
case 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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ ‖f (x + y) - f x - ↑L₂ (x + y - x)‖ ≤ ε * r
[PROOFSTEP]
apply le_of_mem_a h₂
[GOAL]
case h₁.hy
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ x ∈ closedBall x (r / 2)
[PROOFSTEP]
simp only [le_of_lt (half_pos hr), mem_closedBall, dist_self]
[GOAL]
case h₁.hz
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ x + y ∈ closedBall x (r / 2)
[PROOFSTEP]
simp only [dist_eq_norm, add_sub_cancel', mem_closedBall, ylt.le]
[GOAL]
case 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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ ‖f (x + y) - f x - ↑L₁ (x + y - x)‖ ≤ ε * r
[PROOFSTEP]
apply le_of_mem_a h₁
[GOAL]
case h₂.hy
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ x ∈ closedBall x (r / 2)
[PROOFSTEP]
simp only [le_of_lt (half_pos hr), mem_closedBall, dist_self]
[GOAL]
case h₂.hz
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ x + y ∈ closedBall x (r / 2)
[PROOFSTEP]
simp only [dist_eq_norm, add_sub_cancel', mem_closedBall, ylt.le]
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ ε * r + ε * r = 2 * ε * r
[PROOFSTEP]
ring
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ 0 ≤ 2
[PROOFSTEP]
norm_num
[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
f : E → F
K : Set (E →L[𝕜] F)
c : 𝕜
hc : 1 < ‖c‖
r ε : ℝ
hε : 0 < ε
hr : 0 < r
x : E
L₁ L₂ : E →L[𝕜] F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
this : 0 ≤ 4 * ‖c‖ * ε
y : E
ley : r ≤ 2 * ‖c‖ * ‖y‖
ylt : ‖y‖ < r / 2
⊢ 2 * ε * (2 * ‖c‖ * ‖y‖) = 4 * ‖c‖ * ε * ‖y‖
[PROOFSTEP]
ring
[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
f : E → F
K : Set (E →L[𝕜] F)
⊢ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K} ⊆ D f K
[PROOFSTEP]
intro x hx
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
⊢ x ∈ D f K
[PROOFSTEP]
rw [D, mem_iInter]
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
⊢ ∀ (i : ℕ), x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ i)
[PROOFSTEP]
intro e
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
⊢ x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
have : (0 : ℝ) < (1 / 2) ^ e := pow_pos (by norm_num) _
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
⊢ x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
rcases mem_a_of_differentiable this hx.1 with ⟨R, R_pos, hR⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
⊢ x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
obtain ⟨n, hn⟩ : ∃ n : ℕ, (1 / 2) ^ n < R := exists_pow_lt_of_lt_one R_pos (by norm_num : (1 : ℝ) / 2 < 1)
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case intro.intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
⊢ x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
simp only [mem_iUnion, mem_iInter, B, mem_inter_iff]
[GOAL]
case intro.intro.intro
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
⊢ ∃ i,
∀ (i_1 : ℕ),
i_1 ≥ i →
∀ (i_3 : ℕ), i_3 ≥ i → ∃ i h, x ∈ A f i ((1 / 2) ^ i_1) ((1 / 2) ^ e) ∧ x ∈ A f i ((1 / 2) ^ i_3) ((1 / 2) ^ e)
[PROOFSTEP]
refine' ⟨n, fun p hp q hq => ⟨fderiv 𝕜 f x, hx.2, ⟨_, _⟩⟩⟩
[GOAL]
case intro.intro.intro.refine'_1
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ x ∈ A f (fderiv 𝕜 f x) ((1 / 2) ^ p) ((1 / 2) ^ e)
[PROOFSTEP]
refine' hR _ ⟨pow_pos (by norm_num) _, lt_of_le_of_lt _ hn⟩
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
case intro.intro.intro.refine'_1
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ (1 / 2) ^ p ≤ (1 / 2) ^ n
[PROOFSTEP]
exact pow_le_pow_of_le_one (by norm_num) (by norm_num) (by assumption)
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 1 / 2 ≤ 1
[PROOFSTEP]
norm_num
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ n ≤ p
[PROOFSTEP]
assumption
[GOAL]
case intro.intro.intro.refine'_2
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ x ∈ A f (fderiv 𝕜 f x) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
refine' hR _ ⟨pow_pos (by norm_num) _, lt_of_le_of_lt _ hn⟩
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
case intro.intro.intro.refine'_2
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ (1 / 2) ^ q ≤ (1 / 2) ^ n
[PROOFSTEP]
exact pow_le_pow_of_le_one (by norm_num) (by norm_num) (by assumption)
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 1 / 2 ≤ 1
[PROOFSTEP]
norm_num
[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
f : E → F
K : Set (E →L[𝕜] F)
x : E
hx : x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (fderiv 𝕜 f x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ n ≤ q
[PROOFSTEP]
assumption
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
⊢ D f K ⊆ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
have P : ∀ {n : ℕ}, (0 : ℝ) < (1 / 2) ^ n := fun {n} => pow_pos (by norm_num) n
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
n : ℕ
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
⊢ D f K ⊆ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
⊢ D f K ⊆ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
have cpos : 0 < ‖c‖ := lt_trans zero_lt_one hc
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
⊢ D f K ⊆ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
intro x hx
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
have :
∀ e : ℕ,
∃ n : ℕ,
∀ p q, n ≤ p → n ≤ q → ∃ L ∈ K, x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e) :=
by
intro e
have := mem_iInter.1 hx e
rcases mem_iUnion.1 this with ⟨n, hn⟩
refine' ⟨n, fun p q hp hq => _⟩
simp only [mem_iInter, ge_iff_le] at hn
rcases mem_iUnion.1 (hn p hp q hq) with ⟨L, hL⟩
exact
⟨L, exists_prop.mp <| mem_iUnion.1 hL⟩
/- Recast the assumptions: for each `e`, there exist `n e` and linear maps `L e p q` in `K`
such that, for `p, q ≥ n e`, then `f` is well approximated by `L e p q` at scale `2 ^ (-p)` and
`2 ^ (-q)`, with an error `2 ^ (-e)`. -/
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
⊢ ∀ (e : ℕ),
∃ n,
∀ (p q : ℕ),
n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
intro e
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
e : ℕ
⊢ ∃ n,
∀ (p q : ℕ), n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
have := mem_iInter.1 hx e
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ ∃ n,
∀ (p q : ℕ), n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
rcases mem_iUnion.1 this with ⟨n, hn⟩
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
n : ℕ
hn : x ∈ ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ ∃ n,
∀ (p q : ℕ), n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
refine' ⟨n, fun p q hp hq => _⟩
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
n : ℕ
hn : x ∈ ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
p q : ℕ
hp : n ≤ p
hq : n ≤ q
⊢ ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
simp only [mem_iInter, ge_iff_le] at hn
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
n p q : ℕ
hp : n ≤ p
hq : n ≤ q
hn : ∀ (i : ℕ), n ≤ i → ∀ (i_2 : ℕ), n ≤ i_2 → x ∈ B f K ((1 / 2) ^ i) ((1 / 2) ^ i_2) ((1 / 2) ^ e)
⊢ ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
rcases mem_iUnion.1 (hn p hp q hq) with ⟨L, hL⟩
[GOAL]
case intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
n p q : ℕ
hp : n ≤ p
hq : n ≤ q
hn : ∀ (i : ℕ), n ≤ i → ∀ (i_2 : ℕ), n ≤ i_2 → x ∈ B f K ((1 / 2) ^ i) ((1 / 2) ^ i_2) ((1 / 2) ^ e)
L : E →L[𝕜] F
hL : x ∈ ⋃ (_ : L ∈ K), A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
exact
⟨L, exists_prop.mp <| mem_iUnion.1 hL⟩
/- Recast the assumptions: for each `e`, there exist `n e` and linear maps `L e p q` in `K`
such that, for `p, q ≥ n e`, then `f` is well approximated by `L e p q` at scale `2 ^ (-p)` and
`2 ^ (-q)`, with an error `2 ^ (-e)`. -/
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
this :
∀ (e : ℕ),
∃ n,
∀ (p q : ℕ),
n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
choose! n L hn using this
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
have M :
∀ e p q e' p' q',
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e :=
by
intro e p q e' p' q' hp hq hp' hq' he'
let r := max (n e) (n e')
have I : ((1 : ℝ) / 2) ^ e' ≤ (1 / 2) ^ e := pow_le_pow_of_le_one (by norm_num) (by norm_num) he'
have J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p q hp hq).2.1
have I2 : x ∈ A f (L e p r) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.1
exact norm_sub_le_of_mem_a hc P P I1 I2
have J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.2
have I2 : x ∈ A f (L e' p' r) ((1 / 2) ^ r) ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.2
exact norm_sub_le_of_mem_a hc P P I1 (a_mono _ _ I I2)
have J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.1
have I2 : x ∈ A f (L e' p' q') ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' q' hp' hq').2.1
exact norm_sub_le_of_mem_a hc P P (a_mono _ _ I I1) (a_mono _ _ I I2)
calc
‖L e p q - L e' p' q'‖ = ‖L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')‖ := by congr 1; abel
_ ≤ ‖L e p q - L e p r‖ + ‖L e p r - L e' p' r‖ + ‖L e' p' r - L e' p' q'‖ :=
(le_trans (norm_add_le _ _) (add_le_add_right (norm_add_le _ _) _))
_ ≤ 4 * ‖c‖ * (1 / 2) ^ e + 4 * ‖c‖ * (1 / 2) ^ e + 4 * ‖c‖ * (1 / 2) ^ e := (add_le_add (add_le_add J1 J2) J3)
_ = 12 * ‖c‖ * (1 / 2) ^ e := by
ring
/- For definiteness, use `L0 e = L e (n e) (n e)`, to have a single sequence. We claim that this
is a Cauchy sequence. -/
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ ∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
intro e p q e' p' q' hp hq hp' hq' he'
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
let r := max (n e) (n e')
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have I : ((1 : ℝ) / 2) ^ e' ≤ (1 / 2) ^ e := pow_le_pow_of_le_one (by norm_num) (by norm_num) he'
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
⊢ 1 / 2 ≤ 1
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p q hp hq).2.1
have I2 : x ∈ A f (L e p r) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.1
exact norm_sub_le_of_mem_a hc P P I1 I2
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
⊢ ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p q hp hq).2.1
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e)
⊢ ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have I2 : x ∈ A f (L e p r) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.1
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e)
I2 : x ∈ A f (L e p r) ((1 / 2) ^ p) ((1 / 2) ^ e)
⊢ ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
exact norm_sub_le_of_mem_a hc P P I1 I2
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.2
have I2 : x ∈ A f (L e' p' r) ((1 / 2) ^ r) ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.2
exact norm_sub_le_of_mem_a hc P P I1 (a_mono _ _ I I2)
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.2
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e)
⊢ ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have I2 : x ∈ A f (L e' p' r) ((1 / 2) ^ r) ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.2
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e)
I2 : x ∈ A f (L e' p' r) ((1 / 2) ^ r) ((1 / 2) ^ e')
⊢ ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
exact norm_sub_le_of_mem_a hc P P I1 (a_mono _ _ I I2)
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.1
have I2 : x ∈ A f (L e' p' q') ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' q' hp' hq').2.1
exact norm_sub_le_of_mem_a hc P P (a_mono _ _ I I1) (a_mono _ _ I I2)
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.1
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e')
⊢ ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
have I2 : x ∈ A f (L e' p' q') ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' q' hp' hq').2.1
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e')
I2 : x ∈ A f (L e' p' q') ((1 / 2) ^ p') ((1 / 2) ^ e')
⊢ ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
exact norm_sub_le_of_mem_a hc P P (a_mono _ _ I I1) (a_mono _ _ I I2)
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
calc
‖L e p q - L e' p' q'‖ = ‖L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')‖ := by congr 1; abel
_ ≤ ‖L e p q - L e p r‖ + ‖L e p r - L e' p' r‖ + ‖L e' p' r - L e' p' q'‖ :=
(le_trans (norm_add_le _ _) (add_le_add_right (norm_add_le _ _) _))
_ ≤ 4 * ‖c‖ * (1 / 2) ^ e + 4 * ‖c‖ * (1 / 2) ^ e + 4 * ‖c‖ * (1 / 2) ^ e := (add_le_add (add_le_add J1 J2) J3)
_ = 12 * ‖c‖ * (1 / 2) ^ e := by
ring
/- For definiteness, use `L0 e = L e (n e) (n e)`, to have a single sequence. We claim that this
is a Cauchy sequence. -/
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ = ‖L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')‖
[PROOFSTEP]
congr 1
[GOAL]
case e_a
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ L e p q - L e' p' q' = L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')
[PROOFSTEP]
abel
[GOAL]
case e_a
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ L e p q - L e' p' q' = L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * ‖c‖ * (1 / 2) ^ e
⊢ 4 * ‖c‖ * (1 / 2) ^ e + 4 * ‖c‖ * (1 / 2) ^ e + 4 * ‖c‖ * (1 / 2) ^ e = 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
ring
/- For definiteness, use `L0 e = L e (n e) (n e)`, to have a single sequence. We claim that this
is a Cauchy sequence. -/
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
let L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
have : CauchySeq L0 := by
rw [Metric.cauchySeq_iff']
intro ε εpos
obtain ⟨e, he⟩ : ∃ e : ℕ, (1 / 2) ^ e < ε / (12 * ‖c‖) :=
exists_pow_lt_of_lt_one (div_pos εpos (mul_pos (by norm_num) cpos)) (by norm_num)
refine' ⟨e, fun e' he' => _⟩
rw [dist_comm, dist_eq_norm]
calc
‖L0 e - L0 e'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e := M _ _ _ _ _ _ le_rfl le_rfl le_rfl le_rfl he'
_ < 12 * ‖c‖ * (ε / (12 * ‖c‖)) := by gcongr
_ = ε := by field_simp [(by norm_num : (12 : ℝ) ≠ 0), ne_of_gt cpos];
ring
-- As it is Cauchy, the sequence `L0` converges, to a limit `f'` in `K`.
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
⊢ CauchySeq L0
[PROOFSTEP]
rw [Metric.cauchySeq_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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
⊢ ∀ (ε : ℝ), ε > 0 → ∃ N, ∀ (n : ℕ), n ≥ N → dist (L0 n) (L0 N) < ε
[PROOFSTEP]
intro ε εpos
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
⊢ ∃ N, ∀ (n : ℕ), n ≥ N → dist (L0 n) (L0 N) < ε
[PROOFSTEP]
obtain ⟨e, he⟩ : ∃ e : ℕ, (1 / 2) ^ e < ε / (12 * ‖c‖) :=
exists_pow_lt_of_lt_one (div_pos εpos (mul_pos (by norm_num) cpos)) (by norm_num)
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
⊢ 0 < 12
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / (12 * ‖c‖)
⊢ ∃ N, ∀ (n : ℕ), n ≥ N → dist (L0 n) (L0 N) < ε
[PROOFSTEP]
refine' ⟨e, fun e' he' => _⟩
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / (12 * ‖c‖)
e' : ℕ
he' : e' ≥ e
⊢ dist (L0 e') (L0 e) < ε
[PROOFSTEP]
rw [dist_comm, dist_eq_norm]
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / (12 * ‖c‖)
e' : ℕ
he' : e' ≥ e
⊢ ‖L0 e - L0 e'‖ < ε
[PROOFSTEP]
calc
‖L0 e - L0 e'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e := M _ _ _ _ _ _ le_rfl le_rfl le_rfl le_rfl he'
_ < 12 * ‖c‖ * (ε / (12 * ‖c‖)) := by gcongr
_ = ε := by field_simp [(by norm_num : (12 : ℝ) ≠ 0), ne_of_gt cpos];
ring
-- As it is Cauchy, the sequence `L0` converges, to a limit `f'` in `K`.
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / (12 * ‖c‖)
e' : ℕ
he' : e' ≥ e
⊢ 12 * ‖c‖ * (1 / 2) ^ e < 12 * ‖c‖ * (ε / (12 * ‖c‖))
[PROOFSTEP]
gcongr
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / (12 * ‖c‖)
e' : ℕ
he' : e' ≥ e
⊢ 12 * ‖c‖ * (ε / (12 * ‖c‖)) = ε
[PROOFSTEP]
field_simp [(by norm_num : (12 : ℝ) ≠ 0), ne_of_gt cpos]
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / (12 * ‖c‖)
e' : ℕ
he' : e' ≥ e
⊢ 12 ≠ 0
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / (12 * ‖c‖)
e' : ℕ
he' : e' ≥ e
⊢ 12 * ‖c‖ * ε = ε * (12 * ‖c‖)
[PROOFSTEP]
ring
-- As it is Cauchy, the sequence `L0` converges, to a limit `f'` in `K`.
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
obtain ⟨f', f'K, hf'⟩ : ∃ f' ∈ K, Tendsto L0 atTop (𝓝 f') :=
cauchySeq_tendsto_of_isComplete hK (fun e => (hn e (n e) (n e) le_rfl le_rfl).1) this
[GOAL]
case intro.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
have Lf' : ∀ e p, n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e :=
by
intro e p hp
apply le_of_tendsto (tendsto_const_nhds.sub hf').norm
rw [eventually_atTop]
exact
⟨e, fun e' he' => M _ _ _ _ _ _ le_rfl hp le_rfl le_rfl he'⟩
-- Let us show that `f` has derivative `f'` at `x`.
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
⊢ ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
intro e p hp
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
e p : ℕ
hp : n e ≤ p
⊢ ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
apply le_of_tendsto (tendsto_const_nhds.sub hf').norm
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
e p : ℕ
hp : n e ≤ p
⊢ ∀ᶠ (c_1 : ℕ) in atTop, ‖L e (n e) p - L0 c_1‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
rw [eventually_atTop]
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
e p : ℕ
hp : n e ≤ p
⊢ ∃ a, ∀ (b : ℕ), b ≥ a → ‖L e (n e) p - L0 b‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
[PROOFSTEP]
exact
⟨e, fun e' he' => M _ _ _ _ _ _ le_rfl hp le_rfl le_rfl he'⟩
-- Let us show that `f` has derivative `f'` at `x`.
[GOAL]
case intro.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
have : HasFDerivAt f f' x :=
by
simp only [hasFDerivAt_iff_isLittleO_nhds_zero, isLittleO_iff]
/- to get an approximation with a precision `ε`, we will replace `f` with `L e (n e) m` for
some large enough `e` (yielding a small error by uniform approximation). As one can vary `m`,
this makes it possible to cover all scales, and thus to obtain a good linear approximation in
the whole ball of radius `(1/2)^(n e)`. -/
intro ε εpos
have pos : 0 < 4 + 12 * ‖c‖ := by positivity
obtain ⟨e, he⟩ : ∃ e : ℕ, (1 / 2) ^ e < ε / (4 + 12 * ‖c‖) := exists_pow_lt_of_lt_one (div_pos εpos pos) (by norm_num)
rw [eventually_nhds_iff_ball]
refine'
⟨(1 / 2) ^ (n e + 1), P, fun y hy => _⟩
-- We need to show that `f (x + y) - f x - f' y` is small. For this, we will work at scale
-- `k` where `k` is chosen with `‖y‖ ∼ 2 ^ (-k)`.
by_cases y_pos : y = 0; · simp [y_pos]
have yzero : 0 < ‖y‖ := norm_pos_iff.mpr y_pos
have y_lt : ‖y‖ < (1 / 2) ^ (n e + 1) := by simpa using mem_ball_iff_norm.1 hy
have yone : ‖y‖ ≤ 1 :=
le_trans y_lt.le
(pow_le_one _ (by norm_num) (by norm_num))
-- define the scale `k`.
obtain ⟨k, hk, h'k⟩ : ∃ k : ℕ, (1 / 2) ^ (k + 1) < ‖y‖ ∧ ‖y‖ ≤ (1 / 2) ^ k :=
exists_nat_pow_near_of_lt_one yzero yone (by norm_num : (0 : ℝ) < 1 / 2)
(by norm_num : (1 : ℝ) / 2 < 1)
-- the scale is large enough (as `y` is small enough)
have k_gt : n e < k :=
by
have : ((1 : ℝ) / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1) := lt_trans hk y_lt
rw [pow_lt_pow_iff_of_lt_one (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num)] at this
linarith
set m := k - 1
have m_ge : n e ≤ m := Nat.le_pred_of_lt k_gt
have km : k = m + 1 := (Nat.succ_pred_eq_of_pos (lt_of_le_of_lt (zero_le _) k_gt)).symm
rw [km] at hk h'k
have J1 : ‖f (x + y) - f x - L e (n e) m (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m :=
by
apply le_of_mem_a (hn e (n e) m le_rfl m_ge).2.2
· simp only [mem_closedBall, dist_self]
exact div_nonneg (le_of_lt P) zero_le_two
· simpa only [dist_eq_norm, add_sub_cancel', mem_closedBall, pow_succ', mul_one_div] using h'k
have J2 : ‖f (x + y) - f x - L e (n e) m y‖ ≤ 4 * (1 / 2) ^ e * ‖y‖ :=
calc
‖f (x + y) - f x - L e (n e) m y‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m := by simpa only [add_sub_cancel'] using J1
_ = 4 * (1 / 2) ^ e * (1 / 2) ^ (m + 2) := by field_simp; ring
_ ≤ 4 * (1 / 2) ^ e * ‖y‖ :=
mul_le_mul_of_nonneg_left (le_of_lt hk)
(mul_nonneg (by norm_num) (le_of_lt P))
-- use the previous estimates to see that `f (x + y) - f x - f' y` is small.
calc
‖f (x + y) - f x - f' y‖ = ‖f (x + y) - f x - L e (n e) m y + (L e (n e) m - f') y‖ := congr_arg _ (by simp)
_ ≤ 4 * (1 / 2) ^ e * ‖y‖ + 12 * ‖c‖ * (1 / 2) ^ e * ‖y‖ :=
(norm_add_le_of_le J2 ((le_op_norm _ _).trans (mul_le_mul_of_nonneg_right (Lf' _ _ m_ge) (norm_nonneg _))))
_ = (4 + 12 * ‖c‖) * ‖y‖ * (1 / 2) ^ e := by ring
_ ≤ (4 + 12 * ‖c‖) * ‖y‖ * (ε / (4 + 12 * ‖c‖)) := by gcongr
_ = ε * ‖y‖ := by field_simp [ne_of_gt pos]; ring
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
⊢ HasFDerivAt f f' x
[PROOFSTEP]
simp only [hasFDerivAt_iff_isLittleO_nhds_zero, isLittleO_iff]
/- to get an approximation with a precision `ε`, we will replace `f` with `L e (n e) m` for
some large enough `e` (yielding a small error by uniform approximation). As one can vary `m`,
this makes it possible to cover all scales, and thus to obtain a good linear approximation in
the whole ball of radius `(1/2)^(n e)`. -/
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
⊢ ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : E) in 𝓝 0, ‖f (x + x_1) - f x - ↑f' x_1‖ ≤ c * ‖x_1‖
[PROOFSTEP]
intro ε εpos
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
⊢ ∀ᶠ (x_1 : E) in 𝓝 0, ‖f (x + x_1) - f x - ↑f' x_1‖ ≤ ε * ‖x_1‖
[PROOFSTEP]
have pos : 0 < 4 + 12 * ‖c‖ := by positivity
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
⊢ 0 < 4 + 12 * ‖c‖
[PROOFSTEP]
positivity
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
⊢ ∀ᶠ (x_1 : E) in 𝓝 0, ‖f (x + x_1) - f x - ↑f' x_1‖ ≤ ε * ‖x_1‖
[PROOFSTEP]
obtain ⟨e, he⟩ : ∃ e : ℕ, (1 / 2) ^ e < ε / (4 + 12 * ‖c‖) := exists_pow_lt_of_lt_one (div_pos εpos pos) (by norm_num)
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
⊢ ∀ᶠ (x_1 : E) in 𝓝 0, ‖f (x + x_1) - f x - ↑f' x_1‖ ≤ ε * ‖x_1‖
[PROOFSTEP]
rw [eventually_nhds_iff_ball]
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
⊢ ∃ ε_1, ε_1 > 0 ∧ ∀ (y : E), y ∈ ball 0 ε_1 → ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
refine'
⟨(1 / 2) ^ (n e + 1), P, fun y hy => _⟩
-- We need to show that `f (x + y) - f x - f' y` is small. For this, we will work at scale
-- `k` where `k` is chosen with `‖y‖ ∼ 2 ^ (-k)`.
[GOAL]
case intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
by_cases y_pos : y = 0
[GOAL]
case pos
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : y = 0
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
simp [y_pos]
[GOAL]
case neg
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
have yzero : 0 < ‖y‖ := norm_pos_iff.mpr y_pos
[GOAL]
case neg
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
have y_lt : ‖y‖ < (1 / 2) ^ (n e + 1) := by simpa using mem_ball_iff_norm.1 hy
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
⊢ ‖y‖ < (1 / 2) ^ (n e + 1)
[PROOFSTEP]
simpa using mem_ball_iff_norm.1 hy
[GOAL]
case neg
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
have yone : ‖y‖ ≤ 1 :=
le_trans y_lt.le
(pow_le_one _ (by norm_num) (by norm_num))
-- define the scale `k`.
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
⊢ 1 / 2 ≤ 1
[PROOFSTEP]
norm_num
[GOAL]
case neg
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
obtain ⟨k, hk, h'k⟩ : ∃ k : ℕ, (1 / 2) ^ (k + 1) < ‖y‖ ∧ ‖y‖ ≤ (1 / 2) ^ k :=
exists_nat_pow_near_of_lt_one yzero yone (by norm_num : (0 : ℝ) < 1 / 2)
(by norm_num : (1 : ℝ) / 2 < 1)
-- the scale is large enough (as `y` is small enough)
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case neg.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
have k_gt : n e < k := by
have : ((1 : ℝ) / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1) := lt_trans hk y_lt
rw [pow_lt_pow_iff_of_lt_one (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num)] at this
linarith
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
⊢ n e < k
[PROOFSTEP]
have : ((1 : ℝ) / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1) := lt_trans hk y_lt
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
this : (1 / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1)
⊢ n e < k
[PROOFSTEP]
rw [pow_lt_pow_iff_of_lt_one (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num)] at this
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
this : (1 / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1)
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
this : (1 / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1)
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
this : n e + 1 < k + 1
⊢ n e < k
[PROOFSTEP]
linarith
[GOAL]
case neg.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
k_gt : n e < k
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
set m := k - 1
[GOAL]
case neg.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
k_gt : n e < k
m : ℕ := k - 1
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
have m_ge : n e ≤ m := Nat.le_pred_of_lt k_gt
[GOAL]
case neg.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
k_gt : n e < k
m : ℕ := k - 1
m_ge : n e ≤ m
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
have km : k = m + 1 := (Nat.succ_pred_eq_of_pos (lt_of_le_of_lt (zero_le _) k_gt)).symm
[GOAL]
case neg.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < ‖y‖
h'k : ‖y‖ ≤ (1 / 2) ^ k
k_gt : n e < k
m : ℕ := k - 1
m_ge : n e ≤ m
km : k = m + 1
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
rw [km] at hk h'k
[GOAL]
case neg.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
have J1 : ‖f (x + y) - f x - L e (n e) m (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m :=
by
apply le_of_mem_a (hn e (n e) m le_rfl m_ge).2.2
· simp only [mem_closedBall, dist_self]
exact div_nonneg (le_of_lt P) zero_le_two
· simpa only [dist_eq_norm, add_sub_cancel', mem_closedBall, pow_succ', mul_one_div] using h'k
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
⊢ ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
[PROOFSTEP]
apply le_of_mem_a (hn e (n e) m le_rfl m_ge).2.2
[GOAL]
case hy
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
⊢ x ∈ closedBall x ((1 / 2) ^ m / 2)
[PROOFSTEP]
simp only [mem_closedBall, dist_self]
[GOAL]
case hy
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
⊢ 0 ≤ (1 / 2) ^ (k - 1) / 2
[PROOFSTEP]
exact div_nonneg (le_of_lt P) zero_le_two
[GOAL]
case hz
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
⊢ x + y ∈ closedBall x ((1 / 2) ^ m / 2)
[PROOFSTEP]
simpa only [dist_eq_norm, add_sub_cancel', mem_closedBall, pow_succ', mul_one_div] using h'k
[GOAL]
case neg.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
have J2 : ‖f (x + y) - f x - L e (n e) m y‖ ≤ 4 * (1 / 2) ^ e * ‖y‖ :=
calc
‖f (x + y) - f x - L e (n e) m y‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m := by simpa only [add_sub_cancel'] using J1
_ = 4 * (1 / 2) ^ e * (1 / 2) ^ (m + 2) := by field_simp; ring
_ ≤ 4 * (1 / 2) ^ e * ‖y‖ :=
mul_le_mul_of_nonneg_left (le_of_lt hk)
(mul_nonneg (by norm_num) (le_of_lt P))
-- use the previous estimates to see that `f (x + y) - f x - f' y` is small.
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
⊢ ‖f (x + y) - f x - ↑(L e (n e) m) y‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
[PROOFSTEP]
simpa only [add_sub_cancel'] using J1
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
⊢ (1 / 2) ^ e * (1 / 2) ^ m = 4 * (1 / 2) ^ e * (1 / 2) ^ (m + 2)
[PROOFSTEP]
field_simp
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
⊢ 2 ^ e * 2 ^ (k - 1 + 2) = 4 * (2 ^ e * 2 ^ (k - 1))
[PROOFSTEP]
ring
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
⊢ 0 ≤ 4
[PROOFSTEP]
norm_num
[GOAL]
case neg.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
J2 : ‖f (x + y) - f x - ↑(L e (n e) m) y‖ ≤ 4 * (1 / 2) ^ e * ‖y‖
⊢ ‖f (x + y) - f x - ↑f' y‖ ≤ ε * ‖y‖
[PROOFSTEP]
calc
‖f (x + y) - f x - f' y‖ = ‖f (x + y) - f x - L e (n e) m y + (L e (n e) m - f') y‖ := congr_arg _ (by simp)
_ ≤ 4 * (1 / 2) ^ e * ‖y‖ + 12 * ‖c‖ * (1 / 2) ^ e * ‖y‖ :=
(norm_add_le_of_le J2 ((le_op_norm _ _).trans (mul_le_mul_of_nonneg_right (Lf' _ _ m_ge) (norm_nonneg _))))
_ = (4 + 12 * ‖c‖) * ‖y‖ * (1 / 2) ^ e := by ring
_ ≤ (4 + 12 * ‖c‖) * ‖y‖ * (ε / (4 + 12 * ‖c‖)) := by gcongr
_ = ε * ‖y‖ := by field_simp [ne_of_gt pos]; ring
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
J2 : ‖f (x + y) - f x - ↑(L e (n e) m) y‖ ≤ 4 * (1 / 2) ^ e * ‖y‖
⊢ f (x + y) - f x - ↑f' y = f (x + y) - f x - ↑(L e (n e) m) y + ↑(L e (n e) m - f') y
[PROOFSTEP]
simp
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
J2 : ‖f (x + y) - f x - ↑(L e (n e) m) y‖ ≤ 4 * (1 / 2) ^ e * ‖y‖
⊢ 4 * (1 / 2) ^ e * ‖y‖ + 12 * ‖c‖ * (1 / 2) ^ e * ‖y‖ = (4 + 12 * ‖c‖) * ‖y‖ * (1 / 2) ^ e
[PROOFSTEP]
ring
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
J2 : ‖f (x + y) - f x - ↑(L e (n e) m) y‖ ≤ 4 * (1 / 2) ^ e * ‖y‖
⊢ (4 + 12 * ‖c‖) * ‖y‖ * (1 / 2) ^ e ≤ (4 + 12 * ‖c‖) * ‖y‖ * (ε / (4 + 12 * ‖c‖))
[PROOFSTEP]
gcongr
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
J2 : ‖f (x + y) - f x - ↑(L e (n e) m) y‖ ≤ 4 * (1 / 2) ^ e * ‖y‖
⊢ (4 + 12 * ‖c‖) * ‖y‖ * (ε / (4 + 12 * ‖c‖)) = ε * ‖y‖
[PROOFSTEP]
field_simp [ne_of_gt pos]
[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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
pos : 0 < 4 + 12 * ‖c‖
e : ℕ
he : (1 / 2) ^ e < ε / (4 + 12 * ‖c‖)
y : E
hy : y ∈ ball 0 ((1 / 2) ^ (n e + 1))
y_pos : ¬y = 0
yzero : 0 < ‖y‖
y_lt : ‖y‖ < (1 / 2) ^ (n e + 1)
yone : ‖y‖ ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : ‖y‖ ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < ‖y‖
m_ge : n e ≤ m
km : k = m + 1
J1 : ‖f (x + y) - f x - ↑(L e (n e) m) (x + y - x)‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
J2 : ‖f (x + y) - f x - ↑(L e (n e) m) y‖ ≤ 4 * (1 / 2) ^ e * ‖y‖
⊢ (4 + 12 * ‖c‖) * ‖y‖ * ε = ε * ‖y‖ * (4 + 12 * ‖c‖)
[PROOFSTEP]
ring
[GOAL]
case intro.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : E →L[𝕜] F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
this : HasFDerivAt f f' x
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
rw [← this.fderiv] at f'K
[GOAL]
case intro.intro.intro
𝕜 : 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
f : E → F
K✝ K : Set (E →L[𝕜] F)
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
c : 𝕜
hc : 1 < ‖c‖
cpos : 0 < ‖c‖
x : E
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → E →L[𝕜] F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ),
n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
L0 : ℕ → E →L[𝕜] F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : E →L[𝕜] F
f'K : fderiv 𝕜 f x ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * ‖c‖ * (1 / 2) ^ e
this : HasFDerivAt f f' x
⊢ x ∈ {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
exact ⟨this.differentiableAt, f'K⟩
[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
f : E → F
K✝ : Set (E →L[𝕜] F)
inst✝¹ : MeasurableSpace E
inst✝ : OpensMeasurableSpace E
K : Set (E →L[𝕜] F)
hK : IsComplete K
⊢ MeasurableSet {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}
[PROOFSTEP]
simp only [D, differentiable_set_eq_d K hK]
[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
f : E → F
K✝ : Set (E →L[𝕜] F)
inst✝¹ : MeasurableSpace E
inst✝ : OpensMeasurableSpace E
K : Set (E →L[𝕜] F)
hK : IsComplete K
⊢ MeasurableSet
(⋂ (e : ℕ), ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[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
f : E → F
K✝ : Set (E →L[𝕜] F)
inst✝¹ : MeasurableSpace E
inst✝ : OpensMeasurableSpace E
K : Set (E →L[𝕜] F)
hK : IsComplete K
x✝ : ℕ
⊢ MeasurableSet (⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ x✝))
[PROOFSTEP]
refine MeasurableSet.iUnion fun _ => ?_
[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
f : E → F
K✝ : Set (E →L[𝕜] F)
inst✝¹ : MeasurableSpace E
inst✝ : OpensMeasurableSpace E
K : Set (E →L[𝕜] F)
hK : IsComplete K
x✝¹ x✝ : ℕ
⊢ MeasurableSet (⋂ (p : ℕ) (_ : p ≥ x✝) (q : ℕ) (_ : q ≥ x✝), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ x✝¹))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[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
f : E → F
K✝ : Set (E →L[𝕜] F)
inst✝¹ : MeasurableSpace E
inst✝ : OpensMeasurableSpace E
K : Set (E →L[𝕜] F)
hK : IsComplete K
x✝² x✝¹ x✝ : ℕ
⊢ MeasurableSet (⋂ (_ : x✝ ≥ x✝¹) (q : ℕ) (_ : q ≥ x✝¹), B f K ((1 / 2) ^ x✝) ((1 / 2) ^ q) ((1 / 2) ^ x✝²))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[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
f : E → F
K✝ : Set (E →L[𝕜] F)
inst✝¹ : MeasurableSpace E
inst✝ : OpensMeasurableSpace E
K : Set (E →L[𝕜] F)
hK : IsComplete K
x✝³ x✝² x✝¹ : ℕ
x✝ : x✝¹ ≥ x✝²
⊢ MeasurableSet (⋂ (q : ℕ) (_ : q ≥ x✝²), B f K ((1 / 2) ^ x✝¹) ((1 / 2) ^ q) ((1 / 2) ^ x✝³))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[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
f : E → F
K✝ : Set (E →L[𝕜] F)
inst✝¹ : MeasurableSpace E
inst✝ : OpensMeasurableSpace E
K : Set (E →L[𝕜] F)
hK : IsComplete K
x✝⁴ x✝³ x✝² : ℕ
x✝¹ : x✝² ≥ x✝³
x✝ : ℕ
⊢ MeasurableSet (⋂ (_ : x✝ ≥ x✝³), B f K ((1 / 2) ^ x✝²) ((1 / 2) ^ x✝) ((1 / 2) ^ x✝⁴))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[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
f : E → F
K✝ : Set (E →L[𝕜] F)
inst✝¹ : MeasurableSpace E
inst✝ : OpensMeasurableSpace E
K : Set (E →L[𝕜] F)
hK : IsComplete K
x✝⁵ x✝⁴ x✝³ : ℕ
x✝² : x✝³ ≥ x✝⁴
x✝¹ : ℕ
x✝ : x✝¹ ≥ x✝⁴
⊢ MeasurableSet (B f K ((1 / 2) ^ x✝³) ((1 / 2) ^ x✝¹) ((1 / 2) ^ x✝⁵))
[PROOFSTEP]
refine isOpen_b.measurableSet
[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
f : E → F
K : Set (E →L[𝕜] F)
inst✝² : MeasurableSpace E
inst✝¹ : OpensMeasurableSpace E
inst✝ : CompleteSpace F
⊢ MeasurableSet {x | DifferentiableAt 𝕜 f x}
[PROOFSTEP]
have : IsComplete (univ : Set (E →L[𝕜] F)) := complete_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
f : E → F
K : Set (E →L[𝕜] F)
inst✝² : MeasurableSpace E
inst✝¹ : OpensMeasurableSpace E
inst✝ : CompleteSpace F
this : IsComplete univ
⊢ MeasurableSet {x | DifferentiableAt 𝕜 f x}
[PROOFSTEP]
convert measurableSet_of_differentiableAt_of_isComplete 𝕜 f this
[GOAL]
case h.e'_3.h.e'_2.h.a
𝕜 : 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
f : E → F
K : Set (E →L[𝕜] F)
inst✝² : MeasurableSpace E
inst✝¹ : OpensMeasurableSpace E
inst✝ : CompleteSpace F
this : IsComplete univ
x✝ : E
⊢ DifferentiableAt 𝕜 f x✝ ↔ DifferentiableAt 𝕜 f x✝ ∧ fderiv 𝕜 f x✝ ∈ univ
[PROOFSTEP]
simp
[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
f : E → F
K : Set (E →L[𝕜] F)
inst✝² : MeasurableSpace E
inst✝¹ : OpensMeasurableSpace E
inst✝ : CompleteSpace F
⊢ Measurable (fderiv 𝕜 f)
[PROOFSTEP]
refine' measurable_of_isClosed fun s hs => _
[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
f : E → F
K : Set (E →L[𝕜] F)
inst✝² : MeasurableSpace E
inst✝¹ : OpensMeasurableSpace E
inst✝ : CompleteSpace F
s : Set (E →L[𝕜] F)
hs : IsClosed s
⊢ MeasurableSet (fderiv 𝕜 f ⁻¹' s)
[PROOFSTEP]
have :
fderiv 𝕜 f ⁻¹' s =
{x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ s} ∪ {x | ¬DifferentiableAt 𝕜 f x} ∩ {_x | (0 : E →L[𝕜] F) ∈ s} :=
Set.ext fun x => mem_preimage.trans fderiv_mem_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
f : E → F
K : Set (E →L[𝕜] F)
inst✝² : MeasurableSpace E
inst✝¹ : OpensMeasurableSpace E
inst✝ : CompleteSpace F
s : Set (E →L[𝕜] F)
hs : IsClosed s
this : fderiv 𝕜 f ⁻¹' s = {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ s} ∪ {x | ¬DifferentiableAt 𝕜 f x} ∩ {_x | 0 ∈ s}
⊢ MeasurableSet (fderiv 𝕜 f ⁻¹' s)
[PROOFSTEP]
rw [this]
[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
f : E → F
K : Set (E →L[𝕜] F)
inst✝² : MeasurableSpace E
inst✝¹ : OpensMeasurableSpace E
inst✝ : CompleteSpace F
s : Set (E →L[𝕜] F)
hs : IsClosed s
this : fderiv 𝕜 f ⁻¹' s = {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ s} ∪ {x | ¬DifferentiableAt 𝕜 f x} ∩ {_x | 0 ∈ s}
⊢ MeasurableSet ({x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ s} ∪ {x | ¬DifferentiableAt 𝕜 f x} ∩ {_x | 0 ∈ s})
[PROOFSTEP]
exact
(measurableSet_of_differentiableAt_of_isComplete _ _ hs.isComplete).union
((measurableSet_of_differentiableAt _ _).compl.inter (MeasurableSet.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
f✝ : E → F
K : Set (E →L[𝕜] F)
inst✝⁶ : MeasurableSpace E
inst✝⁵ : OpensMeasurableSpace E
inst✝⁴ : CompleteSpace F
inst✝³ : MeasurableSpace 𝕜
inst✝² : OpensMeasurableSpace 𝕜
inst✝¹ : MeasurableSpace F
inst✝ : BorelSpace F
f : 𝕜 → F
⊢ Measurable (deriv f)
[PROOFSTEP]
simpa only [fderiv_deriv] using measurable_fderiv_apply_const 𝕜 f 1
[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
f✝ : E → F
K : Set (E →L[𝕜] F)
inst✝⁵ : MeasurableSpace E
inst✝⁴ : OpensMeasurableSpace E
inst✝³ : CompleteSpace F
inst✝² : MeasurableSpace 𝕜
inst✝¹ : OpensMeasurableSpace 𝕜
inst✝ : SecondCountableTopology F
f : 𝕜 → F
⊢ StronglyMeasurable (deriv f)
[PROOFSTEP]
borelize F
[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
f✝ : E → F
K : Set (E →L[𝕜] F)
inst✝⁵ : MeasurableSpace E
inst✝⁴ : OpensMeasurableSpace E
inst✝³ : CompleteSpace F
inst✝² : MeasurableSpace 𝕜
inst✝¹ : OpensMeasurableSpace 𝕜
inst✝ : SecondCountableTopology F
f : 𝕜 → F
this✝¹ : MeasurableSpace F := borel F
this✝ : BorelSpace F
⊢ StronglyMeasurable (deriv f)
[PROOFSTEP]
exact (measurable_deriv f).stronglyMeasurable
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x : ℝ
hx : x ∈ A f L r ε
⊢ A f L r ε ∈ 𝓝[Ioi x] x
[PROOFSTEP]
rcases hx with ⟨r', rr', hr'⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
⊢ A f L r ε ∈ 𝓝[Ioi x] x
[PROOFSTEP]
rw [mem_nhdsWithin_Ioi_iff_exists_Ioo_subset]
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
⊢ ∃ u, u ∈ Ioi x ∧ Ioo x u ⊆ A f L r ε
[PROOFSTEP]
obtain ⟨s, s_gt, s_lt⟩ : ∃ s : ℝ, r / 2 < s ∧ s < r' := exists_between rr'.1
[GOAL]
case intro.intro.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
⊢ ∃ u, u ∈ Ioi x ∧ Ioo x u ⊆ A f L r ε
[PROOFSTEP]
have : s ∈ Ioc (r / 2) r := ⟨s_gt, le_of_lt (s_lt.trans_le rr'.2)⟩
[GOAL]
case intro.intro.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
⊢ ∃ u, u ∈ Ioi x ∧ Ioo x u ⊆ A f L r ε
[PROOFSTEP]
refine' ⟨x + r' - s, by simp only [mem_Ioi]; linarith, fun x' hx' => ⟨s, this, _⟩⟩
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
⊢ x + r' - s ∈ Ioi x
[PROOFSTEP]
simp only [mem_Ioi]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
⊢ x < x + r' - s
[PROOFSTEP]
linarith
[GOAL]
case intro.intro.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
x' : ℝ
hx' : x' ∈ Ioo x (x + r' - s)
⊢ ∀ (y : ℝ), y ∈ Icc x' (x' + s) → ∀ (z : ℝ), z ∈ Icc x' (x' + s) → ‖f z - f y - (z - y) • L‖ ≤ ε * r
[PROOFSTEP]
have A : Icc x' (x' + s) ⊆ Icc x (x + r') := by
apply Icc_subset_Icc hx'.1.le
linarith [hx'.2]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
x' : ℝ
hx' : x' ∈ Ioo x (x + r' - s)
⊢ Icc x' (x' + s) ⊆ Icc x (x + r')
[PROOFSTEP]
apply Icc_subset_Icc hx'.1.le
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
x' : ℝ
hx' : x' ∈ Ioo x (x + r' - s)
⊢ x' + s ≤ x + r'
[PROOFSTEP]
linarith [hx'.2]
[GOAL]
case intro.intro.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
x' : ℝ
hx' : x' ∈ Ioo x (x + r' - s)
A : Icc x' (x' + s) ⊆ Icc x (x + r')
⊢ ∀ (y : ℝ), y ∈ Icc x' (x' + s) → ∀ (z : ℝ), z ∈ Icc x' (x' + s) → ‖f z - f y - (z - y) • L‖ ≤ ε * r
[PROOFSTEP]
intro y hy z hz
[GOAL]
case intro.intro.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε x r' : ℝ
rr' : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
s : ℝ
s_gt : r / 2 < s
s_lt : s < r'
this : s ∈ Ioc (r / 2) r
x' : ℝ
hx' : x' ∈ Ioo x (x + r' - s)
A : Icc x' (x' + s) ⊆ Icc x (x + r')
y : ℝ
hy : y ∈ Icc x' (x' + s)
z : ℝ
hz : z ∈ Icc x' (x' + s)
⊢ ‖f z - f y - (z - y) • L‖ ≤ ε * r
[PROOFSTEP]
exact hr' y (A hy) z (A hz)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
r s ε x : ℝ
hx : x ∈ B f K r s ε
⊢ B f K r s ε ∈ 𝓝[Ioi x] x
[PROOFSTEP]
obtain ⟨L, LK, hL₁, hL₂⟩ : ∃ L : F, L ∈ K ∧ x ∈ A f L r ε ∧ x ∈ A f L s ε := by
simpa only [B, mem_iUnion, mem_inter_iff, exists_prop] using hx
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
r s ε x : ℝ
hx : x ∈ B f K r s ε
⊢ ∃ L, L ∈ K ∧ x ∈ A f L r ε ∧ x ∈ A f L s ε
[PROOFSTEP]
simpa only [B, mem_iUnion, mem_inter_iff, exists_prop] using hx
[GOAL]
case intro.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
r s ε x : ℝ
hx : x ∈ B f K r s ε
L : F
LK : L ∈ K
hL₁ : x ∈ A f L r ε
hL₂ : x ∈ A f L s ε
⊢ B f K r s ε ∈ 𝓝[Ioi x] x
[PROOFSTEP]
filter_upwards [a_mem_nhdsWithin_Ioi hL₁, a_mem_nhdsWithin_Ioi hL₂] with y hy₁ hy₂
[GOAL]
case h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
r s ε x : ℝ
hx : x ∈ B f K r s ε
L : F
LK : L ∈ K
hL₁ : x ∈ A f L r ε
hL₂ : x ∈ A f L s ε
y : ℝ
hy₁ : y ∈ A f L r ε
hy₂ : y ∈ A f L s ε
⊢ y ∈ B f K r s ε
[PROOFSTEP]
simp only [B, mem_iUnion, mem_inter_iff, exists_prop]
[GOAL]
case h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
r s ε x : ℝ
hx : x ∈ B f K r s ε
L : F
LK : L ∈ K
hL₁ : x ∈ A f L r ε
hL₂ : x ∈ A f L s ε
y : ℝ
hy₁ : y ∈ A f L r ε
hy₂ : y ∈ A f L s ε
⊢ ∃ i, i ∈ K ∧ y ∈ A f i r ε ∧ y ∈ A f i s ε
[PROOFSTEP]
exact ⟨L, LK, hy₁, hy₂⟩
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε δ : ℝ
h : ε ≤ δ
⊢ A f L r ε ⊆ A f L r δ
[PROOFSTEP]
rintro x ⟨r', r'r, hr'⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε δ : ℝ
h : ε ≤ δ
x r' : ℝ
r'r : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
⊢ x ∈ A f L r δ
[PROOFSTEP]
refine' ⟨r', r'r, fun y hy z hz => (hr' y hy z hz).trans (mul_le_mul_of_nonneg_right h _)⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
L : F
r ε δ : ℝ
h : ε ≤ δ
x r' : ℝ
r'r : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
y : ℝ
hy : y ∈ Icc x (x + r')
z : ℝ
hz : z ∈ Icc x (x + r')
⊢ 0 ≤ r
[PROOFSTEP]
linarith [hy.1, hy.2, r'r.2]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r ε : ℝ
L : F
x : ℝ
hx : x ∈ A f L r ε
y z : ℝ
hy : y ∈ Icc x (x + r / 2)
hz : z ∈ Icc x (x + r / 2)
⊢ ‖f z - f y - (z - y) • L‖ ≤ ε * r
[PROOFSTEP]
rcases hx with ⟨r', r'mem, hr'⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r ε : ℝ
L : F
x y z : ℝ
hy : y ∈ Icc x (x + r / 2)
hz : z ∈ Icc x (x + r / 2)
r' : ℝ
r'mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
⊢ ‖f z - f y - (z - y) • L‖ ≤ ε * r
[PROOFSTEP]
have A : x + r / 2 ≤ x + r' := by linarith [r'mem.1]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r ε : ℝ
L : F
x y z : ℝ
hy : y ∈ Icc x (x + r / 2)
hz : z ∈ Icc x (x + r / 2)
r' : ℝ
r'mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
⊢ x + r / 2 ≤ x + r'
[PROOFSTEP]
linarith [r'mem.1]
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r ε : ℝ
L : F
x y z : ℝ
hy : y ∈ Icc x (x + r / 2)
hz : z ∈ Icc x (x + r / 2)
r' : ℝ
r'mem : r' ∈ Ioc (r / 2) r
hr' : ∀ (y : ℝ), y ∈ Icc x (x + r') → ∀ (z : ℝ), z ∈ Icc x (x + r') → ‖f z - f y - (z - y) • L‖ ≤ ε * r
A : x + r / 2 ≤ x + r'
⊢ ‖f z - f y - (z - y) • L‖ ≤ ε * r
[PROOFSTEP]
exact hr' _ ((Icc_subset_Icc le_rfl A) hy) _ ((Icc_subset_Icc le_rfl A) hz)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
⊢ ∃ R, R > 0 ∧ ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ε
[PROOFSTEP]
have := hx.hasDerivWithinAt
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this : HasDerivWithinAt f (derivWithin f (Ici x) x) (Ici x) x
⊢ ∃ R, R > 0 ∧ ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ε
[PROOFSTEP]
simp_rw [hasDerivWithinAt_iff_isLittleO, isLittleO_iff] at this
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
⊢ ∃ R, R > 0 ∧ ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ε
[PROOFSTEP]
rcases mem_nhdsWithin_Ici_iff_exists_Ico_subset.1 (this (half_pos hε)) with ⟨m, xm, hm⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
⊢ ∃ R, R > 0 ∧ ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ε
[PROOFSTEP]
refine' ⟨m - x, by linarith [show x < m from xm], fun r hr => _⟩
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
⊢ m - x > 0
[PROOFSTEP]
linarith [show x < m from xm]
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
⊢ x ∈ A f (derivWithin f (Ici x) x) r ε
[PROOFSTEP]
have : r ∈ Ioc (r / 2) r := ⟨half_lt_self hr.1, le_rfl⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
⊢ x ∈ A f (derivWithin f (Ici x) x) r ε
[PROOFSTEP]
refine' ⟨r, this, fun y hy z hz => _⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ ‖f z - f y - (z - y) • derivWithin f (Ici x) x‖ ≤ ε * r
[PROOFSTEP]
calc
‖f z - f y - (z - y) • derivWithin f (Ici x) x‖ =
‖f z - f x - (z - x) • derivWithin f (Ici x) x - (f y - f x - (y - x) • derivWithin f (Ici x) x)‖ :=
by congr 1; simp only [sub_smul]; abel
_ ≤ ‖f z - f x - (z - x) • derivWithin f (Ici x) x‖ + ‖f y - f x - (y - x) • derivWithin f (Ici x) x‖ :=
(norm_sub_le _ _)
_ ≤ ε / 2 * ‖z - x‖ + ε / 2 * ‖y - x‖ :=
(add_le_add (hm ⟨hz.1, hz.2.trans_lt (by linarith [hr.2])⟩) (hm ⟨hy.1, hy.2.trans_lt (by linarith [hr.2])⟩))
_ ≤ ε / 2 * r + ε / 2 * r := by
gcongr
· rw [Real.norm_of_nonneg] <;> linarith [hz.1, hz.2]
· rw [Real.norm_of_nonneg] <;> linarith [hy.1, hy.2]
_ = ε * r := by ring
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ ‖f z - f y - (z - y) • derivWithin f (Ici x) x‖ =
‖f z - f x - (z - x) • derivWithin f (Ici x) x - (f y - f x - (y - x) • derivWithin f (Ici x) x)‖
[PROOFSTEP]
congr 1
[GOAL]
case e_a
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ f z - f y - (z - y) • derivWithin f (Ici x) x =
f z - f x - (z - x) • derivWithin f (Ici x) x - (f y - f x - (y - x) • derivWithin f (Ici x) x)
[PROOFSTEP]
simp only [sub_smul]
[GOAL]
case e_a
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ f z - f y - (z • derivWithin f (Ici x) x - y • derivWithin f (Ici x) x) =
f z - f x - (z • derivWithin f (Ici x) x - x • derivWithin f (Ici x) x) -
(f y - f x - (y • derivWithin f (Ici x) x - x • derivWithin f (Ici x) x))
[PROOFSTEP]
abel
[GOAL]
case e_a
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ f z - f y - (z • derivWithin f (Ici x) x - y • derivWithin f (Ici x) x) =
f z - f x - (z • derivWithin f (Ici x) x - x • derivWithin f (Ici x) x) -
(f y - f x - (y • derivWithin f (Ici x) x - x • derivWithin f (Ici x) x))
[PROOFSTEP]
abel
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ x + r < m
[PROOFSTEP]
linarith [hr.2]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ x + r < m
[PROOFSTEP]
linarith [hr.2]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ ε / 2 * ‖z - x‖ + ε / 2 * ‖y - x‖ ≤ ε / 2 * r + ε / 2 * r
[PROOFSTEP]
gcongr
[GOAL]
case h₁.h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ ‖z - x‖ ≤ r
[PROOFSTEP]
rw [Real.norm_of_nonneg]
[GOAL]
case h₁.h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ z - x ≤ r
[PROOFSTEP]
linarith [hz.1, hz.2]
[GOAL]
case h₁.h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ 0 ≤ z - x
[PROOFSTEP]
linarith [hz.1, hz.2]
[GOAL]
case h₂.h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ ‖y - x‖ ≤ r
[PROOFSTEP]
rw [Real.norm_of_nonneg]
[GOAL]
case h₂.h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ y - x ≤ r
[PROOFSTEP]
linarith [hy.1, hy.2]
[GOAL]
case h₂.h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ 0 ≤ y - x
[PROOFSTEP]
linarith [hy.1, hy.2]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
ε : ℝ
hε : 0 < ε
x : ℝ
hx : DifferentiableWithinAt ℝ f (Ici x) x
this✝ :
∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • derivWithin f (Ici x) x‖ ≤ c * ‖x_1 - x‖
m : ℝ
xm : m ∈ Ioi x
hm : Ico x m ⊆ {x_1 | (fun x_2 => ‖f x_2 - f x - (x_2 - x) • derivWithin f (Ici x) x‖ ≤ ε / 2 * ‖x_2 - x‖) x_1}
r : ℝ
hr : r ∈ Ioo 0 (m - x)
this : r ∈ Ioc (r / 2) r
y : ℝ
hy : y ∈ Icc x (x + r)
z : ℝ
hz : z ∈ Icc x (x + r)
⊢ ε / 2 * r + ε / 2 * r = ε * r
[PROOFSTEP]
ring
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ ‖L₁ - L₂‖ ≤ 4 * ε
[PROOFSTEP]
suffices H : ‖(r / 2) • (L₁ - L₂)‖ ≤ r / 2 * (4 * ε)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
H : ‖(r / 2) • (L₁ - L₂)‖ ≤ r / 2 * (4 * ε)
⊢ ‖L₁ - L₂‖ ≤ 4 * ε
[PROOFSTEP]
rwa [norm_smul, Real.norm_of_nonneg (half_pos hr).le, mul_le_mul_left (half_pos hr)] at H
[GOAL]
case H
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ ‖(r / 2) • (L₁ - L₂)‖ ≤ r / 2 * (4 * ε)
[PROOFSTEP]
calc
‖(r / 2) • (L₁ - L₂)‖ = ‖f (x + r / 2) - f x - (x + r / 2 - x) • L₂ - (f (x + r / 2) - f x - (x + r / 2 - x) • L₁)‖ :=
by simp [smul_sub]
_ ≤ ‖f (x + r / 2) - f x - (x + r / 2 - x) • L₂‖ + ‖f (x + r / 2) - f x - (x + r / 2 - x) • L₁‖ := (norm_sub_le _ _)
_ ≤ ε * r + ε * r := by
apply add_le_add
· apply le_of_mem_a h₂ <;> simp [(half_pos hr).le]
· apply le_of_mem_a h₁ <;> simp [(half_pos hr).le]
_ = r / 2 * (4 * ε) := by ring
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ ‖(r / 2) • (L₁ - L₂)‖ = ‖f (x + r / 2) - f x - (x + r / 2 - x) • L₂ - (f (x + r / 2) - f x - (x + r / 2 - x) • L₁)‖
[PROOFSTEP]
simp [smul_sub]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ ‖f (x + r / 2) - f x - (x + r / 2 - x) • L₂‖ + ‖f (x + r / 2) - f x - (x + r / 2 - x) • L₁‖ ≤ ε * r + ε * r
[PROOFSTEP]
apply add_le_add
[GOAL]
case h₁
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ ‖f (x + r / 2) - f x - (x + r / 2 - x) • L₂‖ ≤ ε * r
[PROOFSTEP]
apply le_of_mem_a h₂
[GOAL]
case h₁.hy
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ x ∈ Icc x (x + r / 2)
[PROOFSTEP]
simp [(half_pos hr).le]
[GOAL]
case h₁.hz
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ x + r / 2 ∈ Icc x (x + r / 2)
[PROOFSTEP]
simp [(half_pos hr).le]
[GOAL]
case h₂
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ ‖f (x + r / 2) - f x - (x + r / 2 - x) • L₁‖ ≤ ε * r
[PROOFSTEP]
apply le_of_mem_a h₁
[GOAL]
case h₂.hy
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ x ∈ Icc x (x + r / 2)
[PROOFSTEP]
simp [(half_pos hr).le]
[GOAL]
case h₂.hz
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ x + r / 2 ∈ Icc x (x + r / 2)
[PROOFSTEP]
simp [(half_pos hr).le]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
r x : ℝ
hr : 0 < r
ε : ℝ
L₁ L₂ : F
h₁ : x ∈ A f L₁ r ε
h₂ : x ∈ A f L₂ r ε
⊢ ε * r + ε * r = r / 2 * (4 * ε)
[PROOFSTEP]
ring
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
⊢ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K} ⊆ D f K
[PROOFSTEP]
intro x hx
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
⊢ x ∈ D f K
[PROOFSTEP]
rw [D, mem_iInter]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
⊢ ∀ (i : ℕ), x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ i)
[PROOFSTEP]
intro e
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
⊢ x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
have : (0 : ℝ) < (1 / 2) ^ e := pow_pos (by norm_num) _
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
⊢ x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
rcases mem_a_of_differentiable this hx.1 with ⟨R, R_pos, hR⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
⊢ x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
obtain ⟨n, hn⟩ : ∃ n : ℕ, (1 / 2) ^ n < R := exists_pow_lt_of_lt_one R_pos (by norm_num : (1 : ℝ) / 2 < 1)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case intro.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
⊢ x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
simp only [mem_iUnion, mem_iInter, B, mem_inter_iff]
[GOAL]
case intro.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
⊢ ∃ i,
∀ (i_1 : ℕ),
i_1 ≥ i →
∀ (i_3 : ℕ), i_3 ≥ i → ∃ i h, x ∈ A f i ((1 / 2) ^ i_1) ((1 / 2) ^ e) ∧ x ∈ A f i ((1 / 2) ^ i_3) ((1 / 2) ^ e)
[PROOFSTEP]
refine' ⟨n, fun p hp q hq => ⟨derivWithin f (Ici x) x, hx.2, ⟨_, _⟩⟩⟩
[GOAL]
case intro.intro.intro.refine'_1
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ x ∈ A f (derivWithin f (Ici x) x) ((1 / 2) ^ p) ((1 / 2) ^ e)
[PROOFSTEP]
refine' hR _ ⟨pow_pos (by norm_num) _, lt_of_le_of_lt _ hn⟩
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
case intro.intro.intro.refine'_1
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ (1 / 2) ^ p ≤ (1 / 2) ^ n
[PROOFSTEP]
exact pow_le_pow_of_le_one (by norm_num) (by norm_num) (by assumption)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 1 / 2 ≤ 1
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ n ≤ p
[PROOFSTEP]
assumption
[GOAL]
case intro.intro.intro.refine'_2
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ x ∈ A f (derivWithin f (Ici x) x) ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
refine' hR _ ⟨pow_pos (by norm_num) _, lt_of_le_of_lt _ hn⟩
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
case intro.intro.intro.refine'_2
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ (1 / 2) ^ q ≤ (1 / 2) ^ n
[PROOFSTEP]
exact pow_le_pow_of_le_one (by norm_num) (by norm_num) (by assumption)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ 1 / 2 ≤ 1
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K : Set F
x : ℝ
hx : x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
e : ℕ
this : 0 < (1 / 2) ^ e
R : ℝ
R_pos : R > 0
hR : ∀ (r : ℝ), r ∈ Ioo 0 R → x ∈ A f (derivWithin f (Ici x) x) r ((1 / 2) ^ e)
n : ℕ
hn : (1 / 2) ^ n < R
p : ℕ
hp : p ≥ n
q : ℕ
hq : q ≥ n
⊢ n ≤ q
[PROOFSTEP]
assumption
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
⊢ D f K ⊆ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
have P : ∀ {n : ℕ}, (0 : ℝ) < (1 / 2) ^ n := fun {n} => pow_pos (by norm_num) n
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
n : ℕ
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
⊢ D f K ⊆ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
intro x hx
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
have :
∀ e : ℕ,
∃ n : ℕ,
∀ p q, n ≤ p → n ≤ q → ∃ L ∈ K, x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e) :=
by
intro e
have := mem_iInter.1 hx e
rcases mem_iUnion.1 this with ⟨n, hn⟩
refine' ⟨n, fun p q hp hq => _⟩
simp only [mem_iInter, ge_iff_le] at hn
rcases mem_iUnion.1 (hn p hp q hq) with ⟨L, hL⟩
exact
⟨L, exists_prop.mp <| mem_iUnion.1 hL⟩
/- Recast the assumptions: for each `e`, there exist `n e` and linear maps `L e p q` in `K`
such that, for `p, q ≥ n e`, then `f` is well approximated by `L e p q` at scale `2 ^ (-p)` and
`2 ^ (-q)`, with an error `2 ^ (-e)`. -/
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
⊢ ∀ (e : ℕ),
∃ n,
∀ (p q : ℕ),
n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
intro e
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
e : ℕ
⊢ ∃ n,
∀ (p q : ℕ), n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
have := mem_iInter.1 hx e
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ ∃ n,
∀ (p q : ℕ), n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
rcases mem_iUnion.1 this with ⟨n, hn⟩
[GOAL]
case intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
n : ℕ
hn : x ∈ ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ ∃ n,
∀ (p q : ℕ), n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
refine' ⟨n, fun p q hp hq => _⟩
[GOAL]
case intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
n : ℕ
hn : x ∈ ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
p q : ℕ
hp : n ≤ p
hq : n ≤ q
⊢ ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
simp only [mem_iInter, ge_iff_le] at hn
[GOAL]
case intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
n p q : ℕ
hp : n ≤ p
hq : n ≤ q
hn : ∀ (i : ℕ), n ≤ i → ∀ (i_2 : ℕ), n ≤ i_2 → x ∈ B f K ((1 / 2) ^ i) ((1 / 2) ^ i_2) ((1 / 2) ^ e)
⊢ ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
rcases mem_iUnion.1 (hn p hp q hq) with ⟨L, hL⟩
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
e : ℕ
this : x ∈ ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e)
n p q : ℕ
hp : n ≤ p
hq : n ≤ q
hn : ∀ (i : ℕ), n ≤ i → ∀ (i_2 : ℕ), n ≤ i_2 → x ∈ B f K ((1 / 2) ^ i) ((1 / 2) ^ i_2) ((1 / 2) ^ e)
L : F
hL : x ∈ ⋃ (_ : L ∈ K), A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
[PROOFSTEP]
exact
⟨L, exists_prop.mp <| mem_iUnion.1 hL⟩
/- Recast the assumptions: for each `e`, there exist `n e` and linear maps `L e p q` in `K`
such that, for `p, q ≥ n e`, then `f` is well approximated by `L e p q` at scale `2 ^ (-p)` and
`2 ^ (-q)`, with an error `2 ^ (-e)`. -/
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
this :
∀ (e : ℕ),
∃ n,
∀ (p q : ℕ),
n ≤ p → n ≤ q → ∃ L, L ∈ K ∧ x ∈ A f L ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f L ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
choose! n L hn using this
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
have M :
∀ e p q e' p' q', n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e :=
by
intro e p q e' p' q' hp hq hp' hq' he'
let r := max (n e) (n e')
have I : ((1 : ℝ) / 2) ^ e' ≤ (1 / 2) ^ e := pow_le_pow_of_le_one (by norm_num) (by norm_num) he'
have J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p q hp hq).2.1
have I2 : x ∈ A f (L e p r) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.1
exact norm_sub_le_of_mem_a P _ I1 I2
have J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.2
have I2 : x ∈ A f (L e' p' r) ((1 / 2) ^ r) ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.2
exact norm_sub_le_of_mem_a P _ I1 (a_mono _ _ I I2)
have J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.1
have I2 : x ∈ A f (L e' p' q') ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' q' hp' hq').2.1
exact norm_sub_le_of_mem_a P _ (a_mono _ _ I I1) (a_mono _ _ I I2)
calc
‖L e p q - L e' p' q'‖ = ‖L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')‖ := by congr 1; abel
_ ≤ ‖L e p q - L e p r‖ + ‖L e p r - L e' p' r‖ + ‖L e' p' r - L e' p' q'‖ :=
(le_trans (norm_add_le _ _) (add_le_add_right (norm_add_le _ _) _))
_ ≤ 4 * (1 / 2) ^ e + 4 * (1 / 2) ^ e + 4 * (1 / 2) ^ e := by
gcongr
-- Porting note: proof was `by apply_rules [add_le_add]`
_ = 12 * (1 / 2) ^ e := by
ring
/- For definiteness, use `L0 e = L e (n e) (n e)`, to have a single sequence. We claim that this
is a Cauchy sequence. -/
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
⊢ ∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
intro e p q e' p' q' hp hq hp' hq' he'
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
let r := max (n e) (n e')
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
have I : ((1 : ℝ) / 2) ^ e' ≤ (1 / 2) ^ e := pow_le_pow_of_le_one (by norm_num) (by norm_num) he'
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
⊢ 1 / 2 ≤ 1
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
have J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p q hp hq).2.1
have I2 : x ∈ A f (L e p r) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.1
exact norm_sub_le_of_mem_a P _ I1 I2
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
⊢ ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
have I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p q hp hq).2.1
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e)
⊢ ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
have I2 : x ∈ A f (L e p r) ((1 / 2) ^ p) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.1
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
I1 : x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e)
I2 : x ∈ A f (L e p r) ((1 / 2) ^ p) ((1 / 2) ^ e)
⊢ ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
exact norm_sub_le_of_mem_a P _ I1 I2
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
have J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.2
have I2 : x ∈ A f (L e' p' r) ((1 / 2) ^ r) ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.2
exact norm_sub_le_of_mem_a P _ I1 (a_mono _ _ I I2)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
⊢ ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
have I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e) := (hn e p r hp (le_max_left _ _)).2.2
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e)
⊢ ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
have I2 : x ∈ A f (L e' p' r) ((1 / 2) ^ r) ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.2
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
I1 : x ∈ A f (L e p r) ((1 / 2) ^ r) ((1 / 2) ^ e)
I2 : x ∈ A f (L e' p' r) ((1 / 2) ^ r) ((1 / 2) ^ e')
⊢ ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
exact norm_sub_le_of_mem_a P _ I1 (a_mono _ _ I I2)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
have J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e :=
by
have I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.1
have I2 : x ∈ A f (L e' p' q') ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' q' hp' hq').2.1
exact norm_sub_le_of_mem_a P _ (a_mono _ _ I I1) (a_mono _ _ I I2)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
⊢ ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
have I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' r hp' (le_max_right _ _)).2.1
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e')
⊢ ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
have I2 : x ∈ A f (L e' p' q') ((1 / 2) ^ p') ((1 / 2) ^ e') := (hn e' p' q' hp' hq').2.1
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
I1 : x ∈ A f (L e' p' r) ((1 / 2) ^ p') ((1 / 2) ^ e')
I2 : x ∈ A f (L e' p' q') ((1 / 2) ^ p') ((1 / 2) ^ e')
⊢ ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
[PROOFSTEP]
exact norm_sub_le_of_mem_a P _ (a_mono _ _ I I1) (a_mono _ _ I I2)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
calc
‖L e p q - L e' p' q'‖ = ‖L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')‖ := by congr 1; abel
_ ≤ ‖L e p q - L e p r‖ + ‖L e p r - L e' p' r‖ + ‖L e' p' r - L e' p' q'‖ :=
(le_trans (norm_add_le _ _) (add_le_add_right (norm_add_le _ _) _))
_ ≤ 4 * (1 / 2) ^ e + 4 * (1 / 2) ^ e + 4 * (1 / 2) ^ e := by
gcongr
-- Porting note: proof was `by apply_rules [add_le_add]`
_ = 12 * (1 / 2) ^ e := by
ring
/- For definiteness, use `L0 e = L e (n e) (n e)`, to have a single sequence. We claim that this
is a Cauchy sequence. -/
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
⊢ ‖L e p q - L e' p' q'‖ = ‖L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')‖
[PROOFSTEP]
congr 1
[GOAL]
case e_a
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
⊢ L e p q - L e' p' q' = L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')
[PROOFSTEP]
abel
[GOAL]
case e_a
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
⊢ L e p q - L e' p' q' = L e p q - L e p r + (L e p r - L e' p' r) + (L e' p' r - L e' p' q')
[PROOFSTEP]
abel
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
⊢ ‖L e p q - L e p r‖ + ‖L e p r - L e' p' r‖ + ‖L e' p' r - L e' p' q'‖ ≤
4 * (1 / 2) ^ e + 4 * (1 / 2) ^ e + 4 * (1 / 2) ^ e
[PROOFSTEP]
gcongr
-- Porting note: proof was `by apply_rules [add_le_add]`
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
e p q e' p' q' : ℕ
hp : n e ≤ p
hq : n e ≤ q
hp' : n e' ≤ p'
hq' : n e' ≤ q'
he' : e ≤ e'
r : ℕ := max (n e) (n e')
I : (1 / 2) ^ e' ≤ (1 / 2) ^ e
J1 : ‖L e p q - L e p r‖ ≤ 4 * (1 / 2) ^ e
J2 : ‖L e p r - L e' p' r‖ ≤ 4 * (1 / 2) ^ e
J3 : ‖L e' p' r - L e' p' q'‖ ≤ 4 * (1 / 2) ^ e
⊢ 4 * (1 / 2) ^ e + 4 * (1 / 2) ^ e + 4 * (1 / 2) ^ e = 12 * (1 / 2) ^ e
[PROOFSTEP]
ring
/- For definiteness, use `L0 e = L e (n e) (n e)`, to have a single sequence. We claim that this
is a Cauchy sequence. -/
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
let L0 : ℕ → F := fun e => L e (n e) (n e)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
have : CauchySeq L0 := by
rw [Metric.cauchySeq_iff']
intro ε εpos
obtain ⟨e, he⟩ : ∃ e : ℕ, (1 / 2) ^ e < ε / 12 := exists_pow_lt_of_lt_one (div_pos εpos (by norm_num)) (by norm_num)
refine' ⟨e, fun e' he' => _⟩
rw [dist_comm, dist_eq_norm]
calc
‖L0 e - L0 e'‖ ≤ 12 * (1 / 2) ^ e := M _ _ _ _ _ _ le_rfl le_rfl le_rfl le_rfl he'
_ < 12 * (ε / 12) := (mul_lt_mul' le_rfl he (le_of_lt P) (by norm_num))
_ = ε := by field_simp [(by norm_num : (12 : ℝ) ≠ 0)];
ring
-- As it is Cauchy, the sequence `L0` converges, to a limit `f'` in `K`.
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
⊢ CauchySeq L0
[PROOFSTEP]
rw [Metric.cauchySeq_iff']
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
⊢ ∀ (ε : ℝ), ε > 0 → ∃ N, ∀ (n : ℕ), n ≥ N → dist (L0 n) (L0 N) < ε
[PROOFSTEP]
intro ε εpos
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
⊢ ∃ N, ∀ (n : ℕ), n ≥ N → dist (L0 n) (L0 N) < ε
[PROOFSTEP]
obtain ⟨e, he⟩ : ∃ e : ℕ, (1 / 2) ^ e < ε / 12 := exists_pow_lt_of_lt_one (div_pos εpos (by norm_num)) (by norm_num)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
⊢ 0 < 12
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / 12
⊢ ∃ N, ∀ (n : ℕ), n ≥ N → dist (L0 n) (L0 N) < ε
[PROOFSTEP]
refine' ⟨e, fun e' he' => _⟩
[GOAL]
case intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / 12
e' : ℕ
he' : e' ≥ e
⊢ dist (L0 e') (L0 e) < ε
[PROOFSTEP]
rw [dist_comm, dist_eq_norm]
[GOAL]
case intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / 12
e' : ℕ
he' : e' ≥ e
⊢ ‖L0 e - L0 e'‖ < ε
[PROOFSTEP]
calc
‖L0 e - L0 e'‖ ≤ 12 * (1 / 2) ^ e := M _ _ _ _ _ _ le_rfl le_rfl le_rfl le_rfl he'
_ < 12 * (ε / 12) := (mul_lt_mul' le_rfl he (le_of_lt P) (by norm_num))
_ = ε := by field_simp [(by norm_num : (12 : ℝ) ≠ 0)];
ring
-- As it is Cauchy, the sequence `L0` converges, to a limit `f'` in `K`.
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / 12
e' : ℕ
he' : e' ≥ e
⊢ 0 < 12
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / 12
e' : ℕ
he' : e' ≥ e
⊢ 12 * (ε / 12) = ε
[PROOFSTEP]
field_simp [(by norm_num : (12 : ℝ) ≠ 0)]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / 12
e' : ℕ
he' : e' ≥ e
⊢ 12 ≠ 0
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
ε : ℝ
εpos : ε > 0
e : ℕ
he : (1 / 2) ^ e < ε / 12
e' : ℕ
he' : e' ≥ e
⊢ 12 * ε = ε * 12
[PROOFSTEP]
ring
-- As it is Cauchy, the sequence `L0` converges, to a limit `f'` in `K`.
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
obtain ⟨f', f'K, hf'⟩ : ∃ f' ∈ K, Tendsto L0 atTop (𝓝 f') :=
cauchySeq_tendsto_of_isComplete hK (fun e => (hn e (n e) (n e) le_rfl le_rfl).1) this
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
have Lf' : ∀ e p, n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e :=
by
intro e p hp
apply le_of_tendsto (tendsto_const_nhds.sub hf').norm
rw [eventually_atTop]
exact
⟨e, fun e' he' => M _ _ _ _ _ _ le_rfl hp le_rfl le_rfl he'⟩
-- Let us show that `f` has right derivative `f'` at `x`.
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
⊢ ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
intro e p hp
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
e p : ℕ
hp : n e ≤ p
⊢ ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
apply le_of_tendsto (tendsto_const_nhds.sub hf').norm
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
e p : ℕ
hp : n e ≤ p
⊢ ∀ᶠ (c : ℕ) in atTop, ‖L e (n e) p - L0 c‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
rw [eventually_atTop]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
e p : ℕ
hp : n e ≤ p
⊢ ∃ a, ∀ (b : ℕ), b ≥ a → ‖L e (n e) p - L0 b‖ ≤ 12 * (1 / 2) ^ e
[PROOFSTEP]
exact
⟨e, fun e' he' => M _ _ _ _ _ _ le_rfl hp le_rfl le_rfl he'⟩
-- Let us show that `f` has right derivative `f'` at `x`.
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
have : HasDerivWithinAt f f' (Ici x) x :=
by
simp only [hasDerivWithinAt_iff_isLittleO, isLittleO_iff]
/- to get an approximation with a precision `ε`, we will replace `f` with `L e (n e) m` for
some large enough `e` (yielding a small error by uniform approximation). As one can vary `m`,
this makes it possible to cover all scales, and thus to obtain a good linear approximation in
the whole interval of length `(1/2)^(n e)`. -/
intro ε εpos
obtain ⟨e, he⟩ : ∃ e : ℕ, (1 / 2) ^ e < ε / 16 := exists_pow_lt_of_lt_one (div_pos εpos (by norm_num)) (by norm_num)
have xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1)) := by
simp only [one_div, left_mem_Ico, lt_add_iff_pos_right, inv_pos, pow_pos, zero_lt_two, zero_lt_one]
filter_upwards [Icc_mem_nhdsWithin_Ici xmem] with y hy
rcases eq_or_lt_of_le hy.1 with (rfl | xy)
· simp only [sub_self, zero_smul, norm_zero, mul_zero, le_rfl]
have yzero : 0 < y - x := sub_pos.2 xy
have y_le : y - x ≤ (1 / 2) ^ (n e + 1) := by linarith [hy.2]
have yone : y - x ≤ 1 :=
le_trans y_le
(pow_le_one _ (by norm_num) (by norm_num))
-- define the scale `k`.
obtain ⟨k, hk, h'k⟩ : ∃ k : ℕ, (1 / 2) ^ (k + 1) < y - x ∧ y - x ≤ (1 / 2) ^ k :=
exists_nat_pow_near_of_lt_one yzero yone (by norm_num : (0 : ℝ) < 1 / 2)
(by norm_num : (1 : ℝ) / 2 < 1)
-- the scale is large enough (as `y - x` is small enough)
have k_gt : n e < k :=
by
have : ((1 : ℝ) / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1) := lt_of_lt_of_le hk y_le
rw [pow_lt_pow_iff_of_lt_one (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num)] at this
linarith
set m := k - 1
have m_ge : n e ≤ m := Nat.le_pred_of_lt k_gt
have km : k = m + 1 := (Nat.succ_pred_eq_of_pos (lt_of_le_of_lt (zero_le _) k_gt)).symm
rw [km] at hk h'k
have J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖ :=
calc
‖f y - f x - (y - x) • L e (n e) m‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m :=
by
apply le_of_mem_a (hn e (n e) m le_rfl m_ge).2.2
· simp only [one_div, inv_pow, left_mem_Icc, le_add_iff_nonneg_right]
exact div_nonneg (inv_nonneg.2 (pow_nonneg zero_le_two _)) zero_le_two
· simp only [pow_add, tsub_le_iff_left] at h'k
simpa only [hy.1, mem_Icc, true_and_iff, one_div, pow_one] using h'k
_ = 4 * (1 / 2) ^ e * (1 / 2) ^ (m + 2) := by field_simp; ring
_ ≤ 4 * (1 / 2) ^ e * (y - x) := (mul_le_mul_of_nonneg_left (le_of_lt hk) (mul_nonneg (by norm_num) (le_of_lt P)))
_ = 4 * (1 / 2) ^ e * ‖y - x‖ := by rw [Real.norm_of_nonneg yzero.le]
calc
‖f y - f x - (y - x) • f'‖ = ‖f y - f x - (y - x) • L e (n e) m + (y - x) • (L e (n e) m - f')‖ := by
simp only [smul_sub, sub_add_sub_cancel]
_ ≤ 4 * (1 / 2) ^ e * ‖y - x‖ + ‖y - x‖ * (12 * (1 / 2) ^ e) :=
(norm_add_le_of_le J (by rw [norm_smul]; exact mul_le_mul_of_nonneg_left (Lf' _ _ m_ge) (norm_nonneg _)))
_ = 16 * ‖y - x‖ * (1 / 2) ^ e := by ring
_ ≤ 16 * ‖y - x‖ * (ε / 16) := (mul_le_mul_of_nonneg_left he.le (mul_nonneg (by norm_num) (norm_nonneg _)))
_ = ε * ‖y - x‖ := by ring
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
⊢ HasDerivWithinAt f f' (Ici x) x
[PROOFSTEP]
simp only [hasDerivWithinAt_iff_isLittleO, isLittleO_iff]
/- to get an approximation with a precision `ε`, we will replace `f` with `L e (n e) m` for
some large enough `e` (yielding a small error by uniform approximation). As one can vary `m`,
this makes it possible to cover all scales, and thus to obtain a good linear approximation in
the whole interval of length `(1/2)^(n e)`. -/
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
⊢ ∀ ⦃c : ℝ⦄, 0 < c → ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • f'‖ ≤ c * ‖x_1 - x‖
[PROOFSTEP]
intro ε εpos
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
⊢ ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • f'‖ ≤ ε * ‖x_1 - x‖
[PROOFSTEP]
obtain ⟨e, he⟩ : ∃ e : ℕ, (1 / 2) ^ e < ε / 16 := exists_pow_lt_of_lt_one (div_pos εpos (by norm_num)) (by norm_num)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
⊢ 0 < 16
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
⊢ ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • f'‖ ≤ ε * ‖x_1 - x‖
[PROOFSTEP]
have xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1)) := by
simp only [one_div, left_mem_Ico, lt_add_iff_pos_right, inv_pos, pow_pos, zero_lt_two, zero_lt_one]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
⊢ x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
[PROOFSTEP]
simp only [one_div, left_mem_Ico, lt_add_iff_pos_right, inv_pos, pow_pos, zero_lt_two, zero_lt_one]
[GOAL]
case intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
⊢ ∀ᶠ (x_1 : ℝ) in 𝓝[Ici x] x, ‖f x_1 - f x - (x_1 - x) • f'‖ ≤ ε * ‖x_1 - x‖
[PROOFSTEP]
filter_upwards [Icc_mem_nhdsWithin_Ici xmem] with y hy
[GOAL]
case h
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
rcases eq_or_lt_of_le hy.1 with (rfl | xy)
[GOAL]
case h.inl
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
hy : x ∈ Icc x (x + (1 / 2) ^ (n e + 1))
⊢ ‖f x - f x - (x - x) • f'‖ ≤ ε * ‖x - x‖
[PROOFSTEP]
simp only [sub_self, zero_smul, norm_zero, mul_zero, le_rfl]
[GOAL]
case h.inr
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
have yzero : 0 < y - x := sub_pos.2 xy
[GOAL]
case h.inr
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
have y_le : y - x ≤ (1 / 2) ^ (n e + 1) := by linarith [hy.2]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
⊢ y - x ≤ (1 / 2) ^ (n e + 1)
[PROOFSTEP]
linarith [hy.2]
[GOAL]
case h.inr
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
have yone : y - x ≤ 1 :=
le_trans y_le
(pow_le_one _ (by norm_num) (by norm_num))
-- define the scale `k`.
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
⊢ 1 / 2 ≤ 1
[PROOFSTEP]
norm_num
[GOAL]
case h.inr
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
obtain ⟨k, hk, h'k⟩ : ∃ k : ℕ, (1 / 2) ^ (k + 1) < y - x ∧ y - x ≤ (1 / 2) ^ k :=
exists_nat_pow_near_of_lt_one yzero yone (by norm_num : (0 : ℝ) < 1 / 2)
(by norm_num : (1 : ℝ) / 2 < 1)
-- the scale is large enough (as `y - x` is small enough)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case h.inr.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
have k_gt : n e < k :=
by
have : ((1 : ℝ) / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1) := lt_of_lt_of_le hk y_le
rw [pow_lt_pow_iff_of_lt_one (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num)] at this
linarith
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
⊢ n e < k
[PROOFSTEP]
have : ((1 : ℝ) / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1) := lt_of_lt_of_le hk y_le
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
this : (1 / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1)
⊢ n e < k
[PROOFSTEP]
rw [pow_lt_pow_iff_of_lt_one (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num)] at this
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
this : (1 / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1)
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
this : (1 / 2) ^ (k + 1) < (1 / 2) ^ (n e + 1)
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
this : n e + 1 < k + 1
⊢ n e < k
[PROOFSTEP]
linarith
[GOAL]
case h.inr.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
k_gt : n e < k
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
set m := k - 1
[GOAL]
case h.inr.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
k_gt : n e < k
m : ℕ := k - 1
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
have m_ge : n e ≤ m := Nat.le_pred_of_lt k_gt
[GOAL]
case h.inr.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
k_gt : n e < k
m : ℕ := k - 1
m_ge : n e ≤ m
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
have km : k = m + 1 := (Nat.succ_pred_eq_of_pos (lt_of_le_of_lt (zero_le _) k_gt)).symm
[GOAL]
case h.inr.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
hk : (1 / 2) ^ (k + 1) < y - x
h'k : y - x ≤ (1 / 2) ^ k
k_gt : n e < k
m : ℕ := k - 1
m_ge : n e ≤ m
km : k = m + 1
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
rw [km] at hk h'k
[GOAL]
case h.inr.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
have J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖ :=
calc
‖f y - f x - (y - x) • L e (n e) m‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m :=
by
apply le_of_mem_a (hn e (n e) m le_rfl m_ge).2.2
· simp only [one_div, inv_pow, left_mem_Icc, le_add_iff_nonneg_right]
exact div_nonneg (inv_nonneg.2 (pow_nonneg zero_le_two _)) zero_le_two
· simp only [pow_add, tsub_le_iff_left] at h'k
simpa only [hy.1, mem_Icc, true_and_iff, one_div, pow_one] using h'k
_ = 4 * (1 / 2) ^ e * (1 / 2) ^ (m + 2) := by field_simp; ring
_ ≤ 4 * (1 / 2) ^ e * (y - x) := (mul_le_mul_of_nonneg_left (le_of_lt hk) (mul_nonneg (by norm_num) (le_of_lt P)))
_ = 4 * (1 / 2) ^ e * ‖y - x‖ := by rw [Real.norm_of_nonneg yzero.le]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ ‖f y - f x - (y - x) • L e (n e) m‖ ≤ (1 / 2) ^ e * (1 / 2) ^ m
[PROOFSTEP]
apply le_of_mem_a (hn e (n e) m le_rfl m_ge).2.2
[GOAL]
case hy
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ x ∈ Icc x (x + (1 / 2) ^ m / 2)
[PROOFSTEP]
simp only [one_div, inv_pow, left_mem_Icc, le_add_iff_nonneg_right]
[GOAL]
case hy
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ 0 ≤ (2 ^ (k - 1))⁻¹ / 2
[PROOFSTEP]
exact div_nonneg (inv_nonneg.2 (pow_nonneg zero_le_two _)) zero_le_two
[GOAL]
case hz
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ y ∈ Icc x (x + (1 / 2) ^ m / 2)
[PROOFSTEP]
simp only [pow_add, tsub_le_iff_left] at h'k
[GOAL]
case hz
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
h'k : y ≤ x + (1 / 2) ^ (k - 1) * (1 / 2) ^ 1
⊢ y ∈ Icc x (x + (1 / 2) ^ m / 2)
[PROOFSTEP]
simpa only [hy.1, mem_Icc, true_and_iff, one_div, pow_one] using h'k
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ (1 / 2) ^ e * (1 / 2) ^ m = 4 * (1 / 2) ^ e * (1 / 2) ^ (m + 2)
[PROOFSTEP]
field_simp
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ 2 ^ e * 2 ^ (k - 1 + 2) = 4 * (2 ^ e * 2 ^ (k - 1))
[PROOFSTEP]
ring
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ 0 ≤ 4
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
⊢ 4 * (1 / 2) ^ e * (y - x) = 4 * (1 / 2) ^ e * ‖y - x‖
[PROOFSTEP]
rw [Real.norm_of_nonneg yzero.le]
[GOAL]
case h.inr.intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖
⊢ ‖f y - f x - (y - x) • f'‖ ≤ ε * ‖y - x‖
[PROOFSTEP]
calc
‖f y - f x - (y - x) • f'‖ = ‖f y - f x - (y - x) • L e (n e) m + (y - x) • (L e (n e) m - f')‖ := by
simp only [smul_sub, sub_add_sub_cancel]
_ ≤ 4 * (1 / 2) ^ e * ‖y - x‖ + ‖y - x‖ * (12 * (1 / 2) ^ e) :=
(norm_add_le_of_le J (by rw [norm_smul]; exact mul_le_mul_of_nonneg_left (Lf' _ _ m_ge) (norm_nonneg _)))
_ = 16 * ‖y - x‖ * (1 / 2) ^ e := by ring
_ ≤ 16 * ‖y - x‖ * (ε / 16) := (mul_le_mul_of_nonneg_left he.le (mul_nonneg (by norm_num) (norm_nonneg _)))
_ = ε * ‖y - x‖ := by ring
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖
⊢ ‖f y - f x - (y - x) • f'‖ = ‖f y - f x - (y - x) • L e (n e) m + (y - x) • (L e (n e) m - f')‖
[PROOFSTEP]
simp only [smul_sub, sub_add_sub_cancel]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖
⊢ ‖(y - x) • (L e (n e) m - f')‖ ≤ ‖y - x‖ * (12 * (1 / 2) ^ e)
[PROOFSTEP]
rw [norm_smul]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖
⊢ ‖y - x‖ * ‖L e (n e) m - f'‖ ≤ ‖y - x‖ * (12 * (1 / 2) ^ e)
[PROOFSTEP]
exact mul_le_mul_of_nonneg_left (Lf' _ _ m_ge) (norm_nonneg _)
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖
⊢ 4 * (1 / 2) ^ e * ‖y - x‖ + ‖y - x‖ * (12 * (1 / 2) ^ e) = 16 * ‖y - x‖ * (1 / 2) ^ e
[PROOFSTEP]
ring
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖
⊢ 0 ≤ 16
[PROOFSTEP]
norm_num
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
ε : ℝ
εpos : 0 < ε
e : ℕ
he : (1 / 2) ^ e < ε / 16
xmem : x ∈ Ico x (x + (1 / 2) ^ (n e + 1))
y : ℝ
hy : y ∈ Icc x (x + (1 / 2) ^ (n e + 1))
xy : x < y
yzero : 0 < y - x
y_le : y - x ≤ (1 / 2) ^ (n e + 1)
yone : y - x ≤ 1
k : ℕ
k_gt : n e < k
m : ℕ := k - 1
h'k : y - x ≤ (1 / 2) ^ (m + 1)
hk : (1 / 2) ^ (m + 1 + 1) < y - x
m_ge : n e ≤ m
km : k = m + 1
J : ‖f y - f x - (y - x) • L e (n e) m‖ ≤ 4 * (1 / 2) ^ e * ‖y - x‖
⊢ 16 * ‖y - x‖ * (ε / 16) = ε * ‖y - x‖
[PROOFSTEP]
ring
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : F
f'K : f' ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
this : HasDerivWithinAt f f' (Ici x) x
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
rw [← this.derivWithin (uniqueDiffOn_Ici x x Set.left_mem_Ici)] at f'K
[GOAL]
case intro.intro
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
P : ∀ {n : ℕ}, 0 < (1 / 2) ^ n
x : ℝ
hx : x ∈ D f K
n : ℕ → ℕ
L : ℕ → ℕ → ℕ → F
hn :
∀ (e p q : ℕ),
n e ≤ p →
n e ≤ q → L e p q ∈ K ∧ x ∈ A f (L e p q) ((1 / 2) ^ p) ((1 / 2) ^ e) ∩ A f (L e p q) ((1 / 2) ^ q) ((1 / 2) ^ e)
M :
∀ (e p q e' p' q' : ℕ), n e ≤ p → n e ≤ q → n e' ≤ p' → n e' ≤ q' → e ≤ e' → ‖L e p q - L e' p' q'‖ ≤ 12 * (1 / 2) ^ e
L0 : ℕ → F := fun e => L e (n e) (n e)
this✝ : CauchySeq L0
f' : F
f'K : derivWithin f (Ici x) x ∈ K
hf' : Tendsto L0 atTop (𝓝 f')
Lf' : ∀ (e p : ℕ), n e ≤ p → ‖L e (n e) p - f'‖ ≤ 12 * (1 / 2) ^ e
this : HasDerivWithinAt f f' (Ici x) x
⊢ x ∈ {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
exact ⟨this.differentiableWithinAt, f'K⟩
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
⊢ MeasurableSet {x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K}
[PROOFSTEP]
simp only [differentiable_set_eq_d K hK, D]
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
⊢ MeasurableSet
(⋂ (e : ℕ), ⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
x✝ : ℕ
⊢ MeasurableSet (⋃ (n : ℕ), ⋂ (p : ℕ) (_ : p ≥ n) (q : ℕ) (_ : q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ x✝))
[PROOFSTEP]
refine MeasurableSet.iUnion fun _ => ?_
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
x✝¹ x✝ : ℕ
⊢ MeasurableSet (⋂ (p : ℕ) (_ : p ≥ x✝) (q : ℕ) (_ : q ≥ x✝), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ x✝¹))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
x✝² x✝¹ x✝ : ℕ
⊢ MeasurableSet (⋂ (_ : x✝ ≥ x✝¹) (q : ℕ) (_ : q ≥ x✝¹), B f K ((1 / 2) ^ x✝) ((1 / 2) ^ q) ((1 / 2) ^ x✝²))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
x✝³ x✝² x✝¹ : ℕ
x✝ : x✝¹ ≥ x✝²
⊢ MeasurableSet (⋂ (q : ℕ) (_ : q ≥ x✝²), B f K ((1 / 2) ^ x✝¹) ((1 / 2) ^ q) ((1 / 2) ^ x✝³))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
x✝⁴ x✝³ x✝² : ℕ
x✝¹ : x✝² ≥ x✝³
x✝ : ℕ
⊢ MeasurableSet (⋂ (_ : x✝ ≥ x✝³), B f K ((1 / 2) ^ x✝²) ((1 / 2) ^ x✝) ((1 / 2) ^ x✝⁴))
[PROOFSTEP]
refine MeasurableSet.iInter fun _ => ?_
[GOAL]
F : Type u_1
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f : ℝ → F
K✝ K : Set F
hK : IsComplete K
x✝⁵ x✝⁴ x✝³ : ℕ
x✝² : x✝³ ≥ x✝⁴
x✝¹ : ℕ
x✝ : x✝¹ ≥ x✝⁴
⊢ MeasurableSet (B f K ((1 / 2) ^ x✝³) ((1 / 2) ^ x✝¹) ((1 / 2) ^ x✝⁵))
[PROOFSTEP]
exact measurableSet_b
[GOAL]
F : Type u_1
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝ : CompleteSpace F
⊢ MeasurableSet {x | DifferentiableWithinAt ℝ f (Ici x) x}
[PROOFSTEP]
have : IsComplete (univ : Set F) := complete_univ
[GOAL]
F : Type u_1
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝ : CompleteSpace F
this : IsComplete univ
⊢ MeasurableSet {x | DifferentiableWithinAt ℝ f (Ici x) x}
[PROOFSTEP]
convert measurableSet_of_differentiableWithinAt_Ici_of_isComplete f this
[GOAL]
case h.e'_3.h.e'_2.h.a
F : Type u_1
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝ : CompleteSpace F
this : IsComplete univ
x✝ : ℝ
⊢ DifferentiableWithinAt ℝ f (Ici x✝) x✝ ↔ DifferentiableWithinAt ℝ f (Ici x✝) x✝ ∧ derivWithin f (Ici x✝) x✝ ∈ univ
[PROOFSTEP]
simp
[GOAL]
F : Type u_1
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝² : CompleteSpace F
inst✝¹ : MeasurableSpace F
inst✝ : BorelSpace F
⊢ Measurable fun x => derivWithin f (Ici x) x
[PROOFSTEP]
refine' measurable_of_isClosed fun s hs => _
[GOAL]
F : Type u_1
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝² : CompleteSpace F
inst✝¹ : MeasurableSpace F
inst✝ : BorelSpace F
s : Set ((fun x => F) 1)
hs : IsClosed s
⊢ MeasurableSet ((fun x => derivWithin f (Ici x) x) ⁻¹' s)
[PROOFSTEP]
have :
(fun x => derivWithin f (Ici x) x) ⁻¹' s =
{x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ s} ∪
{x | ¬DifferentiableWithinAt ℝ f (Ici x) x} ∩ {_x | (0 : F) ∈ s} :=
Set.ext fun x => mem_preimage.trans derivWithin_mem_iff
[GOAL]
F : Type u_1
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝² : CompleteSpace F
inst✝¹ : MeasurableSpace F
inst✝ : BorelSpace F
s : Set ((fun x => F) 1)
hs : IsClosed s
this :
(fun x => derivWithin f (Ici x) x) ⁻¹' s =
{x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ s} ∪
{x | ¬DifferentiableWithinAt ℝ f (Ici x) x} ∩ {_x | 0 ∈ s}
⊢ MeasurableSet ((fun x => derivWithin f (Ici x) x) ⁻¹' s)
[PROOFSTEP]
rw [this]
[GOAL]
F : Type u_1
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝² : CompleteSpace F
inst✝¹ : MeasurableSpace F
inst✝ : BorelSpace F
s : Set ((fun x => F) 1)
hs : IsClosed s
this :
(fun x => derivWithin f (Ici x) x) ⁻¹' s =
{x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ s} ∪
{x | ¬DifferentiableWithinAt ℝ f (Ici x) x} ∩ {_x | 0 ∈ s}
⊢ MeasurableSet
({x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ s} ∪
{x | ¬DifferentiableWithinAt ℝ f (Ici x) x} ∩ {_x | 0 ∈ s})
[PROOFSTEP]
exact
(measurableSet_of_differentiableWithinAt_Ici_of_isComplete _ hs.isComplete).union
((measurableSet_of_differentiableWithinAt_Ici _).compl.inter (MeasurableSet.const _))
[GOAL]
F : Type u_1
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝¹ : CompleteSpace F
inst✝ : SecondCountableTopology F
⊢ StronglyMeasurable fun x => derivWithin f (Ici x) x
[PROOFSTEP]
borelize F
[GOAL]
F : Type u_1
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝¹ : CompleteSpace F
inst✝ : SecondCountableTopology F
this✝¹ : MeasurableSpace F := borel F
this✝ : BorelSpace F
⊢ StronglyMeasurable fun x => derivWithin f (Ici x) x
[PROOFSTEP]
exact (measurable_derivWithin_Ici f).stronglyMeasurable
[GOAL]
F : Type u_1
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝ : CompleteSpace F
⊢ MeasurableSet {x | DifferentiableWithinAt ℝ f (Ioi x) x}
[PROOFSTEP]
simpa [differentiableWithinAt_Ioi_iff_Ici] using measurableSet_of_differentiableWithinAt_Ici f
[GOAL]
F : Type u_1
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝² : CompleteSpace F
inst✝¹ : MeasurableSpace F
inst✝ : BorelSpace F
⊢ Measurable fun x => derivWithin f (Ioi x) x
[PROOFSTEP]
simpa [derivWithin_Ioi_eq_Ici] using measurable_derivWithin_Ici f
[GOAL]
F : Type u_1
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝¹ : CompleteSpace F
inst✝ : SecondCountableTopology F
⊢ StronglyMeasurable fun x => derivWithin f (Ioi x) x
[PROOFSTEP]
borelize F
[GOAL]
F : Type u_1
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
f : ℝ → F
K : Set F
inst✝¹ : CompleteSpace F
inst✝ : SecondCountableTopology F
this✝¹ : MeasurableSpace F := borel F
this✝ : BorelSpace F
⊢ StronglyMeasurable fun x => derivWithin f (Ioi x) x
[PROOFSTEP]
exact (measurable_derivWithin_Ioi f).stronglyMeasurable
|
module Simplicity
-- Simplicity, based on https://blockstream.com/simplicity.pdf
data Ty = One | Sum Ty Ty | Prod Ty Ty
interpTy : Ty -> Type
interpTy One = Unit
interpTy (Sum x y) = Either (interpTy x) (interpTy y)
interpTy (Prod x y) = ((interpTy x), (interpTy y))
data Term : Ty -> Ty -> Type where
Iden : Term a a
Comp : Term a b -> Term b c -> Term a c
Unit : Term a One
InjL : Term a b -> Term a (Sum b c)
InjR : Term a c -> Term a (Sum b c)
Case : Term (Prod a c) d -> Term (Prod b c) d -> Term (Prod (Sum a b) c) d
Pair : Term a b -> Term a c -> Term a (Prod b c)
Take : Term a c -> Term (Prod a b) c
Drop : Term b c -> Term (Prod a b) c
eval : Term a b -> interpTy a -> interpTy b
eval Iden = \a => a
eval (Comp x y) = \a => eval y (eval x a)
eval Unit = \_ => ()
eval (InjL x) = \a => Left (eval x a)
eval (InjR x) = \a => Right (eval x a)
eval (Case x y) = \(ab, c) => case ab of
Left l => eval x (l, c)
Right r => eval y (r, c)
eval (Pair x y) = \a => ((eval x a), (eval y a))
eval (Take x) = \(a, b) => eval x a
eval (Drop x) = \(a, b) => eval x b
Bit : Ty
Bit = Sum One One
not : Term Bit Bit
not = Comp (Pair Iden Unit) (Case (InjR Unit) (InjL Unit))
not' : interpTy Bit -> interpTy Bit
not' b = eval not b
zero : interpTy Bit
zero = Left ()
one : interpTy Bit
one = Right ()
test : interpTy Bit
test = not' zero
|
import discord
from selenium import webdriver
from bs4 import BeautifulSoup
import bs4
from urllib.request import urlopen
import urllib
import urllib.request
import os
import requests
import sys
import io
import random
from googletrans import Translator
import time
import re
import subprocess
import pandas as pd
import ssl
import datetime
from collections import Counter
from gensim.summarization.summarizer import summarize
import numpy as np
from newspaper import Article
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding='utf-8')
def main():
app = discord.Client()
@app.event
async def on_ready():
print('Logged in as')
print(app.user.name)
print(app.user.id)
print('+++++++++++++')
await app.change_presence(game=discord.Game(name='크롤링', type=1))
@app.event
async def on_reaction_add(reaction, user):
channel = reaction.message.channel
await app.send_message(channel,
'{}가 {}에 {} 이모지를 달았습니다.'.format(user.name, reaction.message.content, reaction.emoji))
@app.event
async def on_reaction_remove(reaction, user):
channel = reaction.message.channel
await app.send_message(channel,
'{}가 {}에 {} 이모지를 제거'.format(user.name, reaction.message.content, reaction.emoji))
# ㅇㅇㅇ
@app.event
async def on_message(message):
####봇 dm 테스트코드
if message.content.startswith('whoami'):
user_id = message.author.id
user_name = message.author.name
txt = '{} {}'.format(user_id, user_name)
await app.send_message(message.channel, txt)
if message.content.startswith('!제어'):
user_id = message.author.id
sentence = message.content.split(' ')
word = ''.join(sentence[1:])
if user_id == '123456789':
# bot_developer_id
if word == 'pwd':
n_dir = os.getcwd()
await app.send_message(message.channel, n_dir)
elif word == 'll':
f = open('output.txt', 'w')
output = subprocess.check_output(['ls -alh'], shell=True, encoding='utf-8')
f.write(output)
f.close()
embed = discord.Embed(
title='ls -alh',
color=discord.Color.red())
with open('output.txt') as t:
for i in t:
embed.add_field(name='결과', value='{}\n'.format(i))
await app.send_message(message.channel, embed=embed)
else:
await app.send_message(message.channel, 'permission denied')
if message.content.startswith('!기억'):
m_sentence = message.content.split(' ')
memories = ' '.join(m_sentence[1:])
u_id = message.author.id
m_file = open('memory.txt', 'a', encoding='utf8')
lines = u_id + ': ' + memories + '\n'
m_file.write(lines)
m_file.close()
await app.send_message(message.channel, 'ㅇㅋ')
if message.content.startswith('!망각'):
u_id = message.author.id
f = open('memory.txt', 'r')
lines = f.readlines()
f.close()
f = open('memory.txt', 'w')
for i in lines:
if u_id not in i:
f.write(i)
f.close()
await app.send_message(message.channel, '기억 삭제')
if message.content.startswith('!회상'):
u_id = message.author.id
embed = discord.Embed(
title='기억 목록',
color=discord.Color.red()
)
count = 1
with open('memory.txt') as f:
for i in f:
stat = i.split(': ')
s_ui = ''.join(stat[0])
s_tx = ' '.join(stat[1:])
if s_ui == u_id:
embed.add_field(name=str(count) + '.', value='{}'.format(s_tx))
count += 1
await app.send_message(message.author, embed=embed)
if message.content.startswith('!') and message.content.endswith('연차'):
try:
playgames = message.content[1:-2]
if int(playgames) >= 1001:
await app.send_message(message.channel,'도박문제 전화상담 서비스(국번 없이 ☎1336)')
else:
g_point = 0
player_name = message.author.name
gotcha = np.random.choice(3, int(playgames), p=[0.01, 0.2, 0.79])
embed = discord.Embed(
title='{}의 {}연차'.format(player_name, playgames),
color=discord.Color.dark_blue()
)
for i in gotcha:
if i == 1:
g_point += 2
elif i == 2:
g_point += 1
else:
g_point += 3
embed.add_field(name='결과',
value='1성:{}, 2성:{}, 3성:{}\n가챠포인트:{}'.format(Counter(gotcha)[2], Counter(gotcha)[1],
Counter(gotcha)[0], g_point))
gotcha_per = int(Counter(gotcha)[0]) / int(playgames) * 100
if gotcha_per >= 2.0:
await app.send_message(message.channel, embed=embed)
await app.send_file(message.channel, fp='img_con/icon_96.png')
else:
await app.send_message(message.channel, embed=embed)
gotcha_ran = ['img_con/icon_55.png', 'img_con/icon_22.png', 'img_con/icon_58.png']
await app.send_file(message.channel, fp=random.choice(gotcha_ran))
except:
await app.send_message(message.channel, 'command not found')
if message.content.startswith('!이마트'):
sentence = message.content.split(' ')
mart = ' '.join(sentence[1:])
f = open('emart.txt', 'r')
line = f.read().splitlines()
for i in line:
stat = i.split(' ')
if mart in stat and len(stat) == 2:
await app.send_message(message.channel, '점포명:{} 영업여부:{}'.format(stat[0], stat[-1]))
elif mart in stat and len(stat) == 3:
await app.send_message(message.channel, '점포명:{} 영업여부:{}'.format(stat[0] + stat[1], stat[-1]))
# 네이버 뉴스 사회면 출력
if message.content.startswith('!사회'):
embed = discord.Embed(
title='사회면 뉴스 순위',
color=discord.Color.red()
)
html = urllib.request.urlopen('https://news.naver.com/main/main.nhn?mode=LSD&mid=shm&sid1=102')
news_url = 'https://news.naver.com'
soup = BeautifulSoup(html, 'lxml')
news1 = soup.find('div', {'id': 'ranking_102'})
news2 = news1.find('ul', 'section_list_ranking')
news3 = news2.find_all('a', "nclicks(rig.ranksoc)")
count = 1
for i in news3:
re_title = i.text
news_href = i.get('href')
embed.add_field(name=str(count) + '위: ', value='[%s](<%s>)' % (re_title, news_url + news_href))
count += 1
await app.send_message(message.channel, embed=embed)
if message.content.startswith('!요약'):
sentence = message.content.split(' ')
txt_url = ''.join(sentence[1])
news = Article(txt_url, language='ko')
news.download()
news.parse()
embed = discord.Embed(
title='url의 텍스트를 요약',
color=discord.Color.dark_purple()
)
text_summ = summarize(news.text, word_count=50)
embed.add_field(name='요약', value='[%s](<%s>)' % (text_summ, txt_url))
await app.send_message(message.channel, embed=embed)
if message.content.startswith('!주사위'):
number = message.content.split(' ')
dice_num = int(number[1])
dice = []
for i in range(1, dice_num + 1):
dice.append(random.randint(1, 6))
await app.send_message(message.channel, dice)
if message.content.startswith('!다나와'):
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--disable--gpu')
options.add_argument('–no-sandbox')
chromedriver_dir = r'chromedriver_ver/linux/chromedriver'
driver = webdriver.Chrome(chromedriver_dir, chrome_options=options)
sentence = message.content.split(' ')
word = ' '.join(sentence[1:])
s_word = urllib.parse.quote(word)
driver.get('http://search.danawa.com/dsearch.php?k1=' + s_word + '&module=goods&act=dispMain')
time.sleep(3)
source = driver.page_source
soup = bs4.BeautifulSoup(source, 'lxml')
stat = soup.find_all('p', 'prod_name')
price_stat = soup.find_all('p', 'price_sect')
driver.quit()
embed = discord.Embed(
title='다나와 ' + word + ' 검색결과',
color=discord.Color.dark_purple()
)
count = 1
for i, k in zip(stat, price_stat):
title = i.text.strip()
price = k.find('a').text.strip()
embed.add_field(name=str(count) + '.', value='{}\n{}'.format(title, price))
count += 1
if count == 7:
break
await app.send_message(message.channel, embed=embed)
if message.content.startswith('!유튭'):
sentence = message.content.split(' ')
word = ' '.join(sentence[1:])
search_word = urllib.parse.quote(word)
html = urllib.request.urlopen('https://www.youtube.com/results?search_query=' + search_word)
soup = BeautifulSoup(html, 'lxml')
tt = soup.find('ol', 'item-section')
stat = tt.find_all('h3', 'yt-lockup-title')
embed = discord.Embed(
title='유튜브 검색결과',
color=discord.Color.blue()
)
count = 1
for i in stat:
url = 'https://www.youtube.com'
tx = i.text
tx = tx.split(' ')[:-3]
ti = ' '.join(tx)
link = i.find('a').get('href')
embed.add_field(name=str(count) + '.', value='[%s](<%s>)' % (ti, url + link))
count += 1
if count == 6:
break
await app.send_message(message.channel, embed=embed)
if message.content.startswith('!파파고'):
sentence = message.content.split(' ')
trans_text = ''.join(sentence[1:])
request_url = "https://openapi.naver.com/v1/papago/n2mt"
headers = {"X-Naver-Client-Id": "123456789", "X-Naver-Client-Secret": "12345678"} # personal_token
params = {"source": "ko", "target": "en", "text": trans_text}
response = requests.post(request_url, headers=headers, data=params)
result = response.json()
await app.send_message(message.channel, result['message']['result']['translatedText'])
if message.content.startswith('!번역'):
sentence = message.content.split(' ')
convert_sentence = ' '.join(sentence[1:])
translator = Translator()
if translator.detect(convert_sentence).lang != 'ko':
result = translator.translate(convert_sentence, dest='ko').text
await app.send_message(message.channel, result)
if translator.detect(convert_sentence).lang == 'ko':
result = translator.translate(convert_sentence, dest='en').text
await app.send_message(message.channel, result)
if message.content.startswith('!날씨'):
try:
sentence = message.content.split(' ')
area = ' '.join(sentence[1:])
location = urllib.parse.quote(area + '+날씨')
html = urllib.request.urlopen(
'https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=' + location)
soup = BeautifulSoup(html, 'lxml')
area_loca = soup.find('div', 'select_box').find('em').text
embed = discord.Embed(
title=area_loca + '의 날씨정보',
color=discord.Color.blue()
)
# ------오늘 날씨 정보------------
today_weather = soup.select(
'#main_pack > div.sc.cs_weather._weather > div:nth-child(2) > div.weather_box > div.weather_area._mainArea > div.today_area._mainTabContent > div.main_info')[
0]
today_dust_stat = soup.select(
'#main_pack > div.sc.cs_weather._weather > div:nth-child(2) > div.weather_box > div.weather_area._mainArea > div.today_area._mainTabContent > div.sub_info > div > dl')[
0]
today_temp = today_weather.find('span', 'todaytemp').text
today_stat = today_weather.find('p', 'cast_txt').text
skin_temp = today_weather.find('span', 'sensible').find('span', 'num').text
# ------내일 날씨 정보------------
tomm_weather = soup.select(
'#main_pack > div.sc.cs_weather._weather > div:nth-child(2) > div.weather_box > div.weather_area._mainArea > div:nth-child(4)')[
0]
temp_am, temp_pm = tomm_weather.find_all('span', 'todaytemp')
air_am, air_pm = tomm_weather.find_all('p', 'cast_txt')
# ------언패킹 오류 발생 위치-----
try:
t_dust = today_dust_stat.find_all('dd')
mise, c_mise, o_z = t_dust
mise_am, mise_pm = tomm_weather.find_all('div', 'detail_box')
except ValueError:
embed.add_field(name='오늘',
value='현재온도 : {}도, 체감온도 : {}도\n{}'.format(today_temp, skin_temp, today_stat))
embed.add_field(name='내일', value='오전온도 : {}도, {}\n오후온도 : {}도, {}'.format(temp_am.text, air_am.text,
temp_pm.text.strip(),
air_pm.text))
else:
embed.add_field(name='오늘',
value='현재온도 : {}도, 체감온도 : {}도\n{}\n미세먼지 : {}\n초미세먼지 : {}'.format(today_temp,
skin_temp,
today_stat,
mise.text,
c_mise.text))
embed.add_field(name='내일',
value='오전온도 : {}도, {}\n{}\n오후온도 : {}도, {}\n{}'.format(temp_am.text, air_am.text,
mise_am.text.strip(),
temp_pm.text.strip(),
air_pm.text,
mise_pm.text.strip()))
await app.send_message(message.channel, embed=embed)
if float(skin_temp) >= 30.0 and float(skin_temp) < 35.0:
await app.send_file(message.channel, fp='img_con/icon_49.png')
elif float(skin_temp) >= 35.0:
await app.send_file(message.channel, fp='img_con/icon_38.gif')
except:
await app.send_message(message.channel, 'command not found')
if message.content.startswith("!주간날씨"):
try:
sentence = message.content.split(' ')
area = sentence[1]
location = urllib.parse.quote(area + '+날씨')
html = urllib.request.urlopen(
'https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=' + location)
soup = BeautifulSoup(html, 'lxml')
title = soup.find('div', 'select_box').find('em')
week = soup.find_all('li', 'date_info')
embed = discord.Embed(
title=title.text + '의 주간 날씨 정보',
color=discord.Color.blue()
)
for i in week:
day = i.find('span', 'day_info').text
am = i.find('span', 'point_time morning').text.strip()
pm = i.find('span', 'point_time afternoon').text.strip()
temp = i.find('dd').text
embed.add_field(name=day, value='오전:{}\n오후:{}\n{}'.format(am, pm, temp))
await app.send_message(message.author, embed=embed)
except:
await app.send_message(message.channel, 'command not found')
if message.content.startswith('!세계날씨'):
try:
sentence = message.content.split(' ')
out_area = ''.join(sentence[1:])
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
base_url = 'https://www.google.com/search?ei=2FIQXbn7OIuU8wXRtonYCA&q=' + out_area + '+날씨'
html = requests.get(base_url, headers=headers).text
soup = BeautifulSoup(html, 'lxml')
stat = soup.find_all('div', 'vk_c card-section')
for i in stat:
location = i.find('div', 'vk_gy vk_h').text.strip()
loca_time = i.find('div', 'vk_gy vk_sh').text.strip()
air = i.find('span', {'id': 'wob_dc'}).text.strip()
temp = i.find('span', {'id': 'wob_ttm'}).text.strip()
air_s = i.find_all('div', 'vk_gy vk_sh wob-dtl')
for k in air_s:
rain = k.find('span', {'id': 'wob_pp'}).text.strip()
wet = k.find('span', {'id': 'wob_hm'}).text.strip()
wind = k.find('span', 'wob_t').text.strip()
embed = discord.Embed(
title=location + '의 날씨정보',
color=discord.Color.blue()
)
embed.add_field(name=loca_time,
value='현재온도: {}도 , {}\n강수확률: {}\n습도: {} 풍속: {}'.format(temp, air, rain, wet, wind))
await app.send_message(message.channel, embed=embed)
if int(temp) >= 30 and int(temp) <= 34:
await app.send_file(message.channel, fp='img_con/icon_49.png')
elif int(temp) >= 35:
await app.send_file(message.channel, fp='img_con/icon_38.gif')
except:
await app.send_message(message.channel, 'command not found')
if message.content.startswith('!영화'):
sentence = message.content.split(' ')
word = sentence[1]
if word == '예정':
embed = discord.Embed(
title='영화개봉예정',
color=discord.Color.dark_orange()
)
html = urllib.request.urlopen('https://movie.naver.com/movie/running/premovie.nhn')
soup = BeautifulSoup(html, 'lxml')
name = soup.find_all('dl', 'lst_dsc')
for i in name:
c_name = i.find('a').text
c_kind = i.find('span', 'link_txt').text
c_kind = ''.join(c_kind.split())
embed.add_field(name='{}'.format(c_name), value='{}'.format(c_kind))
await app.send_message(message.channel, embed=embed)
if word == '상영중':
embed = discord.Embed(
title='상영중인 영화',
color=discord.Color.dark_orange()
)
html = urllib.request.urlopen('https://movie.naver.com/movie/running/current.nhn')
soup = BeautifulSoup(html, 'lxml')
pre_order = soup.find_all('div', 'star_t1 b_star')
title = soup.find_all('dt', 'tit')
count = 1
for i, k in zip(title, pre_order):
order_per = k.text.strip()
order_title = i.find('a').text
embed.add_field(name=str(count) + '번쨰', value='{}\n예매율: {}'.format(order_title, order_per))
count += 1
if count == 6:
break
await app.send_message(message.channel, embed=embed)
if message.content.startswith('!예매'):
try:
# str = '!예매 청주 목록'
dt = datetime.datetime.now()
today_time = dt.strftime('%Y%m%d')
sentence = message.content.split(' ')
user_loca = ''.join(sentence[1])
user_word = ''.join(sentence[2:])
data = {'title': [], 'link': []}
df = pd.DataFrame(data)
f = open('cgv_code.txt', 'r')
embed = discord.Embed(
title=user_loca,
color=discord.Color.blue()
)
while True:
line = f.readline()
if not line:
break
re_line = line.split('//')
data['title'].append(re_line[0][3:])
data['link'].append(re_line[1][8:] + today_time)
df = pd.DataFrame(data)
base_url = 'http://www.cgv.co.kr/common/showtimes/iframeTheater.aspx'
cgv_url = 'http://www.cgv.co.kr'
for q, w in zip(df['title'], df['link']):
if user_loca == q:
base_url = base_url + w
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
html = requests.get(base_url, headers=headers).text
soup = BeautifulSoup(html, 'lxml')
stat = soup.find_all('div', 'col-times')
cgv_data = {'movie': [], 'time': [], 'link': []}
cgv_df = pd.DataFrame(cgv_data)
for i in stat:
title = i.find('div').find('a').text.strip()
time_table = i.find_all('div', 'type-hall')
for k in time_table:
t_d = k.find('div', 'info-timetable').text.strip()
try:
link = k.find('div', 'info-timetable').find('a').get('href')
except AttributeError:
continue
cgv_data['movie'].append(title)
cgv_data['time'].append(t_d)
cgv_data['link'].append(link)
cgv_df = pd.DataFrame(cgv_data)
if user_word == '목록':
count = 1
re_df = cgv_df.drop_duplicates(['movie'], keep='first')
for re_title, re_link in zip(re_df['movie'], re_df['link']):
d_link = '[%s](<%s>)' % (re_title, cgv_url + re_link)
embed.add_field(name=str(count) + '.', value='{}'.format(d_link))
count += 1
await app.send_message(message.channel, embed=embed)
else:
await app.send_message(message.channel, 'command not found')
except:
await app.send_message(message.channel, 'command not found')
if message.content.startswith('!환전'):
try:
sentence = message.content.split(' ')
word = ''.join(sentence[1:])
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
# h_word = urllib.parse.quote(word)
url = 'https://www.google.co.kr/search?biw=531&bih=592&ei=YTQHXd7ZOJHm8wXhqrWQCA&q=' + word
html = requests.get(url, headers=headers).text
soup = BeautifulSoup(html, 'lxml')
h_result = soup.find('div', 'dDoNo vk_bk gsrt')
result = h_result.text.split(' ')
await app.send_message(message.channel, result[0][:-3] + sentence[2])
except:
await app.send_message(message.channel, 'command not found')
if message.content.startswith('!계산'):
sentence = message.content.split(' ')
word = ''.join(sentence[1:])
n_word = urllib.parse.quote(word)
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
url = 'https://www.google.com/search?q=' + n_word
html = requests.get(url, headers=headers).text
soup = BeautifulSoup(html, 'lxml')
n_result = soup.find('span', 'cwcot gsrt').text.strip()
await app.send_message(message.channel, n_result)
if message.content.startswith('!환율'):
try:
sentence = message.content.split(' ')
user_input = sentence[1]
p_word = urllib.parse.quote(user_input)
embed = discord.Embed(
title='실시간 환율',
color=discord.Color.blue()
)
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
url = 'https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=' + p_word + '+환율'
html = requests.get(url, headers=headers).text
soup = BeautifulSoup(html, 'lxml')
stat = soup.find_all('div', 'rate_tlt')
for i in stat:
price = i.find('span', 'spt_con').text.strip().split(' ')
embed.add_field(name=user_input + '의 환율 정보',
value='{}\n{} {}'.format(price[0][2:], price[2], price[3]))
await app.send_message(message.channel, embed=embed)
except:
await app.send_message(message.channel, 'command not found')
if message.content.startswith('!증시'):
sentence = message.content.split(' ')
n_word = ''.join(sentence[1:])
h_url = 'https://www.wpws.kr/hangang/'
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
h_html = requests.get(h_url, headers=headers).text
h_soup = BeautifulSoup(h_html, 'lxml')
w_stat = h_soup.find('p', {'id': 'temp'}).text
url = 'https://finance.naver.com/sise/'
base_url = 'https://finance.naver.com'
context = ssl._create_unverified_context()
html = urlopen(url, context=context)
soup = BeautifulSoup(html.read(), 'lxml')
if n_word == '해외':
embed = discord.Embed(
title='주요 해외 증시',
color=discord.Color.dark_orange()
)
url = 'http://finance-service.daum.net/global/index.daum'
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
html = requests.get(url, headers=headers).text
soup = BeautifulSoup(html, 'lxml')
stat = soup.select('#worldInfo')[0]
i_title = stat.find_all('li')
for i in i_title:
aa = re.sub('<.+?>', ' ', str(i)).strip().split(' ')
embed.add_field(name=aa[0], value='{} {} {}'.format(aa[1], aa[2], aa[3]))
await app.send_message(message.channel, embed=embed)
if n_word == '주요':
embed = discord.Embed(
title='{}\n{}: {}'.format('주요 국내 증시', '현재 한강 수온', w_stat),
color=discord.Color.dark_orange()
)
k_stat = soup.find('div', 'lft')
kos_price = k_stat.find_all('span', 'num')
kos_stat = k_stat.find_all('span', 'num_s')
kos = ['코스피', '코스닥', '코스피200']
for a, b, c, in zip(kos_price, kos_stat, kos):
n_p = a.text
n_s = b.text
n_n = c
embed.add_field(name=n_n, value='{}\n{}'.format(n_p, n_s))
await app.send_message(message.channel, embed=embed)
if n_word == '유가':
embed = discord.Embed(
title='국내외 유가',
color=discord.Color.dark_orange()
)
url = 'https://finance.naver.com/marketindex/?tabSel=gold#tab_section'
context = ssl._create_unverified_context()
html = urlopen(url, context=context)
soup = BeautifulSoup(html.read(), 'lxml')
stat = soup.find('table', 'tbl_exchange').find_all('tr')
for i in stat:
try:
oil_name = i.find('a').text
price = i.find_all('td', 'num')
n, y, p = price
unit = i.find('td', 'unit').text
y_stat = i.find('img').get('alt')
except AttributeError:
continue
embed.add_field(name=oil_name,
value='현재가: {}{}\n전일비: {} 등락율: {}\n{}'.format(n.text, unit, y.text, p.text, y_stat))
await app.send_message(message.channel, embed=embed)
if n_word == '인기':
embed = discord.Embed(
title='인기 검색 종목',
color=discord.Color.dark_orange()
)
stat = soup.find('ul', 'lst_pop').find_all('li')
count = 1
for i in stat:
n_title = i.find('a').text
n_href = i.find('a').get('href')
price = i.find('span').text
link = base_url + n_href
title = '[%s](<%s>)' % (n_title, link)
embed.add_field(name=str(count) + '위', value='{}\n{}원'.format(title, price))
count += 1
await app.send_message(message.channel, embed=embed)
if message.content.startswith('!해축'):
embed = discord.Embed(
title='해축 정보',
color=discord.Color.dark_orange()
)
sentence = message.content.split(' ')
word = ''.join(sentence[1:])
html = urllib.request.urlopen('https://sports.news.naver.com/wfootball/index.nhn')
soup = BeautifulSoup(html, 'lxml')
base_url = 'https://sports.news.naver.com'
if word == '주요':
s_count = 1
stat = soup.find('div', 'home_news').find_all('li')
for i in stat:
title = i.find('a').text.strip()
link = i.find('a').get('href')
i_s_n = '[%s](<%s>)' % (title, base_url + link)
embed.add_field(name=str(s_count) + '.', value='{}'.format(i_s_n))
s_count += 1
await app.send_message(message.channel, embed=embed)
else:
await app.send_message(message.channel, 'command not found')
if message.content.startswith('!남대문'):
embed = discord.Embed(
title='위스키 판매 목록',
color=discord.Color.red()
)
sentence = message.content.split(' ')
w_name = ''.join(sentence[1:])
df = pd.read_csv('new_namdeon_list.csv')
for a, b, c, d, e, k, q in zip(df['title'], df['price'], df['year'], df['cask'], df['seller'], df['date'],
df['ml']):
try:
if w_name in a:
embed.add_field(name='{} {}({})\n{}원'.format(a, c, d, int(float(b))),
value='{} {} {}'.format(e, q, k))
except:
continue
await app.send_message(message.channel, embed=embed)
# w_dict= {}
# for i in sheet1.iter_rows(min_row=3):
# title = i[1].value
# price = i[4].value
# w_dict[title]=price
if message.content.startswith('!스팀'):
embed = discord.Embed(
title='스팀 특별할인 목록',
color=discord.Color.green()
)
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
url = 'https://store.steampowered.com/search/?specials=1&os=win'
html = requests.get(url, headers=headers).text
soup = BeautifulSoup(html, 'lxml')
stat = soup.find_all('div', 'responsive_search_name_combined')
game_page = soup.find('div', {'id': 'search_results'})
game_stat = game_page.find('div', {'id': 'search_result_container'})
link = game_stat.find_all('a')
count = 1
for i, k in zip(stat, link):
try:
title = i.find('div', 'col search_name ellipsis').text.strip()
price = i.find('div', 'col search_price discounted responsive_secondrow').text.strip().split('$')
per = i.find('div', 'col search_discount responsive_secondrow').text.strip()
g_link = k.get('href')
url = '[%s](<%s>)' % (title, g_link)
except AttributeError:
continue
embed.add_field(name=str(count) + '.',
value=url + '\n''정가:{} , 할인가:{}\n할인률:{}'.format('~~' + '$' + price[1] + '~~',
'$' + price[2], per))
count += 1
await app.send_message(message.channel, embed=embed)
token = '1234567890'
# personal_token_value
app.run(token)
if __name__ == '__main__':
main()
|
using Plots, HDF5
@testset "HDF5_Plots" begin
fname = "tmpplotsave.hdf5"
hdf5()
x = 1:10
psrc = plot(x, x .* x) #Create some plot
Plots.hdf5plot_write(psrc, fname)
#Read back file:
gr() #Choose some fast backend likely to work in test environment.
pread = Plots.hdf5plot_read(fname)
#Make sure data made it through:
@test psrc.subplots[1].series_list[1][:x] == pread.subplots[1].series_list[1][:x]
@test psrc.subplots[1].series_list[1][:y] == pread.subplots[1].series_list[1][:y]
#display(pread) #Don't display. Regression env might not support
end #testset
|
module IrrelevantRecordField where
import Common.Irrelevance
record R (A : Set) : Set where
constructor inn
field
.out : A
proj : {A : Set} -> R A -> A
proj (inn a) = a
-- needs to fail, since a is irrelevant under inn |
/*
* Copyright (c) 2013-2014 Nicholas Corgan ([email protected])
*
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
* or copy at http://opensource.org/licenses/MIT)
*/
#ifndef INCLUDED_BASE_POKEMON_IMPL_HPP
#define INCLUDED_BASE_POKEMON_IMPL_HPP
//For code cleanliness in source file
#define ICON_PATH(name) fs::path(fs::path(_icon_dir) / name)
#define FEMALE_ICON_PATH(name) fs::path(fs::path(_icon_dir) / "female" / name)
#define SPRITE_PATH(name) fs::path(fs::path(_sprite_dir) / name)
#define SHINY_SPRITE_PATH(name) fs::path(fs::path(_shiny_sprite_dir) / name)
#define FEMALE_SPRITE_PATH(name) fs::path(fs::path(_sprite_dir) / "female" / name)
#define FEMALE_SHINY_SPRITE_PATH(name) fs::path(fs::path(_shiny_sprite_dir) / "female" / name)
#define SET_IMAGES_PATHS(filename) _male_icon_path = ICON_PATH(filename); \
_female_icon_path = _male_icon_path; \
_male_sprite_path = SPRITE_PATH(filename); \
_female_sprite_path = _male_sprite_path; \
_male_shiny_sprite_path = SHINY_SPRITE_PATH(filename); \
_female_shiny_sprite_path = _male_sprite_path;
#define SET_POKEBALL_IMAGE() _male_icon_path = fs::path(_images_dir / "misc" / "pokeball.png"); \
_female_icon_path = _male_icon_path; \
_male_sprite_path = fs::path(_images_dir / "misc" / "pokeball.png"); \
_female_sprite_path = _female_icon_path; \
_male_shiny_sprite_path = _male_sprite_path; \
_female_shiny_sprite_path = _female_sprite_path;
#define SET_SUBSTITUTE_IMAGE() _male_icon_path = _male_icon_path = SPRITE_PATH("substitute.png"); \
_female_icon_path = _male_icon_path; \
_male_sprite_path = SPRITE_PATH("substitute.png"); \
_female_sprite_path = _female_icon_path; \
_male_shiny_sprite_path = _male_sprite_path; \
_female_shiny_sprite_path = _female_sprite_path;
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <pkmn/base_pokemon.hpp>
#include "SQLiteCpp/SQLiteC++.h"
namespace pkmn
{
class base_pokemon_impl: public base_pokemon
{
public:
base_pokemon_impl(unsigned int species_id, unsigned int game_id);
//Game-specific info
std::string get_game() const;
unsigned int get_generation() const;
//Non-Battle Attributes
std::string get_name() const;
std::string get_species() const;
unsigned int get_pokedex_num() const;
std::string get_pokedex_entry() const;
string_pair_t get_types() const;
double get_height() const;
double get_weight() const;
void get_evolutions(base_pokemon_vector& evolution_vec) const;
bool is_fully_evolved() const;
//Battle Stats
unsigned int get_exp_yield() const;
//Forms
std::string get_form() const;
//Database Info
unsigned int get_pokemon_id() const;
unsigned int get_species_id() const;
unsigned int get_game_id() const;
unsigned int get_form_id() const;
protected:
void _get_evolution_ids(std::vector<unsigned int> &id_vec) const;
virtual void _set_old_values();
unsigned int _generation, _form_id, _pokemon_id, _species_id, _type1_id, _type2_id;
unsigned int _hp, _attack, _defense, _speed, _special, _special_attack, _special_defense;
unsigned int _game_id;
std::string _images_default_basename, _images_game_string, _images_gen_string;
boost::filesystem::path _images_dir, _icon_dir;
boost::filesystem::path _sprite_dir, _shiny_sprite_dir;
boost::filesystem::path _male_icon_path, _female_icon_path;
boost::filesystem::path _male_sprite_path, _female_sprite_path;
boost::filesystem::path _male_shiny_sprite_path, _female_shiny_sprite_path;
static pkmn::shared_ptr<SQLite::Database> _db;
static boost::format _png_format;
};
}
#endif /* INCLUDED_BASE_POKEMON_IMPL_HPP */
|
-- --------------------------------------------------------------- [ Utils.idr ]
-- Module : Utils.idr
-- Copyright : (c) Jan de Muijnck-Hughes
-- License : see LICENSE
-- --------------------------------------------------------------------- [ EOH ]
module Text.Markup.Edda.Process.Utils
import Data.AVL.Dict
%default total
%access export
lookupType : Dict String String -> Maybe String
lookupType = lookup "type"
lookupSrcLang : Dict String String -> Maybe String
lookupSrcLang = lookup "src_lang"
lookupSrcOpts : Dict String String -> Maybe String
lookupSrcOpts = lookup "src_opts"
nubAttribute : String -> Dict String String -> Dict String String
nubAttribute key as = fromList $ doNub key (toList as)
where
doNub : String -> List (String, String) -> List (String, String)
doNub _ Nil = Nil
doNub key ((k,v)::xs) =
case key == k of
True => doNub key xs
False => (k,v) :: doNub key xs
-- --------------------------------------------------------------------- [ EOF ]
|
Googling Natalie will give you a small slice of the enormous influence she has had not only in Davis but from coast to coast....
Graduate of Marymount University Arlington, Virgina
Graduate of King Hall Law School Davis, California
Leadership Positions
Code Pink CoFounder of the Davis Chapter
ACLU Current Yolo County Chapter President and AtLarge Northern California Board Member
Progressive Coalition Coordinator
wiki:calbar:175705 CalBar Profile Admitted to the bar on 1995120.
|
lemma prime_factor_nat: "n \<noteq> (1::nat) \<Longrightarrow> \<exists>p. prime p \<and> p dvd n" |
# Extract Data from RBSN Stations:
# Address: http://reports.irimo.ir/jasperserver/login.html
# User Name: user
# Password: user
rm(list = ls())
# Load library:
library(dplyr)
library(ggplot2)
# Set Current Directori to RBSN_Data Folder:
setwd(dir = choose.dir(default = getwd(), caption = "Select RBSN Data Folder (*.csv): "))
# Read Data:
Data <- read.csv(file = "Mashhad_40745.csv", header = TRUE, skip = 2)
# Modified Data:
# remove X cloumn:
Data$X <- NULL
# remove empty rows:
Data <- Data[-which(x = Data$station_i == "" | Data$station_i == "station_i"), ]
# reset row names:
row.names(Data) <- NULL
# Remove "null", "nul" and "n" from Data:
Data[Data == "null"] <- NA
Data[Data == "n"] <- NA
Data[Data == "nul"] <- NA
# Reset Factor Level:
Data <- droplevels.data.frame(Data)
# Rename of date column:
colnames(Data)[5] <- "date"
# Change Class of date Cloumn:
Data$date <- as.POSIXct(x = as.character(x = Data$date), format = "%m/%d/%Y %H:%M")
# Change Class of Clumns:
Column.Names <- colnames(Data)[-c(1,5)]
for (ColName in Column.Names) {
eval(expr = parse(text = paste("Data$", ColName, " <- as.numeric(as.character(x = Data$",
ColName, "))", sep = "")))
}
# Group Date Variable into Day/Month/Year:
A <- Data %>%
mutate(month = format(x = date, "%m"), year = format(x = date, "%Y")) %>%
group_by(month, year) %>%
summarise(total = sum(rrr, na.rm = TRUE))
B <- Data %>%
mutate(year = format(x = date, "%Y")) %>%
group_by(year) %>%
summarise(total = sum(rrr, na.rm = TRUE))
# Order Data by the Year:
A <- A[order(A$year),]
A$date <- seq(from = as.Date("1951/01/01"), to = as.Date("2017/12/01"), by = "month")
B <- B[order(A$year),]
B$date <- seq(from = as.Date("1951/01/01"), to = as.Date("2017/12/01"), by = "year")
ggplot(data = B, mapping = aes(x = year, y = total, group = 1)) +
geom_point() +
geom_line(linetype = "dashed", color="red")
|
using BenhmarkTools
x = "id".*dec.(1:1_000_000, 10);
rx = rand(x, 100_000_000);
function fhash(z)
pz = z |> pointer |> Ptr{UInt}
h = pz |> unsafe_load |> hash
h1 = (pz + 8) |> unsafe_load |> hash
h * h1
end
@benchmark hash.($rx)
# BenchmarkTools.Trial:
# memory estimate: 762.94 MiB
# allocs estimate: 2
# --------------
# minimum time: 16.816 s (0.00% GC)
# median time: 16.816 s (0.00% GC)
# mean time: 16.816 s (0.00% GC)
# maximum time: 16.816 s (0.00% GC)
# --------------
# samples: 1
# evals/sample: 1
@benchmark fhash.($rx) # 8
@benchmark Base.crc32c.($rx)
a = (z->z |> pointer |> Ptr{UInt} |> unsafe_load).(rx)
fshash(z) = z |> pointer |> Ptr{UInt} |> unsafe_load |> hash
fshash1(z) = z |> pointer |> Ptr{UInt} |> unsafe_load
@benchmark fshash.($rx)
@benchmark fshash1.($rx)
@benchmark hash.($a)
@benchmark sort.(a)
@time aa = fshash1.(rx)
@benchmark sort($aa)
@benchmark sort($aa, alg=RadixSort) |
/-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen
-/
import algebra.algebra.basic
import algebra.order.field.inj_surj
/-!
# Subfields
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.
Let `K` be a field. This file defines the "bundled" subfield type `subfield K`, a type
whose terms correspond to subfields of `K`. This is the preferred way to talk
about subfields in mathlib. Unbundled subfields (`s : set K` and `is_subfield s`)
are not in this file, and they will ultimately be deprecated.
We prove that subfields are a complete lattice, and that you can `map` (pushforward) and
`comap` (pull back) them along ring homomorphisms.
We define the `closure` construction from `set R` to `subfield R`, sending a subset of `R`
to the subfield it generates, and prove that it is a Galois insertion.
## Main definitions
Notation used here:
`(K : Type u) [field K] (L : Type u) [field L] (f g : K →+* L)`
`(A : subfield K) (B : subfield L) (s : set K)`
* `subfield R` : the type of subfields of a ring `R`.
* `instance : complete_lattice (subfield R)` : the complete lattice structure on the subfields.
* `subfield.closure` : subfield closure of a set, i.e., the smallest subfield that includes the set.
* `subfield.gi` : `closure : set M → subfield M` and coercion `coe : subfield M → set M`
form a `galois_insertion`.
* `comap f B : subfield K` : the preimage of a subfield `B` along the ring homomorphism `f`
* `map f A : subfield L` : the image of a subfield `A` along the ring homomorphism `f`.
* `prod A B : subfield (K × L)` : the product of subfields
* `f.field_range : subfield B` : the range of the ring homomorphism `f`.
* `eq_locus_field f g : subfield K` : given ring homomorphisms `f g : K →+* R`,
the subfield of `K` where `f x = g x`
## Implementation notes
A subfield is implemented as a subring which is is closed under `⁻¹`.
Lattice inclusion (e.g. `≤` and `⊓`) is used rather than set notation (`⊆` and `∩`), although
`∈` is defined as membership of a subfield's underlying set.
## Tags
subfield, subfields
-/
open_locale big_operators
universes u v w
variables {K : Type u} {L : Type v} {M : Type w} [field K] [field L] [field M]
/-- `subfield_class S K` states `S` is a type of subsets `s ⊆ K` closed under field operations. -/
class subfield_class (S K : Type*) [field K] [set_like S K]
extends subring_class S K, inv_mem_class S K : Prop
namespace subfield_class
variables (S : Type*) [set_like S K] [h : subfield_class S K]
include h
/-- A subfield contains `1`, products and inverses.
Be assured that we're not actually proving that subfields are subgroups:
`subgroup_class` is really an abbreviation of `subgroup_with_or_without_zero_class`.
-/
@[priority 100] -- See note [lower instance priority]
instance subfield_class.to_subgroup_class : subgroup_class S K := { .. h }
variables {S}
instance (s : S) : has_rat_cast s :=
⟨λ x, ⟨↑x, coe_rat_mem s x⟩⟩
@[simp] lemma coe_rat_cast (s : S) (x : ℚ) : ((x : s) : K) = x := rfl
lemma rat_smul_mem (s : S) (a : ℚ) (x : s) : (a • x : K) ∈ s :=
by simpa only [rat.smul_def] using mul_mem (coe_rat_mem s a) x.prop
instance (s : S) : has_smul ℚ s :=
⟨λ a x, ⟨a • x, rat_smul_mem s a x⟩⟩
@[simp] lemma coe_rat_smul (s : S) (a : ℚ) (x : s) : (↑(a • x) : K) = a • x := rfl
variables (S)
/-- A subfield inherits a field structure -/
@[priority 75] -- Prefer subclasses of `field` over subclasses of `subfield_class`.
instance to_field (s : S) : field s :=
subtype.coe_injective.field (coe : s → K)
rfl rfl (λ _ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _ _, rfl)
(λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _, rfl) (λ _, rfl)
omit h
/-- A subfield of a `linear_ordered_field` is a `linear_ordered_field`. -/
@[priority 75] -- Prefer subclasses of `field` over subclasses of `subfield_class`.
instance to_linear_ordered_field {K} [linear_ordered_field K] [set_like S K]
[subfield_class S K] (s : S) :
linear_ordered_field s :=
subtype.coe_injective.linear_ordered_field coe
rfl rfl (λ _ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _ _, rfl)
(λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _, rfl) (λ _, rfl) (λ _ _, rfl)
(λ _ _, rfl)
end subfield_class
set_option old_structure_cmd true
/-- `subfield R` is the type of subfields of `R`. A subfield of `R` is a subset `s` that is a
multiplicative submonoid and an additive subgroup. Note in particular that it shares the
same 0 and 1 as R. -/
structure subfield (K : Type u) [field K] extends subring K :=
(inv_mem' : ∀ x ∈ carrier, x⁻¹ ∈ carrier)
/-- Reinterpret a `subfield` as a `subring`. -/
add_decl_doc subfield.to_subring
namespace subfield
/-- The underlying `add_subgroup` of a subfield. -/
def to_add_subgroup (s : subfield K) : add_subgroup K :=
{ ..s.to_subring.to_add_subgroup }
/-- The underlying submonoid of a subfield. -/
def to_submonoid (s : subfield K) : submonoid K :=
{ ..s.to_subring.to_submonoid }
instance : set_like (subfield K) K :=
⟨subfield.carrier, λ p q h, by cases p; cases q; congr'⟩
instance : subfield_class (subfield K) K :=
{ add_mem := add_mem',
zero_mem := zero_mem',
neg_mem := neg_mem',
mul_mem := mul_mem',
one_mem := one_mem',
inv_mem := inv_mem' }
@[simp]
lemma mem_carrier {s : subfield K} {x : K} : x ∈ s.carrier ↔ x ∈ s := iff.rfl
@[simp]
lemma mem_mk {S : set K} {x : K} (h₁ h₂ h₃ h₄ h₅ h₆) :
x ∈ (⟨S, h₁, h₂, h₃, h₄, h₅, h₆⟩ : subfield K) ↔ x ∈ S := iff.rfl
@[simp] lemma coe_set_mk (S : set K) (h₁ h₂ h₃ h₄ h₅ h₆) :
((⟨S, h₁, h₂, h₃, h₄, h₅, h₆⟩ : subfield K) : set K) = S := rfl
@[simp]
lemma mk_le_mk {S S' : set K} (h₁ h₂ h₃ h₄ h₅ h₆ h₁' h₂' h₃' h₄' h₅' h₆') :
(⟨S, h₁, h₂, h₃, h₄, h₅, h₆⟩ : subfield K) ≤ (⟨S', h₁', h₂', h₃', h₄', h₅', h₆'⟩ : subfield K) ↔
S ⊆ S' :=
iff.rfl
/-- Two subfields are equal if they have the same elements. -/
@[ext] theorem ext {S T : subfield K} (h : ∀ x, x ∈ S ↔ x ∈ T) : S = T := set_like.ext h
/-- Copy of a subfield with a new `carrier` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (S : subfield K) (s : set K) (hs : s = ↑S) : subfield K :=
{ carrier := s,
inv_mem' := hs.symm ▸ S.inv_mem',
..S.to_subring.copy s hs }
@[simp] lemma coe_copy (S : subfield K) (s : set K) (hs : s = ↑S) :
(S.copy s hs : set K) = s := rfl
lemma copy_eq (S : subfield K) (s : set K) (hs : s = ↑S) : S.copy s hs = S :=
set_like.coe_injective hs
@[simp] lemma coe_to_subring (s : subfield K) : (s.to_subring : set K) = s :=
rfl
@[simp] lemma mem_to_subring (s : subfield K) (x : K) :
x ∈ s.to_subring ↔ x ∈ s := iff.rfl
end subfield
/-- A `subring` containing inverses is a `subfield`. -/
def subring.to_subfield (s : subring K) (hinv : ∀ x ∈ s, x⁻¹ ∈ s) : subfield K :=
{ inv_mem' := hinv
..s }
namespace subfield
variables (s t : subfield K)
section derived_from_subfield_class
/-- A subfield contains the field's 1. -/
protected theorem one_mem : (1 : K) ∈ s := one_mem s
/-- A subfield contains the field's 0. -/
protected theorem zero_mem : (0 : K) ∈ s := zero_mem s
/-- A subfield is closed under multiplication. -/
protected theorem mul_mem {x y : K} : x ∈ s → y ∈ s → x * y ∈ s := mul_mem
/-- A subfield is closed under addition. -/
protected theorem add_mem {x y : K} : x ∈ s → y ∈ s → x + y ∈ s := add_mem
/-- A subfield is closed under negation. -/
protected theorem neg_mem {x : K} : x ∈ s → -x ∈ s := neg_mem
/-- A subfield is closed under subtraction. -/
protected theorem sub_mem {x y : K} : x ∈ s → y ∈ s → x - y ∈ s := sub_mem
/-- A subfield is closed under inverses. -/
protected theorem inv_mem {x : K} : x ∈ s → x⁻¹ ∈ s := inv_mem
/-- A subfield is closed under division. -/
protected theorem div_mem {x y : K} : x ∈ s → y ∈ s → x / y ∈ s := div_mem
/-- Product of a list of elements in a subfield is in the subfield. -/
protected lemma list_prod_mem {l : list K} : (∀ x ∈ l, x ∈ s) → l.prod ∈ s := list_prod_mem
/-- Sum of a list of elements in a subfield is in the subfield. -/
protected lemma list_sum_mem {l : list K} : (∀ x ∈ l, x ∈ s) → l.sum ∈ s := list_sum_mem
/-- Product of a multiset of elements in a subfield is in the subfield. -/
protected lemma multiset_prod_mem (m : multiset K) : (∀ a ∈ m, a ∈ s) → m.prod ∈ s :=
multiset_prod_mem m
/-- Sum of a multiset of elements in a `subfield` is in the `subfield`. -/
protected lemma multiset_sum_mem (m : multiset K) : (∀ a ∈ m, a ∈ s) → m.sum ∈ s :=
multiset_sum_mem m
/-- Product of elements of a subfield indexed by a `finset` is in the subfield. -/
protected lemma prod_mem {ι : Type*} {t : finset ι} {f : ι → K} (h : ∀ c ∈ t, f c ∈ s) :
∏ i in t, f i ∈ s :=
prod_mem h
/-- Sum of elements in a `subfield` indexed by a `finset` is in the `subfield`. -/
protected lemma sum_mem {ι : Type*} {t : finset ι} {f : ι → K} (h : ∀ c ∈ t, f c ∈ s) :
∑ i in t, f i ∈ s :=
sum_mem h
protected lemma pow_mem {x : K} (hx : x ∈ s) (n : ℕ) : x^n ∈ s := pow_mem hx n
protected lemma zsmul_mem {x : K} (hx : x ∈ s) (n : ℤ) : n • x ∈ s := zsmul_mem hx n
protected lemma coe_int_mem (n : ℤ) : (n : K) ∈ s := coe_int_mem s n
lemma zpow_mem {x : K} (hx : x ∈ s) (n : ℤ) : x^n ∈ s :=
begin
cases n,
{ simpa using s.pow_mem hx n },
{ simpa [pow_succ] using s.inv_mem (s.mul_mem hx (s.pow_mem hx n)) },
end
instance : ring s := s.to_subring.to_ring
instance : has_div s := ⟨λ x y, ⟨x / y, s.div_mem x.2 y.2⟩⟩
instance : has_inv s := ⟨λ x, ⟨x⁻¹, s.inv_mem x.2⟩⟩
instance : has_pow s ℤ := ⟨λ x z, ⟨x ^ z, s.zpow_mem x.2 z⟩⟩
/-- A subfield inherits a field structure -/
instance to_field : field s :=
subtype.coe_injective.field (coe : s → K)
rfl rfl (λ _ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _ _, rfl)
(λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _, rfl) (λ _, rfl)
/-- A subfield of a `linear_ordered_field` is a `linear_ordered_field`. -/
instance to_linear_ordered_field {K} [linear_ordered_field K] (s : subfield K) :
linear_ordered_field s :=
subtype.coe_injective.linear_ordered_field coe
rfl rfl (λ _ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _ _, rfl)
(λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _, rfl) (λ _, rfl) (λ _, rfl) (λ _ _, rfl)
(λ _ _, rfl)
@[simp, norm_cast] lemma coe_add (x y : s) : (↑(x + y) : K) = ↑x + ↑y := rfl
@[simp, norm_cast] lemma coe_sub (x y : s) : (↑(x - y) : K) = ↑x - ↑y := rfl
@[simp, norm_cast] lemma coe_neg (x : s) : (↑(-x) : K) = -↑x := rfl
@[simp, norm_cast] lemma coe_mul (x y : s) : (↑(x * y) : K) = ↑x * ↑y := rfl
@[simp, norm_cast] lemma coe_div (x y : s) : (↑(x / y) : K) = ↑x / ↑y := rfl
@[simp, norm_cast] lemma coe_inv (x : s) : (↑(x⁻¹) : K) = (↑x)⁻¹ := rfl
@[simp, norm_cast] lemma coe_zero : ((0 : s) : K) = 0 := rfl
@[simp, norm_cast] lemma coe_one : ((1 : s) : K) = 1 := rfl
end derived_from_subfield_class
/-- The embedding from a subfield of the field `K` to `K`. -/
def subtype (s : subfield K) : s →+* K :=
{ to_fun := coe,
.. s.to_submonoid.subtype, .. s.to_add_subgroup.subtype }
instance to_algebra : algebra s K := ring_hom.to_algebra s.subtype
@[simp] theorem coe_subtype : ⇑s.subtype = coe := rfl
lemma to_subring.subtype_eq_subtype (F : Type*) [field F] (S : subfield F) :
S.to_subring.subtype = S.subtype := rfl
/-! # Partial order -/
variables (s t)
@[simp] lemma mem_to_submonoid {s : subfield K} {x : K} : x ∈ s.to_submonoid ↔ x ∈ s := iff.rfl
@[simp] lemma coe_to_submonoid : (s.to_submonoid : set K) = s := rfl
@[simp] lemma mem_to_add_subgroup {s : subfield K} {x : K} :
x ∈ s.to_add_subgroup ↔ x ∈ s := iff.rfl
@[simp] lemma coe_to_add_subgroup : (s.to_add_subgroup : set K) = s := rfl
/-! # top -/
/-- The subfield of `K` containing all elements of `K`. -/
instance : has_top (subfield K) :=
⟨{ inv_mem' := λ x _, subring.mem_top x, .. (⊤ : subring K)}⟩
instance : inhabited (subfield K) := ⟨⊤⟩
@[simp] lemma mem_top (x : K) : x ∈ (⊤ : subfield K) := set.mem_univ x
@[simp] lemma coe_top : ((⊤ : subfield K) : set K) = set.univ := rfl
/-- The ring equiv between the top element of `subfield K` and `K`. -/
@[simps]
def top_equiv : (⊤ : subfield K) ≃+* K := subsemiring.top_equiv
/-! # comap -/
variables (f : K →+* L)
/-- The preimage of a subfield along a ring homomorphism is a subfield. -/
def comap (s : subfield L) : subfield K :=
{ inv_mem' := λ x hx, show f (x⁻¹) ∈ s, by { rw map_inv₀ f, exact s.inv_mem hx },
.. s.to_subring.comap f }
@[simp] lemma coe_comap (s : subfield L) : (s.comap f : set K) = f ⁻¹' s := rfl
@[simp]
lemma mem_comap {s : subfield L} {f : K →+* L} {x : K} : x ∈ s.comap f ↔ f x ∈ s := iff.rfl
lemma comap_comap (s : subfield M) (g : L →+* M) (f : K →+* L) :
(s.comap g).comap f = s.comap (g.comp f) :=
rfl
/-! # map -/
/-- The image of a subfield along a ring homomorphism is a subfield. -/
def map (s : subfield K) : subfield L :=
{ inv_mem' := by { rintros _ ⟨x, hx, rfl⟩, exact ⟨x⁻¹, s.inv_mem hx, map_inv₀ f x⟩ },
.. s.to_subring.map f }
@[simp] lemma coe_map : (s.map f : set L) = f '' s := rfl
@[simp] lemma mem_map {f : K →+* L} {s : subfield K} {y : L} :
y ∈ s.map f ↔ ∃ x ∈ s, f x = y :=
set.mem_image_iff_bex
lemma map_map (g : L →+* M) (f : K →+* L) : (s.map f).map g = s.map (g.comp f) :=
set_like.ext' $ set.image_image _ _ _
lemma map_le_iff_le_comap {f : K →+* L} {s : subfield K} {t : subfield L} :
s.map f ≤ t ↔ s ≤ t.comap f :=
set.image_subset_iff
lemma gc_map_comap (f : K →+* L) : galois_connection (map f) (comap f) :=
λ S T, map_le_iff_le_comap
end subfield
namespace ring_hom
variables (g : L →+* M) (f : K →+* L)
/-! # range -/
/-- The range of a ring homomorphism, as a subfield of the target. See Note [range copy pattern]. -/
def field_range : subfield L :=
((⊤ : subfield K).map f).copy (set.range f) set.image_univ.symm
@[simp] lemma coe_field_range : (f.field_range : set L) = set.range f := rfl
@[simp] lemma mem_field_range {f : K →+* L} {y : L} : y ∈ f.field_range ↔ ∃ x, f x = y := iff.rfl
lemma field_range_eq_map : f.field_range = subfield.map f ⊤ :=
by { ext, simp }
lemma map_field_range : f.field_range.map g = (g.comp f).field_range :=
by simpa only [field_range_eq_map] using (⊤ : subfield K).map_map g f
/-- The range of a morphism of fields is a fintype, if the domain is a fintype.
Note that this instance can cause a diamond with `subtype.fintype` if `L` is also a fintype.-/
instance fintype_field_range [fintype K] [decidable_eq L] (f : K →+* L) : fintype f.field_range :=
set.fintype_range f
end ring_hom
namespace subfield
/-! # inf -/
/-- The inf of two subfields is their intersection. -/
instance : has_inf (subfield K) :=
⟨λ s t,
{ inv_mem' := λ x hx, subring.mem_inf.mpr
⟨s.inv_mem (subring.mem_inf.mp hx).1,
t.inv_mem (subring.mem_inf.mp hx).2⟩,
.. s.to_subring ⊓ t.to_subring }⟩
@[simp] lemma coe_inf (p p' : subfield K) : ((p ⊓ p' : subfield K) : set K) = p ∩ p' := rfl
@[simp] lemma mem_inf {p p' : subfield K} {x : K} : x ∈ p ⊓ p' ↔ x ∈ p ∧ x ∈ p' := iff.rfl
instance : has_Inf (subfield K) :=
⟨λ S,
{ inv_mem' := begin
rintros x hx,
apply subring.mem_Inf.mpr,
rintro _ ⟨p, p_mem, rfl⟩,
exact p.inv_mem (subring.mem_Inf.mp hx p.to_subring ⟨p, p_mem, rfl⟩),
end,
.. Inf (subfield.to_subring '' S) }⟩
@[simp, norm_cast] lemma coe_Inf (S : set (subfield K)) :
((Inf S : subfield K) : set K) = ⋂ s ∈ S, ↑s :=
show ((Inf (subfield.to_subring '' S) : subring K) : set K) = ⋂ s ∈ S, ↑s,
begin
ext x,
rw [subring.coe_Inf, set.mem_Inter, set.mem_Inter],
exact ⟨λ h s s' ⟨s_mem, s'_eq⟩, h s.to_subring _ ⟨⟨s, s_mem, rfl⟩, s'_eq⟩,
λ h s s' ⟨⟨s'', s''_mem, s_eq⟩, (s'_eq : ↑s = s')⟩,
h s'' _ ⟨s''_mem, by simp [←s_eq, ← s'_eq]⟩⟩
end
lemma mem_Inf {S : set (subfield K)} {x : K} : x ∈ Inf S ↔ ∀ p ∈ S, x ∈ p :=
subring.mem_Inf.trans
⟨λ h p hp, h p.to_subring ⟨p, hp, rfl⟩,
λ h p ⟨p', hp', p_eq⟩, p_eq ▸ h p' hp'⟩
@[simp] lemma Inf_to_subring (s : set (subfield K)) :
(Inf s).to_subring = ⨅ t ∈ s, subfield.to_subring t :=
begin
ext x,
rw [mem_to_subring, mem_Inf],
erw subring.mem_Inf,
exact ⟨λ h p ⟨p', hp⟩, hp ▸ subring.mem_Inf.mpr (λ p ⟨hp', hp⟩, hp ▸ h _ hp'),
λ h p hp, h p.to_subring ⟨p, subring.ext (λ x,
⟨λ hx, subring.mem_Inf.mp hx _ ⟨hp, rfl⟩,
λ hx, subring.mem_Inf.mpr (λ p' ⟨hp, p'_eq⟩, p'_eq ▸ hx)⟩)⟩⟩
end
lemma is_glb_Inf (S : set (subfield K)) : is_glb S (Inf S) :=
begin
refine is_glb.of_image (λ s t, show (s : set K) ≤ t ↔ s ≤ t, from set_like.coe_subset_coe) _,
convert is_glb_binfi,
exact coe_Inf _
end
/-- Subfields of a ring form a complete lattice. -/
instance : complete_lattice (subfield K) :=
{ top := ⊤,
le_top := λ s x hx, trivial,
inf := (⊓),
inf_le_left := λ s t x, and.left,
inf_le_right := λ s t x, and.right,
le_inf := λ s t₁ t₂ h₁ h₂ x hx, ⟨h₁ hx, h₂ hx⟩,
.. complete_lattice_of_Inf (subfield K) is_glb_Inf }
/-! # subfield closure of a subset -/
/-- The `subfield` generated by a set. -/
def closure (s : set K) : subfield K :=
{ carrier := { (x / y) | (x ∈ subring.closure s) (y ∈ subring.closure s) },
zero_mem' := ⟨0, subring.zero_mem _, 1, subring.one_mem _, div_one _⟩,
one_mem' := ⟨1, subring.one_mem _, 1, subring.one_mem _, div_one _⟩,
neg_mem' := λ x ⟨y, hy, z, hz, x_eq⟩, ⟨-y, subring.neg_mem _ hy, z, hz, x_eq ▸ neg_div _ _⟩,
inv_mem' := λ x ⟨y, hy, z, hz, x_eq⟩, ⟨z, hz, y, hy, x_eq ▸ (inv_div _ _).symm⟩,
add_mem' := λ x y x_mem y_mem, begin
obtain ⟨nx, hnx, dx, hdx, rfl⟩ := id x_mem,
obtain ⟨ny, hny, dy, hdy, rfl⟩ := id y_mem,
by_cases hx0 : dx = 0, { rwa [hx0, div_zero, zero_add] },
by_cases hy0 : dy = 0, { rwa [hy0, div_zero, add_zero] },
exact ⟨nx * dy + dx * ny,
subring.add_mem _ (subring.mul_mem _ hnx hdy) (subring.mul_mem _ hdx hny),
dx * dy, subring.mul_mem _ hdx hdy,
(div_add_div nx ny hx0 hy0).symm⟩
end,
mul_mem' := λ x y x_mem y_mem, begin
obtain ⟨nx, hnx, dx, hdx, rfl⟩ := id x_mem,
obtain ⟨ny, hny, dy, hdy, rfl⟩ := id y_mem,
exact ⟨nx * ny, subring.mul_mem _ hnx hny,
dx * dy, subring.mul_mem _ hdx hdy,
(div_mul_div_comm _ _ _ _).symm⟩
end }
lemma mem_closure_iff {s : set K} {x} :
x ∈ closure s ↔ ∃ (y ∈ subring.closure s) (z ∈ subring.closure s), y / z = x := iff.rfl
lemma subring_closure_le (s : set K) : subring.closure s ≤ (closure s).to_subring :=
λ x hx, ⟨x, hx, 1, subring.one_mem _, div_one x⟩
/-- The subfield generated by a set includes the set. -/
@[simp] lemma subset_closure {s : set K} : s ⊆ closure s :=
set.subset.trans subring.subset_closure (subring_closure_le s)
lemma not_mem_of_not_mem_closure {s : set K} {P : K} (hP : P ∉ closure s) : P ∉ s :=
λ h, hP (subset_closure h)
lemma mem_closure {x : K} {s : set K} : x ∈ closure s ↔ ∀ S : subfield K, s ⊆ S → x ∈ S :=
⟨λ ⟨y, hy, z, hz, x_eq⟩ t le, x_eq ▸
t.div_mem
(subring.mem_closure.mp hy t.to_subring le)
(subring.mem_closure.mp hz t.to_subring le),
λ h, h (closure s) subset_closure⟩
/-- A subfield `t` includes `closure s` if and only if it includes `s`. -/
@[simp]
lemma closure_le {s : set K} {t : subfield K} : closure s ≤ t ↔ s ⊆ t :=
⟨set.subset.trans subset_closure, λ h x hx, mem_closure.mp hx t h⟩
/-- Subfield closure of a set is monotone in its argument: if `s ⊆ t`,
then `closure s ≤ closure t`. -/
lemma closure_mono ⦃s t : set K⦄ (h : s ⊆ t) : closure s ≤ closure t :=
closure_le.2 $ set.subset.trans h subset_closure
lemma closure_eq_of_le {s : set K} {t : subfield K} (h₁ : s ⊆ t) (h₂ : t ≤ closure s) :
closure s = t :=
le_antisymm (closure_le.2 h₁) h₂
/-- An induction principle for closure membership. If `p` holds for `1`, and all elements
of `s`, and is preserved under addition, negation, and multiplication, then `p` holds for all
elements of the closure of `s`. -/
@[elab_as_eliminator]
lemma closure_induction {s : set K} {p : K → Prop} {x} (h : x ∈ closure s)
(Hs : ∀ x ∈ s, p x) (H1 : p 1)
(Hadd : ∀ x y, p x → p y → p (x + y))
(Hneg : ∀ x, p x → p (-x))
(Hinv : ∀ x, p x → p (x⁻¹))
(Hmul : ∀ x y, p x → p y → p (x * y)) : p x :=
(@closure_le _ _ _ ⟨p, Hmul, H1,
Hadd, @add_neg_self K _ 1 ▸ Hadd _ _ H1 (Hneg _ H1), Hneg, Hinv⟩).2 Hs h
variable (K)
/-- `closure` forms a Galois insertion with the coercion to set. -/
protected def gi : galois_insertion (@closure K _) coe :=
{ choice := λ s _, closure s,
gc := λ s t, closure_le,
le_l_u := λ s, subset_closure,
choice_eq := λ s h, rfl }
variable {K}
/-- Closure of a subfield `S` equals `S`. -/
lemma closure_eq (s : subfield K) : closure (s : set K) = s := (subfield.gi K).l_u_eq s
@[simp] lemma closure_empty : closure (∅ : set K) = ⊥ := (subfield.gi K).gc.l_bot
@[simp] lemma closure_univ : closure (set.univ : set K) = ⊤ := @coe_top K _ ▸ closure_eq ⊤
lemma closure_union (s t : set K) : closure (s ∪ t) = closure s ⊔ closure t :=
(subfield.gi K).gc.l_sup
lemma closure_Union {ι} (s : ι → set K) : closure (⋃ i, s i) = ⨆ i, closure (s i) :=
(subfield.gi K).gc.l_supr
lemma closure_sUnion (s : set (set K)) : closure (⋃₀ s) = ⨆ t ∈ s, closure t :=
(subfield.gi K).gc.l_Sup
lemma map_sup (s t : subfield K) (f : K →+* L) : (s ⊔ t).map f = s.map f ⊔ t.map f :=
(gc_map_comap f).l_sup
lemma map_supr {ι : Sort*} (f : K →+* L) (s : ι → subfield K) :
(supr s).map f = ⨆ i, (s i).map f :=
(gc_map_comap f).l_supr
lemma comap_inf (s t : subfield L) (f : K →+* L) : (s ⊓ t).comap f = s.comap f ⊓ t.comap f :=
(gc_map_comap f).u_inf
lemma comap_infi {ι : Sort*} (f : K →+* L) (s : ι → subfield L) :
(infi s).comap f = ⨅ i, (s i).comap f :=
(gc_map_comap f).u_infi
@[simp] lemma map_bot (f : K →+* L) : (⊥ : subfield K).map f = ⊥ :=
(gc_map_comap f).l_bot
@[simp] lemma comap_top (f : K →+* L) : (⊤ : subfield L).comap f = ⊤ :=
(gc_map_comap f).u_top
/-- The underlying set of a non-empty directed Sup of subfields is just a union of the subfields.
Note that this fails without the directedness assumption (the union of two subfields is
typically not a subfield) -/
lemma mem_supr_of_directed {ι} [hι : nonempty ι] {S : ι → subfield K} (hS : directed (≤) S)
{x : K} : x ∈ (⨆ i, S i) ↔ ∃ i, x ∈ S i :=
begin
refine ⟨_, λ ⟨i, hi⟩, (set_like.le_def.1 $ le_supr S i) hi⟩,
suffices : x ∈ closure (⋃ i, (S i : set K)) → ∃ i, x ∈ S i,
by simpa only [closure_Union, closure_eq],
refine λ hx, closure_induction hx (λ x, set.mem_Union.mp) _ _ _ _ _,
{ exact hι.elim (λ i, ⟨i, (S i).one_mem⟩) },
{ rintros x y ⟨i, hi⟩ ⟨j, hj⟩,
obtain ⟨k, hki, hkj⟩ := hS i j,
exact ⟨k, (S k).add_mem (hki hi) (hkj hj)⟩ },
{ rintros x ⟨i, hi⟩,
exact ⟨i, (S i).neg_mem hi⟩ },
{ rintros x ⟨i, hi⟩,
exact ⟨i, (S i).inv_mem hi⟩ },
{ rintros x y ⟨i, hi⟩ ⟨j, hj⟩,
obtain ⟨k, hki, hkj⟩ := hS i j,
exact ⟨k, (S k).mul_mem (hki hi) (hkj hj)⟩ }
end
lemma coe_supr_of_directed {ι} [hι : nonempty ι] {S : ι → subfield K} (hS : directed (≤) S) :
((⨆ i, S i : subfield K) : set K) = ⋃ i, ↑(S i) :=
set.ext $ λ x, by simp [mem_supr_of_directed hS]
lemma mem_Sup_of_directed_on {S : set (subfield K)} (Sne : S.nonempty)
(hS : directed_on (≤) S) {x : K} :
x ∈ Sup S ↔ ∃ s ∈ S, x ∈ s :=
begin
haveI : nonempty S := Sne.to_subtype,
simp only [Sup_eq_supr', mem_supr_of_directed hS.directed_coe, set_coe.exists, subtype.coe_mk]
end
lemma coe_Sup_of_directed_on {S : set (subfield K)} (Sne : S.nonempty) (hS : directed_on (≤) S) :
(↑(Sup S) : set K) = ⋃ s ∈ S, ↑s :=
set.ext $ λ x, by simp [mem_Sup_of_directed_on Sne hS]
end subfield
namespace ring_hom
variables {s : subfield K}
open subfield
/-- Restriction of a ring homomorphism to its range interpreted as a subfield. -/
def range_restrict_field (f : K →+* L) : K →+* f.field_range :=
f.srange_restrict
@[simp] lemma coe_range_restrict_field (f : K →+* L) (x : K) :
(f.range_restrict_field x : L) = f x := rfl
/-- The subfield of elements `x : R` such that `f x = g x`, i.e.,
the equalizer of f and g as a subfield of R -/
def eq_locus_field (f g : K →+* L) : subfield K :=
{ inv_mem' := λ x (hx : f x = g x), show f x⁻¹ = g x⁻¹, by rw [map_inv₀ f, map_inv₀ g, hx],
carrier := {x | f x = g x}, .. (f : K →+* L).eq_locus g }
/-- If two ring homomorphisms are equal on a set, then they are equal on its subfield closure. -/
lemma eq_on_field_closure {f g : K →+* L} {s : set K} (h : set.eq_on f g s) :
set.eq_on f g (closure s) :=
show closure s ≤ f.eq_locus_field g, from closure_le.2 h
lemma eq_of_eq_on_subfield_top {f g : K →+* L} (h : set.eq_on f g (⊤ : subfield K)) :
f = g :=
ext $ λ x, h trivial
lemma eq_of_eq_on_of_field_closure_eq_top {s : set K} (hs : closure s = ⊤) {f g : K →+* L}
(h : s.eq_on f g) : f = g :=
eq_of_eq_on_subfield_top $ hs ▸ eq_on_field_closure h
lemma field_closure_preimage_le (f : K →+* L) (s : set L) :
closure (f ⁻¹' s) ≤ (closure s).comap f :=
closure_le.2 $ λ x hx, set_like.mem_coe.2 $ mem_comap.2 $ subset_closure hx
/-- The image under a ring homomorphism of the subfield generated by a set equals
the subfield generated by the image of the set. -/
lemma map_field_closure (f : K →+* L) (s : set K) :
(closure s).map f = closure (f '' s) :=
le_antisymm
(map_le_iff_le_comap.2 $ le_trans (closure_mono $ set.subset_preimage_image _ _)
(field_closure_preimage_le _ _))
(closure_le.2 $ set.image_subset _ subset_closure)
end ring_hom
namespace subfield
open ring_hom
/-- The ring homomorphism associated to an inclusion of subfields. -/
def inclusion {S T : subfield K} (h : S ≤ T) : S →+* T :=
S.subtype.cod_restrict _ (λ x, h x.2)
@[simp] lemma field_range_subtype (s : subfield K) : s.subtype.field_range = s :=
set_like.ext' $ (coe_srange _).trans subtype.range_coe
end subfield
namespace ring_equiv
variables {s t : subfield K}
/-- Makes the identity isomorphism from a proof two subfields of a multiplicative
monoid are equal. -/
def subfield_congr (h : s = t) : s ≃+* t :=
{ map_mul' := λ _ _, rfl, map_add' := λ _ _, rfl, ..equiv.set_congr $ set_like.ext'_iff.1 h }
end ring_equiv
namespace subfield
variables {s : set K}
lemma closure_preimage_le (f : K →+* L) (s : set L) :
closure (f ⁻¹' s) ≤ (closure s).comap f :=
closure_le.2 $ λ x hx, set_like.mem_coe.2 $ mem_comap.2 $ subset_closure hx
end subfield
|
If $S$ is locally path-connected, then the path-component of $S$ containing $x$ is locally path-connected. |
\title{FYS-STK4155 \\
Project 1}
\author{Lars Johan Brodtkorb}
\date{ }
\subsection*{Abstract}
In this exercise I have tried to figure out which method is to be preferred of ordinary least squares, Ridge and Lasso regressions. The results show a better prediction error for the ridge regression, but that may be due to a faulty implementation of the Lasso method.
\section{Introduction}
The main aim of this project is to study in more detail various
regression methods, including the Ordinary Least Squares (OLS) method,
Ridge regression and finally Lasso regression.
The methods are in turn combined with resampling techniques.
We will first study how
to fit polynomials to a specific two-dimensional function called
\href{{http://www.dtic.mil/dtic/tr/fulltext/u2/a081688.pdf}}{Franke's
function}. This
is a function which has been widely used when testing various interpolation and fitting
algorithms. Furthermore, after having etsablished the model and the
method, we will employ resampling techniques such as the cross-validation and/or
the bootstrap methods, in order to perform a proper assessment of our models.
The Franke function, which is a weighted sum of four exponentials reads as follows
\begin{align*}
f(x,y) &= \frac{3}{4}\exp{\left(-\frac{(9x-2)^2}{4} - \frac{(9y-2)^2}{4}\right)}+\frac{3}{4}\exp{\left(-\frac{(9x+1)^2}{49}- \frac{(9y+1)}{10}\right)} \\
&+\frac{1}{2}\exp{\left(-\frac{(9x-7)^2}{4} - \frac{(9y-3)^2}{4}\right)} -\frac{1}{5}\exp{\left(-(9x-4)^2 - (9y-7)^2\right) }.
\end{align*}
The function will be defined for $x,y\in [0,1]$. Our first step will
be to perform an OLS regression analysis of this function, trying out
a polynomial fit with an $x$ and $y$ dependence of the form $[x, y,
x^2, y^2, xy, \dots]$. We will also include cross-validation and
bootstrap as resampling techniques. As in homeworks 1 and 2, we
can use a uniform distribution to set up the arrays of values for $x$
and $y$, or as in the example below just a fix values for $x$ and $y$ with a given step size.
In this case we will have two predictors and need to fit a
function (for example a polynomial) of $x$ and $y$. Thereafter we will
repeat much of the same procedure using the the Ridge and
Lasso regression methods, introducing thus a dependence on the bias
(penalty) $\lambda$.
Thereafter we are going to use (real) digital terrain data and try to
reproduce these data using the same methods. We will also try to go
beyond the second-order polynomials metioned above and explore
which polynomial fits the data best.
\section{Methods}
\subsection{Measures of prediction accuracy}
Find the confidence intervals of the $\beta$ parameters by computing their variances, evaluate the Mean Squared error (MSE)
\[ MSE(\hat{y},\hat{\tilde{y}}) = \frac{1}{n}
\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2,
\]
and the $R^2$ score function.
If $\tilde{\hat{y}}_i$ is the predicted value of the $i-th$ sample and $y_i$ is the corresponding true value, then the score $R^2$ is defined as
\[
R^2(\hat{y}, \tilde{\hat{y}}) = 1 - \frac{\sum_{i=0}^{n - 1} (y_i - \tilde{y}_i)^2}{\sum_{i=0}^{n - 1} (y_i - \bar{y})^2},
\]
where we have defined the mean value of $\hat{y}$ as
\[
\bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i.
\]
\subsection{Ordinary least square regression}
We have an input vector $X^T = (X_1,X_2,X_3,...,X_p)$ and want to predict a real-valued output Y. The linear regression model has the form: (\cite{elementsstat}, chapter 3.2)
\begin{equation}
f(X) = \beta_0 + \sum_{j=1}^{p}X_j\beta_j
\end{equation}
The linear model either assumes that the regression function $E(Y |X)$ is
linear, or that the linear model is a reasonable approximation. The $\beta_j$ ’s are unknown parameters or coefficients, and the variables $X_j$ can come
from many different sources. One of them is that of basis expansions such as
$X_2 = X_1^2, X_3 = X_1^3$, leading to a polynomial
representation;
We can use the basis expansions as a device to achieve more flexible representations for f(X). Polynomials are an example of this. Having great flexibility in approximation allows the basis expansions to work for many occurences, but their variability may increase heavily if they are applied outside their intended scope. The coefficients to achieve a functional form
in one region can cause the function to flap about madly in remote regions (\cite{elementsstat}, chapter 5.1, p. 140).
The polynomial method produces a dictionary $D$ consisting of typically a very large number of basis functions $|D|$, far more than we can afford to fit to our data. Along
with the dictionary we require a method for controlling the complexity
of our model, using basis functions from the dictionary. There are three
common approaches:
Restriction, selection and regularization methods, which we will revisit in the Ridge and Lasso segment.
No matter the source of the $X_j$, the model is linear in the parameters. Typically we have a set of training data $(x_1, y_1)...(x_N , y_N )$ from which
to estimate the parameters $\beta$. Each $x_i = (x_{i1}, x_{i2},...,x_{ip})^T$ is a vector of feature measurements for the i-th case.
Using linear least squared fittings for $X \in \R^2$ we can get the linear function of X that minimizes the sum of the sum of squared residuals of Y.
A unique solution for $\beta$ has the form:
\begin{align*}
\beta =(\textbf{X}^T\textbf{X})^{-1}\textbf{X}^T\textbf{y}
\end{align*}
\medskip
We have made minimal assumptions about the true distribution
of the data. In order to pin down the sampling properties of $\hat{\beta}$ , we now
assume that the observations $y_i$ are uncorrelated and have constant variance
$\sigma^2$, and that the $x_i$ are fixed (non random). The $\hyphenation{variance covariance}$
matrix of the least squares parameter estimates is then given by:
\begin{align*}
Var(\hat{\beta}) =(\textbf{X}^T\textbf{X})^{-1}\sigma^2
\end{align*}
\medskip
\subsection{K-fold cross-validation algorithm}
Cross-validation is probably the simplest and most widely used method for estimating prediction
error. This method directly estimates the expected
extra-sample error $Err = E[L(Y, \hat{f(X)})]$, the average generalization error when the method $\hat{f(X)}$ is applied to an independent test sample from the joint distribution of X and Y. As mentioned earlier, we might hope that cross-validation estimates the conditional error, with the training set T held fixed. Unfortunately, cross-validation typically estimates well only the expected prediction error (\cite{elementsstat}, chapter 7.10 - 7.12).
K-fold crossvalidation uses part of the available data to fit the model, and a different part to test it. We split the data into K roughly equal-sized parts. For the kth part, we fit the model to the other $K-1$ parts of the data, and calculate the prediction error of the fitted model when predicting the kth part of the data. We do this for k = 1, 2,...,K and
combine the K estimates of prediction error.
Given a set of models $f(x,\alpha)$ indexed by a tuning parameter $\alpha$, denote
$\hat{f}^{-\kappa(x,\alpha)}$ by the $\alpha$-th model fitted with the k-th part of the data removed. Then for this set of models we define:
\begin{equation}
CV(\hat{f},\alpha) = \frac{1}{N}\sum_{i=1}^{N}L(y_i,\hat{f}^{-\kappa(i)}(x_i,\alpha))
\end{equation}
\medskip
where L is the loss function, $\kappa$ is the removed data.
The function $CV(\hat{f},\alpha)$ provides an estimate of the test error curve, and we
find the tuning parameter $\hat{\alpha}$ that minimizes it. Our final chosen model is
$f(x,\hat{\alpha})$, which we then fit to all the data.
\medskip
\medskip
The steps of the cross-validation method: \newline
(a) Find a subset of “good” predictors that show fairly strong (univariate) correlation with the class labels, using all of the samples except those in fold k.\newline
(b) Using just this subset of predictors, build a multivariate classifier, using all of the samples except those in fold k.\newline
(c) Use the classifier to predict the class labels for the samples in
fold k.
\subsection{Bootstrap}
The bootstrap method has been used in this project to estimate the variance and bias.
As with cross-validation, the bootstrap seeks to estimate the conditional error, but typically estimates well only the expected prediction error.
Suppose we have a model fit to a set of training data. We denote the
training set by $Z = (z_1, z_2,...,z_N )$ where $z_i = (x_i, y_i).$ The basic idea is
to randomly draw datasets with replacement from the training data, each
sample the same size as the original training set. This is done B times
(B = 200 in my application), producing B bootstrap datasets.
Then we refit the model to each of the bootstrap datasets, and examine
the behavior of the fits over the B replications (\cite{elementsstat} p.249)
\subsection{Ridge and Lasso regression}
\subsubsection*{Ridge regression}
Ridge regression is a simple example of a regularization approach, while the lasso is both a regularization and selection method.
Selection methods adaptively scan the dictionary and include only those basis functions $h_m$ that contribute significantly to the fit of
the model.
Regularization methods use the entire dictionary but restrict the coefficients. (\cite{elementsstat}, chapter 5.1 p.141)
The method used follows \cite{ridge} quite closely. In chapter 1.4.2 on page 8 in \cite{ridge} we find an estimator for $\beta$ and variance in the ridge regression:
\begin{equation*}
\beta=(\textbf{X}^T\textbf{X}+\lambda\textbf{I})^{-1}\textbf{X}^T\textbf{y}
\end{equation*}
\medskip
\begin{equation*}
Var(\hat{\beta}) =(\textbf{X}^T\textbf{X}+\lambda\textbf{I})^{-1}\sigma^2
\end{equation*}
\medskip
Ridge regression shrinks the regression coefficients by imposing a penalty on their size. The ridge coefficients minimize a penalized residual sum of squares.
\begin{equation}
\hat{\beta}_{ridge} =\argmin_{\beta}({\sum_{i=1}^{N}(y_i - \beta_0 -\sum_{j=1}^{p}x_{ij}\beta_j)^2 + \lambda \sum_{j=1}^{p}\beta_j^2})
\end{equation}
\medskip
Here $\lambda\ge 0 $ is a complexity parameter that controls the amount of shrinkage. The idea of penalizing by the sum-of-squares of the parameters is also used in neural networks,
where it is known as weight decay (\cite{elementsstat} p. 63)
\subsection*{Lasso regression}
The Lasso method is a shrinking method like Ridge. Just as in ridge regression, we can re-parametrize the constant $\beta_0$ by standardizing the predictors; the solution for $\hat{\beta_0}$ is $\hat{y}$, and thereafter we fit a model without an intercept. In the signal processing literature,
the Lasso is also known as basis pursuit (Chen et al., 1998).
We can also write the Lasso problem in the equivalent Lagrangian form:
\begin{equation}
\hat{\beta}_{lasso} =\argmin_{\beta}(\frac{1}{2}{\sum_{i=1}^{N}(y_i - \beta_0 -\sum_{j=1}^{p}x_{ij}\beta_j)^2 + \lambda \sum_{j=1}^{p}\abs{\beta_j}})
\end{equation}
\medskip
The difference from the ridge method is that the ridge penalty $\sum_{j=1}^{p}\beta_j^2$ is replaced with the Lasso penalty $\sum_{j=1}^{p}\abs{\beta_j}$
\section{Code implementation}
For most of the code implementation see github repository: \href{https://github.com/larsjbro/FYS-STK3155/tree/master/project1}{https://github.com/larsjbro/FYS-STK3155/tree/master/project1}. I will include the bootstrap method with comments in the report.
\subsection{Bootstrap}
The bootstrap method was implemented with the following code, which was used to generate the prediction error, bias and variance shown in the figures.\newline
\lstinputlisting[language=Python]{bootstrap.py}
\medskip
\section{Analysis}
\subsection{Results}
\subsubsection{OLS}
Table \ref{Table:1} shows the fitted coefficients for the best ordinary least squares method fitted to the Frankfunkction along with its standard deviation, z-score and 95 percent confidence interval. As we can se from the table, only a few of the coefficients are significantly different from 0. In total table \ref{Table:1} shows there are only 5 such coefficients. The other coefficients could have possibly been set to zero.
\FloatBarrier
\begin{table}
\begin{tabular}{lrrrrr}
\toprule
{} & coef & std & z\_score & Confidence interval 0.025 & Confidence interval 0.975 \\
\midrule
0 & -1.648196 & 0.532137 & -3.097317 & -2.691165 & -0.605227 \\
1 & -1.919886 & 1.848958 & -1.038361 & -5.543776 & 1.704005 \\
2 & 6.699335 & 3.720084 & 1.800856 & -0.591897 & 13.990566 \\
3 & 1.577407 & 10.841403 & 0.145498 & -19.671353 & 22.826166 \\
4 & 0.248456 & 0.463744 & 0.535762 & -0.660466 & 1.157378 \\
5 & 3.048496 & 2.491046 & 1.223781 & -1.833865 & 7.930857 \\
6 & -20.088662 & 12.870111 & -1.560877 & -45.313616 & 5.136292 \\
7 & -17.914271 & 16.822026 & -1.064929 & -50.884836 & 15.056294 \\
8 & 81.253441 & 62.107653 & 1.308268 & -40.475323 & 202.982204 \\
9 & 0.006444 & 1.659116 & 0.003884 & -3.245363 & 3.258252 \\
10 & -10.048598 & 13.844107 & -0.725839 & -37.182548 & 17.085353 \\
11 & 122.772857 & 58.256501 & 2.107453 & 8.592213 & 236.953501 \\
12 & 18.202467 & 89.033985 & 0.204444 & -156.300937 & 192.705871 \\
13 & -464.346238 & 295.293981 & -1.572488 & -1043.111806 & 114.419331 \\
14 & -5.577415 & 2.836466 & -1.966325 & -11.136786 & -0.018044 \\
15 & -17.666890 & 15.364312 & -1.149865 & -47.780388 & 12.446608 \\
16 & 188.349237 & 79.758452 & 2.361496 & 32.025544 & 344.672930 \\
17 & 127.373969 & 100.448526 & 1.268052 & -69.501525 & 324.249463 \\
18 & -781.831660 & 379.979896 & -2.057561 & -1526.578570 & -37.084750 \\
19 & 0.140168 & 8.835873 & 0.015864 & -17.177825 & 17.458162 \\
20 & 72.613196 & 63.561066 & 1.142416 & -51.964203 & 197.190596 \\
21 & -603.170312 & 289.455482 & -2.083810 & -1170.492631 & -35.847993 \\
22 & -176.329738 & 401.060283 & -0.439659 & -962.393449 & 609.733972 \\
23 & 2420.894666 & 1422.585633 & 1.701757 & -367.321940 & 5209.111272 \\
\bottomrule
\end{tabular}
\caption{Values for the best fit ordinary least squares method for the data from the Frankefunction with m=300 and sigma=0.5}
\label{Table:1}
\end{table}
\FloatBarrier
Below are figures from the ordinary least squares method:
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{plot_ols_without_r2/olsprediction_error_vs_degrees_m300_l300_s0.png}
\caption{This shows the bias-variance tradeoff as function of the maximum polynomial degree used in the OLS method, with a sample size of 300.}
\label{fig:1}
\end{figure}
\FloatBarrier
\medskip
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{plot_ols_without_r2/olsprediction_error_vs_degrees_m300_l300_s10.png}
\caption{This shows the bias-variance tradeoff as function of the maximum polynomial degree used in the OLS method, with a sample size of 300 and a random gaussian noise with standard deviation of 0.1.}
\label{fig:1}
\end{figure}
\FloatBarrier
\medskip
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{plot_ols_without_r2/olsprediction_error_vs_degrees_m300_l300_s50.png}
\caption{This shows the bias-variance tradeoff as function of the maximum polynomial degree used in the OLS method, with a sample size of 300 and a random gaussian noise with standard deviation of 0.5.}
\label{fig:1}
\end{figure}
\FloatBarrier
\medskip
\subsubsection{Ridge}
Below are the figures for varying sample sizes, degree of polynomials and penalty with Ridge.
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{plot_ridge_without_r2/ridgeprediction_error_m300_d5_s0.png}
\caption{This shows the bias-variance tradeoff as function of the regularization parameter, lambda,for Ridge regression with a sample size of 300 and a polynomial degree of 5}
\label{fig:2}
\end{figure}
\FloatBarrier
\medskip
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{plot_ridge_without_r2/ridgeprediction_error_m300_d5_s10.png}
\caption{This shows the bias-variance tradeoff as function of the regularization parameter, lambda,for Ridge regression with a sample size of 300, polynomial degree of 5 and standard deviation of 0.1}
\label{fig:2}
\end{figure}
\FloatBarrier
\medskip
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{plot_ridge_without_r2/ridgeprediction_error_m300_d5_s50.png}
\caption{This shows the bias-variance tradeoff as function of the regularization parameter, lambda,for Ridge regression with a sample size of 300, polynomial degree of 5 and standard deviation of 0.5}
\label{fig:2}
\end{figure}
\FloatBarrier
\medskip
\subsubsection{Lasso}
Below are the figures for varying sample sizes, polynomials and penalty with Lasso.
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{lasso_prediction_vs_lambda/lassoprediction_error_m300_d5_s0.png}
\caption{This shows the bias-variance tradeoff as function of the regularization parameter, lambda, for Lasso regression method with a sample size of 300 and a polynomial degree of 5}
\label{fig:3}
\end{figure}
\FloatBarrier
\medskip
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{lasso_prediction_vs_lambda/lassoprediction_error_m300_d5_s10.png}
\caption{This shows the bias-variance tradeoff as function of the regularization parameter, lambda, for Lasso regression method with a sample size of 300, polynomial degree of 5 and standard deviation of 0.1.}
\label{fig:3}
\end{figure}
\FloatBarrier
\medskip
\FloatBarrier
\begin{figure}[!ht]
\centering
\FloatBarrier
\includegraphics[width=1\textwidth]{lasso_prediction_vs_lambda/lassoprediction_error_m300_d5_s50.png}
\caption{This shows the bias-variance tradeoff as function of the regularization parameter, lambda, for Lasso regression method with a sample size of 300, a polynomial degree of 5 and standard deviation of 0.5}
\label{fig:3}
\end{figure}
\FloatBarrier
\medskip
\subsection{Discussion}
From all the figures I will now consider prediction error, bias and variance for the various methods.
\subsubsection{OLS}
For the OLS I can see that the minimum prediction error is for a polynomial of degree 4 for all standard deviations 0, 0.1 and 0.5. IN all cases the value of the prediction error is about 0.004. The bias is smallest at 5 degrees in all cases. The variance is smallest for a degree 4 polynomial for standard deviations of 0 and 0.1. For standard deviation of 0.5 the smallest variance is at 3. For a degree 1 polynomial, we do have a low variance, but the bias is really high.
\medskip
Table \ref{Table:1} shows that there were only 5 significant coefficients, the other ones could possibly have been set to 0, but that was not implemented. In principle I could have found a best subset model here.
\subsubsection{Ridge}
For the ridge regression I can see a low prediction error for lambda being $10^{-4}$ and $10^{-10}$ for the 0 and 0.1 standard deviation cases, with a value of the prediction error of about 0.0035 and 0.002. The lowest value being for 0.1 standard deviation and lambda $10^{-4}$. For the 0.5 standard deviation case, the prediction error is the smallest at about 0.25 for lambda $10^{-4}$.
\subsubsection{Lasso}
For the lasso regression at standard deviation of 0 I can see a minimum prediction error of about 0.005 for lambda $10^{-7}$. For standard deviation 0.1 the prediction error is up to 0.015 and for standard deviation 0.5 it is all the way up to 0.25. This tells me that something might have gone wrong with the implementation of lasso.
\section{Conclusion}
The results show that the Ridge regression gives a better prediction error than the other two methods. That does not agree with the expected, since the Lasso method should have been better. I tried to figure out the reason why that happened, and I came up with the following explanation:
The formulation of Lasso is the same as for Ridge, but for the extra $\beta$ term in Ridge. It seems clear from the results that the Ridge method was to be preferred, but on further inspection, it seemed that the Lasso method may have been worse because the standardization method was not done correctly for Lasso. I suspect this was the reason for Lasso being worse than the Ridge regression.
I then implemented this standardization, and still found that the Lasso regression was inferior to the ridge regression, which I can not fully explain.
\section*{Improvements}
I would have liked to complete the data analysis, and also figured out why Ridge regression showed superior results compared to the Lasso Regression. For the OLS method I could have found a best subset model after having found the significant coefficients.
\section{Bibliography}
\begin{thebibliography}{99}
\bibitem{projecttext}$\href{https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/2018/Project1/pdf/Project1.pdf}{https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/2018/Project1/pdf/Project1.pdf}$
\bibitem{elementsstat}$\href{https://github.com/CompPhysics/MachineLearning/blob/master/doc/Textbooks/elementsstat.pdf}{https://github.com/CompPhysics/MachineLearning/blob/master/doc/Textbooks/elementsstat.pdf}$
\bibitem{ridge}$\href{https://arxiv.org/pdf/1509.09169.pdf}{https://arxiv.org/pdf/1509.09169.pdf}$
\bibitem{franke}$\href{http://www.dtic.mil/dtic/tr/fulltext/u2/a081688.pdf}{http://www.dtic.mil/dtic/tr/fulltext/u2/a081688.pdf}$
\end{thebibliography}
|
theory ex2_7
imports Main
begin
datatype 'a tree = Leaf | Node "'a tree" 'a "'a tree"
fun mirror :: "'a tree \<Rightarrow> 'a tree" where
"mirror Leaf = Leaf" |
"mirror (Node l x r) = Node (mirror r) x (mirror l)"
fun pre_order :: "'a tree \<Rightarrow> 'a list" where
"pre_order Leaf =[]" |
"pre_order (Node l x r) = [x]@(pre_order l)@(pre_order r)"
fun post_order :: "'a tree \<Rightarrow> 'a list" where
"post_order Leaf = []" |
"post_order (Node l x r) = (post_order l)@(post_order r)@[x]"
value "mirror(Node (Node Leaf a Leaf) b t)"
value "pre_order (Node (Node Leaf a Leaf) b t)"
value "post_order (Node (Node Leaf a Leaf) b t)"
lemma order : "pre_order (mirror t) = rev (post_order t)"
apply (induction t)
apply (auto)
done
end |
Formal statement is: lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T \<Longrightarrow> bounded S" Informal statement is: If $T$ is a bounded set and $S$ is a subset of $T$, then $S$ is bounded. |
# Chaotic model divergence: an ensemble of Lorenz 96 models using basic model interface (BMI)
The Lorenz 96 model is a model often used to demonstrate chaotic behavior and it is the de-facto standard benchmark model used in the field of data assimilation to test data assimilation methods. In this notebook I present how to easily interact with an implementation of the Lorenz 96 model through the Basic Model Interface (BMI). I show to run a complete ensemble of model-instances that illustrates the chaotic nature of the model.
## the Lorenz 96 model
The Lorenz 96 model is a dynamical sytem for $i=1,...,N$ defined by
\begin{equation}
\frac{dx_{i}}{dt}=\left(x_{i+1} - x_{i-2}\right)x_{i-1} - x_{i} + F
\end{equation}
where i is cyclical, ie. $x_{0}=x_{N}$ and $x_{-1} = x_{N-1}$. $F$ is an external force acting on the system. A value of $F=8$ is known to create chaotic bahavior and is often used. The dimension $N$ can be freely chosen and is typical $40$, but for testing very high dimension systems, higher values can be used. The Lorenz 96 model is a typical chaotic model where, although, the model is deterministic, slight variations in the input state will over time result in complete different states.
## Numerical implementation of the Lorenz 96 model
A fourth order Runga Kutta scheme is used to implement the Lorenz 96 model. Writing the entire state-vector as $\vec{x}$ and using $f\left(\vec{x}\right)$ as the right hand side of the model, ie:
\begin{eqnarray}
f\left(x_{i}\right) = \left(x_{i+1} - x_{i-2}\right)x_{i-1} - x_{i} + F
\\
f\left(\vec{x}\right) = \left\{f\left(x_{1}\right),...,f\left(x_{N}\right)\right\}
\end{eqnarray}
the implementation is given by:
\begin{eqnarray}
\vec{k}_{1}=f\left(\vec{x}\left(t\right)\right)
\\
\vec{k}_{2}=f\left(\vec{x}\left(t\right) + \frac{1}{2}\vec{k}_{1}\Delta t\right)
\\
\vec{k}_{3}=f\left(\vec{x}\left(t\right) + \frac{1}{2}\vec{k}_{2}\Delta t\right)
\\
\vec{k}_{4}=f\left(\vec{x}\left(t\right) + \vec{k}_{3}\Delta t\right)
\end{eqnarray}
and finally
\begin{equation}
\vec{x}\left(t + \Delta t\right) = \vec{x}\left(t\right) + \frac{1}{6}\left(\vec{k}_{1} + 2\vec{k}_{2} + 2 \vec{k}_{3} + \vec{k}_{4}\right)
\end{equation}
## The Basic Model Interface (BMI)
The basic model interface allows communicating with models in a generic fashion. It requires a few standard methods to be available such as 'initialize()' and 'update()'. Methods that are not relevant for the model need still be implemented, but can simply raise a one line exception. See [ref] for more information. Implementing the BMI allows easy interaction with the model. The cells below initiate one instance of the model. For reasons that will become clear we will call this instance "truthModel".
BMI models are typically initialized with a settings-file. This is overkill here, but for completeness, we generate the settings-file first and than pass it to the model.
```python
#required libraries and settings
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import yaml
import io
import BMILorenz
```
```python
#create an instance of the BMILorenz class
truthModel = BMILorenz.BMILorenz ()
#initialize the model
J = 40 #dimension of Lorenz Model
#make a starting state vector
commonStartState = np.zeros(J)
commonStartState[19]=0.01
# Define settings data
settings = {'J': J,
'F': 8.0,
'startTime': 0.0,
'endTime': 20.0,
'dt':1e-3,
'startState': commonStartState}
# Write YAML file
with io.open('settings.yaml', 'w', encoding='utf8') as outfile:
yaml.dump(settings, outfile, default_flow_style=False, allow_unicode=True)
#initialize model
truthModel.initialize('settings.yaml')
```
### Running the model
The model is now all set to run. We need to choose which variables to save every timestep. In the case of the Lorenz model we choose the 5th element of the state-vector, yet this is arbitrary.
The model us run for one timestep by calling `truthModel.update()`. We check if the model time is greater than the end time by using `truthModel.get_current_time()` and `truthModel.get_end_time()`
```python
output = pd.DataFrame(columns = ['truth'])
while truthModel.get_current_time() < truthModel.get_end_time():
truthModel.update()
output.loc[truthModel.get_current_time()] = truthModel.get_value_at_indices('state',5)
```
Let's plot the output of the model
```python
plt.plot(output)
plt.show()
```
## creating an ensemble of models
An ensemble of model instances can be easily created by making an array of model objects. Below I slightly change the starting state of the ensemble members by using the `model.set_value_at_indices()` function.
```python
N = 25 #numeber of ensemble members
#start with an empty ensemble
ensemble = []
for n in range (N):
#add an ensemble methods
ensemble.append(BMILorenz.BMILorenz ())
ensemble[n].initialize('settings.yaml')
ensemble[n].set_value_at_indices('state',5,ensemble[n].get_value_at_indices('state',5) + np.random.randn(1)*0.01)
#also add a column to the output dataframe to store the output
output['ensemble' + str(n)]= np.nan
```
```python
#run the Ensemble. We will use the time of the first ensemble member to keep time, assuming that all
#models use the same time steps.
while ensemble[0].get_current_time()<ensemble[0].get_end_time():
#loop through the ensemble members and store the state after each update
for n in range (N):
ensemble[n].update()
output.at[ensemble[n].get_current_time(),'ensemble' + str(n)] = ensemble[n].get_value_at_indices('state',5)
```
### output of the ensemble
I plot the output of all ensemble members in black and the truth in red
```python
plt.plot(output.loc[:,'ensemble0':],'k')
plt.plot(output.loc[:,'truth'],'r')
plt.show()
```
It shows that after a certain moment in time the ensemble starts diverging from the truth: the little variations on the starting conditions are enough to trigger this behavior. Zooming in on the point where the divergence starts shows this behavior
```python
plt.plot(output.loc[1:3,'ensemble0':],'k')
plt.plot(output.loc[1:3,'truth'],'r')
plt.show()
```
|
#include <stdlib.h>
#include <gsl/gsl_vector.h>
#include "../include/type.h"
#include "../include/global.h"
#include "../include/cthreadpool.h"
void *pool_thread(void *arg) {
threadpool_t *pool = (threadpool_t*)arg;
task_t task;
int head;
while(1) {
pthread_mutex_lock(&(pool->pool_lock));
while(pool->task_count == 0 && pool->flag != POOL_RECLAIM) {
pthread_cond_wait(&(pool->notify), &(pool->pool_lock));
}
if (pool->task_count == 0 && pool->flag == POOL_RECLAIM) {
break;
}
head = pool->task_head;
task.func = pool->tasks[head].func;
task.arg = pool->tasks[head].arg;
pool->task_head++;
pool->task_count--;
pthread_mutex_unlock(&(pool->pool_lock));
*(pool->tasks[head].ret) = (task.func)(task.arg);
}
pthread_mutex_unlock(&(pool->pool_lock));
return NULL;
}
threadpool_t* threadpool_create(const int nthread, const int queue_size) {
int i = 0;
threadpool_t *pool = NULL;
if ((pool = (threadpool_t *)malloc(sizeof(threadpool_t))) == NULL) {
return NULL;
}
pool->nthread = nthread;
pool->queue_size = queue_size;
pool->task_head = 0;
pool->task_tail = -1;
pool->task_count = 0;
pthread_mutex_init(&pool->pool_lock, NULL);
pthread_cond_init(&pool->notify, NULL);
pool->working = (int*)malloc(sizeof(int)*nthread);
pool->threads = (pthread_t*)malloc(sizeof(pthread_t)*nthread);
pool->tasks = (task_t*)malloc(sizeof(task_t)*queue_size);
for (i = 0; i < nthread; ++i) {
pool->working[i] = IDLE;
}
for(i = 0; i < nthread; i++) {
if(pthread_create(&(pool->threads[i]), NULL, pool_thread, (void*)pool) != 0) {
threadpool_reclaim(pool);
return NULL;
}
pool->working[i] = INCOMPLETED;
}
return pool;
}
int threadpool_add(threadpool_t *pool, void* (*func)(void *), void *arg, void **ret) {
int tail;
if (pool == NULL || func == NULL) {
return POOL_ADD_ERR;
}
if(pthread_mutex_lock(&(pool->pool_lock)) != 0) {
return POOL_LOCK_FAILURE;
}
tail = pool->task_tail + 1;
tail = tail == pool->queue_size? 0:tail;
if (pool->task_count == pool->queue_size) {
// TODO erroneous.
if ((realloc(pool->tasks, 2 * pool->queue_size)) != 0) {
return POOL_ADD_ERR;
}
tail = pool->queue_size;
pool->queue_size *= 2;
}
pool->tasks[tail].func = func;
pool->tasks[tail].arg = arg;
pool->tasks[tail].ret = ret;
pool->task_tail = tail;
pool->task_count++;
if(pthread_cond_signal(&(pool->notify)) != 0 ||
pthread_mutex_unlock(&pool->pool_lock) != 0) {
return POOL_LOCK_FAILURE;
}
return 0;
}
int threadpool_reclaim(threadpool_t *pool) {
int i = 0;
if(pthread_mutex_lock(&(pool->pool_lock)) != 0) {
return POOL_LOCK_FAILURE;
}
pool->flag = POOL_RECLAIM;
pthread_mutex_unlock(&(pool->pool_lock));
for (i = 0; i < pool->nthread; ++i) {
if (pool->working[i] != IDLE) {
pthread_join(pool->threads[i], NULL);
}
}
free(pool->threads);
free(pool->tasks);
free(pool);
return 0;
}
|
function [f] = spm_mc_fx_1(x,v,P)
% equations of motion for the mountain car problem using basis functions
% problem
% FORMAT [f] = spm_mc_fx_1(x,v,P)
%
% x - hidden states
% v - exogenous inputs
% P.p - parameters for gradient function: G(x(1),P.p)
% P.q - parameters for cost or loss function: C(x(1),P.q)
%
% returns f = dx/dt = f = [x(2);
% G - x(2)*C]*dt;
%
% where C determines divergence of flow x(2) at any position x(1).
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
% Karl Friston
% $Id: spm_mc_fx_1.m 3140 2009-05-21 18:38:17Z karl $
% gradient (G)
%--------------------------------------------------------------------------
G = spm_DEM_basis(x(1),v,P.p);
% cost function (C)
%--------------------------------------------------------------------------
C = spm_DEM_basis(x(1),v,P.q);
% flow
%--------------------------------------------------------------------------
dt = 1/8;
f = [x(2);
G - x(2)*C]*dt;
% true scalar potential gradient (see spm_moutaincar_fx)
%--------------------------------------------------------------------------
% if x(1) < 0
% G = 2*x(1) + 1;
% else
% xx = x(1)^2;
% G = (1 + 5*xx)^(-1/2) - 5*xx/(1 + 5*xx)^(3/2) + (x(1)/2)^4;
% end |
function permindx = permute_setupperms(n,nperms)
% Set up permutations x observations matrix of observation indices for
% permutation test
%
% :Usage:
% ::
%
% % approximate test with nperms obs.
% permindx = permute_setupperms(n,nperms)
% permindx = permute_setupperms(n,[])
%
% % exact test (all permutations) of n observations
% permindx = permute_setupperms(n)
%
% ..
% Uses code from SnPM3b by Tom Nichols
% adapted for this function by Tor Wager
% ..
if nargin < 2 || isempty(nperms) || nperms == 0
OUT.meth = 'exact';
nperms = gamma(n+1);
use_approximate = 0;
else
nperms = min(gamma(n+1),nperms);
use_approximate = 1;
if nperms > 50000
warning('More than 50,000 permutations! May cause time/memory problems');
end
end
% interactive
% % nperms = gamma(n+1);
% % use_approximate = input(sprintf('%d Perms. Enter return for exact test, or num. of perms in random subset: ',nperms));
% % if isempty(use_approximate)
% % use_approximate = 0;
% % else
% % nperms = min(use_approximate,nperms);
% % use_approximate = 1;
% % end
if use_approximate
% taken from snpm3b code, by Tom Nichols
%-Approximate test :
% Build up random subset of all (within n) permutations
%===============================================================
rand('seed',sum(100*clock)) %-Initialise random number generator
permindx = zeros(nperms,n);
permindx(1,:) = 1+rem(0:(n-1), n);
for i = 2:nperms+1
permindx(i,:) = randperm(n);
end
b = unique(permindx, 'rows');
if(size(b,1) ~= size(permindx, 1))
while(size(b,1) ~= size(permindx, 1))
permindx = b;
for i = (size(permindx,1)+1):nperms+1
permindx(i,:) = randperm(n);
end
b = unique(permindx, 'rows');
end
permindx = [b(1,:); b(randperm(size(b,1)-1)+1,:)];
end
% null permutation is not included in perm indx
permindx = permindx(2:end,:);
else
% taken from snpm3b code, by Tom Nichols
%
%-Full permutation test :
% Build up exhaustive matrix of permutations
%===============================================================
%-Compute permutations for a single exchangability block
%---------------------------------------------------------------
%-Initialise Xblkpermindx & remaining numbers
Xblkpermindx = [];
lef = [1:n]';
%-Loop through numbers left to add to permutations, accumulating permindx
for i = n:-1:1
%-Expand Xblkpermindx & lef
tmp = round(exp(gammaln(n+1)-gammaln(i+1)));
Exp = meshgrid(1:tmp,1:i); Exp = Exp(:)';
if ~isempty(Xblkpermindx), Xblkpermindx = Xblkpermindx(:,Exp); end
lef = lef(:,Exp);
%-Work out sampling for lef
tmp1 = round(exp(gammaln(n+1)-gammaln(i+1)));
tmp2 = round(exp(gammaln(n+1)-gammaln(i)));
sam = 1+rem(0:i*tmp1-1,i) + ([1:tmp2]-1)*i;
%-Add samplings from lef to Xblkpermindx
Xblkpermindx = [Xblkpermindx; lef(sam)];
%-Delete sampled items from lef & condition size
lef(sam) = [];
tmp = round(exp(gammaln(n+1)-gammaln((i-1)+1)));
lef = reshape(lef,(i-1),tmp);
%NB:gamma(n+1)/gamma((i-1)+1) == size(Xblkpermindx,2);
end
clear lef Exp sam i
%-Reorient so permutations are in rows
permindx = Xblkpermindx';
end
%-Check, condition and randomise permindx
%-----------------------------------------------------------------------
%-Check permindxs sum within Xblks to sum to 1
if ~all(all(sum(permindx,2) == (n+1)*n/2 ))
error('Invalid permindx computed!'), end
%-Convert to full permutations from permutations within blocks
nperms = size(permindx,1);
%-Randomise order of permindxs (except first) to allow interim analysis
rand('seed',sum(100*clock)) %-Initialise random number generator
permindx=[permindx(1,:);permindx(randperm(nperms-1)+1,:)];
%-Check first permutation is null permutation
if ~use_approximate
if ~all(permindx(1,:)==[1:n])
error('permindx(1,:)~=[1:n]');
end
end
end
|
//==================================================================================================
/**
Copyright 2016 NumScale SAS
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
**/
//==================================================================================================
#ifndef BOOST_SIMD_ARCH_COMMON_SIMD_FUNCTION_COMBINE_HPP_INCLUDED
#define BOOST_SIMD_ARCH_COMMON_SIMD_FUNCTION_COMBINE_HPP_INCLUDED
#include <boost/simd/function/make.hpp>
#include <boost/simd/function/extract.hpp>
#include <boost/simd/meta/hierarchy/simd.hpp>
#include <boost/simd/detail/dispatch/hierarchy.hpp>
#include <boost/simd/detail/dispatch/function/overload.hpp>
#include <boost/config.hpp>
namespace boost { namespace simd { namespace ext
{
namespace bd = boost::dispatch;
namespace bs = boost::simd;
// -----------------------------------------------------------------------------------------------
// combine(scalar,scalar)
BOOST_DISPATCH_OVERLOAD ( combine_
, (typename T)
, bd::cpu_
, bd::scalar_< bd::unspecified_<T> >
, bd::scalar_< bd::unspecified_<T> >
)
{
BOOST_FORCEINLINE pack<T,2> operator()(T const& a, T const& b) const BOOST_NOEXCEPT
{
return make(as_<pack<T,2>>{}, a,b);
}
};
// -----------------------------------------------------------------------------------------------
// combine(pack<T,N>,pack<T,N>)
BOOST_DISPATCH_OVERLOAD ( combine_
, (typename T, typename X)
, bd::cpu_
, bs::pack_< bd::unspecified_<T>, X >
, bs::pack_< bd::unspecified_<T>, X >
)
{
using result_t = typename T::template resize<2 * T::static_size>;
template<typename... N>
static BOOST_FORCEINLINE result_t do_ ( T const& a, T const& b, aggregate_storage const&
, nsm::list<N...> const&
) BOOST_NOEXCEPT
{
return typename result_t::storage_type{{a,b}};
}
template<typename K, typename... N>
static BOOST_FORCEINLINE result_t do_ ( T const& a, T const& b, K const&
, nsm::list<N...> const&
) BOOST_NOEXCEPT
{
return make(as_<result_t>{}
, bs::extract<N::value>(a)...
, bs::extract<N::value>(b)...
);
}
BOOST_FORCEINLINE result_t operator()(T const& a, T const& b) const BOOST_NOEXCEPT
{
return do_( a, b
, typename result_t::traits::storage_kind{}
, nsm::range<std::size_t, 0, T::static_size>{}
);
}
};
} } }
#endif
|
using ResponseManneville
using Test
@testset "ResponseManneville.jl" begin
include("testLSV.jl")
include("testC2Basis.jl")
end
|
: (flout) ;
: (fl) ;
wvariable fl_in
|
[STATEMENT]
lemma proj3_inv: "\<And>dip rt dests. dip\<in>kD (rt)
\<Longrightarrow> \<pi>\<^sub>3(the (invalidate rt dests dip)) = \<pi>\<^sub>3(the (rt dip))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>dip rt dests. dip \<in> kD rt \<Longrightarrow> \<pi>\<^sub>3 (the (invalidate rt dests dip)) = \<pi>\<^sub>3 (the (rt dip))
[PROOF STEP]
by (clarsimp simp: invalidate_def kD_def split: option.split) |
Desmond Llewelyn as Q : Head of MI6 technical department .
|
Set Warnings "-notation-overridden".
Require Import Category.Lib.
Require Export Category.Theory.Category.
Require Import Category.Theory.Functor.
Require Import Category.Structure.Initial.
Require Import Category.Structure.Terminal.
Require Import Category.Instance.Zero.
Require Import Category.Instance.One.
Require Import Coq.Arith.PeanoNat.
Require Import Coq.Lists.List.
Require Import Coq.Lists.ListSet.
Require Import Coq.Vectors.Fin.
Generalizable All Variables.
Set Primitive Projections.
Set Universe Polymorphism.
Unset Transparent Obligations.
(* jww (2017-06-02): TODO
Import ListNotations.
(* This record establishes the structure of a concrete category's objects and
arrows, in terms of fixed sets of natural numbers. It's main practical use
is for building diagrams. *)
Record Concrete_Structure := {
obs : nat;
arrs : nat;
composition : Fin.t arrs -> Fin.t arrs -> Fin.t arrs;
composition_assoc {f g h} :
composition f (composition g h) = composition (composition f g) h
}.
(* A concrete category has a fixed set of objects (of some decidable type, to
differentiate them), and a fixed set of arrows between those objects. A
frequent use of these is as index categories to build diagrams. *)
Program Definition Concrete (C : Concrete_Structure) :
Category := {|
obj := Fin.t (obs C);
hom := fun _ _ => Fin.t (S (arrs C));
homset := Morphism_equality
id := fun _ => F1;
compose := fun x y z f g => match f, g with
| f, F1 => f
| F1, g => g
| f, g => f
end
|}.
Next Obligation. destruct f; reflexivity. Qed.
Next Obligation. destruct f; reflexivity. Qed.
Next Obligation.
destruct f, g, h; auto; f_equal.
- pose proof (@composition_assoc S t t0 t1).
destruct (composition S t0 t1); try tauto.
destruct (composition S t t0); try tauto.
destruct (composition S t t2); try tauto.
destruct (composition S t3 t1); try tauto.
subst; reflexivity.
- destruct (composition S t t0); try tauto.
- destruct (composition S t t0); try tauto.
Qed.
Next Obligation.
destruct f, g, h; auto; f_equal.
- pose proof (@composition_assoc S t t0 t1).
destruct (composition S t0 t1); try tauto.
destruct (composition S t t0); try tauto.
destruct (composition S t t2); try tauto.
destruct (composition S t3 t1); try tauto.
subst; reflexivity.
- destruct (composition S t t0); try tauto.
- destruct (composition S t t0); try tauto.
Qed.
Module ConcreteInstances.
Set Transparent Obligations.
(* The 0 category has no objects and no morphisms. It is initial in Cat. *)
Program Definition Structure_0 : Concrete_Structure := {|
obs := 0;
arrs := 0
|}.
Next Obligation. apply case0; auto. Qed.
Next Obligation. apply case0; auto. Qed.
Program Definition Concrete_0 := Concrete Structure_0.
Program Instance Map_0 `(C : Category) : Concrete_0 ⟶ C.
Next Obligation. inversion H. Qed.
Next Obligation. inversion X. Qed.
Next Obligation. inversion X. Qed.
Next Obligation. inversion X. Qed.
Program Instance Initial_0 : @Initial Cat := {
Zero := Concrete_0;
zero := Map_0
}.
Next Obligation.
constructive.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact A0.
refine (case0 (fun _ => _) _). exact A0.
Qed.
Program Instance Initial_0_is_0 : @Zero Cat Initial_0 ≅ 0.
Next Obligation. exact Id. Qed.
Next Obligation. exact Id. Qed.
Next Obligation.
constructive.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact None.
refine (case0 (fun _ => _) _); simpl.
refine (case0 (fun _ => _) _); simpl. exact X.
simpl; refine (case0 (fun _ => _) _).
simpl; refine (case0 (fun _ => _) _).
Qed.
Next Obligation.
constructive.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact X.
refine (case0 (fun _ => _) _). exact None.
refine (case0 (fun _ => _) _); simpl.
refine (case0 (fun _ => _) _); simpl. exact X.
simpl; refine (case0 (fun _ => _) _).
simpl; refine (case0 (fun _ => _) _).
Qed.
(* The 1 category has one object and its identity morphism. It is terminal in
Cat. *)
Program Definition Structure_1 : Concrete_Structure := {|
obs := 1;
arrs := 0
|}.
Next Obligation. apply case0; auto. Qed.
Next Obligation. apply case0; auto. Qed.
Program Definition Concrete_1 := Concrete Structure_1.
Program Instance Map_1 `(C : Category) : C ⟶ Concrete_1 := {
fobj := fun _ => F1;
fmap := fun _ _ _ => id
}.
Program Instance Terminal_1 : @Terminal Cat := {
One := Concrete_1;
one := Map_1
}.
Next Obligation.
constructive; auto; simpl.
all:swap 2 4.
- exact None.
- exact None.
- simpl.
destruct (fmap[f] f0); simpl;
destruct (fmap[g] f0); auto;
pattern t; apply case0.
- simpl.
destruct (fmap[f] f0); simpl;
destruct (fmap[g] f0); auto;
pattern t; apply case0.
- simpl.
destruct (fmap[f] f0); simpl;
destruct (fmap[g] f0); auto;
pattern t; apply case0.
- simpl.
destruct (fmap[f] f0); simpl;
destruct (fmap[g] f0); auto;
pattern t; apply case0.
- simpl.
destruct (fmap[g] id); auto;
pattern t; apply case0.
- simpl.
destruct (fmap[f] id); auto;
pattern t; apply case0.
Qed.
Program Instance Terminal_1_is_1 : @One Cat Terminal_1 ≅ _1.
Next Obligation.
functor; simpl; intros; reflexivity.
Defined.
Next Obligation.
functor; simpl; intros; reflexivity.
Defined.
Next Obligation.
constructive; intuition.
Qed.
Next Obligation.
constructive; intuition.
all:swap 2 4.
- exact None.
- exact None.
- simpl.
destruct f; auto;
pattern t; apply case0.
- simpl.
destruct f; auto;
pattern t; apply case0.
- simpl.
destruct f; auto;
pattern t; apply case0.
- simpl.
destruct f; auto;
pattern t; apply case0.
- reflexivity.
- reflexivity.
Qed.
(* The 2 category has two objects, their identity morphisms, and a morphism
from the first to the second object. *)
Program Definition Structure_2 : Concrete_Structure := {|
obs := 2;
arrs := 1
|}.
Next Obligation. exact None. Defined.
Definition Concrete_2 := Concrete Structure_2.
(* The 3 category has three objects, their identity morphisms, and morphisms
from the first to the second object, the second to the third, and the first
to the third (required by composition). *)
Program Definition Structure_3 : Concrete_Structure := {|
obs := 3;
arrs := 3;
composition := fun f g =>
|}.
Definition Concrete_3 := Concrete Structure_3.
End ConcreteInstances.
*)
|
import Mathlib.Tactic.Basic
/-!
## Rewriting Tactics
The rewriting tactic `rw` and its relative `simp` replace equals for equals. Unlike `cc`,
they use equations as left-to-right rewrite rules. By default, they operate on the
goal’s target, but they can also be used to rewrite hypotheses specified using the
`at` keyword:
| at | description |
|----|-------------|
|`at ⊢` | applies to the target (the default) |
| `at h₁ . . . hₙ` | applies to the specified hypotheses |
| `at *` | applies to all hypotheses and the target |
**rw**
```
rw lemma-or-constant [at position]
```
The rw tactic applies a single equation as a left-to-right rewrite rule. It searches for the first
subterm that matches the rule’s left-hand side; once found, all occurrences of that subterm are
replaced by the right-hand side of the rule. If the rule contains variables, these are instantiated
as necessary. To apply a lemma as a right-to-left rewrite rule, put a short left arrow (`←`) in front
of the lemma’s name.
Given the lemma `l : ∀x, g x = f x` and the goal `⊢ h (f a) (g b) (g c)`, the
tactic `rw l` produces the subgoal `⊢ h (f a) (f b) (g c)`, whereas `rw ←l` produces the subgoal
`⊢ h (g a) (g b) (g c)`.
Instead of a lemma, we can also specify the name of a constant. This will attempt to
use one of the constant’s defining equations as rewrite rules. For technical reasons, this does not
work with not (`¬`), and we must use `rw not_def` instead.
**simp**
```
simp [at position]
```
The simp tactic applies a standard set of rewrite rules, called the _simp_ set, exhaustively. The simp
set can be extended by putting the `attribute [simp]` on lemmas. Unlike `rw`, `simp` can rewrite terms
containing bound variables (e.g., occurrences of `x` in the body of `λx => . . .`, `∀x, . . .`, or
`∃x, . . .`).
```
simp [lemma-or-constant₁, . . . , lemma-or-constantₙ] [at position]
```
For the above `simp` variant, the specified lemmas are temporarily added to the simp set. In the
lemma list, an asterisk (`*`) can be use to represent all hypotheses. The minus sign (`-`) in front
of a lemma name temporarily removes the lemma from the simp set. A powerful incantation that both
simplifies the hypotheses and uses the result to simplify the goal’s target is `simp [*] at *`.
Given the `lemma l : ∀x, g x = f x` and the goal `⊢ h (f a) (g b) (g c)`, the tactic `simp [l]`
produces the subgoal `⊢ h (f a) (f b) (f c)`, where both `g b` and `g c` have been rewritten. Instead of a
lemma, we can also specify the name of a constant. This temporarily adds the constant’s defining
equations to the simp set.
To find out what simp does, you can enable tracing via the command just before your lemma
and you will see nice detailed information in the InfoView in VS Code.
```lean
set_option trace.Meta.Tactic.simp.rewrite true
```
-/ |
(*
Authors:
Anthony Bordg, University of Cambridge, [email protected];
Yijun He, University of Cambridge, [email protected]
*)
section \<open>The No-Cloning Theorem\<close>
theory No_Cloning
imports
Quantum
Tensor
begin
subsection \<open>The Cauchy-Schwarz Inequality\<close>
lemma inner_prod_expand:
assumes "dim_vec a = dim_vec b" and "dim_vec a = dim_vec c" and "dim_vec a = dim_vec d"
shows "\<langle>a + b|c + d\<rangle> = \<langle>a|c\<rangle> + \<langle>a|d\<rangle> + \<langle>b|c\<rangle> + \<langle>b|d\<rangle>"
apply (simp add: inner_prod_def)
using assms sum.cong by (simp add: sum.distrib algebra_simps)
lemma inner_prod_distrib_left:
assumes "dim_vec a = dim_vec b"
shows "\<langle>c \<cdot>\<^sub>v a|b\<rangle> = cnj(c) * \<langle>a|b\<rangle>"
using assms inner_prod_def by (simp add: algebra_simps mult_hom.hom_sum)
lemma inner_prod_distrib_right:
assumes "dim_vec a = dim_vec b"
shows "\<langle>a|c \<cdot>\<^sub>v b\<rangle> = c * \<langle>a|b\<rangle>"
using assms by (simp add: algebra_simps mult_hom.hom_sum)
lemma cauchy_schwarz_ineq:
assumes "dim_vec v = dim_vec w"
shows "(cmod(\<langle>v|w\<rangle>))\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)"
proof (cases "\<langle>v|v\<rangle> = 0")
case c0:True
then have "\<And>i. i < dim_vec v \<Longrightarrow> v $ i = 0"
by(metis index_zero_vec(1) inner_prod_with_itself_nonneg_reals_non0)
then have "(cmod(\<langle>v|w\<rangle>))\<^sup>2 = 0" by (simp add: assms inner_prod_def)
moreover have "Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>) = 0" by (simp add: c0)
ultimately show ?thesis by simp
next
case c1:False
have "dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)" by (simp add: assms)
then have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> +
\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>"
using inner_prod_expand[of "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v"] by auto
moreover have "\<langle>w|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> * \<langle>w|v\<rangle>"
using assms inner_prod_distrib_right[of "w" "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"] by simp
moreover have "\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj(-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * \<langle>v|w\<rangle>"
using assms inner_prod_distrib_left[of "v" "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"] by simp
moreover have "\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj(-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * (-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * \<langle>v|v\<rangle>"
using inner_prod_distrib_left[of "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
inner_prod_distrib_right[of "v" "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"] by simp
ultimately have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - cmod(\<langle>v|w\<rangle>)^2 / \<langle>v|v\<rangle>"
using assms inner_prod_cnj[of "w" "v"] inner_prod_cnj[of "v" "v"] complex_norm_square by simp
moreover have "Re(\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>) \<ge> 0"
using inner_prod_with_itself_Re by blast
ultimately have "Re(\<langle>w|w\<rangle>) \<ge> cmod(\<langle>v|w\<rangle>)^2/Re(\<langle>v|v\<rangle>)"
using inner_prod_with_itself_real by simp
moreover have c2:"Re(\<langle>v|v\<rangle>) > 0"
using inner_prod_with_itself_Re_non0 inner_prod_with_itself_eq0 c1 by auto
ultimately have "Re(\<langle>w|w\<rangle>) * Re(\<langle>v|v\<rangle>) \<ge> cmod(\<langle>v|w\<rangle>)^2/Re(\<langle>v|v\<rangle>) * Re(\<langle>v|v\<rangle>)"
by (metis less_numeral_extra(3) nonzero_divide_eq_eq pos_divide_le_eq)
thus ?thesis
using inner_prod_with_itself_Im c2 by (simp add: mult.commute)
qed
lemma cauchy_schwarz_eq [simp]:
assumes "v = (l \<cdot>\<^sub>v w)"
shows "(cmod(\<langle>v|w\<rangle>))\<^sup>2 = Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)"
proof-
have "cmod(\<langle>v|w\<rangle>) = cmod(cnj(l) * \<langle>w|w\<rangle>)"
using assms inner_prod_distrib_left[of "w" "w" "l"] by simp
then have "cmod(\<langle>v|w\<rangle>)^2 = cmod(l)^2 * \<langle>w|w\<rangle> * \<langle>w|w\<rangle>"
using complex_norm_square inner_prod_cnj[of "w" "w"] by simp
moreover have "\<langle>v|v\<rangle> = cmod(l)^2 * \<langle>w|w\<rangle>"
using assms complex_norm_square inner_prod_distrib_left[of "w" "v" "l"]
inner_prod_distrib_right[of "w" "w" "l"] by simp
ultimately show ?thesis by (metis Re_complex_of_real)
qed
lemma cauchy_schwarz_col [simp]:
assumes "dim_vec v = dim_vec w" and "(cmod(\<langle>v|w\<rangle>))\<^sup>2 = Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)"
shows "\<exists>l. v = (l \<cdot>\<^sub>v w) \<or> w = (l \<cdot>\<^sub>v v)"
proof (cases "\<langle>v|v\<rangle> = 0")
case c0:True
then have "\<And>i. i < dim_vec v \<Longrightarrow> v $ i = 0"
by(metis index_zero_vec(1) inner_prod_with_itself_nonneg_reals_non0)
then have "v = 0 \<cdot>\<^sub>v w" by (auto simp: assms)
then show ?thesis by auto
next
case c1:False
have f0:"dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)" by (simp add: assms(1))
then have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> +
\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>"
using inner_prod_expand[of "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v"] by simp
moreover have "\<langle>w|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> * \<langle>w|v\<rangle>"
using assms(1) inner_prod_distrib_right[of "w" "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"] by simp
moreover have "\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj(-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * \<langle>v|w\<rangle>"
using assms(1) inner_prod_distrib_left[of "v" "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"] by simp
moreover have "\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj(-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * (-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * \<langle>v|v\<rangle>"
using inner_prod_distrib_left[of "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
inner_prod_distrib_right[of "v" "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"] by simp
ultimately have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - cmod(\<langle>v|w\<rangle>)^2 / \<langle>v|v\<rangle>"
using inner_prod_cnj[of "w" "v"] inner_prod_cnj[of "v" "v"] assms(1) complex_norm_square by simp
moreover have "\<langle>w|w\<rangle> = cmod(\<langle>v|w\<rangle>)^2 / \<langle>v|v\<rangle>"
using assms(2) inner_prod_with_itself_real by(metis Reals_mult c1 nonzero_mult_div_cancel_left of_real_Re)
ultimately have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = 0" by simp
then have "\<And>i. i<dim_vec w \<Longrightarrow> (w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v) $ i = 0"
by (metis f0 index_add_vec(2) index_zero_vec(1) inner_prod_with_itself_nonneg_reals_non0)
then have "\<And>i. i<dim_vec w \<Longrightarrow> w $ i + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> * v $ i = 0"
by (metis assms(1) f0 index_add_vec(1) index_smult_vec(1))
then have "\<And>i. i<dim_vec w \<Longrightarrow> w $ i = \<langle>v|w\<rangle>/\<langle>v|v\<rangle> * v $ i" by simp
then have "w = \<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" by (auto simp add: assms(1))
thus ?thesis by auto
qed
subsection \<open>The No-Cloning Theorem\<close>
lemma eq_from_inner_prod [simp]:
assumes "dim_vec v = dim_vec w" and "\<langle>v|w\<rangle> = 1" and "\<langle>v|v\<rangle> = 1" and "\<langle>w|w\<rangle> = 1"
shows "v = w"
proof-
have "(cmod(\<langle>v|w\<rangle>))\<^sup>2 = Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)" by (simp add: assms)
then have f0:"\<exists>l. v = (l \<cdot>\<^sub>v w) \<or> w = (l \<cdot>\<^sub>v v)" by (simp add: assms(1))
then show ?thesis
proof (cases "\<exists>l. v = (l \<cdot>\<^sub>v w)")
case True
then have "\<exists>l. v = (l \<cdot>\<^sub>v w) \<and> \<langle>v|w\<rangle> = cnj(l) * \<langle>w|w\<rangle>"
using inner_prod_distrib_left by auto
then show ?thesis by (simp add: assms(2,4))
next
case False
then have "\<exists>l. w = (l \<cdot>\<^sub>v v) \<and> \<langle>v|w\<rangle> = l * \<langle>v|v\<rangle>"
using f0 inner_prod_distrib_right by auto
then show ?thesis by (simp add: assms(2,3))
qed
qed
lemma hermite_cnj_of_tensor:
shows "(A \<Otimes> B)\<^sup>\<dagger> = (A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>)"
proof
show c0:"dim_row ((A \<Otimes> B)\<^sup>\<dagger>) = dim_row ((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>))" by simp
show c1:"dim_col ((A \<Otimes> B)\<^sup>\<dagger>) = dim_col ((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>))" by simp
show "\<And>i j. i < dim_row ((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>)) \<Longrightarrow> j < dim_col ((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>)) \<Longrightarrow>
((A \<Otimes> B)\<^sup>\<dagger>) $$ (i, j) = ((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>)) $$ (i, j)"
proof-
fix i j assume a0:"i < dim_row ((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>))" and a1:"j < dim_col ((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>))"
then have "(A \<Otimes> B)\<^sup>\<dagger> $$ (i, j) = cnj((A \<Otimes> B) $$ (j, i))" by (simp add: dagger_def)
also have "\<dots> = cnj(A $$ (j div dim_row(B), i div dim_col(B)) * B $$ (j mod dim_row(B), i mod dim_col(B)))"
by (metis (mono_tags, lifting) a0 a1 c1 dim_row_tensor_mat dim_col_of_dagger dim_row_of_dagger
index_tensor_mat less_nat_zero_code mult_not_zero neq0_conv)
moreover have "((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>)) $$ (i, j) =
(A\<^sup>\<dagger>) $$ (i div dim_col(B), j div dim_row(B)) * (B\<^sup>\<dagger>) $$ (i mod dim_col(B), j mod dim_row(B))"
by (smt a0 a1 c1 dim_row_tensor_mat dim_col_of_dagger dim_row_of_dagger index_tensor_mat
less_nat_zero_code mult_eq_0_iff neq0_conv)
moreover have "(B\<^sup>\<dagger>) $$ (i mod dim_col(B), j mod dim_row(B)) = cnj(B $$ (j mod dim_row(B), i mod dim_col(B)))"
proof-
have "i mod dim_col(B) < dim_col(B)"
using a0 gr_implies_not_zero mod_div_trivial by fastforce
moreover have "j mod dim_row(B) < dim_row(B)"
using a1 gr_implies_not_zero mod_div_trivial by fastforce
ultimately show ?thesis by (simp add: dagger_def)
qed
moreover have "(A\<^sup>\<dagger>) $$ (i div dim_col(B), j div dim_row(B)) = cnj(A $$ (j div dim_row(B), i div dim_col(B)))"
proof-
have "i div dim_col(B) < dim_col(A)"
using a0 dagger_def by (simp add: less_mult_imp_div_less)
moreover have "j div dim_row(B) < dim_row(A)"
using a1 dagger_def by (simp add: less_mult_imp_div_less)
ultimately show ?thesis by (simp add: dagger_def)
qed
ultimately show "((A \<Otimes> B)\<^sup>\<dagger>) $$ (i, j) = ((A\<^sup>\<dagger>) \<Otimes> (B\<^sup>\<dagger>)) $$ (i, j)" by simp
qed
qed
locale quantum_machine =
fixes n:: nat and s:: "complex Matrix.vec" and U:: "complex Matrix.mat"
assumes dim_vec [simp]: "dim_vec s = 2^n"
and dim_col [simp]: "dim_col U = 2^n * 2^n"
and square [simp]: "square_mat U" and unitary [simp]: "unitary U"
lemma inner_prod_of_unit_vec:
fixes n i:: nat
assumes "i < n"
shows "\<langle>unit_vec n i| unit_vec n i\<rangle> = 1"
by (auto simp add: inner_prod_def unit_vec_def)
(simp add: assms sum.cong[of "{0..<n}" "{0..<n}"
"\<lambda>j. cnj (if j = i then 1 else 0) * (if j = i then 1 else 0)" "\<lambda>j. (if j = i then 1 else 0)"])
theorem (in quantum_machine) no_cloning:
assumes [simp]: "dim_vec v = 2^n" and [simp]: "dim_vec w = 2^n" and
cloning1: "\<And>s. U * ( |v\<rangle> \<Otimes> |s\<rangle>) = |v\<rangle> \<Otimes> |v\<rangle>" and
cloning2: "\<And>s. U * ( |w\<rangle> \<Otimes> |s\<rangle>) = |w\<rangle> \<Otimes> |w\<rangle>" and
"\<langle>v|v\<rangle> = 1" and "\<langle>w|w\<rangle> = 1"
shows "v = w \<or> \<langle>v|w\<rangle> = 0"
proof-
define s:: "complex Matrix.vec" where d0:"s = unit_vec (2^n) 0"
have f0:"\<langle>|v\<rangle>| \<Otimes> \<langle>|s\<rangle>| = (( |v\<rangle> \<Otimes> |s\<rangle>)\<^sup>\<dagger>)"
using hermite_cnj_of_tensor[of "|v\<rangle>" "|s\<rangle>"] bra_def dagger_def ket_vec_def by simp
moreover have f1:"( |v\<rangle> \<Otimes> |v\<rangle>)\<^sup>\<dagger> * ( |w\<rangle> \<Otimes> |w\<rangle>) = (\<langle>|v\<rangle>| \<Otimes> \<langle>|s\<rangle>| ) * ( |w\<rangle> \<Otimes> |s\<rangle>)"
proof-
have "(U * ( |v\<rangle> \<Otimes> |s\<rangle>))\<^sup>\<dagger> = (\<langle>|v\<rangle>| \<Otimes> \<langle>|s\<rangle>| ) * (U\<^sup>\<dagger>)"
using dagger_of_prod[of "U" "|v\<rangle> \<Otimes> |s\<rangle>"] f0 d0 by (simp add: ket_vec_def)
then have "(U * ( |v\<rangle> \<Otimes> |s\<rangle>))\<^sup>\<dagger> * U * ( |w\<rangle> \<Otimes> |s\<rangle>) = (\<langle>|v\<rangle>| \<Otimes> \<langle>|s\<rangle>| ) * (U\<^sup>\<dagger>) * U * ( |w\<rangle> \<Otimes> |s\<rangle>)" by simp
moreover have "(U * ( |v\<rangle> \<Otimes> |s\<rangle>))\<^sup>\<dagger> * U * ( |w\<rangle> \<Otimes> |s\<rangle>) = (( |v\<rangle> \<Otimes> |v\<rangle>)\<^sup>\<dagger>) * ( |w\<rangle> \<Otimes> |w\<rangle>)"
using assms(2-4) d0 unit_vec_def by (smt Matrix.dim_vec assoc_mult_mat carrier_mat_triv dim_row_mat(1)
dim_row_tensor_mat dim_col_of_dagger index_mult_mat(2) ket_vec_def square square_mat.elims(2))
moreover have "(U\<^sup>\<dagger>) * U = 1\<^sub>m (2^n * 2^n)"
using unitary_def dim_col unitary by simp
moreover have "(\<langle>|v\<rangle>| \<Otimes> \<langle>|s\<rangle>| ) * (U\<^sup>\<dagger>) * U = (\<langle>|v\<rangle>| \<Otimes> \<langle>|s\<rangle>| ) * ((U\<^sup>\<dagger>) * U)"
using d0 assms(1) unit_vec_def by (smt Matrix.dim_vec assoc_mult_mat carrier_mat_triv dim_row_mat(1)
dim_row_tensor_mat f0 dim_col_of_dagger dim_row_of_dagger ket_vec_def local.dim_col)
moreover have "(\<langle>|v\<rangle>| \<Otimes> \<langle>|s\<rangle>| ) * 1\<^sub>m (2^n * 2^n) = (\<langle>|v\<rangle>| \<Otimes> \<langle>|s\<rangle>| )"
using f0 ket_vec_def d0 by simp
ultimately show ?thesis by simp
qed
then have f2:"(\<langle>|v\<rangle>| * |w\<rangle>) \<Otimes> (\<langle>|v\<rangle>| * |w\<rangle>) = (\<langle>|v\<rangle>| * |w\<rangle>) \<Otimes> (\<langle>|s\<rangle>| * |s\<rangle>)"
proof-
have "\<langle>|v\<rangle>| \<Otimes> \<langle>|v\<rangle>| = (( |v\<rangle> \<Otimes> |v\<rangle>)\<^sup>\<dagger>)"
using hermite_cnj_of_tensor[of "|v\<rangle>" "|v\<rangle>"] bra_def dagger_def ket_vec_def by simp
then show ?thesis
using f1 d0 by (simp add: bra_def mult_distr_tensor ket_vec_def)
qed
then have "\<langle>v|w\<rangle> * \<langle>v|w\<rangle> = \<langle>v|w\<rangle> * \<langle>s|s\<rangle>"
proof-
have "((\<langle>|v\<rangle>| * |w\<rangle>) \<Otimes> (\<langle>|v\<rangle>| * |w\<rangle>)) $$ (0,0) = \<langle>v|w\<rangle> * \<langle>v|w\<rangle>"
using assms inner_prod_with_times_mat[of "v" "w"] by (simp add: bra_def ket_vec_def)
moreover have "((\<langle>|v\<rangle>| * |w\<rangle>) \<Otimes> (\<langle>|s\<rangle>| * |s\<rangle>)) $$ (0,0) = \<langle>v|w\<rangle> * \<langle>s|s\<rangle>"
using inner_prod_with_times_mat[of "v" "w"] inner_prod_with_times_mat[of "s" "s"] by(simp add: bra_def ket_vec_def)
ultimately show ?thesis using f2 by auto
qed
then have "\<langle>v|w\<rangle> = 0 \<or> \<langle>v|w\<rangle> = \<langle>s|s\<rangle>" by (simp add: mult_left_cancel)
moreover have "\<langle>s|s\<rangle> = 1" by(simp add: d0 inner_prod_of_unit_vec)
ultimately show ?thesis using assms(1,2,5,6) by auto
qed
end |
Formal statement is: lemma continuous_on_open_invariant: "continuous_on s f \<longleftrightarrow> (\<forall>B. open B \<longrightarrow> (\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> s))" Informal statement is: A function $f$ is continuous on a set $s$ if and only if for every open set $B$, there exists an open set $A$ such that $A \cap s = f^{-1}(B) \cap s$. |
The latest book from the Al-Attiyah Foundation – Best Practice Guidelines for Corporate Social Responsibility – is based on the premise that the United Nations Sustainable Development Goals (SDGs) serve as a good blueprint for framing corporate social responsibility (CSR) of companies and organisations, as well as how progress in approaches to sustainable development is influencing CSR practices.
The Foundation has developed this new publication with the expectation for it to serve as a useful guide for companies wishing to capitalise on their positive benefits to society, while mitigating, in a meaningful way, the adverse impacts of their activities. It builds on the Foundation’s 2017 publication, on Sustainable Development Goals and Energy Nexus.
The book examines key international standards, guidelines and principles, related to CSR, that have emerged through UN or other multilateral processes, or established by industry or business associations. These standards and guidelines represent the expectations of the international society for responsible business conduct. A concise overview of the standards and guidelines are presented and the key elements that are considered essential for best practice are highlighted and discussed. Some case studies illustrating the contributions, through CSR initiatives, by companies based in Qatar to Qatar National Vision 2030, are presented.
Serves as a tool for responsible environmental management.
Key aspects that should be considered if a CSR initiative is to effectively achieve its intended purpose are identified under each of the above four clusters.
The book is cast within the context of the plethora of CSR initiatives that use the existing different standards and guidelines.
The rapidly changing times and business environment move us deeper and deeper into the new era of corporate responsibilities, where companies are expected to be good neighbours.
Consequently, CSR has become part of the DNA of many companies, although the effectiveness and impact of such programmes varies.
Organisations have recognised that, in addition to legal and regulatory incentives, there are also strategic, operational, reputational and financial reasons to seriously address the social and environmental aspects of their operations.
For many companies, especially those that operate internationally, environmental and social challenges – often called ‘non-technical risks’ can have as much potential to harm their bottom line as financial issues.
Companies are increasingly using their experiences of local challenges to work with communities to determine how best to align their investments in projects with community needs. |
Vincent Verdoold studied Microbiology at the Saxion Hogeschool Enschede. His Bachelors project was done at the UMC Utrecht where he worked on the Development of a Combined Herpes Simplex type 1 and 2 real-time-PCR. He obtained his MSc. in Biotechnology from the University of Ulster in Northern Ireland where he studied the antibacterial effects of several plants, and Protein purification and separation/detection. Since 2006 he has been PhD student at the University of Twente, working on the On-chip coupling of a High Performance Liquid Chromatography chip (HPLC) to Mass spectrometry (MS).
As from February 2010 Vincent is working as a researcher/developer for Medisse B.V., a Dutch company that develops, produces and markets soft tissue implants, based on bio-resorbable PTMC polymers. |
[STATEMENT]
lemma R_cons: "t p \<le> t p' \<Longrightarrow> t q' \<le> t q \<Longrightarrow> R p' q' \<le> R p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>tp \<le> tp'; tq' \<le> tq\<rbrakk> \<Longrightarrow> R p' q' \<le> R p q
[PROOF STEP]
by (simp add: H_cons R2 R1) |
/*
* Copyright (c) 2016-2021 lymastee, All rights reserved.
* Contact: [email protected]
*
* This file is part of the gslib project.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#ifndef uuid_93a5858f_7040_4f67_9767_808d2a4f7ff9_h
#define uuid_93a5858f_7040_4f67_9767_808d2a4f7ff9_h
#include <gslib/type.h>
#include <gslib/string.h>
__gslib_begin__
struct uuid_timestamp
{
byte tm_sec;
byte tm_min;
byte tm_hour;
byte tm_mday; /* day of month */
byte tm_mon;
byte tm_wday; /* day of week */
int16 tm_year;
int16 tm_yday; /* day of year */
int32 tm_fraction;
};
enum uuid_version
{
uuid_v1, /* date-time & MAC address */
uuid_v2, /* DCE security */
uuid_v3, /* MD5 hash & namespace */
uuid_v4, /* random */
uuid_v5, /* SHA-1 hash & namespace */
uuid_ver_default = uuid_v4,
uuid_ver_invalid = uuid_v2,
};
struct uuid_raw
{
uint data1;
uint16 data2;
uint16 data3;
byte data4[8];
};
class uuid:
protected uuid_raw
{
public:
uuid();
uuid(uuid_version ver) { generate(ver); }
uuid(uuid_version ver, const gchar* name, int len) { generate(ver, name, len); }
uuid(const string& str) { from_string(str.c_str(), str.length()); }
uuid(const gchar* str, int len) { from_string(str, len); }
bool operator==(const uuid& that) const;
bool is_valid() const;
void generate(uuid_version ver);
void generate(uuid_version ver, const gchar* name, int len);
void from_string(const gchar* str, int len);
const gchar* to_string(string& str) const;
void get_timestamp(uuid_timestamp& ts) const;
};
__gslib_end__
#endif
|
Require Import VST.floyd.proofauto.
Require Import CertiGraph.graph.graph_model.
Require Import CertiGraph.kruskal.WeightedEdgeListGraph.
Require Import CertiGraph.graph.FiniteGraph.
Require Import CertiGraph.kruskal.env_kruskal_edgelist.
Local Open Scope logic.
Definition wedge_to_cdata (wedge : LE*EType) : reptype t_struct_edge :=
(Vint (Int.repr (fst wedge)),
(Vint (Int.repr (fst (snd wedge))),
Vint (Int.repr (snd (snd wedge)))
)
).
Lemma wedge_to_cdata_wedgerep:
forall w, Int.min_signed <= fst w <= Int.max_signed ->
Int.min_signed <= fst (snd w) <= Int.max_signed ->
Int.min_signed <= snd (snd w) <= Int.max_signed ->
def_wedgerep (wedge_to_cdata w).
Proof.
intros. unfold wedge_to_cdata; unfold def_wedgerep; simpl. lia.
Qed.
Lemma map_local_functions_eq:
forall (A B: Type) (f f': A -> B) (l: list A),
(forall x: A, In x l -> f x = f' x) -> map f l = map f' l.
Proof.
induction l; intros. auto.
simpl. rewrite (H a). rewrite IHl. auto.
intros. apply H. right; auto. left; auto.
Qed.
Lemma list_inj_map_NoDup:
forall (A B : Type) (f : A -> B) (l : list A),
(forall x y : A, In x l -> In y l -> f x = f y -> x = y) -> NoDup l -> NoDup (map f l).
Proof.
induction l; intros. simpl. apply NoDup_nil.
simpl. apply NoDup_cons. unfold not; intros.
apply NoDup_cons_iff in H0; destruct H0.
apply list_in_map_inv in H1. destruct H1. destruct H1. apply H in H1. subst a. contradiction.
left; auto. right; auto.
apply IHl. intros. apply H. right; auto. right; auto. auto. apply NoDup_cons_iff in H0. apply H0.
Qed.
Lemma sound_wedge_to_cdata_inj:
forall size (g: @EdgeListGG size),
(forall x y : LE * EType,
In x (graph_to_wedgelist g) ->
In y (graph_to_wedgelist g) -> wedge_to_cdata x = wedge_to_cdata y -> x = y).
Proof.
intros. unfold graph_to_wedgelist in H, H0. apply list_in_map_inv in H. destruct H.
apply list_in_map_inv in H0. destruct H0. destruct H. destruct H0. unfold edge_to_wedge in H. unfold edge_to_wedge in H0.
subst x. subst y.
apply EList_evalid in H2. apply EList_evalid in H3.
assert (Hvvalid_x0: vvalid g (fst x0) /\ vvalid g (snd x0)). {
rewrite <- (src_fst g), <- (dst_snd g) by auto. apply edge_valid; auto.
}
destruct Hvvalid_x0 as [Hx0_1 Hx0_2].
assert (Hvvalid_x1: vvalid g (fst x1) /\ vvalid g (snd x1)). {
rewrite <- (src_fst g), <- (dst_snd g) by auto. apply edge_valid; auto.
}
destruct Hvvalid_x1 as [Hx1_1 Hx1_2].
unfold wedge_to_cdata in H1; simpl in H1.
apply pair_equal_spec in H1. destruct H1. apply pair_equal_spec in H0. destruct H0.
apply Vint_injective in H. apply Vint_injective in H0. apply Vint_injective in H1.
apply repr_inj_signed in H. rewrite H.
2: unfold repable_signed; apply (weight_valid g); auto.
2: unfold repable_signed; apply (weight_valid g); auto.
replace x0 with (fst x0, snd x0). 2: destruct x0; auto.
replace x1 with (fst x1, snd x1). 2: destruct x1; auto.
apply repr_inj_signed in H0. rewrite H0.
apply repr_inj_signed in H1. rewrite H1. auto.
all: unfold repable_signed.
apply (@vertex_representable size) in Hx0_2. lia. apply (size_bound g).
apply (@vertex_representable size) in Hx1_2. lia. apply (size_bound g).
apply (@vertex_representable size) in Hx0_1. lia. apply (size_bound g).
apply (@vertex_representable size) in Hx1_1. lia. apply (size_bound g).
Qed.
Lemma wedge_to_cdata_NoDup:
forall size (g: @EdgeListGG size),
NoDup (map wedge_to_cdata (graph_to_wedgelist g)).
Proof.
intros. pose proof (NoDup_g2wedgelist g). apply list_inj_map_NoDup. 2: auto.
apply sound_wedge_to_cdata_inj.
Qed.
Definition c_connected_by_path size (g: @EdgeListGG size) p u v :=
match u, v with
| Vint u', Vint v' => connected_by_path g p (Int.signed u') (Int.signed v')
| _, _ => False
end.
Lemma def_wedgerep_map_w2c:
forall size (g: @EdgeListGG size),
Forall def_wedgerep (map wedge_to_cdata (graph_to_wedgelist g)).
Proof.
intros.
rewrite Forall_forall; intros.
apply list_in_map_inv in H.
destruct H as [? [? _]].
unfold wedge_to_cdata in H.
unfold def_wedgerep.
rewrite (surjective_pairing x) in *.
inversion H; clear H.
destruct x.
rewrite (surjective_pairing c) in *.
simpl fst in *; simpl snd in *.
inversion H2; clear H2.
rewrite H1, H0, H3. split3; trivial.
Qed.
(*Warning, this is a BAD definition. It's only because the place it's used in has
Forall def_wedgerep, so the second will never happen*)
Definition cdata_to_wedge (cwedge: reptype t_struct_edge) : (LE*EType) :=
match cwedge with
| (Vint w, (Vint x, Vint y)) => (Int.signed w,(Int.signed x,Int.signed y))
| _ => (0, (0,0))
end.
Lemma w2c2w:
forall w, Int.min_signed <= fst w <= Int.max_signed ->
Int.min_signed <= fst (snd w) <= Int.max_signed ->
Int.min_signed <= snd (snd w) <= Int.max_signed ->
cdata_to_wedge (wedge_to_cdata w) = w.
Proof.
unfold wedge_to_cdata; unfold cdata_to_wedge; intros.
repeat rewrite Int.signed_repr by auto. destruct w; destruct p; simpl; auto.
Qed.
Lemma cons_eq:
forall {A: Type} (l l': list A) (a: A), l = l' -> a::l = a::l'.
Proof. intros. rewrite H. auto. Qed.
Lemma w2c2w_map:
forall l,
(forall w, In w l -> Int.min_signed <= fst w <= Int.max_signed /\
Int.min_signed <= fst (snd w) <= Int.max_signed /\
Int.min_signed <= snd (snd w) <= Int.max_signed) ->
map cdata_to_wedge (map wedge_to_cdata l) = l.
Proof.
intros. induction l. simpl; auto.
rewrite map_cons. rewrite map_cons.
assert (In a (a::l)) by (left;auto). apply H in H0. destruct H0 as [? [? ?]].
rewrite w2c2w; auto. apply cons_eq. apply IHl. intros. apply H. right; auto.
Qed.
Lemma c2w2c:
forall wedgerep, def_wedgerep wedgerep ->
wedge_to_cdata (cdata_to_wedge wedgerep) = wedgerep.
Proof.
unfold def_wedgerep; intros. destruct H as [? [? ?]].
destruct (fst wedgerep) eqn:Hw; try contradiction.
destruct (fst (snd wedgerep)) eqn:Hu; try contradiction.
destruct (snd (snd wedgerep)) eqn:Hv; try contradiction.
replace wedgerep with (Vint i, (Vint i0, Vint i1)).
2: { rewrite <- Hw; rewrite <- Hu; rewrite <- Hv. destruct wedgerep as [? [? ?]]; auto. }
unfold wedge_to_cdata; unfold cdata_to_wedge; simpl.
repeat rewrite Int.repr_signed; auto.
Qed.
Lemma c2w2c_map:
forall (l: list (reptype t_struct_edge)),
Forall def_wedgerep l ->
map wedge_to_cdata (map cdata_to_wedge l) = l.
Proof.
induction l; intros. simpl; auto.
rewrite map_cons. rewrite map_cons. rewrite c2w2c.
apply cons_eq. apply IHl. apply Forall_inv_tail in H. auto.
apply Forall_inv in H; auto.
Qed.
Definition Vundef_cwedges (n: Z): list (reptype t_struct_edge) :=
repeat (Vundef, (Vundef, Vundef)) (Z.to_nat n).
Lemma Vundef_cwedges_Zlength:
forall n: Z, 0 <= n -> Zlength (Vundef_cwedges n) = n.
Proof.
intros. unfold Vundef_cwedges. apply Zlength_repeat. auto.
Qed.
|
State Before: α : Type u_2
β : Type u_1
γ : Type ?u.1687696
δ : Type ?u.1687699
m : MeasurableSpace α
μ ν✝ : Measure α
mb : MeasurableSpace β
ν : Measure β
g : α → β
hg : MeasurePreserving g
hge : MeasurableEmbedding g
f : β → ℝ≥0∞
s : Set β
⊢ (∫⁻ (a : α) in g ⁻¹' s, f (g a) ∂μ) = ∫⁻ (b : β) in s, f b ∂ν State After: no goals Tactic: rw [← hg.map_eq, hge.restrict_map, hge.lintegral_map] |
open import Web.Semantic.DL.ABox using ( ABox )
open import Web.Semantic.DL.Signature using ( Signature )
open import Web.Semantic.DL.TBox using ( TBox )
module Web.Semantic.DL.KB where
infixr 4 _,_
data KB (Σ : Signature) (X : Set) : Set where
_,_ : (T : TBox Σ) → (A : ABox Σ X) → KB Σ X
tbox : ∀ {Σ X} → KB Σ X → TBox Σ
tbox (T , A) = T
abox : ∀ {Σ X} → KB Σ X → ABox Σ X
abox (T , A) = A
|
-- Andreas, 2017-04-26, issue #2554
-- Allow mutual sized types in successor style.
-- {-# OPTIONS -v tc.pos.args:100 #-}
-- {-# OPTIONS -v tc.pos:100 #-}
-- {-# OPTIONS -v tc.polarity:20 #-}
open import Agda.Builtin.Size
mutual
data C : Size → Set where
c : ∀{i} → D i → C (↑ i)
data D : Size → Set where
d : ∀{i} → C i → D (↑ i)
-- Test subtyping
test : ∀{i} {j : Size< i} → C j → C i
test x = x
-- Define a size-preserving function
mutual
f : ∀{i} → C i → C i
f (c y) = c (g y)
g : ∀{i} → D i → D i
g (d x) = d (f x)
|
open import Algebra.Apartness using (HeytingField)
module Data.Real.Abstract.Structures {c ℓ₁ ℓ₂} (f : HeytingField c ℓ₁ ℓ₂) where
open HeytingField f
open import Relation.Binary using (Rel; IsStrictTotalOrder)
open import Level using (_⊔_)
open import Data.Product using (_×_; ∃-syntax)
import Data.Nat as ℕ
open ℕ using (ℕ; zero; suc)
record IsOrderedHeytingField
{r} (_<_ : Rel Carrier r) : Set (c ⊔ ℓ₁ ⊔ r)
where
field
isStrictTotalOrder : IsStrictTotalOrder _≈_ _<_
ordered : ∀ a b c → a < b → (a + c) < (b + c) × (c + a) < (c + b)
_ℕ*_ : ℕ → Carrier → Carrier
zero ℕ* x = 1#
suc n ℕ* x = x * (n ℕ* x)
record IsArchimedanHeytingField
{r} (_<_ : Rel Carrier r) : Set (c ⊔ ℓ₁ ⊔ r)
where
field
dense : ∀ a b → a < b → ∃[ c ] (a < c) × (c < b)
archimedan : ∀ a b → 0# < a → 0# < b → ∃[ n ] (b < (n ℕ* a))
|
[STATEMENT]
lemma func_le_dom: "f \<preceq> g \<Longrightarrow> dom f \<subseteq> dom g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. f \<preceq> g \<Longrightarrow> dom f \<subseteq> dom g
[PROOF STEP]
by (auto simp add: func_le_def, metis domIff option.simps(2)) |
(* Title: HOL/Auth/n_german_lemma_on_inv__38.thy
Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
*)
header{*The n_german Protocol Case Study*}
theory n_german_lemma_on_inv__38 imports n_german_base
begin
section{*All lemmas on causal relation between inv__38 and some rule r*}
lemma n_RecvReqVsinv__38:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvReq N i)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvReq N i" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__38 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Ident ''Chan3'') p__Inv4) ''Cmd'')) (Const InvAck)) (eqn (IVar (Ident ''CurCmd'')) (Const Empty))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Ident ''Chan3'') p__Inv4) ''Cmd'')) (Const InvAck)) (eqn (IVar (Ident ''CurCmd'')) (Const Empty))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendInvEVsinv__38:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInvE i)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInvE i" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__38 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendInvSVsinv__38:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInvS i)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInvS i" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__38 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_SendInvAckVsinv__38:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInvAck i)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInvAck i" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__38 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Para (Ident ''InvSet'') p__Inv4)) (Const true)) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv4) ''Cmd'')) (Const Inv))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_RecvInvAckVsinv__38:
assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvInvAck i)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvInvAck i" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__38 p__Inv4" apply fastforce done
have "(i=p__Inv4)\<or>(i~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(i=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(i~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_StoreVsinv__38:
assumes a1: "\<exists> i d. i\<le>N\<and>d\<le>N\<and>r=n_Store i d" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_SendReqESVsinv__38:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqES i" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_RecvGntSVsinv__38:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvGntS i" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_SendGntSVsinv__38:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendGntS i" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_RecvGntEVsinv__38:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvGntE i" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_SendReqSVsinv__38:
assumes a1: "\<exists> j. j\<le>N\<and>r=n_SendReqS j" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_SendGntEVsinv__38:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendGntE N i" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_SendReqEIVsinv__38:
assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqEI i" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__38 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
end
|
Require Import Setoid.
Parameter A : Set.
Axiom eq_dec : forall a b : A, {a = b} + {a <> b}.
Inductive set : Set :=
| Empty : set
| Add : A -> set -> set.
Fixpoint In (a : A) (s : set) {struct s} : Prop :=
match s with
| Empty => False
| Add b s' => a = b \/ In a s'
end.
Definition same (s t : set) : Prop := forall a : A, In a s <-> In a t.
Lemma setoid_set : Setoid_Theory set same.
unfold same in |- *; split ; red.
red in |- *; auto.
red in |- *.
intros.
elim (H a); auto.
intros.
elim (H a); elim (H0 a).
split; auto.
Qed.
Add Setoid set same setoid_set as setsetoid.
Add Morphism In : In_ext.
unfold same in |- *; intros a s t H; elim (H a); auto.
Qed.
Lemma add_aux :
forall s t : set,
same s t -> forall a b : A, In a (Add b s) -> In a (Add b t).
unfold same in |- *; simple induction 2; intros.
rewrite H1.
simpl in |- *; left; reflexivity.
elim (H a).
intros.
simpl in |- *; right.
apply (H2 H1).
Qed.
Add Morphism Add : Add_ext.
split; apply add_aux.
assumption.
rewrite H.
reflexivity.
Qed.
Fixpoint remove (a : A) (s : set) {struct s} : set :=
match s with
| Empty => Empty
| Add b t =>
match eq_dec a b with
| left _ => remove a t
| right _ => Add b (remove a t)
end
end.
Lemma in_rem_not : forall (a : A) (s : set), ~ In a (remove a (Add a Empty)).
intros.
setoid_replace (remove a (Add a Empty)) with Empty.
auto.
unfold same in |- *.
split.
simpl in |- *.
case (eq_dec a a).
intros e ff; elim ff.
intros; absurd (a = a); trivial.
simpl in |- *.
intro H; elim H.
Qed.
Parameter P : set -> Prop.
Parameter P_ext : forall s t : set, same s t -> P s -> P t.
Add Morphism P : P_extt.
intros; split; apply P_ext; (assumption || apply (Seq_sym _ _ setoid_set); assumption).
Qed.
Lemma test_rewrite :
forall (a : A) (s t : set), same s t -> P (Add a s) -> P (Add a t).
intros.
rewrite <- H.
rewrite H.
setoid_rewrite <- H.
setoid_rewrite H.
setoid_rewrite <- H.
trivial.
Qed.
(* Unifying the domain up to delta-conversion (example from emakarov) *)
Definition id: Set -> Set := fun A => A.
Definition rel : forall A : Set, relation (id A) := @eq.
Definition f: forall A : Set, A -> A := fun A x => x.
Add Relation (id A) (rel A) as eq_rel.
Add Morphism (@f A) : f_morph.
Proof.
unfold rel, f. trivial.
Qed.
(* Submitted by Nicolas Tabareau *)
(* Needs unification.ml to support environments with de Bruijn *)
Goal forall
(f : Prop -> Prop)
(Q : (nat -> Prop) -> Prop)
(H : forall (h : nat -> Prop), Q (fun x : nat => f (h x)) <-> True)
(h:nat -> Prop),
Q (fun x : nat => f (Q (fun b : nat => f (h x)))) <-> True.
intros f0 Q H.
setoid_rewrite H.
tauto.
Qed.
(** Check proper refreshing of the lemma application for multiple
different instances in a single setoid rewrite. *)
Section mult.
Context (fold : forall {A} {B}, (A -> B) -> A -> B).
Context (add : forall A, A -> A).
Context (fold_lemma : forall {A B f} {eqA : relation B} x, eqA (fold A B f (add A x)) (fold _ _ f x)).
Context (ab : forall B, A -> B).
Context (anat : forall A, nat -> A).
Goal forall x, (fold _ _ (fun x => ab A x) (add A x) = anat _ (fold _ _ (ab nat) (add _ x))).
Proof. intros.
setoid_rewrite fold_lemma.
change (fold A A (fun x0 : A => ab A x0) x = anat A (fold A nat (ab nat) x)).
Abort.
End mult.
(** Current semantics for rewriting with typeclass constraints in the lemma
does not fix the instance at the first unification, use [at], or simply rewrite for
this semantics. *)
Require Import Arith.
Class Foo (A : Type) := {foo_neg : A -> A ; foo_prf : forall x : A, x = foo_neg x}.
Instance: Foo nat. admit. Defined.
Instance: Foo bool. admit. Defined.
Goal forall (x : nat) (y : bool), beq_nat (foo_neg x) 0 = foo_neg y.
Proof. intros. setoid_rewrite <- foo_prf. change (beq_nat x 0 = y). Abort.
Goal forall (x : nat) (y : bool), beq_nat (foo_neg x) 0 = foo_neg y.
Proof. intros. setoid_rewrite <- @foo_prf at 1. change (beq_nat x 0 = foo_neg y). Abort.
|
-- -------------------------------------------------------------- [ Lens.idr ]
-- Description : Idris port of Control.Lens
-- Copyright : (c) Huw Campbell
-- --------------------------------------------------------------------- [ EOH ]
module Data.Contravariant
public export
interface Contravariant (0 f : Type -> Type) where
contramap : (b -> a) -> f a -> f b
-- --------------------------------------------------------------------- [ EOF ]
|
isSingleton : Bool -> Type
isSingleton True = Nat
isSingleton False = List Nat
mkSingle : (x : Bool) -> isSingleton x
mkSingle True = 0
mkSingle False = []
sum : (single : Bool) -> isSingleton single -> Nat
sum True x = x
sum False [] = 0
sum False (x::xs) = x + sum False xs
|
module slots.imports where
open import Data.Nat public using (ℕ ; zero ; suc ; _+_ ; _*_)
open import Data.Fin public using (Fin ; zero ; suc ; #_)
open import Data.List public using (List ; [] ; _∷_)
open import Data.Vec public using (Vec ; [] ; _∷_)
open import Data.Product public using (_×_ ; _,_ ; proj₁ ; proj₂)
open import Function public using (const ; _∘_ ; _$_ ; case_of_)
open import Relation.Nullary public using (Dec ; yes ; no)
open import Relation.Binary.PropositionalEquality public using (_≡_ ; refl)
module N = Data.Nat
module F = Data.Fin
module L = Data.List
module V = Data.Vec
module P = Data.Product
|
(*
Copyright (C) 2017 M.A.L. Marques
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)
(* type: work_gga_x *)
mu := 0.2195149727645171:
c := (146/2025)*(4/9) - (73/405)*(2/3) + (mu - 10/81):
kappa := 0.8040:
f0_aux := s -> kappa + MU_GE * s^2 + (mu - MU_GE) * s^2 * exp(-s^2) + log(1 + c * s^4):
f0_wc := s -> 1 + kappa*(1 - kappa/f0_aux(s)):
f_wc := x -> f0_wc(X2S*x):
f := x -> f_wc(x):
|
# Problem Statement:
\begin{equation} H_{0} : p_{gate30} - p_{gate40} >= 0 \end{equation}
\begin{equation} H_{1} : p_{gate30} - p_{gate40} < 0 \end{equation}
```python
import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
%matplotlib inline
```
## Read & Understand the data
```python
### Your Code Here ###
df = pd.read_csv('cookie_cats.csv')
df.head()
```
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>userid</th>
<th>version</th>
<th>sum_gamerounds</th>
<th>retention_1</th>
<th>retention_7</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>116</td>
<td>gate_30</td>
<td>3</td>
<td>False</td>
<td>False</td>
</tr>
<tr>
<th>1</th>
<td>337</td>
<td>gate_30</td>
<td>38</td>
<td>True</td>
<td>False</td>
</tr>
<tr>
<th>2</th>
<td>377</td>
<td>gate_40</td>
<td>165</td>
<td>True</td>
<td>False</td>
</tr>
<tr>
<th>3</th>
<td>483</td>
<td>gate_40</td>
<td>1</td>
<td>False</td>
<td>False</td>
</tr>
<tr>
<th>4</th>
<td>488</td>
<td>gate_40</td>
<td>179</td>
<td>True</td>
<td>True</td>
</tr>
</tbody>
</table>
</div>
```python
df.shape
```
(90189, 5)
```python
df.isnull().any().sum()
```
0
```python
df.userid.duplicated().sum()
```
0
### How many player in each group?
##### Hint: Use groupby with count
```python
### Your Code Here ###
df.groupby('version').count()
```
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>userid</th>
<th>sum_gamerounds</th>
<th>retention_1</th>
<th>retention_7</th>
</tr>
<tr>
<th>version</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>gate_30</th>
<td>44700</td>
<td>44700</td>
<td>44700</td>
<td>44700</td>
</tr>
<tr>
<th>gate_40</th>
<td>45489</td>
<td>45489</td>
<td>45489</td>
<td>45489</td>
</tr>
</tbody>
</table>
</div>
### What is the percentage of users that came back the day after they installed?
```python
### Your Code Here ###
df.retention_1.mean()
```
0.4452095044850259
### What is the percentage of users of each group [gate_30, gate_40] that came back the day after they installed?
```python
### Your Code Here ###
gate_30 = df.query("version == 'gate_30'").retention_1.mean()
gate_40 = df.query("version == 'gate_40'").retention_1.mean()
gate_30, gate_40
obs_sample = gate_30 - gate_40
obs_sample
```
0.005905169787341458
### Bootstrap the data by resampling the dataset with replacement for retention_1
##### Hint: use .sample method with frac = 1 and replace = True
##### Hint: groupby the result of sampling by version column then select retention_1 column and apply mean as an agg function
##### Hint: take difference in mean between the 2 groups in each iteration and append it to a list
```python
df_30 = df.query("version == 'gate_30'")
df_40 = df.query("version == 'gate_40'")
```
```python
### Your Code Here ###
diffs = []
for _ in range(10000):
sample_30 = np.random.choice([0,1],df_30.shape[0], p = [1-gate_30, gate_30])
sample_40 = np.random.choice([0,1],df_40.shape[0], p = [1-gate_40, gate_40])
diff = sample_30.mean() - sample_40.mean()
diffs.append(diff)
```
### Plot the difference distribution
```python
### Your Code Here ###
plt.hist(diffs);
```
### At alpha level 0.05, should we reject the null ?
##### Hint: Calculate the STDerr, Simulate under the null, Calculate the p-value
```python
diffs = np.array(diffs)
```
```python
### Your Code Here ###
under_null = np.random.normal(0, diffs.std(), 10000)
```
```python
### Your Code Here ###
plt.hist(under_null)
plt.axvline(x= obs_sample, color = 'r');
```
```python
P_value = (under_null < obs_sample).mean()
P_value
```
0.9653
**Since P_Value is (0.9648) > alpha (0.05), So we Fail to Reject the Null Hypothesis.**
```python
```
|
Formal statement is: lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation: "orthogonal_transformation f \<longleftrightarrow> linear f \<and> (\<forall>v. norm (f v) = norm v)" Informal statement is: A linear transformation $f$ is an orthogonal transformation if and only if $\|f(v)\| = \|v\|$ for all $v$. |
module IFace1
import Stuff
%default partial
infixl 5 ==, /=
interface Eq b where
(==) : b -> b -> Bool
(/=) : b -> b -> Bool
Eq Nat where
(==) Z Z = True
(==) (S j) (S k) = j == k
(==) _ _ = False
(/=) x y = not (x == y)
[silly] Eq Nat where
(==) Z Z = False
(==) (S j) (S k) = j == k
(==) _ _ = True
(/=) x y = not (x == y)
Eq a => Eq (List a) where
(==) [] [] = True
(==) (x :: xs) (y :: ys) = x == y && xs == ys
(==) _ _ = False
(/=) x y = not (x == y)
(Eq a, Eq b) => Eq (a, b) where
(==) (x, y) (x', y') = x == x' && y == y'
(/=) x y = not (x == y)
[alsoSilly] Eq a => Eq (List a) where
(==) [] [] = False
(==) (x :: xs) (y :: ys) = x == y && xs == ys
(==) _ _ = True
(/=) x y = not (x == y)
test : ((Eq b, Eq b, Eq a), Eq b) => a -> a -> Bool
test x y = x == y
interface DecEq ty where
decEq : (x : ty) -> (y : ty) -> Dec (x = y)
-- partial!
eqNat : (x : Nat) -> (y : Nat) -> Dec (x = y)
eqNat (S x) (S y)
= case eqNat x y of
Yes Refl => Yes Refl
eqNat Z Z = Yes Refl
DecEq Nat where
decEq = eqNat
data Vect : _ -> Type -> Type where
Nil : Vect Z a
(::) : a -> Vect k a -> Vect (S k) a
Eq a => Eq (Vect n a) where
(==) [] [] = True
(==) (x :: xs) (y :: ys) = x == y && xs == ys
(==) _ _ = False
(/=) xs ys = not (xs == ys)
v1 : DPair Nat (\n => Vect n Nat)
v1 = MkDPair _ [Z, S Z]
v2 : DPair Nat (\n => Vect n Nat)
v2 = MkDPair _ [Z, Z]
(DecEq a, {t : a} -> Eq (p t)) => Eq (DPair a p) where
(==) (MkDPair l r) (MkDPair l' r')
= case decEq l l' of
Yes Refl => ?foo
No _ => False
(/=) x y = not (x == y)
|
A function $f$ converges to $l$ at infinity if and only if for every $\epsilon > 0$, there exists a $b$ such that for all $x$ with $|x| \geq b$, we have $|f(x) - l| < \epsilon$. |
[STATEMENT]
lemma measurable_const:
"c \<in> space M' \<Longrightarrow> (\<lambda>x. c) \<in> measurable M M'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c \<in> space M' \<Longrightarrow> (\<lambda>x. c) \<in> M \<rightarrow>\<^sub>M M'
[PROOF STEP]
by (auto simp add: measurable_def) |
function tor_ihb_TalSpace()
% :Usage:
% ::
%
% tor_ihb_TalSpace
%
% Main function to view SPM99 cluster's (contours & 3D) in Talariach space
%
%==================================================================================
% Graphic objects and their 'Tags':
%==================================================================================
% type handle Tag Description
%----------------------------------------------------------------------------------
% figure hFigMain ihb_TalSpaceMain_fig Main figure
% figure hFig3D ihb_TalSpace3D_fig 3D view figure
% figure hFigLeg ihb_TalSpaceLeg_fig Legend figure
%
% axes hAxis3D ihb_axesTalSpace3D Axes for 3D view
% light hLight ihb_lightTalSpace3D Light object for 3D view
%
% patch ihb_cntAxial contours patch handles
% patch ihb_cntFrontal in 3D view window
% patch ihb_cntSaggitalL
% patch ihb_cntSaggitalR
%
% patch ihb_surfaceCluster isosurface patch
%
% uicontrol ihb_CursorCoord coordinates under cursor
% uicontrol ihb_ClusterLevelProb cluster probability
% uicontrol ihb_VoxelLevelProb extr. probability
% uicontrol ihb_VolumeInVox cluster volume
% uicontrol ihb_ClusterPopUp select cluster combo box
%
% uicontrol ihb_clr_Orig pushbuttons for
% uicontrol ihb_clr_Symm color change in
% uicontrol ihb_clr_Surface legend window
% uicontrol ihb_clr_Axial
% uicontrol ihb_clr_Frontal
% uicontrol ihb_clr_Saggital
%
% line ihb_LineOriginal lines for original clusters
% line ihb_LineSymmetrical lines for symmetrical clusters
%
% uimenu ihb_VoxSizeMenu111
% uimenu ihb_VoxSizeMenu222
% uimenu ihb_VoxSizeMenu444
%
% uimenu ihb_RendererMenuZbuffer
% uimenu ihb_RendererMenuOpenGL
%
% uimenu ihb_TransparencyMenu
% uimenu ihb_TransparencyMenuOpaque
% uimenu ihb_TransparencyMenuLow
% uimenu ihb_TransparencyMenuMedium
% uimenu ihb_TransparencyMenuHigh
%
% uimenu ihb_Axes3DMenuClusterOnly
% uimenu ihb_Axes3DMenuWholeBrain
%
% uimenu ihb_LineWidthMenuThin
% uimenu ihb_LineWidthMenuNormal
% uimenu ihb_LineWidthMenuThick
%
%==================================================================================
% Application data (name used with setappdata the same as handle or variable name
%==================================================================================
% for hFigMain:
%
% axes hAxAxial axial
% axes hAxFront frontal
% axes hAxSagL left saggital
% axes hAxSagR right saggital
% strucure array clusters array of selected clusters
% integer indClusterToView index of currently viewed cluster in clusters array
% bool drawSymLS == 1 if draw symmetrical on left saggital
% bool drawSymRS == 1 if draw symmetrical on right saggital
%
%----------------------------------------------------------------------------------
%
% for hAxis (where hAxis is one of hAxAxial, hAxFront, hAxSagL, hAxSagR):
% (see ihb_LoadSlice for detail)
%
% strucure array sliceInfo array of Talarich slice information (ihbdfl_ax_info etc.)
% integer array rngArray array of local indexes in sliceInfo
% integer sliceIndex index of slice in the local range array rngArray
% double sliceDist slice distance from origin
% string axType axis type: 'ax' 'fr' 'sl' 'sr'
% 1x2 vector xLim limit values for X direction
% 1x2 vector yLim limit values for Y direction
%
%
%==================================================================================
% Default information in ihb_TalSpaceDfl.mat file (see ihb_ResetDefaults)
%==================================================================================
% To get default variable with name var use:
%
% load('ihb_TalSpaceDfl.mat', 'var');
%
% To save:
%
% save('ihb_TalSpaceDfl.mat', 'var', '-append');
%----------------------------------------------------------------------------------
% Figures tags for windows created by SPM during call spm_getSPM
%----------------------------------------------------------------------------------
% ihbdfl_spm_fig_Interactive
% ihbdfl_spm_fig_SelFileWin
% ihbdfl_spm_fig_ConMan
%----------------------------------------------------------------------------------
% Minimal size of clusters to draw
%----------------------------------------------------------------------------------
% ihbdfl_min_size_to_draw
%----------------------------------------------------------------------------------
% Sizes of voxels used in Talariach space
%----------------------------------------------------------------------------------
% ihbdfl_tal_x_vox
% ihbdfl_tal_y_vox
% ihbdfl_tal_z_vox
%----------------------------------------------------------------------------------
% Sizes of main window and axis for ihb_TalSpace
%----------------------------------------------------------------------------------
% ihbdfl_main_width
% ihbdfl_main_height
% ihbdfl_main_gap
% ihbdfl_main_x
% ihbdfl_main_y
% ihbdfl_main_z
% ihbdfl_main_info_h
%----------------------------------------------------------------------------------
% Talariach slices information
%----------------------------------------------------------------------------------
% ihbdfl_ax_info
% ihbdfl_fr_info
% ihbdfl_sl_info
% ihbdfl_sr_info
%----------------------------------------------------------------------------------
% Axis limits to draw slice
%----------------------------------------------------------------------------------
% ihbdfl_xLimD
% ihbdfl_yLimD
% ihbdfl_zLimD
% ihbdfl_xLimI
% ihbdfl_yLimI
% ihbdfl_zLimI
%----------------------------------------------------------------------------------
% 3D view Renderer ('zbuffer' or 'OpenGL')
% 3D view transparency (available only for OpenGL
%----------------------------------------------------------------------------------
% ihbdfl_renderer
% ihbdfl_transparency
%----------------------------------------------------------------------------------
% Axes for 3D view type. If ihbdfl_bAxesIsClusterOnly == 1 - axes have cluster range
% 0 - axes have brain range
%----------------------------------------------------------------------------------
% ihbdfl_bAxesIsClusterOnly
%----------------------------------------------------------------------------------
% Colors defaults
%----------------------------------------------------------------------------------
% ihbdfl_color_clOrig
% ihbdfl_color_clSymm
% ihbdfl_color_surface
% ihbdfl_color_cntAx
% ihbdfl_color_cntFr
% ihbdfl_color_cntSag
%----------------------------------------------------------------------------------
% Line width
%----------------------------------------------------------------------------------
% ihbdfl_line_width
%==================================================================================
%
% ..
% 09.04.01 Sergey Pakhomov
% 01.08.01 last modified
% ..
% ..
% Create Default information file if necessary
% ..
dflFileName = ihb_FileFolderName('dfl');
fid = fopen(dflFileName);
if fid == -1
ihb_ResetDefaults;
else
fclose(fid);
end
%==================================================================================
% Delete previous figures
%==================================================================================
ihb_ResetFigure('ihb_TalSpaceMain_fig');
ihb_ResetFigure('ihb_TalSpace3D_fig');
ihb_ResetFigure('ihb_TalSpaceLeg_fig');
%==================================================================================
% Create main figure
%==================================================================================
screenUnits = get(0, 'units'); % Save current screen units
set(0, 'units', 'pixels'); % Set pixels units for screen
scrSize = get(0,'ScreenSize'); % Get screen size in pixels
set(0, 'units', screenUnits); % Restore current screen units
load(dflFileName, 'ihbdfl_main_width');
load(dflFileName, 'ihbdfl_main_height');
pos(3) = ihbdfl_main_width;
pos(4) = ihbdfl_main_height;
pos(1) = (scrSize(3) - pos(3))/2;
pos(2) = (scrSize(4) - pos(4))/2;
hFigMain = figure(...
'Visible', 'off',...
'NumberTitle', 'off',...
'MenuBar', 'none',...
'Name', 'Talairach slices',...
'Tag', 'ihb_TalSpaceMain_fig',...
'CloseRequestFcn', 'ihb_CloseTalSpaceCB',...
'ResizeFcn', 'ihb_ResizeTalSpaceCB',...
'units', 'pixels',...
'Position', pos);
%==================================================================================
% Set menu
%==================================================================================
%----------------------------------------------------------------------------------
% File menu
%----------------------------------------------------------------------------------
hFileMenu = uimenu('Label', 'File');
uimenu(hFileMenu, 'Label', 'New clusters', 'Callback', 'ihb_GetClusterSet');
uimenu(hFileMenu, 'Label', 'Exit', 'Callback', 'close', 'Separator', 'on');
%----------------------------------------------------------------------------------
% 3D View menu
%----------------------------------------------------------------------------------
h3DViewMenu = uimenu('Label', '3D View', 'Callback', 'ihb_TalSpaceView3D');
%----------------------------------------------------------------------------------
% Color Legend menu
%----------------------------------------------------------------------------------
hLegendMenu = uimenu('Label', 'Colors', 'Callback', 'ihb_ColorsTalSpace');
%----------------------------------------------------------------------------------
% Option menu
%----------------------------------------------------------------------------------
hOptionMenu = uimenu('Label', 'Options');
%------------------------------------------------------------------------------
% Voxel size submenu
%------------------------------------------------------------------------------
hVoxSizeMenu = uimenu(hOptionMenu, 'Label', 'Voxel size');
uimenu(hVoxSizeMenu, 'Tag', 'ihb_VoxSizeMenu111', 'Label', '1x1x1', 'Callback', 'ihb_TalSpaceVoxSizeMenuCB(1)');
uimenu(hVoxSizeMenu, 'Tag', 'ihb_VoxSizeMenu222', 'Label', '2x2x2', 'Callback', 'ihb_TalSpaceVoxSizeMenuCB(2)');
uimenu(hVoxSizeMenu, 'Tag', 'ihb_VoxSizeMenu444', 'Label', '4x4x4', 'Callback', 'ihb_TalSpaceVoxSizeMenuCB(4)');
%------------------------------------------------------------------------------
% Renderer submenu
%------------------------------------------------------------------------------
hRendererMenu = uimenu(hOptionMenu, 'Label', '3D renderer');
uimenu(hRendererMenu, 'Tag', 'ihb_RendererMenuZbuffer', 'Label', 'Zbuffer', 'Callback', 'ihb_TalSpaceRendererMenuCB(1)');
uimenu(hRendererMenu, 'Tag', 'ihb_RendererMenuOpenGL', 'Label', 'OpenGL', 'Callback', 'ihb_TalSpaceRendererMenuCB(2)');
%------------------------------------------------------------------------------
% Transparency submenu
%------------------------------------------------------------------------------
hTransparencyMenu = uimenu(hOptionMenu, 'Tag', 'ihb_TransparencyMenu', 'Label', '3D Transparency');
uimenu(hTransparencyMenu, 'Tag', 'ihb_TransparencyMenuOpaque', 'Label', 'Opaque', 'Callback', 'ihb_TalSpaceTransparencyMenuCB(1.0)');
uimenu(hTransparencyMenu, 'Tag', 'ihb_TransparencyMenuLow', 'Label', 'Low', 'Callback', 'ihb_TalSpaceTransparencyMenuCB(0.8)');
uimenu(hTransparencyMenu, 'Tag', 'ihb_TransparencyMenuMedium', 'Label', 'Medium', 'Callback', 'ihb_TalSpaceTransparencyMenuCB(0.5)');
uimenu(hTransparencyMenu, 'Tag', 'ihb_TransparencyMenuHigh', 'Label', 'High', 'Callback', 'ihb_TalSpaceTransparencyMenuCB(0.2)');
%------------------------------------------------------------------------------
% 3D axes submenu
%------------------------------------------------------------------------------
hAxes3DMenu = uimenu(hOptionMenu, 'Label', '3D view axes');
uimenu(hAxes3DMenu, 'Tag', 'ihb_Axes3DMenuClusterOnly', 'Label', 'Cluster Only', 'Callback', 'ihb_TalSpaceAxes3DMenuCB(1)');
uimenu(hAxes3DMenu, 'Tag', 'ihb_Axes3DMenuWholeBrain', 'Label', 'Whole Brain', 'Callback', 'ihb_TalSpaceAxes3DMenuCB(0)');
%------------------------------------------------------------------------------
% Smoothing submenu
%------------------------------------------------------------------------------
% hSmoothMenu = uimenu(hOptionMenu, 'Label', 'Smoothing');
%------------------------------------------------------------------------------
% Line width submenu
%------------------------------------------------------------------------------
hLineWidthMenu = uimenu(hOptionMenu, 'Label', 'Line width');
uimenu(hLineWidthMenu, 'Tag', 'ihb_LineWidthMenuThin', 'Label', 'Thin', 'Callback', 'ihb_TalSpaceLineWidthMenuCB(1)');
uimenu(hLineWidthMenu, 'Tag', 'ihb_LineWidthMenuNormal', 'Label', 'Normal', 'Callback', 'ihb_TalSpaceLineWidthMenuCB(2)');
uimenu(hLineWidthMenu, 'Tag', 'ihb_LineWidthMenuThick', 'Label', 'Thick', 'Callback', 'ihb_TalSpaceLineWidthMenuCB(4)');
hResetMenu = uimenu(hOptionMenu, 'Label', 'Reset Defaults', 'Callback', 'ihb_TalSpaceResetMenuCB');
%----------------------------------------------------------------------------------
% Help menu
%----------------------------------------------------------------------------------
hHelpMenu = uimenu('Label', 'Help');
uimenu(hHelpMenu, 'Label', 'Web site', 'Callback', 'ihb_TalSpaceHelp');
uimenu(hHelpMenu, 'Label', 'About', 'Callback', 'ihb_AboutTalSpace');
%----------------------------------------------------------------------------------
ihb_TalSpaceSetMenuCheck;
%----------------------------------------------------------------------------------
% Set axis and information UI
%----------------------------------------------------------------------------------
ihb_SetAxis(hFigMain);
ihb_SetInfoUI(hFigMain);
%----------------------------------------------------------------------------------
% Set mouse move callback
%----------------------------------------------------------------------------------
set(hFigMain, 'WindowButtonMotionFcn', 'ihb_MotionTalSpaceCB');
%----------------------------------------------------------------------------------
% Select cluster set and cluster to view while
%----------------------------------------------------------------------------------
bIsEmpty = 0;
while bIsEmpty == 0
bIsEmpty = tor_ihb_GetClusterSet;
if bIsEmpty == 0
h = msgbox('Cluster to view should be selected', 'Warning!', 'warn', 'modal');
waitfor(h);
end
end
|
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Data.FinData.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Nat
open import Cubical.Relation.Nullary
data Fin : ℕ → Type₀ where
zero : {n : ℕ} → Fin (suc n)
suc : {n : ℕ} (i : Fin n) → Fin (suc n)
toℕ : ∀ {n} → Fin n → ℕ
toℕ zero = 0
toℕ (suc i) = suc (toℕ i)
fromℕ : (n : ℕ) → Fin (suc n)
fromℕ zero = zero
fromℕ (suc n) = suc (fromℕ n)
¬Fin0 : ¬ Fin 0
¬Fin0 ()
|
[STATEMENT]
lemma store_tval_disjoint_1_content:
assumes "store_tval obj off val = obj'"
and "val \<noteq> Undef"
and "off' < off"
shows "Mapping.lookup (content obj) off' = Mapping.lookup (content obj') off'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Mapping.lookup (content obj) off' = Mapping.lookup (content obj') off'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
store_tval obj off val = obj'
val \<noteq> Undef
off' < off
goal (1 subgoal):
1. Mapping.lookup (content obj) off' = Mapping.lookup (content obj') off'
[PROOF STEP]
by (clarsimp simp add: store_tval_def split: ccval.split_asm)
(presburger add: stored_bytes_prev stored_cap_prev)+ |
{-# OPTIONS --universe-polymorphism #-}
module Categories.Colimit where
open import Level
open import Categories.Category
open import Categories.Functor
open import Categories.NaturalTransformation
open import Categories.Functor.Constant
open import Categories.Cocones
open import Categories.Cocone
open import Categories.Object.Initial
-- Isomorphic to an terminal object, but worth keeping distinct in case we change its definition
record Colimit {o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} (F : Functor J C) : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) where
field
initial : Initial (Cocones F)
module I = Initial initial
module Ic = Cocone I.⊥
private module C = Category C
∃F : C.Obj
∃F = Ic.N
ι : NaturalTransformation F (Constant ∃F)
ι = record { η = Ic.ψ; commute = λ f → C.Equiv.trans (C.Equiv.sym (Ic.commute f)) (C.Equiv.sym C.identityˡ) }
<_> : ∀ {Q} → NaturalTransformation F (Constant Q) → ∃F C.⇒ Q
<_> {Q} η = CoconeMorphism.f (I.! {record
{ N = Q
; ψ = η.η
; commute = λ f → C.Equiv.trans (C.Equiv.sym C.identityˡ) (C.Equiv.sym (η.commute f)) }})
where
module η = NaturalTransformation η
record Cocomplete (o ℓ e : Level) {o′ ℓ′ e′} (C : Category o′ ℓ′ e′) : Set (suc o ⊔ suc ℓ ⊔ suc e ⊔ o′ ⊔ ℓ′ ⊔ e′) where
field
colimit : ∀ {J : Category o ℓ e} (F : Functor J C) → Colimit F
|
-- 2010-10-15
module DoNotEtaExpandMVarsWhenComparingAgainstRecord where
open import Common.Irrelevance
data _==_ {A : Set1}(a : A) : A -> Set where
refl : a == a
record IR : Set1 where
constructor mkIR
field
.fromIR : Set
open IR
reflIR2 : (r : IR) -> _ == mkIR (fromIR r)
reflIR2 r = refl {a = _}
-- this would fail if
-- ? = mkIR (fromIR r)
-- would be solved by
-- mkIR ?1 = mkIR (fromIR r)
-- because then no constraint is generated for ?1 due to triviality
|
(* Title: WhileGraphSSA.thy
Author: Denis Lohner, Sebastian Ullrich
*)
subsubsection \<open>Instantiation for a Simple While Language\<close>
theory WhileGraphSSA imports
Generic_Interpretation
Disjoin_Transform
"HOL-Library.List_Lexorder"
"HOL-Library.Char_ord"
begin
instantiation w_node :: ord
begin
fun less_eq_w_node where
"(_Entry_) \<le> x = True"
| "(_ n _) \<le> x = (case x of
(_Entry_) \<Rightarrow> False
| (_ m _) \<Rightarrow> n \<le> m
| (_Exit_) \<Rightarrow> True)"
| "(_Exit_) \<le> x = (x = (_Exit_))"
fun less_w_node where
"(_Entry_) < x = (x \<noteq> (_Entry_))"
| "(_ n _) < x = (case x of
(_Entry_) \<Rightarrow> False
| (_ m _) \<Rightarrow> n < m
| (_Exit_) \<Rightarrow> True)"
| "(_Exit_) < x = False"
instance ..
end
instance w_node :: linorder proof
fix x y z :: w_node
show "x \<le> x" by (cases x) auto
show "x \<le> y \<or> y \<le> x" by (cases x) (cases y, auto)+
show "x < y \<longleftrightarrow> x \<le> y \<and> \<not> y \<le> x" by (cases x) (cases y, auto)+
assume "x \<le> y" and "y \<le> z"
thus "x \<le> z" by (cases x, cases y, cases z) auto
assume "x \<le> y" and "y \<le> x"
thus "x = y" by (cases x) (cases y, auto)+
qed
declare Defs.simps [simp del]
declare Uses.simps [simp del]
declare Let_def [simp]
declare finite_valid_nodes [simp, intro!]
lemma finite_valid_edge [simp, intro!]: "finite (Collect (valid_edge c))"
unfolding valid_edge_def [abs_def]
apply (rule inj_on_finite [where f="\<lambda>(f,d,t). (f,t)" and B="Collect (valid_node c) \<times> Collect (valid_node c)"])
apply (rule inj_onI)
apply (auto intro: WCFG_edge_det)[1]
apply (force simp: valid_node_def valid_edge_def)[1]
by auto
lemma uses_expr_finite: "finite (rhs_aux e)"
by (induction e) auto
lemma uses_cmd_finite: "finite (rhs c)"
by (induction c) (auto intro: uses_expr_finite)
lemma defs_cmd_finite: "finite (lhs c)"
by (induction c) auto
lemma finite_labels': "finite {(l,c). labels prog l c}"
proof -
have "{l. \<exists>c. labels prog l c} = fst ` {(l,c). labels prog l c}"
by auto
with finite_labels [of prog] labels_det [of prog] show ?thesis
by (auto 4 4 intro: inj_onI dest: finite_imageD)
qed
lemma finite_Uses [simp, intro!]: "finite (Uses c n)"
unfolding Uses.simps
apply clarsimp
apply (rule_tac B="\<Union>(rhs ` snd ` {(l,c'). labels c l c'})" in finite_subset)
apply fastforce
apply (rule finite_Union)
apply (rule finite_imageI)+
apply (rule finite_labels')
by (clarsimp simp: uses_cmd_finite)
definition "while_cfg_\<alpha>e c = Collect (valid_edge (transform c))"
definition "while_cfg_\<alpha>n c = sorted_list_of_set (Collect (valid_node (transform c)))"
definition "while_cfg_invar c = True"
definition "while_cfg_inEdges' c t = (SOME ls. distinct ls \<and> set ls = {(sourcenode e, kind e)| e. valid_edge (transform c) e \<and> targetnode e = t})"
definition "while_cfg_Entry c = (_Entry_)"
definition "while_cfg_defs c = (Defs (transform c))((_Entry_) := {v. \<exists>n. v \<in> Uses (transform c) n})"
definition "while_cfg_uses c = Uses (transform c)"
abbreviation "while_cfg_inEdges c t \<equiv> map (\<lambda>(f,d). (f,d,t)) (while_cfg_inEdges' c t)"
lemmas while_cfg_defs = while_cfg_\<alpha>e_def while_cfg_\<alpha>n_def
while_cfg_invar_def while_cfg_inEdges'_def
while_cfg_Entry_def while_cfg_defs_def
while_cfg_uses_def
interpretation while: graph_path while_cfg_\<alpha>e while_cfg_\<alpha>n while_cfg_invar while_cfg_inEdges'
apply unfold_locales
apply (simp_all add: while_cfg_defs)
apply (force simp: valid_node_def)[1]
apply (force simp: valid_node_def)[1]
apply (rule set_iterator_I)
prefer 3 apply (simp add: foldri_def)
apply simp
apply simp
apply (clarsimp simp: Graph_path.pred_def)
apply (subgoal_tac "finite {(v', w). valid_edge (transform g) (v', w, v)}")
apply (drule finite_distinct_list)
apply clarsimp
apply (rule_tac a=xs in someI2)
apply simp
apply clarsimp
apply (metis set_iterator_foldri_correct)
apply (rule_tac f="\<lambda>(f,d,t). (f,d)" in finite_surj [OF finite_valid_edge])
by (auto intro: rev_image_eqI)
lemma right_total_const: "right_total (\<lambda>x y. x = c)"
by (rule right_totalI) simp
lemma const_transfer: "rel_fun (\<lambda>x y. x = c) (=) f (\<lambda>_. f c)"
by (clarsimp simp: rel_fun_def)
interpretation while_ign: graph_path "\<lambda>_. while_cfg_\<alpha>e cmd" "\<lambda>_. while_cfg_\<alpha>n cmd" "\<lambda>_. while_cfg_invar cmd" "\<lambda>_. while_cfg_inEdges' cmd"
by (rule graph_path_transfer [OF right_total_const const_transfer const_transfer const_transfer const_transfer, rule_format])
unfold_locales
definition "gen_while_cfg g \<equiv> \<lparr>
gen_\<alpha>e = while_cfg_\<alpha>e g,
gen_\<alpha>n = while_cfg_\<alpha>n g,
gen_inEdges = while_cfg_inEdges g,
gen_Entry = while_cfg_Entry g,
gen_defs = while_cfg_defs g ,
gen_uses = while_cfg_uses g
\<rparr>"
lemma while_path_graph_pathD: "While_CFG.path (transform c) n es m \<Longrightarrow> while.path2 c n (n#map targetnode es) m"
unfolding while.path2_def
apply (induction n es m rule: While_CFG.path.induct)
apply clarsimp
apply (rule while.path.intros)
apply (auto simp: while_cfg_defs valid_node_def While_CFG.valid_node_def)[1]
apply (simp add: while_cfg_defs)
apply clarsimp
apply (rule while.path.intros)
apply assumption
apply (clarsimp simp: while.predecessors_def)
apply (rename_tac n ed m)
apply (rule_tac x="(n,ed,m)" in image_eqI)
apply simp
apply (clarsimp simp: while.inEdges_def)
apply (rule_tac x="(n,ed)" in image_eqI)
apply simp
apply (clarsimp simp: while_cfg_inEdges'_def)
apply (subgoal_tac "finite {(aa, a). valid_edge (transform c) (aa, a, m)}")
prefer 2
apply (rule_tac f="\<lambda>(f,d,t). (f,d)" in finite_surj [OF finite_valid_edge])
apply (auto intro: rev_image_eqI)[1]
apply (drule finite_distinct_list)
apply clarsimp
by (rule_tac a=xs in someI2; simp)
lemma Uses_Entry [simp]: "Uses c (_Entry_) = {}"
unfolding Uses.simps by auto
lemma in_Uses_valid_node: "V \<in> Uses c n \<Longrightarrow> valid_node c n"
by (auto dest!: label_less_num_inner_nodes less_num_nodes_edge
simp: Uses.simps valid_node_def valid_edge_def)
lemma while_cfg_CFG_wf_impl:
"SSA_CFG.CFG_wf (\<lambda>_. gen_\<alpha>e (gen_while_cfg cmd)) (\<lambda>_. gen_\<alpha>n (gen_while_cfg cmd))
(\<lambda>_. while_cfg_invar cmd) (\<lambda>_. gen_inEdges' (gen_while_cfg cmd))
(\<lambda>_. gen_Entry (gen_while_cfg cmd)) (\<lambda>_. gen_defs (gen_while_cfg cmd))
(\<lambda>_. gen_uses (gen_while_cfg cmd))"
apply (simp add: gen_while_cfg_def o_def split_beta)
unfolding SSA_CFG.CFG_wf_def
apply (rule conjI)
apply (rule CFG_transfer [OF right_total_const const_transfer const_transfer const_transfer const_transfer const_transfer const_transfer const_transfer, rule_format])
apply unfold_locales[1]
apply (auto simp: while_cfg_defs valid_node_def valid_edge_def intro: While_CFG.intros)[1]
apply (clarsimp simp: while.inEdges_def)
apply (clarsimp simp: while_cfg_defs valid_edge_def)
apply (subgoal_tac "{(aa, a). transform g \<turnstile> aa -a\<rightarrow> (_Entry_)} = {}")
apply clarsimp
apply (rule_tac a="[]" in someI2; simp)
apply auto[1]
apply (subst(asm) while_cfg_\<alpha>n_def)
apply simp
apply (drule valid_node_Entry_path)
apply clarsimp
apply (drule while_path_graph_pathD)
apply (auto simp: while_cfg_Entry_def)[1]
apply (clarsimp simp: while_cfg_defs)
apply (clarsimp simp: while_cfg_defs)
apply (subgoal_tac "{v. \<exists>n. v \<in> Uses (transform g) n} = (\<Union>n \<in> Collect (valid_node (transform g)). Uses (transform g) n)")
apply simp
apply (auto dest: in_Uses_valid_node)[1]
apply (auto dest!: label_less_num_inner_nodes less_num_nodes_edge
simp: Uses.simps valid_node_def valid_edge_def while_cfg_defs)[1]
apply (clarsimp simp: while_cfg_defs)
apply (clarsimp simp: while_cfg_defs)
apply (clarsimp simp: SSA_CFG.CFG_wf_axioms_def CFG_base.defAss'_def)
apply (rule_tac x="(_Entry_)" in bexI)
apply (auto simp: while_cfg_defs)[1]
by (auto elim: graph_path_base.path.cases simp: graph_path_base.path2_def while_cfg_Entry_def)
lift_definition gen_while_cfg_wf :: "cmd \<Rightarrow> (w_node, vname, state edge_kind) gen_cfg_wf"
is gen_while_cfg
using while_cfg_CFG_wf_impl
by (auto simp: gen_while_cfg_def o_def split_beta while_cfg_invar_def)
definition "build_ssa cmd = gen_ssa_wf_notriv_substAll (gen_ssa_cfg_wf (gen_while_cfg_wf cmd))"
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CMPT 435
% Spring 2019
% Assignment One
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Short Sectioned Assignment
% LaTeX Template
% Version 1.0 (5/5/12)
%
% This template has been downloaded from: http://www.LaTeXTemplates.com
% Original author: % Frits Wenneker (http://www.howtotex.com)
% License: CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
% Modified by Alan G. Labouseur - [email protected]
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[letterpaper, 10pt]{article}
\usepackage[english]{babel} % English language/hyphenation
\usepackage{graphicx}
\usepackage[lined,linesnumbered,commentsnumbered]{algorithm2e}
\usepackage{listings}
\usepackage{fancyhdr} % Custom headers and footers
\pagestyle{fancyplain} % Makes all pages in the document conform to the custom headers and footers
\usepackage{lastpage}
\usepackage{url}
\fancyhead{} % No page header - if you want one, create it in the same way as the footers below
\fancyfoot[L]{} % Empty left footer
\fancyfoot[C]{page \thepage\ of \pageref{LastPage}} % Page numbering for center footer
\fancyfoot[R]{}
\renewcommand{\headrulewidth}{0pt} % Remove header underlines
\renewcommand{\footrulewidth}{0pt} % Remove footer underlines
\setlength{\headheight}{13.6pt} % Customize the height of the header
%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------
\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height
\title{
\normalfont \normalsize
\textsc{CMPT 435 - Spring 2019 - Dr. Labouseur} \\[10pt] % Header stuff.
\horrule{0.5pt} \\[0.25cm] % Top horizontal rule
\huge Assignment Zero -- \LaTeX ~Limerick \\ % Assignment title
\horrule{0.5pt} \\[0.25cm] % Bottom horizontal rule
}
\author{Daniel Gisolfi \\ \normalsize \href{https://github.com/dgisolfi}}
\date{\normalsize\today} % Today's date.
\begin{document}
\maketitle % Print the title
%----------------------------------------------------------------------------------------
% CONTENT SECTION
%----------------------------------------------------------------------------------------
% - -- - - -- - - -- - -
\section*{Limerick}
\noindent
A Jack of all trades is a master of none, \\
but oftentimes better than a master of one. \\
\hspace*{1.5em}Python fits the bill, \\
\hspace*{1.5em}for many quick thrills. \\
Use it for an algorithm and you'll be the first done. \\
\vspace{2em}
\end{document}
|
State Before: α : Type u
β : Type v
γ : Type w
R : Type x
inst✝ : NonUnitalNonAssocRing R
a b x y x' y' : R
h : SemiconjBy a x y
h' : SemiconjBy a x' y'
⊢ SemiconjBy a (x - x') (y - y') State After: no goals Tactic: simpa only [sub_eq_add_neg] using h.add_right h'.neg_right |
lemma prime_power_cancel: assumes "prime p" and eq: "m * (p ^ k) = m' * (p ^ k')" and "\<not> p dvd m" "\<not> p dvd m'" shows "k = k'" |
{-# OPTIONS --cubical --safe #-}
module Algebra.Construct.Free.Semilattice.Relation.Unary where
open import Algebra.Construct.Free.Semilattice.Relation.Unary.All.Def public
open import Algebra.Construct.Free.Semilattice.Relation.Unary.All.Dec public
open import Algebra.Construct.Free.Semilattice.Relation.Unary.All.Properties public
open import Algebra.Construct.Free.Semilattice.Relation.Unary.All.Map public
open import Algebra.Construct.Free.Semilattice.Relation.Unary.Membership public
open import Algebra.Construct.Free.Semilattice.Relation.Unary.Any.Def public
open import Algebra.Construct.Free.Semilattice.Relation.Unary.Any.Dec public
open import Algebra.Construct.Free.Semilattice.Relation.Unary.Any.Properties public
open import Algebra.Construct.Free.Semilattice.Relation.Unary.Any.Map public
|
/**
* @file bblas_sutil.c
*
* @brief BBLAS testing utilities for float routines.
*
* BBLAS is a software package provided by Univ. of Manchester,
* Univ. of Tennessee.
*
* @version 1.0.0
* @author Samuel D. Relton
* @author Pedro V. Lara
* @author Mawussi Zounon
* @date 2016-02-20
*
* Contains routines used in the testing to modify randomly generated matrices
* and compute the average error over an entire batch etc.
*
**/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/**
* Code generation
* @generated from bblas_zutil.c normal z -> s, Mon Jun 6 09:44:13 2016
**/
#endif
#include "bblas_common.h"
#if defined(BBLAS_WITH_MKL)
#include <mkl_lapacke.h>
#else
#include <lapacke.h>
#endif
/** Include real functions since using float real precision **/
#define REAL
/** Quick access to the matrix elements **/
#define A(i,j) A[i + j*lda]
/**
* Make a matrix symmetric/symmetric. Makes diagonal real.
* Sets Aji = conj( Aij ) for j < i, that is, copy & conjugate
* lower triangle to upper triangle.
**/
void bblas_smake_symmetric(int lda, int N, float* A)
{
int i, j;
for( i=0; i < N; ++i ) {
A(i,i) = creal( A(i,i) );
for( j=0; j < i; ++j ) {
A(j,i) = conj( A(i,j) );
}
}
}
#ifdef COMPLEX
/**
* Make a matrix real-symmetric
* Does NOT make diagonal real.
* Sets Aji = Aij for j < i, that is,
* copy lower triangle to upper triangle.
**/
void bblas_smake_symmetric(int lda, int N, float* A)
{
int i, j;
for( i=0; i < N; ++i ) {
for( j=0; j < i; ++j ) {
A(j,i) = A(i,j);
}
}
}
#endif
/**
* irandRange generates a random value (int)
* in the range min_n and max_n
**/
int irandRange(int min_n, int max_n)
{
return rand() % (max_n - min_n + 1) + min_n;
}
/**
* bblas_srandRange generates a random value (float)
* in the range [0,max_n]: TODO replace by generic
*/
float bblas_srandRange( int max_n )
{
return ( float )rand()/( float )( RAND_MAX/max_n );
}
/**
* Computes statistics of the relative errors to summarise them for the user.
**/
void bblas_sstatistic(bblas_stest_t *test)
{
enum BBLAS_ROUTINE routine = test->routine;
/*Compute avg(M), avg(N), avg(K) */
if(test->batch_opts == BBLAS_VARIABLE)
{
if ((routine == BBLAS_GEMM) || (routine == BBLAS_SYMM) ||
(routine == BBLAS_HEMM) || (routine == BBLAS_TRMM) ||
(routine == BBLAS_TRSM))
{
test->avgM = bblas_avgarrayI(test->M, test->batch_count);
}
if ((routine == BBLAS_GEMM) || (routine == BBLAS_SYRK) ||
(routine == BBLAS_HERK) || (routine == BBLAS_SYR2K) ||
(routine == BBLAS_HER2K))
{
test->avgK = bblas_avgarrayI(test->K, test->batch_count);
}
test->avgN = bblas_avgarrayI(test->N, test->batch_count);
} else if (test->batch_opts == BBLAS_FIXED)
{
if ((routine == BBLAS_GEMM) || (routine == BBLAS_SYMM) ||
(routine == BBLAS_HEMM) || (routine == BBLAS_TRMM) ||
(routine == BBLAS_TRSM))
{
test->avgM = test->M[0];
}
if ((routine == BBLAS_GEMM) || (routine == BBLAS_SYRK) ||
(routine == BBLAS_HERK) || (routine == BBLAS_SYR2K) ||
(routine == BBLAS_HER2K))
{
test->avgK = test->K[0];
}
test->avgN = test->N[0];
} else
{
bblas_error("testing_sgemm_batch.c", "wrong batch_opts value");
}
/*Statistics on the error */
switch(test->target)
{
case BBLAS_MKL:
test->mkl_min_error = bblas_sminarrayD(test->mkl_error, test->batch_count);
test->mkl_avg_error = bblas_savgarrayD(test->mkl_error, test->batch_count);
test->mkl_max_error = bblas_smaxarrayD(test->mkl_error, test->batch_count);
test->mkl_std_error = bblas_sstdarrayD(test->mkl_error, test->batch_count);
break;
case BBLAS_CUBLAS:
case BBLAS_MAGMA:
test->device_min_error = bblas_sminarrayD(test->device_error, test->batch_count);
test->device_avg_error = bblas_savgarrayD(test->device_error, test->batch_count);
test->device_max_error = bblas_smaxarrayD(test->device_error, test->batch_count);
test->device_std_error = bblas_sstdarrayD(test->device_error, test->batch_count);
break;
case BBLAS_OTHER:
test->other_min_error = bblas_sminarrayD(test->other_error, test->batch_count);
test->other_avg_error = bblas_savgarrayD(test->other_error, test->batch_count);
test->other_max_error = bblas_smaxarrayD(test->other_error, test->batch_count);
test->other_std_error = bblas_sstdarrayD(test->other_error, test->batch_count);
break;
default:
printf("In bblas_sstatistic(): Target no defined\n");
exit(EXIT_FAILURE);
}
}
/**
* Print a matrix.
**/
void bblas_sprintmatrix(float *matrix, int row, int col)
{
/*Local variables */
int i, j;
for (i=0; i < row; i++)
{
printf("\n\n");
for (j=0; j < col; j++)
{
#ifdef COMPLEX
printf("%1.2f + %1.2f\t", creal(matrix[i*col+j]), cimag(matrix[i*col+j]));
#else
printf("%1.2f",matrix[i*col+j]);
#endif
}
}
printf("\n");
}
/**
* Decide whether a batch is fixed or variable.
**/
char* bblas_getoption(enum BBLAS_OPTS opts)
{
/*Local variable */
char funcname[] = "bblas_getoption";
switch(opts)
{
case BBLAS_VARIABLE:
return "BATCH OPTION: VARIABLE";
break;
case BBLAS_FIXED:
return "BATCH OPTION: FIXED";
break;
default:
printf("ERROR in %s, undefined bblas routine name\n",funcname);
exit(EXIT_FAILURE);
}
}
/**
* Get the name of the current test routine.
**/
char* bblas_getroutine(enum BBLAS_ROUTINE routine)
{
/*Local variable */
char funcname[] = "bblas_getroutine";
switch(routine)
{
case BBLAS_GEMM:
return "SGEMM";
break;
case BBLAS_HEMM:
return "SSYMM";
break;
case BBLAS_HER2K:
return "SSYR2K";
break;
case BBLAS_HERK:
return "SSYRK";
break;
case BBLAS_SYMM:
return "SSYMM";
break;
case BBLAS_SYR2K:
return "SSYR2K";
break;
case BBLAS_SYRK:
return "SSYRK";
break;
case BBLAS_TRMM:
return "STRMM";
break;
case BBLAS_TRSM:
return "STRSM";
break;
default:
printf("ERROR in %s, undefined bblas routine name\n",funcname);
exit(EXIT_FAILURE);
}
}
/**
* Computes the maximum value of an array of real floats.
**/
float bblas_smaxarrayD(float *myArray, int size)
{
int iter;
float maxValue = myArray[0];
for (iter = 0; iter < size; ++iter)
{
if ( myArray[iter] > maxValue )
{
maxValue = myArray[iter];
}
}
return maxValue;
}
/**
* Computes the minimum value of an array of real floats.
**/
float bblas_sminarrayD(float *myArray, int size)
{
int iter;
float minValue = myArray[0];
for (iter = 0; iter < size; ++iter)
{
if ( myArray[iter] < minValue )
{
minValue = myArray[iter];
}
}
return minValue;
}
/**
* Computes the mean value of an array of real floats.
**/
float bblas_savgarrayD(float *myArray, int size)
{
int iter;
float avg = 0.;
for (iter = 0; iter < size; ++iter)
{
avg += myArray[iter];
}
return avg/size;
}
/**
* Computes the standard deviation of an array of real floats.
**/
float bblas_sstdarrayD(float *myArray, int size)
{
int iter;
float avg, sd=0.;
avg = bblas_savgarrayD(myArray, size);
for (iter = 0; iter < size; ++iter)
{
sd += (myArray[iter] -avg)*(myArray[iter] -avg);
}
return sd/size;
}
/**
* Computes the minimum value of an array of integers.
**/
int bblas_minarrayI(int *myArray, int size)
{
int iter;
int minValue = myArray[0];
for (iter = 0; iter < size; ++iter)
{
if ( myArray[iter] < minValue )
{
minValue = myArray[iter];
}
}
return minValue;
}
/**
* Computes the mean of an array of integers.
**/
int bblas_avgarrayI(int *myArray, int size)
{
int iter;
int avg = 0;
for (iter = 0; iter < size; ++iter)
{
avg += myArray[iter];
}
return avg/size;
}
/**
* Transform BBLAS enum values for <tt>trans</tt>, <tt>uplo</tt> etc. to human-readable strings.
**/
char* bblas_op2char(unsigned int op)
{
char *opname = (char*)malloc(30*sizeof(char));
switch(op)
{
case BblasNoTrans:
strcpy(opname,"CblasNoTrans");
break;
case BblasTrans:
strcpy(opname,"CblasTrans");
break;
case BblasConjTrans:
strcpy(opname,"CblasConjTrans");
break;
case BblasLower:
strcpy(opname,"CblasLower");
break;
case BblasUpper:
strcpy(opname,"CblasUpper");
break;
case BblasNonUnit:
strcpy(opname,"CblasNonUnit");
break;
case BblasUnit:
strcpy(opname,"CblasUnit");
break;
case BblasLeft:
strcpy(opname,"CblasLeft");
break;
case BblasRight:
strcpy(opname,"CblasRight");
break;
default:
return 0;
exit(EXIT_FAILURE);
}
return opname;
}
/**
* Get the amount of data needed.
**/
int bblas_snbdata(bblas_stest_t *test)
{
enum BBLAS_OPTS batch_opts = test->batch_opts;
int nb_data;
char function_name[NAME_LENGTH] ="bblas_getdatacount";
switch(batch_opts)
{
case BBLAS_VARIABLE:
nb_data = test->batch_count;
break;
case BBLAS_FIXED:
nb_data = 1;
break;
default:
bblas_fatal_error(function_name, "wrong batch_opts value");
}
return nb_data;
}
/**
* Inject an error into the computation if this is set in the input file.
**/
void bblas_sset_error(bblas_stest_t *test)
{
int nb_data = bblas_snbdata(test);
int routine = test->routine;
int error_index = irandRange(0, nb_data);
if (test->global_error){
test->batch_count = -1;
return;
}
if (test->batch_opts == BBLAS_FIXED)
{
error_index = 0;
}
if (test->set_error)
{
if ((routine == BBLAS_GEMM) || (routine == BBLAS_SYMM) ||
(routine == BBLAS_HEMM) || (routine == BBLAS_TRMM) ||
(routine == BBLAS_TRSM))
{
test->M[error_index] = -1;
}else if ((routine == BBLAS_SYRK) || (routine == BBLAS_HERK) ||
(routine == BBLAS_SYR2K)|| (routine == BBLAS_HER2K))
{
test->K[error_index] = -1;
}
}
}
/**
* Check whether a computation has passed or failed our accuracy test.
* When new_accuracy=1 in the input file this uses an appropriate
* forward/backward error bound,
* otherwise this looks at the relative error.
**/
void bblas_spassed_failed(bblas_stest_t *test, float error, char *result, int info)
{
float eps = LAPACKE_slamch_work('e');
/* Use our new accuracy test based on forward/backward error analysis*/
if (test->new_accuracy)
{
if( (error > 1) || (info))
{
strcpy(result, "FAILED");
}else
{
strcpy(result, "PASSED");
}
}else
{
/* Use old accuracy test based on the relative error */
if((error > eps*test->tolerance) || (info))
{
strcpy(result, "FAILED");
}else
{
strcpy(result, "PASSED");
}
}
}
/**
* Set the batch_count.
**/
void bblas_sset_batch_count(bblas_stest_t *test)
{
test->batch_count = test->minbatch_count* (test->current_iter+1);
}
#undef REAL
|
[STATEMENT]
lemma ack_less_mono1: "i < j \<Longrightarrow> ack i k < ack j k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. i < j \<Longrightarrow> ack i k < ack j k
[PROOF STEP]
using ack_less_mono1_aux less_iff_Suc_add
[PROOF STATE]
proof (prove)
using this:
ack ?i ?k < ack (Suc (?i + ?j)) ?k
(?m < ?n) = (\<exists>k. ?n = Suc (?m + k))
goal (1 subgoal):
1. i < j \<Longrightarrow> ack i k < ack j k
[PROOF STEP]
by auto |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.