Datasets:
AI4M
/

text
stringlengths
0
3.34M
subroutine mass c c*********************************************************************** c cumulative mass equation m2 c....................................................................... c called by: matgen c*********************************************************************** c include'titan.imp' include'titan.par' include'titan.com' c c======================================================================= c interior zones c======================================================================= c do 1 k = ngrs + 1, ngre + 1 c c equation m14 c rhs(im, k) = xmen(k-1) - xmen(k) - dn (k-1) * dvoln (k-1) c c equations m9 - m13 c e00(im, jm, k) = e00(im, jm, k) - xmen(k ) em1(im, jm, k) = em1(im, jm, k) + xmen(k-1) c e00(im, jr, k) = e00(im, jr, k) - dn (k-1) * rmup1n(k ) em1(im, jr, k) = em1(im, jr, k) + dn (k-1) * rmup1n(k-1) c em1(im, jd, k) = em1(im, jd, k) - dn (k-1) * dvoln (k-1) c 1 continue c c======================================================================= c inner boundary condition c======================================================================= c c eulerian boundary bc14, or lagrangean boundary bc65 (phil0 == 0) c k = ngrs c rhs(im, k) = xmen(k) - xmeo(k) + rmu (k) * phil0 * dtime e00(im, jr, k) = + thet * rn(k) *xmu * rmum1(k) * phil0 * dtime e00(im, jm, k) = xmen(k) c c======================================================================= c phantom zones c======================================================================= c do 2 k = 1, ngrs - 2 rhs(im, k) = 0.0D0 em2(im, jm, k) = 0.0D0 em1(im, jm, k) = 0.0D0 e00(im, jm, k) = 1.0D0 ep1(im, jm, k) = 0.0D0 ep2(im, jm, k) = 0.0D0 2 continue c do 3 k = ngre + 3, mgr rhs(im, k) = 0.0D0 em2(im, jm, k) = 0.0D0 em1(im, jm, k) = 0.0D0 e00(im, jm, k) = 1.0D0 ep1(im, jm, k) = 0.0D0 ep2(im, jm, k) = 0.0D0 3 continue c c----------------------------------------------------------------------- c eulerian inner boundary c----------------------------------------------------------------------- c k = ngrs - 1 c c zero flux; equations pz3 & pz4 c if (leibc .eq. 1) then c rhs(im, k) = xmen(k) - 2.0D0 * xmen(k+1) + xmen(k+2) c ep2(im, jm, k) = + xmen(k+2) ep1(im, jm, k) = - 2.0D0 * xmen(k+1) e00(im, jm, k) = xmen(k) c end if c c nonzero flux; equations pz13 & pz14 c if (leibc .eq. 2) then c rhs(im, k) = - xmen(k) + xmen(k+1) + dl * dvoln (k ) c ep1(im, jm, k) = + xmen(k+1) e00(im, jm, k) = - xmen(k) c ep1(im, jr, k) = + dl * rmup1n(k+1) e00(im, jr, k) = - dl * rmup1n(k ) c end if c c----------------------------------------------------------------------- c lagrangean inner boundary c----------------------------------------------------------------------- c c equations pz23 & pz24 c if (llibc .gt. 0) then c rhs(im, k) = - xmen(k) + xmen(k+1) + delml c ep1(im, jm, k) = + xmen(k+1) e00(im, jm, k) = - xmen(k) c end if c c----------------------------------------------------------------------- c eulerian outer boundary c----------------------------------------------------------------------- c k = ngre + 2 c c zero flux; equations pz41 & pz42 c if (leobc .eq. 1) then c rhs(im, k) = xmen(k-2) - 2.0D0 * xmen(k-1) + xmen(k) c e00(im, jm, k) = + xmen(k) em1(im, jm, k) = - 2.0D0 * xmen(k-1) em2(im, jm, k) = xmen(k-2) c end if c c nonzero flux; equations pz51 & pz52 c if (leobc .eq. 2) then c rhs(im, k) = xmen(k-1) - xmen(k) - dr * dvoln (k-1) c e00(im, jm, k) = - xmen(k) em1(im, jm, k) = xmen(k-1) c e00(im, jr, k) = - dr * rmup1n(k ) em1(im, jr, k) = + dr * rmup1n(k-1) c end if c c transmitting; equations pz61 & pz62 c if (leobc .eq. 3) then c rhs(im, k) = xmen(k-1) - xmen(k) - dn(k-1) * dvoln (k-1) c e00(im, jm, k) = - xmen(k) em1(im, jm, k) = xmen(k-1) c e00(im, jr, k) = - dn(k-1) * rmup1n(k ) em1(im, jr, k) = + dn(k-1) * rmup1n(k-1) c em1(im, jd, k) = - dn(k-1) * dvoln (k-1) c end if c c----------------------------------------------------------------------- c lagrangean outer boundary c----------------------------------------------------------------------- c c equations pz71 & pz72 c if (llobc .gt. 0) then rhs(im, k) = xmen(k-1) - xmen(k) + delmr c e00(im, jm, k) = - xmen(k) em1(im, jm, k) = xmen(k-1) end if c c----------------------------------------------------------------------- c return end
#弯月面Meniscus的高度和角度随流量,极间距离,针头直径变化而变化 #针头三种液体,ethanol,acetone, isoproply #height高度和angle角度,在一张图上,分为上下部分 #三张图,分别对应三种x轴,流量,极间距离,电压 #固定电压数值为2.0kv #用mtext函数标记其他相关参数信息 #函数名为men_ah & men_ea, men_ah & men_aa,men_ih & men_ia #设定工作区间 setwd("D:/data") library(xlsx) #读取数据 men_ah<-read.xlsx("set_voltage.xls", sheetName="distance_h", header=TRUE) men_aa<-read.xlsx("set_voltage.xls", sheetName="distance_a", header=TRUE) #规划figure界面 par(mfrow=c(2,1), mar=c(4,4,2,2), oma=c(2,1,1,1)) #保存pdf pdf("set_voltage_distance.pdf") ################################画图-高度曲线########################### plot(men_ah$distance, men_ah$ethanol, col=0, xaxs="i", xlim=c(0.9, 4.1), ylim=c(0.1, 1.1), xlab="Distance (mm)", cex.lab=1, ylab="Height of Meniscus (mm)", main="Height with H in meniscus") lines(lowess(men_ah$distance, men_ah$ethanol), col="red", pch=21, lwd=2, type="b", lty=2) lines(lowess(men_ah$distance, men_ah$acetone), col="blue", pch=21, lwd=2, type="b", lty=2) lines(lowess(men_ah$distance, men_ah$iso), col="darkgreen", pch=21, lwd=2, type="b", lty=2) legend("topleft", c("ethanol", "acetone", "isoproply"), inset=.02, col=c("red", "blue", "darkgreen"), pch=21, lwd=2, lty=2, cex=0.9) ##############################画图--角度曲线############################ plot(men_aa$distance, men_aa$ethanol, col=0, xaxs="i", xlim=c(0.9, 4.1), ylim=c(50, 140), xlab="Distance (mm)", cex.lab=1, ylab="Taylor Angle (°)", main="Angle with H in meniscus") lines(lowess(men_aa$distance, men_aa$ethanol), col="red", pch=21, lwd=2, type="b", lty=2) lines(lowess(men_aa$distance, men_aa$acetone), col="blue", pch=21, lwd=2, type="b", lty=2) lines(lowess(men_aa$distance, men_aa$iso), col="darkgreen", pch=21, lwd=2, type="b", lty=2) legend("topright", c("ethanol", "acetone", "isoproply"), inset=.02, col=c("red", "blue", "darkgreen"), pch=21, lwd=2, lty=2, cex=0.9) mtext("Voltage is set at 2.0 kv", 1, line=1, col="black", cex=1.3, font=2, outer=TRUE) ###标注信息 dev.off()
#' earthtools. #' #' @name earthtools #' @docType package NULL
[STATEMENT] lemma "x < y \<and> y < z \<longrightarrow> \<not> (z < (x::nat))" [PROOF STATE] proof (prove) goal (1 subgoal): 1. x < y \<and> y < z \<longrightarrow> \<not> z < x [PROOF STEP] by (meson order_less_irrefl order_less_trans)
# Stochastic Variational Inference Notes from the Hoffmann *et al.* (2013) paper In probabilistic modelling, we use hidden variables to encode hidden structure in observed data; we articulate the relationship between the hidden and observed variables with a factorized probability distribution (i.e. a graphical model) and we use inference algorithms to estimate the **posterior distribution**, the **conditional distribution** of hidden structure given the observations. Consider a graphical model of hidden and observed random variables for which we want to compute the posterior. For many models of interest, this posterior is not tractable to compute and we must appeal to approximate methods. The two most prominent strategies in statistics and machine learning are Markov chain Monte Carlo (MCMC) sampling and variational inference * **MCMC Sampling**: We construct a Markov chain over the hidden variables whose stationary distribution is the posterior of interest. We run the chain until it has (hopefully) reached equilibrium and collect samples to approximate the posterior. * **Variational inference**: We define a flexible family of distribution over the hidden variables, indexed by free parameters. We then find the setting of the parameters (i.e. the member of the family) that is closest to the posterior. Thus we solve the inference problem by solving an optimization problem. The aim here is to develop a general variational method that scales. Form of stochastic variational inference: 1. Subsample one or more data points from the data 2. Analyze the subsample using the current variational parameters 3. Implement a closed-form update of the variational parameters. 4. Repeat. While traditional algorithms require repeatedly analyzing the whole dataset before updating the variational parameters, this algorithm only requires that we analyze randomly sampled subsets. SVI is a sochastic **optimization algorithm** for mean-field variational inference. It approximates the posterior distribution of a probabilistic model with hidden variables, and can handle massive data sets of observations. A graphical model with observations $x_{1:N}$, local hidden variables $z_{1:N}$ and global hidden variables $\beta$. The distribution of each observation $x_n$ only depends on its corresponding local variable $z_n$ and the global variables $\beta$. ## 1. Define the class of models to which our algorithm applies. We define *local* and *global* hidden variables, and requirements on the conditional distributions within the model. The joint distribution factorizes into a global term and a product of local terms: $$ p(x, z, \beta |\alpha) = p(\beta | \alpha)\prod_{n=1}^N p(x_n, z_n |\beta) $$ Our goal is to approximate the posterior distribution of the hidden variables given the observations, $p(\beta, z|x)$. **Assumption 1**: The $n$th observation $x_n$ and the $n$th local variable $z_n$ are conditionally independent, given global variables $\beta$, of all other observations and local hidden variables, $$ p(x_n, z_n |x_{-n}, z_{-n},\beta,\alpha) = p(x_n, z_n|\beta,\alpha) $$ **Assumption 2**: The *complete conditionals* in the model. A complete conditional is the conditional distribution of a hidden variable given the other hidden variables and the observations. We assume that these distributions are in the **exponential family**, \begin{eqnarray} p(\beta|x, z, \alpha) & = & h(\beta)\exp\{\eta_g(x, z, \alpha)^Tt(\beta)-a_g(\eta_g(x, z, \alpha))\}\\ p(z_{nj}|x_n, z_{n,-j}, \beta) & = & h(z_{nj})\exp\{\eta_l(x_n, z_{n,-j},\beta)^Tt(z_{nj}) - a_l(\eta_l(x_n, z_{n,-j},\beta))\} \end{eqnarray} The scala functions $h(\cdot)$ and $a(\cdot)$ are respectively the *base measure* and *log-normalizer*, the vector functions $\eta(\cdot)$ and $t(\cdot)$ are respectively the *natural parameter* and *sufficient statistics*. **(For details of this consult a basic statistic book on exponential distributions)**. These are conditional distributions, so the natural parameter is a function of the variables that are being conditioned on. For the local variables $z_{nj}$, the complete conditional distribution is determined by the global variables $\beta$ and the other local variables in the $n$th context, i.e. the $n$th data point $x_n$ and the local variables $z_{n,-j}$. These assumptions on the complete conditional imply a **conjugacy relationship** between the global variables $\beta$ and the local contexts $(z_n, x_n)$, and this relationship implies the distribution of the local context given the global variables must be in an exponential family, \begin{equation} p(x_n, z_n |\beta) = h(x_n, z_n)\exp\{\beta^Tt(x_n, z_n) - a_l(\beta)\} \end{equation} The prior distribution $p(\beta)$ must also be in an exponential family, $$ p(\beta) = h(\beta)\exp\{\alpha^Tt(\beta)-a_g(\alpha)\} $$ The sufficient statistics are $t(\beta) = (\beta, -a_l(\beta))$ and thus the hyperparameter $\alpha$ has two components $\alpha = (\alpha_1, \alpha_2)$. The first component $\alpha_1$ is a vector of the same dimension as $\beta$, the second component $\alpha_2$ is a scalar. The two equations above imply that the complete conditional for the global variable is in the same exponential family as the prior with natural parameter $$ \eta_g(x, z, \alpha) = (\alpha_1 + \sum_{n=1}^N t(z_n, x_n), \alpha_2+N). $$ Analysing data with one of the model associated with this family of distributions (e.g. Bayesian mixture models, Latent Dirichlet allocation) amounts to computing the posterior distribution of the hidden variables given the observations, $$ p(z, \beta |x ) = \frac{p(x, z, \beta)}{\int p(x, z, \beta)dz d\beta}. $$ We then use this posterior to explore the hidden structure of our data or to make predictions about future data. ## 2. Mean field variational inference An approximate inference strategy that seeks a tractable distribution over the hidden variables which is close to the posterior distribution. Derive the traditional variational inference algorithm for our class of models, which is a coordinate ascent algorithm. Closeness is measured with the KL divergence. We use the resulting distribution, called the *variational distribution* to approximate the posterior. ### The evidence lower bound Variational inference minimizes the KL divergence from the variational distribution to the posterior distribution. It maximizes the *evidence lower bound* (ELBO), a lower bound on the logarithm of the marginal probability of the observations $\log p(x)$. The ELBO is equal to the negative KL divergence up to an additive constant. We derive the ELBO by introducing a distribution over the hidden variables $q(\alpha, \beta)$ and using Jensen's inequality. (This implies $\log\mathbb{E}[f(y)]\ge \mathbb{E}[\log f(y)]$ for any random variable $y$). This gives the following bound on the log marginal, \begin{eqnarray} \log p(x) & = & \log\int p(x, z, \beta)dz d\beta\\ & = & \log\int p(x, z, \beta)\frac{q(z, \beta)}{q(z, \beta)}dzd\beta\\ & = & \log\left(\mathbb{E}_q\left[\frac{p(x,z,\beta)}{q(z,\beta)}\right]\right)\\ &\ge & \mathbb{E}_q[\log p(x, z, \beta)]-\mathbb{E}[\log q(z, \beta)]\\ &\triangleq &\mathcal{L}(q). \end{eqnarray} The ELBO contains two terms. The first term is the expected log joint, $\mathbb{E}_q[\log p(x, z, \beta)]$. The second is the entropy of the variational distribution, $-\mathbb{E}_q[\log q(z, \beta)]$. Both of these terms depend on $q(z, \beta)$, the variational distribution of the hidden variables. We restrict $q(z, \beta)$ to be in a family that is tractable, one for which the expectations in the ELBO can be efficiently computed. We then try to find the member of the family that maximizes the ELBO. Finally, we use the optimized distribution as a proxy for the posterior. Solving this maximization problem is equivalent to finding the member of the family that is closest in KL divergence to the posterior: \begin{eqnarray} KL(q(z,\beta)||p(z, \beta|x)) & = & \mathbb{E}_q[\log q(z, \beta)] - \mathbb{E}_q[\log p(z, \beta|x)]\\ & = & \mathbb{E}_q[\log q(z, \beta)]-\mathbb{E}_q[\log p(x, \, \beta)] + \log p(x)\\ & = & -\mathcal{L}(q) + \mathrm{const}. \end{eqnarray} $\log p(x)$ is replaced by a constant because it does not depend on $q$. ### The mean-field variational family. The simplest variational family of distributions. In this family, each hidden variable is independent and governed by its own parameter, $$ q(z, \beta) = q(\beta |\lambda)\prod_{n=1}^N \prod_{j=1}^J q(z_{nj}|\phi_{nj}) $$ The global parameters $\lambda$ govern the global variables, the local parameters $\phi_n$ govern the local variables in the $n$th context. The ELBO is a function of these parameters. We set $q(\beta|\lambda)$ and $q(z_{nj}|\phi_{nj})$ to be in the same exponential family as the complete conditional distributions $p(\beta|x, z)$ and $p(z_{nj}|x_n,z_{n,-j},\beta)$. The variational parameters $\lambda$ and $\phi_{nj}$ are the natural parameters to those families, \begin{eqnarray} q(\beta|\lambda) & = & h(\beta)\exp\{\lambda^Tt(\beta)-a_g(\lambda)\}\\ q(z_{nj}|\phi_{nj}) & = & h(z_{nj})\exp\{\phi_{nj}^Tt(z_{nj}) - a_{l}(\phi_{nj})\} \end{eqnarray}
module Compiler.ES.Ast import Core.CompileExpr import Core.Context import Compiler.Common import Data.List1 import Data.Nat import Data.Vect %default total ||| A variable in a toplevel function definition ||| ||| When generating the syntax tree of imperative ||| statements and expressions, we decide - based on ||| codegen directives - which Idris names to keep ||| and which names to convert to short, mangled ||| versions. public export data Var = ||| An unaltered name - usually a toplevel function ||| or a function argument with an explicitly given ||| name VName Name | ||| Index of a local variables VLoc Int | ||| Index of a mangled toplevel function VRef Int ||| A minimal expression. public export data Minimal = ||| A variable MVar Var | ||| A projection targeting the field of a data type. ||| We include these here since it allows us to ||| conveniently carry around a `SortedMap Name Minimal` ||| for name resolution during the generation of the ||| imperative syntax tree. MProjection Nat Minimal -------------------------------------------------------------------------------- -- Expressions -------------------------------------------------------------------------------- ||| The effect of a statement or a block of statements. ||| `Returns` means the ||| result of the final expression will be returned as ||| the current function's result, while `ErrorWithout v` ||| is a reminder, that the block of code will eventually ||| assign a value to `v` and will fail to do so if ||| `v` hasn't previously been declared. ||| ||| This is used as a typelevel index to prevent us from ||| making some common stupid errors like declaring a variable ||| twice, or having several `return` statements in the same ||| block of code. public export data Effect = Returns | ErrorWithout Var mutual ||| An expression in a function definition. public export data Exp : Type where ||| A variable or projection. Minimal expressions ||| will always be inlined unless explicitly bound ||| in an Idris2 `let` expression. EMinimal : Minimal -> Exp ||| Lambda expression ||| ||| An empty argument list represents a delayed computation ELam : List Var -> Stmt (Just Returns) -> Exp ||| Function application. ||| ||| In case of a zero-argument list, we might also be ||| dealing with forcing a delayed computation. EApp : Exp -> List Exp -> Exp ||| Saturated construtor application. ||| ||| The tag either represents the name of a type constructor ||| (when we are pattern matching on types) or the index ||| of a data constructor. ECon : (tag : Either Int Name) -> ConInfo -> List Exp -> Exp ||| Primitive operation EOp : {0 arity : Nat} -> PrimFn arity -> Vect arity Exp -> Exp ||| Externally defined primitive operation. EExtPrim : Name -> List Exp -> Exp ||| A constant primitive. EPrimVal : Constant -> Exp ||| An erased value. EErased : Exp ||| An imperative statement in a function definition. ||| ||| This is indexed over the `Effect` the statement, ||| will have. ||| An `effect` of `Nothing` means that the result of ||| the statement is `undefined`: The declaration of ||| a constant or assignment of a previously declared ||| variable. When we sequence statements in a block ||| of code, all but the last one of them must have ||| effect `Nothing`. This makes sure we properly declare variables ||| exactly once before eventually assigning them. ||| It makes also sure a block of code does not contain ||| several `return` statements (until they are the ||| results of the branches of a `switch` statement). public export data Stmt : (effect : Maybe Effect) -> Type where ||| Returns the result of the given expression. Return : Exp -> Stmt (Just Returns) ||| Introduces a new constant by assigning the result ||| of a single expression to the given variable. Const : (v : Var) -> Exp -> Stmt Nothing ||| Assigns the result of an expression to the given variable. ||| This will result in an error, if the variable has not ||| yet been declared. Assign : (v : Var) -> Exp -> Stmt (Just $ ErrorWithout v) ||| Declares (but does not yet assign) a new mutable ||| variable. This is the only way to "saturate" ||| a `Stmt (Just $ ErrorWithout v)`. Declare : (v : Var) -> Stmt (Just $ ErrorWithout v) -> Stmt Nothing ||| Switch statement from a pattern match on ||| data or type constructors. The result of each branch ||| will have the given `Effect`. ||| ||| The scrutinee has already been lifted to ||| the outer scope to make sure it is only ||| evaluated once. ConSwitch : (e : Effect) -> (scrutinee : Minimal) -> (alts : List $ EConAlt e) -> (def : Maybe $ Stmt $ Just e) -> Stmt (Just e) ||| Switch statement from a pattern on ||| a constant. The result of each branch ||| will have the given `Effect`. ConstSwitch : (e : Effect) -> (scrutinee : Exp) -> (alts : List $ EConstAlt e) -> (def : Maybe $ Stmt $ Just e) -> Stmt (Just e) ||| A runtime exception. Error : {0 any : _} -> String -> Stmt (Just any) ||| A code block consisting of one or more ||| imperative statements. Block : List1 (Stmt Nothing) -> Stmt e -> Stmt e ||| Single branch in a pattern match on a data or ||| type constructor. public export record EConAlt (e : Effect) where constructor MkEConAlt tag : Either Int Name conInfo : ConInfo body : Stmt (Just e) ||| Single branch in a pattern match on a constant public export record EConstAlt (e : Effect) where constructor MkEConstAlt constant : Constant body : Stmt (Just e) export toMinimal : Exp -> Maybe Minimal toMinimal (EMinimal v) = Just v toMinimal _ = Nothing export prepend : List (Stmt Nothing) -> Stmt (Just e) -> Stmt (Just e) prepend [] s = s prepend (h :: t) s = Block (h ::: t) s export total declare : {v : _} -> Stmt (Just $ ErrorWithout v) -> Stmt Nothing declare (Assign v y) = Const v y declare (Block ss s) = Block ss $ declare s declare s = Declare v s
infopath(resultdir) = joinpath(resultdir, "info.json") resultpath(resultdir, i::Integer) = joinpath(resultdir, "result-$i.json") function loadresults(resultdir, n::Integer) results = Vector{Union{BenchmarkGroup,Nothing}}(undef, n) fill!(results, nothing) for i in 1:n path = resultpath(resultdir, i) isfile(path) || continue data = BenchmarkTools.load(path) @assert length(data) == 1 results[i], = data end return results end """ BenchmarkConfigSweeps.load(resultdir) -> sweepresult Load `sweepresult` from `resultdir`. `sweepresult` object satisfies the row table interface. `Tables.rows(sweepresult)` is an alias of `BenchmarkConfigSweeps.flattable(sweepresult)`. For example, `DataFrame(sweepresult)` can be used to obtain the sweeps as a flat table. Note that `BenchmarkConfigSweeps.flattable` aggressively flatten/splat environment variables and tries to interpret benchmark group keys. For programatic processing, use [`BenchmarkConfigSweeps.simpletable`](@ref) which produces a predictable output. """ function BenchmarkConfigSweeps.load(resultdir) info = loadinfo(infopath(resultdir)) results = loadresults(resultdir, length(info.configs)) return SweepResult(resultdir, info, results) end struct SweepResult resultdir::String info::Info results::Vector{Union{BenchmarkGroup,Nothing}} end function Base.show(io::IO, result::SweepResult) print(io, BenchmarkConfigSweeps, ".load(") show(io, result.resultdir) print(io, ')') end function _simpletable(result::SweepResult) results = result.results configs = result.info.configs::Vector{Config} return ( julia = Union{Missing,Vector{String}}[ cfg.julia === nothing ? missing : cfg.julia.cmd for cfg in configs ], nthreads = Union{Missing,Int}[ cfg.nthreads === nothing ? missing : cfg.nthreads.value for cfg in configs ], env = Union{Missing,Dict{String,Any}}[ cfg.env === nothing ? missing : cfg.env.dict for cfg in configs ], env_inherit = Union{Missing,Bool}[ cfg.env === nothing ? missing : cfg.env.inherit for cfg in configs ], result = Union{Missing,BenchmarkGroup}[ g === nothing ? missing : g for g in results ], ) end function try_parse_kv(str) i = findfirst('=', str) i === nothing && return nothing k = Symbol(strip(SubString(str, 1:i-1))) j = findfirst(!isspace, SubString(str, i+1:lastindex(str))) j === nothing && return nothing vstr = SubString(str, i+j:lastindex(str)) v = tryparse(Int64, vstr) if v !== nothing return k => v end v = tryparse(Float64, vstr) if v !== nothing return k => v end if startswith(vstr, ':') && lastindex(vstr) > 1 return k => Symbol(SubString(vstr, firstindex(vstr)+1:lastindex(vstr))) end return k => vstr end dont_parsekeys(ks) = (; trialkeys = ks) function dwim_parsekeys(strings) vals = Pair{Symbol,Any}[] for (i, str) in enumerate(strings) kv = try_parse_kv(str) if kv === nothing push!(vals, Symbol(:level_, i) => str) else push!(vals, kv) end end return vals end """ BenchmarkConfigSweeps.flattable(sweepresult) -> table BenchmarkConfigSweeps.flattable(group::BenchmarkGroup) -> table Convert a `sweepresult` returned from `BenchmarkConfigSweeps.load(resultdir)` as a flat table where the benchmark parameters are splatted into a flat row. Benchmark labels are expected to be the form `"key=value"`. As a utility, a single `group::BenchmarkGroup` (which may not be obtained through BenchmarkConfigSweeps) can also be passed to this function. """ BenchmarkConfigSweeps.flattable # TODO: type-stabilize by using "concrete" dynamic dispatch function BenchmarkConfigSweeps.flattable(result::SweepResult; parsekeys = dwim_parsekeys) parsekeys = something(parsekeys, dont_parsekeys) simple = _simpletable(result) cols = Pair{Symbol,Vector}[] if !all(ismissing, simple.julia) push!(cols, :julia => simple.julia) end if !all(ismissing, simple.nthreads) push!(cols, :nthreads => simple.nthreads) end envkeys = mapfoldl(union!, simple.env; init = Set{String}()) do env env === missing ? () : keys(env) end if !isempty(envkeys) for k in sort!(collect(envkeys)) vs = map(simple.env) do env env === missing && return missing get(env, k, missing) end push!(cols, Symbol(k) => vs) end end configrows = Tables.rows(Tables.CopiedColumns((; cols...))) # TODO: check duplicates rows = let parsekeys = parsekeys Iterators.map(zip(simple.result, configrows)) do (result, config) result === missing && return () Iterators.map(BenchmarkTools.leaves(result)) do (ks, trial) (; NamedTuple(config)..., parsekeys(ks)..., trial = trial) end end |> Iterators.flatten |> collect end return rows end function BenchmarkConfigSweeps.flattable(result::BenchmarkGroup; parsekeys = dwim_parsekeys) parsekeys = something(parsekeys, dont_parsekeys) rows = let parsekeys = parsekeys map(BenchmarkTools.leaves(result)) do (ks, trial) (; parsekeys(ks)..., trial = trial) end end return rows end BenchmarkConfigSweeps.simpletable(result::SweepResult) = Tables.CopiedColumns(_simpletable(result)) Tables.istable(::Type{SweepResult}) = true Tables.rowaccess(::Type{SweepResult}) = true Tables.rows(result::SweepResult) = BenchmarkConfigSweeps.flattable(result)
```julia using JuMP, Cbc, Plots # The usual packages using DelimitedFiles # IO reading/writing files using LinearAlgebra # For convenience (includes function norm(x)) using Combinatorics # To perform permutations ``` # MS-E2121 - Linear optimization ## Exercise session 8 ### Demo exercise: Travelling salesman problem (TSP) - MTZ formulation #### Examining the formulation Show that the following formulation $P_{MTZ}$ is valid for the TSP defined on a directed graph $G = (N,A)$ with $N = \{1,\dots,n\}$ cities and arcs $A = \{(i,j) : i,j\in N, i\neq j\}$ between cities. $$ P_{MTZ} = \left\{ \begin{array}{ll} \displaystyle \sum_{j \in N \setminus \{i\}} x_{ij} = 1, & \forall i \in N \\ \displaystyle \sum_{j \in N \setminus \{i\}} x_{ji} = 1, & \forall i \in N \\ \displaystyle u_{i} - u_{j} + (n-1) x_{ij} \leq n - 2, & \forall i,j \in N \setminus \{ 1 \} : i \neq j ~~(*)\\ x_{ij} \in \{0,1\}, & \forall i,j \in N : i\neq j\\ \end{array} \right. $$ where $x_{ij} = 1$ if city $j\in N$ is visited immediately after city $i \in N$, and $x_{ij} = 0$ otherwise. Constraints $(*)$ with the variables $u_i \in \mathbb{R}$ for all $i\in N$ are called *Miller-Tucker-Zemlin* (MTZ) subtour elimination constraints. We want to show that 1. Constraints $(*)$ prevent subtours in any solution $x \in P_{MTZ}$. 2. Every TSP solution $x$ satisfies the constraints $(*)$. To prove the first one, we first assume that a solution $x \in P_{MTZ}$ *has* a subtour with $k$ nodes and $k$ arcs between them, not going through node 1. For example, assume nodes 2, 3 and 5 form a subtour when $n=5$. Let's write the constraints $(*)$ corresponding to this subtour: \begin{align} u_2 - u_3 + 4 \le 3 \\ u_3 - u_5 + 4 \le 3 \\ u_5 - u_2 + 4 \le 3 \end{align} We observe that if $x_{ij} = 1$ such that $i,j \in N \setminus 1$, the constraint $(*)$ can be written as $u_i \le u_j - 1$, which for integer variables is the same as $u_i < u_j$. For a general result, we denote the nodes in the subtour by $\{i_1, ..., i_k\}$ and get $u_{i_1} < u_{i_k} < u_{i_1}$, which is a contradiction. This tells us that there can be no subtour ($k<n$) that doesn't contain node 1. A subtour containing node 1 would imply another subtour not containing node 1, so that is also forbidden by $(*)$. This proves the first part. For the second part, we notice that the $u$-variables seem to imply an ordering for the nodes. Assume that all tours start from node 1 and $u_i, \ i \in N \setminus 1$ is the position of the node on the tour (the first node visited after the starting node 1 has $u$-value 2, the second one 3 and so on). For each arc $i \rightarrow j$, we have either $x_{ij}=0$ or $x_{ij}=1$. If $x_{ij} = 0$: there is no arc from $i$ to $j$, and the constraint is $u_{i} - u_{j} \leq n - 2$, which holds, since we defined that $i$ and $j$ can't be 1, and also not greater than $n$. The upper bound of the difference between two $u$-values is thus $n-2$, and the constraint always holds if $x_{ij}=0$. If $x_{ij} = 1$: there is an arc from $i$ to $j$, and the constraint is $u_{i} - u_{j} + n-1 \leq n - 2$ or $u_{i} - u_{j} \leq -1$, which looks familiar from before and actually holds when we do not have subtours since by our definition, $u_i - u_j = -1$. The key is that this time, we have no subtours that do not contain node 1, which is treated as a special case. To conclude, we proved that this formulation does not allow subtours, and all valid solutions $x$ satisfy the constraints. Therefore, the formulation is valid. #### MTZ and naive TSP implementation We first write some helper functions, starting with one that computes the distances between coordinates: ```julia ## Function for getting the distances array function get_dist(xycoord::Matrix{},n::Int) # Compute distance matrix (d[i,j]) from city coordinates dist = zeros(n,n) for i = 1:n for j = i:n d = norm(xycoord[i,:] - xycoord[j,:]) dist[i,j] = d dist[j,i] = d end end return dist end ``` get_dist (generic function with 1 method) A function to convert the adjacency matrix $x$ describing a tour to a vector representing the tour, starting from city 1. ```julia # Get the optimal tour # Input # x: solution matrix # n: number of cities # Returns # tour: ordering of cities in the optimal tour function gettour(x::Matrix{Int}, n::Int) tour = zeros(Int,n+1) # Initialize tour vector (n+1 as city 1 appears twice) tour[1] = 1 # Set city 1 as first one in the tour k = 2 # Index of vector tour[k] i = 1 # Index of current city while k <= n + 1 # Find all n+1 tour nodes (city 1 is counted twice) for j = 1:n if x[i,j] == 1 # Find next city j visited immediately after i tour[k] = j # Set city j as the k:th city in the tour k = k + 1 # Update index k of tour[] vector i = j # Move to next city break end end end return tour # Return the optimal tour end ``` gettour (generic function with 1 method) ```julia ## Defining the colors to be used c_blue = palette(:auto)[1] # color :1 c_orange = palette(:auto)[2] # color :2 c_green = palette(:auto)[3]; # color :3 ``` The data is stored in csv-files, a common external data format. We use the DelimitedFiles package to read a file into a matrix ```data```. ```julia # "data16a.csv" has 3 columns which are stored in (Nullable) Arrays # data[1], data[2], data[3] after the function call # data = CSV.read(...) below. The columns contain: # # data[:,1]: all cities i in V # data[:,2]: x-coordinate of each city i in V # data[:,3]: y-coordinate of each city i in V # data = readdlm("data16a.csv", ',') # data = readdlm("data16b.csv", ',') n = 16 # number of cities # println(data) # Look at the data in compact form V = data[2:n+1,1] # All cities i in V x = data[2:n+1,2] # x-coordinates of cities i in V y = data[2:n+1,3] # y-coordinates of cities i in V xycoord = [x y]; # n x 2 coordinate matrix ``` ```julia function tsp_naive(xycoord::Matrix{}, n::Int) # Create a model m = Model(Cbc.Optimizer) # Here the costs c are the distances between cities c = get_dist(xycoord,n) ## Variables # x[i,j] = 1 if we travel from city i to city j, 0 otherwise. @variable(m, x[1:n,1:n], Bin) ## Objective # Minimize length of tour @objective(m, Min, dot(c,x)) ## Constraints # Ignore self arcs: set x[i,i] = 0 @constraint(m, sar[i = 1:n], x[i,i] == 0) # We must enter and leave every city exactly once @constraint(m, ji[i = 1:n], sum(x[j,i] for j = 1:n if j != i) == 1) @constraint(m, ij[i = 1:n], sum(x[i,j] for j = 1:n if j != i) == 1) optimize!(m) cost = objective_value(m) # Optimal cost (length) sol_x = round.(Int, value.(x)) # Optimal solution vector return m, sol_x, cost end; ``` ```julia ## Solve the problem and evaluate time and memory with @time macro (m_naive, x_naive, cost_naive) = @time tsp_naive(xycoord, n); # Get the optimal tour tour_naive = gettour(x_naive,n); ``` 25.801976 seconds (57.71 M allocations: 2.882 GiB, 6.41% gc time) Welcome to the CBC MILP Solver Version: 2.10.5 Build Date: Jan 1 1970 command line - Cbc_C_Interface -solve -quit (default strategy 1) Continuous objective value is 14779.5 - 0.00 seconds Cgl0002I 16 variables fixed Cgl0004I processed model has 32 rows, 240 columns (240 integer (240 of which binary)) and 480 elements Cbc0038I Initial state - 0 integers unsatisfied sum - 0 Cbc0038I Solution found of 14779.5 Cbc0038I Before mini branch and bound, 240 integers at bound fixed and 0 continuous Cbc0038I Mini branch and bound did not improve solution (0.02 seconds) Cbc0038I After 0.02 seconds - Feasibility pump exiting with objective of 14779.5 - took 0.01 seconds Cbc0012I Integer solution of 14779.476 found by feasibility pump after 0 iterations and 0 nodes (0.03 seconds) Cbc0001I Search completed - best objective 14779.47644152248, took 0 iterations and 0 nodes (0.03 seconds) Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost Cuts at root node changed objective from 14779.5 to 14779.5 Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Result - Optimal solution found Objective value: 14779.47644152 Enumerated nodes: 0 Total iterations: 0 Time (CPU seconds): 0.03 Time (Wallclock seconds): 0.03 Total time (CPU seconds): 0.03 (Wallclock seconds): 0.03 ```julia plt = scatter(xycoord[:,1],xycoord[:,2], markercolor = c_blue, markerstrokewidth = 0, legend = false ) for i in 1:length(tour_naive)-1 annotate!(xycoord[tour_naive[i],1]+50, xycoord[tour_naive[i],2]+50, ("$(tour_naive[i])", 7, :left)) plot!(([xycoord[tour_naive[i],1],xycoord[tour_naive[i+1],1]] , [xycoord[tour_naive[i],2],xycoord[tour_naive[i+1],2]]), c = c_blue, label = "") end plt ``` ```julia plt = scatter(xycoord[:,1],xycoord[:,2], markercolor = c_blue, markerstrokewidth = 0, legend = false ) for i in 1:n annotate!(xycoord[i,1]+50, xycoord[i,2]+50, ("$(i)", 7, :left)) for j in 1:n if x_naive[i,j] == 1 plot!(([xycoord[i,1],xycoord[j,1]] , [xycoord[i,2],xycoord[j,2]]), c = c_blue, label = "") break end end end plt ``` ```julia # Solve a directed, TSP instance (MTZ formulation) # Input # xycoord: coordinates of city locations # n: number of cities # Returns # tour: ordering of cities in the optimal tour # cost: cost (length) of the optimal tour function tsp_mtz(xycoord::Matrix{}, n::Int) # Create a model m = Model(Cbc.Optimizer) # Here the costs c are the distances between cities c = get_dist(xycoord,n) ## Variables # x[i,j] = 1 if we travel from city i to city j, 0 otherwise. @variable(m, x[1:n,1:n], Bin) # Variables u for subtour elimination constraints @variable(m, u[2:n]) ## Objective # Minimize length of tour @objective(m, Min, dot(c,x)) ## Constraints # Ignore self arcs: set x[i,i] = 0 @constraint(m, sar[i = 1:n], x[i,i] == 0) # We must enter and leave every city exactly once @constraint(m, ji[i = 1:n], sum(x[j,i] for j = 1:n if j != i) == 1) @constraint(m, ij[i = 1:n], sum(x[i,j] for j = 1:n if j != i) == 1) # MTZ subtour elimination constraints @constraint(m, sub[i = 2:n, j = 2:n, i != j], u[i] - u[j] + (n-1)*x[i,j] <= (n-2)) optimize!(m) cost = objective_value(m) # Optimal cost (length) sol_x = round.(Int, value.(x)) # Optimal solution vector return m, sol_x, cost end; ``` ```julia ## Solve the problem and evaluate time and memory with @time macro (m_mtz, x_mtz, cost_mtz) = @time tsp_mtz(xycoord, n); # Get the optimal tour tour_mtz = gettour(x_mtz,n); ``` Welcome to the CBC MILP Solver Version: 2.10.5 Build Date: Jan 1 1970 command line - Cbc_C_Interface -solve -quit (default strategy 1) Continuous objective value is 15273.6 - 0.00 seconds Cgl0002I 16 variables fixed Cgl0004I processed model has 242 rows, 255 columns (240 integer (240 of which binary)) and 1110 elements Cbc0038I Initial state - 29 integers unsatisfied sum - 2.4 Cbc0038I Pass 1: suminf. 1.73333 (19) obj. 16862 iterations 48 Cbc0038I Pass 2: suminf. 1.73333 (7) obj. 38620.3 iterations 54 Cbc0038I Pass 3: suminf. 1.73333 (10) obj. 37603.8 iterations 20 Cbc0038I Pass 4: suminf. 1.73333 (11) obj. 37200.1 iterations 18 Cbc0038I Pass 5: suminf. 1.73333 (9) obj. 43903.4 iterations 38 Cbc0038I Pass 6: suminf. 1.73333 (14) obj. 43717.4 iterations 15 Cbc0038I Pass 7: suminf. 1.73333 (11) obj. 37517.3 iterations 36 Cbc0038I Pass 8: suminf. 2.80000 (6) obj. 39892.6 iterations 34 Cbc0038I Pass 9: suminf. 1.73333 (10) obj. 36107 iterations 25 Cbc0038I Pass 10: suminf. 1.73333 (10) obj. 37514.5 iterations 27 Cbc0038I Pass 11: suminf. 1.33333 (17) obj. 42954.2 iterations 86 Cbc0038I Pass 12: suminf. 0.53333 (4) obj. 43714.8 iterations 51 Cbc0038I Pass 13: suminf. 0.53333 (4) obj. 43402.5 iterations 28 Cbc0038I Pass 14: suminf. 1.33333 (4) obj. 45766.7 iterations 70 Cbc0038I Pass 15: suminf. 1.06667 (11) obj. 45589.8 iterations 56 Cbc0038I Pass 16: suminf. 1.06667 (4) obj. 47925.3 iterations 39 Cbc0038I Pass 17: suminf. 1.06667 (4) obj. 46778 iterations 23 Cbc0038I Pass 18: suminf. 1.06667 (9) obj. 46040.1 iterations 26 Cbc0038I Pass 19: suminf. 1.06667 (4) obj. 48761.5 iterations 51 Cbc0038I Pass 20: suminf. 1.06667 (4) obj. 48761.5 iterations 2 Cbc0038I Pass 21: suminf. 1.06667 (9) obj. 46515.9 iterations 16 Cbc0038I Pass 22: suminf. 1.06667 (4) obj. 46778 iterations 19 Cbc0038I Pass 23: suminf. 1.06667 (4) obj. 46778 iterations 0 Cbc0038I Pass 24: suminf. 1.06667 (9) obj. 46040.1 iterations 16 Cbc0038I Pass 25: suminf. 1.06667 (4) obj. 48761.5 iterations 51 Cbc0038I Pass 26: suminf. 1.06667 (4) obj. 48761.5 iterations 4 Cbc0038I Pass 27: suminf. 1.06667 (9) obj. 46515.9 iterations 29 Cbc0038I Pass 28: suminf. 1.06667 (4) obj. 46778 iterations 21 Cbc0038I Pass 29: suminf. 1.06667 (4) obj. 46778 iterations 0 Cbc0038I Pass 30: suminf. 1.06667 (9) obj. 46040.1 iterations 17 Cbc0038I No solution found this major pass Cbc0038I Before mini branch and bound, 160 integers at bound fixed and 0 continuous Cbc0038I Full problem 242 rows 255 columns, reduced to 242 rows 95 columns - too large Cbc0038I Mini branch and bound did not improve solution (0.03 seconds) Cbc0038I Full problem 243 rows 255 columns, reduced to 243 rows 255 columns - too large Cbc0038I After 0.04 seconds - Feasibility pump exiting - took 0.03 seconds Cbc0031I 11 added rows had average density of 143.81818 Cbc0013I At root node, 11 cuts changed objective from 15273.642 to 20217.641 in 100 passes Cbc0014I Cut generator 0 (Probing) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.094 seconds - new frequency is -100 Cbc0014I Cut generator 1 (Gomory) - 958 row cuts average 191.2 elements, 0 column cuts (0 active) in 0.053 seconds - new frequency is 1 Cbc0014I Cut generator 2 (Knapsack) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.018 seconds - new frequency is -100 Cbc0014I Cut generator 3 (Clique) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.004 seconds - new frequency is -100 Cbc0014I Cut generator 4 (MixedIntegerRounding2) - 2 row cuts average 129.0 elements, 0 column cuts (0 active) in 0.027 seconds - new frequency is -100 Cbc0014I Cut generator 5 (FlowCover) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.014 seconds - new frequency is -100 Cbc0010I After 0 nodes, 1 on tree, 1e+50 best solution, best possible 20217.641 (0.49 seconds) Cbc0004I Integer solution of 21446.314 found after 3463 iterations and 5 nodes (0.54 seconds) Cbc0012I Integer solution 2.693751 seconds (4.25 M allocations: 221.267 MiB, 3.84% gc time) of 21098.73 found by DiveCoefficient after 3540 iterations and 8 nodes (0.55 seconds) Cbc0038I Full problem 242 rows 255 columns, reduced to 228 rows 46 columns - 12 fixed gives 211, 18 - still too large Cbc0038I Full problem 242 rows 255 columns, reduced to 211 rows 18 columns - too large Cbc0001I Search completed - best objective 21098.72984805134, took 4363 iterations and 18 nodes (0.62 seconds) Cbc0032I Strong branching done 394 times (9752 iterations), fathomed 2 nodes and fixed 2 variables Cbc0035I Maximum depth 4, 467 variables fixed on reduced cost Cuts at root node changed objective from 15273.6 to 20217.6 Probing was tried 100 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.094 seconds) Gomory was tried 125 times and created 979 cuts of which 0 were active after adding rounds of cuts (0.056 seconds) Knapsack was tried 100 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.018 seconds) Clique was tried 100 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.004 seconds) MixedIntegerRounding2 was tried 100 times and created 2 cuts of which 0 were active after adding rounds of cuts (0.027 seconds) FlowCover was tried 100 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.014 seconds) TwoMirCuts was tried 1 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) ZeroHalf was tried 1 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.001 seconds) ImplicationCuts was tried 25 times and created 6 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Result - Optimal solution found Objective value: 21098.72984805 Enumerated nodes: 18 Total iterations: 4363 Time (CPU seconds): 0.63 Time (Wallclock seconds): 0.63 Total time (CPU seconds): 0.63 (Wallclock seconds): 0.63 ```julia ## Print the optimal tour and its cost println("\nOptimal tour: $(tour_mtz)\n") println("Optimal length: ", cost_mtz) ``` Optimal tour: [1, 8, 9, 7, 6, 15, 12, 11, 13, 14, 5, 10, 4, 2, 3, 16, 1] Optimal length: 21098.729848051342 ```julia plt = scatter(xycoord[:,1],xycoord[:,2], markercolor = c_blue, markerstrokewidth = 0, legend = false ) for i in 1:length(tour_mtz)-1 annotate!(xycoord[tour_mtz[i],1]+50, xycoord[tour_mtz[i],2]+50, ("$(tour_mtz[i])", 7, :left)) plot!(([xycoord[tour_mtz[i],1],xycoord[tour_mtz[i+1],1]] , [xycoord[tour_mtz[i],2],xycoord[tour_mtz[i+1],2]]), c = c_blue, label = "") end plt ``` Now that we have solved the problem using the MTZ formulation, let's try solving the same problem starting with the naive implementation and using successive cutset or subtour elimination constraints: ```julia ## Initialisation (m_naive, x_naive, cost_naive) = tsp_naive(xycoord, n); subnodes = [] count = 0 stop = 0 lim = 100 methods = [:elimination,:cutset] method = methods[2]; ## Perform cuts to break subtours until we got an optimal @time while stop == 0 && count < lim S = collect(permutations(subnodes,2)) # Possible connections present in the naive implementation NS = setdiff(V,subnodes) # Nodes that are still not included in the tour if method == :cutset ## Cutset constraints if length(S) > 0 @constraint(m_naive,sum(m_naive[:x][subnodes[i],NS[j]] for i in 1:length(subnodes), j in 1:length(NS)) >= 1) end else ## Subtour elimination constraints if length(S) > 0 @constraint(m_naive,sum(m_naive[:x][S[i][1],S[i][2]] for i in 1:length(S)) <= length(subnodes)-1) end end set_silent(m_naive) optimize!(m_naive) cost2 = objective_value(m_naive) # Optimal cost (length) sol_x = round.(Int, value.(m_naive[:x])) # Optimal solution vector tour2 = gettour(sol_x,n) # Get the optimal tour if length(unique(tour2)) < n count = count + 1 println("Method used: ",method) println("Subtours present in node 1, update subnodes vector to break the subtour: ", tour2') println("\nIteration $(count); not optimal.\n") subnodes = unique(tour2); else println("Method used: ",method) println("Optimal tour: ", tour2') println("\n Took $(count) iterations to find the optimal solution.") S = [] stop = 1 end; end; ``` Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 9 8 1 9 8 1 9 8 1 9 8 1 9 8 1 9] Iteration 1; not optimal. Welcome to the CBC MILP Solver Version: 2.10.5 Build Date: Jan 1 1970 command line - Cbc_C_Interface -solve -quit (default strategy 1) Continuous objective value is 14779.5 - 0.00 seconds Cgl0002I 16 variables fixed Cgl0004I processed model has 32 rows, 240 columns (240 integer (240 of which binary)) and 480 elements Cbc0038I Initial state - 0 integers unsatisfied sum - 0 Cbc0038I Solution found of 14779.5 Cbc0038I Before mini branch and bound, 240 integers at bound fixed and 0 continuous Cbc0038I Mini branch and bound did not improve solution (0.01 seconds) Cbc0038I After 0.01 seconds - Feasibility pump exiting with objective of 14779.5 - took 0.01 seconds Cbc0012I Integer solution of 14779.476 found by feasibility pump after 0 iterations and 0 nodes (0.01 seconds) Cbc0001I Search completed - best objective 14779.47644152248, took 0 iterations and 0 nodes (0.01 seconds) Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost Cuts at root node changed objective from 14779.5 to 14779.5 Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Result - Optimal solution found Objective value: 14779.47644152 Enumerated nodes: 0 Total iterations: 0 Time (CPU seconds): 0.02 Time (Wallclock seconds): 0.02 Total time (CPU seconds): 0.02 (Wallclock seconds): 0.02 Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1] Iteration 2; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 16 3 11 12 15 9 8 1 16 3 11 12 15 9 8 1] Iteration 3; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 16 3 14 13 11 12 15 9 8 1 16 3 14 13 11 12] Iteration 4; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 16 3 1 16 3 1 16 3 1 16 3 1 16 3 1 16] Iteration 5; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 3 16 8 9 1 3 16 8 9 1 3 16 8 9 1 3] Iteration 6; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 8 9 15 12 11 13 5 14 3 16 1 8 9 15 12 11] Iteration 7; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 16 3 2 5 14 13 11 12 15 9 8 1 16 3 2 5] Iteration 8; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 16 3 11 12 15 6 7 9 8 1 16 3 11 12 15 6] Iteration 9; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 8 9 7 6 15 12 11 13 14 3 16 1 8 9 7 6] Iteration 10; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 8 9 15 12 11 13 14 5 10 4 2 3 16 1 8 9] Iteration 11; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 8 7 6 9 1 8 7 6 9 1 8 7 6 9 1 8] Iteration 12; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 8 7 6 12 15 9 1 8 7 6 12 15 9 1 8 7] Iteration 13; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 8 9 7 6 15 12 11 13 5 14 3 16 1 8 9 7] Iteration 14; not optimal. Method used: cutset Subtours present in node 1, update subnodes vector to break the subtour: [1 8 9 7 6 15 12 11 13 14 5 2 3 16 1 8 9] Iteration 15; not optimal. Method used: cutset Optimal tour: [1 8 9 7 6 15 12 11 13 14 5 10 4 2 3 16 1] Took 15 iterations to find the optimal solution. 2.362742 seconds (1.97 M allocations: 99.730 MiB) ### Scheduling problem <!---%---> One way to formulate the scheduling problem is to use the job start times $t_j \ge 0$ as the decision variables and then define constraints for making sure two jobs are not done simultaneously. From the problem description, it is clear that the objective is to minimize $\sum_{j=1}^{n}w_jt_j$. For the constraints, we add binary variables $x_{ij}$ such that $x_{ij}=1$ if and only if job $i$ is done at some point before job $j$. We want the following two implications to hold: \begin{align} x_{ij} = 1 \Rightarrow t_j \ge t_i + p_i \\ x_{ij} = 0 \Rightarrow t_i \ge t_j + p_j \end{align} We will then model these implications using a disjunctive big-M formulation (see the ULS problem in Lecture 8). \begin{align} t_i - t_j + p_i &\le M(1-x_{ij}), \ &\forall i,j \in \{1,...,n\}: i \neq j \\ t_j - t_i + p_j &\le Mx_{ij}, \ &\forall i,j \in \{1,...,n\}: i \neq j \end{align} If we then define a large enough big-M ($M \ge t_i - t_j + p_j, \ \forall i,j \in \{1,...,n\}: i \neq j$), these constraints correspond to what we wanted and we have our formulation. \begin{align} \text{min. } &\sum_{j=1}^{n}w_jt_j \\ \text{s.t. }&t_i - t_j + p_i \le M(1-x_{ij}), \ \forall i,j \in \{1,...,n\}: i \neq j \\ &t_j - t_i + p_j \le Mx_{ij}, \ \forall i,j \in \{1,...,n\}: i \neq j \\ &t_j \ge 0, \ \forall j \in \{1,...,n\} \\ &x_{ij} \in \{0,1\}, \ \forall i,j \in \{1,...,n\}: i \neq j \end{align} <!---%--->
/- Copyright (c) 2020 Bhavik Mehta. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Bhavik Mehta -/ import Mathlib.PrePort import Mathlib.Lean3Lib.init.default import Mathlib.category_theory.limits.limits import Mathlib.category_theory.thin import Mathlib.PostPort universes v l u namespace Mathlib /-! # Wide pullbacks We define the category `wide_pullback_shape`, (resp. `wide_pushout_shape`) which is the category obtained from a discrete category of type `J` by adjoining a terminal (resp. initial) element. Limits of this shape are wide pullbacks (pushouts). The convenience method `wide_cospan` (`wide_span`) constructs a functor from this category, hitting the given morphisms. We use `wide_pullback_shape` to define ordinary pullbacks (pushouts) by using `J := walking_pair`, which allows easy proofs of some related lemmas. Furthermore, wide pullbacks are used to show the existence of limits in the slice category. Namely, if `C` has wide pullbacks then `C/B` has limits for any object `B` in `C`. Typeclasses `has_wide_pullbacks` and `has_finite_wide_pullbacks` assert the existence of wide pullbacks and finite wide pullbacks. -/ namespace category_theory.limits /-- A wide pullback shape for any type `J` can be written simply as `option J`. -/ def wide_pullback_shape (J : Type v) := Option J /-- A wide pushout shape for any type `J` can be written simply as `option J`. -/ def wide_pushout_shape (J : Type v) := Option J namespace wide_pullback_shape /-- The type of arrows for the shape indexing a wide pullback. -/ inductive hom {J : Type v} : wide_pullback_shape J → wide_pullback_shape J → Type v where | id : (X : wide_pullback_shape J) → hom X X | term : (j : J) → hom (some j) none protected instance struct {J : Type v} : category_struct (wide_pullback_shape J) := sorry protected instance hom.inhabited {J : Type v} : Inhabited (hom none none) := { default := hom.id none } protected instance subsingleton_hom {J : Type v} (j : wide_pullback_shape J) (j' : wide_pullback_shape J) : subsingleton (j ⟶ j') := sorry protected instance category {J : Type v} : small_category (wide_pullback_shape J) := thin_category @[simp] theorem hom_id {J : Type v} (X : wide_pullback_shape J) : hom.id X = 𝟙 := rfl /-- Construct a functor out of the wide pullback shape given a J-indexed collection of arrows to a fixed object. -/ @[simp] theorem wide_cospan_map {J : Type v} {C : Type u} [category C] (B : C) (objs : J → C) (arrows : (j : J) → objs j ⟶ B) (X : wide_pullback_shape J) (Y : wide_pullback_shape J) (f : X ⟶ Y) : functor.map (wide_cospan B objs arrows) f = hom.cases_on f (fun (f_1 : wide_pullback_shape J) (H_1 : X = f_1) => Eq._oldrec (fun (H_2 : Y = X) => Eq._oldrec (fun (f : X ⟶ X) (H_3 : f == hom.id X) => Eq._oldrec 𝟙 (wide_cospan._proof_1 X f H_3)) (wide_cospan._proof_2 X Y H_2) f) H_1) (fun (j : J) (H_1 : X = some j) => Eq._oldrec (fun (f : some j ⟶ Y) (H_2 : Y = none) => Eq._oldrec (fun (f : some j ⟶ none) (H_3 : f == hom.term j) => Eq._oldrec (arrows j) (wide_cospan._proof_3 j f H_3)) (wide_cospan._proof_4 Y H_2) f) (wide_cospan._proof_5 X j H_1) f) (wide_cospan._proof_6 X) (wide_cospan._proof_7 Y) (wide_cospan._proof_8 X Y f) := Eq.refl (functor.map (wide_cospan B objs arrows) f) /-- Every diagram is naturally isomorphic (actually, equal) to a `wide_cospan` -/ def diagram_iso_wide_cospan {J : Type v} {C : Type u} [category C] (F : wide_pullback_shape J ⥤ C) : F ≅ wide_cospan (functor.obj F none) (fun (j : J) => functor.obj F (some j)) fun (j : J) => functor.map F (hom.term j) := nat_iso.of_components (fun (j : wide_pullback_shape J) => eq_to_iso sorry) sorry end wide_pullback_shape namespace wide_pushout_shape /-- The type of arrows for the shape indexing a wide psuhout. -/ inductive hom {J : Type v} : wide_pushout_shape J → wide_pushout_shape J → Type v where | id : (X : wide_pushout_shape J) → hom X X | init : (j : J) → hom none (some j) protected instance struct {J : Type v} : category_struct (wide_pushout_shape J) := sorry protected instance hom.inhabited {J : Type v} : Inhabited (hom none none) := { default := hom.id none } protected instance subsingleton_hom {J : Type v} (j : wide_pushout_shape J) (j' : wide_pushout_shape J) : subsingleton (j ⟶ j') := sorry protected instance category {J : Type v} : small_category (wide_pushout_shape J) := thin_category @[simp] theorem hom_id {J : Type v} (X : wide_pushout_shape J) : hom.id X = 𝟙 := rfl /-- Construct a functor out of the wide pushout shape given a J-indexed collection of arrows from a fixed object. -/ @[simp] theorem wide_span_map {J : Type v} {C : Type u} [category C] (B : C) (objs : J → C) (arrows : (j : J) → B ⟶ objs j) (X : wide_pushout_shape J) (Y : wide_pushout_shape J) (f : X ⟶ Y) : functor.map (wide_span B objs arrows) f = hom.cases_on f (fun (f_1 : wide_pushout_shape J) (H_1 : X = f_1) => Eq._oldrec (fun (H_2 : Y = X) => Eq._oldrec (fun (f : X ⟶ X) (H_3 : f == hom.id X) => Eq._oldrec 𝟙 (wide_span._proof_1 X f H_3)) (wide_span._proof_2 X Y H_2) f) H_1) (fun (j : J) (H_1 : X = none) => Eq._oldrec (fun (f : none ⟶ Y) (H_2 : Y = some j) => Eq._oldrec (fun (f : none ⟶ some j) (H_3 : f == hom.init j) => Eq._oldrec (arrows j) (wide_span._proof_3 j f H_3)) (wide_span._proof_4 Y j H_2) f) (wide_span._proof_5 X H_1) f) (wide_span._proof_6 X) (wide_span._proof_7 Y) (wide_span._proof_8 X Y f) := Eq.refl (functor.map (wide_span B objs arrows) f) /-- Every diagram is naturally isomorphic (actually, equal) to a `wide_span` -/ def diagram_iso_wide_span {J : Type v} {C : Type u} [category C] (F : wide_pushout_shape J ⥤ C) : F ≅ wide_span (functor.obj F none) (fun (j : J) => functor.obj F (some j)) fun (j : J) => functor.map F (hom.init j) := nat_iso.of_components (fun (j : wide_pushout_shape J) => eq_to_iso sorry) sorry end wide_pushout_shape /-- `has_wide_pullbacks` represents a choice of wide pullback for every collection of morphisms -/ def has_wide_pullbacks (C : Type u) [category C] := ∀ (J : Type v), has_limits_of_shape (wide_pullback_shape J) C /-- `has_wide_pushouts` represents a choice of wide pushout for every collection of morphisms -/ def has_wide_pushouts (C : Type u) [category C] := ∀ (J : Type v), has_colimits_of_shape (wide_pushout_shape J) C
module Contact public export record Contact where constructor CreateContact mobilePhone : Maybe String homePhone : Maybe String
State Before: F : Type ?u.29827 α : Type u_1 β : Type ?u.29833 inst✝¹ : LinearOrderedSemiring α inst✝ : FloorSemiring α a : α n : ℕ x : α ⊢ 1 ≤ ⌊x⌋₊ ↔ 1 ≤ x State After: no goals Tactic: exact_mod_cast @le_floor_iff' α _ _ x 1 one_ne_zero
dir <- "~/workspace/dyn-urg/files/results/time-series-dynamism-experiment/" nonhomogTS <- read.table(paste(dir,"non-homog-poisson-dynamism.csv",sep=""), quote="\"",as.is=T,colClasses=list("numeric")) homogTS <- read.table(paste(dir,"homog-poisson-dynamism.csv",sep=""), quote="\"",as.is=T,colClasses=list("numeric")) normalTS <- read.table(paste(dir,"normal-dynamism.csv",sep=""), quote="\"",as.is=T,colClasses=list("numeric")) uniformTS <- read.table(paste(dir,"uniform-dynamism.csv",sep=""), quote="\"",as.is=T,colClasses=list("numeric")) nonhomogTS["type"] <- "non-homogeneous-Poisson" homogTS["type"] <- "homogeneous-Poisson" normalTS["type"] <- "normal" uniformTS["type"] <- "uniform" res <- merge(nonhomogTS,homogTS, all=T) res <- merge(res,normalTS,all=T) res <- merge(res,uniformTS,all=T) df <- data.frame(res) library(ggplot2) p <- ggplot(df, aes(x=V1,fill=type)) + geom_histogram(binwidth=.01, alpha=.5, position="identity") + xlab("dynamism") + scale_x_continuous(breaks=seq(0, 1, 0.05)) + scale_fill_brewer(palette="Set1") show(p)
module BlockFactorizations using LinearAlgebra using Base.Threads using Base.Threads: @spawn, @sync const AbstractMatOrFac{T} = Union{AbstractMatrix{T}, Factorization{T}} const AbstractMatOrFacOrUni{T} = Union{AbstractMatrix{T}, Factorization{T}, UniformScaling{T}} const AbstractVecOfVec{T} = AbstractVector{<:AbstractVector{T}} const AbstractVecOfVecOrMat{T} = AbstractVector{<:AbstractVecOrMat{T}} export BlockFactorization, BlockDiagonalFactorization include("block.jl") end # module
struct VanillaOption isCall::Bool strike::Float64 maturity::Float64 end #advancePath(gen, pathValues, t0, t1) #advancePayoff(time, pathValues) function evaluatePayoff(payoff::VanillaOption, x, df) if payoff.isCall return df * max(x - payoff.strike, 0) else return df * max(payoff.strike - x, 0) end end function specificTimes(payoff::VanillaOption) return [payoff.maturity] end
1 -- @@stderr -- dtrace: invalid probe specifier genunix:read: probe description ::genunix:read does not match any probes
module Prelude.Types import Builtin import PrimIO import Prelude.Basics import Prelude.EqOrd import Prelude.Interfaces import Prelude.Num import Prelude.Uninhabited %default total ----------- -- NATS --- ----------- ||| Natural numbers: unbounded, unsigned integers which can be pattern matched. public export data Nat = ||| Zero. Z | ||| Successor. S Nat %name Nat k, j, i public export integerToNat : Integer -> Nat integerToNat x = if intToBool (prim__lte_Integer x 0) then Z else S (assert_total (integerToNat (prim__sub_Integer x 1))) -- Define separately so we can spot the name when optimising Nats ||| Add two natural numbers. ||| @ x the number to case-split on ||| @ y the other numberpublic export public export plus : (1 x : Nat) -> (1 y : Nat) -> Nat plus Z y = y plus (S k) y = S (plus k y) ||| Subtract natural numbers. If the second number is larger than the first, ||| return 0. public export minus : (1 left : Nat) -> Nat -> Nat minus Z right = Z minus left Z = left minus (S left) (S right) = minus left right ||| Multiply natural numbers. public export mult : (1 x : Nat) -> Nat -> Nat mult Z y = Z mult (S k) y = plus y (mult k y) public export Num Nat where (+) = plus (*) = mult fromInteger x = integerToNat x public export Eq Nat where Z == Z = True S j == S k = j == k _ == _ = False public export Ord Nat where compare Z Z = EQ compare Z (S k) = LT compare (S k) Z = GT compare (S j) (S k) = compare j k public export natToInteger : Nat -> Integer natToInteger Z = 0 natToInteger (S k) = 1 + natToInteger k -- integer (+) may be non-linear in second -- argument ----------- -- PAIRS -- ----------- public export Functor (Pair a) where map f (x, y) = (x, f y) public export mapFst : (a -> c) -> (a, b) -> (c, b) mapFst f (x, y) = (f x, y) ----------- -- MAYBE -- ----------- ||| An optional value. This can be used to represent the possibility of ||| failure, where a function may return a value, or not. public export data Maybe : (ty : Type) -> Type where ||| No value stored Nothing : Maybe ty ||| A value of type `ty` is stored Just : (1 x : ty) -> Maybe ty public export Uninhabited (Nothing = Just x) where uninhabited Refl impossible public export Uninhabited (Just x = Nothing) where uninhabited Refl impossible public export maybe : Lazy b -> Lazy (a -> b) -> Maybe a -> b maybe n j Nothing = n maybe n j (Just x) = j x public export Eq a => Eq (Maybe a) where Nothing == Nothing = True Nothing == (Just _) = False (Just _) == Nothing = False (Just a) == (Just b) = a == b public export Ord a => Ord (Maybe a) where compare Nothing Nothing = EQ compare Nothing (Just _) = LT compare (Just _) Nothing = GT compare (Just a) (Just b) = compare a b public export Semigroup (Maybe a) where Nothing <+> m = m (Just x) <+> _ = Just x public export Monoid (Maybe a) where neutral = Nothing public export Functor Maybe where map f (Just x) = Just (f x) map f Nothing = Nothing public export Applicative Maybe where pure = Just Just f <*> Just a = Just (f a) _ <*> _ = Nothing public export Alternative Maybe where empty = Nothing (Just x) <|> _ = Just x Nothing <|> v = v public export Monad Maybe where Nothing >>= k = Nothing (Just x) >>= k = k x public export Foldable Maybe where foldr _ z Nothing = z foldr f z (Just x) = f x z public export Traversable Maybe where traverse f Nothing = pure Nothing traverse f (Just x) = (pure Just) <*> (f x) --------- -- DEC -- --------- ||| Decidability. A decidable property either holds or is a contradiction. public export data Dec : Type -> Type where ||| The case where the property holds. ||| @ prf the proof Yes : (prf : prop) -> Dec prop ||| The case where the property holding would be a contradiction. ||| @ contra a demonstration that prop would be a contradiction No : (contra : prop -> Void) -> Dec prop ------------ -- EITHER -- ------------ ||| A sum type. public export data Either : (a : Type) -> (b : Type) -> Type where ||| One possibility of the sum, conventionally used to represent errors. Left : forall a, b. (1 x : a) -> Either a b ||| The other possibility, conventionally used to represent success. Right : forall a, b. (1 x : b) -> Either a b ||| Simply-typed eliminator for Either. ||| @ f the action to take on Left ||| @ g the action to take on Right ||| @ e the sum to analyze public export either : (f : Lazy (a -> c)) -> (g : Lazy (b -> c)) -> (e : Either a b) -> c either l r (Left x) = l x either l r (Right x) = r x public export (Eq a, Eq b) => Eq (Either a b) where Left x == Left x' = x == x' Right x == Right x' = x == x' _ == _ = False public export (Ord a, Ord b) => Ord (Either a b) where compare (Left x) (Left x') = compare x x' compare (Left _) (Right _) = LT compare (Right _) (Left _) = GT compare (Right x) (Right x') = compare x x' %inline public export Functor (Either e) where map f (Left x) = Left x map f (Right x) = Right (f x) %inline public export Applicative (Either e) where pure = Right (Left a) <*> _ = Left a (Right f) <*> (Right r) = Right (f r) (Right _) <*> (Left l) = Left l public export Monad (Either e) where (Left n) >>= _ = Left n (Right r) >>= f = f r public export Foldable (Either e) where foldr f acc (Left _) = acc foldr f acc (Right x) = f x acc public export Traversable (Either e) where traverse f (Left x) = pure (Left x) traverse f (Right x) = Right <$> f x ----------- -- LISTS -- ----------- ||| Generic lists. public export data List a = ||| Empty list Nil | ||| A non-empty list, consisting of a head element and the rest of the list. (::) a (List a) %name List xs, ys, zs public export Eq a => Eq (List a) where [] == [] = True x :: xs == y :: ys = x == y && xs == ys _ == _ = False public export Ord a => Ord (List a) where compare [] [] = EQ compare [] (x :: xs) = LT compare (x :: xs) [] = GT compare (x :: xs) (y ::ys) = case compare x y of EQ => compare xs ys c => c namespace List public export (++) : (1 xs, ys : List a) -> List a [] ++ ys = ys (x :: xs) ++ ys = x :: xs ++ ys public export length : List a -> Nat length [] = Z length (x :: xs) = S (length xs) public export Functor List where map f [] = [] map f (x :: xs) = f x :: map f xs public export Semigroup (List a) where (<+>) = (++) public export Monoid (List a) where neutral = [] public export Foldable List where foldr c n [] = n foldr c n (x::xs) = c x (foldr c n xs) foldl f q [] = q foldl f q (x::xs) = foldl f (f q x) xs public export Applicative List where pure x = [x] fs <*> vs = concatMap (\f => map f vs) fs public export Alternative List where empty = [] (<|>) = (++) public export Monad List where m >>= f = concatMap f m public export Traversable List where traverse f [] = pure [] traverse f (x::xs) = pure (::) <*> (f x) <*> (traverse f xs) ||| Check if something is a member of a list using the default Boolean equality. public export elem : Eq a => a -> List a -> Bool x `elem` [] = False x `elem` (y :: ys) = x == y || elem x ys ------------- -- STREAMS -- ------------- namespace Stream ||| An infinite stream. public export data Stream : Type -> Type where (::) : a -> Inf (Stream a) -> Stream a public export Functor Stream where map f (x :: xs) = f x :: map f xs ||| The first element of an infinite stream. public export head : Stream a -> a head (x :: xs) = x ||| All but the first element. public export tail : Stream a -> Stream a tail (x :: xs) = xs ||| Take precisely n elements from the stream. ||| @ n how many elements to take ||| @ xs the stream public export take : (1 n : Nat) -> (xs : Stream a) -> List a take Z xs = [] take (S k) (x :: xs) = x :: take k xs ------------- -- STRINGS -- ------------- namespace Strings public export (++) : (1 x : String) -> (1 y : String) -> String x ++ y = prim__strAppend x y ||| Returns the length of the string. ||| ||| ```idris example ||| length "" ||| ``` ||| ```idris example ||| length "ABC" ||| ``` public export length : String -> Nat length str = fromInteger (prim__cast_IntInteger (prim__strLength str)) ||| Reverses the elements within a string. ||| ||| ```idris example ||| reverse "ABC" ||| ``` ||| ```idris example ||| reverse "" ||| ``` public export reverse : String -> String reverse = prim__strReverse ||| Returns a substring of a given string ||| ||| @ index The (zero based) index of the string to extract. If this is beyond ||| the end of the string, the function returns the empty string. ||| @ len The desired length of the substring. Truncated if this exceeds the ||| length of the input ||| @ subject The string to return a portion of public export substr : (index : Nat) -> (len : Nat) -> (subject : String) -> String substr s e subj = if natToInteger s < natToInteger (length subj) then prim__strSubstr (prim__cast_IntegerInt (natToInteger s)) (prim__cast_IntegerInt (natToInteger e)) subj else "" ||| Adds a character to the front of the specified string. ||| ||| ```idris example ||| strCons 'A' "B" ||| ``` ||| ```idris example ||| strCons 'A' "" ||| ``` public export strCons : Char -> String -> String strCons = prim__strCons public export strUncons : String -> Maybe (Char, String) strUncons "" = Nothing strUncons str = assert_total $ Just (prim__strHead str, prim__strTail str) ||| Turns a list of characters into a string. public export pack : List Char -> String pack [] = "" pack (x :: xs) = strCons x (pack xs) %foreign "scheme:string-pack" "javascript:lambda:(xs)=>''.concat(...__prim_idris2js_array(xs))" export fastPack : List Char -> String ||| Turns a string into a list of characters. ||| ||| ```idris example ||| unpack "ABC" ||| ``` public export unpack : String -> List Char unpack str = case strUncons str of Nothing => [] Just (x, xs) => x :: unpack (assert_smaller str xs) public export Semigroup String where (<+>) = (++) public export Monoid String where neutral = "" ---------------- -- CHARACTERS -- ---------------- ||| Returns true if the character is in the range [A-Z]. public export isUpper : Char -> Bool isUpper x = x >= 'A' && x <= 'Z' ||| Returns true if the character is in the range [a-z]. public export isLower : Char -> Bool isLower x = x >= 'a' && x <= 'z' ||| Returns true if the character is in the ranges [A-Z][a-z]. public export isAlpha : Char -> Bool isAlpha x = isUpper x || isLower x ||| Returns true if the character is in the range [0-9]. public export isDigit : Char -> Bool isDigit x = (x >= '0' && x <= '9') ||| Returns true if the character is in the ranges [A-Z][a-z][0-9]. public export isAlphaNum : Char -> Bool isAlphaNum x = isDigit x || isAlpha x ||| Returns true if the character is a whitespace character. public export isSpace : Char -> Bool isSpace x = x == ' ' || x == '\t' || x == '\r' || x == '\n' || x == '\f' || x == '\v' || x == '\xa0' ||| Returns true if the character represents a new line. public export isNL : Char -> Bool isNL x = x == '\r' || x == '\n' ||| Convert a letter to the corresponding upper-case letter, if any. ||| Non-letters are ignored. public export toUpper : Char -> Char toUpper x = if (isLower x) then prim__cast_IntChar (prim__cast_CharInt x - 32) else x ||| Convert a letter to the corresponding lower-case letter, if any. ||| Non-letters are ignored. public export toLower : Char -> Char toLower x = if (isUpper x) then prim__cast_IntChar (prim__cast_CharInt x + 32) else x ||| Returns true if the character is a hexadecimal digit i.e. in the range ||| [0-9][a-f][A-F]. public export isHexDigit : Char -> Bool isHexDigit x = elem (toUpper x) hexChars where hexChars : List Char hexChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'] ||| Returns true if the character is an octal digit. public export isOctDigit : Char -> Bool isOctDigit x = (x >= '0' && x <= '7') ||| Returns true if the character is a control character. public export isControl : Char -> Bool isControl x = (x >= '\x0000' && x <= '\x001f') || (x >= '\x007f' && x <= '\x009f') ||| Convert the number to its backend dependent (usually Unicode) Char ||| equivalent. public export chr : Int -> Char chr = prim__cast_IntChar ||| Return the backend dependent (usually Unicode) numerical equivalent of the Char. public export ord : Char -> Int ord = prim__cast_CharInt ----------------------- -- DOUBLE PRIMITIVES -- ----------------------- public export pi : Double pi = 3.14159265358979323846 public export euler : Double euler = 2.7182818284590452354 public export exp : Double -> Double exp x = prim__doubleExp x public export log : Double -> Double log x = prim__doubleLog x public export pow : Double -> Double -> Double pow x y = exp (y * log x) public export sin : Double -> Double sin x = prim__doubleSin x public export cos : Double -> Double cos x = prim__doubleCos x public export tan : Double -> Double tan x = prim__doubleTan x public export asin : Double -> Double asin x = prim__doubleASin x public export acos : Double -> Double acos x = prim__doubleACos x public export atan : Double -> Double atan x = prim__doubleATan x public export sinh : Double -> Double sinh x = (exp x - exp (-x)) / 2 public export cosh : Double -> Double cosh x = (exp x + exp (-x)) / 2 public export tanh : Double -> Double tanh x = sinh x / cosh x public export sqrt : Double -> Double sqrt x = prim__doubleSqrt x public export floor : Double -> Double floor x = prim__doubleFloor x public export ceiling : Double -> Double ceiling x = prim__doubleCeiling x ----------- -- CASTS -- ----------- -- Casts between primitives only here. They might be lossy. ||| Interface for transforming an instance of a data type to another type. public export interface Cast from to where ||| Perform a (potentially lossy!) cast operation. ||| @ orig The original type cast : (orig : from) -> to -- To String export Cast Int String where cast = prim__cast_IntString export Cast Integer String where cast = prim__cast_IntegerString export Cast Char String where cast = prim__cast_CharString export Cast Double String where cast = prim__cast_DoubleString -- To Integer export Cast Int Integer where cast = prim__cast_IntInteger export Cast Char Integer where cast = prim__cast_CharInteger export Cast Double Integer where cast = prim__cast_DoubleInteger export Cast String Integer where cast = prim__cast_StringInteger export Cast Nat Integer where cast = natToInteger export Cast Bits8 Integer where cast = prim__cast_Bits8Integer export Cast Bits16 Integer where cast = prim__cast_Bits16Integer export Cast Bits32 Integer where cast = prim__cast_Bits32Integer export Cast Bits64 Integer where cast = prim__cast_Bits64Integer -- To Int export Cast Integer Int where cast = prim__cast_IntegerInt export Cast Char Int where cast = prim__cast_CharInt export Cast Double Int where cast = prim__cast_DoubleInt export Cast String Int where cast = prim__cast_StringInt export Cast Nat Int where cast = fromInteger . natToInteger export Cast Bits8 Int where cast = prim__cast_Bits8Int export Cast Bits16 Int where cast = prim__cast_Bits16Int export Cast Bits32 Int where cast = prim__cast_Bits32Int export Cast Bits64 Int where cast = prim__cast_Bits64Int -- To Char export Cast Int Char where cast = prim__cast_IntChar -- To Double export Cast Int Double where cast = prim__cast_IntDouble export Cast Integer Double where cast = prim__cast_IntegerDouble export Cast String Double where cast = prim__cast_StringDouble export Cast Nat Double where cast = prim__cast_IntegerDouble . natToInteger -- To Bits8 export Cast Int Bits8 where cast = prim__cast_IntBits8 export Cast Integer Bits8 where cast = prim__cast_IntegerBits8 export Cast Bits16 Bits8 where cast = prim__cast_Bits16Bits8 export Cast Bits32 Bits8 where cast = prim__cast_Bits32Bits8 export Cast Bits64 Bits8 where cast = prim__cast_Bits64Bits8 -- To Bits16 export Cast Int Bits16 where cast = prim__cast_IntBits16 export Cast Integer Bits16 where cast = prim__cast_IntegerBits16 export Cast Bits8 Bits16 where cast = prim__cast_Bits8Bits16 export Cast Bits32 Bits16 where cast = prim__cast_Bits32Bits16 export Cast Bits64 Bits16 where cast = prim__cast_Bits64Bits16 -- To Bits32 export Cast Int Bits32 where cast = prim__cast_IntBits32 export Cast Integer Bits32 where cast = prim__cast_IntegerBits32 export Cast Bits8 Bits32 where cast = prim__cast_Bits8Bits32 export Cast Bits16 Bits32 where cast = prim__cast_Bits16Bits32 export Cast Bits64 Bits32 where cast = prim__cast_Bits64Bits32 -- To Bits64 export Cast Int Bits64 where cast = prim__cast_IntBits64 export Cast Integer Bits64 where cast = prim__cast_IntegerBits64 export Cast Bits8 Bits64 where cast = prim__cast_Bits8Bits64 export Cast Bits16 Bits64 where cast = prim__cast_Bits16Bits64 export Cast Bits32 Bits64 where cast = prim__cast_Bits32Bits64 ------------ -- RANGES -- ------------ public export countFrom : n -> (n -> n) -> Stream n countFrom start diff = start :: countFrom (diff start) diff -- this and takeBefore are for range syntax, and not exported here since -- they're partial. They are exported from Data.Stream instead. partial takeUntil : (n -> Bool) -> Stream n -> List n takeUntil p (x :: xs) = if p x then [x] else x :: takeUntil p xs partial takeBefore : (n -> Bool) -> Stream n -> List n takeBefore p (x :: xs) = if p x then [] else x :: takeBefore p xs public export interface Range a where rangeFromTo : a -> a -> List a rangeFromThenTo : a -> a -> a -> List a rangeFrom : a -> Stream a rangeFromThen : a -> a -> Stream a -- Idris 1 went to great lengths to prove that these were total. I don't really -- think it's worth going to those lengths! Let's keep it simple and assert. export Range Nat where rangeFromTo x y = if y > x then assert_total $ takeUntil (>= y) (countFrom x S) else if x > y then assert_total $ takeUntil (<= y) (countFrom x (\n => minus n 1)) else [x] rangeFromThenTo x y z = if y > x then (if z > x then assert_total $ takeBefore (> z) (countFrom x (plus (minus y x))) else []) else (if x == y then (if x == z then [x] else []) else assert_total $ takeBefore (< z) (countFrom x (\n => minus n (minus x y)))) rangeFrom x = countFrom x S rangeFromThen x y = if y > x then countFrom x (plus (minus y x)) else countFrom x (\n => minus n (minus x y)) export (Integral a, Ord a, Neg a) => Range a where rangeFromTo x y = if y > x then assert_total $ takeUntil (>= y) (countFrom x (+1)) else if x > y then assert_total $ takeUntil (<= y) (countFrom x (\x => x-1)) else [x] rangeFromThenTo x y z = if (z - x) > (z - y) then -- go up assert_total $ takeBefore (> z) (countFrom x (+ (y-x))) else if (z - x) < (z - y) then -- go down assert_total $ takeBefore (< z) (countFrom x (\n => n - (x - y))) else -- meaningless if x == y && y == z then [x] else [] rangeFrom x = countFrom x (1+) rangeFromThen x y = if y > x then countFrom x (+ (y - x)) else countFrom x (\n => n - (x - y))
Formal statement is: lemma (in order_topology) decreasing_tendsto: assumes bdd: "eventually (\<lambda>n. l \<le> f n) F" and en: "\<And>x. l < x \<Longrightarrow> eventually (\<lambda>n. f n < x) F" shows "(f \<longlongrightarrow> l) F" Informal statement is: If $f$ is a sequence of real numbers such that $f_n \geq l$ for all $n$ and $f_n < x$ for all $n$ whenever $x > l$, then $f$ converges to $l$.
import Decidable.Equality data Elem : a -> List a -> Type where Here : Elem x (x :: xs) There : (later : Elem x xs) -> Elem x (y :: xs) data Last : List a -> a -> Type where LastOne : Last [value] value LastCons : (prf : Last xs value) -> Last (x :: xs) value last123 : Last [1,2,3] 3 last123 = LastCons (LastCons LastOne) isNotNill : Last [] value -> Void isNotNill LastOne impossible isNotNill (LastCons prf) impossible isNotLastOne : (value = x -> Void) -> Last [x] value -> Void isNotLastOne notLastOne LastOne = notLastOne Refl isNotLastOne _ (LastCons prf) = isNotNill prf notInTail : (xs = [] -> Void) -> (Last xs value -> Void) -> Last (x :: xs) value -> Void notInTail hasMore noMore LastOne = hasMore Refl notInTail hasMore noMore (LastCons later) = noMore later isLast : DecEq a => (xs : List a) -> (value : a) -> Dec (Last xs value) isLast [] value = No isNotNill isLast (x :: xs) value = case decEq xs [] of Yes Refl => case decEq value x of Yes Refl => Yes LastOne No notLastOne => No (isNotLastOne notLastOne) No hasMore => case isLast xs value of Yes prf => Yes (LastCons prf) No noMore => No (notInTail hasMore noMore)
# Clean data from approval_pollist.csv and # approval_topline.csv # Packages: ggplot2, reshape2, plyr # load in required packages if not selecting check box in R Studio library(ggplot2) library(plyr) library(reshape2) # Set the current working directory setwd('C:/rstuff/projects/dt_approval/') # Make function for spacing spacing = function() { strrep('-',70) } # Load the datasets poll_list = read.csv('approval_polllist.csv') topline = read.csv('approval_topline.csv') #DATA SUMMARY----------------------------------------------------------------------- # Print head head(poll_list) spacing() head(topline) # Print a summary summary(poll_list) spacing() summary(topline) # Print dimensions dim(poll_list) spacing() dim(topline) # Print column names names(poll_list) spacing() names(topline) #DATA COPIES ------------------------------------------------------------------------------------- # Creat dataset copies for testing purposes pl_copy = data.frame(poll_list) tl_copy = data.frame(topline) head(pl_copy) spacing() head(tl_copy) # Check memory addresses to ensure original and copy are different tracemem(pl_copy)==tracemem(poll_list) tracemem(tl_copy)==tracemem(topline) #DATA EXPLORATION ------------------------------------------------------------------------------- # Variables for unique column values for poll_list c_subgroup = unique(poll_list$subgroup) c_pollster = unique(poll_list$pollster) c_grade = unique(poll_list$grade) c_population = unique(poll_list$population) # Print the variables and length print(c_subgroup) print(length(c_subgroup)) print(c_pollster) print(length(c_pollster)) print(c_grade) print(length(c_grade)) print(c_population) print(length(c_population)) # topline only has subgroup categorical column. Identical to poll_list subgroup. # Check total NA values sum(is.na(pl_copy)) sum(is.na(tl_copy)) #GRADE AND N/A CLEANING ----------------------------------------------------------------------------- # create new dataframe with desired columns from pl_copy pollster_data = pl_copy[,c(6,7,12,13,14,15)] head(pollster_data) # create a factor for grades pollster_data$grade = factor(pollster_data$grade, levels = c('A+', 'A', 'A-', 'A/B', 'B+', 'B', 'B-', 'B/C', 'C+', 'C', 'C-', 'C/D', 'D+', 'D', 'D-')) # order pollster_data by grade (descending order) pollster_data = pollster_data[order(pollster_data$grade),] head(pollster_data) tail(pollster_data) summary(pollster_data) # omit rows with grade NA values pollster_data = pollster_data[complete.cases(pollster_data[,2]),] head(pollster_data) tail(pollster_data) summary(pollster_data) #ADJUSTED APPROVE CLEAN/RESHAPE ---------------------------------------------------------------------------------------- # create factor of pollster and get adjusted_approve averages pollster_avg_app = aggregate(pollster_data[,5], list(pollster_data$pollster, pollster_data$grade), mean) head(pollster_avg_app) tail(pollster_avg_app) # sort averages by highest adjusted approve sorted_avg = data.frame(pollster_avg_app) sorted_avg = sorted_avg[order(sorted_avg$x, decreasing = TRUE),] head(sorted_avg) tail(sorted_avg) # rename sorted_avg columns sorted_avg = rename(sorted_avg, c("Group.1"="Pollster", "Group.2"="Grade", "x"="Adjusted_Approve_AVG")) # make pollster index/row names rownames(sorted_avg) = sorted_avg$Pollster # remove the pollster colummn sorted_avg$Pollster = NULL #ADJUSTED DISAPPROVE CLEAN/RESHAPE --------------------------------------------------------------------------------------- # create factor of pollster and get adjusted_disapprove averages pollster_avg_dis = aggregate(pollster_data[,6], list(pollster_data$pollster, pollster_data$grade), mean) head(pollster_avg_dis) tail(pollster_avg_dis) # sort averages by highest adjusted disapprove sorted_avg2 = data.frame(pollster_avg_dis) sorted_avg2 = sorted_avg2[order(sorted_avg2$x, decreasing = TRUE),] head(sorted_avg2) tail(sorted_avg2) # rename sorted_avg2 columns sorted_avg2 = rename(sorted_avg2, c("Group.1"="Pollster", "Group.2"="Grade", "x"="Adjusted_Disapprove_AVG")) # make pollster index/row names rownames(sorted_avg2) = sorted_avg2$Pollster # remove the pollster column sorted_avg2$Pollster = NULL #ADJUSTED AVERAGES DATA AND DF REMOVAL -------------------------------------------------------------------------------- total_avg = merge(sorted_avg, sorted_avg2, by=0, all=TRUE) head(total_avg) tail(total_avg) # drop Grade.y since it is identical to Grade.x and rename Grade.x total_avg$Grade.y = NULL total_avg = rename(total_avg, c("Grade.x"="Grade")) # rename row.names and make index, remove pollster column total_avg = rename(total_avg, c("Row.names"="Pollster")) rownames(total_avg) = total_avg$Pollster total_avg$Pollster = NULL head(total_avg) # create a copy of total_avg sorted by grade total_avg_by_grade = data.frame(total_avg) total_avg_by_grade = total_avg_by_grade[order(total_avg_by_grade$Grade),] head(total_avg_by_grade) tail(total_avg_by_grade) # delete data frames and factors no longer needed rm(list = c("pl_copy", "poll_list", "pollster_avg_app", "pollster_avg_dis", "pollster_data", "sorted_avg", "sorted_avg2", "tl_copy", "topline", "c_grade", "c_pollster", "c_population", "c_subgroup")) # summary of total_avg and total_avg_by_grade (SHOULD BE IDENTICAL) summary(total_avg) summary(total_avg_by_grade) #DATA OUTPUT ----------------------------------------------------------------------------------------------- # output total_avg and total_avg_by_grade as csv files to cwd write.csv(total_avg, 'approval_averages.csv', row.names = TRUE) write.csv(total_avg_by_grade, 'averages_by_grade.csv', row.names = TRUE) # create a copy of pollster_data to sort by approve (decreasing) BELOW IS REFERENCE # approval_data = data.frame(pollster_data) # approval_data = approval_data[order(approval_data$adjusted_approve, decreasing = TRUE),] # head(approval_data)
module induction where import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; cong; sym) open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; step-≡; _∎) open import Data.Nat using (ℕ; zero; suc; _+_; _*_; _∸_; _^_) -- ------------------------------- -- (zero + n) + p ≡ zero + (n + p) -- -- (m + n) + p ≡ m + (n + p) -- --------------------------------- -- (suc m + n) + p ≡ suc m + (n + p) -- 1) -- In the beginning, we know nothing. -- On the first day, we know zero. -- 0 : ℕ -- On the second day, we know one and about associativity of 0. -- 0 : ℕ -- 1 : ℕ (0 + 0) + 0 ≡ 0 + (0 + 0) -- On the third day, we know two and about associativity of 1. -- 0 : ℕ -- 1 : ℕ (0 + 0) + 0 ≡ 0 + (0 + 0) -- 2 : ℕ (0 + 1) + 0 ≡ 0 + (1 + 0) (0 + 1) + 1 ≡ 0 + (1 + 1) (0 + 0) + 1 ≡ 0 + (0 + 1) (1 + 0) + 0 ≡ 1 + (0 + 0) -- On the fourth day, we know two and about associativity of 2. -- 0 : ℕ -- 1 : ℕ (0 + 0) + 0 ≡ 0 + (0 + 0) -- 2 : ℕ (0 + 1) + 0 ≡ 0 + (1 + 0) (0 + 1) + 1 ≡ 0 + (1 + 1) (0 + 0) + 1 ≡ 0 + (0 + 1) (1 + 0) + 0 ≡ 1 + (0 + 0) (1 + 0) + 1 ≡ 1 + (0 + 1) (1 + 1) + 0 ≡ 1 + (1 + 0) (1 + 1) + 1 ≡ 1 + (1 + 1) -- 3 : ℕ (0 + 2) + 0 ≡ 0 + (2 + 0) (0 + 2) + 2 ≡ 0 + (2 + 2) (0 + 0) + 2 ≡ 0 + (0 + 2) (0 + 2) + 1 ≡ 0 + (2 + 1) (0 + 1) + 2 ≡ 0 + (1 + 2) (2 + 0) + 0 ≡ 2 + (0 + 0) (2 + 1) + 0 ≡ 2 + (1 + 0) (2 + 2) + 0 ≡ 2 + (2 + 0) (2 + 0) + 1 ≡ 2 + (0 + 1) (2 + 0) + 2 ≡ 2 + (0 + 2) (2 + 1) + 1 ≡ 2 + (1 + 1) (2 + 1) + 2 ≡ 2 + (1 + 2) (2 + 2) + 1 ≡ 2 + (2 + 1) (2 + 2) + 2 ≡ 2 + (2 + 2) -- 2) +-assoc : ∀ (m n p : ℕ) → (m + n) + p ≡ m + (n + p) +-assoc zero n p = begin (zero + n) + p ≡⟨⟩ n + p ≡⟨⟩ zero + (n + p) ∎ +-assoc (suc m) n p = begin (suc m + n) + p ≡⟨⟩ suc (m + n) + p ≡⟨⟩ suc ((m + n) + p) ≡⟨ cong suc (+-assoc m n p) ⟩ suc (m + (n + p)) ≡⟨⟩ suc m + (n + p) ∎ +-identityʳ : ∀ (m : ℕ) → m + zero ≡ m +-identityʳ zero = begin zero + zero ≡⟨⟩ zero ∎ +-identityʳ (suc m) = begin suc m + zero ≡⟨⟩ suc (m + zero) ≡⟨ cong suc (+-identityʳ m) ⟩ suc m ∎ +-suc : ∀ (m n : ℕ) → m + suc n ≡ suc (m + n) +-suc zero n = begin zero + suc n ≡⟨⟩ suc n ≡⟨⟩ suc (zero + n) ∎ +-suc (suc m) n = begin suc m + suc n ≡⟨⟩ suc (m + suc n) ≡⟨ cong suc (+-suc m n) ⟩ suc (suc (m + n)) ≡⟨⟩ suc (suc m + n) ∎ +-comm : ∀ (m n : ℕ) → m + n ≡ n + m +-comm m zero = begin m + zero ≡⟨ +-identityʳ m ⟩ m ≡⟨⟩ zero + m ∎ +-comm m (suc n) = begin m + suc n ≡⟨ +-suc m n ⟩ suc (m + n) ≡⟨ cong suc (+-comm m n) ⟩ suc (n + m) ≡⟨⟩ suc n + m ∎ +-swap : ∀ (m n p : ℕ) → m + (n + p) ≡ n + (m + p) +-swap m n p = begin m + (n + p) ≡⟨ sym (+-assoc m n p) ⟩ (m + n) + p ≡⟨ cong (_+ p) (+-comm m n) ⟩ (n + m) + p ≡⟨ +-assoc n m p ⟩ n + (m + p) ∎ -- +-swap : ∀ (m n p : ℕ) → m + (n + p) ≡ n + (m + p) -- +-swap m n p rewrite sym (+-assoc m n p) -- | cong (_+ p) (+-comm m n) -- | +-assoc n m p -- = refl -- 3) *-distrib-+ : ∀ (m n p : ℕ) → (m + n) * p ≡ m * p + n * p *-distrib-+ zero n p = begin (zero + n) * p ≡⟨⟩ n * p ≡⟨⟩ zero * p + n * p ∎ *-distrib-+ (suc m) n p = begin ((suc m) + n) * p ≡⟨⟩ suc (m + n) * p ≡⟨⟩ p + ((m + n) * p) ≡⟨ cong (p +_) (*-distrib-+ m n p) ⟩ p + (m * p + n * p) ≡⟨ sym (+-assoc p (m * p) (n * p))⟩ (p + m * p) + n * p ≡⟨⟩ (suc m) * p + n * p ∎ -- 4) *-assoc : ∀ (m n p : ℕ) → (m * n) * p ≡ m * (n * p) *-assoc zero n p = begin (zero * n) * p ≡⟨⟩ zero * p ≡⟨⟩ zero ≡⟨⟩ zero * n ≡⟨⟩ zero * (n * p) ∎ *-assoc (suc m) n p = begin (suc m * n) * p ≡⟨⟩ (n + m * n) * p ≡⟨ *-distrib-+ n (m * n) p ⟩ (n * p) + (m * n) * p ≡⟨ cong ((n * p) +_) (*-assoc m n p) ⟩ (n * p) + m * (n * p) ≡⟨⟩ suc m * (n * p) ∎ -- 5) *-absorbingʳ : ∀ (m : ℕ) → m * zero ≡ zero *-absorbingʳ zero = begin zero * zero ≡⟨⟩ zero ∎ *-absorbingʳ (suc m) = begin suc m * zero ≡⟨⟩ zero + m * zero ≡⟨ cong (zero +_) (*-absorbingʳ m) ⟩ zero + zero ≡⟨⟩ zero ∎ *-suc : ∀ (m n : ℕ) → m * suc n ≡ m + m * n *-suc zero n = begin zero * (suc n) ≡⟨⟩ zero ≡⟨⟩ zero * n ≡⟨⟩ zero + zero * n ∎ *-suc (suc m) n = begin suc m * suc n ≡⟨⟩ (suc n) + (m * suc n) ≡⟨ cong ((suc n) +_) (*-suc m n) ⟩ (suc n) + (m + m * n) ≡⟨⟩ suc (n + (m + m * n)) ≡⟨ cong suc (sym (+-assoc n m (m * n))) ⟩ suc ((n + m) + m * n) ≡⟨ cong (λ {term → suc (term + m * n)}) (+-comm n m) ⟩ suc ((m + n) + m * n) ≡⟨ cong suc (+-assoc m n (m * n)) ⟩ suc (m + (n + m * n)) ≡⟨⟩ suc (m + (suc m * n)) ≡⟨⟩ suc m + suc m * n ∎ *-comm : ∀ (m n : ℕ) → m * n ≡ n * m *-comm m zero = begin m * zero ≡⟨ *-absorbingʳ m ⟩ zero ≡⟨⟩ zero * m ∎ *-comm m (suc n) = begin m * suc n ≡⟨ *-suc m n ⟩ m + m * n ≡⟨ cong (m +_) (*-comm m n) ⟩ m + n * m ≡⟨⟩ suc n * m ∎ -- 6) 0∸n≡0 : ∀ (n : ℕ) → zero ∸ n ≡ zero 0∸n≡0 zero = begin zero ∸ zero ≡⟨⟩ zero ∎ 0∸n≡0 (suc n) = begin zero ∸ suc n ≡⟨⟩ zero ∎ -- No induction needed, just prove it holds for 0 and for suc n. (Holds because of definition of ∸) -- 7) 0∸n≡0∸n+p : ∀ (n p : ℕ) → zero ∸ n ≡ zero ∸ (n + p) 0∸n≡0∸n+p n zero = begin zero ∸ n ≡⟨ cong (zero ∸_) (sym (+-identityʳ n)) ⟩ zero ∸ (n + zero) ∎ 0∸n≡0∸n+p n (suc p) = begin zero ∸ n ≡⟨ 0∸n≡0 n ⟩ zero ≡⟨⟩ zero ∸ suc (n + p) ≡⟨ cong (zero ∸_) (sym (+-suc n p)) ⟩ zero ∸ (n + suc p) ∎ ∸-+-assoc : ∀ (m n p : ℕ) → (m ∸ n) ∸ p ≡ m ∸ (n + p) ∸-+-assoc zero n p = begin (zero ∸ n) ∸ p ≡⟨ cong (_∸ p) (0∸n≡0 n) ⟩ zero ∸ p ≡⟨ 0∸n≡0 p ⟩ zero ≡⟨ sym (0∸n≡0 n) ⟩ zero ∸ n ≡⟨ 0∸n≡0∸n+p n p ⟩ zero ∸ (n + p) ∎ ∸-+-assoc (suc m) zero p = begin (suc m ∸ zero) ∸ p ≡⟨⟩ suc m ∸ (zero + p) ∎ ∸-+-assoc (suc m) (suc n) p = begin (suc m ∸ suc n) ∸ p ≡⟨⟩ (m ∸ n) ∸ p ≡⟨ ∸-+-assoc m n p ⟩ m ∸ (n + p) ≡⟨⟩ suc m ∸ suc (n + p) ≡⟨⟩ suc m ∸ (suc n + p) ∎ -- 8) *-identityˡ : ∀ (n : ℕ) → 1 * n ≡ n *-identityˡ n = begin 1 * n ≡⟨⟩ (suc zero) * n ≡⟨⟩ n + (zero * n) ≡⟨⟩ n + zero ≡⟨ +-identityʳ n ⟩ n ∎ ^-distribˡ-+-* : ∀ (m n p : ℕ) → m ^ (n + p) ≡ (m ^ n) * (m ^ p) ^-distribˡ-+-* m zero p = begin m ^ (zero + p) ≡⟨⟩ m ^ p ≡⟨ sym (*-identityˡ (m ^ p)) ⟩ 1 * m ^ p ≡⟨⟩ (m ^ zero) * (m ^ p) ∎ ^-distribˡ-+-* m (suc n) p = begin m ^ (suc n + p) ≡⟨⟩ m ^ suc (n + p) ≡⟨⟩ m * (m ^ (n + p)) ≡⟨ cong (m *_) (^-distribˡ-+-* m n p) ⟩ m * (m ^ n * m ^ p) ≡⟨ sym (*-assoc m (m ^ n) (m ^ p)) ⟩ (m * m ^ n) * m ^ p ≡⟨⟩ (m ^ suc n) * (m ^ p) ∎ ^-distribʳ-* : ∀ (m n p : ℕ) → (m * n) ^ p ≡ (m ^ p) * (n ^ p) ^-distribʳ-* m n zero = begin (m * n) ^ zero ≡⟨⟩ 1 ≡⟨⟩ 1 * 1 ≡⟨⟩ (m ^ zero) * (n ^ zero) ∎ ^-distribʳ-* m n (suc p) = begin (m * n) ^ (suc p) ≡⟨⟩ (m * n) * (m * n) ^ p ≡⟨ cong ((m * n) *_) (^-distribʳ-* m n p) ⟩ (m * n) * ((m ^ p) * (n ^ p)) ≡⟨ sym (*-assoc (m * n) (m ^ p) (n ^ p)) ⟩ ((m * n) * (m ^ p)) * (n ^ p) ≡⟨ cong (_* (n ^ p)) (*-assoc m n (m ^ p)) ⟩ (m * (n * (m ^ p))) * (n ^ p) ≡⟨ cong (λ {term → (m * term) * (n ^ p)}) (*-comm n (m ^ p)) ⟩ (m * ((m ^ p) * n)) * (n ^ p) ≡⟨ cong (_* (n ^ p)) (sym (*-assoc m (m ^ p) n)) ⟩ (m * (m ^ p) * n) * (n ^ p) ≡⟨ *-assoc (m * (m ^ p)) n (n ^ p) ⟩ m * (m ^ p) * (n * (n ^ p)) ≡⟨⟩ (m ^ suc p) * (n ^ suc p) ∎ ^-*-assoc : ∀ (m n p : ℕ) → (m ^ n) ^ p ≡ m ^ (n * p) ^-*-assoc m n zero = begin (m ^ n) ^ zero ≡⟨⟩ 1 ≡⟨⟩ m ^ zero ≡⟨ cong (m ^_) (sym (*-absorbingʳ n)) ⟩ m ^ (n * zero) ∎ ^-*-assoc m n (suc p) = begin (m ^ n) ^ suc p ≡⟨⟩ (m ^ n) * (m ^ n) ^ p ≡⟨ cong ((m ^ n) *_) (^-*-assoc m n p) ⟩ (m ^ n) * (m ^ (n * p)) ≡⟨ cong (λ {term → (m ^ n) * (m ^ term)}) (*-comm n p) ⟩ (m ^ n) * (m ^ (p * n)) ≡⟨ sym (^-distribˡ-+-* m n (p * n)) ⟩ m ^ (n + p * n) ≡⟨⟩ m ^ (suc p * n) ≡⟨ cong (m ^_) (*-comm (suc p) n) ⟩ m ^ (n * suc p) ∎ -- 9) data Bin : Set where - : Bin _O : Bin → Bin _I : Bin → Bin inc : Bin → Bin inc - = - I inc (rest O) = rest I inc (rest I) = (inc rest) O to : ℕ → Bin to zero = - O to (suc n) = inc (to n) from : Bin → ℕ from - = 0 from (rest O) = 2 * from rest from (rest I) = 2 * from rest + 1 bin-inverse-suc-inc : ∀ (b : Bin) → from (inc b) ≡ suc (from b) bin-inverse-suc-inc - = begin from (inc -) ≡⟨⟩ from (- I) ≡⟨⟩ 2 * from - + 1 ≡⟨⟩ 2 * 0 + 1 ≡⟨⟩ 0 + 1 ≡⟨⟩ 1 ≡⟨⟩ suc 0 ≡⟨⟩ suc (from -) ∎ bin-inverse-suc-inc (b O) = begin from (inc (b O)) ≡⟨⟩ from (b I) ≡⟨⟩ 2 * from b + 1 ≡⟨ +-comm (2 * from b) 1 ⟩ suc (2 * from b) ≡⟨⟩ suc (from (b O)) ∎ bin-inverse-suc-inc (b I) = begin from (inc (b I)) ≡⟨⟩ from ((inc b) O) ≡⟨⟩ 2 * from (inc b) ≡⟨ cong (2 *_) (bin-inverse-suc-inc b) ⟩ 2 * suc (from b) ≡⟨ *-comm 2 (suc (from b)) ⟩ suc (from b) * 2 ≡⟨⟩ (1 + from b) * 2 ≡⟨ *-distrib-+ 1 (from b) 2 ⟩ 1 * 2 + from b * 2 ≡⟨ cong (1 * 2 +_) (*-comm (from b) 2) ⟩ 1 * 2 + 2 * from b ≡⟨⟩ 2 + 2 * from b ≡⟨⟩ suc 1 + 2 * from b ≡⟨⟩ suc (1 + 2 * from b) ≡⟨ cong (suc) (+-comm 1 (2 * from b)) ⟩ suc (2 * from b + 1) ≡⟨⟩ suc (from (b I)) ∎ -- ∀ (b : Bin) → to (from b) ≡ b -- This does not work, as "from" is a surjective function. Both "-" and "- O" from Bin map into 0 from ℕ. Surjective functions have no left inverse. -- 0 would have to map into two values, making the inverse of "from" not a function. -- This works, as "to" is an injective function. 0 from ℕ maps (according to our definition) into "- O" in Bin. Injective functions have a left inverse. -- "from" is a left inverse to "to". Note that there are infinitely many left inverses, since "-" could be mapped to any value in ℕ. from∘to≡idₗ : ∀ (n : ℕ) → from (to n) ≡ n from∘to≡idₗ zero = begin from (to zero) ≡⟨⟩ from (- O) ≡⟨⟩ 2 * from - ≡⟨⟩ 2 * 0 ≡⟨⟩ zero ∎ from∘to≡idₗ (suc n) = begin from (to (suc n)) ≡⟨⟩ from (inc (to n)) ≡⟨ bin-inverse-suc-inc (to n) ⟩ suc (from (to n)) ≡⟨ cong suc (from∘to≡idₗ n) ⟩ suc n ∎
import .main open tactic #exit meta def ex01 : expr := `(∀ x : int, x ≤ -x → x ≤ 0) meta def ex02 : expr := `(∀ x y : int, (x ≤ 5 ∧ y ≤ 3) → x + y ≤ 8) meta def ex03 : expr := `(∀ x y z : int, x < y → y < z → x < z) meta def ex04 : expr := `(∀ x y z : int, x - y ≤ x - z → z ≤ y) meta def ex05 : expr := `(∀ x : int, (x = 5 ∨ x = 7) → 2 < x) meta def ex06 : expr := `(∀ x : int, (x = -5 ∨ x = 7) → x ≠ 0) meta def ex07 : expr := `(∀ x : int, 31 * x > 0 → x > 0) meta def ex08 : expr := `(∀ x y : int, (-x - y < x - y) → (x - y < x + y) → (x > 0 ∧ y > 0)) meta def ex09 : expr := `(∀ x y : int, ¬(2 * x + 1 = 2 * y)) meta def ex10 : expr := `(∀ x y z : int, (2 * x + 1 = 2 * y) → x + y + z > 1) meta def ex11 : expr := `(∃ x y : int, 5 * x + 3 * y = 1) meta def ex12 : expr := `(∀ x y : int, x + 2 < y → ∃ z w : int, (x < z ∧ z < w ∧ w < y)) meta def ex13 : expr := `(∀ x : int, (x ≥ -1 ∧ x ≤ 1) → (x = -1 ∨ x = 0 ∨ x = 1)) meta def ex14 : expr := `(∀ x : int, ∃ y : int, x = 2 * y ∨ x = (2 * y) + 1) meta def ex15 : expr := `(∀ x : int, 5 * x = 5 → x = 1) meta def ex16 : expr := `(∀ x : int, (∃ y : int, 2 * y + 1 = x) → ¬ ∃ y : int, 4 * y = x) meta def ex17 : expr := `(∃ x : int, 5 * x = 1335) meta def ex18 : expr := `(∃ x y : int, x + y = 231 ∧ x - y = -487) meta def ex19 : expr := `(∀ a : int, ∃ b : int, a < 4 * b + 3 * a ∨ (¬(a < b) ∧ a > b + 1)) meta def ex20 : expr := `(∃ x y : int, x > 0 ∧ y ≥ 0 ∧ 3 * x - 5 * y = 1) meta def ex21 : expr := `(∃ x y : int, x ≥ 0 ∧ y ≥ 0 ∧ 5 * x - 6 * y = 1) meta def ex22 : expr := `(∃ x y : int, x ≥ 0 ∧ y ≥ 0 ∧ 5 * x - 3 * y = 1) meta def ex23 : expr := `(∃ x y : int, x ≥ 0 ∧ y ≥ 0 ∧ 3 * x - 5 * y = 1) meta def ex24 : expr := `(∃ a b : int, ¬(a = 1) ∧ ((2 * b = a) ∨ (2 * b = 3 * a + 1)) ∧ (a = b)) meta def ex25 : expr := `(∀ x y z : int, x = y → y = z → x = z) meta def ex26 : expr := `(∀ x : int, x < 349 ∨ x > 123) meta def ex27 : expr := `(∀ x y : int, x ≤ 3 * y → 3 * x ≤ 9 * y) meta def ex28 : expr := `(∃ x y : int, 32 * x = 2023 + y) meta def ex29 : expr := `(∀ x : int, (x < 43 ∧ x > 513) → x ≠ x) meta def ex30 : expr := `(∀ x : int, ∃ y : int, x = 3 * y - 1 ∨ x = 3 * y ∨ x = 3 * y + 1) meta def ex31 : expr := `(forall x : int, exists y : int, x = 5 * y - 2 \/ x = 5 * y - 1 \/ x = 5 * y \/ x = 5 * y + 1 \/ x = 5 * y + 2) meta def ex32 : expr := `(forall x y : int, 6 * x = 5 * y -> exists d : int, y = 3 * d) meta def ex33 : expr := `(forall x : int, ¬(exists m : int, x = 2 * m) /\ (exists m : int, x = 3 * m + 1) ↔ (exists m : int, x = 12 * m + 1) \/ (exists m : int, x = 12 * m + 7)) meta def ex34 : expr := `(forall x y : int, (exists d : int, x + y = 2 * d) ↔ ((exists d : int, x = 2 * d) ↔ (exists d : int, y = 2 * d))) meta def ex35 : expr := `(∀ x : int, x > 5000 → ∃ y : int, y ≥ 1000 ∧ 5 * y < x) meta def ex36 : expr := `(forall x : int, (exists y : int, 3 * y = x) -> (exists y : int, 7 * y = x) -> (exists y : int, 21 * y = x)) meta def ex37 : expr := `(forall y : int, (exists d : int, y = 65 * d) -> (exists d : int, y = 5 * d)) meta def ex38 : expr := `(forall n : int, 0 < n /\ n < 2400 -> n <= 2 /\ 2 <= 2 * n \/ n <= 3 /\ 3 <= 2 * n \/ n <= 5 /\ 5 <= 2 * n \/ n <= 7 /\ 7 <= 2 * n \/ n <= 13 /\ 13 <= 2 * n \/ n <= 23 /\ 23 <= 2 * n \/ n <= 43 /\ 43 <= 2 * n \/ n <= 83 /\ 83 <= 2 * n \/ n <= 163 /\ 163 <= 2 * n \/ n <= 317 /\ 317 <= 2 * n \/ n <= 631 /\ 631 <= 2 * n \/ n <= 1259 /\ 1259 <= 2 * n \/ n <= 2503 /\ 2503 <= 2 * n) meta def ex39 : expr := `(forall z : int, z > 7 -> exists x y : int, x >= 0 /\ y >= 0 /\ 3 * x + 5 * y = z) meta def ex40 : expr := `(exists w x y z : int, 2 * w + 3 * x + 4 * y + 5 * z = 1) meta def ex41 : expr := `(forall x : int, x >= 8 -> exists u v : int, u >= 0 /\ v >= 0 /\ x = 3 * u + 5 * v) meta def ex42 : expr := `(forall x y : int, x <= y -> 2 * x + 1 < 2 * y) meta def ex43 : expr := `(forall a b : int, exists x : int, a < 20 * x /\ 20 * x < b) meta def ex44 : expr := `(exists y : int, forall x : int, x + 5 * y > 1 /\ 13 * x - y > 1 /\ x + 2 < 0) meta def ex45 : expr := `(exists x y : int, 5 * x + 10 * y = 1) meta def ex46 : expr := `(forall x y : int, x >= 0 /\ y >= 0 -> 12 * x - 8 * y < 0 \/ 12 * x - 8 * y > 2) meta def ex47 : expr := `(exists x y : int, x >= 0 /\ y >= 0 /\ 6 * x - 3 * y = 1) meta def ex48 : expr := `(forall x y : int, ¬(x = 0) -> 5 * y < 6 * x \/ 5 * y > 6 * x) meta def ex49 : expr := `(forall x y : int, ¬(6 * x = 5 * y)) meta def ex50 : expr := `(exists a b : int, a > 1 /\ b > 1 /\ ((2 * b = a) \/ (2 * b = 3 * a + 1)) /\ (a = b)) meta def batch_test (solver : tactic unit) : nat → list expr → tactic unit | _ [] := tactic.triv | idx (exp::exps) := ((do gs ← tactic.get_goals, g ← tactic.mk_meta_var exp, tactic.set_goals (g::gs), solver) <|> (trace (("Failed ex " : format) ++ format.of_nat idx) >> skip)) >> batch_test (idx+1) exps meta def examples_easy : list expr := [ex01,ex02,ex03,ex04,ex05,ex06,ex07,ex08,ex09,ex10, ex11,ex12,ex13,ex14,ex15,ex16,ex17,ex18,ex19,ex20, ex21,ex22,ex23,ex24,ex25,ex26,ex27,ex28,ex29,ex30, ex31,ex32,ex33,ex34] meta def examples_hard : list expr := [ex35,ex36,ex37,ex38,ex39,ex40,ex41] meta def nontheorems : list expr := [ex42,ex43,ex44,ex45,ex46,ex47,ex48,ex49,ex50] set_option profiler true lemma test : true := by do batch_test lia_vm 0 nontheorems -- lemma test_lia_vm : true := -- by do batch_test lia_vm 0 examples_easy
The norm of a complex number is always greater than or equal to the difference of the norms of its real and imaginary parts.
function kernel = calibSPIRiT(kCalib, kSize, nCoils, CalibTyk) % kernel = calibSPIRiT(kCalib, kSize, nCoils, CalibTyk) % % Function calibrates a SPIRiT kernel from a calibration area in k-space % % % (c) Michael Lustig 2013 % [AtA] = dat2AtA(kCalib,kSize); for n=1:nCoils kernel(:,:,:,n) = calibrate(AtA,kSize,nCoils,n,CalibTyk); end
function [C, sigma] = dataset3Params(X, y, Xval, yval) %DATASET3PARAMS returns your choice of C and sigma for Part 3 of the exercise %where you select the optimal (C, sigma) learning parameters to use for SVM %with RBF kernel % [C, sigma] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and % sigma. You should complete this function to return the optimal C and % sigma based on a cross-validation set. % % You need to return the following variables correctly. C = 1; sigma = 0.3; % ====================== YOUR CODE HERE ====================== % Instructions: Fill in this function to return the optimal C and sigma % learning parameters found using the cross validation set. % You can use svmPredict to predict the labels on the cross % validation set. For example, % predictions = svmPredict(model, Xval); % will return the predictions on the cross validation set. % % Note: You can compute the prediction error using % mean(double(predictions ~= yval)) % C_s = [0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30]; sigma_s = C_s ; l = length(C_s); scores = zeros(l); for i = 1:l for j = 1:l C = C_s(i); sigma = sigma_s(j); model= svmTrain(X, y, C, @(x1, x2) gaussianKernel(x1, x2, sigma)); predictions = svmPredict(model, Xval); scores(i, j) = mean(double(predictions ~= yval)); end end s = scores; [~, j] = min(min(s)); [~, temp] = min(s); i = temp(j); C = C_s(i); sigma = sigma_s(j); % ========================================================================= end
theory ex_sort imports Main begin value "[1::nat, 3,2]" (* fun my_sort::"nat list \<Rightarrow> nat list" where "my_sort [] = []"| "my_sort [x] = [x]"| "my_sort [x1,x2] = (if (x1 < x2) then ([x1,x2]) else ([x2,x1]))"| "my_sort (x1#x2#xs) = (if (x1 < x2) then (x1#(my_sort (x2#xs))) else (my_sort (x2#x1#xs)))" *) fun myInsert::"nat \<Rightarrow> nat list \<Rightarrow> nat list" where "myInsert x [] = [x]"| "myInsert x (y#ys) = (if (x\<le>y) then (x#y#ys) else (y#(myInsert x ys)))" fun mySort::"nat list \<Rightarrow> nat list" where "mySort [] = []"| "mySort (x#xs) = myInsert x (mySort xs)" value "mySort [3,2,1]" lemma ms: "\<forall>i j. i<j \<longrightarrow> j<length xs \<longrightarrow> \<not>(mySort xs) ! 1 > (mySort xs) ! 1" proof (induction xs) case Nil then show ?case by simp next case (Cons a xs) then show ?case by blast qed lemma subls: "Suc (length xs) = length (myInsert a xs)" proof (induction xs) case Nil then show ?case by simp next case (Cons a xs) then show ?case by simp qed lemma ls: "length xs = length (mySort xs)" proof (induction xs) case Nil then show ?case by simp next case (Cons a xs) then show ?case by (simp add:subls) qed (*export_code mySort in OCaml*) end
Formal statement is: lemma le_measure_iff: "M \<le> N \<longleftrightarrow> (if space M = space N then if sets M = sets N then emeasure M \<le> emeasure N else sets M \<subseteq> sets N else space M \<subseteq> space N)" Informal statement is: The measure $M$ is less than or equal to the measure $N$ if and only if either the spaces of $M$ and $N$ are equal and the sets of $M$ and $N$ are equal and the emeasure of $M$ is less than or equal to the emeasure of $N$, or the space of $M$ is a subset of the space of $N$.
lemma valid_path_compose_holomorphic: assumes "valid_path g" and holo:"f holomorphic_on S" and "open S" "path_image g \<subseteq> S" shows "valid_path (f \<circ> g)"
/** * @copyright Copyright (c) 2017 B-com http://www.b-com.com/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define USE_FREE //#define USE_IMAGES_SET #include <iostream> #include <string> #include <vector> #include <boost/log/core.hpp> // ADD MODULES TRAITS HEADERS HERE #include "SolARModuleOpencv_traits.h" #include "SolARModuleOpengl_traits.h" #include "SolARModuleTools_traits.h" #include "SolARModuleFBOW_traits.h" #ifndef USE_FREE #include "SolARModuleNonFreeOpencv_traits.h" #endif // ADD XPCF HEADERS HERE #include "xpcf/xpcf.h" #include "core/Log.h" // ADD COMPONENTS HEADERS HERE #include "api/input/devices/ICamera.h" #include "api/features/IKeypointDetector.h" #include "api/features/IDescriptorsExtractor.h" #include "api/features/IDescriptorMatcher.h" #include "api/solver/pose/I3DTransformFinderFrom2D2D.h" #include "api/solver/map/ITriangulator.h" #include "api/solver/map/IMapper.h" #include "api/solver/map/IKeyframeSelector.h" #include "api/solver/map/IMapFilter.h" #include "api/solver/pose/I2D3DCorrespondencesFinder.h" #include "api/solver/pose/I3DTransformSACFinderFrom2D3D.h" #include "api/features/IMatchesFilter.h" #include "api/display/I2DOverlay.h" #include "api/display/IMatchesOverlay.h" #include "api/display/I3DOverlay.h" #include "api/display/IImageViewer.h" #include "api/display/I3DPointsViewer.h" #include "api/reloc/IKeyframeRetriever.h" #include "core/Log.h" using namespace SolAR; using namespace SolAR::datastructure; using namespace SolAR::api; using namespace SolAR::MODULES::OPENCV; using namespace SolAR::MODULES::FBOW; #ifndef USE_FREE using namespace SolAR::MODULES::NONFREEOPENCV; #endif using namespace SolAR::MODULES::OPENGL; using namespace SolAR::MODULES::TOOLS; namespace xpcf = org::bcom::xpcf; int main(int argc, char **argv) { #if NDEBUG boost::log::core::get()->set_logging_enabled(false); #endif LOG_ADD_LOG_TO_CONSOLE(); try{ /* instantiate component manager*/ /* this is needed in dynamic mode */ SRef<xpcf::IComponentManager> xpcfComponentManager = xpcf::getComponentManagerInstance(); std::string configxml = std::string("conf_SLAM.xml"); if (argc == 2) configxml = std::string(argv[1]); if (xpcfComponentManager->load(configxml.c_str()) != org::bcom::xpcf::_SUCCESS) { LOG_ERROR("Failed to load the configuration file {}", configxml.c_str()) return -1; } // declare and create components LOG_INFO("Start creating components"); // component creation #ifdef USE_IMAGES_SET auto camera = xpcfComponentManager->create<SolARImagesAsCameraOpencv>()->bindTo<input::devices::ICamera>(); #else auto camera = xpcfComponentManager->create<SolARCameraOpencv>()->bindTo<input::devices::ICamera>(); #endif #ifdef USE_FREE auto keypointsDetector = xpcfComponentManager->create<SolARKeypointDetectorOpencv>()->bindTo<features::IKeypointDetector>(); auto descriptorExtractor = xpcfComponentManager->create<SolARDescriptorsExtractorAKAZE2Opencv>()->bindTo<features::IDescriptorsExtractor>(); #else auto keypointsDetector = xpcfComponentManager->create<SolARKeypointDetectorNonFreeOpencv>()->bindTo<features::IKeypointDetector>(); auto descriptorExtractor = xpcfComponentManager->create<SolARDescriptorsExtractorSURF64Opencv>()->bindTo<features::IDescriptorsExtractor>(); #endif // auto descriptorExtractorORB =xpcfComponentManager->create<SolARDescriptorsExtractorORBOpencv>()->bindTo<features::IDescriptorsExtractor>(); SRef<features::IDescriptorMatcher> matcher = xpcfComponentManager->create<SolARDescriptorMatcherKNNOpencv>()->bindTo<features::IDescriptorMatcher>(); SRef<solver::pose::I3DTransformFinderFrom2D2D> poseFinderFrom2D2D = xpcfComponentManager->create<SolARPoseFinderFrom2D2DOpencv>()->bindTo<solver::pose::I3DTransformFinderFrom2D2D>(); SRef<solver::map::ITriangulator> triangulator = xpcfComponentManager->create<SolARSVDTriangulationOpencv>()->bindTo<solver::map::ITriangulator>(); SRef<features::IMatchesFilter> matchesFilter = xpcfComponentManager->create<SolARGeometricMatchesFilterOpencv>()->bindTo<features::IMatchesFilter>(); SRef<solver::pose::I3DTransformSACFinderFrom2D3D> PnP = xpcfComponentManager->create<SolARPoseEstimationSACPnpOpencv>()->bindTo<solver::pose::I3DTransformSACFinderFrom2D3D>(); SRef<solver::pose::I2D3DCorrespondencesFinder> corr2D3DFinder = xpcfComponentManager->create<SolAR2D3DCorrespondencesFinderOpencv>()->bindTo<solver::pose::I2D3DCorrespondencesFinder>(); SRef<solver::map::IMapFilter> mapFilter = xpcfComponentManager->create<SolARMapFilter>()->bindTo<solver::map::IMapFilter>(); SRef<solver::map::IMapper> mapper = xpcfComponentManager->create<SolARMapper>()->bindTo<solver::map::IMapper>(); SRef<solver::map::IKeyframeSelector> keyframeSelector = xpcfComponentManager->create<SolARKeyframeSelector>()->bindTo<solver::map::IKeyframeSelector>(); SRef<display::IMatchesOverlay> matchesOverlay = xpcfComponentManager->create<SolARMatchesOverlayOpencv>()->bindTo<display::IMatchesOverlay>(); SRef<display::IMatchesOverlay> matchesOverlayBlue = xpcfComponentManager->create<SolARMatchesOverlayOpencv>("matchesBlue")->bindTo<display::IMatchesOverlay>(); SRef<display::IMatchesOverlay> matchesOverlayRed = xpcfComponentManager->create<SolARMatchesOverlayOpencv>("matchesRed")->bindTo<display::IMatchesOverlay>(); SRef<display::IImageViewer> imageViewer = xpcfComponentManager->create<SolARImageViewerOpencv>()->bindTo<display::IImageViewer>(); SRef<display::I3DPointsViewer> viewer3DPoints = xpcfComponentManager->create<SolAR3DPointsViewerOpengl>()->bindTo<display::I3DPointsViewer>(); // KeyframeRetriever component to relocalize SRef<reloc::IKeyframeRetriever> kfRetriever = xpcfComponentManager->create<SolARKeyframeRetrieverFBOW>()->bindTo<reloc::IKeyframeRetriever>(); // declarations SRef<Image> view1, view2, view; SRef<Keyframe> keyframe1; SRef<Keyframe> keyframe2; std::vector<SRef<Keypoint>> keypointsView1, keypointsView2, keypoints; SRef<DescriptorBuffer> descriptorsView1, descriptorsView2, descriptors; std::vector<DescriptorMatch> matches; Transform3Df poseFrame1 = Transform3Df::Identity(); Transform3Df poseFrame2; Transform3Df newFramePose; Transform3Df lastPose; std::vector<SRef<CloudPoint>> cloud, filteredCloud; std::vector<Transform3Df> keyframePoses; std::vector<Transform3Df> framePoses; SRef<Frame> newFrame; SRef<Frame> frameToTrack; SRef<Keyframe> referenceKeyframe; SRef<Keyframe> newKeyframe; SRef<Image> imageMatches, imageMatches2; SRef<Map> map; bool isLostTrack = false; // initialize pose estimation with the camera intrinsic parameters (please refeer to the use of intrinsec parameters file) PnP->setCameraParameters(camera->getIntrinsicsParameters(), camera->getDistorsionParameters()); poseFinderFrom2D2D->setCameraParameters(camera->getIntrinsicsParameters(), camera->getDistorsionParameters()); triangulator->setCameraParameters(camera->getIntrinsicsParameters(), camera->getDistorsionParameters()); LOG_DEBUG("Intrincic parameters : \n {}", camera->getIntrinsicsParameters()); if (camera->start() != FrameworkReturnCode::_SUCCESS) { LOG_ERROR("Camera cannot start"); return -1; } // Here, Capture the two first keyframe view1, view2 bool imageCaptured = false; while (!imageCaptured) { if (camera->getNextImage(view1) == SolAR::FrameworkReturnCode::_ERROR_) break; #ifdef USE_IMAGES_SET imageViewer->display(view1); #else if (imageViewer->display(view1) == SolAR::FrameworkReturnCode::_STOP) #endif { keypointsDetector->detect(view1, keypointsView1); descriptorExtractor->extract(view1, keypointsView1, descriptorsView1); keyframe1 = xpcf::utils::make_shared<Keyframe>(keypointsView1, descriptorsView1, view1, poseFrame1); mapper->update(map, keyframe1); keyframePoses.push_back(poseFrame1); // used for display kfRetriever->addKeyframe(keyframe1); // add keyframe for reloc imageCaptured = true; } } bool bootstrapOk = false; while (!bootstrapOk) { if (camera->getNextImage(view2) == SolAR::FrameworkReturnCode::_ERROR_) break; keypointsDetector->detect(view2, keypointsView2); descriptorExtractor->extract(view2, keypointsView2, descriptorsView2); SRef<Frame> frame2 = xpcf::utils::make_shared<Frame>(keypointsView2, descriptorsView2, view2, keyframe1); matcher->match(descriptorsView1, descriptorsView2, matches); int nbOriginalMatches = matches.size(); matchesFilter->filter(matches, matches, keypointsView1, keypointsView2); matchesOverlay->draw(view2, imageMatches, keypointsView1, keypointsView2, matches); if (imageViewer->display(imageMatches) == SolAR::FrameworkReturnCode::_STOP) return 1; if (keyframeSelector->select(frame2, matches)) { // Estimate the pose of of the second frame (the first frame being the reference of our coordinate system) poseFinderFrom2D2D->estimate(keypointsView1, keypointsView2, poseFrame1, poseFrame2, matches); LOG_INFO("Nb matches for triangulation: {}\\{}", matches.size(), nbOriginalMatches); LOG_INFO("Estimate pose of the camera for the frame 2: \n {}", poseFrame2.matrix()); frame2->setPose(poseFrame2); // Triangulate keyframe2 = xpcf::utils::make_shared<Keyframe>(frame2); triangulator->triangulate(keyframe2, matches, cloud); //double reproj_error = triangulator->triangulate(keypointsView1, keypointsView2, matches, std::make_pair(0, 1), poseFrame1, poseFrame2, cloud); mapFilter->filter(poseFrame1, poseFrame2, cloud, filteredCloud); keyframePoses.push_back(poseFrame2); // used for display mapper->update(map, keyframe2, filteredCloud, matches); kfRetriever->addKeyframe(keyframe2); // add keyframe for reloc bootstrapOk = true; } } referenceKeyframe = keyframe2; lastPose = poseFrame2; // copy referenceKeyframe to frameToTrack frameToTrack = xpcf::utils::make_shared<Frame>(referenceKeyframe); frameToTrack->setReferenceKeyframe(referenceKeyframe); // Start tracking clock_t start, end; int count = 0; start = clock(); while (true) { // Get current image camera->getNextImage(view); count++; keypointsDetector->detect(view, keypoints); descriptorExtractor->extract(view, keypoints, descriptors); newFrame = xpcf::utils::make_shared<Frame>(keypoints, descriptors, view, referenceKeyframe); // match current keypoints with the keypoints of the Keyframe SRef<DescriptorBuffer> frameToTrackDescriptors = frameToTrack->getDescriptors(); matcher->match(frameToTrackDescriptors, descriptors, matches); matchesFilter->filter(matches, matches, frameToTrack->getKeypoints(), keypoints); std::vector<SRef<Point2Df>> pt2d; std::vector<SRef<Point3Df>> pt3d; std::vector<SRef<CloudPoint>> foundPoints; std::vector<DescriptorMatch> foundMatches; std::vector<DescriptorMatch> remainingMatches; corr2D3DFinder->find(frameToTrack, newFrame, matches, foundPoints, pt3d, pt2d, foundMatches, remainingMatches); //LOG_INFO("found matches {}, Remaining Matches {}", foundMatches.size(), remainingMatches.size()); // display matches if (isLostTrack) { if (imageViewer->display(view) == FrameworkReturnCode::_STOP) break; } else { matchesOverlayBlue->draw(view, imageMatches, referenceKeyframe->getKeypoints(), keypoints, foundMatches); matchesOverlayRed->draw(imageMatches, imageMatches2, referenceKeyframe->getKeypoints(), keypoints, remainingMatches); if (imageViewer->display(imageMatches2) == FrameworkReturnCode::_STOP) break; } std::vector<SRef<Point2Df>> imagePoints_inliers; std::vector<SRef<Point3Df>> worldPoints_inliers; if (PnP->estimate(pt2d, pt3d, imagePoints_inliers, worldPoints_inliers, newFramePose, lastPose) == FrameworkReturnCode::_SUCCESS) { LOG_INFO(" pnp inliers size: {} / {}", worldPoints_inliers.size(), pt3d.size()); lastPose = newFramePose; // Set the pose of the new frame newFrame->setPose(newFramePose); // update frame to track frameToTrack = newFrame; // If the camera has moved enough, create a keyframe and map the scene if (keyframeSelector->select(newFrame, foundMatches)) //if ((nbFrameTracking == 0) && (foundMatches.size() < 0.7 * referenceKeyframe->getVisibleMapPoints().size())) { // create a new keyframe from the current frame newKeyframe = xpcf::utils::make_shared<Keyframe>(newFrame); // triangulate with the reference keyframe std::vector<SRef<CloudPoint>>newCloud, filteredCloud; triangulator->triangulate(newKeyframe, remainingMatches, newCloud); //triangulator->triangulate(referenceKeyframe->getKeypoints(), keypoints, remainingMatches, std::make_pair<int, int>((int)referenceKeyframe->m_idx + 0, (int)(mapper->getNbKeyframes())), // referenceKeyframe->getPose(), newFramePose, newCloud); // remove abnormal 3D points from the new cloud mapFilter->filter(referenceKeyframe->getPose(), newFramePose, newCloud, filteredCloud); LOG_DEBUG("Number of matches: {}, number of 3D points:{}", remainingMatches.size(), filteredCloud.size()); // Add new keyframe with the cloud to the mapper mapper->update(map, newKeyframe, filteredCloud, remainingMatches, foundMatches); keyframePoses.push_back(newKeyframe->getPose()); referenceKeyframe = newKeyframe; frameToTrack = xpcf::utils::make_shared<Frame>(referenceKeyframe); frameToTrack->setReferenceKeyframe(referenceKeyframe); kfRetriever->addKeyframe(referenceKeyframe); // add keyframe for reloc //LOG_INFO("************************ NEW KEYFRAME *************************"); LOG_DEBUG(" cloud current size: {} \n", map->getPointCloud()->size()); } else { framePoses.push_back(newFramePose); // used for display } isLostTrack = false; // tracking is good } else { LOG_INFO("Pose estimation has failed"); isLostTrack = true; // lost tracking // reloc std::vector < SRef <Keyframe>> ret_keyframes; if (kfRetriever->retrieve(newFrame, ret_keyframes) == FrameworkReturnCode::_SUCCESS) { referenceKeyframe = ret_keyframes[0]; frameToTrack = xpcf::utils::make_shared<Frame>(referenceKeyframe); frameToTrack->setReferenceKeyframe(referenceKeyframe); lastPose = referenceKeyframe->getPose(); LOG_INFO("Retrieval Success"); } else LOG_INFO("Retrieval Failed"); } // display point cloud if (viewer3DPoints->display(*(map->getPointCloud()), lastPose, keyframePoses, framePoses) == FrameworkReturnCode::_STOP) break; } // display stats on frame rate end = clock(); double duration = double(end - start) / CLOCKS_PER_SEC; printf("\n\nElasped time is %.2lf seconds.\n", duration); printf("Number of processed frame per second : %8.2f\n", count / duration); } catch (xpcf::Exception &e) { LOG_DEBUG("{}", e.what()); return -1; } return 0; }
export Simulation, simulate """ Simulation Describe a PDSampling: information about the initial point, the time of the simulation, the function to sample from an IPP, etc. """ struct Simulation x0::Vector{Real} # Starting point v0::Vector{Real} # Starting velocity T::Real # Simulation time nextevent::Function # Appropriate simulation for first arrival time gll::Function # Gradient of Log Lik (potentially CV) nextboundary::Function # Where/When is the next boundary hit lambdaref::Real # Refreshment rate algname::String # BPS, ZZ, GBPS # derived dim::Int # dimensionality # optional named arguments mass::Matrix{Real} # mass matrix (preconditioner) blocksize::Int # increment the storage by blocks maxsimtime::Real # max. simulation time (s) maxsegments::Int # max. num. of segments maxgradeval::Int # max. num. grad. evals refresh!::Function # refreshment function (TODO: examples) # constructor function Simulation(x0, v0, T, nextevent, gradloglik, nextboundary, lambdaref=1.0, algname="BPS"; mass=diagm(0=>ones(0)), blocksize=1000, maxsimtime=4e3, maxsegments=1_000_000, maxgradeval=100_000_000, refresh! = refresh_global! ) # check none of the default named arguments went through @assert !(x0 == :undefined || v0 == :undefined || T == :undefined || nextevent == :undefined || gradloglik == :undefined || nextboundary == :undefined) "Essential arguments undefined" # basic check to see that things are reasonable @assert length(x0) == length(v0) > 0 "Inconsistent arguments" @assert T > 0.0 "Simulation time must be positive" @assert lambdaref >= 0.0 "Refreshment rate must be >= 0" ALGNAME = uppercase(algname) @assert (ALGNAME ∈ ["BPS", "ZZ","GBPS"]) "Unknown algorithm <$algname>" new( x0, v0, T, nextevent, gradloglik, nextboundary, lambdaref, ALGNAME, length(x0), mass, blocksize, maxsimtime, maxsegments, maxgradeval, refresh! ) end end # Constructor with named arguments function Simulation(; x0 = :undefined, v0 = :undefined, T = :undefined, nextevent = :undefined, gradloglik = :undefined, nextboundary = :undefined, lambdaref = 1.0, algname = "BPS", mass = diagm(0=>ones(0)), blocksize = 1000, maxsimtime = 4e3, maxsegments = Int(1e6), maxgradeval = Int(1e8), refresh! = refresh_global! ) # calling the unnamed constructor Simulation( x0, v0, T, nextevent, gradloglik, nextboundary, lambdaref, algname; mass = mass, blocksize = blocksize, maxsimtime = maxsimtime, maxsegments = maxsegments, maxgradeval = maxgradeval, refresh! = refresh! ) end """ simulate(sim) Launch a PD simulation defined in the sim variable. Return the corresponding Path and a dictionary of indicators (clocktime, ...). """ function simulate(sim::Simulation) # keep track of how much time we've been going for start = time() # dimensionality d = sim.dim # initial states x, v = copy(sim.x0), copy(sim.v0) # time counter, and segment counter t, i = 0.0, 1 # counters for the number of effective loops and # for the number of evaluations of the gradient # this will be higher than the number of segments i lcnt, gradeval = 0, 0 # storing by blocks of blocksize nodes at the time blocksize = sim.blocksize # storing xs as a single column for efficient resizing xs, ts = zeros(d*blocksize), zeros(blocksize) # store initial point xs[1:d] = x # mass matrix? mass = copy(sim.mass) # store it here as we may want to adapt it # check if nextevent takes 2 or 3 parameters nevtakes2 = (length(methods(sim.nextevent).ms[1].sig.parameters)-1) == 2 # compute current reference bounce time lambdaref = sim.lambdaref tauref = (lambdaref>0.0) ? randexp() / lambdaref : Inf # Compute time to next boundary + normal (taubd, normalbd) = sim.nextboundary(x, v) # keep track of how many refresh events nrefresh = 0 # keep track of how many boundary hits nboundary = 0 # keep track of how many standard bounces nbounce = 0 while (t < sim.T) && (gradeval < sim.maxgradeval) # increment the counter to keep track of the number of effective loops lcnt += 1 # simulate first arrival from IPP bounce = nevtakes2 ? sim.nextevent(x, v) : sim.nextevent(x, v, tauref) # find next event (unconstrained case taubd=NaN (ignored)) tau = min(bounce.tau, taubd, tauref) # standard bounce if tau == bounce.tau # there will be an evaluation of the gradient gradeval += 1 # updating position/time t += tau x += tau*v # exploiting the memoryless property tauref -= tau # ---- BOUNCE ---- g = sim.gll(x) if bounce.dobounce(g, v) # e.g.: thinning, acc/rej # if accept nbounce += 1 if sim.algname == "BPS" # if a mass matrix is provided if length(mass) > 0 v = reflect_bps!(g, v, mass) # standard BPS bounce else v = reflect_bps!(g,v) end elseif sim.algname == "GBPS" v = reflect_gbps(g, v) elseif sim.algname == "ZZ" v = reflect_zz!(bounce.flipindex, v) end else # move closer to the boundary/refreshment time taubd -= tau # we don't need to record when rejecting continue end # hard bounce against boundary elseif tau == taubd # nboundary += 1 # Record point epsilon from boundary for numerical stability x += (tau - 1e-10) * v t += tau # exploiting the memoryless property tauref -= tau # ---- BOUNCE (boundary) ---- if sim.algname ∈ ["BPS", "GBPS"] # Specular reflection (possibly with mass matrix) if length(mass) > 0 v = reflect_bps!(normalbd, v, mass) else v = reflect_bps!(normalbd,v) end elseif sim.algname == "ZZ" v = reflect_zz!(find((v.*normalbd).<0.0), v) end # random refreshment else #= to be in this part, lambdaref should be greater than 0.0 because if lambdaref=0 then tauref=Inf. There may be a weird corner case in which an infinity filters through which we would skip =# if !isinf(tau) # nrefresh += 1 # x += tau*v t += tau # ---- REFRESH ---- v = sim.refresh!(v) # update tauref tauref = randexp()/lambdaref end end # check when the next boundary hit will occur (taubd, normalbd) = sim.nextboundary(x, v) # increment the counter for the number of segments i += 1 # Increase storage on a per-need basis. if mod(i,blocksize)==0 resize!(xs, length(xs) + d * blocksize) resize!(ts, length(ts) + blocksize) end # Storing path times ts[i] = t # storing columns vertically, a vector is simpler/cheaper to resize xs[((i-1) * d + 1):(i * d)] = x # Safety checks to break long loops every 100 iterations if mod(lcnt, 100) == 0 if (time() - start) > sim.maxsimtime println("Max simulation time reached. Stopping") break end if i > sim.maxsegments println("Too many segments generated. Stopping") break end end end # End of while loop details = Dict( "clocktime" => time()-start, "ngradeval" => gradeval, "nloops" => lcnt, "nsegments" => i, "nbounce" => nbounce, "nboundary" => nboundary, "nrefresh" => nrefresh ) (Path(reshape(xs[1:(i*d)], (d,i)), ts[1:i]), details) end
\section{Program structure} \label{sect:programstructure} The basic component of the generator and how they interact are described in this section.
# Load the output from a previously build include("build_output.jl") include("builder_defs.jl") include("builder_tools.jl") build_jlls(ARGS, name, output, dependencies)
module Text.CSS.Flexbox import Text.CSS.Render %default total public export data FlexDirection = Row | RowReverse | Column | ColumnReverse export Render FlexDirection where render Row = "row" render RowReverse = "row-reverse" render Column = "column" render ColumnReverse = "column-reverse" public export data FlexAlign = Normal | Stretch | Center | Start | End | FlexStart | FlexEnd | Baseline | FirstBaseline | LastBaseline export Render FlexAlign where render Normal = "normal" render Stretch = "stretch" render Center = "center" render Start = "start" render End = "end" render FlexStart = "flex-start" render FlexEnd = "flex-end" render Baseline = "baseline" render FirstBaseline = "first baseline" render LastBaseline = "last baseline" namespace FlexJustify public export data FlexJustify = Center | Start | End | FlexStart | FlexEnd | Left | Right | Normal | SpaceBetween | SpaceAround | SpaceEvenly | Stretch export Render FlexJustify where render Center = "center" render Start = "start" render End = "end" render FlexStart = "flex-start" render FlexEnd = "flex-end" render Left = "left" render Right = "right" render Normal = "normal" render SpaceBetween = "space-between" render SpaceAround = "space-around" render SpaceEvenly = "space-evenly" render Stretch = "stretch"
# wahpenayo at gmail dot com # 2018-04-16 #----------------------------------------------------------------- if (file.exists('e:/porta/projects/taiga')) { setwd('e:/porta/projects/taiga') } else { setwd('c:/porta/projects/taiga') } #source('src/scripts/r/functions.r') #----------------------------------------------------------------- library(quantreg) #example(rq) #----------------------------------------------------------------- fit.summary <- function(y,yhat,p=0.75) { n <- length(yhat) r <- y -yhat rmean <- mean(r) rmse <- sqrt(sum(r*r/n)) rmad <- sum(abs(r))/n rqr <- 2.0*sum(ifelse(r>=0,p*r,(p-1)*r))/n qrq <- 0.5*sum(ifelse(r>=0,r/(1-p),-r/p))/n list(rmean=rmean,rmse=rmse,rmad=rmad,rqr=rqr,qrq=qrq) } #----------------------------------------------------------------- data(engel) y <- engel$foodexp x <- data.frame(income=engel$income) affine.l2 <- lm(foodexp~income,data=engel) yhat <- predict(affine.l2,newdata=x) print("l2 affine") print(affine.l2,digits=16) print(fit.summary(y,yhat),digits=16) affine.q50 <- rq(foodexp~income,data=engel,tau=0.5) yhat <- predict(affine.q50,newdata=x) print("q50 affine") print(affine.q50,digits=16) print(fit.summary(y=y,yhat=yhat),digits=16) affine.q75 <- rq(foodexp~income,data=engel,tau=0.75) yhat <- predict(affine.q75,newdata=x) print("q75 affine") print(affine.q75,digits=16) print(fit.summary(y=y,yhat=yhat),digits=16) linear.l2 <- lm(foodexp~income - 1,data=engel) yhat <- predict(linear.l2,newdata=x) print("l2 linear") print(linear.l2,digits=16) print(fit.summary(y,yhat),digits=16) linear.q50 <- rq(foodexp~income - 1,data=engel,tau=0.5) yhat <- predict(linear.q50,newdata=x) print("q50 linear") print(linear.q50,digits=16) print(fit.summary(y,yhat),digits=16) linear.q75 <- rq(foodexp~income - 1,data=engel,tau=0.75) yhat <- predict(linear.q75,newdata=x) print("q75 linear") print(linear.q75,digits=16) print(fit.summary(y,yhat),digits=16) yhat <- rep_len(median(y),length(y)) print("q50 constant") print(yhat[1],digits=16) print(fit.summary(y,yhat),digits=16) yhat <- rep_len(quantile(x=y,probs=0.75),length(y)) print("q75 constant") print(yhat[1],digits=16) print(fit.summary(y,yhat),digits=16) yhat <- rep_len(mean(y),length(y)) print("l2 constant") print(yhat[1],digits=16) print(fit.summary(y,yhat),digits=16) #----------------------------------------------------------------- data(stackloss) yx <- data.frame( stackloss=stackloss$stack.loss, acidconc=stackloss$Acid.Conc., airflow=stackloss$Air.Flow, watertemp=stackloss$Water.Temp) y <- yx$stackloss x <- data.frame( acidconc=yx$acidconc, airflow=yx$airflow, watertemp=yx$watertemp) affine.l2 <- lm(stackloss~acidconc+airflow+watertemp,data=yx) yhat <- predict(affine.l2,newdata=x) print("l2 affine") print(affine.l2,digits=16) print(fit.summary(y,yhat),digits=16) affine.q50 <- rq(stackloss~acidconc+airflow+watertemp,data=yx,tau=0.5) yhat <- predict(affine.q50,newdata=x) print("q50 affine") print(affine.q50,digits=16) print(fit.summary(y=y,yhat=yhat),digits=16) affine.q75 <- rq(stackloss~acidconc+airflow+watertemp,data=yx,tau=0.75) yhat <- predict(affine.q75,newdata=x) print("q75 affine") print(affine.q75,digits=16) print(fit.summary(y=y,yhat=yhat),digits=16) linear.l2 <- lm(stackloss~acidconc+airflow+watertemp - 1,data=yx) yhat <- predict(linear.l2,newdata=x) print("l2 linear") print(linear.l2,digits=16) print(fit.summary(y,yhat),digits=16) linear.q50 <- rq(stackloss~acidconc+airflow+watertemp - 1,data=yx,tau=0.5) yhat <- predict(linear.q50,newdata=x) print("q50 linear") print(linear.q50,digits=16) print(fit.summary(y,yhat),digits=16) linear.q75 <- rq(stackloss~acidconc+airflow+watertemp - 1,data=yx,tau=0.75) yhat <- predict(linear.q75,newdata=x) print("q75 linear") print(linear.q75,digits=16) print(fit.summary(y,yhat),digits=16) yhat <- rep_len(mean(y),length(y)) print("l2 constant") print(yhat[1],digits=16) print(fit.summary(y,yhat),digits=16) yhat <- rep_len(median(y),length(y)) print("q50 constant") print(yhat[1],digits=16) print(fit.summary(y,yhat),digits=16) yhat <- rep_len(quantile(x=y,probs=0.75),length(y)) print("q75 constant") print(yhat[1],digits=16) print(fit.summary(y,yhat),digits=16) #-----------------------------------------------------------------
Movability for associations is zero longer a solution; it’s a require, especially when a business wants towards stay on top within just the fast paced pace associated with today’s internet business environment. Associated with motion is some software edge for an enterprise. Certainly, whenever thinking associated with motion wireless solutions becomes difficult to forget. Wireless equipment are important for people who do buiness. These service coming through internet enterprise products in which a mobile computer and Rim can represent the general business system. Nevertheless down with the important things about activity as well as handheld technological know-how, so can come fees, issues, and also risks. A exceptional cloud-based Software petty cashbook fashioned to develop how mobile phone teams add safely, exactly, and during low priced will be what any company necessities. With the main raising concerns involving immediately widening wi-fi make use of, any solution that adheres to that also delivers the much better deal with and also field of vision more than wireless usage making sure that companies will be able to release smarter wifi managing programs this lessen costs plus risks on the business even while making cell teams considerably more productive. The very mobile feel can always be enhanced beyond the sales connected with costs. A sophisticated, cloud-based petty cashbook could unify the particular various reasons for contact information and facts in order that portable coaches and teams will be absolved for managing, replacing, and browsing through progressively more large in addition to buoyant speak to details. Hence the reward towards the cell member of staff is usually twofold, pain relief throughout monthly construction along with liberty of choice on wireless strategies while at the same time gaining typically the productivity increases of a strong advanced, cloud-based notebook which will speeds links in order to together with groups on the proceed. Have a part to better endure your current entity movability attempts in addition to study the Bright white Paper indexed by the reference box and you will find away just what answers together with functions can offer anyone these essential prices capable of present you along with a a great deal better wireless direction program, the most flourishing strategic solutions to enterprise ability to move capable connected with delivering you a highly effective competitive bonus that is going to help you actually to keep up with the rapid moving online business environment.
module DepSec.File import public DepSec.DIO import public DepSec.Labeled %access export ||| Secure file data SecFile : {label : Type} -> (l : label) -> Type where ||| TCB MkSecFile : (path : String) -> SecFile l ||| Make a secure file from string ||| TCB ||| @ path path to file makeFile : (path : String) -> SecFile l makeFile = MkSecFile ||| Read a secure file ||| @ flow evidence that l may flow to l' ||| @ file secure file to read readFile : Poset labelType => {l,l' : labelType} -> {auto flow : l `leq` l'} -> (file : SecFile l') -> DIO l (Labeled l' (Either FileError String)) readFile (MkSecFile path) = lift $ map MkLabeled $ readFile path ||| Write to a secure file ||| @ file secure file to write to ||| @ flow evidence that l may flow to l' ||| @ flow' evidence that l' may flow to l'' ||| @ content labeled content to write writeFile : Poset labelType => {l,l',l'' : labelType} -> {auto flow : l `leq` l'} -> (file : SecFile l'') -> {auto flow' : l' `leq` l''} -> (content : Labeled l' String) -> DIO l (Labeled l'' (Either FileError ())) writeFile (MkSecFile path) (MkLabeled content) = lift $ map MkLabeled $ writeFile path content
Add LoadPath "MyAlgebraicStructure" as MyAlgebraicStructure. Add LoadPath "Tools" as Tools. Add LoadPath "BasicProperty" as BasicProperty. Add LoadPath "LibraryExtension" as LibraryExtension. From mathcomp Require Import ssreflect. Require Import Coq.Logic.JMeq. Require Import Coq.Logic.FunctionalExtensionality. Require Import Coq.Logic.ClassicalDescription. Require Import Coq.Sets.Ensembles. Require Import Coq.Sets.Finite_sets. Require Import Coq.Sets.Finite_sets_facts. Require Import Coq.Sets.Image. Require Import Coq.Program.Basics. Require Import MyAlgebraicStructure.MyField. Require Import MyAlgebraicStructure.MyVectorSpace. Require Import BasicProperty.MappingProperty. Require Import BasicProperty.NatProperty. Require Import Tools.MySum. Require Import Tools.BasicTools. Require Import LibraryExtension.DatatypesExtension. Require Import LibraryExtension.EnsemblesExtension. Section Senkeidaisuunosekai1. Definition VSPCM (K : Field) (V : VectorSpace K) : CommutativeMonoid := mkCommutativeMonoid (VT K V) (VO K V) (Vadd K V) (Vadd_comm K V) (Vadd_O_r K V) (Vadd_assoc K V). Definition DirectSumField (K : Field) (T : Type) := {G : T -> FT K | Finite T (fun (t : T) => G t <> FO K)}. Definition BasisVS (K : Field) (V : VectorSpace K) (T : Type) := fun (F : T -> VT K V) => Bijective (DirectSumField K T) (VT K V) (fun (g : DirectSumField K T) => MySumF2 T (exist (Finite T) (fun (t : T) => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V) (fun (t : T) => Vmul K V (proj1_sig g t) (F t))). Lemma BijectiveSaveBasisVS : forall (K : Field) (V : VectorSpace K) (T1 T2 : Type) (F : T1 -> T2) (G : T2 -> VT K V), Bijective T1 T2 F -> BasisVS K V T2 G -> BasisVS K V T1 (compose G F). Proof. move=> K V T1 T2 F G H1 H2. elim H1. move=> f H3. unfold BasisVS. suff: (forall (x : DirectSumField K T1), Finite T2 (fun (t : T2) => proj1_sig x (f t) <> FO K)). move=> H4. suff: ((fun g : DirectSumField K T1 => MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V) (fun t : T1 => Vmul K V (proj1_sig g t) (G (F t)))) = (fun g : DirectSumField K T1 => (fun g : DirectSumField K T2 => MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V) (fun t : T2 => Vmul K V (proj1_sig g t) (G t))) ((fun g : DirectSumField K T1 => exist (fun (G : T2 -> FT K) => Finite T2 (fun t : T2 => G t <> FO K)) (fun (t : T2) => proj1_sig g (f t)) (H4 g)) g))). move=> H5. rewrite H5. apply (BijChain (DirectSumField K T1) (DirectSumField K T2) (VT K V) (fun g : DirectSumField K T1 => exist (fun (G : T2 -> FT K) => Finite T2 (fun t : T2 => G t <> FO K)) (fun (t : T2) => proj1_sig g (f t)) (H4 g)) (fun g : DirectSumField K T2 => MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V) (fun t : T2 => Vmul K V (proj1_sig g t) (G t)))). apply InjSurjBij. move=> x1 x2 H6. apply sig_map. apply functional_extensionality. move=> t. suff: (proj1_sig x1 t = proj1_sig (exist (fun G : T2 -> FT K => Finite T2 (fun t : T2 => G t <> FO K)) (fun t : T2 => proj1_sig x1 (f t)) (H4 x1)) (F t)). move=> H7. rewrite H7. rewrite H6. rewrite - {2} (proj1 H3 t). reflexivity. rewrite - {1} (proj1 H3 t). reflexivity. move=> y. suff: (Finite T1 (fun (t : T1) => (proj1_sig y (F t)) <> FO K)). move=> H6. exists (exist (fun G : T1 -> FT K => Finite T1 (fun t : T1 => G t <> FO K)) (fun (t : T1) => (proj1_sig y (F t))) H6). apply sig_map. simpl. apply functional_extensionality. move=> t. rewrite (proj2 H3 t). reflexivity. suff: ((fun t : T1 => proj1_sig y (F t) <> FO K) = Im T2 T1 (fun t : T2 => proj1_sig y t <> FO K) f). move=> H6. rewrite H6. apply finite_image. apply (proj2_sig y). apply Extensionality_Ensembles. apply conj. move=> t H6. apply (Im_intro T2 T1 (fun t0 : T2 => proj1_sig y t0 <> FO K) f (F t)). apply H6. rewrite (proj1 H3 t). reflexivity. move=> t1. elim. move=> t2 H6 y0 H7. rewrite H7. unfold In. rewrite (proj2 H3 t2). apply H6. apply H2. apply functional_extensionality. move=> x. rewrite - (MySumF2BijectiveSame T1 (exist (Finite T1) (fun t : T1 => proj1_sig x t <> FO K) (proj2_sig x)) T2 (exist (Finite T2) (fun t : T2 => proj1_sig (exist (fun G0 : T2 -> FT K => Finite T2 (fun t0 : T2 => G0 t0 <> FO K)) (fun t0 : T2 => proj1_sig x (f t0)) (H4 x)) t <> FO K) (proj2_sig (exist (fun G0 : T2 -> FT K => Finite T2 (fun t : T2 => G0 t <> FO K)) (fun t : T2 => proj1_sig x (f t)) (H4 x)))) (VSPCM K V) (fun t : T2 => Vmul K V (proj1_sig (exist (fun G0 : T2 -> FT K => Finite T2 (fun t0 : T2 => G0 t0 <> FO K)) (fun t0 : T2 => proj1_sig x (f t0)) (H4 x)) t) (G t)) F). suff: ((fun t : T1 => Vmul K V (proj1_sig x t) (G (F t))) = (fun u : T1 => Vmul K V (proj1_sig (exist (fun G0 : T2 -> FT K => Finite T2 (fun t0 : T2 => G0 t0 <> FO K)) (fun t0 : T2 => proj1_sig x (f t0)) (H4 x)) (F u)) (G (F u)))). move=> H5. rewrite H5. reflexivity. apply functional_extensionality. move=> t. simpl. rewrite (proj1 H3 t). reflexivity. simpl. move=> t. rewrite (proj1 H3 t). apply. simpl. move=> H5. apply InjSurjBij. move=> u1 u2 H6. apply sig_map. apply (BijInj T1 T2 F H1). suff: (F (proj1_sig u1) = proj1_sig (exist (fun t : T2 => proj1_sig x (f t) <> FO K) (F (proj1_sig u1)) (H5 (proj1_sig u1) (proj2_sig u1)))). move=> H7. rewrite H7. rewrite H6. reflexivity. reflexivity. move=> u. exists (exist (fun (t : T1) => proj1_sig x t <> FO K) (f (proj1_sig u)) (proj2_sig u)). apply sig_map. simpl. apply (proj2 H3 (proj1_sig u)). move=> x. suff: ((fun t : T2 => proj1_sig x (f t) <> FO K) = Im T1 T2 (fun t : T1 => proj1_sig x t <> FO K) F). move=> H4. rewrite H4. apply finite_image. apply (proj2_sig x). apply Extensionality_Ensembles. apply conj. move=> t H4. apply (Im_intro T1 T2 (fun t0 : T1 => proj1_sig x t0 <> FO K) F (f t)). apply H4. rewrite (proj2 H3 t). reflexivity. move=> t2. elim. move=> t1 H4 y0 H5. rewrite H5. unfold In. rewrite (proj1 H3 t1). apply H4. Qed. Lemma IsomorphicSaveBasisVS : forall (K : Field) (V1 V2 : VectorSpace K) (T : Type) (F : T -> VT K V1) (G : VT K V1 -> VT K V2), IsomorphicVS K V1 V2 G -> BasisVS K V1 T F -> BasisVS K V2 T (compose G F). Proof. move=> K V1 V2 T F G H1 H2. unfold BasisVS. suff: ((fun g : DirectSumField K T => MySumF2 T (exist (Finite T) (fun t : T => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V2) (fun t : T => Vmul K V2 (proj1_sig g t) (G (F t)))) = (fun g : DirectSumField K T => G (MySumF2 T (exist (Finite T) (fun t : T => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V1) (fun t : T => Vmul K V1 (proj1_sig g t) (F t))))). move=> H3. rewrite H3. apply (BijChain (DirectSumField K T) (VT K V1) (VT K V2) (fun g : DirectSumField K T => MySumF2 T (exist (Finite T) (fun t : T => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V1) (fun t : T => Vmul K V1 (proj1_sig g t) (F t))) G H2 (proj1 H1)). apply functional_extensionality. move=> g. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => proj1_sig g t <> FO K) (proj2_sig g))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite - (Vmul_O_l K V1 (VO K V1)). rewrite (proj2 (proj2 H1)). rewrite (Vmul_O_l K V2 (G (VO K V1))). reflexivity. move=> B b H3 H4 H5 H6. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H6. rewrite (proj1 (proj2 H1) (MySumF2 T B (VSPCM K V1) (fun t : T => Vmul K V1 (proj1_sig g t) (F t))) (Vmul K V1 (proj1_sig g b) (F b))). rewrite (proj2 (proj2 H1) (proj1_sig g b) (F b)). reflexivity. apply H5. apply H5. Qed. Lemma FiniteBasisVS : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), (BasisVS K V (Count N) F) <-> forall (v : VT K V), exists! (a : Count N -> FT K), v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun (n : Count N) => Vmul K V (a n) (F n)). Proof. move=> K V N F. unfold BasisVS. suff: ((fun g : DirectSumField K (Count N) => MySumF2 (Count N) (exist (Finite (Count N)) (fun t : Count N => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig g t) (F t))) = (fun g : DirectSumField K (Count N) => MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig g t) (F t)))). move=> H1. rewrite H1. apply conj. elim. move=> G H2 v. apply (proj1 (unique_existence (fun (a : Count N -> FT K) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n))))). apply conj. exists (proj1_sig (G v)). rewrite (proj2 H2 v). reflexivity. move=> a1 a2 H3 H4. suff: (forall (G : Count N -> FT K), Finite (Count N) (fun t : Count N => G t <> FO K)). move=> H5. suff: (a1 = proj1_sig (exist (fun G : Count N -> FT K => Finite (Count N) (fun t : Count N => G t <> FO K)) a1 (H5 a1))). move=> H6. rewrite H6. suff: (a2 = proj1_sig (exist (fun G : Count N -> FT K => Finite (Count N) (fun t : Count N => G t <> FO K)) a2 (H5 a2))). move=> H7. rewrite H7. rewrite - (proj1 H2 (exist (fun G : Count N -> FT K => Finite (Count N) (fun t : Count N => G t <> FO K)) a2 (H5 a2))). rewrite - (proj1 H2 (exist (fun G : Count N -> FT K => Finite (Count N) (fun t : Count N => G t <> FO K)) a1 (H5 a1))). rewrite - H3. rewrite - H4. reflexivity. reflexivity. reflexivity. move=> G0. apply (Finite_downward_closed (Count N) (Full_set (Count N)) (CountFinite N) (fun t : Count N => G0 t <> FO K)). move=> n H5. apply (Full_intro (Count N) n). move=> H2. suff: (forall (v : VT K V), {a : Count N -> FT K | v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n))}). move=> H3. suff: (forall (G : Count N -> FT K), Finite (Count N) (fun t : Count N => G t <> FO K)). move=> H4. exists (fun (v : VT K V) => exist (fun G : Count N -> FT K => Finite (Count N) (fun t : Count N => G t <> FO K)) (proj1_sig (H3 v)) (H4 (proj1_sig (H3 v)))). apply conj. move=> n. apply sig_map. simpl. suff: (forall (v : VT K V), uniqueness (fun (a : Count N -> FT K) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)))). move=> H5. apply (H5 (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig n t) (F t)))). rewrite - (proj2_sig (H3 (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig n t) (F t))))). reflexivity. reflexivity. move=> v. apply (proj2 (proj2 (unique_existence (fun a : Count N -> FT K => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n0 : Count N => Vmul K V (a n0) (F n0)))) (H2 v))). move=> y. rewrite - (proj2_sig (H3 y)). reflexivity. move=> G. apply (Finite_downward_closed (Count N) (Full_set (Count N)) (CountFinite N) (fun t : Count N => G t <> FO K)). move=> n H4. apply (Full_intro (Count N) n). move=> v. apply (constructive_definite_description (fun (a : Count N -> FT K) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)))). apply (H2 v). apply functional_extensionality. move=> a. rewrite (MySumF2Excluded (Count N) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig a t) (F t)) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun t : Count N => proj1_sig a t <> FO K)). suff: ((MySumF2 (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Complement (Count N) (fun t : Count N => proj1_sig a t <> FO K))) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig a t) (F t))) = VO K V). move=> H1. rewrite H1. simpl. rewrite (Vadd_O_r K V (MySumF2 (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun t : Count N => proj1_sig a t <> FO K)) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig a t) (F t)))). suff: ((exist (Finite (Count N)) (fun t : Count N => proj1_sig a t <> FO K) (proj2_sig a)) = (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun t : Count N => proj1_sig a t <> FO K))). move=> H2. rewrite H2. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t H2. apply (Intersection_intro (Count N) (fun t : Count N => proj1_sig a t <> FO K) (Full_set (Count N))). apply H2. apply (Full_intro (Count N) t). move=> t. elim. move=> t0 H2 H3. apply H2. apply (MySumF2Induction (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Complement (Count N) (fun t : Count N => proj1_sig a t <> FO K)))). apply conj. reflexivity. move=> v n H1 H2. rewrite H2. suff: ((proj1_sig a n) = (FO K)). move=> H3. rewrite H3. rewrite (Vmul_O_l K V (F n)). apply (Vadd_O_r K V (VO K V)). apply NNPP. elim H1. move=> m H3 H4. apply H3. Qed. Definition OVST (F : Field) := (Count 1). Definition OVSadd (F : Field) := fun (f1 f2 : OVST F) => exist (fun (n : nat) => n < S O) O (le_n (S O)). Definition OVSmul (F : Field) := fun (c : FT F) (f : OVST F) => exist (fun (n : nat) => n < S O) O (le_n (S O)). Definition OVSopp (F : Field) := fun (f : OVST F) => exist (fun (n : nat) => n < S O) O (le_n (S O)). Definition OVSO (F : Field) := exist (fun (n : nat) => n < S O) O (le_n (S O)). Lemma OVSadd_comm : forall (F : Field) (f1 f2 : OVST F), (OVSadd F f1 f2) = (OVSadd F f2 f1). Proof. move=> F f1 f2. reflexivity. Qed. Lemma OVSadd_assoc : forall (F : Field) (f1 f2 f3 : OVST F), (OVSadd F (OVSadd F f1 f2) f3) = (OVSadd F f1 (OVSadd F f2 f3)). Proof. move=> F f1 f2 f3. reflexivity. Qed. Lemma OVSadd_O_l : forall (F : Field) (f : OVST F), (OVSadd F (OVSO F) f) = f. Proof. move=> F f. apply sig_map. elim (le_lt_or_eq (proj1_sig f) O). move=> H1. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig f) H1). move=> H1. rewrite H1. reflexivity. apply (le_S_n (proj1_sig f) O (proj2_sig f)). Qed. Lemma OVSadd_opp_r : forall (F : Field) (f : OVST F), (OVSadd F f (OVSopp F f)) = (OVSO F). Proof. move=> F f. reflexivity. Qed. Lemma OVSadd_distr_l : forall (F : Field) (c : FT F) (f1 f2 : OVST F), (OVSmul F c (OVSadd F f1 f2)) = (OVSadd F (OVSmul F c f1) (OVSmul F c f2)). Proof. move=> F c f1 f2. reflexivity. Qed. Lemma OVSadd_distr_r : forall (F : Field) (c1 c2 : FT F) (f : OVST F), (OVSmul F (Fadd F c1 c2) f) = (OVSadd F (OVSmul F c1 f) (OVSmul F c2 f)). Proof. move=> F c1 c2 f. reflexivity. Qed. Lemma OVSmul_assoc : forall (F : Field) (c1 c2 : FT F) (f : OVST F), (OVSmul F c1 (OVSmul F c2 f)) = (OVSmul F (Fmul F c1 c2) f). Proof. move=> F c1 c2 f. reflexivity. Qed. Lemma OVSmul_I_l : forall (F : Field) (f : OVST F), (OVSmul F (FI F) f) = f. Proof. move=> F f. apply sig_map. elim (le_lt_or_eq (proj1_sig f) O). move=> H1. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig f) H1). move=> H1. rewrite H1. reflexivity. apply (le_S_n (proj1_sig f) O (proj2_sig f)). Qed. Definition OVS (F : Field) := mkVectorSpace F (OVST F) (OVSO F) (OVSadd F) (OVSmul F) (OVSopp F) (OVSadd_comm F) (OVSadd_assoc F) (OVSadd_O_l F) (OVSadd_opp_r F) (OVSadd_distr_l F) (OVSadd_distr_r F) (OVSmul_assoc F) (OVSmul_I_l F). Definition StandardBasisVS (F : Field) (N : nat) := fun (n : Count N) (m : Count N) => match excluded_middle_informative (proj1_sig n = proj1_sig m) with | left _ => FI F | right _ => FO F end. Lemma StandardBasisNatureVS : forall (F : Field) (N : nat), BasisVS F (FnVS F N) (Count N) (StandardBasisVS F N). Proof. move=> F N. apply (proj2 (FiniteBasisVS F (FnVS F N) N (StandardBasisVS F N))). move=> v. apply (proj1 (unique_existence (fun (a : Count N -> FT F) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM F (FnVS F N)) (fun n : Count N => Vmul F (FnVS F N) (a n) (StandardBasisVS F N n))))). apply conj. exists (fun (n : Count N) => v n). apply functional_extensionality. move=> m. rewrite (MySumF2Excluded (Count N) (VSPCM F (FnVS F N)) (fun (n : Count N) => Vmul F (FnVS F N) (v n) (StandardBasisVS F N n)) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun (k : Count N) => k = m)). suff: ((MySumF2 (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Complement (Count N) (fun k : Count N => k = m))) (VSPCM F (FnVS F N)) (fun n : Count N => Vmul F (FnVS F N) (v n) (StandardBasisVS F N n))) m = FO F). move=> H1. simpl. unfold Fnadd. rewrite H1. rewrite (Fadd_O_r F (MySumF2 (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun k : Count N => k = m)) (VSPCM F (FnVS F N)) (fun n : Count N => Fnmul F N (v n) (StandardBasisVS F N n)) m)). suff: ((FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun k : Count N => k = m)) = FiniteSingleton (Count N) m). move=> H2. rewrite H2. rewrite MySumF2Singleton. unfold Fnmul. unfold StandardBasisVS. elim (excluded_middle_informative (proj1_sig m = proj1_sig m)). move=> H3. rewrite (Fmul_I_r F (v m)). reflexivity. move=> H3. apply False_ind. apply H3. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> n. elim. move=> n0 H2 H3. rewrite H2. apply (In_singleton (Count N) m). move=> n. elim. apply (Intersection_intro (Count N) (fun k : Count N => k = m) (Full_set (Count N))). reflexivity. apply (Full_intro (Count N) m). apply (FiniteSetInduction (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Complement (Count N) (fun k : Count N => k = m)))). apply conj. rewrite MySumF2Empty. reflexivity. move=> B b H1 H2 H3 H4. rewrite MySumF2Add. simpl. unfold Fnadd. rewrite H4. suff: ((Fnmul F N (v b) (StandardBasisVS F N b) m) = FO F). move=> H5. rewrite H5. apply (Fadd_O_l F (FO F)). unfold StandardBasisVS. unfold Fnmul. elim (excluded_middle_informative (proj1_sig b = proj1_sig m)). elim H2. move=> k H5 H6 H7. apply False_ind. apply H5. apply sig_map. apply H7. move=> H5. apply (Fmul_O_r F (v b)). apply H3. move=> m1 m2 H1 H2. suff: (forall (m : Fn F N), m = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM F (FnVS F N)) (fun n : Count N => Vmul F (FnVS F N) (m n) (StandardBasisVS F N n))). move=> H3. rewrite (H3 m1). rewrite (H3 m2). rewrite - H1. apply H2. move=> m. apply functional_extensionality. move=> n. rewrite (MySumF2Excluded (Count N) (VSPCM F (FnVS F N)) (fun (n0 : Count N) => Vmul F (FnVS F N) (m n0) (StandardBasisVS F N n0)) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun (k : Count N) => k = n)). simpl. unfold Fnadd. suff: ((FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun k : Count N => k = n)) = FiniteSingleton (Count N) n). move=> H3. rewrite H3. suff: ((MySumF2 (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Complement (Count N) (fun k : Count N => k = n))) (VSPCM F (FnVS F N)) (fun n0 : Count N => Fnmul F N (m n0) (StandardBasisVS F N n0)) n) = FO F). move=> H4. rewrite H4. rewrite (Fadd_O_r F (MySumF2 (Count N) (FiniteSingleton (Count N) n) (VSPCM F (FnVS F N)) (fun n0 : Count N => Fnmul F N (m n0) (StandardBasisVS F N n0)) n)). rewrite MySumF2Singleton. unfold Fnmul. unfold StandardBasisVS. elim (excluded_middle_informative (proj1_sig n = proj1_sig n)). move=> H5. rewrite (Fmul_I_r F (m n)). reflexivity. move=> H5. apply False_ind. apply H5. reflexivity. apply (FiniteSetInduction (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Complement (Count N) (fun k : Count N => k = n)))). apply conj. rewrite MySumF2Empty. reflexivity. move=> B b H4 H5 H6 H7. rewrite MySumF2Add. simpl. unfold Fnadd. rewrite H7. unfold Fnmul. unfold StandardBasisVS. elim (excluded_middle_informative (proj1_sig b = proj1_sig n)). elim H5. move=> b0 H8 H9 H10. apply False_ind. apply H8. apply sig_map. apply H10. move=> H8. rewrite (Fmul_O_r F (m b)). apply (Fadd_O_l F (FO F)). apply H6. apply sig_map. apply Extensionality_Ensembles. simpl. apply conj. move=> k. elim. move=> k0 H3 H4. rewrite H3. apply (In_singleton (Count N) n). move=> k. elim. apply (Intersection_intro (Count N) (fun k0 : Count N => k0 = n) (Full_set (Count N)) n). reflexivity. apply (Full_intro (Count N) n). Qed. Lemma Proposition_2_3_1 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), (BasisVS K V (Count N) F) <-> (Bijective (Fn K N) (VT K V) (fun (a : Fn K N) => MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun (n : Count N) => Vmul K V (a n) (F n)))). Proof. move=> K V N F. unfold BasisVS. suff: (forall (a : Fn K N), Finite (Count N) (fun (t : Count N) => a t <> FO K)). move=> H1. suff: (forall (g : DirectSumField K (Count N)), MySumF2 (Count N) (exist (Finite (Count N)) (fun t : Count N => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig g t) (F t)) = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V ((proj1_sig g) n) (F n))). move=> H2. apply conj. elim. move=> G H3. exists (fun (v : VT K V) => proj1_sig (G v)). apply conj. move=> f. suff: (f = proj1_sig (exist (fun (a : Fn K N) => Finite (Count N) (fun t : Count N => a t <> FO K)) f (H1 f))). move=> H4. rewrite {1} H4. rewrite - (H2 (exist (fun (a : Fn K N) => Finite (Count N) (fun t : Count N => a t <> FO K)) f (H1 f))). rewrite (proj1 H3 (exist (fun (a : Fn K N) => Finite (Count N) (fun t : Count N => a t <> FO K)) f (H1 f))). reflexivity. reflexivity. move=> v. rewrite - (H2 (G v)). apply (proj2 H3 v). elim. move=> G H3. exists (fun (v : VT K V) => exist (fun (a : Fn K N) => Finite (Count N) (fun t : Count N => a t <> FO K)) (G v) (H1 (G v))). apply conj. move=> f. apply sig_map. simpl. rewrite (H2 f). apply (proj1 H3 (proj1_sig f)). move=> v. rewrite (H2 (exist (fun a : Fn K N => Finite (Count N) (fun t0 : Count N => a t0 <> FO K)) (G v) (H1 (G v)))). apply (proj2 H3 v). move=> g. rewrite (MySumF2Excluded (Count N) (VSPCM K V) (fun n : Count N => Vmul K V (proj1_sig g n) (F n)) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun t : Count N => proj1_sig g t <> FO K)). suff: ((MySumF2 (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Complement (Count N) (fun t : Count N => proj1_sig g t <> FO K))) (VSPCM K V) (fun n : Count N => Vmul K V (proj1_sig g n) (F n))) = VO K V). move=> H2. rewrite H2. simpl. rewrite (Vadd_O_r K V (MySumF2 (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (fun t : Count N => proj1_sig g t <> FO K)) (VSPCM K V) (fun n : Count N => Vmul K V (proj1_sig g n) (F n)))). suff: ((exist (Finite (Count N)) (fun t : Count N => proj1_sig g t <> FO K) (proj2_sig g)) = (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N))(fun t : Count N => proj1_sig g t <> FO K))). move=> H3. rewrite H3. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> n H3. apply (Intersection_intro (Count N) (fun t : Count N => proj1_sig g t <> FO K) (Full_set (Count N))). apply H3. apply (Full_intro (Count N) n). move=> n. elim. move=> n0 H3 H4. apply H3. apply MySumF2Induction. apply conj. reflexivity. move=> v n H2 H3. rewrite H3. suff: ((proj1_sig g n) = FO K). move=> H4. rewrite H4. rewrite (Vmul_O_l K V (F n)). apply (Vadd_O_l K V (VO K V)). elim H2. move=> m H4 H5. apply NNPP. apply H4. move=> a. apply (Finite_downward_closed (Count N) (Full_set (Count N)) (CountFinite N) (fun t : Count N => a t <> FO K)). move=> t H1. apply (Full_intro (Count N) t). Qed. Lemma Proposition_2_3_2 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), (BasisVS K V (Count N) F) <-> ((forall (v : VT K V), exists (a : Count N -> FT K), v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n))) /\ (forall (a : Count N -> FT K), MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)) = VO K V -> a = FnO K N)). Proof. move=> K V N F. apply conj. move=> H1. suff: (forall v : VT K V, exists! a : Count N -> FT K, v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n))). move=> H2. apply conj. move=> v. apply (proj1 (proj2 (unique_existence (fun (a : Count N -> FT K) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)))) (H2 v))). move=> a0 H3. apply (proj2 (proj2 (unique_existence (fun (a : Count N -> FT K) => VO K V = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)))) (H2 (VO K V))) a0 (FnO K N)). rewrite H3. reflexivity. apply (MySumF2Induction (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N))). apply conj. reflexivity. move=> v n H4 H5. rewrite H5. rewrite (Vmul_O_l K V (F n)). rewrite - {1} (Vadd_O_r K V v). reflexivity. apply (proj1 (FiniteBasisVS K V N F) H1). move=> H1. apply (proj2 (FiniteBasisVS K V N F)). move=> v. apply (proj1 (unique_existence (fun (a : Count N -> FT K) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n))))). apply conj. apply (proj1 H1 v). move=> a1 a2 H2 H3. rewrite - (Vadd_O_r K (FnVS K N) a1). rewrite - (Vadd_O_l K (FnVS K N) a2). rewrite - {1} (Vadd_opp_l K (FnVS K N) a2). rewrite - (Vadd_assoc K (FnVS K N) a1 (Vopp K (FnVS K N) a2) a2). simpl. suff: (Fnminus K N a1 a2 = FnO K N). unfold Fnminus. move=> H4. rewrite H4. reflexivity. apply (proj2 H1 (Fnminus K N a1 a2)). suff: (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (Fnminus K N a1 a2 n) (F n)) = Vadd K V (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a1 n) (F n))) (Vopp K V (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a2 n) (F n))))). move=> H4. rewrite H4. rewrite - H2. rewrite - H3. apply (Vadd_opp_r K V v). apply (FiniteSetInduction (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite (Vadd_opp_r K V (VO K V)). reflexivity. move=> B b H4 H5 H6 H7. rewrite MySumF2Add. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H7. rewrite (Vopp_add_distr K V (MySumF2 (Count N) B (VSPCM K V) (fun n : Count N => Vmul K V (a2 n) (F n))) (Vmul K V (a2 b) (F b))). rewrite (Vadd_assoc K V (MySumF2 (Count N) B (VSPCM K V) (fun n : Count N => Vmul K V (a1 n) (F n))) (Vmul K V (a1 b) (F b)) (Vadd K V (Vopp K V (MySumF2 (Count N) B (VSPCM K V) (fun n : Count N => Vmul K V (a2 n) (F n)))) (Vopp K V (Vmul K V (a2 b) (F b))))). rewrite - (Vadd_assoc K V (Vmul K V (a1 b) (F b)) (Vopp K V (MySumF2 (Count N) B (VSPCM K V) (fun n : Count N => Vmul K V (a2 n) (F n)))) (Vopp K V (Vmul K V (a2 b) (F b)))). rewrite (Vadd_comm K V (Vmul K V (a1 b) (F b)) (Vopp K V (MySumF2 (Count N) B (VSPCM K V) (fun n : Count N => Vmul K V (a2 n) (F n))))). rewrite (Vadd_assoc K V (Vopp K V (MySumF2 (Count N) B (VSPCM K V) (fun n : Count N => Vmul K V (a2 n) (F n)))) (Vmul K V (a1 b) (F b)) (Vopp K V (Vmul K V (a2 b) (F b)))). rewrite (Vadd_assoc K V (MySumF2 (Count N) B (VSPCM K V) (fun n : Count N => Vmul K V (a1 n) (F n))) (Vopp K V (MySumF2 (Count N) B (VSPCM K V) (fun n : Count N => Vmul K V (a2 n) (F n)))) (Vmul K V (Fnminus K N a1 a2 b) (F b))). rewrite (Vopp_mul_distr_l K V (a2 b) (F b)). rewrite - (Vmul_add_distr_r K V (a1 b) (Fopp K (a2 b)) (F b)). reflexivity. apply H6. apply H6. apply H6. Qed. Definition PairVST (K : Field) (V1 V2 : VectorSpace K) := prod (VT K V1) (VT K V2). Definition PairVSVO (K : Field) (V1 V2 : VectorSpace K) := (VO K V1, VO K V2). Definition PairVSVadd (K : Field) (V1 V2 : VectorSpace K) := fun (v1 v2 : PairVST K V1 V2) => (Vadd K V1 (fst v1) (fst v2), Vadd K V2 (snd v1) (snd v2)). Definition PairVSVmul (K : Field) (V1 V2 : VectorSpace K) := fun (f : FT K) (v : PairVST K V1 V2) => (Vmul K V1 f (fst v), Vmul K V2 f (snd v)). Definition PairVSVopp (K : Field) (V1 V2 : VectorSpace K) := fun (v : PairVST K V1 V2) => (Vopp K V1 (fst v), Vopp K V2 (snd v)). Lemma PairVSVadd_comm : forall (K : Field) (V1 V2 : VectorSpace K) (v1 v2 : PairVST K V1 V2), PairVSVadd K V1 V2 v1 v2 = PairVSVadd K V1 V2 v2 v1. Proof. move=> K V1 V2 v1 v2. apply injective_projections. apply (Vadd_comm K V1 (fst v1) (fst v2)). apply (Vadd_comm K V2 (snd v1) (snd v2)). Qed. Lemma PairVSVadd_assoc : forall (K : Field) (V1 V2 : VectorSpace K) (v1 v2 v3 : PairVST K V1 V2), PairVSVadd K V1 V2 (PairVSVadd K V1 V2 v1 v2) v3 = PairVSVadd K V1 V2 v1 (PairVSVadd K V1 V2 v2 v3). Proof. move=> K V1 V2 v1 v2 v3. apply injective_projections. apply (Vadd_assoc K V1 (fst v1) (fst v2) (fst v3)). apply (Vadd_assoc K V2 (snd v1) (snd v2) (snd v3)). Qed. Lemma PairVSVadd_O_l : forall (K : Field) (V1 V2 : VectorSpace K) (v : PairVST K V1 V2), PairVSVadd K V1 V2 (PairVSVO K V1 V2) v = v. Proof. move=> K V1 V2 v. apply injective_projections. apply (Vadd_O_l K V1 (fst v)). apply (Vadd_O_l K V2 (snd v)). Qed. Lemma PairVSVadd_opp_r : forall (K : Field) (V1 V2 : VectorSpace K) (v : PairVST K V1 V2), PairVSVadd K V1 V2 v (PairVSVopp K V1 V2 v) = PairVSVO K V1 V2. Proof. move=> K V1 V2 v. apply injective_projections. apply (Vadd_opp_r K V1 (fst v)). apply (Vadd_opp_r K V2 (snd v)). Qed. Lemma PairVSVmul_add_distr_l : forall (K : Field) (V1 V2 : VectorSpace K) (f : FT K) (v1 v2 : PairVST K V1 V2), PairVSVmul K V1 V2 f (PairVSVadd K V1 V2 v1 v2) = (PairVSVadd K V1 V2 (PairVSVmul K V1 V2 f v1) (PairVSVmul K V1 V2 f v2)). Proof. move=> K V1 V2 f v1 v2. apply injective_projections. apply (Vmul_add_distr_l K V1 f (fst v1) (fst v2)). apply (Vmul_add_distr_l K V2 f (snd v1) (snd v2)). Qed. Lemma PairVSVmul_add_distr_r : forall (K : Field) (V1 V2 : VectorSpace K) (f1 f2 : FT K) (v : PairVST K V1 V2), (PairVSVmul K V1 V2 (Fadd K f1 f2) v) = (PairVSVadd K V1 V2 (PairVSVmul K V1 V2 f1 v) (PairVSVmul K V1 V2 f2 v)). Proof. move=> K V1 V2 f1 f2 v. apply injective_projections. apply (Vmul_add_distr_r K V1 f1 f2 (fst v)). apply (Vmul_add_distr_r K V2 f1 f2 (snd v)). Qed. Lemma PairVSVmul_assoc : forall (K : Field) (V1 V2 : VectorSpace K) (f1 f2 : FT K) (v : PairVST K V1 V2), (PairVSVmul K V1 V2 f1 (PairVSVmul K V1 V2 f2 v)) = (PairVSVmul K V1 V2 (Fmul K f1 f2) v). Proof. move=> K V1 V2 f1 f2 v. apply injective_projections. apply (Vmul_assoc K V1 f1 f2 (fst v)). apply (Vmul_assoc K V2 f1 f2 (snd v)). Qed. Lemma PairVSVmul_I_l : forall (K : Field) (V1 V2 : VectorSpace K) (v : PairVST K V1 V2), (PairVSVmul K V1 V2 (FI K) v) = v. Proof. move=> K V1 V2 v. apply injective_projections. apply (Vmul_I_l K V1 (fst v)). apply (Vmul_I_l K V2 (snd v)). Qed. Definition PairVS (K : Field) (V1 V2 : VectorSpace K) := mkVectorSpace K (PairVST K V1 V2) (PairVSVO K V1 V2) (PairVSVadd K V1 V2) (PairVSVmul K V1 V2) (PairVSVopp K V1 V2) (PairVSVadd_comm K V1 V2) (PairVSVadd_assoc K V1 V2) (PairVSVadd_O_l K V1 V2) (PairVSVadd_opp_r K V1 V2) (PairVSVmul_add_distr_l K V1 V2) (PairVSVmul_add_distr_r K V1 V2) (PairVSVmul_assoc K V1 V2) (PairVSVmul_I_l K V1 V2). Definition PairSystemVS (K : Field) (T1 T2 : Type) (V1 V2 : VectorSpace K) (a1 : T1 -> (VT K V1)) (a2 : T2 -> (VT K V2)) := fun (t : T1 + T2) => match t with | inl t1 => (a1 t1, VO K V2) | inr t2 => (VO K V1, a2 t2) end. Lemma PairBasisVS : forall (K : Field) (T1 T2 : Type) (V1 V2 : VectorSpace K) (a1 : T1 -> (VT K V1)) (a2 : T2 -> (VT K V2)), (BasisVS K V1 T1 a1) -> (BasisVS K V2 T2 a2) -> (BasisVS K (PairVS K V1 V2) (T1 + T2) (PairSystemVS K T1 T2 V1 V2 a1 a2)). Proof. move=> K T1 T2 V1 V2 a1 a2 H1 H2. suff: (forall (g : DirectSumField K (T1 + T2)), Finite T1 (fun t : T1 => proj1_sig g (inl t) <> FO K)). move=> H3. suff: (forall (g : DirectSumField K (T1 + T2)), Finite T2 (fun t : T2 => proj1_sig g (inr t) <> FO K)). move=> H4. suff: (forall (g : DirectSumField K (T1 + T2)), fst (MySumF2 (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => Vmul K (PairVS K V1 V2) (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t))) = MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig g (inl t) <> FO K) (H3 g)) (VSPCM K V1) (fun t : T1 => Vmul K V1 (proj1_sig g (inl t)) (a1 t))). move=> H5. suff: (forall (g : DirectSumField K (T1 + T2)), snd (MySumF2 (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => Vmul K (PairVS K V1 V2) (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t))) = MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig g (inr t) <> FO K) (H4 g)) (VSPCM K V2) (fun t : T2 => Vmul K V2 (proj1_sig g (inr t)) (a2 t))). move=> H6. apply (InjSurjBij (DirectSumField K (T1 + T2)) (VT K V1 * VT K V2) (fun g : DirectSumField K (T1 + T2) => MySumF2 (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => Vmul K (PairVS K V1 V2) (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t)))). move=> x1 x2 H7. apply sig_map. apply functional_extensionality. elim. suff: (exist (fun (G : T1 -> FT K) => Finite T1 (fun t : T1 => G t <> FO K)) (fun (t : T1) => proj1_sig x1 (inl t)) (H3 x1) = exist (fun (G : T1 -> FT K) => Finite T1 (fun t : T1 => G t <> FO K)) (fun (t : T1) => proj1_sig x2 (inl t)) (H3 x2)). move=> H8 t. suff: (proj1_sig x1 (inl t) = proj1_sig (exist (fun G : T1 -> FT K => Finite T1 (fun t : T1 => G t <> FO K)) (fun t : T1 => proj1_sig x1 (inl t)) (H3 x1)) t). move=> H9. rewrite H9. rewrite H8. reflexivity. reflexivity. suff: (Injective (DirectSumField K T1) (VT K V1) (fun g : DirectSumField K T1 => MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V1) (fun t : T1 => Vmul K V1 (proj1_sig g t) (a1 t)))). move=> H8. apply (H8 (exist (fun G : T1 -> FT K => Finite T1 (fun t : T1 => G t <> FO K)) (fun t : T1 => proj1_sig x1 (inl t)) (H3 x1)) (exist (fun G : T1 -> FT K => Finite T1 (fun t : T1 => G t <> FO K)) (fun t : T1 => proj1_sig x2 (inl t)) (H3 x2))). simpl. rewrite - (H5 x1). rewrite - (H5 x2). rewrite H7. reflexivity. apply (BijInj (DirectSumField K T1) (VT K V1) (fun g : DirectSumField K T1 => MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V1) (fun t : T1 => Vmul K V1 (proj1_sig g t) (a1 t))) H1). suff: (exist (fun (G : T2 -> FT K) => Finite T2 (fun t : T2 => G t <> FO K)) (fun (t : T2) => proj1_sig x1 (inr t)) (H4 x1) = exist (fun (G : T2 -> FT K) => Finite T2 (fun t : T2 => G t <> FO K)) (fun (t : T2) => proj1_sig x2 (inr t)) (H4 x2)). move=> H8 t. suff: (proj1_sig x1 (inr t) = proj1_sig (exist (fun G : T2 -> FT K => Finite T2 (fun t : T2 => G t <> FO K)) (fun t : T2 => proj1_sig x1 (inr t)) (H4 x1)) t). move=> H9. rewrite H9. rewrite H8. reflexivity. reflexivity. suff: (Injective (DirectSumField K T2) (VT K V2) (fun g : DirectSumField K T2 => MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V2) (fun t : T2 => Vmul K V2 (proj1_sig g t) (a2 t)))). move=> H8. apply (H8 (exist (fun G : T2 -> FT K => Finite T2 (fun t : T2 => G t <> FO K)) (fun t : T2 => proj1_sig x1 (inr t)) (H4 x1)) (exist (fun G : T2 -> FT K => Finite T2 (fun t : T2 => G t <> FO K)) (fun t : T2 => proj1_sig x2 (inr t)) (H4 x2))). simpl. rewrite - (H6 x1). rewrite - (H6 x2). rewrite H7. reflexivity. apply (BijInj (DirectSumField K T2) (VT K V2) (fun g : DirectSumField K T2 => MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V2) (fun t : T2 => Vmul K V2 (proj1_sig g t) (a2 t))) H2). move=> v. suff: (Surjective (DirectSumField K T1) (VT K V1) (fun g : DirectSumField K T1 => MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V1) (fun t : T1 => Vmul K V1 (proj1_sig g t) (a1 t)))). move=> H7. suff: (Surjective (DirectSumField K T2) (VT K V2) (fun g : DirectSumField K T2 => MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V2) (fun t : T2 => Vmul K V2 (proj1_sig g t) (a2 t)))). move=> H8. elim (H7 (fst v)). move=> x1 H9. elim (H8 (snd v)). move=> x2 H10. suff: (Finite (T1 + T2) (fun t : T1 + T2 => (fun t0 : T1 + T2 => match t0 with | inl t0l => proj1_sig x1 t0l | inr t0r => proj1_sig x2 t0r end) t <> FO K)). move=> H11. exists (exist (fun (G : T1 + T2 -> FT K) => Finite (T1 + T2) (fun t : T1 + T2 => G t <> FO K)) (fun t0 : T1 + T2 => match t0 with | inl t0l => proj1_sig x1 t0l | inr t0r => proj1_sig x2 t0r end) H11). apply injective_projections. simpl. rewrite (H5 (exist (fun (G : T1 + T2 -> FT K) => Finite (T1 + T2) (fun t : T1 + T2 => G t <> FO K)) (fun t0 : T1 + T2 => match t0 with | inl t0l => proj1_sig x1 t0l | inr t0r => proj1_sig x2 t0r end) H11)). simpl. suff: ((exist (Finite T1) (fun t : T1 => proj1_sig x1 t <> FO K) (H3 (exist (fun G : T1 + T2 -> FT K => Finite (T1 + T2) (fun t : T1 + T2 => G t <> FO K)) (fun t0 : T1 + T2 => match t0 with | inl t0l => proj1_sig x1 t0l | inr t0r => proj1_sig x2 t0r end) H11))) = (exist (Finite T1) (fun t : T1 => proj1_sig x1 t <> FO K) (proj2_sig x1))). move=> H12. rewrite H12. apply H9. apply sig_map. reflexivity. simpl. rewrite (H6 (exist (fun (G : T1 + T2 -> FT K) => Finite (T1 + T2) (fun t : T1 + T2 => G t <> FO K)) (fun t0 : T1 + T2 => match t0 with | inl t0l => proj1_sig x1 t0l | inr t0r => proj1_sig x2 t0r end) H11)). simpl. suff: ((exist (Finite T2) (fun t : T2 => proj1_sig x2 t <> FO K) (H4 (exist (fun G : T1 + T2 -> FT K => Finite (T1 + T2) (fun t : T1 + T2 => G t <> FO K)) (fun t0 : T1 + T2 => match t0 with | inl t0l => proj1_sig x1 t0l | inr t0r => proj1_sig x2 t0r end) H11))) = (exist (Finite T2) (fun t : T2 => proj1_sig x2 t <> FO K) (proj2_sig x2))). move=> H12. rewrite H12. apply H10. apply sig_map. reflexivity. suff: ((fun t : T1 + T2 => match t with | inl t0l => proj1_sig x1 t0l | inr t0r => proj1_sig x2 t0r end <> FO K) = Union (T1 + T2) (fun t : T1 + T2 => match t with | inl t0l => proj1_sig x1 t0l <> FO K | inr _ => False end) (fun t : T1 + T2 => match t with | inl _ => False | inr t0r => proj1_sig x2 t0r <> FO K end)). move=> H11. rewrite H11. apply (Union_preserves_Finite (T1 + T2) (fun t : T1 + T2 => match t with | inl t0l => proj1_sig x1 t0l <> FO K | inr _ => False end) (fun t : T1 + T2 => match t with | inl _ => False | inr t0r => proj1_sig x2 t0r <> FO K end)). suff: ((fun t : T1 + T2 => match t with | inl t0l => proj1_sig x1 t0l <> FO K | inr _ => False end) = Im T1 (T1 + T2) (fun (t : T1) => proj1_sig x1 t <> FO K) inl). move=> H12. rewrite H12. apply (finite_image T1 (T1 + T2) (fun t : T1 => proj1_sig x1 t <> FO K) inl). apply (proj2_sig x1). apply Extensionality_Ensembles. apply conj. unfold Included. unfold In. elim. move=> t1 H12. apply (Im_intro T1 (T1 + T2) (fun t : T1 => proj1_sig x1 t <> FO K) inl t1). apply H12. reflexivity. move=> t2 H12. apply False_ind. apply H12. move=> t. elim. move=> t1 H12 tt H13. rewrite H13. apply H12. suff: ((fun t : T1 + T2 => match t with | inl _ => False | inr t0r => proj1_sig x2 t0r <> FO K end) = Im T2 (T1 + T2) (fun (t : T2) => proj1_sig x2 t <> FO K) inr). move=> H12. rewrite H12. apply (finite_image T2 (T1 + T2) (fun t : T2 => proj1_sig x2 t <> FO K) inr). apply (proj2_sig x2). apply Extensionality_Ensembles. apply conj. unfold Included. unfold In. elim. move=> t1 H12. apply False_ind. apply H12. move=> t2 H12. apply (Im_intro T2 (T1 + T2) (fun t : T2 => proj1_sig x2 t <> FO K) inr t2). apply H12. reflexivity. move=> t. elim. move=> t2 H12 tt H13. rewrite H13. apply H12. apply Extensionality_Ensembles. apply conj. unfold Included. unfold In. elim. move=> t1 H11. left. apply H11. move=> t2 H11. right. apply H11. unfold Included. unfold In. elim. move=> t1 H11. suff: (In (T1 + T2) (fun t : T1 + T2 => match t with | inl t0l => proj1_sig x1 t0l <> FO K | inr _ => False end) (inl t1) \/ In (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => False | inr t0r => proj1_sig x2 t0r <> FO K end) (inl t1)). elim. apply. move=> H12 H13. apply H12. elim H11. move=> t12 H12. left. apply H12. move=> t12 H12. right. apply H12. move=> t2 H11. suff: (In (T1 + T2) (fun t : T1 + T2 => match t with | inl t0l => proj1_sig x1 t0l <> FO K | inr _ => False end) (inr t2) \/ In (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => False | inr t0r => proj1_sig x2 t0r <> FO K end) (inr t2)). elim. move=> H12 H13. apply H12. apply. elim H11. move=> t12 H12. left. apply H12. move=> t12 H12. right. apply H12. apply (BijSurj (DirectSumField K T2) (VT K V2) (fun g : DirectSumField K T2 => MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V2) (fun t : T2 => Vmul K V2 (proj1_sig g t) (a2 t))) H2). apply (BijSurj (DirectSumField K T1) (VT K V1) (fun g : DirectSumField K T1 => MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K V1) (fun t : T1 => Vmul K V1 (proj1_sig g t) (a1 t))) H1). move=> g. rewrite (MySumF2Excluded (T1 + T2) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => Vmul K (PairVS K V1 V2) (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t)) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (fun t : T1 + T2 => match t with | inl t1 => False | inr t2 => True end)). simpl. suff: ((snd (MySumF2 (T1 + T2) (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (Complement (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => False | inr _ => True end))) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => PairVSVmul K V1 V2 (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t)))) = VO K V2). move=> H6. rewrite H6. rewrite (Vadd_O_r K V2). rewrite - (MySumF2BijectiveSame T2 (exist (Finite T2) (fun t : T2 => proj1_sig g (inr t) <> FO K) (H4 g)) (T1 + T2) (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (fun t : T1 + T2 => match t with | inl _ => False | inr _ => True end)) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => PairVSVmul K V1 V2 (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t)) inr). apply (FiniteSetInduction T2 (exist (Finite T2) (fun t : T2 => proj1_sig g (inr t) <> FO K) (H4 g))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H7 H8 H9 H10. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H10. reflexivity. apply H9. apply H9. simpl. move=> t2 H7. apply (Intersection_intro (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => False | inr _ => True end) (fun t : T1 + T2 => proj1_sig g t <> FO K) (inr t2)). apply I. apply H7. move=> H7. apply InjSurjBij. move=> u1 u2 H8. apply sig_map. suff: (inr T1 (proj1_sig u1) = inr T1 (proj1_sig u2)). move=> H9. suff: (proj1_sig u1 = let temp := (fun (t : T1 + T2) => match t with | inl _ => proj1_sig u1 | inr t2 => t2 end) in temp (inr (proj1_sig u1))). move=> H10. rewrite H10. rewrite H9. reflexivity. reflexivity. suff: (inr (proj1_sig u1) = proj1_sig (exist (proj1_sig (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (fun t : T1 + T2 => match t with | inl _ => False | inr _ => True end))) (inr (proj1_sig u1)) (H7 (proj1_sig u1) (proj2_sig u1)))). move=> H9. rewrite H9. rewrite H8. reflexivity. reflexivity. move=> u. suff: (exists x : {u0 : T2 | proj1_sig (exist (Finite T2) (fun t : T2 => proj1_sig g (inr t) <> FO K) (H4 g)) u0}, proj1_sig (exist (proj1_sig (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (fun t : T1 + T2 => match t with | inl _ => False | inr _ => True end))) (inr (proj1_sig x)) (H7 (proj1_sig x) (proj2_sig x))) = proj1_sig u). elim. move=> x H8. exists x. apply sig_map. apply H8. suff: (In (T1 + T2) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj1_sig u)). suff: (In (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => False | inr _ => True end) (proj1_sig u)). elim (proj1_sig u). move=> t1 H8. apply False_ind. apply H8. move=> t2 H8 H9. exists (exist (fun (u0 : T2) => proj1_sig (exist (Finite T2) (fun t : T2 => proj1_sig g (inr t) <> FO K) (H4 g)) u0) t2 H9). reflexivity. elim (proj2_sig u). move=> t H8 H9. apply H8. elim (proj2_sig u). move=> t H8 H9. apply H9. apply (FiniteSetInduction (T1 + T2) (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (Complement (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => False | inr _ => True end)))). apply conj. rewrite MySumF2Empty. reflexivity. move=> B b H6 H7 H8 H9. rewrite MySumF2Add. simpl. rewrite H9. suff: ((Vmul K V2 (proj1_sig g b) (snd (PairSystemVS K T1 T2 V1 V2 a1 a2 b))) = VO K V2). move=> H10. rewrite H10. apply (Vadd_O_r K V2 (VO K V2)). elim H7. elim. move=> a H10 H11. simpl. apply (Vmul_O_r K V2 (proj1_sig g (inl a))). move=> a H10 H11. apply False_ind. apply H10. apply I. apply H8. move=> g. rewrite (MySumF2Excluded (T1 + T2) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => Vmul K (PairVS K V1 V2) (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t)) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (fun t : T1 + T2 => match t with | inl t1 => True | inr t2 => False end)). simpl. suff: ((fst (MySumF2 (T1 + T2) (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (Complement (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => True | inr _ => False end))) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => PairVSVmul K V1 V2 (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t)))) = VO K V1). move=> H5. rewrite H5. rewrite (Vadd_O_r K V1). rewrite - (MySumF2BijectiveSame T1 (exist (Finite T1) (fun t : T1 => proj1_sig g (inl t) <> FO K) (H3 g)) (T1 + T2) (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (fun t : T1 + T2 => match t with | inl _ => True | inr _ => False end)) (VSPCM K (PairVS K V1 V2)) (fun t : T1 + T2 => PairVSVmul K V1 V2 (proj1_sig g t) (PairSystemVS K T1 T2 V1 V2 a1 a2 t)) inl). apply (FiniteSetInduction T1 (exist (Finite T1) (fun t : T1 => proj1_sig g (inl t) <> FO K) (H3 g))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H6 H7 H8 H9. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H9. reflexivity. apply H8. apply H8. simpl. move=> t1 H6. apply (Intersection_intro (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => True | inr _ => False end) (fun t : T1 + T2 => proj1_sig g t <> FO K) (inl t1)). apply I. apply H6. move=> H6. apply InjSurjBij. move=> u1 u2 H7. apply sig_map. suff: (inl T2 (proj1_sig u1) = inl T2 (proj1_sig u2)). move=> H8. suff: (proj1_sig u1 = let temp := (fun (t : T1 + T2) => match t with | inl t1 => t1 | inr t2 => proj1_sig u1 end) in temp (inl (proj1_sig u1))). move=> H9. rewrite H9. rewrite H8. reflexivity. reflexivity. suff: (inl (proj1_sig u1) = proj1_sig (exist (proj1_sig (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (fun t : T1 + T2 => match t with | inl _ => True | inr _ => False end))) (inl (proj1_sig u1)) (H6 (proj1_sig u1) (proj2_sig u1)))). move=> H8. rewrite H8. rewrite H7. reflexivity. reflexivity. move=> u. suff: (exists x : {u0 : T1 | proj1_sig (exist (Finite T1) (fun t : T1 => proj1_sig g (inl t) <> FO K) (H3 g)) u0}, proj1_sig (exist (proj1_sig (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (fun t : T1 + T2 => match t with | inl _ => True | inr _ => False end))) (inl (proj1_sig x)) (H6 (proj1_sig x) (proj2_sig x))) = proj1_sig u). elim. move=> x H7. exists x. apply sig_map. apply H7. suff: (In (T1 + T2) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj1_sig u)). suff: (In (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => True | inr _ => False end) (proj1_sig u)). elim (proj1_sig u). move=> t1 H7 H8. exists (exist (fun (u0 : T1) => proj1_sig (exist (Finite T1) (fun t : T1 => proj1_sig g (inl t) <> FO K) (H3 g)) u0) t1 H8). reflexivity. move=> t2 H7. apply False_ind. apply H7. elim (proj2_sig u). move=> t H7 H8. apply H7. elim (proj2_sig u). move=> t H7 H8. apply H8. apply (FiniteSetInduction (T1 + T2) (FiniteIntersection (T1 + T2) (exist (Finite (T1 + T2)) (fun t : T1 + T2 => proj1_sig g t <> FO K) (proj2_sig g)) (Complement (T1 + T2) (fun t : T1 + T2 => match t with | inl _ => True | inr _ => False end)))). apply conj. rewrite MySumF2Empty. reflexivity. move=> B b H5 H6 H7 H8. rewrite MySumF2Add. simpl. rewrite H8. suff: ((Vmul K V1 (proj1_sig g b) (fst (PairSystemVS K T1 T2 V1 V2 a1 a2 b))) = VO K V1). move=> H9. rewrite H9. apply (Vadd_O_r K V1 (VO K V1)). elim H6. elim. move=> a H9 H10. apply False_ind. apply H9. apply I. simpl. move=> a H9 H10. apply (Vmul_O_r K V1 (proj1_sig g (inr a))). apply H7. move=> g. elim (classic (Inhabited T2 (fun t : T2 => proj1_sig g (inr t) <> FO K))). elim. move=> t2 H4. suff: ((fun t : T2 => proj1_sig g (inr t) <> FO K) = Im (T1 + T2) T2 (fun t : T1 + T2 => proj1_sig g t <> FO K) (fun t : T1 + T2 => match t with | inl _ => t2 | inr t0 => t0 end)). move=> H5. rewrite H5. apply (finite_image (T1 + T2) T2 (fun t : T1 + T2 => proj1_sig g t <> FO K) (fun t : T1 + T2 => match t with | inl _ => t2 | inr t0 => t0 end)). apply (proj2_sig g). apply Extensionality_Ensembles. apply conj. move=> t H5. exists (inr t). apply H5. reflexivity. move=> t12. elim. move=> t0 H5 t1 H6. rewrite H6. move: H5. elim t0. move=> a H7. apply H4. move=> b. apply. move=> H4. suff: ((fun t : T2 => proj1_sig g (inr t) <> FO K) = Empty_set T2). move=> H5. rewrite H5. apply Empty_is_finite. apply Extensionality_Ensembles. apply conj. move=> t H5. apply False_ind. apply H4. apply (Inhabited_intro T2 (fun t0 : T2 => proj1_sig g (inr t0) <> FO K) t H5). move=> t. elim. move=> g. elim (classic (Inhabited T1 (fun t : T1 => proj1_sig g (inl t) <> FO K))). elim. move=> t1 H3. suff: ((fun t : T1 => proj1_sig g (inl t) <> FO K) = Im (T1 + T2) T1 (fun t : T1 + T2 => proj1_sig g t <> FO K) (fun t : T1 + T2 => match t with | inl t0 => t0 | inr _ => t1 end)). move=> H4. rewrite H4. apply (finite_image (T1 + T2) T1 (fun t : T1 + T2 => proj1_sig g t <> FO K) (fun t : T1 + T2 => match t with | inl t0 => t0 | inr _ => t1 end)). apply (proj2_sig g). apply Extensionality_Ensembles. apply conj. move=> t H4. exists (inl t). apply H4. reflexivity. move=> t12. elim. move=> t0 H4 t2 H5. rewrite H5. move: H4. elim t0. move=> a H6. apply H6. move=> b H6. apply H3. move=> H3. suff: ((fun t : T1 => proj1_sig g (inl t) <> FO K) = Empty_set T1). move=> H4. rewrite H4. apply Empty_is_finite. apply Extensionality_Ensembles. apply conj. move=> t H4. apply False_ind. apply H3. apply (Inhabited_intro T1 (fun t0 : T1 => proj1_sig g (inl t0) <> FO K) t H4). move=> t. elim. Qed. Definition DirectProdVST (K : Field) (T : Type) (V : T -> VectorSpace K) := forall (t : T), VT K (V t). Definition DirectProdVSVO (K : Field) (T : Type) (V : T -> VectorSpace K) := fun (t : T) => VO K (V t). Definition DirectProdVSVadd (K : Field) (T : Type) (V : T -> VectorSpace K) := fun (v1 v2 : DirectProdVST K T V) (t : T) => Vadd K (V t) (v1 t) (v2 t). Definition DirectProdVSVmul (K : Field) (T : Type) (V : T -> VectorSpace K) := fun (f : FT K) (v : DirectProdVST K T V) (t : T) => Vmul K (V t) f (v t). Definition DirectProdVSVopp (K : Field) (T : Type) (V : T -> VectorSpace K) := fun (v : DirectProdVST K T V) (t : T) => Vopp K (V t) (v t). Lemma DirectProdVSVadd_comm : forall (K : Field) (T : Type) (V : T -> VectorSpace K) (v1 v2 : DirectProdVST K T V), DirectProdVSVadd K T V v1 v2 = DirectProdVSVadd K T V v2 v1. Proof. move=> K T V v1 v2. unfold DirectProdVSVadd. apply functional_extensionality_dep. move=> t. apply (Vadd_comm K (V t) (v1 t) (v2 t)). Qed. Lemma DirectProdVSVadd_assoc : forall (K : Field) (T : Type) (V : T -> VectorSpace K) (v1 v2 v3 : DirectProdVST K T V), DirectProdVSVadd K T V (DirectProdVSVadd K T V v1 v2) v3 = DirectProdVSVadd K T V v1 (DirectProdVSVadd K T V v2 v3). Proof. move=> K T V v1 v2 v3. apply functional_extensionality_dep. move=> t. apply (Vadd_assoc K (V t) (v1 t) (v2 t) (v3 t)). Qed. Lemma DirectProdVSVadd_O_l : forall (K : Field) (T : Type) (V : T -> VectorSpace K) (v : DirectProdVST K T V), DirectProdVSVadd K T V (DirectProdVSVO K T V) v = v. Proof. move=> K T V v. apply functional_extensionality_dep. move=> t. apply (Vadd_O_l K (V t) (v t)). Qed. Lemma DirectProdVSVadd_opp_r : forall (K : Field) (T : Type) (V : T -> VectorSpace K) (v : DirectProdVST K T V), DirectProdVSVadd K T V v (DirectProdVSVopp K T V v) = DirectProdVSVO K T V. Proof. move=> K T V v. apply functional_extensionality_dep. move=> t. apply (Vadd_opp_r K (V t) (v t)). Qed. Lemma DirectProdVSVmul_add_distr_l : forall (K : Field) (T : Type) (V : T -> VectorSpace K) (f : FT K) (v1 v2 : DirectProdVST K T V), DirectProdVSVmul K T V f (DirectProdVSVadd K T V v1 v2) = (DirectProdVSVadd K T V (DirectProdVSVmul K T V f v1) (DirectProdVSVmul K T V f v2)). Proof. move=> K T V f v1 v2. apply functional_extensionality_dep. move=> t. apply (Vmul_add_distr_l K (V t) f (v1 t) (v2 t)). Qed. Lemma DirectProdVSVmul_add_distr_r : forall (K : Field) (T : Type) (V : T -> VectorSpace K) (f1 f2 : FT K) (v : DirectProdVST K T V), (DirectProdVSVmul K T V (Fadd K f1 f2) v) = (DirectProdVSVadd K T V (DirectProdVSVmul K T V f1 v) (DirectProdVSVmul K T V f2 v)). Proof. move=> K T V f1 f2 v. apply functional_extensionality_dep. move=> t. apply (Vmul_add_distr_r K (V t) f1 f2 (v t)). Qed. Lemma DirectProdVSVmul_assoc : forall (K : Field) (T : Type) (V : T -> VectorSpace K) (f1 f2 : FT K) (v : DirectProdVST K T V), (DirectProdVSVmul K T V f1 (DirectProdVSVmul K T V f2 v)) = (DirectProdVSVmul K T V (Fmul K f1 f2) v). Proof. move=> K T V f1 f2 v. apply functional_extensionality_dep. move=> t. apply (Vmul_assoc K (V t) f1 f2 (v t)). Qed. Lemma DirectProdVSVmul_I_l : forall (K : Field) (T : Type) (V : T -> VectorSpace K) (v : DirectProdVST K T V), (DirectProdVSVmul K T V (FI K) v) = v. Proof. move=> K T V v. apply functional_extensionality_dep. move=> t. apply (Vmul_I_l K (V t) (v t)). Qed. Definition DirectProdVS (K : Field) (T : Type) (V : T -> VectorSpace K) := mkVectorSpace K (DirectProdVST K T V) (DirectProdVSVO K T V) (DirectProdVSVadd K T V) (DirectProdVSVmul K T V) (DirectProdVSVopp K T V) (DirectProdVSVadd_comm K T V) (DirectProdVSVadd_assoc K T V) (DirectProdVSVadd_O_l K T V) (DirectProdVSVadd_opp_r K T V) (DirectProdVSVmul_add_distr_l K T V) (DirectProdVSVmul_add_distr_r K T V) (DirectProdVSVmul_assoc K T V) (DirectProdVSVmul_I_l K T V). Definition DirectProdSystemVS (K : Field) (T : Type) (tf : T -> Type) (V : T -> VectorSpace K) (a : forall (t : T), (tf t) -> (VT K (V t))) := fun (t : sumT T tf) => match t with | inT t0 ti => fun (t1 : T) => match (excluded_middle_informative (t0 = t1)) with | left H => a t1 (TypeEqConvert (tf t0) (tf t1) (f_equal tf H) ti) | right _ => VO K (V t1) end end. Lemma DirectProductBasisVS : forall (K : Field) (N : nat) (T : {n : nat | n < N} -> Type) (V : {n : nat | n < N} -> VectorSpace K) (a : forall (t : {n : nat | n < N}), (T t) -> (VT K (V t))), (forall (k : {n : nat | n < N}), (BasisVS K (V k) (T k) (a k))) -> (BasisVS K (DirectProdVS K {n : nat | n < N} V) (sumT {n : nat | n < N} T) (DirectProdSystemVS K {n : nat | n < N} T V a)). Proof. move=> K N T V a H1. suff: (forall (v : DirectSumField K (sumT {n : nat | n < N} T)) (m : {n : nat | n < N}), Finite (T m) (fun (t : T m) => proj1_sig v (inT {n : nat | n < N} T m t) <> FO K)). move=> H2. suff: (forall (v : DirectSumField K (sumT {n : nat | n < N} T)) (m : {n : nat | n < N}), MySumF2 (T m) (exist (Finite (T m)) (fun t0 : T m => proj1_sig v (inT {n : nat | n < N} T m t0) <> FO K) (H2 v m)) (VSPCM K (V m)) (fun t0 : T m => Vmul K (V m) (proj1_sig v (inT {n : nat | n < N} T m t0)) (a m t0)) = (MySumF2 (sumT {n : nat | n < N} T) (exist (Finite (sumT {n : nat | n < N} T)) (fun t : sumT {n : nat | n < N} T => proj1_sig v t <> FO K) (proj2_sig v)) (VSPCM K (DirectProdVS K {n : nat | n < N} V)) (fun t : sumT {n : nat | n < N} T => Vmul K (DirectProdVS K {n : nat | n < N} V) (proj1_sig v t) (DirectProdSystemVS K {n : nat | n < N} T V a t))) m). move=> H3. apply (InjSurjBij (DirectSumField K (sumT {n : nat | n < N} T)) (VT K (DirectProdVS K {n : nat | n < N} V))). move=> v1 v2 H4. apply sig_map. apply functional_extensionality. elim. move=> m t. suff: (exist (fun (G : T m -> FT K) => Finite (T m) (fun t : T m => G t <> FO K)) (fun (t : T m) => proj1_sig v1 (inT {n : nat | n < N} T m t)) (H2 v1 m) = exist (fun (G : T m -> FT K) => Finite (T m) (fun t : T m => G t <> FO K)) (fun (t : T m) => proj1_sig v2 (inT {n : nat | n < N} T m t)) (H2 v2 m)). move=> H5. suff: (proj1_sig v1 (inT {n : nat | n < N} T m t) = proj1_sig (exist (fun G : T m -> FT K => Finite (T m) (fun t : T m => G t <> FO K)) (fun t : T m => proj1_sig v1 (inT {n : nat | n < N} T m t)) (H2 v1 m)) t). move=> H6. rewrite H6. rewrite H5. reflexivity. reflexivity. apply (BijInj (DirectSumField K (T m)) (VT K (V m)) (fun (g : DirectSumField K (T m)) => MySumF2 (T m) (exist (Finite (T m)) (fun t : T m => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (V m)) (fun t : T m => Vmul K (V m) (proj1_sig g t) (a m t)))). apply (H1 m). simpl. rewrite (H3 v1 m). rewrite (H3 v2 m). rewrite H4. reflexivity. suff: (forall (m : {n : nat | n < N}), {f : (VT K (V m)) -> (DirectSumField K (T m)) | (forall (x : DirectSumField K (T m)), f ((fun g : DirectSumField K (T m) => MySumF2 (T m) (exist (Finite (T m)) (fun t : T m => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (V m)) (fun t : T m => Vmul K (V m) (proj1_sig g t) (a m t))) x) = x) /\ (forall (y : VT K (V m)), (fun g : DirectSumField K (T m) => MySumF2 (T m) (exist (Finite (T m)) (fun t : T m => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (V m)) (fun t : T m => Vmul K (V m) (proj1_sig g t) (a m t))) (f y) = y)}). move=> H4 v. suff: (Finite (sumT {n : nat | n < N} T) (fun (t : sumT {n : nat | n < N} T) => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 end <> FO K)). move=> H5. exists (exist (fun (G : (sumT {n : nat | n < N} T) -> (FT K)) => Finite (sumT {n : nat | n < N} T) (fun t : (sumT {n : nat | n < N} T) => G t <> FO K)) (fun (t : sumT {n : nat | n < N} T) => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 end) H5). apply functional_extensionality_dep. move=> m. simpl. rewrite - (H3 (exist (fun (G : (sumT {n : nat | n < N} T) -> (FT K)) => Finite (sumT {n : nat | n < N} T) (fun t : (sumT {n : nat | n < N} T) => G t <> FO K)) (fun (t : sumT {n : nat | n < N} T) => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 end) H5) m). simpl. suff: ((H2 (exist (fun G : sumT {n : nat | n < N} T -> FT K => Finite (sumT {n : nat | n < N} T) (fun t : sumT {n : nat | n < N} T => G t <> FO K)) (fun t : sumT {n : nat | n < N} T => match t with | inT m0 t0 => proj1_sig (proj1_sig (H4 m0) (v m0)) t0 end) H5) m) = (proj2_sig (proj1_sig (H4 m) (v m)))). move=> H6. rewrite H6. apply (proj2 (proj2_sig (H4 m)) (v m)). apply proof_irrelevance. suff: (forall (k : nat), k <= N -> Finite (sumT {n : nat | n < N} T) (fun t : sumT {n : nat | n < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ proj1_sig m < k end)). move=> H5. suff: ( (fun t : sumT {n : nat | n < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 end <> FO K) = (fun t : sumT {n : nat | n < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ proj1_sig m < N end)). move=> H6. rewrite H6. apply (H5 N (le_n N)). apply Extensionality_Ensembles. apply conj. unfold Included. unfold In. elim. move=> m t H6. apply conj. apply H6. apply (proj2_sig m). unfold Included. unfold In. elim. move=> m t H6. apply (proj1 H6). suff: (forall (m0 : {n : nat | n < N}), Finite (sumT {n : nat | n < N} T) (fun t : sumT {n : nat | n < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ m = m0 end)). move=> H5. elim. move=> H6. suff: ((fun t : sumT {n : nat | n < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ proj1_sig m < 0 end) = Empty_set (sumT {n : nat | n < N} T)). move=> H7. rewrite H7. apply (Empty_is_finite (sumT {n : nat | n < N} T)). apply Extensionality_Ensembles. apply conj. elim. move=> m t. elim. move=> H7 H8. apply False_ind. apply (lt_not_le (proj1_sig m) 0 H8 (le_0_n (proj1_sig m))). move=> t. elim. move=> k H6 H7. suff: ((fun t : sumT {n0 : nat | n0 < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ proj1_sig m < S k end) = Union (sumT {n0 : nat | n0 < N} T) (fun t : sumT {n0 : nat | n0 < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ proj1_sig m < k end) (fun t : sumT {n : nat | n < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ m = (exist (fun (n : nat) => n < N) k H7) end)). move=> H8. rewrite H8. apply (Union_preserves_Finite (sumT {n : nat | n < N} T) (fun t : sumT {n0 : nat | n0 < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ proj1_sig m < k end) (fun t : sumT {n : nat | n < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ m = exist (fun n : nat => n < N) k H7 end)). apply H6. apply (le_trans k (S k) N (le_S k k (le_n k)) H7). apply (H5 (exist (fun n : nat => n < N) k H7)). apply Extensionality_Ensembles. apply conj. unfold Included. unfold In. elim. move=> m t H8. elim (le_lt_or_eq (proj1_sig m) k). move=> H9. left. apply conj. apply (proj1 H8). apply H9. move=> H9. right. apply conj. apply (proj1 H8). apply sig_map. apply H9. apply (le_S_n (proj1_sig m) k (proj2 H8)). move=> t. elim. elim. move=> m t0 H8. apply conj. apply (proj1 H8). apply (le_trans (S (proj1_sig m)) k (S k) (proj2 H8) (le_S k k (le_n k))). elim. move=> m t0 H8. apply conj. apply (proj1 H8). rewrite (proj2 H8). apply (le_n (S k)). move=> m0. suff: ((fun t : sumT {n : nat | n < N} T => match t with | inT m t0 => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K /\ m = m0 end) = Im (T m0) (sumT {n : nat | n < N} T) (fun t0 : T m0 => proj1_sig (proj1_sig (H4 m0) (v m0)) t0 <> FO K) (inT {n : nat | n < N} T m0)). move=> H5. rewrite H5. apply (finite_image (T m0) (sumT {n : nat | n < N} T) (fun t0 : T m0 => proj1_sig (proj1_sig (H4 m0) (v m0)) t0 <> FO K) (inT {n : nat | n < N} T m0)). apply (proj2_sig (proj1_sig (H4 m0) (v m0))). apply Extensionality_Ensembles. apply conj. elim. move=> m t H5. rewrite - (proj2 H5). apply (Im_intro (T m) (sumT {n : nat | n < N} T) (fun t0 : T m => proj1_sig (proj1_sig (H4 m) (v m)) t0 <> FO K) (inT {n : nat | n < N} T m) t). apply (proj1 H5). reflexivity. move=> t. elim. move=> t0 H5 y H6. rewrite H6. apply conj. apply H5. reflexivity. move=> m. apply constructive_definite_description. apply (proj1 (unique_existence (fun x : VT K (V m) -> DirectSumField K (T m) => (forall x0 : DirectSumField K (T m), x (MySumF2 (T m) (exist (Finite (T m)) (fun t : T m => proj1_sig x0 t <> FO K) (proj2_sig x0)) (VSPCM K (V m)) (fun t : T m => Vmul K (V m) (proj1_sig x0 t) (a m t))) = x0) /\ (forall y : VT K (V m), MySumF2 (T m) (exist (Finite (T m)) (fun t : T m => proj1_sig (x y) t <> FO K) (proj2_sig (x y))) (VSPCM K (V m)) (fun t : T m => Vmul K (V m) (proj1_sig (x y) t) (a m t)) = y)))). apply conj. apply (H1 m). move=> x1 x2 H4 H5. apply functional_extensionality. move=> v. unfold BasisVS in H1. apply (BijInj (DirectSumField K (T m)) (VT K (V m)) (fun g : DirectSumField K (T m) => MySumF2 (T m) (exist (Finite (T m)) (fun t : T m => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (V m)) (fun t : T m => Vmul K (V m) (proj1_sig g t) (a m t))) (H1 m)). rewrite (proj2 H5 v). apply (proj2 H4 v). move=> v m. rewrite (MySumF2Excluded (sumT {n : nat | n < N} T) (VSPCM K (DirectProdVS K {n : nat | n < N} V)) (fun t : sumT {n : nat | n < N} T => Vmul K (DirectProdVS K {n : nat | n < N} V) (proj1_sig v t) (DirectProdSystemVS K {n : nat | n < N} T V a t)) (exist (Finite (sumT {n : nat | n < N} T)) (fun t : sumT {n : nat | n < N} T => proj1_sig v t <> FO K) (proj2_sig v)) (fun t : sumT {n : nat | n < N} T => match t with | inT m0 _ => m0 = m end)). simpl. unfold DirectProdVSVadd. suff: (MySumF2 (sumT {n : nat | n < N} T) (FiniteIntersection (sumT {n : nat | n < N} T) (exist (Finite (sumT {n : nat | n < N} T)) (fun t : sumT {n : nat | n < N} T => proj1_sig v t <> FO K) (proj2_sig v)) (Complement (sumT {n : nat | n < N} T) (fun t : sumT {n : nat | n < N} T => match t with | inT m0 _ => m0 = m end))) (VSPCM K (DirectProdVS K {n : nat | n < N} V)) (fun t : sumT {n : nat | n < N} T => DirectProdVSVmul K {n : nat | n < N} V (proj1_sig v t) (DirectProdSystemVS K {n : nat | n < N} T V a t)) m = VO K (V m)). move=> H3. rewrite H3. rewrite (Vadd_O_r K (V m)). suff: ((FiniteIntersection (sumT {n : nat | n < N} T) (exist (Finite (sumT {n : nat | n < N} T)) (fun t : sumT {n : nat | n < N} T => proj1_sig v t <> FO K) (proj2_sig v)) (fun t : sumT {n : nat | n < N} T => match t with | inT m0 _ => m0 = m end)) = FiniteIm (T m) (sumT {n : nat | n < N} T) (inT {n : nat | n < N} T m) (exist (Finite (T m)) (fun t0 : T m => proj1_sig v (inT {n : nat | n < N} T m t0) <> FO K) (H2 v m))). move=> H4. rewrite H4. apply (FiniteSetInduction (T m) (exist (Finite (T m)) (fun t0 : T m => proj1_sig v (inT {n : nat | n < N} T m t0) <> FO K) (H2 v m))). apply conj. suff: ((FiniteIm (T m) (sumT {n : nat | n < N} T) (inT {n : nat | n < N} T m) (FiniteEmpty (T m))) = (FiniteEmpty (sumT {n : nat | n < N} T))). move=> H5. rewrite H5. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> t. elim. move=> t0. elim. move=> t. elim. move=> B b H5 H6 H7 H8. suff: ((FiniteIm (T m) (sumT {n : nat | n < N} T) (inT {n : nat | n < N} T m) (FiniteAdd (T m) B b)) = (FiniteAdd (sumT {n : nat | n < N} T) (FiniteIm (T m) (sumT {n : nat | n < N} T) (inT {n : nat | n < N} T m) B) (inT {n : nat | n < N} T m b))). move=> H9. rewrite H9. rewrite MySumF2Add. rewrite MySumF2Add. simpl. unfold DirectProdVSVadd. rewrite H8. unfold DirectProdVSVmul. elim (excluded_middle_informative (m = m)). move=> H10. suff: (b = (TypeEqConvert (T m) (T m) (f_equal T H10) b)). move=> H11. rewrite - H11. reflexivity. apply JMeq_eq. apply (proj2_sig (TypeEqConvertExist (T m) (T m) (f_equal T H10)) b). move=> H10. apply False_ind. apply H10. reflexivity. move=> H10. suff: (~ In (T m) (proj1_sig B) b). suff: (b = let temp := (fun (t : (sumT {n : nat | n < N} T)) => match t with | inT m0 t0 => match excluded_middle_informative (m0 = m) with | left H => TypeEqConvert (T m0) (T m) (f_equal T H) t0 | right _ => b end end) in temp (inT {n : nat | n < N} T m b)). move=> H11. rewrite H11. elim H10. move=> x H12 y H13. rewrite H13. simpl. elim (excluded_middle_informative (m = m)). move=> H14. suff: (x = (TypeEqConvert (T m) (T m) (f_equal T H14) x)). move=> H15. rewrite - H15. move=> H16. apply (H16 H12). apply JMeq_eq. apply (proj2_sig (TypeEqConvertExist (T m) (T m) (f_equal T H14)) x). move=> H14 H15. apply H14. reflexivity. simpl. elim (excluded_middle_informative (m = m)). move=> H11. apply JMeq_eq. apply (proj2_sig (TypeEqConvertExist (T m) (T m) (f_equal T H11)) b). move=> H11. reflexivity. apply H7. apply H7. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> t. elim. move=> t0 H9 y H10. rewrite H10. elim H9. move=> t1 H11. left. apply (Im_intro (T m) (sumT {n : nat | n < N} T) (proj1_sig B) (inT {n : nat | n < N} T m) t1 H11). reflexivity. move=> t1. elim. right. apply (In_singleton (sumT {n : nat | n < N} T) (inT {n : nat | n < N} T m b)). move=> t. elim. move=> t0. elim. move=> t1 H9 y H10. rewrite H10. apply (Im_intro (T m) (sumT {n : nat | n < N} T) (proj1_sig (FiniteAdd (T m) B b)) (inT {n : nat | n < N} T m) t1). left. apply H9. reflexivity. move=> t0. elim. apply (Im_intro (T m) (sumT {n : nat | n < N} T) (proj1_sig (FiniteAdd (T m) B b)) (inT {n : nat | n < N} T m) b). right. apply (In_singleton (T m) b). reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> t. elim. unfold In. elim. move=> m0 t0 H4. simpl. rewrite - H4. move=> H5. apply (Im_intro (T m0) (sumT {n : nat | n < N} T) (fun t1 : T m0 => proj1_sig v (inT {n : nat | n < N} T m0 t1) <> FO K) (inT {n : nat | n < N} T m0) t0). apply H5. reflexivity. move=> t. elim. move=> t0 H4 y H5. rewrite H5. simpl. apply Intersection_intro. reflexivity. apply H4. apply (FiniteSetInduction (sumT {n : nat | n < N} T) (FiniteIntersection (sumT {n : nat | n < N} T) (exist (Finite (sumT {n : nat | n < N} T)) (fun t : sumT {n : nat | n < N} T => proj1_sig v t <> FO K) (proj2_sig v)) (Complement (sumT {n : nat | n < N} T) (fun t : sumT {n : nat | n < N} T => match t with | inT m0 _ => m0 = m end)))). apply conj. rewrite MySumF2Empty. reflexivity. move=> B b H3 H4 H5 H6. rewrite MySumF2Add. simpl. unfold DirectProdVSVadd. rewrite H6. unfold DirectProdSystemVS. suff: (~ In (sumT {n : nat | n < N} T) (fun t : sumT {n : nat | n < N} T => match t with | inT m0 _ => m0 = m end) b). unfold In. unfold DirectProdVSVmul. elim b. move=> m0 t0 H7. elim (excluded_middle_informative (m0 = m)). move=> H8. apply False_ind. apply (H7 H8). move=> H8. rewrite (Vmul_O_r K (V m) (proj1_sig v (inT {n : nat | n < N} T m0 t0))). apply (Vadd_O_r K (V m)). elim H4. move=> t H7 H8 H9. apply (H7 H9). apply H5. move=> v m. elim (proj2 (CountFiniteBijective {m : sumT {n : nat | n < N} T | proj1_sig v m <> FO K})). move=> n. elim. move=> f. elim. move=> g H2. apply FiniteSigSame. apply (CountFiniteInjective {t : T m | proj1_sig v (inT {n0 : nat | n0 < N} T m t) <> FO K} n (fun (t : {t : T m | proj1_sig v (inT {n0 : nat | n0 < N} T m t) <> FO K}) => g (exist (fun (m : sumT {n : nat | n < N} T) => proj1_sig v m <> FO K) (inT {n0 : nat | n0 < N} T m (proj1_sig t)) (proj2_sig t)))). move=> m1 m2 H3. suff: ((exist (fun m : sumT {n : nat | n < N} T => proj1_sig v m <> FO K) (inT {n0 : nat | n0 < N} T m (proj1_sig m1)) (proj2_sig m1)) = (exist (fun m : sumT {n : nat | n < N} T => proj1_sig v m <> FO K) (inT {n0 : nat | n0 < N} T m (proj1_sig m2)) (proj2_sig m2))). move=> H4. apply sig_map. suff: (proj1_sig m1 = (fun (t : sumT {n : nat | n < N} T) => match t with | inT m3 t0 => match excluded_middle_informative (m3 = m) with | left H => (TypeEqConvert (T m3) (T m) (f_equal T H) t0) | right _ => proj1_sig m1 end end) (proj1_sig (exist (fun m : sumT {n : nat | n < N} T => proj1_sig v m <> FO K) (inT {n0 : nat | n0 < N} T m (proj1_sig m1)) (proj2_sig m1)))). move=> H5. rewrite H5. rewrite H4. simpl. elim (excluded_middle_informative (m = m)). move=> H6. apply JMeq_eq. apply JMeq_sym. apply (proj2_sig (TypeEqConvertExist (T m) (T m) (f_equal T H6)) (proj1_sig m2)). move=> H6. apply False_ind. apply H6. reflexivity. simpl. elim (excluded_middle_informative (m = m)). move=> H5. apply JMeq_eq. apply (proj2_sig (TypeEqConvertExist (T m) (T m) (f_equal T H5)) (proj1_sig m1)). move=> H5. reflexivity. rewrite - (proj2 H2 (exist (fun m0 : sumT {n0 : nat | n0 < N} T => proj1_sig v m0 <> FO K) (inT {n0 : nat | n0 < N} T m (proj1_sig m1)) (proj2_sig m1))). rewrite H3. apply (proj2 H2 (exist (fun m : sumT {n : nat | n < N} T => proj1_sig v m <> FO K) (inT {n0 : nat | n0 < N} T m (proj1_sig m2)) (proj2_sig m2))). apply (FiniteSigSame (sumT {n : nat | n < N} T)). apply (proj2_sig v). Qed. Definition SubspaceVS (K : Field) (V : VectorSpace K) := fun (W : Ensemble (VT K V)) => (forall (v1 v2 : VT K V), In (VT K V) W v1 -> In (VT K V) W v2 -> In (VT K V) W (Vadd K V v1 v2)) /\ (forall (f : FT K) (v : VT K V), In (VT K V) W v -> In (VT K V) W (Vmul K V f v)) /\ (In (VT K V) W (VO K V)). Lemma SubspaceMakeVSVoppSub : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)), (SubspaceVS K V W) -> forall (v : VT K V), (In (VT K V) W v) -> (In (VT K V) W (Vopp K V v)). Proof. move=> K V W H1 v H2. rewrite - (Vmul_I_l K V (Vopp K V v)). rewrite - (Vopp_mul_distr_r K V (FI K) v). rewrite (Vopp_mul_distr_l K V (FI K) v). apply (proj1 (proj2 H1) (Fopp K (FI K)) v H2). Qed. Definition SubspaceMakeVST (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) := {x : (VT K V) | In (VT K V) W x}. Definition SubspaceMakeVSVO (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) := (exist W (VO K V) (proj2 (proj2 H))). Definition SubspaceMakeVSVadd (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) := fun (v1 v2 : SubspaceMakeVST K V W H) => (exist W (Vadd K V (proj1_sig v1) (proj1_sig v2)) (proj1 H (proj1_sig v1) (proj1_sig v2) (proj2_sig v1) (proj2_sig v2))). Definition SubspaceMakeVSVmul (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) := fun (f : FT K) (v : SubspaceMakeVST K V W H) => (exist W (Vmul K V f (proj1_sig v)) (proj1 (proj2 H) f (proj1_sig v) (proj2_sig v))). Definition SubspaceMakeVSVopp (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) := fun (v : SubspaceMakeVST K V W H) => (exist W (Vopp K V (proj1_sig v)) (SubspaceMakeVSVoppSub K V W H (proj1_sig v) (proj2_sig v))). Lemma SubspaceMakeVSVadd_comm : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (v1 v2 : SubspaceMakeVST K V W H), SubspaceMakeVSVadd K V W H v1 v2 = SubspaceMakeVSVadd K V W H v2 v1. Proof. move=> K V W H1 v1 v2. apply sig_map. apply (Vadd_comm K V (proj1_sig v1) (proj1_sig v2)). Qed. Lemma SubspaceMakeVSVadd_assoc : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (v1 v2 v3 : SubspaceMakeVST K V W H), SubspaceMakeVSVadd K V W H (SubspaceMakeVSVadd K V W H v1 v2) v3 = SubspaceMakeVSVadd K V W H v1 (SubspaceMakeVSVadd K V W H v2 v3). Proof. move=> K V W H1 v1 v2 v3. apply sig_map. apply (Vadd_assoc K V (proj1_sig v1) (proj1_sig v2) (proj1_sig v3)). Qed. Lemma SubspaceMakeVSVadd_O_l : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (v : SubspaceMakeVST K V W H), SubspaceMakeVSVadd K V W H (SubspaceMakeVSVO K V W H) v = v. Proof. move=> K V W H1 v. apply sig_map. apply (Vadd_O_l K V (proj1_sig v)). Qed. Lemma SubspaceMakeVSVadd_opp_r : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (v : SubspaceMakeVST K V W H), SubspaceMakeVSVadd K V W H v (SubspaceMakeVSVopp K V W H v) = SubspaceMakeVSVO K V W H. Proof. move=> K V W H1 v. apply sig_map. apply (Vadd_opp_r K V (proj1_sig v)). Qed. Lemma SubspaceMakeVSVmul_add_distr_l : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (f : FT K) (v1 v2 : SubspaceMakeVST K V W H), SubspaceMakeVSVmul K V W H f (SubspaceMakeVSVadd K V W H v1 v2) = (SubspaceMakeVSVadd K V W H (SubspaceMakeVSVmul K V W H f v1) (SubspaceMakeVSVmul K V W H f v2)). Proof. move=> K V W H1 f v1 v2. apply sig_map. apply (Vmul_add_distr_l K V f (proj1_sig v1) (proj1_sig v2)). Qed. Lemma SubspaceMakeVSVmul_add_distr_r : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (f1 f2 : FT K) (v : SubspaceMakeVST K V W H), (SubspaceMakeVSVmul K V W H (Fadd K f1 f2) v) = (SubspaceMakeVSVadd K V W H (SubspaceMakeVSVmul K V W H f1 v) (SubspaceMakeVSVmul K V W H f2 v)). Proof. move=> K V W H f1 f2 v. apply sig_map. apply (Vmul_add_distr_r K V f1 f2 (proj1_sig v)). Qed. Lemma SubspaceMakeVSVmul_assoc : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (f1 f2 : FT K) (v : SubspaceMakeVST K V W H), (SubspaceMakeVSVmul K V W H f1 (SubspaceMakeVSVmul K V W H f2 v)) = (SubspaceMakeVSVmul K V W H (Fmul K f1 f2) v). Proof. move=> K V W H f1 f2 v. apply sig_map. apply (Vmul_assoc K V f1 f2 (proj1_sig v)). Qed. Lemma SubspaceMakeVSVmul_I_l : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (v : SubspaceMakeVST K V W H), (SubspaceMakeVSVmul K V W H (FI K) v) = v. Proof. move=> K V W H v. apply sig_map. apply (Vmul_I_l K V (proj1_sig v)). Qed. Definition SubspaceMakeVS (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) := mkVectorSpace K (SubspaceMakeVST K V W H) (SubspaceMakeVSVO K V W H) (SubspaceMakeVSVadd K V W H) (SubspaceMakeVSVmul K V W H) (SubspaceMakeVSVopp K V W H) (SubspaceMakeVSVadd_comm K V W H) (SubspaceMakeVSVadd_assoc K V W H) (SubspaceMakeVSVadd_O_l K V W H) (SubspaceMakeVSVadd_opp_r K V W H) (SubspaceMakeVSVmul_add_distr_l K V W H) (SubspaceMakeVSVmul_add_distr_r K V W H) (SubspaceMakeVSVmul_assoc K V W H) (SubspaceMakeVSVmul_I_l K V W H). Definition BasisSubspaceVS (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (T : Type) (F : T -> VT K V) := exists (H1 : forall (t : T), In (VT K V) W (F t)), BasisVS K (SubspaceMakeVS K V W H) T (fun (t : T) => exist W (F t) (H1 t)). Lemma FullsetSubspaceVS : forall (K : Field) (V : VectorSpace K), SubspaceVS K V (Full_set (VT K V)). Proof. move=> K V. apply conj. move=> v1 v2 H1 H2. apply (Full_intro (VT K V) (Vadd K V v1 v2)). apply conj. move=> f v H1. apply (Full_intro (VT K V) (Vmul K V f v)). apply (Full_intro (VT K V) (VO K V)). Qed. Lemma VOSubspaceVS : forall (K : Field) (V : VectorSpace K), SubspaceVS K V (Singleton (VT K V) (VO K V)). Proof. move=> K V. apply conj. move=> v1 v2. elim. elim. rewrite (Vadd_O_l K V (VO K V)). apply (In_singleton (VT K V) (VO K V)). apply conj. move=> f v. elim. rewrite (Vmul_O_r K V f). apply (In_singleton (VT K V) (VO K V)). apply (In_singleton (VT K V) (VO K V)). Qed. Lemma SingleSubspaceVS : forall (K : Field) (V : VectorSpace K) (v : VT K V), SubspaceVS K V (fun (v0 : VT K V) => exists (f : FT K), v0 = Vmul K V f v). Proof. move=> K V v. apply conj. move=> v1 v2. elim. move=> f1 H1. elim. move=> f2 H2. exists (Fadd K f1 f2). rewrite H1. rewrite H2. rewrite (Vmul_add_distr_r K V f1 f2 v). reflexivity. apply conj. move=> f v0. elim. move=> g H1. exists (Fmul K f g). rewrite H1. apply (Vmul_assoc K V f g v). exists (FO K). rewrite (Vmul_O_l K V v). reflexivity. Qed. Lemma Formula_P18_1 : forall (K : Field) (V : VectorSpace K) (x : VT K V) (H : SubspaceVS K V (fun (v0 : VT K V) => exists (f : FT K), v0 = Vmul K V f x)), x <> VO K V -> BasisSubspaceVS K V (fun (v0 : VT K V) => exists (f : FT K), v0 = Vmul K V f x) H {n : nat | n < S O} (fun (m : {n : nat | n < S O}) => x). Proof. move=> K V x H1 H2. unfold BasisSubspaceVS. suff: (forall (m : {n : nat | n < S O}), In (VT K V) (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f x) x). move=> H3. exists H3. apply FiniteBasisVS. move=> v. apply (proj1 (unique_existence (fun (a : Count 1 -> FT K) => v = MySumF2 (Count 1) (exist (Finite (Count 1)) (Full_set (Count 1)) (CountFinite 1)) (VSPCM K (SubspaceMakeVS K V (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f x) H1)) (fun n : Count 1 => Vmul K (SubspaceMakeVS K V (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f x) H1) (a n) (exist (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f x) x (H3 n)))))). apply conj. elim (proj2_sig v). move=> f H4. exists (fun (n : Count 1) => f). suff: ((exist (Finite (Count 1)) (Full_set (Count 1)) (CountFinite 1)) = FiniteSingleton (Count 1) (exist (fun (n : nat) => n < S O) O (le_n (S O)))). move=> H5. rewrite H5. rewrite MySumF2Singleton. apply sig_map. apply H4. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> n H5. suff: ((exist (fun n : nat => n < 1) 0 (le_n 1)) = n). move=> H6. rewrite H6. apply In_singleton. apply sig_map. simpl. elim (le_lt_or_eq (proj1_sig n) O). move=> H6. apply False_ind. apply (le_not_lt O (proj1_sig n)). apply le_0_n. apply H6. move=> H6. rewrite H6. reflexivity. apply (le_S_n (proj1_sig n) O (proj2_sig n)). move=> t H5. apply (Full_intro (Count 1) t). suff: (forall (x0 : Count 1 -> FT K), proj1_sig (MySumF2 (Count 1) (exist (Finite (Count 1)) (Full_set (Count 1)) (CountFinite 1)) (VSPCM K (SubspaceMakeVS K V (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f x) H1)) (fun n : Count 1 => Vmul K (SubspaceMakeVS K V (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f x) H1) (x0 n) (exist (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f x) x (H3 n)))) = Vmul K V (x0 (exist (fun n : nat => n < 1) 0 (le_n 1))) x). move=> H4 x1 x2 H5 H6. apply functional_extensionality. move=> n. suff: (n = (exist (fun n : nat => n < 1) 0 (le_n 1))). move=> H7. apply (Vmul_eq_reg_r K V x (x1 n) (x2 n)). rewrite H7. rewrite - (H4 x1). rewrite - (H4 x2). rewrite - H5. rewrite - H6. reflexivity. apply H2. apply sig_map. elim (le_lt_or_eq (proj1_sig n) O). move=> H7. apply False_ind. apply (le_not_lt O (proj1_sig n)). apply le_0_n. apply H7. apply. apply (le_S_n (proj1_sig n) O (proj2_sig n)). move=> x0. suff: ((exist (Finite (Count 1)) (Full_set (Count 1)) (CountFinite 1)) = FiniteSingleton (Count 1) (exist (fun (n : nat) => n < S O) O (le_n (S O)))). move=> H4. rewrite H4. rewrite MySumF2Singleton. reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> n H4. suff: ((exist (fun n : nat => n < 1) 0 (le_n 1)) = n). move=> H5. rewrite H5. apply In_singleton. apply sig_map. elim (le_lt_or_eq (proj1_sig n) O). move=> H5. apply False_ind. apply (le_not_lt O (proj1_sig n)). apply le_0_n. apply H5. move=> H5. rewrite H5. reflexivity. apply (le_S_n (proj1_sig n) O (proj2_sig n)). move=> t H4. apply (Full_intro (Count 1) t). move=> m. exists (FI K). rewrite (Vmul_I_l K V x). reflexivity. Qed. Lemma Formula_P18_1_exists : forall (K : Field) (V : VectorSpace K) (x : VT K V), exists (H : SubspaceVS K V (fun (v0 : VT K V) => exists (f : FT K), v0 = Vmul K V f x)), x <> VO K V -> BasisSubspaceVS K V (fun (v0 : VT K V) => exists (f : FT K), v0 = Vmul K V f x) H {n : nat | n < S O} (fun (m : {n : nat | n < S O}) => x). Proof. move=> K V x. exists (SingleSubspaceVS K V x). apply (Formula_P18_1 K V x (SingleSubspaceVS K V x)). Qed. Lemma Formula_P18_2 : forall (K : Field) (V : VectorSpace K) (x : VT K V), x = VO K V -> (fun (v0 : VT K V) => exists (f : FT K), v0 = Vmul K V f x) = (Singleton (VT K V) (VO K V)). Proof. move=> K V x H1. rewrite H1. apply Extensionality_Ensembles. apply conj. move=> t. elim. move=> k H2. rewrite H2. rewrite (Vmul_O_r K V k). apply In_singleton. move=> t. elim. exists (FO K). rewrite (Vmul_O_r K V (FO K)). reflexivity. Qed. Inductive SumEnsembleVS (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) : Ensemble (VT K V) := | SumEnsembleVS_intro : forall (x1 x2 : VT K V), In (VT K V) W1 x1 -> In (VT K V) W2 x2 -> In (VT K V) (SumEnsembleVS K V W1 W2) (Vadd K V x1 x2). Lemma SumSubspaceVS : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)), SubspaceVS K V W1 -> SubspaceVS K V W2 -> SubspaceVS K V (SumEnsembleVS K V W1 W2). Proof. move=> K V W1 W2 H1 H2. apply conj. move=> v1 v2. elim. move=> w11 w12 H3 H4. elim. move=> w21 w22 H5 H6. rewrite - (Vadd_assoc K V (Vadd K V w11 w12) w21 w22). rewrite (Vadd_comm K V (Vadd K V w11 w12) w21). rewrite - (Vadd_assoc K V w21 w11 w12). rewrite (Vadd_assoc K V (Vadd K V w21 w11) w12 w22). apply (SumEnsembleVS_intro K V W1 W2 (Vadd K V w21 w11) (Vadd K V w12 w22)). apply (proj1 H1 w21 w11 H5 H3). apply (proj1 H2 w12 w22 H4 H6). apply conj. move=> f v. elim. move=> v1 v2 H3 H4. rewrite (Vmul_add_distr_l K V f v1 v2). apply (SumEnsembleVS_intro K V W1 W2 (Vmul K V f v1) (Vmul K V f v2)). apply (proj1 (proj2 H1) f v1 H3). apply (proj1 (proj2 H2) f v2 H4). rewrite - (Vadd_O_r K V (VO K V)). apply (SumEnsembleVS_intro K V W1 W2 (VO K V) (VO K V)). apply (proj2 (proj2 H1)). apply (proj2 (proj2 H2)). Qed. Inductive SumTEnsembleVS (K : Field) (V : VectorSpace K) (T : Type) (W : T -> Ensemble (VT K V)) : Ensemble (VT K V) := | SumTEnsembleVS_intro : forall (a : T -> VT K V) (H : Finite T (fun (t : T) => a t <> VO K V)), (forall (t : T), In (VT K V) (W t) (a t)) -> In (VT K V) (SumTEnsembleVS K V T W) (MySumF2 T (exist (Finite T) (fun (t : T) => a t <> VO K V) H) (VSPCM K V) a). Lemma FiniteSumTEnsembleVS : forall (K : Field) (V : VectorSpace K) (N : nat) (W : {n : nat | n < N} -> Ensemble (VT K V)), SumTEnsembleVS K V {n : nat | n < N} W = (fun (t : VT K V) => exists (a : {n : nat | n < N} -> VT K V), (forall (m : {n : nat | n < N}), In (VT K V) (W m) (a m)) /\ (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) a = t)). Proof. move=> K V N W. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> a H1 H2. exists a. apply conj. apply H2. rewrite (MySumF2Included {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => a t <> VO K V) H1) (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) a). rewrite (MySumF2O {n : nat | n < N} (FiniteIntersection {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (Complement {n : nat | n < N} (proj1_sig (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => a t <> VO K V) H1)))) (VSPCM K V) a). apply (Vadd_O_r K V). move=> u. elim. move=> m H3 H4. apply NNPP. apply H3. move=> m H3. apply (Full_intro {n : nat | n < N} m). move=> v. elim. move=> a H1. rewrite - (proj2 H1). suff: (Finite {n : nat | n < N} (fun t : {n : nat | n < N} => a t <> VO K V)). move=> H2. suff: ((MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) a) = (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => a t <> VO K V) H2) (VSPCM K V) a)). move=> H3. rewrite H3. apply (SumTEnsembleVS_intro K V {n : nat | n < N} W a H2). apply (proj1 H1). rewrite (MySumF2Included {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => a t <> VO K V) H2) (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) a). rewrite (MySumF2O {n : nat | n < N} (FiniteIntersection {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (Complement {n : nat | n < N} (proj1_sig (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => a t <> VO K V) H2)))) (VSPCM K V) a). apply (Vadd_O_r K V). move=> u. elim. move=> m H3 H4. apply NNPP. apply H3. move=> m H3. apply (Full_intro {n : nat | n < N} m). apply (Finite_downward_closed {n : nat | n < N} (Full_set {n : nat | n < N}) (CountFinite N)). move=> t H2. apply (Full_intro {n : nat | n < N} t). Qed. Lemma SumTSubspaceVS : forall (K : Field) (V : VectorSpace K) (T : Type) (W : T -> Ensemble (VT K V)), (forall (t : T), SubspaceVS K V (W t)) -> SubspaceVS K V (SumTEnsembleVS K V T W). Proof. move=> K V T W H1. apply conj. move=> v1 v2. elim. move=> w1 H2 H3. elim. move=> w2 H4 H5. suff: (Finite T (fun t : T => Vadd K V (w1 t) (w2 t) <> VO K V)). move=> H6. suff: ((MySumF2 T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (VSPCM K V) w1) = (MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) w1)). move=> H7. rewrite H7. suff: ((MySumF2 T (exist (Finite T) (fun t : T => w2 t <> VO K V) H4) (VSPCM K V) w2) = (MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) w2)). move=> H8. rewrite H8. suff: ((Vadd K V (MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) w1) (MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) w2)) = (MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) (fun (t : T) => Vadd K V (w1 t) (w2 t)))). move=> H9. rewrite H9. suff: ((MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) (fun t : T => Vadd K V (w1 t) (w2 t))) = (MySumF2 T (exist (Finite T) (fun t : T => Vadd K V (w1 t) (w2 t) <> VO K V) H6) (VSPCM K V) (fun t : T => Vadd K V (w1 t) (w2 t)))). move=> H10. rewrite H10. apply (SumTEnsembleVS_intro K V T W (fun (t : T) => Vadd K V (w1 t) (w2 t)) H6). move=> t. apply (proj1 (H1 t) (w1 t) (w2 t)). apply (H3 t). apply (H5 t). rewrite (MySumF2Included T (exist (Finite T) (fun t : T => Vadd K V (w1 t) (w2 t) <> VO K V) H6) (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) (fun t : T => Vadd K V (w1 t) (w2 t))). rewrite (MySumF2O T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (Complement T (proj1_sig (exist (Finite T) (fun t : T => Vadd K V (w1 t) (w2 t) <> VO K V) H6)))) (VSPCM K V) (fun t : T => Vadd K V (w1 t) (w2 t))). apply (Vadd_O_r K V). move=> t. elim. move=> t0 H10 H11. apply NNPP. apply H10. simpl. move=> t H10. apply NNPP. move=> H11. apply H10. suff: (w1 t = VO K V). move=> H12. rewrite H12. suff: (w2 t = VO K V). move=> H13. rewrite H13. apply (Vadd_O_r K V). apply NNPP. move=> H13. apply H11. right. apply H13. apply NNPP. move=> H12. apply H11. left. apply H12. apply (FiniteSetInduction T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. rewrite MySumF2Empty. apply (Vadd_O_r K V (VO K V)). move=> B b H9 H10 H11 H12. rewrite MySumF2Add. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite - H12. rewrite - (Vadd_assoc K V (Vadd K V (MySumF2 T B (VSPCM K V) w1) (w1 b)) (MySumF2 T B (VSPCM K V) w2) (w2 b)). rewrite (Vadd_comm K V (Vadd K V (MySumF2 T B (VSPCM K V) w1) (w1 b)) (MySumF2 T B (VSPCM K V) w2)). rewrite - (Vadd_assoc K V (MySumF2 T B (VSPCM K V) w2) (MySumF2 T B (VSPCM K V) w1) (w1 b)). rewrite (Vadd_assoc K V (Vadd K V (MySumF2 T B (VSPCM K V) w2) (MySumF2 T B (VSPCM K V) w1)) (w1 b) (w2 b)). rewrite (Vadd_comm K V (MySumF2 T B (VSPCM K V) w2) (MySumF2 T B (VSPCM K V) w1)). reflexivity. apply H11. apply H11. apply H11. rewrite (MySumF2Included T (exist (Finite T) (fun t : T => w2 t <> VO K V) H4) (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) w2). rewrite (MySumF2O T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (Complement T (proj1_sig (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)))) (VSPCM K V) w2). simpl. rewrite (Vadd_O_r K V). reflexivity. move=> t. elim. move=> t0 H8 H9. apply NNPP. apply H8. move=> t H8. right. apply H8. rewrite (MySumF2Included T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (VSPCM K V) w1). rewrite (MySumF2O T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => w1 t <> VO K V) H2) (exist (Finite T) (fun t : T => w2 t <> VO K V) H4)) (Complement T (proj1_sig (exist (Finite T) (fun t : T => w1 t <> VO K V) H2)))) (VSPCM K V) w1). simpl. rewrite (Vadd_O_r K V). reflexivity. move=> t. elim. move=> t0 H7 H8. apply NNPP. apply H7. move=> t H7. left. apply H7. apply (Finite_downward_closed T (Union T (fun t : T => w1 t <> VO K V) (fun t : T => w2 t <> VO K V))). apply (Union_preserves_Finite T (fun t : T => w1 t <> VO K V) (fun t : T => w2 t <> VO K V)). apply H2. apply H4. move=> t H6. apply NNPP. move=> H7. apply H6. suff: (w1 t = VO K V). move=> H8. suff: (w2 t = VO K V). move=> H9. rewrite H8. rewrite H9. apply (Vadd_O_r K V (VO K V)). apply NNPP. move=> H9. apply H7. right. apply H9. apply NNPP. move=> H8. apply H7. left. apply H8. apply conj. move=> f v H2. elim (classic (f = FO K)). move=> H3. rewrite H3. rewrite (Vmul_O_l K V v). suff: (Finite T (fun (t : T) => VO K V <> VO K V)). move=> H4. suff: (exist (Finite T) (fun _ : T => VO K V <> VO K V) H4 = FiniteEmpty T). move=> H5. suff: ((MySumF2 T (exist (Finite T) (fun _ : T => VO K V <> VO K V) H4) (VSPCM K V) (fun _ : T => VO K V)) = (VO K V)). move=> H6. rewrite - H6. apply (SumTEnsembleVS_intro K V T W (fun (t : T) => VO K V)). move=> t. apply (proj2 (proj2 (H1 t))). rewrite H5. apply MySumF2Empty. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> t H5. apply False_ind. apply H5. reflexivity. move=> t. elim. suff: ((fun _ : T => VO K V <> VO K V) = Empty_set T). move=> H4. rewrite H4. apply (Empty_is_finite T). apply Extensionality_Ensembles. apply conj. move=> t H4. apply False_ind. apply H4. reflexivity. move=> t. elim. move=> H3. elim H2. move=> a H4 H5. suff: ((fun t : T => Vmul K V f (a t) <> VO K V) = (fun t : T => a t <> VO K V)). move=> H6. suff: (Finite T (fun t : T => Vmul K V f (a t) <> VO K V)). move=> H7. suff: ((Vmul K V f (MySumF2 T (exist (Finite T) (fun t : T => a t <> VO K V) H4) (VSPCM K V) a)) = (MySumF2 T (exist (Finite T) (fun t : T => Vmul K V f (a t) <> VO K V) H7) (VSPCM K V) (fun (t : T) => Vmul K V f (a t)))). move=> H8. rewrite H8. apply (SumTEnsembleVS_intro K V T W (fun t : T => Vmul K V f (a t)) H7). move=> t. apply (proj1 (proj2 (H1 t)) f (a t) (H5 t)). suff: ((exist (Finite T) (fun t : T => a t <> VO K V) H4) = (exist (Finite T) (fun t : T => Vmul K V f (a t) <> VO K V) H7)). move=> H8. rewrite H8. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => Vmul K V f (a t) <> VO K V) H7)). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. apply (Vmul_O_r K V f). move=> B b H9 H10 H11 H12. rewrite MySumF2Add. rewrite MySumF2Add. rewrite - H12. apply (Vmul_add_distr_l K V f (MySumF2 T B (VSPCM K V) a) (a b)). apply H11. apply H11. apply sig_map. simpl. rewrite H6. reflexivity. rewrite H6. apply H4. apply Extensionality_Ensembles. apply conj. move=> t H6 H7. apply H6. rewrite H7. apply (Vmul_O_r K V f). move=> t H6 H7. apply H6. rewrite - (Vmul_I_l K V (a t)). rewrite - (Finv_l K f H3). rewrite - (Vmul_assoc K V (Finv K f) f (a t)). rewrite H7. apply (Vmul_O_r K V (Finv K f)). suff: (Finite T (fun (t : T) => VO K V <> VO K V)). move=> H2. suff: (exist (Finite T) (fun _ : T => VO K V <> VO K V) H2 = FiniteEmpty T). move=> H3. suff: ((MySumF2 T (exist (Finite T) (fun _ : T => VO K V <> VO K V) H2) (VSPCM K V) (fun _ : T => VO K V)) = (VO K V)). move=> H4. rewrite - H4. apply (SumTEnsembleVS_intro K V T W (fun (t : T) => VO K V)). move=> t. apply (proj2 (proj2 (H1 t))). rewrite H3. apply MySumF2Empty. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> t H3. apply False_ind. apply H3. reflexivity. move=> t. elim. suff: ((fun _ : T => VO K V <> VO K V) = Empty_set T). move=> H2. rewrite H2. apply (Empty_is_finite T). apply Extensionality_Ensembles. apply conj. move=> t H2. apply False_ind. apply H2. reflexivity. move=> t. elim. Qed. Lemma IntersectionSubspaceVS : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)), SubspaceVS K V W1 -> SubspaceVS K V W2 -> SubspaceVS K V (Intersection (VT K V) W1 W2). Proof. move=> K V W1 W2 H1 H2. apply conj. move=> v1 v2. elim. move=> v10 H3 H4. elim. move=> v20 H5 H6. apply (Intersection_intro (VT K V) W1 W2 (Vadd K V v10 v20)). apply (proj1 H1 v10 v20 H3 H5). apply (proj1 H2 v10 v20 H4 H6). apply conj. move=> f v. elim. move=> v0 H3 H4. apply (Intersection_intro (VT K V) W1 W2 (Vmul K V f v0)). apply (proj1 (proj2 H1) f v0 H3). apply (proj1 (proj2 H2) f v0 H4). apply (Intersection_intro (VT K V) W1 W2 (VO K V)). apply (proj2 (proj2 H1)). apply (proj2 (proj2 H2)). Qed. Lemma IntersectionTSubspaceVS : forall (K : Field) (V : VectorSpace K) (T : Type) (W : T -> Ensemble (VT K V)), (forall (t : T), SubspaceVS K V (W t)) -> SubspaceVS K V (IntersectionT (VT K V) T W). Proof. move=> K V T W H1. apply conj. move=> v1 v2. elim. move=> v10 H2. elim. move=> v20 H3. apply (IntersectionT_intro (VT K V) T W (Vadd K V v10 v20)). move=> t. apply (proj1 (H1 t) v10 v20 (H2 t) (H3 t)). apply conj. move=> f v. elim. move=> v0 H2. apply (IntersectionT_intro (VT K V) T W (Vmul K V f v0)). move=> t. apply (proj1 (proj2 (H1 t)) f v0 (H2 t)). apply (IntersectionT_intro (VT K V) T W (VO K V)). move=> t. apply (proj2 (proj2 (H1 t))). Qed. Definition SpanVS (K : Field) (V : VectorSpace K) (T : Type) (x : T -> VT K V) := fun (v : VT K V) => exists (a : DirectSumField K T), v = MySumF2 T (exist (Finite T) (fun (t : T) => proj1_sig a t <> FO K) (proj2_sig a)) (VSPCM K V) (fun (t : T) => Vmul K V (proj1_sig a t) (x t)). Lemma BijectiveSaveSpanVS : forall (K : Field) (V : VectorSpace K) (T1 T2 : Type) (F : T1 -> T2) (G : T2 -> VT K V), Bijective T1 T2 F -> SpanVS K V T2 G = SpanVS K V T1 (compose G F). Proof. move=> K V T1 T2 F G H1. elim H1. move=> Finv H2. apply Extensionality_Ensembles. apply conj. suff: (forall (a : DirectSumField K T2), Finite T1 (fun t : T1 => proj1_sig a (F t) <> FO K)). move=> H3. suff: (forall (a : DirectSumField K T2), MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig a t <> FO K) (proj2_sig a)) (VSPCM K V) (fun t : T2 => Vmul K V (proj1_sig a t) (G t)) = MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig a (F t) <> FO K) (H3 a)) (VSPCM K V) (fun t : T1 => Vmul K V (proj1_sig a (F t)) (G (F t)))). move=> H4 t. elim. move=> a H5. rewrite H5. rewrite (H4 a). exists (exist (fun (a0 : T1 -> FT K) => Finite T1 (fun t : T1 => a0 t <> FO K)) (fun t : T1 => proj1_sig a (F t)) (H3 a)). reflexivity. move=> a. rewrite (MySumF2BijectiveSame T1 (exist (Finite T1) (fun t : T1 => proj1_sig a (F t) <> FO K) (H3 a)) T2 (exist (Finite T2) (fun t : T2 => proj1_sig a t <> FO K) (proj2_sig a)) (VSPCM K V) (fun t : T2 => Vmul K V (proj1_sig a t) (G t)) F). reflexivity. simpl. apply InjSurjBij. move=> u1 u2 H4. apply sig_map. rewrite - (proj1 H2 (proj1_sig u1)). suff: (F (proj1_sig u1) = proj1_sig (exist (fun t : T2 => proj1_sig a t <> FO K) (F (proj1_sig u1)) (proj2_sig u1))). move=> H5. rewrite H5. rewrite H4. apply (proj1 H2 (proj1_sig u2)). reflexivity. move=> v. suff: (proj1_sig a (F (Finv (proj1_sig v))) <> FO K). move=> H4. exists (exist (fun (u : T1) => proj1_sig a (F u) <> FO K) (Finv (proj1_sig v)) H4). apply sig_map. apply (proj2 H2 (proj1_sig v)). rewrite (proj2 H2 (proj1_sig v)). apply (proj2_sig v). move=> a. suff: ((fun t : T1 => proj1_sig a (F t) <> FO K) = Im T2 T1 (fun t : T2 => proj1_sig a t <> FO K) Finv). move=> H3. rewrite H3. apply finite_image. apply (proj2_sig a). apply Extensionality_Ensembles. apply conj. move=> t H3. apply (Im_intro T2 T1 (fun t0 : T2 => proj1_sig a t0 <> FO K) Finv (F t)). apply H3. rewrite (proj1 H2 t). reflexivity. move=> t. elim. move=> t0 H3 t1 H4. rewrite H4. unfold In. rewrite (proj2 H2 t0). apply H3. suff: (forall (a : DirectSumField K T1), Finite T2 (fun t : T2 => proj1_sig a (Finv t) <> FO K)). move=> H3. suff: (forall (a : DirectSumField K T1), MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig a t <> FO K) (proj2_sig a)) (VSPCM K V) (fun t : T1 => Vmul K V (proj1_sig a t) (G (F t))) = MySumF2 T2 (exist (Finite T2) (fun t : T2 => proj1_sig a (Finv t) <> FO K) (H3 a)) (VSPCM K V) (fun t : T2 => Vmul K V (proj1_sig a (Finv t)) (G t))). move=> H4 v. elim. move=> a H5. rewrite H5. rewrite (H4 a). exists (exist (fun (a : T2 -> FT K) => Finite T2 (fun t : T2 => a t <> FO K)) (fun t : T2 => proj1_sig a (Finv t)) (H3 a)). reflexivity. move=> a. suff: ((fun t : T1 => Vmul K V (proj1_sig a t) (G (F t))) = (fun t : T1 => Vmul K V (proj1_sig a (Finv (F t))) (G (F t)))). move=> H4. rewrite H4. suff: (forall u : T1, proj1_sig (exist (Finite T1) (fun t : T1 => proj1_sig a t <> FO K) (proj2_sig a)) u -> proj1_sig (exist (Finite T2) (fun t : T2 => proj1_sig a (Finv t) <> FO K) (H3 a)) (F u)). move=> H5. apply (MySumF2BijectiveSame T1 (exist (Finite T1) (fun t : T1 => proj1_sig a t <> FO K) (proj2_sig a)) T2 (exist (Finite T2) (fun t : T2 => proj1_sig a (Finv t) <> FO K) (H3 a)) (VSPCM K V) (fun t : T2 => Vmul K V (proj1_sig a (Finv t)) (G t)) F H5). simpl. apply InjSurjBij. move=> u1 u2 H6. apply sig_map. rewrite - (proj1 H2 (proj1_sig u1)). suff: (F (proj1_sig u1) = proj1_sig (exist (fun t : T2 => proj1_sig a (Finv t) <> FO K) (F (proj1_sig u1)) (H5 (proj1_sig u1) (proj2_sig u1)))). move=> H7. rewrite H7. rewrite H6. apply (proj1 H2 (proj1_sig u2)). reflexivity. move=> u. exists (exist (fun (u : T1) => proj1_sig a u <> FO K) (Finv (proj1_sig u)) (proj2_sig u)). apply sig_map. apply (proj2 H2 (proj1_sig u)). move=> u. simpl. rewrite (proj1 H2 u). apply. apply functional_extensionality. move=> t. rewrite (proj1 H2 t). reflexivity. move=> a. suff: ((fun t : T2 => proj1_sig a (Finv t) <> FO K) = Im T1 T2 (fun t : T1 => proj1_sig a t <> FO K) F). move=> H3. rewrite H3. apply finite_image. apply (proj2_sig a). apply Extensionality_Ensembles. apply conj. move=> t H3. apply (Im_intro T1 T2 (fun t0 : T1 => proj1_sig a t0 <> FO K) F (Finv t)). apply H3. rewrite (proj2 H2 t). reflexivity. move=> t. elim. move=> t0 H3 t1 H4. rewrite H4. unfold In. rewrite (proj1 H2 t0). apply H3. Qed. Lemma FiniteSpanVS : forall (K : Field) (V : VectorSpace K) (N : nat) (x : Count N -> VT K V), SpanVS K V (Count N) x = fun (v : VT K V) => exists (a : Count N -> FT K), v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun (n : Count N) => Vmul K V (a n) (x n)). Proof. move=> K V N x. suff: (forall (a : DirectSumField K (Count N)), MySumF2 (Count N) (exist (Finite (Count N)) (fun t : Count N => proj1_sig a t <> FO K) (proj2_sig a)) (VSPCM K V) (fun t : Count N => Vmul K V (proj1_sig a t) (x t)) = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (proj1_sig a n) (x n))). move=> H1. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> a H2. exists (proj1_sig a). rewrite H2. rewrite (H1 a). reflexivity. move=> v. elim. move=> a H2. suff: (Finite (Count N) (fun (n : Count N) => a n <> FO K)). move=> H3. exists (exist (fun (G : Count N -> FT K) => Finite (Count N) (fun (n : Count N) => G n <> FO K)) a H3). rewrite H2. rewrite (H1 (exist (fun (G : Count N -> FT K) => Finite (Count N) (fun (n : Count N) => G n <> FO K)) a H3)). reflexivity. apply (Finite_downward_closed (Count N) (Full_set (Count N)) (CountFinite N) (fun (n : Count N) => a n <> FO K)). move=> n H3. apply (Full_intro (Count N) n). move=> a. rewrite (MySumF2Included (Count N) (exist (Finite (Count N)) (fun t : Count N => proj1_sig a t <> FO K) (proj2_sig a)) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (proj1_sig a n) (x n))). rewrite (MySumF2O (Count N) (FiniteIntersection (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Complement (Count N) (proj1_sig (exist (Finite (Count N)) (fun t : Count N => proj1_sig a t <> FO K) (proj2_sig a))))) (VSPCM K V) (fun n : Count N => Vmul K V (proj1_sig a n) (x n))). simpl. rewrite (Vadd_O_r K V). reflexivity. move=> u. elim. move=> u0 H1 H2. suff: (proj1_sig a u0 = FO K). move=> H3. rewrite H3. apply (Vmul_O_l K V (x u0)). apply NNPP. apply H1. move=> n H1. apply (Full_intro (Count N) n). Qed. Lemma SpanSubspaceVS (K : Field) (V : VectorSpace K) (T : Type) (x : T -> VT K V) : SubspaceVS K V (SpanVS K V T x). Proof. apply conj. move=> v1 v2. elim. move=> a1 H1. elim. move=> a2 H2. suff: (Finite T (fun (t : T) => Fadd K (proj1_sig a1 t) (proj1_sig a2 t) <> FO K)). move=> H3. exists (exist (fun (G : T -> FT K) => Finite T (fun t : T => G t <> FO K)) (fun (t : T) => Fadd K (proj1_sig a1 t) (proj1_sig a2 t)) H3). suff: (MySumF2 T (exist (Finite T) (fun t : T => proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0)) H3) t <> FO K) (proj2_sig (exist (fun G : T -> FT K => Finite T (fun t : T => G t <> FO K)) (fun t : T => Fadd K (proj1_sig a1 t) (proj1_sig a2 t)) H3))) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0)) H3) t) (x t)) = MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0)) H3) t) (x t))). move=> H4. rewrite H4. suff: (v1 = MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t))). move=> H5. rewrite H5. suff: (v2 = MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t))). move=> H6. rewrite H6. apply (FiniteSetInduction T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2)))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. rewrite MySumF2Empty. apply (Vadd_O_l K V (VO K V)). move=> B b H7 H8 H9. simpl. move=> H10. rewrite MySumF2Add. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite - H10. rewrite - (Vadd_assoc K V (Vadd K V (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t))) (Vmul K V (proj1_sig a1 b) (x b))) (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t))) (Vmul K V (proj1_sig a2 b) (x b))). rewrite (Vadd_comm K V (Vadd K V (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t))) (Vmul K V (proj1_sig a1 b) (x b))) (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t)))). rewrite - (Vadd_assoc K V (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t))) (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t))) (Vmul K V (proj1_sig a1 b) (x b))). rewrite (Vadd_comm K V (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t))) (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t)))). rewrite (Vadd_assoc K V (Vadd K V (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t))) (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t)))) (Vmul K V (proj1_sig a1 b) (x b)) (Vmul K V (proj1_sig a2 b) (x b))). rewrite (Vmul_add_distr_r K V (proj1_sig a1 b) (proj1_sig a2 b) (x b)). reflexivity. apply H9. apply H9. apply H9. rewrite H2. rewrite (MySumF2Excluded T (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t)) (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => proj1_sig a2 t <> FO K)). suff: ((MySumF2 T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (Complement T (fun t : T => proj1_sig a2 t <> FO K))) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t))) = VO K V). move=> H6. rewrite H6. simpl. rewrite (Vadd_O_r K V (MySumF2 T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => proj1_sig a2 t <> FO K)) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a2 t) (x t)))). suff: ((exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2)) = (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => proj1_sig a2 t <> FO K))). move=> H7. rewrite - H7. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t H7. apply (Intersection_intro T (fun t0 : T => proj1_sig a2 t0 <> FO K) (Union T (fun t0 : T => proj1_sig a1 t0 <> FO K) (fun t0 : T => proj1_sig a2 t0 <> FO K)) t). apply H7. right. apply H7. move=> t. elim. move=> t0 H7 H8. apply H7. apply (MySumF2Induction T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (Complement T (fun t : T => proj1_sig a2 t <> FO K)))). apply conj. reflexivity. simpl. move=> v u H6 H7. rewrite H7. suff: (proj1_sig a2 u = FO K). move=> H8. rewrite H8. rewrite (Vmul_O_l K V (x u)). apply (Vadd_O_l K V (VO K V)). apply NNPP. elim H6. move=> u0 H8 H9 H10. apply (H8 H10). rewrite H1. rewrite (MySumF2Excluded T (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t)) (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => proj1_sig a1 t <> FO K)). suff: ((MySumF2 T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (Complement T (fun t : T => proj1_sig a1 t <> FO K))) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t))) = VO K V). move=> H5. rewrite H5. simpl. rewrite (Vadd_O_r K V (MySumF2 T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => proj1_sig a1 t <> FO K)) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a1 t) (x t)))). suff: ((exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) = (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => proj1_sig a1 t <> FO K))). move=> H6. rewrite - H6. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t H6. apply (Intersection_intro T (fun t0 : T => proj1_sig a1 t0 <> FO K) (Union T (fun t0 : T => proj1_sig a1 t0 <> FO K) (fun t0 : T => proj1_sig a2 t0 <> FO K)) t). apply H6. left. apply H6. move=> t. elim. move=> t0 H6 H7. apply H6. apply (MySumF2Induction T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (Complement T (fun t : T => proj1_sig a1 t <> FO K)))). apply conj. reflexivity. simpl. move=> v u H5 H6. rewrite H6. suff: (proj1_sig a1 u = FO K). move=> H7. rewrite H7. rewrite (Vmul_O_l K V (x u)). apply (Vadd_O_l K V (VO K V)). apply NNPP. elim H5. move=> u0 H7 H8 H9. apply (H7 H9). rewrite (MySumF2Excluded T (VSPCM K V) (fun t : T => Vmul K V (proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0)) H3) t) (x t)) (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0)) H3) t <> FO K)). suff: ((MySumF2 T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (Complement T (fun t : T => proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0)) H3) t <> FO K))) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0)) H3) t) (x t))) = VO K V). move=> H4. rewrite H4. simpl. rewrite (Vadd_O_r K V (MySumF2 T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => Fadd K (proj1_sig a1 t) (proj1_sig a2 t) <> FO K)) (VSPCM K V) (fun t : T => Vmul K V (Fadd K (proj1_sig a1 t) (proj1_sig a2 t)) (x t)))). suff: ((exist (Finite T) (fun t : T => Fadd K (proj1_sig a1 t) (proj1_sig a2 t) <> FO K) H3) = (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (fun t : T => Fadd K (proj1_sig a1 t) (proj1_sig a2 t) <> FO K))). move=> H5. rewrite H5. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t H5. apply (Intersection_intro T (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0) <> FO K) (Union T (fun t0 : T => proj1_sig a1 t0 <> FO K) (fun t0 : T => proj1_sig a2 t0 <> FO K)) t). apply H5. apply NNPP. move=> H6. apply H5. suff: (proj1_sig a1 t = FO K). move=> H7. rewrite H7. suff: (proj1_sig a2 t = FO K). move=> H8. rewrite H8. apply (Fadd_O_l K (FO K)). apply NNPP. move=> H8. apply H6. right. apply H8. apply NNPP. move=> H7. apply H6. left. apply H7. move=> t. elim. move=> t0 H5 H6. apply H5. apply (MySumF2Induction T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig a1 t <> FO K) (proj2_sig a1)) (exist (Finite T) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a2))) (Complement T (fun t : T => proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fadd K (proj1_sig a1 t0) (proj1_sig a2 t0)) H3) t <> FO K)))). apply conj. reflexivity. simpl. move=> v u H4 H5. rewrite H5. suff: ((Fadd K (proj1_sig a1 u) (proj1_sig a2 u)) = FO K). move=> H6. rewrite H6. rewrite (Vmul_O_l K V (x u)). apply (Vadd_O_l K V (VO K V)). elim H4. move=> u0 H6 H7. apply NNPP. move=> H8. apply (H6 H8). suff: (Finite T (Union T (fun t : T => proj1_sig a1 t <> FO K) (fun t : T => proj1_sig a2 t <> FO K))). move=> H3. apply (Finite_downward_closed T (Union T (fun t : T => proj1_sig a1 t <> FO K) (fun t : T => proj1_sig a2 t <> FO K)) H3 (fun t : T => Fadd K (proj1_sig a1 t) (proj1_sig a2 t) <> FO K)). move=> t H4. apply NNPP. move=> H5. apply H4. suff: (proj1_sig a1 t) = (FO K). move=> H6. suff: (proj1_sig a2 t) = (FO K). move=> H7. rewrite H6. rewrite H7. apply (Fadd_O_r K (FO K)). apply NNPP. move=> H7. apply H5. right. apply H7. apply NNPP. move=> H6. apply H5. left. apply H6. apply (Union_preserves_Finite T (fun t : T => proj1_sig a1 t <> FO K) (fun t : T => proj1_sig a2 t <> FO K) (proj2_sig a1) (proj2_sig a2)). apply conj. move=> f v. elim. move=> a H1. elim (classic (f = (FO K))). move=> H2. rewrite H2. rewrite (Vmul_O_l K V v). suff: (Finite T (fun (t : T) => FO K <> FO K)). move=> H3. exists (exist (fun (G : T -> FT K) => Finite T (fun t : T => G t <> FO K)) (fun (t : T) => FO K) H3). suff: ((exist (Finite T) (fun t : T => proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun _ : T => FO K) H3) t <> FO K) (proj2_sig (exist (fun G : T -> FT K => Finite T (fun t : T => G t <> FO K)) (fun _ : T => FO K) H3))) = FiniteEmpty T). move=> H4. rewrite H4. rewrite MySumF2Empty. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t H4. apply False_ind. apply H4. reflexivity. move=> t. elim. suff: ((fun _ : T => FO K <> FO K) = Empty_set T). move=> H3. rewrite H3. apply (Empty_is_finite T). apply Extensionality_Ensembles. apply conj. move=> t H3. apply False_ind. apply H3. reflexivity. move=> t. elim. move=> H2. suff: (Finite T (fun (t : T) => Fmul K f (proj1_sig a t) <> FO K)). move=> H3. exists (exist (fun (G : T -> FT K) => Finite T (fun t : T => G t <> FO K)) (fun (t : T) => Fmul K f (proj1_sig a t)) H3). rewrite H1. suff: ((exist (Finite T) (fun t : T => proj1_sig a t <> FO K) (proj2_sig a)) = (exist (Finite T) (fun t : T => proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => Fmul K f (proj1_sig a t0)) H3) t <> FO K) (proj2_sig (exist (fun G : T -> FT K => Finite T (fun t : T => G t <> FO K)) (fun t : T => Fmul K f (proj1_sig a t)) H3)))). move=> H4. rewrite H4. simpl. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => Fmul K f (proj1_sig a t) <> FO K) H3)). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. apply (Vmul_O_r K V f). move=> B b H5 H6 H7 H8. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite (Vmul_add_distr_l K V f (MySumF2 T B (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a t) (x t))) (Vmul K V (proj1_sig a b) (x b))). rewrite H8. rewrite (Vmul_assoc K V f (proj1_sig a b) (x b)). reflexivity. apply H7. apply H7. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t H4 H5. apply H4. rewrite - (Fmul_I_l K (proj1_sig a t)). rewrite - (Finv_l K f). rewrite (Fmul_assoc K (Finv K f) f (proj1_sig a t)). rewrite H5. apply (Fmul_O_r K (Finv K f)). apply H2. move=> t H4 H5. apply H4. rewrite H5. apply (Fmul_O_r K f). suff: ((fun t : T => Fmul K f (proj1_sig a t) <> FO K) = (fun t : T => proj1_sig a t <> FO K)). move=> H3. rewrite H3. apply (proj2_sig a). apply Extensionality_Ensembles. apply conj. move=> t H3 H4. apply H3. rewrite H4. apply (Fmul_O_r K f). move=> t H3 H4. apply H3. rewrite - (Fmul_I_l K (proj1_sig a t)). rewrite - (Finv_l K f). rewrite (Fmul_assoc K (Finv K f) f (proj1_sig a t)). rewrite H4. apply (Fmul_O_r K (Finv K f)). apply H2. suff: (Finite T (fun (t : T) => FO K <> FO K)). move=> H1. exists (exist (fun (G : T -> FT K) => Finite T (fun t : T => G t <> FO K)) (fun (t : T) => FO K) H1). suff: ((exist (Finite T) (fun t : T => proj1_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun _ : T => FO K) H1) t <> FO K) (proj2_sig (exist (fun G : T -> FT K => Finite T (fun t : T => G t <> FO K)) (fun _ : T => FO K) H1))) = FiniteEmpty T). move=> H2. rewrite H2. rewrite MySumF2Empty. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t H2. apply False_ind. apply H2. reflexivity. move=> t. elim. suff: ((fun _ : T => FO K <> FO K) = Empty_set T). move=> H1. rewrite H1. apply (Empty_is_finite T). apply Extensionality_Ensembles. apply conj. move=> t H1. apply False_ind. apply H1. reflexivity. move=> t. elim. Qed. Lemma SpanContainSelfVS : forall (K : Field) (V : VectorSpace K) (T : Type) (x : T -> VT K V) (t : T), In (VT K V) (SpanVS K V T x) (x t). Proof. move=> K V T x t. elim (classic (FI K = FO K)). move=> H1. rewrite - (Vmul_I_l K V (x t)). rewrite H1. rewrite (Vmul_O_l K V (x t)). apply (proj2 (proj2 (SpanSubspaceVS K V T x))). move=> H1. suff: (Finite T (fun t0 : T => (fun (t1 : T) => match (excluded_middle_informative (t1 = t)) with | left _ => FI K | right _ => FO K end) t0 <> FO K)). move=> H2. exists (exist (fun (G : T -> FT K) => Finite T (fun t : T => G t <> FO K)) (fun t0 : T => (fun (t1 : T) => match (excluded_middle_informative (t1 = t)) with | left _ => FI K | right _ => FO K end) t0) H2). suff: ((exist (Finite T) (fun t0 : T => proj1_sig (exist (fun G : T -> FT K => Finite T (fun t1 : T => G t1 <> FO K)) (fun t1 : T => match excluded_middle_informative (t1 = t) with | left _ => FI K | right _ => FO K end) H2) t0 <> FO K) (proj2_sig (exist (fun G : T -> FT K => Finite T (fun t0 : T => G t0 <> FO K)) (fun t0 : T => match excluded_middle_informative (t0 = t) with | left _ => FI K | right _ => FO K end) H2))) = FiniteSingleton T t). move=> H3. rewrite H3. rewrite MySumF2Singleton. simpl. elim (excluded_middle_informative (t = t)). move=> H4. rewrite (Vmul_I_l K V (x t)). reflexivity. move=> H4. apply False_ind. apply H4. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t0. unfold In. elim (excluded_middle_informative (t0 = t)). move=> H3 H4. rewrite H3. apply (In_singleton T t). move=> H3 H4. apply False_ind. apply H4. reflexivity. move=> t0. elim. unfold In. elim (excluded_middle_informative (t = t)). move=> H3. apply H1. move=> H3 H4. apply H3. reflexivity. suff: ((fun t0 : T => (match excluded_middle_informative (t0 = t) with | left _ => FI K | right _ => FO K end) <> FO K) = Singleton T t). move=> H2. rewrite H2. apply (Singleton_is_finite T t). apply Extensionality_Ensembles. apply conj. move=> t0. unfold In. elim (excluded_middle_informative (t0 = t)). move=> H2 H3. rewrite H2. apply (In_singleton T t). move=> H2 H3. apply False_ind. apply H3. reflexivity. move=> t0. elim. unfold In. elim (excluded_middle_informative (t = t)). move=> H2. apply H1. move=> H2 H3. apply H2. reflexivity. Qed. Definition GeneratingSystemVS (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V) := Full_set (VT K V) = SpanVS K V T F. Lemma BijectiveSaveGeneratingSystemVS : forall (K : Field) (V : VectorSpace K) (T1 T2 : Type) (F : T1 -> T2) (G : T2 -> VT K V), Bijective T1 T2 F -> GeneratingSystemVS K V T2 G -> GeneratingSystemVS K V T1 (compose G F). Proof. move=> K V T1 T2 F G H1 H2. suff: (SpanVS K V T1 (fun t : T1 => G (F t)) = SpanVS K V T2 G). move=> H3. unfold GeneratingSystemVS. rewrite H3. apply H2. rewrite (BijectiveSaveSpanVS K V T1 T2 F G H1). reflexivity. Qed. Lemma IsomorphicSaveGeneratingSystemVS : forall (K : Field) (V1 V2 : VectorSpace K) (T : Type) (F : T -> VT K V1) (G : VT K V1 -> VT K V2), IsomorphicVS K V1 V2 G -> GeneratingSystemVS K V1 T F -> GeneratingSystemVS K V2 T (compose G F). Proof. move=> K V1 V2 T F G H1 H2. apply Extensionality_Ensembles. apply conj. move=> v2 H3. elim (BijSurj (VT K V1) (VT K V2) G (proj1 H1) v2). move=> v1 H4. suff: (In (VT K V1) (SpanVS K V1 T F) v1). elim. move=> x H5. exists x. rewrite - H4. rewrite H5. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => proj1_sig x t <> FO K) (proj2_sig x))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite - (Vmul_O_l K V1 (VO K V1)). rewrite (proj2 (proj2 H1)). rewrite (Vmul_O_l K V2 (G (VO K V1))). reflexivity. move=> B b H6 H7 H8 H9. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite (proj1 (proj2 H1) (MySumF2 T B (VSPCM K V1) (fun t : T => Vmul K V1 (proj1_sig x t) (F t))) (Vmul K V1 (proj1_sig x b) (F b))). rewrite H9. rewrite (proj2 (proj2 H1) (proj1_sig x b) (F b)). reflexivity. apply H8. apply H8. rewrite - H2. apply (Full_intro (VT K V1) v1). move=> v H3. apply (Full_intro (VT K V2) v). Qed. Lemma SurjectiveSaveGeneratingSystemVS : forall (K : Field) (V : VectorSpace K) (T1 T2 : Type) (F : T1 -> T2) (G : T2 -> VT K V), Surjective T1 T2 F -> GeneratingSystemVS K V T2 G -> GeneratingSystemVS K V T1 (compose G F). Proof. move=> K V T1 T2 F G H1 H2. apply Extensionality_Ensembles. apply conj. move=> v. rewrite H2. elim. move=> x H3. rewrite H3. suff: (SubspaceVS K V (SpanVS K V T1 (fun t : T1 => G (F t)))). move=> H4. apply (FiniteSetInduction T2 (exist (Finite T2) (fun t : T2 => proj1_sig x t <> FO K) (proj2_sig x))). apply conj. rewrite MySumF2Empty. apply (proj2 (proj2 H4)). move=> B b H5 H6 H7 H8. rewrite MySumF2Add. apply (proj1 H4). apply H8. apply (proj1 (proj2 H4) (proj1_sig x b) (G b)). elim (H1 b). move=> t H9. rewrite - H9. apply (SpanContainSelfVS K V T1 (fun t : T1 => G (F t)) t). apply H7. apply (SpanSubspaceVS K V). move=> v H3. apply (Full_intro (VT K V) v). Qed. Lemma SurjectiveSaveGeneratingSystemVS2 : forall (K : Field) (V1 V2 : VectorSpace K) (T : Type) (F : T -> VT K V1) (G : VT K V1 -> VT K V2), (Surjective (VT K V1) (VT K V2) G /\ (forall (x y : VT K V1), G (Vadd K V1 x y) = Vadd K V2 (G x) (G y)) /\ (forall (c : FT K) (x : VT K V1), G (Vmul K V1 c x) = Vmul K V2 c (G x))) -> GeneratingSystemVS K V1 T F -> GeneratingSystemVS K V2 T (compose G F). Proof. move=> K V1 V2 T F G H1 H2. apply Extensionality_Ensembles. apply conj. move=> v H3. elim (proj1 H1 v). move=> u H4. rewrite - H4. suff: (In (VT K V1) (Full_set (VT K V1)) u). rewrite H2. elim. move=> x H5. rewrite H5. exists x. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => proj1_sig x t <> FO K) (proj2_sig x))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite - (Vmul_O_l K V1 (VO K V1)). rewrite (proj2 (proj2 H1) (FO K) (VO K V1)). apply (Vmul_O_l K V2 (G (VO K V1))). move=> B b H6 H7 H8 H9. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite (proj1 (proj2 H1)). rewrite (proj2 (proj2 H1) (proj1_sig x b) (F b)). rewrite H9. reflexivity. apply H8. apply H8. apply (Full_intro (VT K V1) u). move=> v H3. apply (Full_intro (VT K V2) v). Qed. Lemma FiniteGeneratingSystemVS : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), (GeneratingSystemVS K V (Count N) F) <-> (Full_set (VT K V) = (fun (v : VT K V) => exists (a : Count N -> FT K), v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)))). Proof. move=> K V N F. unfold GeneratingSystemVS. rewrite (FiniteSpanVS K V N F). apply conj. apply. apply. Qed. Lemma Proposition_4_9 : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)), SubspaceVS K V W1 -> SubspaceVS K V W2 -> forall (H : forall (x : ({v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v})), In (VT K V) (SumEnsembleVS K V W1 W2) (Vadd K V (proj1_sig (fst x)) (proj1_sig (snd x)))), (Intersection (VT K V) W1 W2 = Singleton (VT K V) (VO K V)) <-> Bijective ({v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v}) {v : VT K V | In (VT K V) (SumEnsembleVS K V W1 W2) v} (fun (x : ({v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v})) => exist (SumEnsembleVS K V W1 W2) (Vadd K V (proj1_sig (fst x)) (proj1_sig (snd x))) (H x)). Proof. move=> K V W1 W2 H1 H2 H3. apply conj. move=> H4. apply (InjSurjBij ({v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v}) {v : VT K V | In (VT K V) (SumEnsembleVS K V W1 W2) v}). move=> x1 x2 H5. suff: (Vadd K V (proj1_sig (fst x1)) (Vopp K V (proj1_sig (fst x2))) = Vadd K V (proj1_sig (snd x2)) (Vopp K V (proj1_sig (snd x1)))). move=> H6. suff: (Vadd K V (proj1_sig (fst x1)) (Vopp K V (proj1_sig (fst x2))) = VO K V). move=> H7. apply injective_projections. apply sig_map. apply (Vminus_diag_uniq K V). apply H7. apply sig_map. apply (Vminus_diag_uniq_sym K V). rewrite - H6. apply H7. suff: (In (VT K V) (Singleton (VT K V) (VO K V)) (Vadd K V (proj1_sig (fst x1)) (Vopp K V (proj1_sig (fst x2))))). elim. reflexivity. rewrite - H4. apply (Intersection_intro (VT K V) W1 W2 (Vadd K V (proj1_sig (fst x1)) (Vopp K V (proj1_sig (fst x2))))). apply (proj1 H1 (proj1_sig (fst x1)) (Vopp K V (proj1_sig (fst x2)))). apply (proj2_sig (fst x1)). apply (SubspaceMakeVSVoppSub K V W1 H1 (proj1_sig (fst x2)) (proj2_sig (fst x2))). rewrite H6. apply (proj1 H2 (proj1_sig (snd x2)) (Vopp K V (proj1_sig (snd x1)))). apply (proj2_sig (snd x2)). apply (SubspaceMakeVSVoppSub K V W2 H2 (proj1_sig (snd x1)) (proj2_sig (snd x1))). apply (Vadd_eq_reg_r K V (proj1_sig (fst x2))). rewrite (Vadd_assoc K V (proj1_sig (fst x1)) (Vopp K V (proj1_sig (fst x2))) (proj1_sig (fst x2))). rewrite (Vadd_opp_l K V (proj1_sig (fst x2))). rewrite (Vadd_O_r K V (proj1_sig (fst x1))). rewrite (Vadd_comm K V (Vadd K V (proj1_sig (snd x2)) (Vopp K V (proj1_sig (snd x1)))) (proj1_sig (fst x2))). rewrite - (Vadd_assoc K V (proj1_sig (fst x2)) (proj1_sig (snd x2)) (Vopp K V (proj1_sig (snd x1)))). apply (Vadd_eq_reg_r K V (proj1_sig (snd x1))). rewrite (Vadd_assoc K V (Vadd K V (proj1_sig (fst x2)) (proj1_sig (snd x2))) (Vopp K V (proj1_sig (snd x1))) (proj1_sig (snd x1))). rewrite (Vadd_opp_l K V (proj1_sig (snd x1))). rewrite (Vadd_O_r K V). suff: (Vadd K V (proj1_sig (fst x1)) (proj1_sig (snd x1)) = proj1_sig (exist (SumEnsembleVS K V W1 W2) (Vadd K V (proj1_sig (fst x1)) (proj1_sig (snd x1))) (H3 x1))). move=> H6. rewrite H6. rewrite H5. reflexivity. reflexivity. move=> y. suff: (exists (y1 y2 : VT K V), In (VT K V) W1 y1 /\ In (VT K V) W2 y2 /\ Vadd K V y1 y2 = proj1_sig y). elim. move=> y1. elim. move=> y2 H5. exists (exist W1 y1 (proj1 H5), exist W2 y2 (proj1 (proj2 H5))). apply sig_map. apply (proj2 (proj2 H5)). elim (proj2_sig y). move=> y1 y2 H5 H6. exists y1. exists y2. apply conj. apply H5. apply conj. apply H6. reflexivity. move=> H4. apply Extensionality_Ensembles. apply conj. move=> x. elim. move=> x0 H5 H6. suff: (x0 = (VO K V)). move=> H7. rewrite H7. apply (In_singleton (VT K V) (VO K V)). suff: (In (VT K V) W2 (Vopp K V x0)). move=> H7. suff: ((exist W1 (VO K V) (proj2 (proj2 H1)), exist W2 (VO K V) (proj2 (proj2 H2))) = (exist W1 x0 H5, exist W2 (Vopp K V x0) H7)). move=> H8. suff: (VO K V = proj1_sig (fst (exist W1 (VO K V) (proj2 (proj2 H1)), exist W2 (VO K V) (proj2 (proj2 H2))))). move=> H9. rewrite H9. rewrite H8. reflexivity. reflexivity. apply (BijInj ({v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v}) {v : VT K V | In (VT K V) (SumEnsembleVS K V W1 W2) v} (fun (x : {v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v}) => exist (SumEnsembleVS K V W1 W2) (Vadd K V (proj1_sig (fst x)) (proj1_sig (snd x))) (H3 x)) H4). apply sig_map. simpl. rewrite (Vadd_O_r K V (VO K V)). rewrite (Vadd_opp_r K V x0). reflexivity. apply (SubspaceMakeVSVoppSub K V W2 H2 x0 H6). move=> x. elim. apply (Intersection_intro (VT K V) W1 W2 (VO K V)). apply (proj2 (proj2 H1)). apply (proj2 (proj2 H2)). Qed. Lemma Proposition_4_9_exists : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)), SubspaceVS K V W1 -> SubspaceVS K V W2 -> exists (H : forall (x : ({v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v})), In (VT K V) (SumEnsembleVS K V W1 W2) (Vadd K V (proj1_sig (fst x)) (proj1_sig (snd x)))), (Intersection (VT K V) W1 W2 = Singleton (VT K V) (VO K V)) <-> Bijective ({v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v}) {v : VT K V | In (VT K V) (SumEnsembleVS K V W1 W2) v} (fun (x : ({v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v})) => exist (SumEnsembleVS K V W1 W2) (Vadd K V (proj1_sig (fst x)) (proj1_sig (snd x))) (H x)). Proof. move=> K V W1 W2 H1 H2. suff: (forall (x : {v : VT K V | In (VT K V) W1 v} * {v : VT K V | In (VT K V) W2 v}), In (VT K V) (SumEnsembleVS K V W1 W2) (Vadd K V (proj1_sig (fst x)) (proj1_sig (snd x)))). move=> H3. exists H3. apply (Proposition_4_9 K V W1 W2 H1 H2 H3). move=> x. apply (SumEnsembleVS_intro K V W1 W2 (proj1_sig (fst x)) (proj1_sig (snd x)) (proj2_sig (fst x)) (proj2_sig (snd x))). Qed. Lemma Corollary_4_10 : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2) (H3 : SubspaceVS K V (Intersection (VT K V) W1 W2)) (H4 : SubspaceVS K V (SumEnsembleVS K V W1 W2)) (T1 T2 T3 : Type) (x : T1 -> VT K V) (y : T2 -> VT K V) (z : T3 -> VT K V), BasisSubspaceVS K V (Intersection (VT K V) W1 W2) H3 T1 x -> BasisSubspaceVS K V W1 H1 (T1 + T2) (fun (t : T1 + T2) => match t with | inl t0 => x t0 | inr t0 => y t0 end) -> BasisSubspaceVS K V W2 H2 (T1 + T3) (fun (t : T1 + T3) => match t with | inl t0 => x t0 | inr t0 => z t0 end) -> BasisSubspaceVS K V (SumEnsembleVS K V W1 W2) H4 (T1 + T2 + T3) (fun (t : T1 + T2 + T3) => match t with | inl t0 => (match t0 with | inl t1 => x t1 | inr t1 => y t1 end) | inr t0 => z t0 end). Proof. move=> K V W1 W2 H1 H2 H3 H4 T1 T2 T3 x y z H5 H6 H7. suff: (let W3 := SpanVS K V T3 z in BasisSubspaceVS K V (SumEnsembleVS K V W1 W2) H4 (T1 + T2 + T3) (fun t : T1 + T2 + T3 => match t with | inl (inl t1) => x t1 | inl (inr t1) => y t1 | inr t0 => z t0 end)). apply. move=> W3. suff: (SubspaceVS K V W3). move=> H8. suff: (BasisSubspaceVS K V W3 H8 T3 z). move=> H9. suff: (SumEnsembleVS K V W1 W2 = SumEnsembleVS K V W1 W3). move=> H10. suff: (SubspaceVS K V (SumEnsembleVS K V W1 W3)). move=> H11. suff: (BasisSubspaceVS K V (SumEnsembleVS K V W1 W3) H11 (T1 + T2 + T3) (fun t : T1 + T2 + T3 => match t with | inl (inl t1) => x t1 | inl (inr t1) => y t1 | inr t0 => z t0 end)). suff: (forall (U : Type) (P : U -> Prop) (Q : forall (u : U), P u -> Prop) (u1 u2 : U), (u1 = u2) -> (forall (H1 : P u1) (H2 : P u2), Q u1 H1 -> Q u2 H2)). move=> H12. apply (H12 (Ensemble (VT K V)) (SubspaceVS K V) (fun (u : (Ensemble (VT K V))) (H : SubspaceVS K V u) => BasisSubspaceVS K V u H (T1 + T2 + T3) (fun t : T1 + T2 + T3 => match t with | inl (inl t1) => x t1 | inl (inr t1) => y t1 | inr t0 => z t0 end))). rewrite H10. reflexivity. move=> U P Q u1 u2 H12. rewrite H12. move=> H13 H14. suff: (H13 = H14). move=> H15. rewrite H15. apply. apply proof_irrelevance. suff: (forall (t : T1 + T2 + T3), In (VT K V) (SumEnsembleVS K V W1 W3) (match t with | inl (inl t1) => x t1 | inl (inr t1) => y t1 | inr t0 => z t0 end)). move=> H12. exists H12. elim H6. move=> H13 H14. elim H9. move=> H15 H16. suff: ((fun t : T1 + T2 + T3 => exist (SumEnsembleVS K V W1 W3) match t with | inl (inl t1) => x t1 | inl (inr t1) => y t1 | inr t0 => z t0 end (H12 t)) = (fun t : T1 + T2 + T3 => exist (SumEnsembleVS K V W1 W3) (Vadd K V (proj1_sig (fst match t with | inl t0 => (exist W1 match t0 with | inl t1 => x t1 | inr t1 => y t1 end (H13 t0), exist W3 (VO K V) (proj2 (proj2 H8))) | inr t0 => (exist W1 (VO K V) (proj2 (proj2 H1)), exist W3 (z t0) (H15 t0)) end)) (proj1_sig (snd match t with | inl t0 => (exist W1 match t0 with | inl t1 => x t1 | inr t1 => y t1 end (H13 t0), exist W3 (VO K V) (proj2 (proj2 H8))) | inr t0 => (exist W1 (VO K V) (proj2 (proj2 H1)), exist W3 (z t0) (H15 t0)) end))) (SumEnsembleVS_intro K V W1 W3 (proj1_sig (fst match t with | inl t0 => (exist W1 match t0 with | inl t1 => x t1 | inr t1 => y t1 end (H13 t0), exist W3 (VO K V) (proj2 (proj2 H8))) | inr t0 => (exist W1 (VO K V) (proj2 (proj2 H1)), exist W3 (z t0) (H15 t0)) end)) (proj1_sig (snd match t with | inl t0 => (exist W1 match t0 with | inl t1 => x t1 | inr t1 => y t1 end (H13 t0), exist W3 (VO K V) (proj2 (proj2 H8))) | inr t0 => (exist W1 (VO K V) (proj2 (proj2 H1)), exist W3 (z t0) (H15 t0)) end)) (proj2_sig (fst match t with | inl t0 => (exist W1 match t0 with | inl t1 => x t1 | inr t1 => y t1 end (H13 t0), exist W3 (VO K V) (proj2 (proj2 H8))) | inr t0 => (exist W1 (VO K V) (proj2 (proj2 H1)), exist W3 (z t0) (H15 t0)) end)) (proj2_sig (snd match t with | inl t0 => (exist W1 match t0 with | inl t1 => x t1 | inr t1 => y t1 end (H13 t0), exist W3 (VO K V) (proj2 (proj2 H8))) | inr t0 => (exist W1 (VO K V) (proj2 (proj2 H1)), exist W3 (z t0) (H15 t0)) end))))). move=> H17. rewrite H17. apply (IsomorphicSaveBasisVS K (PairVS K (SubspaceMakeVS K V W1 H1) (SubspaceMakeVS K V W3 H8)) (SubspaceMakeVS K V (SumEnsembleVS K V W1 W3) H11) (T1 + T2 + T3) (fun (t : T1 + T2 + T3) => match t with | inl t0 => (exist W1 match t0 with | inl t1 => x t1 | inr t1 => y t1 end (H13 t0), exist W3 (VO K V) (proj2 (proj2 H8))) | inr t0 => (exist W1 (VO K V) (proj2 (proj2 H1)), exist W3 (z t0) (H15 t0)) end) (fun (v : VT K (PairVS K (SubspaceMakeVS K V W1 H1) (SubspaceMakeVS K V W3 H8))) => exist (SumEnsembleVS K V W1 W3) (Vadd K V (proj1_sig (fst v)) (proj1_sig (snd v))) (SumEnsembleVS_intro K V W1 W3 (proj1_sig (fst v)) (proj1_sig (snd v)) (proj2_sig (fst v)) (proj2_sig (snd v))))). apply conj. apply (Proposition_4_9 K V W1 W3). apply H1. apply H8. apply Extensionality_Ensembles. apply conj. move=> v H18. elim H5. move=> H19 H20. suff: (In (VT K V) (Intersection (VT K V) W1 W2) v). move=> H21. elim (BijSurj (DirectSumField K T1) (VT K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) H3)) (fun g : DirectSumField K T1 => MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) H3)) (fun t : T1 => Vmul K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) H3) (proj1_sig g t) (exist (Intersection (VT K V) W1 W2) (x t) (H19 t)))) H20 (exist (Intersection (VT K V) W1 W2) v H21)). move=> xt H22. suff: (In (VT K V) W3 v). move=> H23. elim H9. move=> H24 H25. elim (BijSurj (DirectSumField K T3) (VT K (SubspaceMakeVS K V W3 H8)) (fun g : DirectSumField K T3 => MySumF2 T3 (exist (Finite T3) (fun t : T3 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (SubspaceMakeVS K V W3 H8)) (fun t : T3 => Vmul K (SubspaceMakeVS K V W3 H8) (proj1_sig g t) (exist W3 (z t) (H24 t)))) H25 (exist W3 v H23)). move=> zt H26. suff: (proj1_sig zt = fun (t : T3) => FO K). move=> H27. suff: (v = proj1_sig (exist W3 v H23)). move=> H28. rewrite H28. rewrite - H26. suff: ((proj1_sig (MySumF2 T3 (exist (Finite T3) (fun t : T3 => proj1_sig zt t <> FO K) (proj2_sig zt)) (VSPCM K (SubspaceMakeVS K V W3 H8)) (fun t : T3 => Vmul K (SubspaceMakeVS K V W3 H8) (proj1_sig zt t) (exist W3 (z t) (H24 t))))) = VO K V). move=> H29. rewrite H29. apply (In_singleton (VT K V) (VO K V)). suff: ((MySumF2 T3 (exist (Finite T3) (fun t : T3 => proj1_sig zt t <> FO K) (proj2_sig zt)) (VSPCM K (SubspaceMakeVS K V W3 H8)) (fun t : T3 => Vmul K (SubspaceMakeVS K V W3 H8) (proj1_sig zt t) (exist W3 (z t) (H24 t)))) = exist W3 (VO K V) (proj2 (proj2 H8))). move=> H30. rewrite H30. reflexivity. apply (FiniteSetInduction T3 (exist (Finite T3) (fun t : T3 => proj1_sig zt t <> FO K) (proj2_sig zt))). apply conj. rewrite MySumF2Empty. reflexivity. move=> B b H29 H30 H31 H32. rewrite MySumF2Add. simpl. rewrite H32. rewrite H27. unfold SubspaceMakeVSVadd. unfold SubspaceMakeVSVmul. apply sig_map. simpl. rewrite (Vmul_O_l K V (z b)). apply (Vadd_O_r K V (VO K V)). apply H31. reflexivity. suff: (Finite (T1 + T3) (fun (t : T1 + T3) => match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end <> FO K)). move=> H27. suff: (Finite (T1 + T3) (fun (t : T1 + T3) => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end <> FO K)). move=> H28. suff: ((fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end) = (fun t : T1 + T3 => FO K)). move=> H29. apply functional_extensionality. move=> t. suff: (let temp := (fun _ : T1 + T3 => FO K) in proj1_sig zt t = FO K). apply. move=> temp. suff: (FO K = temp (inr T1 t)). move=> H30. rewrite {2} H30. suff: (temp = (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end)). move=> H31. rewrite H31. reflexivity. rewrite H29. unfold temp. reflexivity. reflexivity. suff: ((fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end) = (fun t : T1 + T3 => match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end)). move=> H29. apply functional_extensionality. elim. move=> t. reflexivity. move=> t. suff: (let temp := (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end) in proj1_sig zt t = FO K). apply. move=> temp. suff: (proj1_sig zt t = temp (inr T1 t)). move=> H30. rewrite H30. suff: (temp = (fun t : T1 + T3 => match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end)). move=> H31. rewrite H31. reflexivity. rewrite - H29. reflexivity. reflexivity. suff: (exist (fun (G : T1 + T3 -> FT K) => Finite (T1 + T3) (fun t : T1 + T3 => G t <> FO K)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end) H28 = exist (fun (G : T1 + T3 -> FT K) => Finite (T1 + T3) (fun t : T1 + T3 => G t <> FO K)) (fun t : T1 + T3 => match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end) H27). move=> H29. suff: ((fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end) = proj1_sig (exist (fun (G : T1 + T3 -> FT K) => Finite (T1 + T3) (fun t : T1 + T3 => G t <> FO K)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end) H28)). move=> H30. rewrite H30. rewrite H29. reflexivity. reflexivity. elim H7. move=> H29 H30. unfold BasisVS in H30. apply (BijInj (DirectSumField K (T1 + T3)) (VT K (SubspaceMakeVS K V W2 H2)) (fun g : DirectSumField K (T1 + T3) => MySumF2 (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig g t) (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H29 t)))) H30). simpl. apply sig_map. suff: (proj1_sig (MySumF2 (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end <> FO K) H28) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => SubspaceMakeVSVmul K V W2 H2 match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H29 t)))) = proj1_sig (MySumF2 T3 (exist (Finite T3) (fun t : T3 => proj1_sig zt t <> FO K) (proj2_sig zt)) (VSPCM K (SubspaceMakeVS K V W3 H8)) (fun t : T3 => Vmul K (SubspaceMakeVS K V W3 H8) (proj1_sig zt t) (exist W3 (z t) (H24 t))))). move=> H31. rewrite H31. rewrite H26. suff: (proj1_sig (MySumF2 (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end <> FO K) H27) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => SubspaceMakeVSVmul K V W2 H2 match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H29 t)))) = proj1_sig (MySumF2 T1 (exist (Finite T1) (fun t : T1 => proj1_sig xt t <> FO K) (proj2_sig xt)) (VSPCM K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) H3)) (fun t : T1 => Vmul K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) H3) (proj1_sig xt t) (exist (Intersection (VT K V) W1 W2) (x t) (H19 t))))). move=> H32. rewrite H32. rewrite H22. reflexivity. rewrite - (MySumF2BijectiveSame T1 (exist (Finite T1) (fun t : T1 => proj1_sig xt t <> FO K) (proj2_sig xt)) (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end <> FO K) H27) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => SubspaceMakeVSVmul K V W2 H2 match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H29 t))) (fun (t : T1) => inl T3 t)). apply (FiniteSetInduction T1 (exist (Finite T1) (fun t : T1 => proj1_sig xt t <> FO K) (proj2_sig xt))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H32 H33 H34 H35. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H35. reflexivity. apply H34. apply H34. simpl. apply InjSurjBij. move=> u1 u2 H32. apply sig_map. apply (injective_inl T1 T3). suff: (inl (proj1_sig u1) = proj1_sig (exist (fun t : T1 + T3 => match t with | inl t0 => proj1_sig xt t0 | inr _ => FO K end <> FO K) (inl (proj1_sig u1)) (proj2_sig u1))). move=> H33. rewrite H33. rewrite H32. reflexivity. reflexivity. elim. elim. move=> t H32. exists (exist (fun (u : T1) => proj1_sig xt u <> FO K) t H32). reflexivity. move=> t H32. apply False_ind. apply H32. reflexivity. rewrite - (MySumF2BijectiveSame T3 (exist (Finite T3) (fun t : T3 => proj1_sig zt t <> FO K) (proj2_sig zt)) (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end <> FO K) H28) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => SubspaceMakeVSVmul K V W2 H2 match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H29 t))) (fun (t : T3) => inr T1 t)). apply (FiniteSetInduction T3 (exist (Finite T3) (fun t : T3 => proj1_sig zt t <> FO K) (proj2_sig zt))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H31 H32 H33 H34. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H34. reflexivity. apply H33. apply H33. simpl. apply InjSurjBij. move=> u1 u2 H31. apply sig_map. apply (injective_inr T1 T3). suff: (inr (proj1_sig u1) = proj1_sig (exist (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig zt t0 end <> FO K) (inr (proj1_sig u1)) (proj2_sig u1))). move=> H32. rewrite H32. rewrite H31. reflexivity. reflexivity. elim. elim. move=> t H31. apply False_ind. apply H31. reflexivity. move=> t H31. exists (exist (fun (u : T3) => proj1_sig zt u <> FO K) t H31). reflexivity. apply (Finite_downward_closed (T1 + T3) (Im T3 (T1 + T3) (fun (t : T3) => proj1_sig zt t <> FO K) (fun (t : T3) => inr T1 t))). apply finite_image. apply (proj2_sig zt). elim. move=> t1 H28. apply False_ind. apply H28. reflexivity. move=> t3 H29. apply (Im_intro T3 (T1 + T3) (fun t : T3 => proj1_sig zt t <> FO K) (fun t : T3 => inr t) t3). apply H29. reflexivity. apply (Finite_downward_closed (T1 + T3) (Im T1 (T1 + T3) (fun (t : T1) => proj1_sig xt t <> FO K) (fun (t : T1) => inl T3 t))). apply finite_image. apply (proj2_sig xt). elim. move=> t1 H27. apply (Im_intro T1 (T1 + T3) (fun t : T1 => proj1_sig xt t <> FO K) (fun t : T1 => inl t) t1). apply H27. reflexivity. move=> t3 H27. apply False_ind. apply H27. reflexivity. elim H18. move=> v0 H23 H24. apply H24. apply (Intersection_intro (VT K V) W1 W2 v). elim H18. move=> v0 H21 H22. apply H21. elim H18. move=> v0 H21. elim. move=> x0 H22. rewrite H22. apply (FiniteSetInduction T3 (exist (Finite T3) (fun t : T3 => proj1_sig x0 t <> FO K) (proj2_sig x0))). apply conj. rewrite MySumF2Empty. apply (proj2 (proj2 H2)). move=> B b H23 H24 H25 H26. rewrite MySumF2Add. apply (proj1 H2). apply H26. apply (proj1 (proj2 H2)). elim H7. move=> H27 H28. apply (H27 (inr T1 b)). apply H25. move=> t. elim. apply (Intersection_intro (VT K V) W1 W3 (VO K V) (proj2 (proj2 H1)) (proj2 (proj2 H8))). apply conj. move=> v1 v2. apply sig_map. simpl. rewrite (Vadd_assoc K V (proj1_sig (fst v1)) (proj1_sig (fst v2)) (Vadd K V (proj1_sig (snd v1)) (proj1_sig (snd v2)))). rewrite - (Vadd_assoc K V (proj1_sig (fst v2)) (proj1_sig (snd v1)) (proj1_sig (snd v2))). rewrite (Vadd_comm K V (proj1_sig (fst v2)) (proj1_sig (snd v1))). rewrite (Vadd_assoc K V (proj1_sig (snd v1)) (proj1_sig (fst v2)) (proj1_sig (snd v2))). rewrite (Vadd_assoc K V (proj1_sig (fst v1)) (proj1_sig (snd v1)) (Vadd K V (proj1_sig (fst v2)) (proj1_sig (snd v2)))). reflexivity. move=> c v. apply sig_map. simpl. rewrite (Vmul_add_distr_l K V). reflexivity. apply (PairBasisVS K (T1 + T2) T3 (SubspaceMakeVS K V W1 H1) (SubspaceMakeVS K V W3 H8)). apply H14. apply H16. apply functional_extensionality. move=> t. apply sig_map. simpl. elim t. elim. move=> t1. simpl. rewrite (Vadd_O_r K V (x t1)). reflexivity. move=> t2. simpl. rewrite (Vadd_O_r K V (y t2)). reflexivity. move=> t3. simpl. rewrite (Vadd_O_l K V (z t3)). reflexivity. elim. move=> t. rewrite - (Vadd_O_r K V (match t with | inl t1 => x t1 | inr t1 => y t1 end)). apply (SumEnsembleVS_intro K V W1 W3 (match t with | inl t1 => x t1 | inr t1 => y t1 end) (VO K V)). elim H6. move=> H12 H13. apply (H12 t). apply (proj2 (proj2 H8)). move=> t. rewrite - (Vadd_O_l K V (z t)). elim H9. move=> H12 H13. apply (SumEnsembleVS_intro K V W1 W3 (VO K V) (z t) (proj2 (proj2 H1)) (H12 t)). apply (SumSubspaceVS K V W1 W3 H1 H8). apply Extensionality_Ensembles. apply conj. move=> t. elim. move=> t1 t2 H10 H11. elim H7. move=> H12 H13. elim (BijSurj (DirectSumField K (T1 + T3)) (VT K (SubspaceMakeVS K V W2 H2)) (fun g : DirectSumField K (T1 + T3) => MySumF2 (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig g t) (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H12 t)))) H13 (exist W2 t2 H11)). move=> x0 H14. suff: (Vadd K V t1 t2 = (Vadd K V (Vadd K V t1 (proj1_sig (MySumF2 (T1 + T3) (FiniteIntersection (T1 + T3) (exist (Finite (T1 + T3)) (fun t0 : T1 + T3 => proj1_sig x0 t0 <> FO K) (proj2_sig x0)) (fun t0 : T1 + T3 => match t0 with | inl _ => True | inr _ => False end)) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t0 : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig x0 t0) (exist W2 match t0 with | inl t3 => x t3 | inr t3 => z t3 end (H12 t0)))))) (proj1_sig (MySumF2 (T1 + T3) (FiniteIntersection (T1 + T3) (exist (Finite (T1 + T3)) (fun t0 : T1 + T3 => proj1_sig x0 t0 <> FO K) (proj2_sig x0)) (Complement (T1 + T3) (fun t0 : T1 + T3 => match t0 with | inl _ => True | inr _ => False end))) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t0 : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig x0 t0) (exist W2 match t0 with | inl t3 => x t3 | inr t3 => z t3 end (H12 t0))))))). move=> H15. rewrite H15. apply (SumEnsembleVS_intro K V W1 W3 (Vadd K V t1 (proj1_sig (MySumF2 (T1 + T3) (FiniteIntersection (T1 + T3) (exist (Finite (T1 + T3)) (fun t0 : T1 + T3 => proj1_sig x0 t0 <> FO K) (proj2_sig x0)) (fun t0 : T1 + T3 => match t0 with | inl _ => True | inr _ => False end)) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t0 : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig x0 t0) (exist W2 match t0 with | inl t3 => x t3 | inr t3 => z t3 end (H12 t0)))))) (proj1_sig ((MySumF2 (T1 + T3) (FiniteIntersection (T1 + T3) (exist (Finite (T1 + T3)) (fun t0 : T1 + T3 => proj1_sig x0 t0 <> FO K) (proj2_sig x0)) (Complement (T1 + T3) (fun t0 : T1 + T3 => match t0 with | inl _ => True | inr _ => False end))) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t0 : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig x0 t0) (exist W2 match t0 with | inl t3 => x t3 | inr t3 => z t3 end (H12 t0))))))). apply (proj1 H1). apply H10. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H1)). move=> cm u H16 H17. apply (proj1 H1). apply H17. apply (proj1 (proj2 H1)). suff: (In (T1 + T3) (fun t0 : T1 + T3 => match t0 with | inl _ => True | inr _ => False end) u). simpl. unfold In. elim u. move=> t10 H18. elim H6. move=> H19 H20. apply (H19 (inl t10)). move=> t30 H18. apply False_ind. apply H18. elim H16. move=> u0 H18 H19. apply H18. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H8)). move=> cm u H16 H17. apply (proj1 H8). apply H17. apply (proj1 (proj2 H8)). suff: (In (T1 + T3) (Complement (T1 + T3) (fun t0 : T1 + T3 => match t0 with | inl _ => True | inr _ => False end)) u). simpl. unfold In. elim u. move=> t10 H18. apply False_ind. apply H18. apply I. move=> t30 H18. elim H9. move=> H19 H20. apply (H19 t30). elim H16. move=> u0 H18 H19. apply H18. rewrite Vadd_assoc. suff: (t2 = proj1_sig (MySumF2 (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => proj1_sig x0 t <> FO K) (proj2_sig x0)) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig x0 t) (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H12 t))))). move=> H15. rewrite H15. rewrite (MySumF2Excluded (T1 + T3) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t0 : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig x0 t0) (exist W2 match t0 with | inl t3 => x t3 | inr t3 => z t3 end (H12 t0))) (exist (Finite (T1 + T3)) (fun t0 : T1 + T3 => proj1_sig x0 t0 <> FO K) (proj2_sig x0)) (fun (t : T1 + T3) => match t with inl _ => True | inr _ => False end)). reflexivity. suff: (t2 = proj1_sig (exist W2 t2 H11)). move=> H15. rewrite H15. rewrite - H14. reflexivity. reflexivity. move=> t. elim. move=> t1 t3 H10 H11. apply (SumEnsembleVS_intro K V W1 W2 t1 t3 H10). elim H11. move=> x0 H12. rewrite H12. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H2)). move=> cm u H13 H14. apply (proj1 H2). apply H14. apply (proj1 (proj2 H2)). elim H7. move=> H15 H16. apply (H15 (inr u)). exists (SpanContainSelfVS K V T3 z). apply InjSurjBij. move=> x1 x2 H9. suff: (forall (x : DirectSumField K T3), Finite (T1 + T3) (fun (t : T1 + T3) => match t with | inl _ => FO K | inr t0 => proj1_sig x t0 end <> FO K)). move=> H10. suff: (exist (fun (G : T1 + T3 -> FT K) => Finite (T1 + T3) (fun t : T1 + T3 => G t <> FO K)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig x1 t0 end) (H10 x1) = exist (fun (G : T1 + T3 -> FT K) => Finite (T1 + T3) (fun t : T1 + T3 => G t <> FO K)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig x2 t0 end) (H10 x2)). move=> H11. apply sig_map. apply functional_extensionality. move=> t3. suff: (proj1_sig x1 t3 = proj1_sig (exist (fun G : T1 + T3 -> FT K => Finite (T1 + T3) (fun t : T1 + T3 => G t <> FO K)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig x1 t0 end) (H10 x1)) (inr t3)). move=> H12. rewrite H12. rewrite H11. reflexivity. reflexivity. elim H7. move=> H11 H12. apply (BijInj (DirectSumField K (T1 + T3)) (VT K (SubspaceMakeVS K V W2 H2)) (fun g : DirectSumField K (T1 + T3) => MySumF2 (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => Vmul K (SubspaceMakeVS K V W2 H2) (proj1_sig g t) (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H11 t)))) H12). simpl. suff: (forall (x2 : DirectSumField K T3), proj1_sig (MySumF2 (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig x2 t0 end <> FO K) (H10 x2)) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => SubspaceMakeVSVmul K V W2 H2 match t with | inl _ => FO K | inr t0 => proj1_sig x2 t0 end (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H11 t)))) = proj1_sig (MySumF2 T3 (exist (Finite T3) (fun t : T3 => proj1_sig x2 t <> FO K) (proj2_sig x2)) (VSPCM K (SubspaceMakeVS K V W3 H8)) (fun t : T3 => Vmul K (SubspaceMakeVS K V W3 H8) (proj1_sig x2 t) (exist W3 (z t) (SpanContainSelfVS K V T3 z t))))). move=> H13. apply sig_map. rewrite (H13 x1). rewrite (H13 x2). rewrite H9. reflexivity. move=> x0. rewrite - (MySumF2BijectiveSame T3 (exist (Finite T3) (fun t : T3 => proj1_sig x0 t <> FO K) (proj2_sig x0)) (T1 + T3) (exist (Finite (T1 + T3)) (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig x0 t0 end <> FO K) (H10 x0)) (VSPCM K (SubspaceMakeVS K V W2 H2)) (fun t : T1 + T3 => SubspaceMakeVSVmul K V W2 H2 match t with | inl _ => FO K | inr t0 => proj1_sig x0 t0 end (exist W2 match t with | inl t0 => x t0 | inr t0 => z t0 end (H11 t))) (fun (t : T3) => inr t)). apply (FiniteSetInduction T3 (exist (Finite T3) (fun t : T3 => proj1_sig x0 t <> FO K) (proj2_sig x0))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H13 H14 H15 H16. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H16. reflexivity. apply H15. apply H15. simpl. apply InjSurjBij. move=> u1 u2 H13. apply sig_map. apply (injective_inr T1 T3). suff: (inr (proj1_sig u1) = proj1_sig (exist (fun t : T1 + T3 => match t with | inl _ => FO K | inr t0 => proj1_sig x0 t0 end <> FO K) (inr (proj1_sig u1)) (proj2_sig u1))). move=> H14. rewrite H14. rewrite H13. reflexivity. reflexivity. elim. elim. move=> t1 H13. apply False_ind. apply H13. reflexivity. move=> t3 H13. exists (exist (fun (u : T3) => proj1_sig x0 u <> FO K) t3 H13). reflexivity. move=> x0. apply (Finite_downward_closed (T1 + T3) (Im T3 (T1 + T3) (fun (t : T3) => proj1_sig x0 t <> FO K) (fun (t : T3) => inr T1 t))). apply finite_image. apply (proj2_sig x0). move=> t. unfold In. elim t. move=> t1 H10. apply False_ind. apply H10. reflexivity. move=> t3 H10. apply (Im_intro T3 (T1 + T3) (fun t0 : T3 => proj1_sig x0 t0 <> FO K) (fun t0 : T3 => inr t0) t3). apply H10. reflexivity. move=> y0. elim (proj2_sig y0). move=> x0 H9. exists x0. apply sig_map. rewrite H9. apply (FiniteSetInduction T3 (exist (Finite T3) (fun t : T3 => proj1_sig x0 t <> FO K) (proj2_sig x0))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H10 H11 H12 H13. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H13. reflexivity. apply H12. apply H12. apply SpanSubspaceVS. Qed. Lemma Corollary_4_10_exists : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), exists (H3 : SubspaceVS K V (Intersection (VT K V) W1 W2)) (H4 : SubspaceVS K V (SumEnsembleVS K V W1 W2)), forall (T1 T2 T3 : Type) (x : T1 -> VT K V) (y : T2 -> VT K V) (z : T3 -> VT K V), BasisSubspaceVS K V (Intersection (VT K V) W1 W2) H3 T1 x -> BasisSubspaceVS K V W1 H1 (T1 + T2) (fun (t : T1 + T2) => match t with | inl t0 => x t0 | inr t0 => y t0 end) -> BasisSubspaceVS K V W2 H2 (T1 + T3) (fun (t : T1 + T3) => match t with | inl t0 => x t0 | inr t0 => z t0 end) -> BasisSubspaceVS K V (SumEnsembleVS K V W1 W2) H4 (T1 + T2 + T3) (fun (t : T1 + T2 + T3) => match t with | inl t0 => (match t0 with | inl t1 => x t1 | inr t1 => y t1 end) | inr t0 => z t0 end). Proof. move=> K V W1 W2 H1 H2. suff: (SubspaceVS K V (Intersection (VT K V) W1 W2)). move=> H3. suff: (SubspaceVS K V (SumEnsembleVS K V W1 W2)). move=> H4. exists H3. exists H4. apply (Corollary_4_10 K V W1 W2 H1 H2 H3 H4). apply (SumSubspaceVS K V W1 W2 H1 H2). apply (IntersectionSubspaceVS K V W1 W2 H1 H2). Qed. Lemma SumEnsembleBasisVS : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2) (H3 : SubspaceVS K V (SumEnsembleVS K V W1 W2)) (T1 T2 : Type) (x : T1 -> VT K V) (y : T2 -> VT K V), (Intersection (VT K V) W1 W2) = (Singleton (VT K V) (VO K V)) -> BasisSubspaceVS K V W1 H1 T1 x -> BasisSubspaceVS K V W2 H2 T2 y -> BasisSubspaceVS K V (SumEnsembleVS K V W1 W2) H3 (T1 + T2) (fun (t : T1 + T2) => match t with | inl t0 => x t0 | inr t0 => y t0 end). Proof. move=> K V W1 W2 H1 H2 H3 T1 T2 x y H4 H5 H6. suff: (SubspaceVS K V (Intersection (VT K V) W1 W2)). move=> H7. suff: (BasisSubspaceVS K V (Intersection (VT K V) W1 W2) H7 {n : nat | Empty_set nat n} (fun (m : {n : nat | Empty_set nat n}) => match (proj2_sig m) with end)). move=> H8. suff: (BasisSubspaceVS K V (SumEnsembleVS K V W1 W2) H3 ({n : nat | Empty_set nat n} + T1 + T2) (fun t : {n : nat | Empty_set nat n} + T1 + T2 => match t with | inl (inl t1) => match proj2_sig t1 with end | inl (inr t1) => x t1 | inr t0 => y t0 end)). elim. move=> H9 H10. suff: (forall (t : T1 + T2), In (VT K V) (SumEnsembleVS K V W1 W2) match t with | inl t0 => x t0 | inr t0 => y t0 end). move=> H11. exists H11. suff: ((fun t : T1 + T2 => exist (SumEnsembleVS K V W1 W2) match t with | inl t0 => x t0 | inr t0 => y t0 end (H11 t)) = (fun (t : T1 + T2) => (fun t : {n : nat | Empty_set nat n} + T1 + T2 => exist (SumEnsembleVS K V W1 W2) match t with | inl (inl t1) => match proj2_sig t1 with end | inl (inr t1) => x t1 | inr t0 => y t0 end (H9 t)) ((fun t : T1 + T2 => match t with | inl t0 => (inl (inr t0)) | inr t0 => (inr t0) end) t))). move=> H12. rewrite H12. apply (BijectiveSaveBasisVS K (SubspaceMakeVS K V (SumEnsembleVS K V W1 W2) H3) (T1 + T2) ({n : nat | Empty_set nat n} + T1 + T2) (fun t : T1 + T2 => match t with | inl t0 => (inl (inr t0)) | inr t0 => (inr t0) end) (fun t : {n : nat | Empty_set nat n} + T1 + T2 => exist (SumEnsembleVS K V W1 W2) match t with | inl (inl t1) => match proj2_sig t1 with end | inl (inr t1) => x t1 | inr t0 => y t0 end (H9 t))). apply InjSurjBij. move=> t1 t2. elim t1. move=> t10. elim t2. move=> t11 H13. suff: (t10 = t11). move=> H14. rewrite H14. reflexivity. apply (injective_inr {n : nat | Empty_set nat n} T1). apply (injective_inl ({n : nat | Empty_set nat n} + T1) T2). apply H13. move=> t11 H13. apply False_ind. suff: (In ({n : nat | Empty_set nat n} + T1 + T2) (fun (t : {n : nat | Empty_set nat n} + T1 + T2) => match t with | inl t0 => True | inr t0 => False end) (inl (inr t10))). rewrite H13. apply. apply I. move=> t11. elim t2. move=> t12 H13. apply False_ind. suff: (In ({n : nat | Empty_set nat n} + T1 + T2) (fun (t : {n : nat | Empty_set nat n} + T1 + T2) => match t with | inl t0 => False | inr t0 => True end) (inr t11)). rewrite H13. apply. apply I. move=> t12 H13. suff: (t11 = t12). move=> H14. rewrite H14. reflexivity. apply (injective_inr ({n : nat | Empty_set nat n} + T1) T2). apply H13. elim. elim. move=> t. elim (proj2_sig t). move=> t1. exists (inl t1). reflexivity. move=> t2. exists (inr t2). reflexivity. apply H10. apply functional_extensionality. move=> t. apply sig_map. simpl. elim t. move=> t1. reflexivity. move=> t2. reflexivity. elim. move=> t1. elim H5. move=> H11 H12. rewrite - (Vadd_O_r K V (x t1)). apply (SumEnsembleVS_intro K V W1 W2 (x t1) (VO K V)). apply (H11 t1). apply (proj2 (proj2 H2)). move=> t2. rewrite - (Vadd_O_l K V (y t2)). apply (SumEnsembleVS_intro K V W1 W2 (VO K V) (y t2)). apply (proj2 (proj2 H1)). elim H6. move=> H11 H12. apply (H11 t2). apply (Corollary_4_10 K V W1 W2 H1 H2 H7 H3 {n : nat | Empty_set nat n} T1 T2 (fun (m : {n : nat | Empty_set nat n}) => match (proj2_sig m) with end) x y H8). suff: (forall t : {n : nat | Empty_set nat n} + T1, In (VT K V) W1 match t with | inl t0 => match proj2_sig t0 with end | inr t0 => x t0 end). move=> H9. exists H9. elim H5. move=> H10 H11. suff: ((fun t : {n : nat | Empty_set nat n} + T1 => exist W1 match t with | inl t0 => match proj2_sig t0 with end | inr t0 => x t0 end (H9 t)) = (fun t : {n : nat | Empty_set nat n} + T1 => exist W1 (x match t with | inl t0 => match proj2_sig t0 with end | inr t0 => t0 end) (H10 match t with | inl t0 => match proj2_sig t0 with end | inr t0 => t0 end))). move=> H12. rewrite H12. apply (BijectiveSaveBasisVS K (SubspaceMakeVS K V W1 H1) ({n : nat | Empty_set nat n} + T1) T1 (fun t : ({n : nat | Empty_set nat n} + T1) => match t with | inl t0 => match (proj2_sig t0) with end | inr t0 => t0 end) (fun (t : T1) => exist W1 (x t) (H10 t))). exists (fun (t : T1) => inr {n : nat | Empty_set nat n} t). apply conj. elim. move=> t. elim (proj2_sig t). move=> t1. reflexivity. move=> t1. reflexivity. apply H11. apply functional_extensionality. elim. move=> t. elim (proj2_sig t). move=> t1. apply sig_map. reflexivity. elim H5. move=> H9 H10. elim. move=> t. elim (proj2_sig t). apply H9. suff: (forall t : {n : nat | Empty_set nat n} + T2, In (VT K V) W2 match t with | inl t0 => match proj2_sig t0 with end | inr t0 => y t0 end). move=> H9. exists H9. elim H6. move=> H10 H11. suff: ((fun t : {n : nat | Empty_set nat n} + T2 => exist W2 match t with | inl t0 => match proj2_sig t0 with end | inr t0 => y t0 end (H9 t)) = (fun t : {n : nat | Empty_set nat n} + T2 => exist W2 (y match t with | inl t0 => match proj2_sig t0 with end | inr t0 => t0 end) (H10 match t with | inl t0 => match proj2_sig t0 with end | inr t0 => t0 end))). move=> H12. rewrite H12. apply (BijectiveSaveBasisVS K (SubspaceMakeVS K V W2 H2) ({n : nat | Empty_set nat n} + T2) T2 (fun t : ({n : nat | Empty_set nat n} + T2) => match t with | inl t0 => match (proj2_sig t0) with end | inr t0 => t0 end) (fun (t : T2) => exist W2 (y t) (H10 t))). exists (fun (t : T2) => inr {n : nat | Empty_set nat n} t). apply conj. elim. move=> t. elim (proj2_sig t). move=> t1. reflexivity. move=> t1. reflexivity. apply H11. apply functional_extensionality. elim. move=> t. elim (proj2_sig t). move=> t1. apply sig_map. reflexivity. elim H6. move=> H9 H10. elim. move=> t. elim (proj2_sig t). apply H9. unfold BasisSubspaceVS. suff: (forall t : {n : nat | Empty_set nat n}, In (VT K V) (Intersection (VT K V) W1 W2) match proj2_sig t with end). move=> H8. exists H8. apply InjSurjBij. move=> x1 x2 H9. apply sig_map. apply functional_extensionality. move=> t. elim (proj2_sig t). move=> t. suff: (Finite {n : nat | Empty_set nat n} (fun (t : {n : nat | Empty_set nat n}) => match (proj2_sig t) with end <> FO K)). move=> H9. exists (exist (fun (G : {n : nat | Empty_set nat n} -> FT K) => Finite {n : nat | Empty_set nat n} (fun t : {n : nat | Empty_set nat n} => G t <> FO K)) (fun (t : {n : nat | Empty_set nat n}) => match (proj2_sig t) with end) H9). suff: ((exist (Finite {n : nat | Empty_set nat n}) (fun t0 : {n : nat | Empty_set nat n} => proj1_sig (exist (fun G : {n : nat | Empty_set nat n} -> FT K => Finite {n : nat | Empty_set nat n} (fun t1 : {n : nat | Empty_set nat n} => G t1 <> FO K)) (fun t1 : {n : nat | Empty_set nat n} => match proj2_sig t1 with end) H9) t0 <> FO K) (proj2_sig (exist (fun G : {n : nat | Empty_set nat n} -> FT K => Finite {n : nat | Empty_set nat n} (fun t0 : {n : nat | Empty_set nat n} => G t0 <> FO K)) (fun t0 : {n : nat | Empty_set nat n} => match proj2_sig t0 with end) H9))) = FiniteEmpty {n : nat | Empty_set nat n}). move=> H10. rewrite H10. rewrite MySumF2Empty. apply sig_map. simpl. suff: (In (VT K V) (Intersection (VT K V) W1 W2) (proj1_sig t)). rewrite {1} H4. elim. reflexivity. apply (proj2_sig t). apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t0. elim (proj2_sig t0). move=> t0. elim (proj2_sig t0). suff: ((fun t0 : {n : nat | Empty_set nat n} => match proj2_sig t0 with end <> FO K) = Empty_set {n : nat | Empty_set nat n}). move=> H9. rewrite H9. apply Empty_is_finite. apply Extensionality_Ensembles. apply conj. move=> t0. elim (proj2_sig t0). move=> t0. elim (proj2_sig t0). move=> t. elim (proj2_sig t). apply (IntersectionSubspaceVS K V W1 W2 H1 H2). Qed. Lemma SumEnsembleBasisVS_exists : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), exists (H3 : SubspaceVS K V (SumEnsembleVS K V W1 W2)), forall (T1 T2 : Type) (x : T1 -> VT K V) (y : T2 -> VT K V), (Intersection (VT K V) W1 W2) = (Singleton (VT K V) (VO K V)) -> BasisSubspaceVS K V W1 H1 T1 x -> BasisSubspaceVS K V W2 H2 T2 y -> BasisSubspaceVS K V (SumEnsembleVS K V W1 W2) H3 (T1 + T2) (fun (t : T1 + T2) => match t with | inl t0 => x t0 | inr t0 => y t0 end). Proof. move=> K V W1 W2 H1 H2. suff: (SubspaceVS K V (SumEnsembleVS K V W1 W2)). move=> H3. exists H3. apply (SumEnsembleBasisVS K V W1 W2 H1 H2 H3). apply (SumSubspaceVS K V W1 W2 H1 H2). Qed. Lemma Formula_P23 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : {n : nat | n < N} -> VT K V) (H : forall (t : (forall (m : {n : nat | n < N}), {v : VT K V | exists (f : FT K), v = Vmul K V f (F m)})), In (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun (m : {n : nat | n < N}) => proj1_sig (t m)))), BasisVS K V {n : nat | n < N} F <-> ((Bijective (DirectProdVST K {n : nat | n < N} (fun (m : {n : nat | n < N}) => SubspaceMakeVS K V (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m)) w} (fun (t : forall (m : {n : nat | n < N}), {v : VT K V | exists (f : FT K), v = Vmul K V f (F m)}) => exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun (m : {n : nat | n < N}) => proj1_sig (t m))) (H t))) /\ (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) = Full_set (VT K V)) /\ forall (m : {n : nat | n < N}), (F m) <> VO K V). Proof. move=> K V N F H1. apply conj. move=> H2. suff: (forall m : {n : nat | n < N}, F m <> VO K V). move=> H3. apply conj. apply InjSurjBij. move=> x1 x2 H4. suff: (exists (a : {n : nat | n < N} -> FT K), (forall (m : {n : nat | n < N}), proj1_sig (x1 m) = Vmul K V (a m) (F m)) /\ forall (m : {n : nat | n < N}), proj1_sig (x2 m) = Vmul K V (a m) (F m)). elim. move=> a H5. apply functional_extensionality_dep. move=> m. apply sig_map. rewrite (proj2 H5 m). apply (proj1 H5 m). suff: (forall (m : {n : nat | n < N}), {f : FT K | proj1_sig (x1 m) = Vmul K V f (F m)}). move=> H5. exists (fun (m : {n : nat | n < N}) => proj1_sig (H5 m)). apply conj. move=> m. apply (proj2_sig (H5 m)). suff: (forall (m : {n : nat | n < N}), {f : FT K | proj1_sig (x2 m) = Vmul K V f (F m)}). move=> H6. suff: ((fun (m : {n : nat | n < N}) => (proj1_sig (H5 m))) = (fun (m : {n : nat | n < N}) => (proj1_sig (H6 m)))). move=> H7 m. suff: ((proj1_sig (H5 m)) = let temp := (fun m : {n : nat | n < N} => proj1_sig (H5 m)) in temp m). move=> H8. rewrite H8. rewrite H7. apply (proj2_sig (H6 m)). reflexivity. apply (proj2 (proj2 (unique_existence (fun (a : Count N -> FT K) => MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (x1 m)) = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)))) (proj1 (FiniteBasisVS K V N F) H2 (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (x1 m)))))). suff: ((fun m : {n : nat | n < N} => proj1_sig (x1 m)) = (fun n : Count N => Vmul K V (proj1_sig (H5 n)) (F n))). move=> H7. rewrite H7. reflexivity. apply functional_extensionality. move=> m. apply (proj2_sig (H5 m)). suff: (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (x1 m)) = proj1_sig (exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (x1 m))) (H1 x1))). move=> H7. rewrite H7. rewrite H4. simpl. suff: ((fun m : {n : nat | n < N} => proj1_sig (x2 m)) = (fun n : Count N => Vmul K V (proj1_sig (H6 n)) (F n))). move=> H8. rewrite H8. reflexivity. apply functional_extensionality. move=> m. apply (proj2_sig (H6 m)). reflexivity. move=> m. apply (constructive_definite_description (fun (f : FT K) => proj1_sig (x2 m) = Vmul K V f (F m))). apply (proj1 (unique_existence (fun (f : FT K) => proj1_sig (x2 m) = Vmul K V f (F m)))). apply conj. apply (proj2_sig (x2 m)). move=> f1 f2 H6 H7. apply (Vmul_eq_reg_r K V (F m) f1 f2). rewrite - H6. apply H7. apply (H3 m). move=> m. apply (constructive_definite_description (fun (f : FT K) => proj1_sig (x1 m) = Vmul K V f (F m))). apply (proj1 (unique_existence (fun (f : FT K) => proj1_sig (x1 m) = Vmul K V f (F m)))). apply conj. apply (proj2_sig (x1 m)). move=> f1 f2 H5 H6. apply (Vmul_eq_reg_r K V (F m) f1 f2). rewrite - H5. apply H6. apply (H3 m). move=> v. suff: (In (VT K V) (fun t : VT K V => exists a : {n : nat | n < N} -> VT K V, (forall m : {n : nat | n < N}, In (VT K V) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (a m)) /\ MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) a = t) (proj1_sig v)). elim. move=> a H4. exists (fun (m : {n : nat | n < N}) => exist (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (a m) (proj1 H4 m)). apply sig_map. apply (proj2 H4). rewrite - (FiniteSumTEnsembleVS K V N (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))). apply (proj2_sig v). apply conj. apply Extensionality_Ensembles. apply conj. move=> v H4. apply (Full_intro (VT K V) v). move=> v H4. elim (proj1 (proj2 (unique_existence (fun (a : Count N -> FT K) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)))) (proj1 (FiniteBasisVS K V N F) H2 v))). move=> a H5. rewrite H5. rewrite (FiniteSumTEnsembleVS K V N (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))). exists (fun n : Count N => Vmul K V (a n) (F n)). apply conj. move=> m. exists (a m). reflexivity. reflexivity. apply H3. move=> m H3. apply (FI_neq_FO K). suff: ((fun (k : {n : nat | n < N}) => match excluded_middle_informative (k = m) with | left _ => FI K | right _ => FO K end) = (fun (k : {n : nat | n < N}) => FO K)). move=> H5. suff: (FI K = let temp := (fun (k : {n : nat | n < N}) => match excluded_middle_informative (k = m) with | left _ => FI K | right _ => FO K end) in temp m). move=> H6. rewrite H6. rewrite H5. reflexivity. simpl. elim (excluded_middle_informative (m = m)). move=> H6. reflexivity. move=> H6. apply False_ind. apply H6. reflexivity. apply (proj2 (proj2 (unique_existence (fun (t : {n : nat | n < N} -> FT K) => VO K V = MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => Vmul K V (t m) (F m)))) (proj1 (FiniteBasisVS K V N F) H2 (VO K V))) ). rewrite MySumF2O. reflexivity. move=> u H4. elim (excluded_middle_informative (u = m)). move=> H5. rewrite H5. rewrite H3. apply (Vmul_O_r K V (FI K)). move=> H5. apply (Vmul_O_l K V (F u)). rewrite MySumF2O. reflexivity. move=> u H4. apply (Vmul_O_l K V (F u)). move=> H2. apply (proj2 (FiniteBasisVS K V N F)). move=> v. apply (proj1 (unique_existence (fun (a : {n : nat | n < N} -> FT K) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n))))). apply conj. suff: (In (VT K V) (fun t : VT K V => exists a : {n : nat | n < N} -> VT K V, (forall m : {n : nat | n < N}, In (VT K V) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (a m)) /\ MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) a = t) v). elim. move=> a H3. suff: (forall (m : {n : nat | n < N}), {f : FT K | a m = Vmul K V f (F m)}). move=> H4. exists (fun (m : {n : nat | n < N}) => proj1_sig (H4 m)). rewrite - (proj2 H3). suff: (a = (fun n : Count N => Vmul K V (proj1_sig (H4 n)) (F n))). move=> H5. rewrite {1} H5. reflexivity. apply functional_extensionality. move=> m. apply (proj2_sig (H4 m)). move=> m. apply (constructive_definite_description (fun (f : FT K) => a m = Vmul K V f (F m))). apply (proj1 (unique_existence (fun (f : FT K) => a m = Vmul K V f (F m)))). apply conj. elim (proj1 H3 m). move=> f H4. exists f. apply H4. move=> f1 f2 H4 H5. apply (Vmul_eq_reg_r K V (F m) f1 f2). rewrite - H4. apply H5. apply (proj2 (proj2 H2) m). rewrite - (FiniteSumTEnsembleVS K V N (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))). rewrite (proj1 (proj2 H2)). apply (Full_intro (VT K V) v). suff: (forall (a : {n : nat | n < N} -> FT K) (m : {n : nat | n < N}), In (VT K V) (fun (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) (Vmul K V (a m) (F m))). move=> H3 a1 a2 H4 H5. suff: ((fun n : Count N => exist (fun v : VT K V => exists f : FT K, v = Vmul K V f (F n)) (Vmul K V (a1 n) (F n)) (H3 a1 n)) = (fun n : Count N => exist (fun v : VT K V => exists f : FT K, v = Vmul K V f (F n)) (Vmul K V (a2 n) (F n)) (H3 a2 n))). move=> H6. apply functional_extensionality. move=> m. apply (Vmul_eq_reg_r K V (F m) (a1 m) (a2 m)). suff: (Vmul K V (a1 m) (F m) = let temp := (fun n : Count N => exist (fun v : VT K V => exists f : FT K, v = Vmul K V f (F n)) (Vmul K V (a1 n) (F n)) (H3 a1 n)) in proj1_sig (temp m)). move=> H7. rewrite H7. rewrite H6. reflexivity. reflexivity. apply (proj2 (proj2 H2) m). apply (BijInj (DirectProdVST K {n : nat | n < N} (fun m : {n : nat | n < N} => SubspaceMakeVS K V (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) w} (fun t : forall m : {n : nat | n < N}, {v : VT K V | exists f : FT K, v = Vmul K V f (F m)} => exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (t m))) (H1 t))). apply (proj1 H2). apply sig_map. simpl. rewrite - H4. apply H5. move=> a m. exists (a m). reflexivity. Qed. Lemma Formula_P23_exists : forall (K : Field) (V : VectorSpace K) (N : nat) (F : {n : nat | n < N} -> VT K V), exists (H : forall (t : (forall (m : {n : nat | n < N}), {v : VT K V | exists (f : FT K), v = Vmul K V f (F m)})), In (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun (m : {n : nat | n < N}) => proj1_sig (t m)))), BasisVS K V {n : nat | n < N} F <-> ((Bijective (DirectProdVST K {n : nat | n < N} (fun (m : {n : nat | n < N}) => SubspaceMakeVS K V (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m)) w} (fun (t : forall (m : {n : nat | n < N}), {v : VT K V | exists (f : FT K), v = Vmul K V f (F m)}) => exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun (m : {n : nat | n < N}) => proj1_sig (t m))) (H t))) /\ (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) = Full_set (VT K V)) /\ forall (m : {n : nat | n < N}), (F m) <> VO K V). Proof. move=> K V N F. suff: (forall (t : forall m : {n : nat | n < N}, {v : VT K V | exists f : FT K, v = Vmul K V f (F m)}), In (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (t m)))). move=> H1. exists H1. apply (Formula_P23 K V N F H1). move=> t. rewrite (FiniteSumTEnsembleVS K V N (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))). exists (fun (m : {n : nat | n < N}) => proj1_sig (t m)). apply conj. move=> m. apply (proj2_sig (t m)). reflexivity. Qed. Definition LinearlyIndependentVS (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V) := BasisVS K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) T (fun (t : T) => exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)). Lemma BijectiveSaveLinearlyIndependentVS : forall (K : Field) (V : VectorSpace K) (T1 T2 : Type) (F : T1 -> T2) (G : T2 -> VT K V), Bijective T1 T2 F -> LinearlyIndependentVS K V T2 G -> LinearlyIndependentVS K V T1 (compose G F). Proof. move=> K V T1 T2 F G H1 H2. suff: (forall (x : T1 -> VT K V) (A1 A2 : Ensemble (VT K V)), A1 = A2 -> forall (H1 : SubspaceVS K V A1) (H2 : SubspaceVS K V A2) (H3 : forall (t : T1), In (VT K V) A1 (x t)) (H4 : forall (t : T1), In (VT K V) A2 (x t)), BasisVS K (SubspaceMakeVS K V A1 H1) T1 (fun t : T1 => exist A1 (x t) (H3 t)) -> BasisVS K (SubspaceMakeVS K V A2 H2) T1 (fun t : T1 => exist A2 (x t) (H4 t))). move=> H3. suff: (SpanVS K V T2 G = SpanVS K V T1 (fun t : T1 => G (F t))). move=> H4. suff: (forall t : T1, In (VT K V) (SpanVS K V T2 G) (G (F t))). move=> H5. apply (H3 (fun t : T1 => G (F t)) (SpanVS K V T2 G) (SpanVS K V T1 (fun t : T1 => G (F t))) H4 (SpanSubspaceVS K V T2 G) (SpanSubspaceVS K V T1 (fun t : T1 => G (F t))) H5 (SpanContainSelfVS K V T1 (fun t0 : T1 => G (F t0)))). suff: ((fun t : T1 => exist (SpanVS K V T2 G) (G (F t)) (H5 t)) = (fun t : T1 => exist (SpanVS K V T2 G) (G (F t)) (SpanContainSelfVS K V T2 G (F t)))). move=> H6. rewrite H6. apply (BijectiveSaveBasisVS K (SubspaceMakeVS K V (SpanVS K V T2 G) (SpanSubspaceVS K V T2 G)) T1 T2 F (fun t : T2 => exist (SpanVS K V T2 G) (G t) (SpanContainSelfVS K V T2 G t)) H1 H2). apply functional_extensionality. move=> t. apply sig_map. reflexivity. move=> t. apply (SpanContainSelfVS K V T2 G (F t)). apply (BijectiveSaveSpanVS K V T1 T2 F G H1). move=> x A1 A2 H3. rewrite H3. move=> H4 H5 H6 H7. suff: (H4 = H5). move=> H8. suff: (H6 = H7). move=> H9. rewrite H8. rewrite H9. apply. apply proof_irrelevance. apply proof_irrelevance. Qed. Lemma IsomorphicSaveLinearlyIndependentVS : forall (K : Field) (V1 V2 : VectorSpace K) (T : Type) (F : T -> VT K V1) (G : VT K V1 -> VT K V2), IsomorphicVS K V1 V2 G -> LinearlyIndependentVS K V1 T F -> LinearlyIndependentVS K V2 T (compose G F). Proof. move=> K V1 V2 T F G H1 H2. unfold LinearlyIndependentVS. suff: (forall (v : VT K V1), (SpanVS K V1 T F) v -> (SpanVS K V2 T (fun t : T => G (F t))) (G v)). move=> H3. suff: ((fun t : T => exist (SpanVS K V2 T (fun t0 : T => G (F t0))) (G (F t)) (SpanContainSelfVS K V2 T (fun t0 : T => G (F t0)) t)) = (fun t : T => exist (SpanVS K V2 T (fun t0 : T => G (F t0))) (G (proj1_sig (exist (SpanVS K V1 T F) (F t) (SpanContainSelfVS K V1 T F t)))) (H3 (proj1_sig (exist (SpanVS K V1 T F) (F t) (SpanContainSelfVS K V1 T F t))) (proj2_sig (exist (SpanVS K V1 T F) (F t) (SpanContainSelfVS K V1 T F t)))))). move=> H4. rewrite H4. apply (IsomorphicSaveBasisVS K (SubspaceMakeVS K V1 (SpanVS K V1 T F) (SpanSubspaceVS K V1 T F)) (SubspaceMakeVS K V2 (SpanVS K V2 T (fun t : T => G (F t))) (SpanSubspaceVS K V2 T (fun t : T => G (F t)))) T (fun t : T => exist (SpanVS K V1 T F) (F t) (SpanContainSelfVS K V1 T F t)) (fun v0 : {v : VT K V1 | SpanVS K V1 T F v} => exist (SpanVS K V2 T (fun t : T => G (F t))) (G (proj1_sig v0)) (H3 (proj1_sig v0) (proj2_sig v0)))). apply conj. apply (InjSurjBij {v : VT K V1 | SpanVS K V1 T F v} {v : VT K V2 | SpanVS K V2 T (fun t : T => G (F t)) v}). move=> v1 v2 H5. apply sig_map. apply (BijInj (VT K V1) (VT K V2) G (proj1 H1) (proj1_sig v1) (proj1_sig v2)). suff: (G (proj1_sig v1) = proj1_sig (exist (SpanVS K V2 T (fun t : T => G (F t))) (G (proj1_sig v1)) (H3 (proj1_sig v1) (proj2_sig v1)))). move=> H6. rewrite H6. rewrite H5. reflexivity. reflexivity. move=> v. elim (BijSurj (VT K V1) (VT K V2) G (proj1 H1) (proj1_sig v)). move=> v0 H5. suff: (In (VT K V1) (SpanVS K V1 T F) v0). move=> H6. exists (exist (SpanVS K V1 T F) v0 H6). apply sig_map. apply H5. elim (proj2_sig v). move=> x H6. exists x. apply (BijInj (VT K V1) (VT K V2) G (proj1 H1) v0 (MySumF2 T (exist (Finite T) (fun t : T => proj1_sig x t <> FO K) (proj2_sig x)) (VSPCM K V1) (fun t : T => Vmul K V1 (proj1_sig x t) (F t)))). rewrite H5. rewrite H6. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => proj1_sig x t <> FO K) (proj2_sig x))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite - (Vmul_O_l K V1 (VO K V1)). rewrite (proj2 (proj2 H1)). rewrite (Vmul_O_l K V2 (G (VO K V1))). reflexivity. move=> B b H7 H8 H9 H10. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite (proj1 (proj2 H1) (MySumF2 T B (VSPCM K V1) (fun t : T => Vmul K V1 (proj1_sig x t) (F t))) (Vmul K V1 (proj1_sig x b) (F b))). rewrite H10. rewrite (proj2 (proj2 H1) (proj1_sig x b) (F b)). reflexivity. apply H9. apply H9. apply conj. move=> v1 v2. apply sig_map. apply (proj1 (proj2 H1) (proj1_sig v1) (proj1_sig v2)). move=> c v. apply sig_map. apply (proj2 (proj2 H1) c (proj1_sig v)). apply H2. apply functional_extensionality. move=> t. apply sig_map. reflexivity. move=> v. elim. move=> x H3. exists x. rewrite H3. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => proj1_sig x t <> FO K) (proj2_sig x))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite - (Vmul_O_l K V1 (VO K V1)). rewrite (proj2 (proj2 H1)). rewrite (Vmul_O_l K V2 (G (VO K V1))). reflexivity. move=> B b H4 H5 H6 H7. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite (proj1 (proj2 H1) (MySumF2 T B (VSPCM K V1) (fun t : T => Vmul K V1 (proj1_sig x t) (F t))) (Vmul K V1 (proj1_sig x b) (F b))). rewrite H7. rewrite (proj2 (proj2 H1) (proj1_sig x b) (F b)). reflexivity. apply H6. apply H6. Qed. Lemma LinearlyIndependentVSDef2 : forall (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V), LinearlyIndependentVS K V T F <-> (forall (a : DirectSumField K T), MySumF2 T (exist (Finite T) (fun t : T => proj1_sig a t <> FO K) (proj2_sig a)) (VSPCM K V) (fun (t : T) => Vmul K V (proj1_sig a t) (F t)) = VO K V -> forall (t : T), proj1_sig a t = FO K). Proof. move=> K V T F. apply conj. move=> H1 a H2. suff: (Finite T (fun (t : T) => FO K <> FO K)). move=> H3. suff: (a = exist (fun (G : T -> FT K) => Finite T (fun (t : T) => G t <> FO K)) (fun (t : T) => FO K) H3). move=> H4 t. rewrite H4. reflexivity. apply (BijInj (DirectSumField K T) (VT K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun (g : DirectSumField K T) => MySumF2 T (exist (Finite T) (fun t : T => proj1_sig g t <> FO K) (proj2_sig g)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => Vmul K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) (proj1_sig g t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)))) H1). simpl. apply sig_map. rewrite (MySumF2O T (exist (Finite T) (fun _ : T => FO K <> FO K) H3)). simpl. suff: (proj1_sig (MySumF2 T (exist (Finite T) (fun t : T => proj1_sig a t <> FO K) (proj2_sig a)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => SubspaceMakeVSVmul K V (SpanVS K V T F) (SpanSubspaceVS K V T F) (proj1_sig a t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)))) = MySumF2 T (exist (Finite T) (fun t : T => proj1_sig a t <> FO K) (proj2_sig a)) (VSPCM K V) (fun t : T => Vmul K V (proj1_sig a t) (F t))). move=> H4. rewrite H4. rewrite H2. reflexivity. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => proj1_sig a t <> FO K) (proj2_sig a))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H4 H5 H6 H7. rewrite MySumF2Add. rewrite MySumF2Add. rewrite - H7. reflexivity. apply H6. apply H6. move=> u H4. apply False_ind. apply H4. reflexivity. suff: ((fun _ : T => FO K <> FO K) = Empty_set T). move=> H3. rewrite H3. apply (Empty_is_finite T). apply Extensionality_Ensembles. apply conj. move=> t H3. apply False_ind. apply H3. reflexivity. move=> t. elim. move=> H1. apply InjSurjBij. move=> g1 g2 H2. suff: (forall (t : T), Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t)) = FO K). move=> H3. apply sig_map. apply functional_extensionality. move=> t. apply (Fminus_diag_uniq K (proj1_sig g1 t) (proj1_sig g2 t) (H3 t)). suff: (Finite T (fun (t : T) => Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t)) <> FO K)). move=> H3. apply (H1 (exist (fun (G : T -> FT K) => Finite T (fun (t : T) => G t <> FO K)) (fun (t : T) => Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t))) H3)). simpl. suff: (MySumF2 T (exist (Finite T) (fun t : T => Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t)) <> FO K) H3) (VSPCM K V) (fun t : T => Vmul K V (Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t))) (F t)) = Vadd K V (proj1_sig (MySumF2 T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => Vmul K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) (proj1_sig g1 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t))))) (Vopp K V (proj1_sig (MySumF2 T (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => Vmul K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) (proj1_sig g2 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t))))))). move=> H4. rewrite H4. rewrite H2. apply (Vadd_opp_r K V). suff: (MySumF2 T (exist (Finite T) (fun t : T => Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t)) <> FO K) H3) (VSPCM K V) (fun t : T => Vmul K V (Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t))) (F t)) = MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2))) (VSPCM K V) (fun t : T => Vmul K V (Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t))) (F t))). move=> H4. rewrite H4. suff: ((MySumF2 T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => Vmul K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) (proj1_sig g1 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)))) = (MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2))) (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => Vmul K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) (proj1_sig g1 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t))))). move=> H5. rewrite H5. suff: ((MySumF2 T (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => Vmul K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) (proj1_sig g2 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)))) = (MySumF2 T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2))) (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => Vmul K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) (proj1_sig g2 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t))))). move=> H6. rewrite H6. apply (FiniteSetInduction T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2)))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite (Vadd_opp_r K V). reflexivity. move=> B b H7 H8 H9 H10. rewrite MySumF2Add. rewrite MySumF2Add. rewrite MySumF2Add. rewrite H10. simpl. rewrite (Vadd_assoc K V (proj1_sig (MySumF2 T B (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => SubspaceMakeVSVmul K V (SpanVS K V T F) (SpanSubspaceVS K V T F) (proj1_sig g1 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t))))) (Vmul K V (proj1_sig g1 b) (F b))). rewrite (Vopp_add_distr K V). rewrite - (Vadd_assoc K V (Vmul K V (proj1_sig g1 b) (F b)) (Vopp K V (proj1_sig (MySumF2 T B (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => SubspaceMakeVSVmul K V (SpanVS K V T F) (SpanSubspaceVS K V T F) (proj1_sig g2 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t))))))). rewrite (Vadd_comm K V (Vmul K V (proj1_sig g1 b) (F b))). rewrite (Vadd_assoc K V (Vopp K V (proj1_sig (MySumF2 T B (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => SubspaceMakeVSVmul K V (SpanVS K V T F) (SpanSubspaceVS K V T F) (proj1_sig g2 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t))))))). rewrite - (Vadd_assoc K V (proj1_sig (MySumF2 T B (VSPCM K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F))) (fun t : T => SubspaceMakeVSVmul K V (SpanVS K V T F) (SpanSubspaceVS K V T F) (proj1_sig g1 t) (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)))))). rewrite (Vmul_add_distr_r K V). rewrite (Vopp_mul_distr_l K V). reflexivity. apply H9. apply H9. apply H9. rewrite (MySumF2Included T (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2)) (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2)))). rewrite (MySumF2O T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2))) (Complement T (proj1_sig (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2)))))). apply sig_map. simpl. rewrite (Vadd_O_r K). reflexivity. move=> u. elim. move=> u0 H6 H7. apply sig_map. simpl. suff: ((proj1_sig g2 u0) = FO K). move=> H8. rewrite H8. apply (Vmul_O_l K V (F u0)). apply NNPP. apply H6. move=> t H6. right. apply H6. rewrite (MySumF2Included T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2)))). rewrite (MySumF2O T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2))) (Complement T (proj1_sig (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)))))). apply sig_map. simpl. rewrite (Vadd_O_r K). reflexivity. move=> u. elim. move=> u0 H5 H6. apply sig_map. simpl. suff: ((proj1_sig g1 u0) = FO K). move=> H7. rewrite H7. apply (Vmul_O_l K V (F u0)). apply NNPP. apply H5. move=> t H5. left. apply H5. rewrite (MySumF2Included T (exist (Finite T) (fun t : T => Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t)) <> FO K) H3) (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2)))). rewrite (MySumF2O T (FiniteIntersection T (FiniteUnion T (exist (Finite T) (fun t : T => proj1_sig g1 t <> FO K) (proj2_sig g1)) (exist (Finite T) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g2))) (Complement T (proj1_sig (exist (Finite T) (fun t : T => Fadd K (proj1_sig g1 t) (Fopp K (proj1_sig g2 t)) <> FO K) H3))))). simpl. rewrite (Vadd_O_r K). reflexivity. move=> u. elim. move=> u0 H4 H5. simpl. suff: ((Fadd K (proj1_sig g1 u0) (Fopp K (proj1_sig g2 u0))) = FO K). move=> H6. rewrite H6. apply (Vmul_O_l K V (F u0)). apply NNPP. apply H4. move=> t H4. apply NNPP. move=> H5. apply H4. suff: ((proj1_sig g1 t) = FO K). move=> H6. suff: ((proj1_sig g2 t) = FO K). move=> H7. rewrite H6. rewrite H7. apply (Fadd_opp_r K). apply NNPP. move=> H7. apply H5. right. apply H7. apply NNPP. move=> H6. apply H5. left. apply H6. apply (Finite_downward_closed T (Union T (fun t : T => proj1_sig g1 t <> FO K) (fun t : T => proj1_sig g2 t <> FO K))). apply (Union_preserves_Finite T (fun t : T => proj1_sig g1 t <> FO K) (fun t : T => proj1_sig g2 t <> FO K) (proj2_sig g1) (proj2_sig g2)). move=> t H3. apply NNPP. move=> H4. apply H3. suff: ((proj1_sig g1 t) = FO K). move=> H5. suff: ((proj1_sig g2 t) = FO K). move=> H6. rewrite H5. rewrite H6. apply (Fadd_opp_r K). apply NNPP. move=> H6. apply H4. right. apply H6. apply NNPP. move=> H5. apply H4. left. apply H5. move=> v. elim (proj2_sig v). move=> x H2. exists x. apply sig_map. rewrite H2. apply (FiniteSetInduction T (exist (Finite T) (fun t : T => proj1_sig x t <> FO K) (proj2_sig x))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H3 H4 H5 H6. rewrite MySumF2Add. rewrite MySumF2Add. rewrite - H6. reflexivity. apply H5. apply H5. Qed. Lemma LinearlyIndependentVSDef3 : forall (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V), LinearlyIndependentVS K V T F <-> (forall (a : T -> FT K) (A : {X : Ensemble T | Finite T X}), MySumF2 T A (VSPCM K V) (fun (t : T) => Vmul K V (a t) (F t)) = VO K V -> forall (t : T), In T (proj1_sig A) t -> a t = FO K). Proof. move=> K V T F. apply conj. move=> H1 a A H2. suff: (forall (t : T), match excluded_middle_informative ((proj1_sig A) t) with | left _ => a t | right _ => FO K end = FO K). move=> H3 t H4. rewrite - (H3 t). elim (excluded_middle_informative (proj1_sig A t)). move=> H5. reflexivity. move=> H5. apply False_ind. apply (H5 H4). suff: (Finite T (fun (t : T) => (match excluded_middle_informative (proj1_sig A t) with | left _ => a t | right _ => FO K end) <> FO K)). move=> H3. apply (proj1 (LinearlyIndependentVSDef2 K V T F) H1 (exist (fun (G : T -> FT K) => Finite T (fun (t : T) => G t <> FO K)) (fun (t : T) => (match excluded_middle_informative (proj1_sig A t) with | left _ => a t | right _ => FO K end)) H3)). simpl. rewrite - H2. rewrite (MySumF2Included T (exist (Finite T) (fun t : T => (match excluded_middle_informative (proj1_sig A t) with | left _=> a t | right _ => FO K end) <> FO K) H3) A). rewrite (MySumF2O T (FiniteIntersection T A (Complement T (proj1_sig (exist (Finite T) (fun t : T => (match excluded_middle_informative (proj1_sig A t) with | left _ => a t | right _ => FO K end) <> FO K) H3))))). rewrite (CM_O_r (VSPCM K V)). apply (MySumF2Same T (exist (Finite T) (fun t : T => (match excluded_middle_informative (proj1_sig A t) with | left _=> a t | right _ => FO K end) <> FO K) H3) (VSPCM K V)). move=> u. simpl. elim (excluded_middle_informative (proj1_sig A u)). move=> H4 H5. reflexivity. move=> H4 H5. apply False_ind. apply H5. reflexivity. move=> u. elim. move=> u0 H4 H5. suff: (a u0 = FO K). move=> H6. rewrite H6. apply (Vmul_O_l K V). apply NNPP. move=> H6. apply H4. unfold In. simpl. elim (excluded_middle_informative (proj1_sig A u0)). move=> H7. apply H6. move=> H7. apply False_ind. apply (H7 H5). move=> t. simpl. unfold In. elim (excluded_middle_informative (proj1_sig A t)). move=> H4 H5. apply H4. move=> H4 H5. apply False_ind. apply H5. reflexivity. apply (Finite_downward_closed T (proj1_sig A) (proj2_sig A)). move=> t. unfold In. elim (excluded_middle_informative (proj1_sig A t)). move=> H3 H4. apply H3. move=> H3 H4. apply False_ind. apply H4. reflexivity. move=> H1. apply (proj2 (LinearlyIndependentVSDef2 K V T F)). move=> a H2 t. elim (classic (proj1_sig a t = FO K)). apply. apply (H1 (proj1_sig a) (exist (Finite T) (fun t : T => proj1_sig a t <> FO K) (proj2_sig a)) H2). Qed. Lemma InjectiveSaveLinearlyIndependentVS : forall (K : Field) (V : VectorSpace K) (T1 T2 : Type) (F : T1 -> T2) (G : T2 -> VT K V), Injective T1 T2 F -> LinearlyIndependentVS K V T2 G -> LinearlyIndependentVS K V T1 (compose G F). Proof. move=> K V T1 T2 F G H1 H2. apply (proj2 (LinearlyIndependentVSDef3 K V T1 (fun t : T1 => G (F t)))). move=> a A H3. suff: (forall (t2 : T2), (exists (t1 : T1), t2 = F t1) -> {t1 : T1 | F t1 = t2}). move=> H4. suff: (Finite T2 (fun (t2 : T2) => exists (t1 : T1), t2 = F t1 /\ In T1 (proj1_sig A) t1)). move=> H5. suff: (forall (t : T2), In T2 (fun (t2 : T2) => exists (t1 : T1), t2 = F t1 /\ In T1 (proj1_sig A) t1) t -> match excluded_middle_informative (exists (t1 : T1), t = F t1) with | left H => a (proj1_sig (H4 t H)) | right _ => FO K end = FO K). move=> H6 t H7. rewrite - (H6 (F t)). elim (excluded_middle_informative (exists (t1 : T1), F t = F t1)). move=> H8. suff: ((proj1_sig (H4 (F t) H8)) = t). move=> H9. rewrite H9. reflexivity. apply H1. apply (proj2_sig (H4 (F t) H8)). move=> H8. apply False_ind. apply H8. exists t. reflexivity. exists t. apply conj. reflexivity. apply H7. apply (proj1 (LinearlyIndependentVSDef3 K V T2 G) H2 (fun (t2 : T2) => match excluded_middle_informative (exists (t1 : T1), t2 = F t1) with | left H => (a (proj1_sig (H4 t2 H))) | right _ => FO K end) (exist (Finite T2) (fun (t2 : T2) => exists (t1 : T1), t2 = F t1 /\ In T1 (proj1_sig A) t1) H5)). rewrite - H3. rewrite - (MySumF2BijectiveSame T1 A T2 (exist (Finite T2) (fun t2 : T2 => exists t1 : T1, t2 = F t1 /\ In T1 (proj1_sig A) t1) H5) (VSPCM K V) (fun (t : T2) => Vmul K V match excluded_middle_informative (exists t1 : T1, t = F t1) with | left H => a (proj1_sig (H4 t H)) | right _ => FO K end (G t)) F). suff: ((fun u : T1 => Vmul K V match excluded_middle_informative (exists t1 : T1, F u = F t1) with | left H => a (proj1_sig (H4 (F u) H)) | right _ => FO K end (G (F u))) = (fun t : T1 => Vmul K V (a t) (G (F t)))). move=> H6. rewrite H6. reflexivity. apply functional_extensionality. move=> u. elim (excluded_middle_informative (exists t1 : T1, F u = F t1)). move=> H6. suff: ((proj1_sig (H4 (F u) H6)) = u). move=> H7. rewrite H7. reflexivity. apply H1. apply (proj2_sig (H4 (F u) H6)). move=> H6. apply False_ind. apply H6. exists u. reflexivity. move=> u H6. exists u. apply conj. reflexivity. apply H6. move=> H6. simpl. apply InjSurjBij. move=> u1 u2 H7. apply sig_map. apply H1. suff: (F (proj1_sig u1) = proj1_sig (exist (fun t2 : T2 => exists t1 : T1, t2 = F t1 /\ In T1 (proj1_sig A) t1) (F (proj1_sig u1)) (H6 (proj1_sig u1) (proj2_sig u1)))). move=> H8. rewrite H8. rewrite H7. reflexivity. reflexivity. elim. move=> u H7. elim H7. move=> t H8. exists (exist (proj1_sig A) t (proj2 H8)). apply sig_map. simpl. rewrite(proj1 H8). reflexivity. suff: ((fun t2 : T2 => exists t1 : T1, t2 = F t1 /\ In T1 (proj1_sig A) t1) = Im T1 T2 (proj1_sig A) F). move=> H5. rewrite H5. apply (finite_image T1 T2 (proj1_sig A) F (proj2_sig A)). apply Extensionality_Ensembles. apply conj. move=> t2. elim. move=> t1 H5. apply (Im_intro T1 T2 (proj1_sig A) F t1 (proj2 H5)). apply (proj1 H5). move=> t2. elim. move=> t1 H5 y H6. exists t1. apply conj. apply H6. apply H5. move=> t2 H4. apply (constructive_definite_description (fun (t1 : T1) => F t1 = t2)). apply (proj1 (unique_existence (fun (t1 : T1) => F t1 = t2))). apply conj. elim H4. move=> t1 H5. exists t1. rewrite H5. reflexivity. move=> x1 x2 H5 H6. apply H1. rewrite H6. apply H5. Qed. Lemma InjectiveSaveLinearlyIndependentVS2 : forall (K : Field) (V1 V2 : VectorSpace K) (T : Type) (F : T -> VT K V1) (G : VT K V1 -> VT K V2), (Injective (VT K V1) (VT K V2) G /\ (forall (x y : VT K V1), G (Vadd K V1 x y) = Vadd K V2 (G x) (G y)) /\ (forall (c : FT K) (x : VT K V1), G (Vmul K V1 c x) = Vmul K V2 c (G x))) -> LinearlyIndependentVS K V1 T F -> LinearlyIndependentVS K V2 T (compose G F). Proof. move=> K V1 V2 T F G H1 H2. apply (proj2 (LinearlyIndependentVSDef3 K V2 T (fun t : T => G (F t)))). move=> a A H3. apply (proj1 (LinearlyIndependentVSDef3 K V1 T F) H2 a A). apply (proj1 H1). rewrite - (Vmul_O_l K V1 (VO K V1)). rewrite (proj2 (proj2 H1) (FO K) (VO K V1)). rewrite (Vmul_O_l K V2 (G (VO K V1))). rewrite - H3. apply (FiniteSetInduction T A). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite - (Vmul_O_l K V1 (VO K V1)). rewrite (proj2 (proj2 H1) (FO K) (VO K V1)). apply (Vmul_O_l K V2 (G (VO K V1))). move=> B b H4 H5 H6 H7. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite (proj1 (proj2 H1)). rewrite (proj2 (proj2 H1) (a b) (F b)). rewrite H7. reflexivity. apply H6. apply H6. Qed. Lemma LinearlyIndependentInjectiveVS : forall (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V), LinearlyIndependentVS K V T F -> Injective T (VT K V) F. Proof. move=> K V T F H1 t1 t2 H2. apply NNPP. move=> H3. apply (FI_neq_FO K). suff: (MySumF2 T (FiniteAdd T (FiniteSingleton T t1) t2) (VSPCM K V) (fun (t : T) => Vmul K V (match excluded_middle_informative (t = t1) with | left _ => FI K | right _ => match excluded_middle_informative (t = t2) with | left _ => Fopp K (FI K) | right _ => FO K end end) (F t)) = VO K V). move=> H4. suff: (FI K = match excluded_middle_informative (t1 = t1) with | left _ => FI K | right _ => match excluded_middle_informative (t1 = t2) with | left _ => Fopp K (FI K) | right _ => FO K end end). move=> H5. rewrite H5. apply (proj1 (LinearlyIndependentVSDef3 K V T F) H1 (fun (t : T) => match excluded_middle_informative (t = t1) with | left _ => FI K | right _ => match excluded_middle_informative (t = t2) with | left _ => Fopp K (FI K) | right _ => FO K end end) (FiniteAdd T (FiniteSingleton T t1) t2) H4 t1). left. apply (In_singleton T t1). elim (excluded_middle_informative (t1 = t1)). move=> H5. reflexivity. move=> H5. apply False_ind. apply H5. reflexivity. rewrite MySumF2Add. rewrite MySumF2Singleton. elim (excluded_middle_informative (t1 = t1)). move=> H4. elim (excluded_middle_informative (t2 = t1)). move=> H5. apply False_ind. apply H3. rewrite H5. reflexivity. move=> H6. elim (excluded_middle_informative (t2 = t2)). move=> H7. rewrite H2. simpl. rewrite - (Vmul_add_distr_r K V (FI K) (Fopp K (FI K)) (F t2)). rewrite (Fadd_opp_r K (FI K)). apply (Vmul_O_l K V (F t2)). move=> H7. apply False_ind. apply H7. reflexivity. move=> H4. apply False_ind. apply H4. reflexivity. move=> H4. apply H3. elim H4. reflexivity. Qed. Lemma FiniteLinearlyIndependentVS : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), (LinearlyIndependentVS K V (Count N) F) <-> (forall (a : Count N -> FT K), MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun (n : Count N) => Vmul K V (a n) (F n)) = VO K V -> forall (m : Count N), a m = FO K). Proof. move=> K V N F. apply conj. suff: (forall (a : Count N -> FT K), In (VT K V) (SpanVS K V (Count N) F) (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n)))). move=> H1 H2 a H3. suff: (a = (fun (m : Count N) => FO K)). move=> H4 m. rewrite H4. reflexivity. suff: (In (VT K V) (SpanVS K V (Count N) F) (VO K V)). move=> H4. apply (proj2 (proj2 (unique_existence (fun (a : Count N -> FT K) => (exist (SpanVS K V (Count N) F) (VO K V) H4) = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F))) (fun n : Count N => Vmul K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F)) (a n) (exist (SpanVS K V (Count N) F) (F n) (SpanContainSelfVS K V (Count N) F n))))) (proj1 (FiniteBasisVS K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F)) N (fun t : Count N => exist (SpanVS K V (Count N) F) (F t) (SpanContainSelfVS K V (Count N) F t))) H2 (exist (SpanVS K V (Count N) F) (VO K V) H4)))) . suff: (proj1_sig (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F))) (fun n : Count N => Vmul K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F)) (a n) (exist (SpanVS K V (Count N) F) (F n) (SpanContainSelfVS K V (Count N) F n)))) = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n))). move=> H5. apply sig_map. rewrite H5. rewrite H3. reflexivity. apply (FiniteSetInduction (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H5 H6 H7 H8. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H8. reflexivity. apply H7. apply H7. rewrite MySumF2O. apply sig_map. reflexivity. move=> u H5. rewrite (Vmul_O_l K). apply sig_map. reflexivity. apply (proj2 (proj2 (SpanSubspaceVS K V (Count N) F))). move=> a. rewrite (FiniteSpanVS K V N F). exists a. reflexivity. move=> H1. apply (proj2 (FiniteBasisVS K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F)) N (fun t : Count N => exist (SpanVS K V (Count N) F) (F t) (SpanContainSelfVS K V (Count N) F t)))). move=> v. apply (unique_existence (fun (a : Count N -> FT K) => v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F))) (fun n : Count N => Vmul K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F)) (a n) (exist (SpanVS K V (Count N) F) (F n) (SpanContainSelfVS K V (Count N) F n))))). apply conj. suff: (In (VT K V) (fun v : VT K V => exists a : Count N -> FT K, v = MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a n) (F n))) (proj1_sig v)). elim. move=> a H2. exists a. apply sig_map. rewrite H2. apply (FiniteSetInduction (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H3 H4 H5 H6. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H6. reflexivity. apply H5. apply H5. rewrite - (FiniteSpanVS K V N F). apply (proj2_sig v). move=> a1 a2 H2 H3. suff: (forall (m : Count N), Fadd K (a1 m) (Fopp K (a2 m)) = FO K). move=> H4. apply functional_extensionality. move=> m. apply (Fminus_diag_uniq K (a1 m) (a2 m) (H4 m)). apply H1. suff: (VO K V = proj1_sig (VO K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F)))). move=> H4. rewrite H4. rewrite - (Vadd_opp_r K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F)) v). rewrite {1} H2. rewrite H3. apply (FiniteSetInduction (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite (Vadd_opp_r K V (VO K V)). reflexivity. move=> B b H5 H6 H7 H8. rewrite MySumF2Add. rewrite MySumF2Add. rewrite MySumF2Add. rewrite H8. simpl. suff: (forall (t1 t2 : VT K V), Vadd K V (Vadd K V t1 (Vopp K V t2)) (Vmul K V (Fadd K (a1 b) (Fopp K (a2 b))) (F b)) = Vadd K V (Vadd K V t1 (Vmul K V (a1 b) (F b))) (Vopp K V (Vadd K V t2 (Vmul K V (a2 b) (F b))))). move=> H9. apply (H9 (proj1_sig (MySumF2 (Count N) B (VSPCM K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F))) (fun n : Count N => SubspaceMakeVSVmul K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F) (a1 n) (exist (SpanVS K V (Count N) F) (F n) (SpanContainSelfVS K V (Count N) F n))))) (proj1_sig (MySumF2 (Count N) B (VSPCM K (SubspaceMakeVS K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F))) (fun n : Count N => SubspaceMakeVSVmul K V (SpanVS K V (Count N) F) (SpanSubspaceVS K V (Count N) F) (a2 n) (exist (SpanVS K V (Count N) F) (F n) (SpanContainSelfVS K V (Count N) F n)))))). move=> t1 t2. rewrite (Vmul_add_distr_r K V (a1 b) (Fopp K (a2 b)) (F b)). rewrite (Vadd_assoc K V t1 (Vopp K V t2) (Vadd K V (Vmul K V (a1 b) (F b)) (Vmul K V (Fopp K (a2 b)) (F b)))). rewrite - (Vadd_assoc K V (Vopp K V t2) (Vmul K V (a1 b) (F b)) (Vmul K V (Fopp K (a2 b)) (F b))). rewrite (Vadd_comm K V (Vopp K V t2) (Vmul K V (a1 b) (F b))). rewrite (Vadd_assoc K V t1 (Vmul K V (a1 b) (F b)) (Vopp K V (Vadd K V t2 (Vmul K V (a2 b) (F b))))). rewrite (Vadd_assoc K V (Vmul K V (a1 b) (F b)) (Vopp K V t2) (Vmul K V (Fopp K (a2 b)) (F b))). rewrite (Vopp_add_distr K V t2 (Vmul K V (a2 b) (F b))). rewrite (Vopp_mul_distr_l K V (a2 b) (F b)). reflexivity. apply H7. apply H7. apply H7. reflexivity. Qed. Lemma BasisLIGeVS : forall (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V), BasisVS K V T F <-> (LinearlyIndependentVS K V T F /\ GeneratingSystemVS K V T F). Proof. move=> K V T F. apply conj. move=> H1. suff: (GeneratingSystemVS K V T F). move=> H2. apply conj. unfold LinearlyIndependentVS. suff: (forall (v : VT K V), In (VT K V) (Full_set (VT K V)) v). rewrite H2. move=> H3. suff: ((fun t : T => exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)) = (fun t : T => exist (SpanVS K V T F) (F t) (H3 (F t)))). move=> H4. rewrite H4. apply (IsomorphicSaveBasisVS K V (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) T F (fun (v : VT K V) => exist (SpanVS K V T F) v (H3 v))). apply conj. exists (fun (w : {v : VT K V | SpanVS K V T F v}) => proj1_sig w). apply conj. move=> x. reflexivity. move=> y. apply sig_map. reflexivity. apply conj. move=> x y. apply sig_map. reflexivity. move=> c x. apply sig_map. reflexivity. apply H1. apply functional_extensionality. move=> t. apply sig_map. reflexivity. move=> v. apply (Full_intro (VT K V) v). apply H2. apply Extensionality_Ensembles. apply conj. elim H1. move=> G H2 v H3. exists (G v). rewrite (proj2 H2 v). reflexivity. move=> v H2. apply (Full_intro (VT K V) v). unfold LinearlyIndependentVS. move=> H1. suff: (F = (fun (t : T) => proj1_sig (exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)))). move=> H2. rewrite H2. apply (IsomorphicSaveBasisVS K (SubspaceMakeVS K V (SpanVS K V T F) (SpanSubspaceVS K V T F)) V T (fun t : T => exist (SpanVS K V T F) (F t) (SpanContainSelfVS K V T F t)) (fun (w : {v : VT K V | SpanVS K V T F v}) => proj1_sig w)). apply conj. suff: (forall (v : VT K V), In (VT K V) (Full_set (VT K V)) v). rewrite (proj2 H1). move=> H3. exists (fun (v : VT K V) => exist (SpanVS K V T F) v (H3 v)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. reflexivity. move=> v. apply (Full_intro (VT K V) v). apply conj. move=> x y. reflexivity. move=> c x. reflexivity. apply (proj1 H1). apply functional_extensionality. move=> t. reflexivity. Qed. Lemma SubspaceBasisLinearlyIndependentVS : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) (T : Type) (F : T -> VT K V), BasisSubspaceVS K V W H T F -> LinearlyIndependentVS K V T F. Proof. move=> K V W H1 T F. elim. move=> H2 H3. apply (InjectiveSaveLinearlyIndependentVS2 K (SubspaceMakeVS K V W H1) V T (fun (t : T) => exist W (F t) (H2 t)) (fun (v : {w : VT K V | In (VT K V) W w}) => proj1_sig v)). apply conj. move=> v1 v2. apply sig_map. apply conj. move=> v1 v2. reflexivity. move=> c v. reflexivity. apply (proj1 (proj1 (BasisLIGeVS K (SubspaceMakeVS K V W H1) T (fun t : T => exist W (F t) (H2 t))) H3)). Qed. Lemma LinearlyIndependentNotContainVOVS : forall (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V), LinearlyIndependentVS K V T F -> forall (t : T), (F t) <> VO K V. Proof. move=> K V T F H1 t H2. suff: (MySumF2 T (FiniteSingleton T t) (VSPCM K V) (fun t : T => Vmul K V (FI K) (F t)) = VO K V). move=> H3. apply (FI_neq_FO K). apply (proj1 (LinearlyIndependentVSDef3 K V T F) H1 (fun (t0 : T) => FI K) (FiniteSingleton T t) H3 t). apply (In_singleton T t). rewrite MySumF2Singleton. rewrite H2. apply (Vmul_O_r K V (FI K)). Qed. Lemma Formula_P25 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : {n : nat | n < N} -> VT K V) (H : forall (t : (forall (m : {n : nat | n < N}), {v : VT K V | exists (f : FT K), v = Vmul K V f (F m)})), In (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun (m : {n : nat | n < N}) => proj1_sig (t m)))), LinearlyIndependentVS K V {n : nat | n < N} F <-> ((Bijective (DirectProdVST K {n : nat | n < N} (fun (m : {n : nat | n < N}) => SubspaceMakeVS K V (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m)) w} (fun (t : forall (m : {n : nat | n < N}), {v : VT K V | exists (f : FT K), v = Vmul K V f (F m)}) => exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun (m : {n : nat | n < N}) => proj1_sig (t m))) (H t))) /\ forall (m : {n : nat | n < N}), (F m) <> VO K V). Proof. move=> K V N F H1. elim (Formula_P23_exists K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) N (fun t : {n : nat | n < N} => exist (SpanVS K V {n : nat | n < N} F) (F t) (SpanContainSelfVS K V {n : nat | n < N} F t))). move=> H2 H3. suff: (Bijective (DirectProdVST K {n : nat | n < N} (fun m : {n : nat | n < N} => SubspaceMakeVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (fun v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (SingleSubspaceVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))) {w : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) | SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) w} (fun t : forall m : {n : nat | n < N}, {v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) | exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))} => exist (SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m)))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (fun m : {n : nat | n < N} => proj1_sig (t m))) (H2 t)) <-> Bijective (DirectProdVST K {n : nat | n < N} (fun m : {n : nat | n < N} => SubspaceMakeVS K V (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) w} (fun t : forall m : {n : nat | n < N}, {v : VT K V | exists f : FT K, v = Vmul K V f (F m)} => exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (t m))) (H1 t))). move=> H4. apply conj. move=> H5. apply conj. apply (proj1 H4). apply (proj1 H3). apply H5. move=> m H6. apply (proj2 (proj2 (proj1 H3 H5)) m). apply sig_map. apply H6. move=> H5. apply (proj2 H3). apply conj. apply (proj2 H4). apply (proj1 H5). apply conj. apply Extensionality_Ensembles. apply conj. move=> x H6. apply Full_intro. move=> x H6. elim (proj2_sig x). move=> f H7. suff: (forall (t : {n : nat | n < N}), In (VT K V) (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t))). move=> H8. suff: (forall (t : {n : nat | n < N}), exists f0 : FT K, (exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t)) (H8 t)) = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f0 (exist (SpanVS K V {n : nat | n < N} F) (F t) (SpanContainSelfVS K V {n : nat | n < N} F t))). move=> H9. suff: (Finite {n : nat | n < N} (fun (t : {n : nat | n < N}) => (exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t)) (H8 t)) <> (VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))))). move=> H10. suff: (x = (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t)) (H8 t) <> VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) H10) (VSPCM K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (fun t : {n : nat | n < N} => exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t)) (H8 t)))). move=> H11. rewrite H11. apply (SumTEnsembleVS_intro K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f0 : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f0 (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (fun (t : {n : nat | n < N}) => (exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t)) (H8 t))) H10). move=> t. exists (proj1_sig f t). apply sig_map. reflexivity. apply sig_map. rewrite H7. rewrite (MySumF2Included {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t)) (H8 t) <> VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) H10) (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => proj1_sig f t <> FO K) (proj2_sig f))). rewrite (MySumF2O {n : nat | n < N} (FiniteIntersection {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => proj1_sig f t <> FO K) (proj2_sig f)) (Complement {n : nat | n < N} (proj1_sig (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t)) (H8 t) <> VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) H10))))). simpl. rewrite (Vadd_O_r K V). apply (FiniteSetInduction {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f t) (F t)) (H8 t) <> SubspaceMakeVSVO K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) H10)). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H11 H12 H13 H14. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H14. reflexivity. apply H13. apply H13. move=> u H11. elim H11. move=> u0 H12 H13. apply NNPP. move=> H14. apply H12. move=> H15. apply H14. suff: ((Vmul K V (proj1_sig f u0) (F u0)) = (proj1_sig (exist (SpanVS K V {n : nat | n < N} F) (Vmul K V (proj1_sig f u0) (F u0)) (H8 u0)))). move=> H16. rewrite H16. rewrite H15. reflexivity. reflexivity. move=> m H11 H12. apply H11. apply sig_map. simpl. rewrite H12. apply (Vmul_O_l K V). apply (Finite_downward_closed {n : nat | n < N} (Full_set {n : nat | n < N}) (CountFinite N)). move=> m H10. apply (Full_intro {n : nat | n < N} m). move=> t. exists (proj1_sig f t). apply sig_map. reflexivity. move=> t. apply (proj1 (proj2 (SpanSubspaceVS K V {n : nat | n < N} F))). apply (SpanContainSelfVS K V {n : nat | n < N} F). move=> m H6. apply (proj2 H5 m). suff: (F m = proj1_sig (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))). move=> H7. rewrite H7. rewrite H6. reflexivity. reflexivity. suff: (exists (g : (DirectProdVST K {n : nat | n < N} (fun m : {n : nat | n < N} => SubspaceMakeVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (fun v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (SingleSubspaceVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))) -> (DirectProdVST K {n : nat | n < N} (fun m : {n : nat | n < N} => SubspaceMakeVS K V (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m))))) (h : {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) w} -> {w : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) | SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) w}), Bijective (DirectProdVST K {n : nat | n < N} (fun m : {n : nat | n < N} => SubspaceMakeVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (fun v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (SingleSubspaceVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))) (DirectProdVST K {n : nat | n < N} (fun m : {n : nat | n < N} => SubspaceMakeVS K V (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) g /\ Bijective {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) w} {w : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) | SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) w} h /\ ((fun t : forall m : {n : nat | n < N}, {v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) | exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))} => exist (SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m)))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (fun m : {n : nat | n < N} => proj1_sig (t m))) (H2 t)) = compose (compose h (fun t : forall m : {n : nat | n < N}, {v : VT K V | exists f : FT K, v = Vmul K V f (F m)} => exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (t m))) (H1 t))) g)). elim. move=> g. elim. move=> h H5. apply conj. move=> H6. elim (proj1 H5). move=> ginv H7. elim (proj1 (proj2 H5)). move=> hinv H8. suff: ((fun t : forall m : {n : nat | n < N}, {v : VT K V | exists f : FT K, v = Vmul K V f (F m)} => exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (t m))) (H1 t)) = (compose hinv (compose (fun t : forall m : {n : nat | n < N}, {v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) | exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))} => exist (SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m)))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (fun m : {n : nat | n < N} => proj1_sig (t m))) (H2 t)) ginv))). move=> H9. rewrite H9. apply BijChain. apply BijChain. exists g. apply conj. move=> x. apply (proj2 H7 x). move=> y. apply (proj1 H7 y). apply H6. exists h. apply conj. move=> x. apply (proj2 H8 x). move=> y. apply (proj1 H8 y). rewrite (proj2 (proj2 H5)). apply functional_extensionality. move=> x. unfold compose. rewrite (proj2 H7). rewrite (proj1 H8). reflexivity. move=> H6. rewrite (proj2 (proj2 H5)). apply BijChain. apply (proj1 H5). apply BijChain. apply H6. apply (proj1 (proj2 H5)). suff: (forall (m : {n : nat | n < N}), {gm : (VT K (SubspaceMakeVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (fun v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (SingleSubspaceVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))) -> (VT K (SubspaceMakeVS K V (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) | (forall (x : VT K (SubspaceMakeVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (fun v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (SingleSubspaceVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))), proj1_sig (proj1_sig x) = proj1_sig (gm x)) /\ Bijective (VT K (SubspaceMakeVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (fun v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (SingleSubspaceVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))) (VT K (SubspaceMakeVS K V (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) gm}). move=> H4. exists (fun (x : DirectProdVST K {n : nat | n < N} (fun m : {n : nat | n < N} => SubspaceMakeVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (fun v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (SingleSubspaceVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))) (m : {n : nat | n < N}) => proj1_sig (H4 m) (x m)). suff: {h : {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) w} -> {w : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) | SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) w} | (forall (x : {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) w}), proj1_sig x = proj1_sig (proj1_sig (h x))) /\ Bijective {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)) w} {w : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) | SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) w} h}. move=> H5. exists (proj1_sig H5). apply conj. apply ForallSavesBijective_dep. move=> m. apply (proj2 (proj2_sig (H4 m))). apply conj. apply (proj2 (proj2_sig H5)). apply functional_extensionality_dep. move=> m. apply sig_map. apply sig_map. simpl. unfold compose. rewrite - (proj1 (proj2_sig H5)). simpl. apply (FiniteSetInduction {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H6 H7 H8 H9. simpl. rewrite MySumF2Add. rewrite MySumF2Add. rewrite - H9. rewrite - (proj1 (proj2_sig (H4 b))). reflexivity. apply H8. apply H8. suff: ((SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) = (SpanVS K V {n : nat | n < N} F)). move=> H5. suff: (forall (w : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))), SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) w). move=> H6. exists (compose (proj1_sig (BijectiveSigFull (VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m)))) H6 )) (proj1_sig (BijectiveSameSig (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (SpanVS K V {n : nat | n < N} F) H5)) ). apply conj. move=> x. unfold compose. rewrite - (proj1 (proj2_sig (BijectiveSigFull (VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m)))) H6))). apply (proj1 (proj2_sig (BijectiveSameSig (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (SpanVS K V {n : nat | n < N} F) H5))). apply BijChain. apply (proj2 (proj2_sig (BijectiveSameSig (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (SpanVS K V {n : nat | n < N} F) H5))). apply (proj2 (proj2_sig (BijectiveSigFull (VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (SumTEnsembleVS K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m)))) H6))). move=> w. elim (proj2_sig w). move=> x H6. suff: (forall (m : {n : nat | n < N}), In (VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (fun (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (proj1_sig x m) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) ). move=> H7. suff: (Finite {n : nat | n < N} (fun t : {n : nat | n < N} => Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (proj1_sig x t) (exist (SpanVS K V {n : nat | n < N} F) (F t) (SpanContainSelfVS K V {n : nat | n < N} F t)) <> VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)))). move=> H8. suff: (w = (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (proj1_sig x t) (exist (SpanVS K V {n : nat | n < N} F) (F t) (SpanContainSelfVS K V {n : nat | n < N} F t)) <> VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) H8) (VSPCM K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) (fun m : {n : nat | n < N} => Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (proj1_sig x m) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))). move=> H9. rewrite H9. apply (SumTEnsembleVS_intro K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) => exists f : FT K, v = Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (fun (m : {n : nat | n < N}) => (Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (proj1_sig x m) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) )). move=> m. exists (proj1_sig x m). reflexivity. apply sig_map. rewrite H6. rewrite (MySumF2Included {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (proj1_sig x t) (exist (SpanVS K V {n : nat | n < N} F) (F t) (SpanContainSelfVS K V {n : nat | n < N} F t)) <> VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) H8) (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => proj1_sig x t <> FO K) (proj2_sig x))). rewrite (MySumF2O {n : nat | n < N} (FiniteIntersection {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => proj1_sig x t <> FO K) (proj2_sig x)) (Complement {n : nat | n < N} (proj1_sig (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (proj1_sig x t) (exist (SpanVS K V {n : nat | n < N} F) (F t) (SpanContainSelfVS K V {n : nat | n < N} F t)) <> VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) H8))))). rewrite (CM_O_r (VSPCM K V)). apply (FiniteSetInduction {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => Vmul K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F)) (proj1_sig x t) (exist (SpanVS K V {n : nat | n < N} F) (F t) (SpanContainSelfVS K V {n : nat | n < N} F t)) <> VO K (SubspaceMakeVS K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F))) H8)). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H9 H10 H11 H12. rewrite MySumF2Add. rewrite MySumF2Add. rewrite H12. reflexivity. apply H11. apply H11. move=> u. elim. move=> m H9 H10. apply NNPP. move=> H11. apply H9. simpl. move=> H12. apply H11. suff: (Vmul K V (proj1_sig x m) (F m) = (proj1_sig (SubspaceMakeVSVmul K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F) (proj1_sig x m) (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))))). move=> H13. rewrite H13. rewrite H12. reflexivity. reflexivity. move=> m H9 H10. apply H9. rewrite H10. apply (Vmul_O_l K). apply (Finite_downward_closed {n : nat | n < N} (Full_set {n : nat | n < N}) (CountFinite N)). move=> m H8. apply (Full_intro {n : nat | n < N} m). move=> m. exists (proj1_sig x m). reflexivity. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> a H5 H6. suff: (forall (t : {n : nat | n < N}), {f : FT K | a t = Vmul K V f (F t)}). move=> H7. suff: (Finite {n : nat | n < N} (fun (m : {n : nat | n < N}) => proj1_sig (H7 m) <> FO K)). move=> H8. exists (exist (fun (G : {n : nat | n < N} -> FT K) => Finite {n : nat | n < N} (fun (t : {n : nat | n < N}) => G t <> FO K)) (fun (m : {n : nat | n < N}) => proj1_sig (H7 m)) H8). simpl. suff: (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => a t <> VO K V) H5) (VSPCM K V) a = MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) a). move=> H9. rewrite H9. suff: (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => proj1_sig (H7 t) <> FO K) H8) (VSPCM K V) (fun t : {n : nat | n < N} => Vmul K V (proj1_sig (H7 t)) (F t)) = MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun t : {n : nat | n < N} => Vmul K V (proj1_sig (H7 t)) (F t))). move=> H10. rewrite H10. suff: (a = (fun t : {n : nat | n < N} => Vmul K V (proj1_sig (H7 t)) (F t))). move=> H11. rewrite - H11. reflexivity. apply functional_extensionality. move=> m. apply (proj2_sig (H7 m)). rewrite (MySumF2Included {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => proj1_sig (H7 t) <> FO K) H8) (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N))). rewrite (MySumF2O {n : nat | n < N} (FiniteIntersection {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (Complement {n : nat | n < N} (proj1_sig (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => proj1_sig (H7 t) <> FO K) H8))))). rewrite (CM_O_r (VSPCM K V)). reflexivity. move=> u. elim. move=> u0 H10 H11. suff: (proj1_sig (H7 u0) = FO K). move=> H12. rewrite H12. apply (Vmul_O_l K V (F u0)). apply NNPP. apply H10. move=> m H10. apply (Full_intro {n : nat | n < N} m). rewrite (MySumF2Included {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => a t <> VO K V) H5) (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N))). rewrite (MySumF2O {n : nat | n < N} (FiniteIntersection {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (Complement {n : nat | n < N} (proj1_sig (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => a t <> VO K V) H5))))). rewrite (CM_O_r (VSPCM K V)). reflexivity. move=> u. elim. move=> u0 H9 H10. apply NNPP. apply H9. move=> m H9. apply (Full_intro {n : nat | n < N} m). apply (Finite_downward_closed {n : nat | n < N} (Full_set {n : nat | n < N}) (CountFinite N)). move=> m H8. apply (Full_intro {n : nat | n < N} m). move=> m. elim (excluded_middle_informative (F m <> VO K V)). move=> H7. apply (constructive_definite_description (fun (f : FT K) => a m = Vmul K V f (F m))). apply (proj1 (unique_existence (fun (f : FT K) => a m = Vmul K V f (F m)))). apply conj. elim (H6 m). move=> f H8. exists f. apply H8. move=> f1 f2 H8 H9. apply (Vmul_eq_reg_r K V (F m) f1 f2). rewrite - H8. apply H9. apply H7. move=> H7. exists (FO K). elim (H6 m). move=> f H8. rewrite H8. suff: (F m = VO K V). move=> H9. rewrite H9. rewrite (Vmul_O_r K V f). rewrite (Vmul_O_r K V (FO K)). reflexivity. apply NNPP. apply H7. suff: (SubspaceVS K V (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m)))). move=> H5. suff: (forall (m : {n : nat | n < N}), In (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (F m)). move=> H6 m. elim. move=> x H7. rewrite H7. apply (MySumF2Induction {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun t : {n : nat | n < N} => proj1_sig x t <> FO K) (proj2_sig x))). apply conj. apply (proj2 (proj2 H5)). move=> B b H8 H9. apply (proj1 H5 B (Vmul K V (proj1_sig x b) (F b)) H9 (proj1 (proj2 H5) (proj1_sig x b) (F b) (H6 b))). move=> m. elim (classic (F m = VO K V)). move=> H6. rewrite H6. apply (proj2 (proj2 H5)). move=> H6. suff: (Finite {n : nat | n < N} (fun (k : {n : nat | n < N}) => match excluded_middle_informative (k = m) with | left _ => F m | right _ => VO K V end <> VO K V)). move=> H7. suff: (F m = (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (fun (k : {n : nat | n < N}) => match excluded_middle_informative (k = m) with | left _ => F m | right _ => VO K V end <> VO K V) H7) (VSPCM K V) (fun k : {n : nat | n < N} => match excluded_middle_informative (k = m) with | left _ => F m | right _ => VO K V end))). move=> H8. rewrite H8. apply (SumTEnsembleVS_intro K V {n : nat | n < N} (fun (m0 : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m0)) (fun (k : {n : nat | n < N}) => match excluded_middle_informative (k = m) with | left _ => F m | right _ => VO K V end) H7). move=> k. elim (excluded_middle_informative (k = m)). move=> H9. rewrite H9. exists (FI K). rewrite (Vmul_I_l K V (F m)). reflexivity. move=> H9. exists (FO K). rewrite (Vmul_O_l K V (F k)). reflexivity. suff: ((exist (Finite {n : nat | n < N}) (fun k : {n : nat | n < N} => (match excluded_middle_informative (k = m) with | left _ => F m | right _ => VO K V end) <> VO K V) H7) = FiniteSingleton {n : nat | n < N} m). move=> H8. rewrite H8. rewrite MySumF2Singleton. elim (excluded_middle_informative (m = m)). move=> H9. reflexivity. move=> H9. apply False_ind. apply H9. reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> k H8. suff: (k = m). move=> H9. rewrite H9. apply (In_singleton {n : nat | n < N} m). apply NNPP. move=> H9. apply H8. elim (excluded_middle_informative (k = m)). move=> H10. apply False_ind. apply (H9 H10). move=> H10. reflexivity. move=> k. elim. unfold In. simpl. elim (excluded_middle_informative (m = m)). move=> H8. apply H6. move=> H8. apply False_ind. apply H8. reflexivity. apply (Finite_downward_closed {n : nat | n < N} (Full_set {n : nat | n < N}) (CountFinite N)). move=> k H7. apply (Full_intro {n : nat | n < N} k). apply SumTSubspaceVS. move=> m. apply (SingleSubspaceVS K V). move=> m. elim (BijectiveSameSig {x : VT K V | In (VT K V) (SpanVS K V {n : nat | n < N} F) x} (fun v : {x : VT K V | In (VT K V) (SpanVS K V {n : nat | n < N} F) x} => exists f : FT K, v = SubspaceMakeVSVmul K V (SpanVS K V {n : nat | n < N} F) (SpanSubspaceVS K V {n : nat | n < N} F) f (exist (SpanVS K V {n : nat | n < N} F) (F m) (SpanContainSelfVS K V {n : nat | n < N} F m))) (fun v : {x : VT K V | In (VT K V) (SpanVS K V {n : nat | n < N} F) x} => exists f : FT K, proj1_sig v = Vmul K V f (F m))). move=> g1 H4. elim (BijectiveSigSigInv (VT K V) (SpanVS K V {n : nat | n < N} F) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m))). move=> g2 H5. elim (BijectiveSameSig (VT K V) (Intersection (VT K V) (SpanVS K V {n : nat | n < N} F) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m))) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F m))). move=> g3 H6. exists (compose g3 (compose g2 g1)). apply conj. move=> x. rewrite - (proj1 H6). rewrite - (proj1 H5). rewrite - (proj1 H4). reflexivity. apply BijChain. apply BijChain. apply (proj2 H4). apply (proj2 H5). apply (proj2 H6). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> w H6 H7. apply H7. move=> v H6. apply Intersection_intro. elim H6. move=> f H7. rewrite H7. apply (proj1 (proj2 (SpanSubspaceVS K V {n : nat | n < N} F)) f (F m)). apply SpanContainSelfVS. apply H6. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> f H4. exists f. rewrite H4. reflexivity. move=> v. elim. move=> f H4. exists f. apply sig_map. apply H4. Qed. Lemma Formula_P25_exists : forall (K : Field) (V : VectorSpace K) (N : nat) (F : {n : nat | n < N} -> VT K V), exists (H : forall (t : (forall (m : {n : nat | n < N}), {v : VT K V | exists (f : FT K), v = Vmul K V f (F m)})), In (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun (m : {n : nat | n < N}) => proj1_sig (t m)))), LinearlyIndependentVS K V {n : nat | n < N} F <-> ((Bijective (DirectProdVST K {n : nat | n < N} (fun (m : {n : nat | n < N}) => SubspaceMakeVS K V (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m)) (SingleSubspaceVS K V (F m)))) {w : VT K V | SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m)) w} (fun (t : forall (m : {n : nat | n < N}), {v : VT K V | exists (f : FT K), v = Vmul K V f (F m)}) => exist (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists (f : FT K), v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun (m : {n : nat | n < N}) => proj1_sig (t m))) (H t))) /\ forall (m : {n : nat | n < N}), (F m) <> VO K V). Proof. move=> K V N F. suff: (forall (t : forall m : {n : nat | n < N}, {v : VT K V | exists f : FT K, v = Vmul K V f (F m)}), In (VT K V) (SumTEnsembleVS K V {n : nat | n < N} (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))) (MySumF2 {n : nat | n < N} (exist (Finite {n : nat | n < N}) (Full_set {n : nat | n < N}) (CountFinite N)) (VSPCM K V) (fun m : {n : nat | n < N} => proj1_sig (t m)))). move=> H1. exists H1. apply (Formula_P25 K V N F H1). move=> t. rewrite (FiniteSumTEnsembleVS K V N (fun (m : {n : nat | n < N}) (v : VT K V) => exists f : FT K, v = Vmul K V f (F m))). exists (fun (m : {n : nat | n < N}) => proj1_sig (t m)). apply conj. move=> m. apply (proj2_sig (t m)). reflexivity. Qed. Lemma Proposition_5_2 : forall (K : Field) (V : VectorSpace K) (N : nat) (H1 : forall (m : Count N), proj1_sig m < S N) (H2 : N < S N) (F : Count (S N) -> VT K V), (LinearlyIndependentVS K V (Count (S N)) F) <-> (LinearlyIndependentVS K V (Count N) (fun (m : Count N) => F (exist (fun (n : nat) => n < S N) (proj1_sig m) (H1 m))) /\ ~ (In (VT K V) (SpanVS K V (Count N) (fun (m : Count N) => F (exist (fun (n : nat) => n < S N) (proj1_sig m) (H1 m)))) (F (exist (fun (n : nat) => n < S N) N H2)))). Proof. move=> K V N H1 H2 F. apply conj. move=> H3. apply conj. apply (proj2 (FiniteLinearlyIndependentVS K V N (fun m : Count N => F (exist (fun n : nat => n < S N) (proj1_sig m) (H1 m))))). move=> a H4. suff: (forall (m : Count (S N)), (fun (n : Count (S N)) => match excluded_middle_informative (proj1_sig n < N) with | left H => a (exist (fun (k : nat) => k < N) (proj1_sig n) H) | right _ => FO K end) m = FO K). move=> H5 m. rewrite - (H5 (exist (fun (n : nat) => n < S N) (proj1_sig m) (H1 m))). simpl. elim (excluded_middle_informative (proj1_sig m < N)). move=> H6. suff: ((exist (fun k : nat => k < N) (proj1_sig m) H6) = m). move=> H7. rewrite H7. reflexivity. apply sig_map. reflexivity. move=> H6. apply False_ind. apply H6. apply (proj2_sig m). apply (proj1 (FiniteLinearlyIndependentVS K V (S N) F) H3). rewrite (MySumF2Excluded (Count (S N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V match excluded_middle_informative (proj1_sig n < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig n) H) | right _ => FO K end (F n)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun (n : Count (S N)) => proj1_sig n < N)). rewrite (MySumF2O (Count (S N)) (FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (Complement (Count (S N)) (fun n : Count (S N) => proj1_sig n < N)))). simpl. rewrite (Vadd_O_r K V). rewrite - (MySumF2BijectiveSame (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Count (S N)) (FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun n : Count (S N) => proj1_sig n < N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V match excluded_middle_informative (proj1_sig n < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig n) H) | right _ => FO K end (F n)) (fun (n : Count N) => (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n)))). simpl. suff: ((fun u : Count N => Vmul K V match excluded_middle_informative (proj1_sig u < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig u) H) | right _ => FO K end (F (exist (fun n0 : nat => n0 < S N) (proj1_sig u) (H1 u)))) = (fun n : Count N => Vmul K V (a n) (F (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n))))). move=> H5. rewrite H5. apply H4. apply functional_extensionality. move=> m. elim (excluded_middle_informative (proj1_sig m < N)). move=> H5. suff: ((exist (fun k : nat => k < N) (proj1_sig m) H5) = m). move=> H6. rewrite H6. reflexivity. apply sig_map. reflexivity. move=> H5. apply False_ind. apply H5. apply (proj2_sig m). simpl. move=> u H5. apply (Intersection_intro (Count (S N))). apply (proj2_sig u). apply (Full_intro (Count (S N))). simpl. move=> H5. suff: (forall (u0 : {u : Count (S N) | Intersection (Count (S N)) (fun n : Count (S N) => proj1_sig n < N) (Full_set (Count (S N))) u}), proj1_sig (proj1_sig u0) < N). move=> H6. exists (fun (u0 : {u : Count (S N) | Intersection (Count (S N)) (fun n : Count (S N) => proj1_sig n < N) (Full_set (Count (S N))) u}) => (exist (Full_set (Count N)) (exist (fun n : nat => n < N) (proj1_sig (proj1_sig u0)) (H6 u0)) (Full_intro (Count N) (exist (fun n : nat => n < N) (proj1_sig (proj1_sig u0)) (H6 u0))))). apply conj. move=> x. apply sig_map. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> u0. elim (proj2_sig u0). move=> m H6 H7. apply H6. move=> u H5. elim (excluded_middle_informative (proj1_sig u < N)). elim H5. move=> m H6 H7 H8. apply False_ind. apply H6. apply H8. move=> H6. apply (Vmul_O_l K V (F u)). rewrite (FiniteSpanVS K V N). elim. move=> a H4. apply (FI_neq_FO K). rewrite - (Fopp_involutive K (FI K)). apply (Fopp_eq_O_compat K (Fopp K (FI K))). suff: (forall (m : Count (S N)), (fun n : Count (S N) => match excluded_middle_informative (proj1_sig n < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig n) H) | right _ => Fopp K (FI K) end) m = FO K). move=> H5. rewrite - (H5 (exist (fun (n : nat) => n < S N) N H2)). simpl. elim (excluded_middle_informative (N < N)). move=> H6. apply False_ind. apply (lt_irrefl N H6). move=> H6. reflexivity. apply (proj1 (FiniteLinearlyIndependentVS K V (S N) F) H3). rewrite (MySumF2Excluded (Count (S N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V match excluded_middle_informative (proj1_sig n < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig n) H) | right _ => Fopp K (FI K) end (F n)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun (n : Count (S N)) => proj1_sig n < N)). suff: ((MySumF2 (Count (S N)) (FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun n : Count (S N) => proj1_sig n < N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V match excluded_middle_informative (proj1_sig n < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig n) H) | right _ => Fopp K (FI K) end (F n))) = F (exist (fun n : nat => n < S N) N H2)). move=> H5. rewrite H5. suff: ((MySumF2 (Count (S N)) (FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (Complement (Count (S N)) (fun n : Count (S N) => proj1_sig n < N))) (VSPCM K V) (fun n : Count (S N) => Vmul K V match excluded_middle_informative (proj1_sig n < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig n) H) | right _ => Fopp K (FI K) end (F n))) = Vopp K V (F (exist (fun n : nat => n < S N) N H2))). move=> H6. rewrite H6. apply (Vadd_opp_r K V). suff: ((FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (Complement (Count (S N)) (fun n : Count (S N) => proj1_sig n < N))) = (FiniteSingleton (Count (S N)) (exist (fun n : nat => n < S N) N H2))). move=> H7. rewrite H7. rewrite MySumF2Singleton. simpl. elim (excluded_middle_informative (N < N)). move=> H8. apply False_ind. apply (lt_irrefl N H8). move=> H8. rewrite (Vopp_mul_distr_l_reverse K V (FI K) (F (exist (fun n : nat => n < S N) N H2))). rewrite (Vmul_I_l K V). reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> m. elim. move=> m0 H6 H7. suff: (m0 = (exist (fun n : nat => n < S N) N H2)). move=> H8. rewrite H8. apply (In_singleton (Count (S N)) (exist (fun n : nat => n < S N) N H2)). apply sig_map. simpl. elim (le_lt_or_eq (proj1_sig m0) N). move=> H8. apply False_ind. apply H6. apply H8. apply. apply (le_S_n (proj1_sig m0) N (proj2_sig m0)). move=> m. elim. apply Intersection_intro. apply (lt_irrefl N). apply (Full_intro (Count (S N)) (exist (fun n : nat => n < S N) N H2)). rewrite H4. rewrite - (MySumF2BijectiveSame (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Count (S N)) (FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun n : Count (S N) => proj1_sig n < N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V match excluded_middle_informative (proj1_sig n < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig n) H) | right _ => Fopp K (FI K) end (F n)) (fun (n : Count N) => (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n)))). simpl. suff: ((fun u : Count N => Vmul K V match excluded_middle_informative (proj1_sig u < N) with | left H => a (exist (fun k : nat => k < N) (proj1_sig u) H) | right _ => Fopp K (FI K) end (F (exist (fun n0 : nat => n0 < S N) (proj1_sig u) (H1 u)))) = (fun n : Count N => Vmul K V (a n) (F (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n))))). move=> H5. rewrite H5. reflexivity. apply functional_extensionality. move=> m. elim (excluded_middle_informative (proj1_sig m < N)). move=> H5. suff: ((exist (fun k : nat => k < N) (proj1_sig m) H5) = m). move=> H6. rewrite H6. reflexivity. apply sig_map. reflexivity. move=> H5. apply False_ind. apply H5. apply (proj2_sig m). move=> u H5. apply (Intersection_intro (Count (S N))). apply (proj2_sig u). apply (Full_intro (Count (S N))). simpl. move=> H5. suff: (forall (u0 : {u : Count (S N) | Intersection (Count (S N)) (fun n : Count (S N) => proj1_sig n < N) (Full_set (Count (S N))) u}), proj1_sig (proj1_sig u0) < N). move=> H6. exists (fun (u0 : {u : Count (S N) | Intersection (Count (S N)) (fun n : Count (S N) => proj1_sig n < N) (Full_set (Count (S N))) u}) => (exist (Full_set (Count N)) (exist (fun n : nat => n < N) (proj1_sig (proj1_sig u0)) (H6 u0)) (Full_intro (Count N) (exist (fun n : nat => n < N) (proj1_sig (proj1_sig u0)) (H6 u0))))). apply conj. move=> x. apply sig_map. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> u0. elim (proj2_sig u0). move=> m H6 H7. apply H6. move=> H3. apply (proj2 (FiniteLinearlyIndependentVS K V (S N) F)). move=> a H4. suff: (a (exist (fun n : nat => n < S N) N H2) = FO K). move=> H5. suff: (forall (m : Count N), a (exist (fun n : nat => n < S N) (proj1_sig m) (H1 m)) = FO K). move=> H6 m. elim (le_lt_or_eq (proj1_sig m) N). move=> H7. rewrite - (H6 (exist (fun n : nat => n < N) (proj1_sig m) H7)). suff: ((exist (fun n : nat => n < S N) (proj1_sig (exist (fun n : nat => n < N) (proj1_sig m) H7)) (H1 (exist (fun n : nat => n < N) (proj1_sig m) H7))) = m). move=> H8. rewrite H8. reflexivity. apply sig_map. reflexivity. move=> H7. suff: (m = (exist (fun n : nat => n < S N) N H2)). move=> H8. rewrite H8. apply H5. apply sig_map. apply H7. apply (le_S_n (proj1_sig m) N (proj2_sig m)). apply (proj1 (FiniteLinearlyIndependentVS K V N (fun m : Count N => F (exist (fun n : nat => n < S N) (proj1_sig m) (H1 m)))) (proj1 H3)). rewrite - H4. rewrite (MySumF2Excluded (Count (S N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V (a n) (F n)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun (n : Count (S N)) => proj1_sig n < N)). rewrite - (MySumF2BijectiveSame (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Count (S N)) (FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun n : Count (S N) => proj1_sig n < N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V (a n) (F n)) (fun (n : Count N) => (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n)))). suff: ((FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (Complement (Count (S N)) (fun n : Count (S N) => proj1_sig n < N))) = (FiniteSingleton (Count (S N)) (exist (fun n : nat => n < S N) N H2))). move=> H6. rewrite H6. rewrite MySumF2Singleton. rewrite H5. rewrite (Vmul_O_l K V). simpl. rewrite (Vadd_O_r K V). reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> m. elim. move=> m0 H6 H7. suff: (m0 = exist (fun n : nat => n < S N) N H2). move=> H8. rewrite H8. apply (In_singleton (Count (S N))). apply sig_map. simpl. elim (le_lt_or_eq (proj1_sig m0) N). move=> H8. apply False_ind. apply H6. apply H8. apply. apply (le_S_n (proj1_sig m0) N (proj2_sig m0)). move=> m. elim. apply (Intersection_intro (Count (S N))). apply (lt_irrefl N). apply (Full_intro (Count (S N))). move=> u H6. apply (Intersection_intro (Count (S N))). apply (proj2_sig u). apply (Full_intro (Count (S N))). move=> H6. simpl. suff: (forall (u0 : {u : Count (S N) | Intersection (Count (S N)) (fun n : Count (S N) => proj1_sig n < N) (Full_set (Count (S N))) u}), proj1_sig (proj1_sig u0) < N). move=> H7. exists (fun (u0 : {u : Count (S N) | Intersection (Count (S N)) (fun n : Count (S N) => proj1_sig n < N) (Full_set (Count (S N))) u}) => (exist (Full_set (Count N)) (exist (fun n : nat => n < N) (proj1_sig (proj1_sig u0)) (H7 u0)) (Full_intro (Count N) (exist (fun n : nat => n < N) (proj1_sig (proj1_sig u0)) (H7 u0))))). apply conj. move=> x. apply sig_map. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> u0. elim (proj2_sig u0). move=> m H7 H8. apply H7. apply NNPP. move=> H5. apply (proj2 H3). rewrite (FiniteSpanVS K V N (fun m : Count N => F (exist (fun n : nat => n < S N) (proj1_sig m) (H1 m)))). exists (fun (m : Count N) => Fopp K (Fmul K (Finv K (a (exist (fun n : nat => n < S N) N H2))) (a (exist (fun (n : nat) => n < S N) (proj1_sig m) (H1 m))))). suff: (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (Fopp K (Fmul K (Finv K (a (exist (fun n0 : nat => n0 < S N) N H2))) (a (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n))))) (F (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n)))) = Vmul K V (Fopp K (Finv K (a (exist (fun n0 : nat => n0 < S N) N H2)))) (MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n))) (F (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n)))))). move=> H6. rewrite H6. suff: ((MySumF2 (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (VSPCM K V) (fun n : Count N => Vmul K V (a (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n))) (F (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n))))) = Vopp K V (Vmul K V (a (exist (fun n0 : nat => n0 < S N) N H2)) (F (exist (fun n : nat => n < S N) N H2)))). move=> H7. rewrite H7. rewrite (Vmul_opp_opp K V). rewrite (Vmul_assoc K V). rewrite (Finv_l K (a (exist (fun n0 : nat => n0 < S N) N H2)) H5). rewrite (Vmul_I_l K V). reflexivity. apply (Vadd_opp_r_uniq K V). rewrite (Vadd_comm K V). rewrite - H4. rewrite (MySumF2Excluded (Count (S N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V (a n) (F n)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun (n : Count (S N)) => proj1_sig n < N)). rewrite - (MySumF2BijectiveSame (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N)) (Count (S N)) (FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (fun n : Count (S N) => proj1_sig n < N)) (VSPCM K V) (fun n : Count (S N) => Vmul K V (a n) (F n)) (fun (n : Count N) => (exist (fun n0 : nat => n0 < S N) (proj1_sig n) (H1 n)))). suff: ((FiniteIntersection (Count (S N)) (exist (Finite (Count (S N))) (Full_set (Count (S N))) (CountFinite (S N))) (Complement (Count (S N)) (fun n : Count (S N) => proj1_sig n < N))) = (FiniteSingleton (Count (S N)) (exist (fun n : nat => n < S N) N H2))). move=> H7. rewrite H7. rewrite MySumF2Singleton. reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> m. elim. move=> m0 H7 H8. suff: (m0 = exist (fun n : nat => n < S N) N H2). move=> H9. rewrite H9. apply (In_singleton (Count (S N))). apply sig_map. simpl. elim (le_lt_or_eq (proj1_sig m0) N). move=> H9. apply False_ind. apply H7. apply H9. apply. apply (le_S_n (proj1_sig m0) N (proj2_sig m0)). move=> m. elim. apply (Intersection_intro (Count (S N))). apply (lt_irrefl N). apply (Full_intro (Count (S N))). move=> u H7. apply (Intersection_intro (Count (S N))). apply (proj2_sig u). apply (Full_intro (Count (S N))). move=> H7. simpl. suff: (forall (u0 : {u : Count (S N) | Intersection (Count (S N)) (fun n : Count (S N) => proj1_sig n < N) (Full_set (Count (S N))) u}), proj1_sig (proj1_sig u0) < N). move=> H8. exists (fun (u0 : {u : Count (S N) | Intersection (Count (S N)) (fun n : Count (S N) => proj1_sig n < N) (Full_set (Count (S N))) u}) => (exist (Full_set (Count N)) (exist (fun n : nat => n < N) (proj1_sig (proj1_sig u0)) (H8 u0)) (Full_intro (Count N) (exist (fun n : nat => n < N) (proj1_sig (proj1_sig u0)) (H8 u0))))). apply conj. move=> x. apply sig_map. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> u. elim (proj2_sig u). move=> m H8 H9. apply H8. apply (FiniteSetInduction (Count N) (exist (Finite (Count N)) (Full_set (Count N)) (CountFinite N))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. rewrite (Vmul_O_r K V). reflexivity. move=> B b H6 H7 H8 H9. rewrite MySumF2Add. rewrite MySumF2Add. rewrite H9. simpl. rewrite (Vmul_add_distr_l K V). rewrite (Vmul_assoc K V (Fopp K (Finv K (a (exist (fun n0 : nat => n0 < S N) N H2)))) (a (exist (fun n0 : nat => n0 < S N) (proj1_sig b) (H1 b)))). rewrite (Fopp_mul_distr_l K (Finv K (a (exist (fun n0 : nat => n0 < S N) N H2))) (a (exist (fun n0 : nat => n0 < S N) (proj1_sig b) (H1 b)))). reflexivity. apply H8. apply H8. Qed. Lemma Proposition_5_2_exists : forall (K : Field) (V : VectorSpace K) (N : nat), exists (H1 : forall (m : Count N), proj1_sig m < S N) (H2 : N < S N), forall (F : Count (S N) -> VT K V), (LinearlyIndependentVS K V (Count (S N)) F) <-> (LinearlyIndependentVS K V (Count N) (fun (m : Count N) => F (exist (fun (n : nat) => n < S N) (proj1_sig m) (H1 m))) /\ ~ (In (VT K V) (SpanVS K V (Count N) (fun (m : Count N) => F (exist (fun (n : nat) => n < S N) (proj1_sig m) (H1 m)))) (F (exist (fun (n : nat) => n < S N) N H2)))). Proof. move=> K V N. exists (fun (m : Count N) => le_S (S (proj1_sig m)) N (proj2_sig m)). exists (le_n (S N)). apply (Proposition_5_2 K V N (fun (m : Count N) => le_S (S (proj1_sig m)) N (proj2_sig m)) (le_n (S N))). Qed. Lemma Theorem_5_4 : forall (K : Field) (V : VectorSpace K) (N1 N2 : nat) (F1 : Count N1 -> VT K V) (F2 : Count N2 -> VT K V), BasisVS K V (Count N1) F1 -> BasisVS K V (Count N2) F2 -> N1 = N2. Proof. move=> K V N1 N2 F1 F2 H1 H2. suff: (exists (f : Count N1 -> Count N2), Bijective (Count N1) (Count N2) f). move=> H3. suff: (exists (f : Count N2 -> Count N2), Bijective (Count N2) (Count N2) f). move=> H4. apply (cardinal_is_functional (Count N2) (Full_set (Count N2)) N1 (proj1 (CountCardinalBijective (Count N2) N1) H3) (Full_set (Count N2)) N2 (proj1 (CountCardinalBijective (Count N2) N2) H4)). reflexivity. exists (fun (m : Count N2) => m). exists (fun (m : Count N2) => m). apply conj. move=> x. reflexivity. move=> y. reflexivity. suff: (let W1 := (fun (m : nat) => SpanVS K V {n : Count N1 | proj1_sig n < m} (fun (k : {n : Count N1 | proj1_sig n < m}) => F1 (proj1_sig k))) in exists (f : Count N1 -> Count N2), Bijective (Count N1) (Count N2) f). apply. move=> W1. suff: (let W2 := (fun (m : nat) => SpanVS K V {n : Count N2 | proj1_sig n < m} (fun (k : {n : Count N2 | proj1_sig n < m}) => F2 (proj1_sig k))) in exists (f : Count N1 -> Count N2), Bijective (Count N1) (Count N2) f). apply. move=> W2. suff: (forall (k : Count N1), {m : nat | is_min_nat (fun (n : nat) => In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig k)) (W2 n)) (F1 k)) m}). move=> H3. suff: (forall (k : Count N2), {m : nat | is_min_nat (fun (n : nat) => In (VT K V) (SumEnsembleVS K V (W1 n) (W2 (proj1_sig k))) (F2 k)) m}). move=> H4. suff: (forall (k : Count N1), {m : Count N2 | S (proj1_sig m) = proj1_sig (H3 k)}). move=> H5. suff: (forall (k : Count N2), {m : Count N1 | S (proj1_sig m) = proj1_sig (H4 k)}). move=> H6. suff: (forall (m : Count N1), W1 (S (proj1_sig m)) = SumEnsembleVS K V (W1 (proj1_sig m)) (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f (F1 m))). move=> H12. suff: (forall (m : Count N2), W2 (S (proj1_sig m)) = SumEnsembleVS K V (W2 (proj1_sig m)) (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f (F2 m))). move=> H13. suff: (forall (n1 n2 : nat), n1 <= n2 -> Included (VT K V) (W1 n1) (W1 n2)). move=> H7. suff: (forall (n1 n2 : nat), n1 <= n2 -> Included (VT K V) (W2 n1) (W2 n2)). move=> H8. suff: (forall (n1 n2 m : nat), n1 <= n2 -> Included (VT K V) (SumEnsembleVS K V (W1 n1) (W2 m)) (SumEnsembleVS K V (W1 n2) (W2 m))). move=> H9. suff: (forall (n1 n2 m : nat), n1 <= n2 -> Included (VT K V) (SumEnsembleVS K V (W1 m) (W2 n1)) (SumEnsembleVS K V (W1 m) (W2 n2))). move=> H10. suff: (forall (w1 : VT K V) (w2 : VT K V) (A : Ensemble (VT K V)), (SubspaceVS K V A) -> ~ (In (VT K V) A w1) -> (In (VT K V) (SumEnsembleVS K V A (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f w2)) w1) -> (In (VT K V) (SumEnsembleVS K V A (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f w1)) w2)). move=> H11. suff: (forall (n1 : Count N1) (n2 : Count N2), (proj1_sig (H5 n1)) = n2 <-> (proj1_sig (H6 n2)) = n1). move=> H14. exists (fun (k : Count N1) => proj1_sig (H5 k)). exists (fun (k : Count N2) => proj1_sig (H6 k)). apply conj. move=> x. apply (proj1 (H14 x (proj1_sig (H5 x)))). reflexivity. move=> y. apply (proj2 (H14 (proj1_sig (H6 y)) y)). reflexivity. move=> n1 n2. suff: (proj1_sig (H5 n1) = n2 <-> ((SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)) <> SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2))) /\ (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)) <> SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2)))) /\ (SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2)) = SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2)))) /\ (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))) = SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2)))))). move=> H14. suff: (proj1_sig (H6 n2) = n1 <-> ((SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)) <> SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2))) /\ (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)) <> SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2)))) /\ (SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2)) = SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2)))) /\ (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))) = SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2)))))). move=> H15. apply conj. move=> H16. apply (proj2 H15). apply (proj1 H14). apply H16. move=> H16. apply (proj2 H14). apply (proj1 H15). apply H16. apply conj. move=> H15. suff: (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)) <> SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2))). move=> H16. suff: (SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2)) = SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2)))). move=> H17. suff: (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))) = SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2)))). move=> H18. apply conj. apply H16. apply conj. rewrite H18. rewrite - H17. apply H16. apply conj. apply H17. apply H18. apply Extensionality_Ensembles. apply conj. apply (H9 (proj1_sig n1) (S (proj1_sig n1)) (S (proj1_sig n2))). apply (le_S (proj1_sig n1) (proj1_sig n1) (le_n (proj1_sig n1))). suff: (SubspaceVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))))). move=> H18. suff: (In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2)))) (F1 n1)). move=> H19 v. rewrite (H12 n1). elim. move=> v1 v2 H20 H21. apply (proj1 H18 v1 v2). elim H20. move=> v11 v12 H22 H23. apply (proj1 H18 v11 v12). rewrite - (Vadd_O_r K V v11). apply (SumEnsembleVS_intro K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))) v11 (VO K V)). apply H22. suff: (SubspaceVS K V (W2 (S (proj1_sig n2)))). move=> H24. apply (proj2 (proj2 H24)). apply (SpanSubspaceVS K V). elim H23. move=> f H24. rewrite H24. apply (proj1 (proj2 H18) f (F1 n1)). apply H19. rewrite - (Vadd_O_l K V v2). apply (SumEnsembleVS_intro K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))) (VO K V) v2). suff: (SubspaceVS K V (W1 (proj1_sig n1))). move=> H22. apply (proj2 (proj2 H22)). apply (SpanSubspaceVS K V). apply H21. rewrite (H13 n2). suff: ((SumEnsembleVS K V (W1 (proj1_sig n1)) (SumEnsembleVS K V (W2 (proj1_sig n2)) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F2 n2)))) = (SumEnsembleVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F2 n2)))). move=> H19. rewrite H19. apply (H11 (F2 n2) (F1 n1) (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)))). apply (SumSubspaceVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))). apply (SpanSubspaceVS K V). apply (SpanSubspaceVS K V). rewrite - H15. move=> H20. apply (lt_irrefl (proj1_sig (proj1_sig (H6 n2)))). unfold lt. rewrite (proj2_sig (H6 n2)). apply (proj2 (proj2_sig (H4 n2)) (proj1_sig (proj1_sig (H6 n2)))). apply H20. suff: ((SumEnsembleVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F1 n1))) = (SumEnsembleVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F1 n1))) (W2 (proj1_sig n2)))). move=> H20. rewrite H20. rewrite - (H12 n1). rewrite H17. rewrite - (Vadd_O_l K V (F2 n2)). apply (SumEnsembleVS_intro K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2))) (VO K V) (F2 n2)). suff: (SubspaceVS K V (W1 (S (proj1_sig n1)))). move=> H21. apply (proj2 (proj2 H21)). apply (SpanSubspaceVS K V). rewrite (H13 n2). rewrite - {2} (Vadd_O_l K V (F2 n2)). apply (SumEnsembleVS_intro K V (W2 (proj1_sig n2)) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F2 n2)) (VO K V) (F2 n2)). suff: (SubspaceVS K V (W2 (proj1_sig n2))). move=> H21. apply (proj2 (proj2 H21)). apply (SpanSubspaceVS K V). exists (FI K). rewrite (Vmul_I_l K V (F2 n2)). reflexivity. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v1 v2 H20 H21. elim H20. move=> v11 v12 H22 H23. rewrite (Vadd_assoc K V v11 v12 v2). rewrite (Vadd_comm K V v12 v2). rewrite - (Vadd_assoc K V v11 v2 v12). apply (SumEnsembleVS_intro K V). apply (SumEnsembleVS_intro K V). apply H22. apply H21. apply H23. move=> v. elim. move=> v1 v12 H20 H21. elim H20. move=> v11 v2 H22 H23. rewrite (Vadd_assoc K V v11 v2 v12). rewrite (Vadd_comm K V v2 v12). rewrite - (Vadd_assoc K V v11 v12 v2). apply (SumEnsembleVS_intro K V). apply (SumEnsembleVS_intro K V). apply H22. apply H21. apply H23. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v11 v1 H19 H20. elim H20. move=> v12 v2 H21 H22. rewrite - (Vadd_assoc K V v11 v12 v2). apply (SumEnsembleVS_intro K V). apply (SumEnsembleVS_intro K V). apply H19. apply H21. apply H22. move=> v. elim. move=> v1 v2 H19 H20. elim H19. move=> v11 v12 H21 H22. rewrite (Vadd_assoc K V v11 v12 v2). apply (SumEnsembleVS_intro K V). apply H21. apply (SumEnsembleVS_intro K V). apply H22. apply H20. apply (SumSubspaceVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2)))). apply (SpanSubspaceVS K V). apply (SpanSubspaceVS K V). apply Extensionality_Ensembles. apply conj. apply (H10 (proj1_sig n2) (S (proj1_sig n2)) (S (proj1_sig n1))). apply (le_S (proj1_sig n2) (proj1_sig n2) (le_n (proj1_sig n2))). rewrite (H13 n2). move=> v. elim. move=> v1 v2 H17 H18. elim H18. move=> v11 v12 H19 H20. rewrite - (Vadd_assoc K V v1 v11 v12). suff: (SubspaceVS K V (SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2)))). move=> H21. apply (proj1 H21 (Vadd K V v1 v11) v12). apply (SumEnsembleVS_intro K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2)) v1 v11 H17 H19). elim H20. move=> f H22. rewrite H22. apply (proj1 (proj2 H21) f (F2 n2)). rewrite - H15. rewrite (proj2_sig (H6 n2)). apply (proj1 (proj2_sig (H4 n2))). apply (SumSubspaceVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2))). apply (SpanSubspaceVS K V). apply (SpanSubspaceVS K V). move=> H16. suff: (In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))) (F2 n2)). rewrite - H15. move=> H17. apply (lt_irrefl (proj1_sig (proj1_sig (H6 n2)))). unfold lt. rewrite (proj2_sig (H6 n2)). apply (proj2 (proj2_sig (H4 n2)) (proj1_sig (proj1_sig (H6 n2)))). apply H17. rewrite H16. rewrite - H15. rewrite (proj2_sig (H6 n2)). apply (proj1 (proj2_sig (H4 n2))). move=> H15. apply sig_map. apply PeanoNat.Nat.succ_inj. rewrite (proj2_sig (H6 n2)). apply (is_min_nat_unique (fun (n : nat) => In (VT K V) (SumEnsembleVS K V (W1 n) (W2 (proj1_sig n2))) (F2 n2)) (proj1_sig (H4 n2)) (S (proj1_sig n1))). apply (proj2_sig (H4 n2)). apply conj. unfold In. rewrite (proj1 (proj2 (proj2 H15))). rewrite (H13 n2). rewrite - {2} (Vadd_O_l K V (F2 n2)). apply (SumEnsembleVS_intro K V). suff: (SubspaceVS K V (W1 (S (proj1_sig n1)))). move=> H16. apply (proj2 (proj2 H16)). apply (SpanSubspaceVS K V). rewrite - {2} (Vadd_O_l K V (F2 n2)). apply (SumEnsembleVS_intro K V). suff: (SubspaceVS K V (W2 (proj1_sig n2))). move=> H16. apply (proj2 (proj2 H16)). apply (SpanSubspaceVS K V). exists (FI K). rewrite (Vmul_I_l K V (F2 n2)). reflexivity. move=> m H16. elim (le_or_lt m (proj1_sig n1)). move=> H17. apply False_ind. suff: (~ In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))) (F2 n2)). move=> H18. apply H18. apply (H9 m (proj1_sig n1) (proj1_sig n2) H17 (F2 n2) H16). move=> H18. apply (proj1 (proj2 H15)). apply Extensionality_Ensembles. apply conj. apply (H10 (proj1_sig n2) (S (proj1_sig n2)) (proj1_sig n1)). apply (le_S (proj1_sig n2) (proj1_sig n2) (le_n (proj1_sig n2))). rewrite (H13 n2). move=> v. elim. move=> v1 v2 H19. elim. move=> v21 v22 H20 H21. rewrite - (Vadd_assoc K V v1 v21 v22). suff: (SubspaceVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)))). move=> H22. apply (proj1 H22 (Vadd K V v1 v21) v22). apply (SumEnsembleVS_intro K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)) v1 v21). apply H19. apply H20. elim H21. move=> f H23. rewrite H23. apply (proj1 (proj2 H22) f (F2 n2)). apply H18. apply (SumSubspaceVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))). apply (SpanSubspaceVS K V). apply (SpanSubspaceVS K V). apply. apply conj. move=> H14. suff: (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)) <> SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2)))). move=> H15. suff: (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))) = SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2)))). move=> H16. suff: (SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2)) = SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2)))). move=> H17. apply conj. rewrite H17. rewrite - H16. apply H15. apply conj. apply H15. apply conj. apply H17. apply H16. apply Extensionality_Ensembles. apply conj. apply (H10 (proj1_sig n2) (S (proj1_sig n2)) (S (proj1_sig n1))). apply (le_S (proj1_sig n2) (proj1_sig n2) (le_n (proj1_sig n2))). suff: (SubspaceVS K V (SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2)))). move=> H17. suff: (In (VT K V) (SumEnsembleVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2))) (F2 n2)). move=> H18 v. rewrite (H13 n2). elim. move=> v1 v2 H19. elim. move=> v11 v12 H20 H21. rewrite - (Vadd_assoc K V v1 v11 v12). apply (proj1 H17 (Vadd K V v1 v11) v12). apply (SumEnsembleVS_intro K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2)) v1 v11 H19 H20). elim H21. move=> f H22. rewrite H22. apply (proj1 (proj2 H17) f (F2 n2)). apply H18. rewrite (H12 n1). suff: ((SumEnsembleVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F1 n1))) (W2 (proj1_sig n2))) = (SumEnsembleVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F1 n1)))). move=> H18. rewrite H18. apply (H11 (F1 n1) (F2 n2) (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)))). apply (SumSubspaceVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))). apply (SpanSubspaceVS K V). apply (SpanSubspaceVS K V). rewrite - H14. move=> H19. apply (lt_irrefl (proj1_sig (proj1_sig (H5 n1)))). unfold lt. rewrite (proj2_sig (H5 n1)). apply (proj2 (proj2_sig (H3 n1)) (proj1_sig (proj1_sig (H5 n1)))). apply H19. suff: ((SumEnsembleVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F2 n2))) = (SumEnsembleVS K V (W1 (proj1_sig n1)) (SumEnsembleVS K V (W2 (proj1_sig n2)) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F2 n2))))). move=> H19. rewrite H19. rewrite - (H13 n2). rewrite H16. rewrite - (Vadd_O_r K V (F1 n1)). apply (SumEnsembleVS_intro K V (W1 (S (proj1_sig n1))) (W2 (S (proj1_sig n2))) (F1 n1) (VO K V)). rewrite (H12 n1). rewrite - {2} (Vadd_O_l K V (F1 n1)). apply (SumEnsembleVS_intro K V (W1 (proj1_sig n1)) (fun v : VT K V => exists f : FT K, v = Vmul K V f (F1 n1)) (VO K V) (F1 n1)). suff: (SubspaceVS K V (W1 (proj1_sig n1))). move=> H20. apply (proj2 (proj2 H20)). apply (SpanSubspaceVS K V). exists (FI K). rewrite (Vmul_I_l K V (F1 n1)). reflexivity. suff: (SubspaceVS K V (W2 (S (proj1_sig n2)))). move=> H20. apply (proj2 (proj2 H20)). apply (SpanSubspaceVS K V). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v1 v2 H19 H20. elim H19. move=> v11 v12 H21 H22. rewrite (Vadd_assoc K V v11 v12 v2). apply (SumEnsembleVS_intro K V). apply H21. apply (SumEnsembleVS_intro K V). apply H22. apply H20. move=> v. elim. move=> v11 v1 H19 H20. elim H20. move=> v12 v2 H21 H22. rewrite - (Vadd_assoc K V v11 v12 v2). apply (SumEnsembleVS_intro K V). apply (SumEnsembleVS_intro K V). apply H19. apply H21. apply H22. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v1 v12 H18 H19. elim H18. move=> v11 v2 H20 H21. rewrite (Vadd_assoc K V v11 v2 v12). rewrite (Vadd_comm K V v2 v12). rewrite - (Vadd_assoc K V v11 v12 v2). apply (SumEnsembleVS_intro K V). apply (SumEnsembleVS_intro K V). apply H20. apply H19. apply H21. move=> v. elim. move=> v1 v2 H18 H19. elim H18. move=> v11 v12 H20 H21. rewrite (Vadd_assoc K V v11 v12 v2). rewrite (Vadd_comm K V v12 v2). rewrite - (Vadd_assoc K V v11 v2 v12). apply (SumEnsembleVS_intro K V). apply (SumEnsembleVS_intro K V). apply H20. apply H19. apply H21. apply (SumSubspaceVS K V (W1 (S (proj1_sig n1))) (W2 (proj1_sig n2))). apply (SpanSubspaceVS K V). apply (SpanSubspaceVS K V). apply Extensionality_Ensembles. apply conj. apply (H9 (proj1_sig n1) (S (proj1_sig n1)) (S (proj1_sig n2))). apply (le_S (proj1_sig n1) (proj1_sig n1) (le_n (proj1_sig n1))). rewrite (H12 n1). move=> v. elim. move=> v1 v12 H16 H17. elim H16. move=> v11 v2 H18 H19. suff: (SubspaceVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))))). move=> H20. rewrite (Vadd_assoc K V v11 v2 v12). rewrite (Vadd_comm K V v2 v12). rewrite - (Vadd_assoc K V v11 v12 v2). apply (proj1 H20 (Vadd K V v11 v12) v2). apply (SumEnsembleVS_intro K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2))) v11 v12 H18 H17). elim H19. move=> f H21. rewrite H21. apply (proj1 (proj2 H20) f (F1 n1)). rewrite - H14. rewrite (proj2_sig (H5 n1)). apply (proj1 (proj2_sig (H3 n1))). apply (SumSubspaceVS K V (W1 (proj1_sig n1)) (W2 (S (proj1_sig n2)))). apply (SpanSubspaceVS K V). apply (SpanSubspaceVS K V). move=> H15. suff: (In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))) (F1 n1)). rewrite - H14. move=> H16. apply (lt_irrefl (proj1_sig (proj1_sig (H5 n1)))). unfold lt. rewrite (proj2_sig (H5 n1)). apply (proj2 (proj2_sig (H3 n1)) (proj1_sig (proj1_sig (H5 n1)))). apply H16. rewrite H15. rewrite - H14. rewrite (proj2_sig (H5 n1)). apply (proj1 (proj2_sig (H3 n1))). move=> H14. apply sig_map. apply PeanoNat.Nat.succ_inj. rewrite (proj2_sig (H5 n1)). apply (is_min_nat_unique (fun (n : nat) => In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 n)) (F1 n1)) (proj1_sig (H3 n1)) (S (proj1_sig n2))). apply (proj2_sig (H3 n1)). apply conj. unfold In. rewrite (proj2 (proj2 (proj2 H14))). rewrite (H12 n1). rewrite - {2} (Vadd_O_r K V (F1 n1)). apply (SumEnsembleVS_intro K V). rewrite - {2} (Vadd_O_l K V (F1 n1)). apply (SumEnsembleVS_intro K V). suff: (SubspaceVS K V (W1 (proj1_sig n1))). move=> H15. apply (proj2 (proj2 H15)). apply (SpanSubspaceVS K V). exists (FI K). rewrite (Vmul_I_l K V (F1 n1)). reflexivity. suff: (SubspaceVS K V (W2 (S (proj1_sig n2)))). move=> H15. apply (proj2 (proj2 H15)). apply (SpanSubspaceVS K V). move=> m H15. elim (le_or_lt m (proj1_sig n2)). move=> H16. apply False_ind. suff: (~ In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))) (F1 n1)). move=> H17. apply H17. apply (H10 m (proj1_sig n2) (proj1_sig n1) H16 (F1 n1) H15). move=> H17. apply (proj1 H14). apply Extensionality_Ensembles. apply conj. apply (H9 (proj1_sig n1) (S (proj1_sig n1)) (proj1_sig n2)). apply (le_S (proj1_sig n1) (proj1_sig n1) (le_n (proj1_sig n1))). rewrite (H12 n1). move=> v. elim. move=> v1 v12 H18 H19. elim H18. move=> v11 v2 H20 H21. rewrite (Vadd_assoc K V v11 v2 v12). rewrite (Vadd_comm K V v2 v12). rewrite - (Vadd_assoc K V v11 v12 v2). suff: (SubspaceVS K V (SumEnsembleVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)))). move=> H22. apply (proj1 H22 (Vadd K V v11 v12) v2). apply (SumEnsembleVS_intro K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2)) v11 v12 H20 H19). elim H21. move=> f H23. rewrite H23. apply (proj1 (proj2 H22) f (F1 n1) H17). apply (SumSubspaceVS K V (W1 (proj1_sig n1)) (W2 (proj1_sig n2))). apply (SpanSubspaceVS K V). apply (SpanSubspaceVS K V). apply. move=> w1 w2 A H11 H14 H15. suff: (exists (a : VT K V) (f : FT K), w1 = Vadd K V a (Vmul K V f w2) /\ In (VT K V) A a). elim. move=> a. elim. move=> f H16. suff: (f <> FO K). move=> H17. rewrite - (Vmul_I_l K V w2). rewrite - (Finv_l K f H17). suff: (SubspaceVS K V(SumEnsembleVS K V A (fun v : VT K V => exists f0 : FT K, v = Vmul K V f0 w1))). move=> H18. rewrite - (Vmul_assoc K V (Finv K f) f w2). apply (proj1 (proj2 H18) (Finv K f) (Vmul K V f w2)). suff: (Vmul K V f w2 = Vadd K V (Vopp K V a) w1). move=> H19. rewrite H19. apply (SumEnsembleVS_intro K V A (fun v : VT K V => exists f0 : FT K, v = Vmul K V f0 w1) (Vopp K V a) w1). apply (SubspaceMakeVSVoppSub K V A H11 a (proj2 H16)). exists (FI K). rewrite (Vmul_I_l K V w1). reflexivity. apply (Vadd_eq_reg_l K V a (Vmul K V f w2) (Vadd K V (Vopp K V a) w1)). rewrite - (Vadd_assoc K V a (Vopp K V a) w1). rewrite (Vadd_opp_r K V a). rewrite (Vadd_O_l K V w1). rewrite (proj1 H16). reflexivity. apply (SumSubspaceVS K V A (fun v : VT K V => exists f0 : FT K, v = Vmul K V f0 w1)). apply H11. apply (SingleSubspaceVS K V w1). move=> H17. apply H14. rewrite (proj1 H16). rewrite H17. rewrite (Vmul_O_l K V w2). rewrite (Vadd_O_r K V a). apply (proj2 H16). elim H15. move=> v1 v2 H16 H17. exists v1. elim H17. move=> f H18. exists f. apply conj. rewrite H18. reflexivity. apply H16. move=> n1 n2 m H10 v. elim. move=> v1 v2 H11 H14. apply (SumEnsembleVS_intro K V (W1 m) (W2 n2) v1 v2 H11). apply (H8 n1 n2 H10 v2 H14). move=> n1 n2 m H9 v. elim. move=> v1 v2 H10 H11. apply (SumEnsembleVS_intro K V (W1 n2) (W2 m) v1 v2). apply (H7 n1 n2 H9 v1 H10). apply H11. move=> n1 n2. elim. move=> v. apply. move=> m H8 H9. elim (le_or_lt N2 m). move=> H10. suff: (W2 (S m) = W2 m). move=> H11. rewrite H11. apply H9. unfold W2. suff: (forall (n : Count N2), proj1_sig n < S m). move=> H11. suff: ((fun k : {n : Count N2 | proj1_sig n < m} => F2 (proj1_sig k)) = compose (fun k : {n : Count N2 | proj1_sig n < S m} => F2 (proj1_sig k)) (fun (l : {n : Count N2 | proj1_sig n < m}) => exist (fun (k : Count N2) => proj1_sig k < S m) (proj1_sig l) (H11 (proj1_sig l)))). move=> H14. rewrite H14. apply (BijectiveSaveSpanVS K V {n : Count N2 | proj1_sig n < m} {n : Count N2 | proj1_sig n < S m} (fun l : {n : Count N2 | proj1_sig n < m} => exist (fun k : Count N2 => proj1_sig k < S m) (proj1_sig l) (H11 (proj1_sig l))) (fun k : {n : Count N2 | proj1_sig n < S m} => F2 (proj1_sig k))). suff: (forall (n : Count N2), proj1_sig n < m). move=> H15. exists (fun l : {n : Count N2 | proj1_sig n < S m} => exist (fun k : Count N2 => proj1_sig k < m) (proj1_sig l) (H15 (proj1_sig l))). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. reflexivity. move=> n. apply (le_trans (S (proj1_sig n)) N2 m (proj2_sig n) H10). apply functional_extensionality. move=> k. reflexivity. move=> n. apply (le_trans (S (proj1_sig n)) N2 (S m) (proj2_sig n) (le_S N2 m H10)). move=> H10. rewrite (H13 (exist (fun (n : nat) => n < N2) m H10)). move=> v H11. rewrite - (Vadd_O_r K V v). apply (SumEnsembleVS_intro K V). apply (H9 v H11). exists (FO K). rewrite (Vmul_O_l K V). reflexivity. move=> n1 n2. elim. move=> v. apply. move=> m H7 H8. elim (le_or_lt N1 m). move=> H9. suff: (W1 (S m) = W1 m). move=> H10. rewrite H10. apply H8. unfold W1. suff: (forall (n : Count N1), proj1_sig n < S m). move=> H10. suff: ((fun k : {n : Count N1 | proj1_sig n < m} => F1 (proj1_sig k)) = compose (fun k : {n : Count N1 | proj1_sig n < S m} => F1 (proj1_sig k)) (fun (l : {n : Count N1 | proj1_sig n < m}) => exist (fun (k : Count N1) => proj1_sig k < S m) (proj1_sig l) (H10 (proj1_sig l)))). move=> H11. rewrite H11. apply (BijectiveSaveSpanVS K V {n : Count N1 | proj1_sig n < m} {n : Count N1 | proj1_sig n < S m} (fun l : {n : Count N1 | proj1_sig n < m} => exist (fun k : Count N1 => proj1_sig k < S m) (proj1_sig l) (H10 (proj1_sig l))) (fun k : {n : Count N1 | proj1_sig n < S m} => F1 (proj1_sig k))). suff: (forall (n : Count N1), proj1_sig n < m). move=> H14. exists (fun l : {n : Count N1 | proj1_sig n < S m} => exist (fun k : Count N1 => proj1_sig k < m) (proj1_sig l) (H14 (proj1_sig l))). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. reflexivity. move=> n. apply (le_trans (S (proj1_sig n)) N1 m (proj2_sig n) H9). apply functional_extensionality. move=> k. reflexivity. move=> n. apply (le_trans (S (proj1_sig n)) N1 (S m) (proj2_sig n) (le_S N1 m H9)). move=> H9. rewrite (H12 (exist (fun (n : nat) => n < N1) m H9)). move=> v H10. rewrite - (Vadd_O_r K V v). apply (SumEnsembleVS_intro K V). apply (H8 v H10). exists (FO K). rewrite (Vmul_O_l K V). reflexivity. move=> m. unfold W2. suff: (forall (m : (Count (S (proj1_sig m)))), proj1_sig m < N2). move=> H13. rewrite (BijectiveSaveSpanVS K V (Count (S (proj1_sig m))) {n : Count N2 | proj1_sig n < S (proj1_sig m)} (fun (k : Count (S (proj1_sig m))) => exist (fun (l : Count N2) => proj1_sig l < S (proj1_sig m)) (exist (fun (l : nat) => l < N2) (proj1_sig k) (H13 k)) (proj2_sig k))). suff: (forall (m : (Count (proj1_sig m))), proj1_sig m < N2). move=> H14. rewrite (BijectiveSaveSpanVS K V (Count (proj1_sig m)) {n : Count N2 | proj1_sig n < proj1_sig m} (fun (k : Count (proj1_sig m)) => exist (fun (l : Count N2) => proj1_sig l < proj1_sig m) (exist (fun (l : nat) => l < N2) (proj1_sig k) (H14 k)) (proj2_sig k))). simpl. rewrite (FiniteSpanVS K V (S (proj1_sig m))). rewrite (FiniteSpanVS K V (proj1_sig m)). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> x H15. rewrite H15. elim (MySumF2Sn2_exists (proj1_sig m)). move=> H16. elim. move=> H17 H18. rewrite H18. apply (SumEnsembleVS_intro K V). exists (fun m0 : Count (proj1_sig m) => (x (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H16 m0)))). suff: ((fun m0 : Count (proj1_sig m) => Vmul K V (x (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H16 m0))) (F2 (exist (fun l : nat => l < N2) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H16 m0))) (H13 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H16 m0)))))) = (fun n : Count (proj1_sig m) => Vmul K V (x (exist (fun n0 : nat => n0 < S (proj1_sig m)) (proj1_sig n) (H16 n))) (F2 (exist (fun l : nat => l < N2) (proj1_sig n) (H14 n))))). move=> H19. rewrite H19. reflexivity. apply functional_extensionality. move=> n. suff: ((H13 (exist (fun n0 : nat => n0 < S (proj1_sig m)) (proj1_sig n) (H16 n))) = (H14 n)). move=> H19. rewrite H19. reflexivity. apply proof_irrelevance. exists (x (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H17)). unfold compose. suff: ((exist (fun l : nat => l < N2) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H17)) (H13 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H17))) = m). move=> H19. simpl. rewrite H19. reflexivity. apply sig_map. reflexivity. move=> v. elim. move=> v1 v2 H15 H16. elim H16. move=> f H17. rewrite H17. elim H15. move=> x H18. rewrite H18. exists (fun (k : Count (S (proj1_sig m))) => match (excluded_middle_informative (proj1_sig k < proj1_sig m)) with | left H => x (exist (fun (l : nat) => l < proj1_sig m) (proj1_sig k) H) | right _ => f end). elim (MySumF2Sn2_exists (proj1_sig m)). move=> H19. elim. move=> H20 H21. rewrite H21. suff: ((fun n : Count (proj1_sig m) => Vmul K V (x n) (F2 (exist (fun l : nat => l < N2) (proj1_sig n) (H14 n)))) = (fun m0 : Count (proj1_sig m) => Vmul K V match excluded_middle_informative (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H19 m0)) < proj1_sig m) with | left H => x (exist (fun l : nat => l < proj1_sig m) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H19 m0))) H) | right _ => f end (F2 (exist (fun l : nat => l < N2) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H19 m0))) (H13 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H19 m0))))))). move=> H22. rewrite H22. suff: (Vmul K V f (F2 m) = Vmul K V match excluded_middle_informative (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H20) < proj1_sig m) with | left H => x (exist (fun l : nat => l < proj1_sig m) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H20)) H) | right _ => f end (F2 (exist (fun l : nat => l < N2) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H20)) (H13 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H20))))). move=> H23. rewrite H23. reflexivity. simpl. suff: ((exist (fun l : nat => l < N2) (proj1_sig m) (H13 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H20))) = m). move=> H23. rewrite H23. elim (excluded_middle_informative (proj1_sig m < proj1_sig m)). move=> H24. apply False_ind. apply (lt_irrefl (proj1_sig m) H24). move=> H24. reflexivity. apply sig_map. reflexivity. apply functional_extensionality. move=> n. simpl. elim (excluded_middle_informative (proj1_sig n < proj1_sig m)). move=> H22. suff: ((exist (fun l : nat => l < proj1_sig m) (proj1_sig n) H22) = n). move=> H23. suff: ((exist (fun l : nat => l < N2) (proj1_sig n) (H13 (exist (fun n0 : nat => n0 < S (proj1_sig m)) (proj1_sig n) (H19 n)))) = (exist (fun l : nat => l < N2) (proj1_sig n) (H14 n))). move=> H24. rewrite H23. rewrite H24. reflexivity. apply sig_map. reflexivity. apply sig_map. reflexivity. move=> H22. apply False_ind. apply H22. apply (proj2_sig n). exists (fun (l : {n : Count N2 | proj1_sig n < proj1_sig m}) => exist (fun (k : nat) => k < proj1_sig m) (proj1_sig (proj1_sig l)) (proj2_sig l)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> k. apply (lt_trans (proj1_sig k) (proj1_sig m) N2 (proj2_sig k) (proj2_sig m)). exists (fun (l : {n : Count N2 | proj1_sig n < S (proj1_sig m)}) => exist (fun (k : nat) => k < S (proj1_sig m)) (proj1_sig (proj1_sig l)) (proj2_sig l)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> k. apply (le_trans (S (proj1_sig k)) (S (proj1_sig m)) N2 (proj2_sig k) (proj2_sig m)). move=> m. unfold W1. suff: (forall (m : (Count (S (proj1_sig m)))), proj1_sig m < N1). move=> H7. rewrite (BijectiveSaveSpanVS K V (Count (S (proj1_sig m))) {n : Count N1 | proj1_sig n < S (proj1_sig m)} (fun (k : Count (S (proj1_sig m))) => exist (fun (l : Count N1) => proj1_sig l < S (proj1_sig m)) (exist (fun (l : nat) => l < N1) (proj1_sig k) (H7 k)) (proj2_sig k))). suff: (forall (m : (Count (proj1_sig m))), proj1_sig m < N1). move=> H8. rewrite (BijectiveSaveSpanVS K V (Count (proj1_sig m)) {n : Count N1 | proj1_sig n < proj1_sig m} (fun (k : Count (proj1_sig m)) => exist (fun (l : Count N1) => proj1_sig l < proj1_sig m) (exist (fun (l : nat) => l < N1) (proj1_sig k) (H8 k)) (proj2_sig k))). simpl. rewrite (FiniteSpanVS K V (S (proj1_sig m))). rewrite (FiniteSpanVS K V (proj1_sig m)). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> x H9. rewrite H9. elim (MySumF2Sn2_exists (proj1_sig m)). move=> H10. elim. move=> H11 H12. rewrite H12. apply (SumEnsembleVS_intro K V). exists (fun m0 : Count (proj1_sig m) => (x (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H10 m0)))). suff: ((fun m0 : Count (proj1_sig m) => Vmul K V (x (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H10 m0))) (F1 (exist (fun l : nat => l < N1) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H10 m0))) (H7 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H10 m0)))))) = (fun n : Count (proj1_sig m) => Vmul K V (x (exist (fun n0 : nat => n0 < S (proj1_sig m)) (proj1_sig n) (H10 n))) (F1 (exist (fun l : nat => l < N1) (proj1_sig n) (H8 n))))). move=> H13. rewrite H13. reflexivity. apply functional_extensionality. move=> n. suff: ((H7 (exist (fun n0 : nat => n0 < S (proj1_sig m)) (proj1_sig n) (H10 n))) = (H8 n)). move=> H13. rewrite H13. reflexivity. apply proof_irrelevance. exists (x (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H11)). suff: ((exist (fun l : nat => l < N1) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H11)) (H7 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H11))) = m). move=> H13. unfold compose. simpl. rewrite H13. reflexivity. apply sig_map. reflexivity. move=> v. elim. move=> v1 v2 H9 H10. elim H10. move=> f H11. rewrite H11. elim H9. move=> x H12. rewrite H12. exists (fun (k : Count (S (proj1_sig m))) => match (excluded_middle_informative (proj1_sig k < proj1_sig m)) with | left H => x (exist (fun (l : nat) => l < proj1_sig m) (proj1_sig k) H) | right _ => f end). elim (MySumF2Sn2_exists (proj1_sig m)). move=> H13. elim. move=> H14 H15. rewrite H15. suff: ((fun n : Count (proj1_sig m) => Vmul K V (x n) (F1 (exist (fun l : nat => l < N1) (proj1_sig n) (H8 n)))) = (fun m0 : Count (proj1_sig m) => Vmul K V match excluded_middle_informative (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H13 m0)) < proj1_sig m) with | left H => x (exist (fun l : nat => l < proj1_sig m) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H13 m0))) H) | right _ => f end (F1 (exist (fun l : nat => l < N1) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H13 m0))) (H7 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H13 m0))))))). move=> H16. rewrite H16. suff: (Vmul K V f (F1 m) = Vmul K V match excluded_middle_informative (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H14) < proj1_sig m) with | left H => x (exist (fun l : nat => l < proj1_sig m) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H14)) H) | right _ => f end (F1 (exist (fun l : nat => l < N1) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H14)) (H7 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H14))))). move=> H17. rewrite H17. reflexivity. simpl. suff: ((exist (fun l : nat => l < N1) (proj1_sig m) (H7 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H14))) = m). move=> H17. rewrite H17. elim (excluded_middle_informative (proj1_sig m < proj1_sig m)). move=> H18. apply False_ind. apply (lt_irrefl (proj1_sig m) H18). move=> H18. reflexivity. apply sig_map. reflexivity. apply functional_extensionality. move=> n. simpl. elim (excluded_middle_informative (proj1_sig n < proj1_sig m)). move=> H16. suff: ((exist (fun l : nat => l < proj1_sig m) (proj1_sig n) H16) = n). move=> H17. suff: ((exist (fun l : nat => l < N1) (proj1_sig n) (H7 (exist (fun n0 : nat => n0 < S (proj1_sig m)) (proj1_sig n) (H13 n)))) = (exist (fun l : nat => l < N1) (proj1_sig n) (H8 n))). move=> H18. rewrite H17. rewrite H18. reflexivity. apply sig_map. reflexivity. apply sig_map. reflexivity. move=> H16. apply False_ind. apply H16. apply (proj2_sig n). exists (fun (l : {n : Count N1 | proj1_sig n < proj1_sig m}) => exist (fun (k : nat) => k < proj1_sig m) (proj1_sig (proj1_sig l)) (proj2_sig l)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> k. apply (lt_trans (proj1_sig k) (proj1_sig m) N1 (proj2_sig k) (proj2_sig m)). exists (fun (l : {n : Count N1 | proj1_sig n < S (proj1_sig m)}) => exist (fun (k : nat) => k < S (proj1_sig m)) (proj1_sig (proj1_sig l)) (proj2_sig l)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> k. apply (le_trans (S (proj1_sig k)) (S (proj1_sig m)) N1 (proj2_sig k) (proj2_sig m)). move=> k. suff: (proj1_sig (H4 k) <> O /\ proj1_sig (H4 k) < S N1). elim (proj1_sig (H4 k)). move=> H6. apply constructive_definite_description. apply False_ind. apply (proj1 H6). reflexivity. move=> n H6 H7. exists (exist (fun (k : nat) => k < N1) n (lt_S_n n N1 (proj2 H7))). reflexivity. apply conj. move=> H6. suff: (In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig (H4 k))) (W2 (proj1_sig k))) (F2 k)). rewrite H6. suff: (SumEnsembleVS K V (W1 0) (W2 (proj1_sig k)) = (W2 (proj1_sig k))). move=> H7. rewrite H7. unfold W2. suff: (forall (m : Count (proj1_sig k)), proj1_sig m < N2). move=> H8. rewrite (BijectiveSaveSpanVS K V (Count (proj1_sig k)) {n : Count N2 | proj1_sig n < proj1_sig k} (fun (m : Count (proj1_sig k)) => exist (fun (n : Count N2) => proj1_sig n < proj1_sig k) (exist (fun (n : nat) => n < N2) (proj1_sig m) (H8 m)) (proj2_sig m))). simpl. rewrite (FiniteSpanVS K V (proj1_sig k) (fun t : Count (proj1_sig k) => F2 (exist (fun n : nat => n < N2) (proj1_sig t) (H8 t)))). elim. move=> a H9. apply (FI_neq_FO K). rewrite - (Fopp_involutive K (FI K)). apply (Fopp_eq_O_compat K (Fopp K (FI K))). suff: (Fopp K (FI K) = (fun (m : Count N2) => match excluded_middle_informative (proj1_sig m <= proj1_sig k) with | left _ => match excluded_middle_informative (proj1_sig m < proj1_sig k) with | left H => a (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig m) H) | right _ => Fopp K (FI K) end | right _ => FO K end) k). move=> H10. rewrite H10. apply (proj1 (FiniteLinearlyIndependentVS K V N2 F2) (proj1 (proj1 (BasisLIGeVS K V (Count N2) F2) H2)) (fun (m : Count N2) => match excluded_middle_informative (proj1_sig m <= proj1_sig k) with | left _ => match excluded_middle_informative (proj1_sig m < proj1_sig k) with | left H => a (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig m) H) | right _ => Fopp K (FI K) end | right _ => FO K end)). rewrite (MySumF2Included (Count N2) (FiniteIntersection (Count N2) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2)) (fun (n : Count N2) => proj1_sig n <= proj1_sig k)) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2))). rewrite (MySumF2O (Count N2) (FiniteIntersection (Count N2) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2)) (Complement (Count N2) (proj1_sig (FiniteIntersection (Count N2) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2)) (fun n : Count N2 => proj1_sig n <= proj1_sig k)))))). rewrite (MySumF2Included (Count N2) (FiniteIntersection (Count N2) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2)) (fun n : Count N2 => proj1_sig n < proj1_sig k)) (FiniteIntersection (Count N2) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2)) (fun n : Count N2 => proj1_sig n <= proj1_sig k))). suff: (FiniteIntersection (Count N2) (FiniteIntersection (Count N2) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2)) (fun n : Count N2 => proj1_sig n <= proj1_sig k)) (Complement (Count N2) (proj1_sig (FiniteIntersection (Count N2) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2)) (fun n : Count N2 => proj1_sig n < proj1_sig k)))) = FiniteSingleton (Count N2) k). move=> H11. rewrite H11. rewrite MySumF2Singleton. elim (excluded_middle_informative (proj1_sig k <= proj1_sig k)). move=> H12. elim (excluded_middle_informative (proj1_sig k < proj1_sig k)). move=> H13. apply False_ind. apply (lt_irrefl (proj1_sig k) H13). move=> H13. rewrite (Vopp_mul_distr_l_reverse K V (FI K) (F2 k)). rewrite (Vmul_I_l K V (F2 k)). rewrite H9. rewrite - (MySumF2BijectiveSame (Count (proj1_sig k)) (exist (Finite (Count (proj1_sig k))) (Full_set (Count (proj1_sig k))) (CountFinite (proj1_sig k))) (Count N2) (FiniteIntersection (Count N2) (exist (Finite (Count N2)) (Full_set (Count N2)) (CountFinite N2)) (fun n : Count N2 => proj1_sig n < proj1_sig k)) (VSPCM K V) (fun m : Count N2 => Vmul K V (match excluded_middle_informative (proj1_sig m <= proj1_sig k) with | left _ => match excluded_middle_informative (proj1_sig m < proj1_sig k) with | left H => a (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig m) H) | right _ => Fopp K (FI K) end | right _ => FO K end) (F2 m)) (fun n : Count (proj1_sig k) => (exist (fun n0 : nat => n0 < N2) (proj1_sig n) (H8 n)))). suff: ((fun u : Count (proj1_sig k) => Vmul K V (match excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < N2) (proj1_sig u) (H8 u)) <= proj1_sig k) with | left _ => match excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < N2) (proj1_sig u) (H8 u)) < proj1_sig k) with | left H => a (exist (fun n : nat => n < proj1_sig k) (proj1_sig (exist (fun n0 : nat => n0 < N2) (proj1_sig u) (H8 u))) H) | right _ => Fopp K (FI K) end | right _ => FO K end) (F2 (exist (fun n0 : nat => n0 < N2) (proj1_sig u) (H8 u)))) = (fun n : Count (proj1_sig k) => Vmul K V (a n) (F2 (exist (fun n0 : nat => n0 < N2) (proj1_sig n) (H8 n))))). move=> H14. rewrite H14. simpl. rewrite (Vadd_opp_r K V). apply (Vadd_O_r K V (VO K V)). apply functional_extensionality. move=> u. elim (excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < N2) (proj1_sig u) (H8 u)) <= proj1_sig k)). move=> H14. elim (excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < N2) (proj1_sig u) (H8 u)) < proj1_sig k)). move=> H15. suff: ((exist (fun n : nat => n < proj1_sig k) (proj1_sig (exist (fun n0 : nat => n0 < N2) (proj1_sig u) (H8 u))) H15) = u). move=> H16. rewrite H16. reflexivity. apply sig_map. reflexivity. move=> H15. apply False_ind. apply H15. apply (proj2_sig u). move=> H14. apply False_ind. apply H14. apply (lt_le_weak (proj1_sig u) (proj1_sig k) (proj2_sig u)). move=> u H14. apply (Intersection_intro (Count N2)). apply (proj2_sig u). apply (Full_intro (Count N2)). simpl. move=> H14. apply InjSurjBij. move=> u1 u2 H15. apply sig_map. apply sig_map. suff: (proj1_sig (proj1_sig u1) = proj1_sig (proj1_sig (exist (Intersection (Count N2) (fun n : Count N2 => proj1_sig n < proj1_sig k) (Full_set (Count N2))) (exist (fun n0 : nat => n0 < N2) (proj1_sig (proj1_sig u1)) (H8 (proj1_sig u1))) (H14 (proj1_sig u1) (proj2_sig u1))))). move=> H16. rewrite H16. rewrite H15. reflexivity. reflexivity. move=> t. suff: (proj1_sig (proj1_sig t) < proj1_sig k). move=> H15. exists (exist (Full_set (Count (proj1_sig k))) (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig (proj1_sig t)) H15) (Full_intro (Count (proj1_sig k)) (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig (proj1_sig t)) H15))). apply sig_map. apply sig_map. reflexivity. elim (proj2_sig t). move=> u H15 H16. apply H15. move=> H12. apply False_ind. apply H12. apply (le_n (proj1_sig k)). apply sig_map. apply Extensionality_Ensembles. apply conj. move=> m H11. suff: (m = k). move=> H12. rewrite H12. apply (In_singleton (Count N2)). apply sig_map. elim H11. move=> u H12 H13. elim (le_lt_or_eq (proj1_sig u) (proj1_sig k)). move=> H14. apply False_ind. apply H12. apply (Intersection_intro (Count N2)). apply H14. apply (Full_intro (Count N2)). apply. elim H13. move=> n H14 H15. apply H14. move=> m H11. apply (Intersection_intro (Count N2)). move=> H12. suff: (~ proj1_sig m < proj1_sig k). move=> H13. apply H13. elim H12. move=> n H14 H15. apply H14. elim H11. apply (lt_irrefl (proj1_sig k)). elim H11. apply (Intersection_intro (Count N2)). apply (le_n (proj1_sig k)). apply (Full_intro (Count N2) k). move=> u. elim. move=> u0 H11. apply (Intersection_intro (Count N2)). apply (lt_le_weak (proj1_sig u0) (proj1_sig k) H11). move=> u. elim. move=> w H11 H12. elim (excluded_middle_informative (proj1_sig w <= proj1_sig k)). move=> H13. apply False_ind. apply H11. apply (Intersection_intro (Count N2)). apply H13. apply (Full_intro (Count N2) w). move=> H13. apply (Vmul_O_l K V (F2 w)). move=> v H11. apply (Full_intro (Count N2) v). elim (excluded_middle_informative (proj1_sig k <= proj1_sig k)). move=> H10. elim (excluded_middle_informative (proj1_sig k < proj1_sig k)). move=> H11. apply False_ind. apply (lt_irrefl (proj1_sig k) H11). move=> H11. reflexivity. move=> H10. apply False_ind. apply H10. apply (le_n (proj1_sig k)). exists (fun (m : {n : Count N2 | proj1_sig n < proj1_sig k}) => exist (fun (l : nat) => l < proj1_sig k) (proj1_sig (proj1_sig m)) (proj2_sig m)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> m. apply (lt_trans (proj1_sig m) (proj1_sig k) N2 (proj2_sig m) (proj2_sig k)). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v1 v2 H7 H8. suff: (v1 = VO K V). move=> H9. rewrite H9. rewrite (Vadd_O_l K V v2). apply H8. elim H7. move=> x H9. rewrite H9. suff: ((exist (Finite {n : Count N1 | proj1_sig n < 0}) (fun t : {n : Count N1 | proj1_sig n < 0} => proj1_sig x t <> FO K) (proj2_sig x)) = (FiniteEmpty {n : Count N1 | proj1_sig n < 0})). move=> H10. rewrite H10. apply (MySumF2Empty {n : Count N1 | proj1_sig n < 0} (VSPCM K V) (fun t : {n : Count N1 | proj1_sig n < 0} => Vmul K V (proj1_sig x t) (F1 (proj1_sig t)))). apply sig_map. apply Extensionality_Ensembles. apply conj. move=> u. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig (proj1_sig u)) (proj2_sig u)). move=> u. elim. move=> v H7. rewrite - (Vadd_O_l K V v). apply (SumEnsembleVS_intro K V). suff: (SubspaceVS K V (W1 0)). move=> H8. apply (proj2 (proj2 H8)). apply (SpanSubspaceVS K V). apply H7. apply (proj1 (proj2_sig (H4 k))). apply (le_n_S (proj1_sig (H4 k)) N1). apply (proj2 (proj2_sig (H4 k)) N1). unfold In. rewrite - (Vadd_O_r K V (F2 k)). apply (SumEnsembleVS_intro K V). unfold W1. rewrite (BijectiveSaveSpanVS K V (Count N1) {n : Count N1 | proj1_sig n < N1} (fun (m : Count N1) => exist (fun (m : Count N1) => proj1_sig m < N1) m (proj2_sig m))). simpl. rewrite - (proj2 (proj1 (BasisLIGeVS K V (Count N1) F1) H1)). apply (Full_intro (VT K V) (F2 k)). exists (fun (m : {n : Count N1 | proj1_sig n < N1}) => proj1_sig m). apply conj. move=> x. reflexivity. move=> y. apply sig_map. reflexivity. suff: (SubspaceVS K V (W2 (proj1_sig k))). move=> H6. apply (proj2 (proj2 H6)). apply (SpanSubspaceVS K V). move=> k. suff: (proj1_sig (H3 k) <> O /\ proj1_sig (H3 k) < S N2). elim (proj1_sig (H3 k)). move=> H5. apply constructive_definite_description. apply False_ind. apply (proj1 H5). reflexivity. move=> n H5 H6. exists (exist (fun (k : nat) => k < N2) n (lt_S_n n N2 (proj2 H6))). reflexivity. apply conj. move=> H5. suff: (In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig k)) (W2 (proj1_sig (H3 k)))) (F1 k)). rewrite H5. suff: (SumEnsembleVS K V (W1 (proj1_sig k)) (W2 0) = (W1 (proj1_sig k))). move=> H6. rewrite H6. unfold W1. suff: (forall (m : Count (proj1_sig k)), proj1_sig m < N1). move=> H7. rewrite (BijectiveSaveSpanVS K V (Count (proj1_sig k)) {n : Count N1 | proj1_sig n < proj1_sig k} (fun (m : Count (proj1_sig k)) => exist (fun (n : Count N1) => proj1_sig n < proj1_sig k) (exist (fun (n : nat) => n < N1) (proj1_sig m) (H7 m)) (proj2_sig m))). simpl. rewrite (FiniteSpanVS K V (proj1_sig k) (fun t : Count (proj1_sig k) => F1 (exist (fun n : nat => n < N1) (proj1_sig t) (H7 t)))). elim. move=> a H8. apply (FI_neq_FO K). rewrite - (Fopp_involutive K (FI K)). apply (Fopp_eq_O_compat K (Fopp K (FI K))). suff: (Fopp K (FI K) = (fun (m : Count N1) => match excluded_middle_informative (proj1_sig m <= proj1_sig k) with | left _ => match excluded_middle_informative (proj1_sig m < proj1_sig k) with | left H => a (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig m) H) | right _ => Fopp K (FI K) end | right _ => FO K end) k). move=> H9. rewrite H9. apply (proj1 (FiniteLinearlyIndependentVS K V N1 F1) (proj1 (proj1 (BasisLIGeVS K V (Count N1) F1) H1)) (fun (m : Count N1) => match excluded_middle_informative (proj1_sig m <= proj1_sig k) with | left _ => match excluded_middle_informative (proj1_sig m < proj1_sig k) with | left H => a (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig m) H) | right _ => Fopp K (FI K) end | right _ => FO K end)). rewrite (MySumF2Included (Count N1) (FiniteIntersection (Count N1) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1)) (fun (n : Count N1) => proj1_sig n <= proj1_sig k)) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1))). rewrite (MySumF2O (Count N1) (FiniteIntersection (Count N1) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1)) (Complement (Count N1) (proj1_sig (FiniteIntersection (Count N1) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1)) (fun n : Count N1 => proj1_sig n <= proj1_sig k)))))). rewrite (MySumF2Included (Count N1) (FiniteIntersection (Count N1) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1)) (fun n : Count N1 => proj1_sig n < proj1_sig k)) (FiniteIntersection (Count N1) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1)) (fun n : Count N1 => proj1_sig n <= proj1_sig k))). suff: (FiniteIntersection (Count N1) (FiniteIntersection (Count N1) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1)) (fun n : Count N1 => proj1_sig n <= proj1_sig k)) (Complement (Count N1) (proj1_sig (FiniteIntersection (Count N1) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1)) (fun n : Count N1 => proj1_sig n < proj1_sig k)))) = FiniteSingleton (Count N1) k). move=> H10. rewrite H10. rewrite MySumF2Singleton. elim (excluded_middle_informative (proj1_sig k <= proj1_sig k)). move=> H11. elim (excluded_middle_informative (proj1_sig k < proj1_sig k)). move=> H12. apply False_ind. apply (lt_irrefl (proj1_sig k) H12). move=> H12. rewrite (Vopp_mul_distr_l_reverse K V (FI K) (F1 k)). rewrite (Vmul_I_l K V (F1 k)). rewrite H8. rewrite - (MySumF2BijectiveSame (Count (proj1_sig k)) (exist (Finite (Count (proj1_sig k))) (Full_set (Count (proj1_sig k))) (CountFinite (proj1_sig k))) (Count N1) (FiniteIntersection (Count N1) (exist (Finite (Count N1)) (Full_set (Count N1)) (CountFinite N1)) (fun n : Count N1 => proj1_sig n < proj1_sig k)) (VSPCM K V) (fun m : Count N1 => Vmul K V (match excluded_middle_informative (proj1_sig m <= proj1_sig k) with | left _ => match excluded_middle_informative (proj1_sig m < proj1_sig k) with | left H => a (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig m) H) | right _ => Fopp K (FI K) end | right _ => FO K end) (F1 m)) (fun n : Count (proj1_sig k) => (exist (fun n0 : nat => n0 < N1) (proj1_sig n) (H7 n)))). suff: ((fun u : Count (proj1_sig k) => Vmul K V (match excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < N1) (proj1_sig u) (H7 u)) <= proj1_sig k) with | left _ => match excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < N1) (proj1_sig u) (H7 u)) < proj1_sig k) with | left H => a (exist (fun n : nat => n < proj1_sig k) (proj1_sig (exist (fun n0 : nat => n0 < N1) (proj1_sig u) (H7 u))) H) | right _ => Fopp K (FI K) end | right _ => FO K end) (F1 (exist (fun n0 : nat => n0 < N1) (proj1_sig u) (H7 u)))) = (fun n : Count (proj1_sig k) => Vmul K V (a n) (F1 (exist (fun n0 : nat => n0 < N1) (proj1_sig n) (H7 n))))). move=> H13. rewrite H13. simpl. rewrite (Vadd_opp_r K V). apply (Vadd_O_r K V (VO K V)). apply functional_extensionality. move=> u. elim (excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < N1) (proj1_sig u) (H7 u)) <= proj1_sig k)). move=> H13. elim (excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < N1) (proj1_sig u) (H7 u)) < proj1_sig k)). move=> H14. suff: ((exist (fun n : nat => n < proj1_sig k) (proj1_sig (exist (fun n0 : nat => n0 < N1) (proj1_sig u) (H7 u))) H14) = u). move=> H15. rewrite H15. reflexivity. apply sig_map. reflexivity. move=> H14. apply False_ind. apply H14. apply (proj2_sig u). move=> H13. apply False_ind. apply H13. apply (lt_le_weak (proj1_sig u) (proj1_sig k) (proj2_sig u)). move=> u H13. apply (Intersection_intro (Count N1)). apply (proj2_sig u). apply (Full_intro (Count N1)). simpl. move=> H13. apply InjSurjBij. move=> u1 u2 H14. apply sig_map. apply sig_map. suff: (proj1_sig (proj1_sig u1) = proj1_sig (proj1_sig (exist (Intersection (Count N1) (fun n : Count N1 => proj1_sig n < proj1_sig k) (Full_set (Count N1))) (exist (fun n0 : nat => n0 < N1) (proj1_sig (proj1_sig u1)) (H7 (proj1_sig u1))) (H13 (proj1_sig u1) (proj2_sig u1))))). move=> H15. rewrite H15. rewrite H14. reflexivity. reflexivity. move=> t. suff: (proj1_sig (proj1_sig t) < proj1_sig k). move=> H14. exists (exist (Full_set (Count (proj1_sig k))) (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig (proj1_sig t)) H14) (Full_intro (Count (proj1_sig k)) (exist (fun (n : nat) => n < proj1_sig k) (proj1_sig (proj1_sig t)) H14))). apply sig_map. apply sig_map. reflexivity. elim (proj2_sig t). move=> u H14 H15. apply H14. move=> H11. apply False_ind. apply H11. apply (le_n (proj1_sig k)). apply sig_map. apply Extensionality_Ensembles. apply conj. move=> m H10. suff: (m = k). move=> H11. rewrite H11. apply (In_singleton (Count N1)). apply sig_map. elim H10. move=> u H11 H12. elim (le_lt_or_eq (proj1_sig u) (proj1_sig k)). move=> H13. apply False_ind. apply H11. apply (Intersection_intro (Count N1)). apply H13. apply (Full_intro (Count N1)). apply. elim H12. move=> n H13 H14. apply H13. move=> m H10. apply (Intersection_intro (Count N1)). move=> H11. suff: (~ proj1_sig m < proj1_sig k). move=> H12. apply H12. elim H11. move=> n H13 H14. apply H13. elim H10. apply (lt_irrefl (proj1_sig k)). elim H10. apply (Intersection_intro (Count N1)). apply (le_n (proj1_sig k)). apply (Full_intro (Count N1) k). move=> u. elim. move=> u0 H10. apply (Intersection_intro (Count N1)). apply (lt_le_weak (proj1_sig u0) (proj1_sig k) H10). move=> u. elim. move=> w H10 H11. elim (excluded_middle_informative (proj1_sig w <= proj1_sig k)). move=> H12. apply False_ind. apply H10. apply (Intersection_intro (Count N1)). apply H12. apply (Full_intro (Count N1) w). move=> H12. apply (Vmul_O_l K V (F1 w)). move=> v H10. apply (Full_intro (Count N1) v). elim (excluded_middle_informative (proj1_sig k <= proj1_sig k)). move=> H9. elim (excluded_middle_informative (proj1_sig k < proj1_sig k)). move=> H10. apply False_ind. apply (lt_irrefl (proj1_sig k) H10). move=> H10. reflexivity. move=> H9. apply False_ind. apply H9. apply (le_n (proj1_sig k)). exists (fun (m : {n : Count N1 | proj1_sig n < proj1_sig k}) => exist (fun (l : nat) => l < proj1_sig k) (proj1_sig (proj1_sig m)) (proj2_sig m)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> m. apply (lt_trans (proj1_sig m) (proj1_sig k) N1 (proj2_sig m) (proj2_sig k)). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v1 v2 H6 H7. suff: (v2 = VO K V). move=> H8. rewrite H8. rewrite (Vadd_O_r K V v1). apply H6. elim H7. move=> x H8. rewrite H8. suff: ((exist (Finite {n : Count N2 | proj1_sig n < 0}) (fun t : {n : Count N2 | proj1_sig n < 0} => proj1_sig x t <> FO K) (proj2_sig x)) = (FiniteEmpty {n : Count N2 | proj1_sig n < 0})). move=> H9. rewrite H9. apply (MySumF2Empty {n : Count N2 | proj1_sig n < 0} (VSPCM K V) (fun t : {n : Count N2 | proj1_sig n < 0} => Vmul K V (proj1_sig x t) (F2 (proj1_sig t)))). apply sig_map. apply Extensionality_Ensembles. apply conj. move=> u. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig (proj1_sig u)) (proj2_sig u)). move=> u. elim. move=> v H6. rewrite - (Vadd_O_r K V v). apply (SumEnsembleVS_intro K V). apply H6. suff: (SubspaceVS K V (W2 0)). move=> H7. apply (proj2 (proj2 H7)). apply (SpanSubspaceVS K V). apply (proj1 (proj2_sig (H3 k))). apply (le_n_S (proj1_sig (H3 k)) N2). apply (proj2 (proj2_sig (H3 k)) N2). unfold In. rewrite - (Vadd_O_l K V (F1 k)). apply (SumEnsembleVS_intro K V). suff: (SubspaceVS K V (W1 (proj1_sig k))). move=> H5. apply (proj2 (proj2 H5)). apply (SpanSubspaceVS K V). unfold W2. rewrite (BijectiveSaveSpanVS K V (Count N2) {n : Count N2 | proj1_sig n < N2} (fun (m : Count N2) => exist (fun (m : Count N2) => proj1_sig m < N2) m (proj2_sig m))). simpl. rewrite - (proj2 (proj1 (BasisLIGeVS K V (Count N2) F2) H2)). apply (Full_intro (VT K V) (F1 k)). exists (fun (m : {n : Count N2 | proj1_sig n < N2}) => proj1_sig m). apply conj. move=> x. reflexivity. move=> y. apply sig_map. reflexivity. move=> k. apply min_nat_get. apply (Inhabited_intro nat (fun n : nat => In (VT K V) (SumEnsembleVS K V (W1 n) (W2 (proj1_sig k))) (F2 k)) N1). unfold In. rewrite - (Vadd_O_r K V (F2 k)). apply (SumEnsembleVS_intro K V). unfold W1. rewrite (BijectiveSaveSpanVS K V (Count N1) {n : Count N1 | proj1_sig n < N1} (fun (m : Count N1) => exist (fun (m : Count N1) => proj1_sig m < N1) m (proj2_sig m))). simpl. rewrite - (proj2 (proj1 (BasisLIGeVS K V (Count N1) F1) H1)). apply (Full_intro (VT K V) (F2 k)). exists (fun (m : {n : Count N1 | proj1_sig n < N1}) => proj1_sig m). apply conj. move=> x. reflexivity. move=> y. apply sig_map. reflexivity. suff: (SubspaceVS K V (W2 (proj1_sig k))). move=> H4. apply (proj2 (proj2 H4)). apply (SpanSubspaceVS K V). move=> k. apply min_nat_get. apply (Inhabited_intro nat (fun n : nat => In (VT K V) (SumEnsembleVS K V (W1 (proj1_sig k)) (W2 n)) (F1 k)) N2). unfold In. rewrite - (Vadd_O_l K V (F1 k)). apply (SumEnsembleVS_intro K V). suff: (SubspaceVS K V (W1 (proj1_sig k))). move=> H5. apply (proj2 (proj2 H5)). apply (SpanSubspaceVS K V). unfold W2. rewrite (BijectiveSaveSpanVS K V (Count N2) {n : Count N2 | proj1_sig n < N2} (fun (m : Count N2) => exist (fun (m : Count N2) => proj1_sig m < N2) m (proj2_sig m))). simpl. rewrite - (proj2 (proj1 (BasisLIGeVS K V (Count N2) F2) H2)). apply (Full_intro (VT K V) (F1 k)). exists (fun (m : {n : Count N2 | proj1_sig n < N2}) => proj1_sig m). apply conj. move=> x. reflexivity. move=> y. apply sig_map. reflexivity. Qed. Definition FiniteDimensionVS (K : Field) (V : VectorSpace K) := exists (N : nat) (F : Count N -> VT K V), BasisVS K V (Count N) F. Lemma DimensionVSsub : forall (K : Field) (V : VectorSpace K), FiniteDimensionVS K V -> {N : nat | exists (F : Count N -> VT K V), BasisVS K V (Count N) F}. Proof. move=> K V H1. apply (constructive_definite_description (fun (N : nat) => exists (F : Count N -> VT K V), BasisVS K V (Count N) F)). apply (proj1 (unique_existence (fun (N : nat) => exists (F : Count N -> VT K V), BasisVS K V (Count N) F))). apply conj. apply H1. move=> N1 N2 H2 H3. elim H2. move=> F1 H4. elim H3. move=> F2 H5. apply (Theorem_5_4 K V N1 N2 F1 F2 H4 H5). Qed. Definition DimensionVS (K : Field) (V : VectorSpace K) (H : FiniteDimensionVS K V) := proj1_sig (DimensionVSsub K V H). Lemma DimensionVSNature : forall (K : Field) (V : VectorSpace K) (H : FiniteDimensionVS K V), exists (F : Count (DimensionVS K V H) -> VT K V), BasisVS K V (Count (DimensionVS K V H)) F. Proof. move=> K V H1. apply (proj2_sig (DimensionVSsub K V H1)). Qed. Lemma DimensionVSNature2 : forall (K : Field) (V : VectorSpace K) (H : FiniteDimensionVS K V) (N : nat) (F : Count N -> VT K V), BasisVS K V (Count N) F -> (DimensionVS K V H) = N. Proof. move=> K V H1 N F H2. elim (DimensionVSNature K V H1). move=> G H3. apply (Theorem_5_4 K V (DimensionVS K V H1) N G F H3 H2). Qed. Definition DimensionSubspaceVS (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H : SubspaceVS K V W) := DimensionVS K (SubspaceMakeVS K V W H). Lemma DimensionSubspaceVSNature : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H1 : SubspaceVS K V W) (H2 : FiniteDimensionVS K (SubspaceMakeVS K V W H1)), exists (F : Count (DimensionSubspaceVS K V W H1 H2) -> VT K V), BasisSubspaceVS K V W H1 (Count (DimensionSubspaceVS K V W H1 H2)) F. Proof. move=> K V W H1 H2. elim (DimensionVSNature K (SubspaceMakeVS K V W H1) H2). move=> F H3. exists (compose (fun (v : {w : VT K V | In (VT K V) W w}) => proj1_sig v) F). exists (fun (m : Count (DimensionVS K (SubspaceMakeVS K V W H1) H2)) => proj2_sig (F m)). suff: ((fun t : Count (DimensionSubspaceVS K V W H1 H2) => exist W (compose (fun v : {w : VT K V | In (VT K V) W w} => proj1_sig v) F t) (proj2_sig (F t))) = F). move=> H4. rewrite H4. apply H3. apply functional_extensionality. move=> m. apply sig_map. reflexivity. Qed. Lemma DimensionSubspaceVSNature2 : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H1 : SubspaceVS K V W) (H2 : FiniteDimensionVS K (SubspaceMakeVS K V W H1)) (N : nat) (F : Count N -> VT K V), BasisSubspaceVS K V W H1 (Count N) F -> (DimensionSubspaceVS K V W H1 H2) = N. Proof. move=> K V W H1 H2 N F. elim. move=> H3 H4. elim (DimensionVSNature K (SubspaceMakeVS K V W H1) H2). move=> G H5. apply (Theorem_5_4 K (SubspaceMakeVS K V W H1) (DimensionSubspaceVS K V W H1 H2) N G (fun t : Count N => exist W (F t) (H3 t)) H5 H4). Qed. Lemma FnVSFiniteDimension : forall (K : Field) (N : nat), FiniteDimensionVS K (FnVS K N). Proof. move=> K N. exists N. exists (StandardBasisVS K N). apply (StandardBasisNatureVS K N). Qed. Lemma FnVSDimension : forall (K : Field) (N : nat), exists (H : FiniteDimensionVS K (FnVS K N)), (DimensionVS K (FnVS K N) H) = N. Proof. move=> K N. exists (FnVSFiniteDimension K N). apply (DimensionVSNature2 K (FnVS K N) (FnVSFiniteDimension K N) N (StandardBasisVS K N) (StandardBasisNatureVS K N)). Qed. Lemma OVSDimension : forall (K : Field), exists (H : FiniteDimensionVS K (OVS K)), (DimensionVS K (OVS K) H) = O. Proof. move=> K. suff: (BasisVS K (OVS K) (Count O) (fun (m : Count O) => OVSO K)). move=> H1. suff: (FiniteDimensionVS K (OVS K)). move=> H2. exists H2. apply (DimensionVSNature2 K (OVS K) H2 O (fun (m : Count O) => OVSO K) H1). exists O. exists (fun (m : Count O) => OVSO K). apply H1. apply (proj2 (FiniteBasisVS K (OVS K) O (fun (m : Count O) => OVSO K))). move=> v. exists (fun (m : Count O) => FO K). apply conj. suff: (forall (w : VT K (OVS K)), proj1_sig w = O). move=> H1. apply sig_map. rewrite H1. rewrite H1. reflexivity. move=> w. elim (le_lt_or_eq (proj1_sig w) O). move=> H1. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig w) H1). apply. apply (le_S_n (proj1_sig w) O (proj2_sig w)). move=> x H1. apply functional_extensionality. move=> m. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig m) (proj2_sig m)). Qed. Lemma VOSubspaceVSDimension : forall (K : Field) (V : VectorSpace K), exists (H : FiniteDimensionVS K (SubspaceMakeVS K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V))), (DimensionSubspaceVS K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V) H) = O. Proof. move=> K V. suff: (BasisVS K (SubspaceMakeVS K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V)) (Count O) (fun (m : Count O) => SubspaceMakeVSVO K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V))). move=> H1. suff: (FiniteDimensionVS K (SubspaceMakeVS K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V))). move=> H2. exists H2. apply (DimensionVSNature2 K (SubspaceMakeVS K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V)) H2 O (fun (m : Count O) => (SubspaceMakeVSVO K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V))) H1). exists O. exists (fun (m : Count O) => SubspaceMakeVSVO K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V)). apply H1. apply (proj2 (FiniteBasisVS K (SubspaceMakeVS K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V)) O (fun (m : Count O) => SubspaceMakeVSVO K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V)))). move=> v. exists (fun (m : Count O) => FO K). apply conj. apply sig_map. rewrite MySumF2O. elim (proj2_sig v). reflexivity. move=> m. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig m) (proj2_sig m)). move=> v0 H1. apply functional_extensionality. move=> m. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig m) (proj2_sig m)). Qed. Lemma Theorem_5_6_sub : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F -> BasisVS K V ({m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun (k : {n : Count N | proj1_sig n < proj1_sig m}) => F (proj1_sig k))) (F m)}) (fun (k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)}) => F (proj1_sig k)). Proof. move=> K V N F H1. suff: (forall (l : nat), l <= N -> SpanVS K V {m : Count N | proj1_sig m < l /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < l /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) = SpanVS K V {m : Count N | proj1_sig m < l} (fun k : {m : Count N | proj1_sig m < l} => F (proj1_sig k))). move=> H2. suff: (forall (l : nat), l <= N -> LinearlyIndependentVS K V {m : Count N | proj1_sig m < l /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < l /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). move=> H3. elim (BijectiveSameSig (Count N) (fun (m : Count N) => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) (fun (m : Count N) => proj1_sig m < N /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m))). move=> g H4. suff: ((fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) = (fun t : {t : Count N | In (Count N) (fun m : Count N => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) t} => F (proj1_sig (g t)))). move=> H5. rewrite H5. apply (BijectiveSaveBasisVS K V {t : Count N | In (Count N) (fun m : Count N => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) t} {t : Count N | In (Count N) (fun m : Count N => proj1_sig m < N /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) t} g (fun k : {m : Count N | proj1_sig m < N /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) (proj2 H4)). apply BasisLIGeVS. apply conj. apply (H3 N (le_n N)). unfold GeneratingSystemVS. rewrite H1. rewrite (H2 N (le_n N)). apply (BijectiveSaveSpanVS K V {m : Count N | proj1_sig m < N} (Count N) (fun (k : {m : Count N | proj1_sig m < N}) => proj1_sig k) F). exists (fun (m : Count N) => exist (fun (m : Count N) => proj1_sig m < N) m (proj2_sig m)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. reflexivity. apply functional_extensionality. move=> k. rewrite (proj1 H4 k). reflexivity. apply Extensionality_Ensembles. apply conj. move=> m H4. apply conj. apply (proj2_sig m). apply H4. move=> m H4. apply (proj2 H4). elim. move=> H3. apply (LinearlyIndependentVSDef3 K V). move=> a A H4 k. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig (proj1_sig k)) (proj1 (proj2_sig k))). move=> n H3 H4. elim (classic (In (VT K V) (SpanVS K V {k : Count N | proj1_sig k < n} (fun k : {k : Count N | proj1_sig k < n} => F (proj1_sig k))) (F (exist (fun (k : nat) => k < N) n H4)))). move=> H5. elim (BijectiveSameSig (Count N) (fun (m : Count N) => proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (fun (m : Count N) => proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m))). move=> g H6. suff: ((fun k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) = (fun t : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig (g t)))). move=> H7. rewrite H7. apply (BijectiveSaveLinearlyIndependentVS K V {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} g (fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). apply (proj2 H6). apply (H3 (le_trans n (S n) N (le_S n n (le_n n)) H4)). apply functional_extensionality. move=> k. rewrite (proj1 H6 k). reflexivity. apply Extensionality_Ensembles. apply conj. move=> m H6. apply conj. elim (le_lt_or_eq (proj1_sig m) n (le_S_n (proj1_sig m) n (proj1 H6))). apply. move=> H7. apply False_ind. apply (proj2 H6). rewrite H7. suff: (m = (exist (fun k : nat => k < N) n H4)). move=> H8. rewrite H8. apply H5. apply sig_map. apply H7. apply (proj2 H6). move=> m H6. apply conj. apply (le_S (S (proj1_sig m)) n (proj1 H6)). apply (proj2 H6). move=> H5. suff: (exists (M : nat) (f : {n : nat | n < M} -> {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)}), Bijective {n : nat | n < M} {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} f). elim. move=> M. elim. move=> f H6. suff: (proj1_sig (exist (fun k : nat => k < N) n H4) < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig (exist (fun k : nat => k < N) n H4)} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig (exist (fun k : nat => k < N) n H4)} => F (proj1_sig k))) (F (exist (fun k : nat => k < N) n H4))). move=> H7. elim H6. move=> g H9. suff: ((fun k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) = (fun t : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => match excluded_middle_informative (proj1_sig match excluded_middle_informative (proj1_sig (proj1_sig t) < n) with | left H => exist (fun l : nat => l < S M) (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig t) (conj H (proj2 (proj2_sig t)))))) (PeanoNat.Nat.le_trans (S (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig t) (conj H (proj2 (proj2_sig t))))))) M (S M) (proj2_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig t) (conj H (proj2 (proj2_sig t)))))) (le_S M M (le_n M))) | right _ => exist (fun l : nat => l < S M) M (le_n (S M)) end < M) with | left H => F (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig match excluded_middle_informative (proj1_sig (proj1_sig t) < n) with | left H0 => exist (fun l : nat => l < S M) (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig t) (conj H0 (proj2 (proj2_sig t)))))) (PeanoNat.Nat.le_trans (S (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig t) (conj H0 (proj2 (proj2_sig t))))))) M (S M) (proj2_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig t) (conj H0 (proj2 (proj2_sig t)))))) (le_S M M (le_n M))) | right _ => exist (fun l : nat => l < S M) M (le_n (S M)) end) H))) | right _ => F (exist (fun k : nat => k < N) n H4) end)). move=> H10. rewrite H10. apply (BijectiveSaveLinearlyIndependentVS K V {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (Count (S M)) (fun (k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)}) => match excluded_middle_informative (proj1_sig (proj1_sig k) < n) with | left H => exist (fun (l : nat) => l < S M) (proj1_sig (g (exist (fun (l : Count N) => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig k) (conj H (proj2 (proj2_sig k)))))) (le_trans (S (proj1_sig (g (exist (fun (l : Count N) => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig k) (conj H (proj2 (proj2_sig k))))))) M (S M) (proj2_sig (g (exist (fun (l : Count N) => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig k) (conj H (proj2 (proj2_sig k)))))) (le_S M M (le_n M))) | right _ => exist (fun (l : nat) => l < S M) M (le_n (S M)) end) (fun m : Count (S M) => match excluded_middle_informative (proj1_sig m < M) with | left H => F (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H))) | right _ => F (exist (fun k : nat => k < N) n H4) end)). apply InjSurjBij. move=> l1 l2. elim (excluded_middle_informative (proj1_sig (proj1_sig l1) < n)). move=> H11. elim (excluded_middle_informative (proj1_sig (proj1_sig l2) < n)). move=> H12 H13. suff: ((exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l1) (conj H11 (proj2 (proj2_sig l1)))) = (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l2) (conj H12 (proj2 (proj2_sig l2))))). move=> H14. apply sig_map. suff: (proj1_sig l1 = proj1_sig (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l1) (conj H11 (proj2 (proj2_sig l1))))). move=> H15. rewrite H15. rewrite H14. reflexivity. reflexivity. apply (BijInj {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} {n : nat | n < M} g). exists f. apply conj. apply (proj2 H9). apply (proj1 H9). suff: (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l1) (conj H11 (proj2 (proj2_sig l1))))) = proj1_sig (exist (fun l : nat => l < S M) (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l1) (conj H11 (proj2 (proj2_sig l1)))))) (PeanoNat.Nat.le_trans (S (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l1) (conj H11 (proj2 (proj2_sig l1))))))) M (S M) (proj2_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l1) (conj H11 (proj2 (proj2_sig l1)))))) (le_S M M (le_n M))))). move=> H14. apply sig_map. rewrite H14. rewrite H13. reflexivity. reflexivity. move=> H12 H13. apply False_ind. suff: (~ proj1_sig (exist (fun l : nat => l < S M) M (le_n (S M))) < M). move=> H14. apply H14. rewrite - H13. simpl. apply (proj2_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l1) (conj H11 (proj2 (proj2_sig l1)))))). apply (lt_irrefl M). move=> H11. elim (excluded_middle_informative (proj1_sig (proj1_sig l2) < n)). move=> H12 H13. apply False_ind. suff: (~ proj1_sig (exist (fun l : nat => l < S M) M (le_n (S M))) < M). move=> H14. apply H14. rewrite H13. simpl. apply (proj2_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig l2) (conj H12 (proj2 (proj2_sig l2)))))). apply (lt_irrefl M). move=> H12 H13. apply sig_map. apply sig_map. suff: (proj1_sig (proj1_sig l1) = n). move=> H14. suff: (proj1_sig (proj1_sig l2) = n). move=> H15. rewrite H15. apply H14. elim (le_lt_or_eq (proj1_sig (proj1_sig l2)) n (le_S_n (proj1_sig (proj1_sig l2)) n (proj1 (proj2_sig l2)))). move=> H15. apply False_ind. apply (H12 H15). apply. elim (le_lt_or_eq (proj1_sig (proj1_sig l1)) n (le_S_n (proj1_sig (proj1_sig l1)) n (proj1 (proj2_sig l1)))). move=> H14. apply False_ind. apply (H11 H14). apply. move=> m. elim (classic (proj1_sig m < M)). move=> H11. suff: (proj1_sig (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11))) < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11)))} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11)))} => F (proj1_sig k))) (F (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11))))). move=> H12. exists (exist (fun (m : Count N) => proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (proj1_sig (f (exist (fun (k : nat) => k < M) (proj1_sig m) H11))) H12). simpl. elim (excluded_middle_informative (proj1_sig (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11))) < n)). move=> H13. simpl. suff: ((exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k))) (F l)) (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11))) (conj H13 (proj2 H12))) = (f (exist (fun k : nat => k < M) (proj1_sig m) H11))). move=> H14. rewrite H14. rewrite (proj1 H9). apply sig_map. reflexivity. apply sig_map. reflexivity. move=> H13. apply False_ind. apply H13. apply (proj1 (proj2_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11)))). apply conj. apply le_S. apply (proj1 (proj2_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11)))). apply (proj2 (proj2_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H11)))). move=> H11. exists (exist (fun (m : Count N) => proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {l : Count N | proj1_sig l < proj1_sig m} (fun k : {l : Count N | proj1_sig l < proj1_sig m} => F (proj1_sig k))) (F m)) (exist (fun k : nat => k < N) n H4) (conj (le_n (S n)) H5)). simpl. elim (excluded_middle_informative (n < n)). move=> H12. apply False_ind. apply (lt_irrefl n H12). move=> H12. apply sig_map. elim (le_lt_or_eq (proj1_sig m) M (le_S_n (proj1_sig m) M (proj2_sig m))). move=> H13. apply False_ind. apply (H11 H13). move=> H13. rewrite H13. reflexivity. elim (Proposition_5_2_exists K V M). move=> H11. elim. move=> H12 H13. apply H13. apply conj. suff: ((fun m : Count M => match excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < S M) (proj1_sig m) (H11 m)) < M) with | left H => F (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig (exist (fun n0 : nat => n0 < S M) (proj1_sig m) (H11 m))) H))) | right _ => F (exist (fun k : nat => k < N) n H4) end) = (fun t : Count M => F (proj1_sig (f t)))). move=> H14. rewrite H14. apply (BijectiveSaveLinearlyIndependentVS K V (Count M) {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} f (fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). apply H6. apply H3. apply (le_trans n (S n) N (le_S n n (le_n n)) H4). apply functional_extensionality. move=> m. elim (excluded_middle_informative (proj1_sig (exist (fun n0 : nat => n0 < S M) (proj1_sig m) (H11 m)) < M)). move=> H14. suff: ((exist (fun k : nat => k < M) (proj1_sig (exist (fun n0 : nat => n0 < S M) (proj1_sig m) (H11 m))) H14) = m). move=> H15. rewrite H15. reflexivity. apply sig_map. reflexivity. move=> H14. apply False_ind. apply (H14 (proj2_sig m)). simpl. elim (excluded_middle_informative (M < M)). move=> H14. apply False_ind. apply (lt_irrefl M H14). move=> H14. suff: ((fun m : Count M => match excluded_middle_informative (proj1_sig m < M) with | left H => F (proj1_sig (f (exist (fun k : nat => k < M) (proj1_sig m) H))) | right _ => F (exist (fun k : nat => k < N) n H4) end) = (fun t : Count M => F (proj1_sig (f t)))). move=> H15. rewrite H15. rewrite - (BijectiveSaveSpanVS K V (Count M) {l : Count N | proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {m : Count N | proj1_sig m < proj1_sig l} (fun k : {m : Count N | proj1_sig m < proj1_sig l} => F (proj1_sig k))) (F l)} f (fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {l : Count N | proj1_sig l < proj1_sig m} (fun k : {l : Count N | proj1_sig l < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). rewrite (H2 n). apply H5. apply (le_trans n (S n) N (le_S n n (le_n n)) H4). apply H6. apply functional_extensionality. move=> m. elim (excluded_middle_informative (proj1_sig m < M)). move=> H15. suff: ((exist (fun k : nat => k < M) (proj1_sig m) H15) = m). move=> H16. rewrite H16. reflexivity. apply sig_map. reflexivity. move=> H15. apply False_ind. apply (H15 (proj2_sig m)). apply functional_extensionality. move=> k. elim (excluded_middle_informative (proj1_sig (proj1_sig k) < n)). move=> H10. simpl. elim (excluded_middle_informative (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k0 : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k0))) (F l)) (proj1_sig k) (conj H10 (proj2 (proj2_sig k))))) < M)). move=> H11. suff: ((exist (fun k0 : nat => k0 < M) (proj1_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k0 : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k0))) (F l)) (proj1_sig k) (conj H10 (proj2 (proj2_sig k)))))) H11) = (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k0 : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k0))) (F l)) (proj1_sig k) (conj H10 (proj2 (proj2_sig k)))))). move=> H12. rewrite H12. rewrite (proj2 H9). reflexivity. apply sig_map. reflexivity. move=> H11. apply False_ind. apply H11. apply (proj2_sig (g (exist (fun l : Count N => proj1_sig l < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig l} (fun k0 : {n0 : Count N | proj1_sig n0 < proj1_sig l} => F (proj1_sig k0))) (F l)) (proj1_sig k) (conj H10 (proj2 (proj2_sig k)))))). move=> H10. elim (excluded_middle_informative (proj1_sig (exist (fun l : nat => l < S M) M (le_n (S M))) < M)). move=> H11. apply False_ind. apply (lt_irrefl M H11). move=> H11. elim (le_lt_or_eq (proj1_sig (proj1_sig k)) n). move=> H12. apply False_ind. apply (H10 H12). move=> H12. suff: ((proj1_sig k) = (exist (fun k0 : nat => k0 < N) n H4)). move=> H13. rewrite H13. reflexivity. apply sig_map. apply H12. apply (le_S_n (proj1_sig (proj1_sig k)) n (proj1 (proj2_sig k))). apply conj. apply (le_n (S n)). apply H5. apply CountFiniteBijective. apply (FiniteSigSame (Count N)). apply (Finite_downward_closed (Count N) (Full_set (Count N)) (CountFinite N)). move=> m H6. apply (Full_intro (Count N) m). elim. move=> H2. elim (BijectiveSameSig (Count N) (fun (m : Count N) => proj1_sig m < O) (fun (m : Count N) => proj1_sig m < 0 /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m))). move=> G H3. suff: ((fun k : {m : Count N | proj1_sig m < 0} => F (proj1_sig k)) = (compose (fun k : {m : Count N | proj1_sig m < 0 /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) G)). move=> H4. rewrite H4. apply (BijectiveSaveSpanVS K V {m : Count N | proj1_sig m < 0} {m : Count N | proj1_sig m < 0 /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} G). apply (proj2 H3). apply functional_extensionality. move=> k. unfold compose. rewrite (proj1 H3). reflexivity. apply Extensionality_Ensembles. apply conj. move=> m H3. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig m) H3). move=> m H3. apply (proj1 H3). move=> n H2 H3. elim (classic (In (VT K V) (SpanVS K V {m : Count N | proj1_sig m < n} (fun k : {m : Count N | proj1_sig m < n} => F (proj1_sig k))) (F (exist (fun (k : nat) => k < N) n H3)))). move=> H4. suff: (SpanVS K V {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) = SpanVS K V {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). move=> H5. rewrite H5. rewrite H2. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> x H6. rewrite H6. suff: (SubspaceVS K V (SpanVS K V {m : Count N | proj1_sig m < S n} (fun k : {m : Count N | proj1_sig m < S n} => F (proj1_sig k)))). move=> H7. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H7)). move=> cm u H8 H9. apply (proj1 H7 cm (Vmul K V (proj1_sig x u) (F (proj1_sig u))) H9). apply (proj1 (proj2 H7) (proj1_sig x u)). suff: (proj1_sig u = proj1_sig (exist (fun (m : Count N) => proj1_sig m < S n) (proj1_sig u) (le_S (S (proj1_sig (proj1_sig u))) n (proj2_sig u)))). move=> H10. rewrite H10. apply (SpanContainSelfVS K V {m : Count N | proj1_sig m < S n} (fun k : {m : Count N | proj1_sig m < S n} => F (proj1_sig k)) (exist (fun m : Count N => proj1_sig m < S n) (proj1_sig u) (le_S (S (proj1_sig (proj1_sig u))) n (proj2_sig u)))). reflexivity. apply (SpanSubspaceVS K V). move=> v. elim. move=> x H6. rewrite H6. suff: (SubspaceVS K V (SpanVS K V {m : Count N | proj1_sig m < n} (fun k : {m : Count N | proj1_sig m < n} => F (proj1_sig k)))). move=> H7. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H7)). move=> cm u H8 H9. apply (proj1 H7 cm (Vmul K V (proj1_sig x u) (F (proj1_sig u))) H9). apply (proj1 (proj2 H7) (proj1_sig x u)). elim (le_lt_or_eq (proj1_sig (proj1_sig u)) n). move=> H10. suff: (proj1_sig u = proj1_sig (exist (fun (m : Count N) => proj1_sig m < n) (proj1_sig u) H10)). move=> H11. rewrite H11. apply (SpanContainSelfVS K V {m : Count N | proj1_sig m < n} (fun k : {m : Count N | proj1_sig m < n} => F (proj1_sig k)) (exist (fun m : Count N => proj1_sig m < n) (proj1_sig u) H10)). reflexivity. move=> H10. suff: (proj1_sig u = (exist (fun k : nat => k < N) n H3)). move=> H11. rewrite H11. apply H4. apply sig_map. apply H10. apply (le_S_n (proj1_sig (proj1_sig u)) n (proj2_sig u)). apply (SpanSubspaceVS K V). apply (le_trans n (S n) N (le_S n n (le_n n)) H3). elim (BijectiveSameSig (Count N) (fun (m : Count N) => proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (fun (m : Count N) => proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m))). move=> G H5. suff: ((fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) = (fun t : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig (G t)))). move=> H6. rewrite H6. apply (BijectiveSaveSpanVS K V {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} G (fun k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). apply (proj2 H5). apply functional_extensionality. move=> k. rewrite (proj1 H5 k). reflexivity. apply Extensionality_Ensembles. apply conj. move=> m H5. apply conj. apply (le_S (S (proj1_sig m)) n (proj1 H5)). apply (proj2 H5). move=> m H5. apply conj. elim (le_lt_or_eq (proj1_sig m) n). apply. move=> H6. apply False_ind. apply (proj2 H5). rewrite H6. suff: (m = (exist (fun k : nat => k < N) n H3)). move=> H7. rewrite H7. apply H4. apply sig_map. apply H6. apply (le_S_n (proj1_sig m) n (proj1 H5)). apply (proj2 H5). move=> H4. suff: (SpanVS K V {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) = SumEnsembleVS K V (SpanVS K V {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))) (fun (v : VT K V) => exists (f : FT K), v = Vmul K V f (F (exist (fun (l : nat) => l < N) n H3)))). move=> H5. rewrite H5. rewrite H2. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v1 v2 H6 H7. suff: (SubspaceVS K V (SpanVS K V {m : Count N | proj1_sig m < S n} (fun k : {m : Count N | proj1_sig m < S n} => F (proj1_sig k)))). move=> H8. apply (proj1 H8 v1 v2). elim H6. move=> x H9. rewrite H9. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H8)). move=> cm u H10 H11. apply (proj1 H8 cm). apply H11. apply (proj1 (proj2 H8)). suff: (proj1_sig u = proj1_sig (exist (fun (m : Count N) => proj1_sig m < S n) (proj1_sig u) (le_S (S (proj1_sig (proj1_sig u))) n (proj2_sig u)))). move=> H12. rewrite H12. apply (SpanContainSelfVS K V {m : Count N | proj1_sig m < S n} (fun k : {m : Count N | proj1_sig m < S n} => F (proj1_sig k)) (exist (fun (m : Count N) => proj1_sig m < S n) (proj1_sig u) (le_S (S (proj1_sig (proj1_sig u))) n (proj2_sig u)))). reflexivity. elim H7. move=> f H9. rewrite H9. apply (proj1 (proj2 H8)). suff: ((exist (fun l : nat => l < N) n H3) = proj1_sig (exist (fun (m : Count N) => proj1_sig m < S n) (exist (fun l : nat => l < N) n H3) (le_n (S n)))). move=> H10. rewrite H10. apply (SpanContainSelfVS K V {m : Count N | proj1_sig m < S n} (fun k : {m : Count N | proj1_sig m < S n} => F (proj1_sig k)) (exist (fun (m : Count N) => proj1_sig m < S n) (exist (fun l : nat => l < N) n H3) (le_n (S n)))). reflexivity. apply (SpanSubspaceVS K V). move=> v. elim. move=> x H6. rewrite H6. suff: (SubspaceVS K V (SumEnsembleVS K V (SpanVS K V {m : Count N | proj1_sig m < n} (fun k : {m : Count N | proj1_sig m < n} => F (proj1_sig k))) (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f (F (exist (fun l : nat => l < N) n H3))))). move=> H7. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H7)). move=> cm u H8 H9. apply (proj1 H7). apply H9. apply (proj1 (proj2 H7)). elim (le_lt_or_eq (proj1_sig (proj1_sig u)) n). move=> H10. rewrite - (Vadd_O_r K V (F (proj1_sig u))). apply SumEnsembleVS_intro. suff: ((proj1_sig u) = proj1_sig (exist (fun (m : Count N) => proj1_sig m < n) (proj1_sig u) H10)). move=> H11. rewrite H11. apply (SpanContainSelfVS K V {m : Count N | proj1_sig m < n} (fun k : {m : Count N | proj1_sig m < n} => F (proj1_sig k)) (exist (fun (m : Count N) => proj1_sig m < n) (proj1_sig u) H10)). reflexivity. exists (FO K). rewrite (Vmul_O_l K V). reflexivity. move=> H10. rewrite - (Vadd_O_l K V (F (proj1_sig u))). apply SumEnsembleVS_intro. suff: (SubspaceVS K V (SpanVS K V {m : Count N | proj1_sig m < n} (fun k : {m : Count N | proj1_sig m < n} => F (proj1_sig k)))). move=> H11. apply (proj2 (proj2 H11)). apply (SpanSubspaceVS K V). exists (FI K). rewrite (Vmul_I_l K V (F (exist (fun l : nat => l < N) n H3))). suff: (proj1_sig u = (exist (fun l : nat => l < N) n H3)). move=> H11. rewrite H11. reflexivity. apply sig_map. apply H10. apply (le_S_n (proj1_sig (proj1_sig u)) n (proj2_sig u)). apply (SumSubspaceVS K V). apply (SpanSubspaceVS K V). apply (SingleSubspaceVS K V). apply (le_trans n (S n) N (le_S n n (le_n n)) H3). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> x H5. rewrite H5. suff: (SubspaceVS K V (SumEnsembleVS K V (SpanVS K V {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))) (fun v0 : VT K V => exists f : FT K, v0 = Vmul K V f (F (exist (fun l : nat => l < N) n H3))))). move=> H6. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H6)). move=> cm u H7 H8. apply (proj1 H6 cm). apply H8. apply (proj1 (proj2 H6) (proj1_sig x u) (F (proj1_sig u))). elim (le_lt_or_eq (proj1_sig (proj1_sig u)) n). move=> H9. rewrite - (Vadd_O_r K V (F (proj1_sig u))). apply SumEnsembleVS_intro. suff: ((proj1_sig u) = proj1_sig (exist (fun (m : Count N) => proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (proj1_sig u) (conj H9 (proj2 (proj2_sig u))))). move=> H10. rewrite H10. apply (SpanContainSelfVS K V {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) (exist (fun (m : Count N) => proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (proj1_sig u) (conj H9 (proj2 (proj2_sig u))))). reflexivity. exists (FO K). rewrite (Vmul_O_l K V). reflexivity. move=> H9. rewrite - (Vadd_O_l K V (F (proj1_sig u))). apply SumEnsembleVS_intro. apply (proj2 (proj2 (SpanSubspaceVS K V {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))))). exists (FI K). rewrite (Vmul_I_l K V). suff: (proj1_sig u = exist (fun l : nat => l < N) n H3). move=> H10. rewrite H10. reflexivity. apply sig_map. apply H9. apply (le_S_n (proj1_sig (proj1_sig u)) n (proj1 (proj2_sig u))). apply (SumSubspaceVS K V). apply (SpanSubspaceVS K V). apply (SingleSubspaceVS K V). move=> v. elim. move=> v1 v2 H5 H6. suff: (SubspaceVS K V (SpanVS K V {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)))). move=> H7. apply (proj1 H7 v1 v2). elim H5. move=> x H8. rewrite H8. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H7)). move=> cm u H9 H10. apply (proj1 H7 cm). apply H10. apply (proj1 (proj2 H7) (proj1_sig x u) (F (proj1_sig u))). suff: (proj1_sig u = proj1_sig (exist (fun (m : Count N) => proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (proj1_sig u) (conj (le_S (S (proj1_sig (proj1_sig u))) n (proj1 (proj2_sig u))) (proj2 (proj2_sig u))))). move=> H11. rewrite H11. apply (SpanContainSelfVS K V {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) (exist (fun m : Count N => proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (proj1_sig u) (conj (le_S (S (proj1_sig (proj1_sig u))) n (proj1 (proj2_sig u))) (proj2 (proj2_sig u))))). reflexivity. elim H6. move=> f H8. rewrite H8. apply (proj1 (proj2 H7) f). suff: ((exist (fun l : nat => l < N) n H3) = proj1_sig (exist (fun (m : Count N) => proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (exist (fun l : nat => l < N) n H3) (conj (le_n (S n)) H4))). move=> H9. rewrite H9. apply (SpanContainSelfVS K V {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) (exist (fun (m : Count N) => proj1_sig m < S n /\ ~ In (VT K V) (SpanVS K V {n0 : Count N | proj1_sig n0 < proj1_sig m} (fun k : {n0 : Count N | proj1_sig n0 < proj1_sig m} => F (proj1_sig k))) (F m)) (exist (fun l : nat => l < N) n H3) (conj (le_n (S n)) H4))). reflexivity. apply (SpanSubspaceVS K V). Qed. Lemma Theorem_5_6 : forall (K : Field) (V : VectorSpace K) (M N : nat), M <= N -> forall (H : forall (m : Count M), proj1_sig m < N) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count M) (fun (m : Count M) => F (exist (fun (n : nat) => n < N) (proj1_sig m) (H m))) -> GeneratingSystemVS K V (Count N) F -> BasisVS K V {m : Count N | proj1_sig m < M \/ (M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m))} (fun (k : {m : Count N | proj1_sig m < M \/ (M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m))}) => F (proj1_sig k)). Proof. move=> K V M N H1 H2 F H3 H4. elim (BijectiveSameSig (Count N) (fun (m : Count N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) (fun (m : Count N) => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m))). move=> G H5. suff: ((fun k : {m : Count N | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) = compose (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) G). move=> H6. rewrite H6. apply (BijectiveSaveBasisVS K V {m : Count N | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} {t : Count N | In (Count N) (fun m : Count N => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) t} G (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). apply (proj2 H5). apply (Theorem_5_6_sub K V N F H4). apply functional_extensionality. move=> m. unfold compose. rewrite (proj1 H5 m). reflexivity. apply Extensionality_Ensembles. apply conj. move=> m. elim. move=> H5. suff: (forall (k : (Count (proj1_sig m))), proj1_sig k < N). move=> H6. unfold In. rewrite (BijectiveSaveSpanVS K V (Count (proj1_sig m)) {n : Count N | proj1_sig n < proj1_sig m} (fun (k : (Count (proj1_sig m))) => exist (fun (l : Count N) => proj1_sig l < proj1_sig m) (exist (fun (l : nat) => l < N) (proj1_sig k) (H6 k)) (proj2_sig k))). elim (Proposition_5_2_exists K V (proj1_sig m)). move=> H7. elim. move=> H8 H9. simpl. suff: (forall (k : (Count (S (proj1_sig m)))), proj1_sig k < N). move=> H10. suff: ((fun t : Count (proj1_sig m) => F (exist (fun l : nat => l < N) (proj1_sig t) (H6 t))) = (fun m0 : Count (proj1_sig m) => F (exist (fun l : nat => l < N) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H7 m0))) (H10 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m0) (H7 m0)))))). move=> H11. unfold compose. rewrite H11. suff: (m = (exist (fun l : nat => l < N) (proj1_sig (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H8)) (H10 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig m) H8)))). move=> H12. rewrite {8} H12. apply (H9 (fun (k : (Count (S (proj1_sig m)))) => F (exist (fun (l : nat) => l < N) (proj1_sig k) (H10 k)))). suff: (forall (k : (Count (S (proj1_sig m)))), proj1_sig k < M). move=> H13. suff: ((fun k : Count (S (proj1_sig m)) => F (exist (fun l : nat => l < N) (proj1_sig k) (H10 k))) = (fun t : Count (S (proj1_sig m)) => F (exist (fun n : nat => n < N) (proj1_sig (exist (fun l : nat => l < M) (proj1_sig t) (H13 t))) (H2 (exist (fun l : nat => l < M) (proj1_sig t) (H13 t)))))). move=> H14. rewrite H14. apply (InjectiveSaveLinearlyIndependentVS K V (Count (S (proj1_sig m))) (Count M) (fun k : Count (S (proj1_sig m)) => (exist (fun l : nat => l < M) (proj1_sig k) (H13 k))) (fun m : Count M => F (exist (fun n : nat => n < N) (proj1_sig m) (H2 m)))). move=> n1 n2 H15. apply sig_map. suff: (proj1_sig n1 = proj1_sig (exist (fun l : nat => l < M) (proj1_sig n1) (H13 n1))). move=> H16. rewrite H16. rewrite H15. reflexivity. reflexivity. apply H3. apply functional_extensionality. move=> k. suff: ((exist (fun l : nat => l < N) (proj1_sig k) (H10 k)) = (exist (fun n : nat => n < N) (proj1_sig (exist (fun l : nat => l < M) (proj1_sig k) (H13 k))) (H2 (exist (fun l : nat => l < M) (proj1_sig k) (H13 k))))). move=> H14. rewrite H14. reflexivity. apply sig_map. reflexivity. move=> k. apply (le_trans (S (proj1_sig k)) (S (proj1_sig m)) M (proj2_sig k) H5). apply sig_map. reflexivity. apply functional_extensionality. move=> k. simpl. suff: (H6 k = H10 (exist (fun n : nat => n < S (proj1_sig m)) (proj1_sig k) (H7 k))). move=> H11. rewrite H11. reflexivity. apply proof_irrelevance. move=> k. apply (le_trans (S (proj1_sig k)) (S (proj1_sig m)) N (proj2_sig k) (proj2_sig m)). exists (fun (l : {n : Count N | proj1_sig n < proj1_sig m}) => exist (fun (k : nat) => k < proj1_sig m) (proj1_sig (proj1_sig l)) (proj2_sig l)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. move=> k. apply (lt_trans (proj1_sig k) (proj1_sig m) N (proj2_sig k) (proj2_sig m)). move=> H5. apply (proj2 H5). move=> m H5. elim (le_or_lt M (proj1_sig m)). move=> H6. right. apply conj. apply H6. apply H5. move=> H6. left. apply H6. Qed. Lemma Theorem_5_6_exists : forall (K : Field) (V : VectorSpace K) (M N : nat), M <= N -> exists (H : forall (m : Count M), proj1_sig m < N), forall (F : Count N -> VT K V), LinearlyIndependentVS K V (Count M) (fun (m : Count M) => F (exist (fun (n : nat) => n < N) (proj1_sig m) (H m))) -> GeneratingSystemVS K V (Count N) F -> BasisVS K V {m : Count N | proj1_sig m < M \/ (M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m))} (fun (k : {m : Count N | proj1_sig m < M \/ (M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m))}) => F (proj1_sig k)). Proof. move=> K V M N H1. suff: (forall m : Count M, proj1_sig m < N). move=> H2. exists H2. apply (Theorem_5_6 K V M N H1 H2). move=> m. apply (le_trans (S (proj1_sig m)) M N (proj2_sig m) H1). Qed. Lemma Corollary_5_7_1 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F -> FiniteDimensionVS K V. Proof. move=> K V N F H1. suff: (BasisVS K V {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). move=> H2. elim (proj2 (CountFiniteBijective {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)})). move=> M. elim. move=> G H3. exists M. exists (compose (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) G). apply (BijectiveSaveBasisVS K V (Count M) {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} G (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). apply H3. apply H2. apply (FiniteSigSame (Count N)). apply (Finite_downward_closed (Count N) (Full_set (Count N)) (CountFinite N)). move=> m H3. apply (Full_intro (Count N) m). apply (Theorem_5_6_sub K V N F H1). Qed. Lemma Corollary_5_7_2 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F -> forall (H : FiniteDimensionVS K V), DimensionVS K V H <= N. Proof. move=> K V N F H1 H2. suff: (BasisVS K V {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). move=> H3. elim (proj2 (CountFiniteBijective {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)})). move=> M. elim. move=> G H4. rewrite (DimensionVSNature2 K V H2 M (compose (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) G)). elim (CountCardinalInjective {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} N (fun (k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)}) => proj1_sig k)). move=> M2 H5. rewrite - (cardinal_is_functional {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} (Full_set {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)}) M2 (proj2 H5) (Full_set {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)}) M). apply (proj1 H5). apply CountCardinalBijective. exists G. apply H4. reflexivity. move=> k1 k2. apply sig_map. apply (BijectiveSaveBasisVS K V (Count M) {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} G (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). apply H4. apply H3. apply (FiniteSigSame (Count N)). apply (Finite_downward_closed (Count N) (Full_set (Count N)) (CountFinite N)). move=> m H4. apply (Full_intro (Count N) m). apply (Theorem_5_6_sub K V N F H1). Qed. Lemma Corollary_5_7_2_exists : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F -> exists (H : FiniteDimensionVS K V), DimensionVS K V H <= N. Proof. move=> K V N F H1. exists (Corollary_5_7_1 K V N F H1). apply (Corollary_5_7_2 K V N F H1 (Corollary_5_7_1 K V N F H1)). Qed. Lemma Corollary_5_7_3 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V) (H : FiniteDimensionVS K V), LinearlyIndependentVS K V (Count N) F -> DimensionVS K V H >= N. Proof. move=> K V N F H1 H2. elim H1. move=> M. elim. move=> G H3. suff: (forall (m : Count (N + M)), ~ (proj1_sig m < N) -> (proj1_sig m - N) < M). move=> H4. suff: (GeneratingSystemVS K V (Count (N + M)) (fun (m : Count (N + M)) => match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun (k : nat) => k < N) (proj1_sig m) H) | right H => G (exist (fun (k : nat) => k < M) (proj1_sig m - N) (H4 m H)) end)). move=> H5. elim (Theorem_5_6_exists K V N (N + M)). move=> H6 H7. suff: (let T := {m : Count (N + M) | proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => match excluded_middle_informative (proj1_sig (proj1_sig k) < N) with | left H => F (exist (fun k0 : nat => k0 < N) (proj1_sig (proj1_sig k)) H) | right H => G (exist (fun k0 : nat => k0 < M) (proj1_sig (proj1_sig k) - N) (H4 (proj1_sig k) H)) end)) match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end} in let F2 := (fun k : {m : Count (N + M) | proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => match excluded_middle_informative (proj1_sig (proj1_sig k) < N) with | left H => F (exist (fun k0 : nat => k0 < N) (proj1_sig (proj1_sig k)) H) | right H => G (exist (fun k0 : nat => k0 < M) (proj1_sig (proj1_sig k) - N) (H4 (proj1_sig k) H)) end)) match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end} => match excluded_middle_informative (proj1_sig (proj1_sig k) < N) with | left H => F (exist (fun k0 : nat => k0 < N) (proj1_sig (proj1_sig k)) H) | right H => G (exist (fun k0 : nat => k0 < M) (proj1_sig (proj1_sig k) - N) (H4 (proj1_sig k) H)) end) in DimensionVS K V H1 >= N). apply. move=> T F2. suff: (BasisVS K V T F2). move=> H8. elim (proj2 (CountFiniteBijective T)). move=> L. elim. move=> g H9. elim H9. move=> ginv H10. rewrite (DimensionVSNature2 K V H1 L (compose F2 g)). suff: (forall (m : (Count N)), proj1_sig m < N + M). move=> H11. suff: ({F3 : Count N -> T | Injective (Count N) T F3}). move=> H12. elim (CountCardinalInjective (Count N) L (compose ginv (proj1_sig H12))). move=> N2 H13. rewrite - (cardinal_is_functional (Count N) (Full_set (Count N)) N2 (proj2 H13) (Full_set (Count N)) N). apply (proj1 H13). apply (proj1 (CountCardinalBijective (Count N) N)). exists (fun (m : Count N) => m). exists (fun (m : Count N) => m). apply conj. move=> x. reflexivity. move=> y. reflexivity. reflexivity. apply (InjChain (Count N) T (Count L) (proj1_sig H12) ginv). apply (proj2_sig H12). apply (BijInj T (Count L) ginv). exists g. apply conj. apply (proj2 H10). apply (proj1 H10). suff: (forall (m : (Count N)), proj1_sig m < N + M). move=> H12. suff: (forall (k : (Count N)), In (Count (N + M)) (fun (m : Count (N + M)) => proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => match excluded_middle_informative (proj1_sig (proj1_sig k) < N) with | left H => F (exist (fun k0 : nat => k0 < N) (proj1_sig (proj1_sig k)) H) | right H => G (exist (fun k0 : nat => k0 < M) (proj1_sig (proj1_sig k) - N) (H4 (proj1_sig k) H)) end)) match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end) (exist (fun (m : nat) => m < N + M) (proj1_sig k) (H12 k))). move=> H13. exists (fun (k : Count N) => exist (fun (m : Count (N + M)) => proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => match excluded_middle_informative (proj1_sig (proj1_sig k) < N) with | left H => F (exist (fun k0 : nat => k0 < N) (proj1_sig (proj1_sig k)) H) | right H => G (exist (fun k0 : nat => k0 < M) (proj1_sig (proj1_sig k) - N) (H4 (proj1_sig k) H)) end)) match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end) (exist (fun (m : nat) => m < N + M) (proj1_sig k) (H12 k)) (H13 k)). move=> k1 k2 H14. apply sig_map. suff: (proj1_sig k1 = proj1_sig (proj1_sig (exist (fun m : Count (N + M) => proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => match excluded_middle_informative (proj1_sig (proj1_sig k) < N) with | left H => F (exist (fun k0 : nat => k0 < N) (proj1_sig (proj1_sig k)) H) | right H => G (exist (fun k0 : nat => k0 < M) (proj1_sig (proj1_sig k) - N) (H4 (proj1_sig k) H)) end)) match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end) (exist (fun m : nat => m < N + M) (proj1_sig k1) (H12 k1)) (H13 k1)))). move=> H15. rewrite H15. rewrite H14. reflexivity. reflexivity. move=> k. left. apply (proj2_sig k). apply H11. move=> m. apply (le_trans (S (proj1_sig m)) N (N + M) (proj2_sig m) (Plus.le_plus_l N M)). apply (BijectiveSaveBasisVS K V (Count L) T g F2). apply H9. apply H8. apply (FiniteSigSame (Count (N + M))). apply (Finite_downward_closed (Count (N + M)) (Full_set (Count (N + M))) (CountFinite (N + M))). move=> m H9. apply (Full_intro (Count (N + M)) m). apply (H7 (fun (m : Count (N + M)) => match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun (k : nat) => k < N) (proj1_sig m) H) | right H => G (exist (fun (k : nat) => k < M) (proj1_sig m - N) (H4 m H)) end)). suff: ((fun m : Count N => match excluded_middle_informative (proj1_sig (exist (fun n : nat => n < N + M) (proj1_sig m) (H6 m)) < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig (exist (fun n : nat => n < N + M) (proj1_sig m) (H6 m))) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig (exist (fun n0 : nat => n0 < N + M) (proj1_sig m) (H6 m)) - N) (H4 (exist (fun n0 : nat => n0 < N + M) (proj1_sig m) (H6 m)) H)) end) = F). move=> H8. rewrite H8. apply H2. apply functional_extensionality. move=> k. simpl. elim (excluded_middle_informative (proj1_sig k < N)). move=> H8. suff: ((exist (fun k0 : nat => k0 < N) (proj1_sig k) H8) = k). move=> H9. rewrite H9. reflexivity. apply sig_map. reflexivity. move=> H8. apply False_ind. apply (H8 (proj2_sig k)). apply H5. apply (Plus.le_plus_l N M). apply Extensionality_Ensembles. apply conj. rewrite (proj2 (proj1 (BasisLIGeVS K V (Count M) G) H3)). move=> v. elim. move=> x H5. rewrite H5. apply MySumF2Induction. apply conj. apply (proj2 (proj2 (SpanSubspaceVS K V (Count (N + M)) (fun m : Count (N + M) => match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end)))). move=> cm u H6 H7. apply (proj1 (SpanSubspaceVS K V (Count (N + M)) (fun m : Count (N + M) => match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end)) cm). apply H7. apply (proj1 (proj2 (SpanSubspaceVS K V (Count (N + M)) (fun m : Count (N + M) => match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end))) (proj1_sig x u) (G u)). suff: (N + proj1_sig u < N + M). move=> H8. suff: (G u = (fun m : Count (N + M) => match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end) (exist (fun (k : nat) => k < N + M) (N + proj1_sig u) H8)). move=> H9. rewrite H9. apply (SpanContainSelfVS K V (Count (N + M)) (fun m : Count (N + M) => match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun k : nat => k < N) (proj1_sig m) H) | right H => G (exist (fun k : nat => k < M) (proj1_sig m - N) (H4 m H)) end) (exist (fun (k : nat) => k < N + M) (N + proj1_sig u) H8)). simpl. elim (excluded_middle_informative (N + proj1_sig u < N)). move=> H9. apply False_ind. apply (lt_irrefl N). apply (le_trans (S N) (S (N + proj1_sig u)) N). apply (le_n_S N (N + proj1_sig u)). apply (Plus.le_plus_l N (proj1_sig u)). apply H9. move=> H9. suff: (u = (exist (fun k : nat => k < M) (N + proj1_sig u - N) (H4 (exist (fun k : nat => k < N + M) (N + proj1_sig u) H8) H9))). move=> H10. rewrite {1} H10. reflexivity. apply sig_map. rewrite - {1} (Minus.minus_plus N (proj1_sig u)). reflexivity. apply (Plus.plus_lt_compat_l (proj1_sig u) M N). apply (proj2_sig u). move=> v H5. apply (Full_intro (VT K V) v). move=> m H4. apply (Plus.plus_lt_reg_l (proj1_sig m - N) M N). rewrite (Minus.le_plus_minus_r N (proj1_sig m)). apply (proj2_sig m). elim (le_or_lt N (proj1_sig m)). apply. move=> H5. apply False_ind. apply (H4 H5). Qed. Lemma Corollary_5_7_trans : forall (K : Field) (V : VectorSpace K) (N M : nat) (F1 : Count N -> VT K V) (F2 : Count M -> VT K V), LinearlyIndependentVS K V (Count N) F1 -> GeneratingSystemVS K V (Count M) F2 -> N <= M. Proof. move=> K V N M F1 F2 H1 H2. elim (Corollary_5_7_2_exists K V M F2 H2). move=> H3 H4. apply (le_trans N (DimensionVS K V H3) M (Corollary_5_7_3 K V N F1 H3 H1) H4). Qed. Lemma Corollary_5_7_4 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F -> forall (H : FiniteDimensionVS K V), DimensionVS K V H = N -> BasisVS K V (Count N) F. Proof. move=> K V N F H1 H2 H3. elim (BijectiveSigFull (Count N) (fun (m : Count N) => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m))). move=> G H4. suff: (F = compose (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) G). move=> H5. rewrite H5. apply (BijectiveSaveBasisVS K V (Count N) {t : Count N | In (Count N) (fun m : Count N => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) t} G (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k))). apply (proj2 H4). apply (Theorem_5_6_sub K V N F H1). apply functional_extensionality. move=> k. unfold compose. rewrite {1} (proj1 H4 k). reflexivity. move=> k. apply NNPP. move=> H4. apply (lt_irrefl N). suff: (cardinal (Count N) (Add (Count N) (fun m : Count N => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) k) (S N)). move=> H5. elim (CountCardinalInjective {l : Count N | In (Count N) (Add (Count N) (fun (m : Count N) => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) k) l} N (fun (x : {l : Count N | In (Count N) (Add (Count N) (fun (m : Count N) => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) k) l}) => proj1_sig x)). move=> M H6. unfold lt. rewrite (cardinal_is_functional (Count N) (Add (Count N) (fun m : Count N => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) k) (S N) H5 (Add (Count N) (fun m : Count N => ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)) k) M). apply (proj1 H6). apply (CardinalSigSame (Count N)). apply (proj2 H6). reflexivity. move=> m1 m2. apply sig_map. apply (card_add (Count N)). apply (CardinalSigSame (Count N)). elim (proj2 (CountFiniteBijective {t : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig t} (fun k0 : {n : Count N | proj1_sig n < proj1_sig t} => F (proj1_sig k0))) (F t)})). move=> N2. elim. move=> f H5. suff: (N = N2). move=> H6. rewrite {29} H6. apply CountCardinalBijective. exists f. apply H5. rewrite - H3. apply (DimensionVSNature2 K V H2 N2 (compose (fun k : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k))) (F m)} => F (proj1_sig k)) f)). apply (BijectiveSaveBasisVS K V (Count N2) {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k0 : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k0))) (F m)} f (fun k0 : {m : Count N | ~ In (VT K V) (SpanVS K V {n : Count N | proj1_sig n < proj1_sig m} (fun k0 : {n : Count N | proj1_sig n < proj1_sig m} => F (proj1_sig k0))) (F m)} => F (proj1_sig k0)) H5 (Theorem_5_6_sub K V N F H1)). apply (FiniteSigSame (Count N)). apply (Finite_downward_closed (Count N) (Full_set (Count N))). apply (CountFinite N). move=> m H5. apply (Full_intro (Count N) m). apply H4. Qed. Lemma Corollary_5_7_4_exists : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F -> exists (H : FiniteDimensionVS K V), DimensionVS K V H = N -> BasisVS K V (Count N) F. Proof. move=> K V N F H1. exists (Corollary_5_7_1 K V N F H1). apply (Corollary_5_7_4 K V N F H1 (Corollary_5_7_1 K V N F H1)). Qed. Lemma Corollary_5_7_5 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count N) F -> forall (H : FiniteDimensionVS K V), DimensionVS K V H = N -> BasisVS K V (Count N) F. Proof. move=> K V N F H1 H2 H3. apply (proj2 (BasisLIGeVS K V (Count N) F)). apply conj. apply H1. elim H2. move=> M. elim. move=> G H4. suff: (forall (m : Count (N + M)), ~ proj1_sig m < N -> proj1_sig m - N < M). move=> H5. suff: (let F2 := (fun (m : Count (N + M)) => match excluded_middle_informative (proj1_sig m < N) with | left H => F (exist (fun (k : nat) => k < N) (proj1_sig m) H) | right H => G (exist (fun (k : nat) => k < M) (proj1_sig m - N) (H5 m H)) end) in GeneratingSystemVS K V (Count N) F). apply. move=> F2. suff: (forall (m : Count M), In (VT K V) (SpanVS K V (Count N) F) (G m)). move=> H7. apply Extensionality_Ensembles. apply conj. rewrite (proj2 (proj1 (BasisLIGeVS K V (Count M) G) H4)). move=> v. elim. move=> x H8. rewrite H8. apply MySumF2Induction. apply conj. apply (proj2 (proj2 (SpanSubspaceVS K V (Count N) F))). move=> cm u H9 H10. apply (proj1 (SpanSubspaceVS K V (Count N) F) cm). apply H10. apply (proj1 (proj2 (SpanSubspaceVS K V (Count N) F)) (proj1_sig x u) (G u) (H7 u)). move=> v H8. apply (Full_intro (VT K V) v). suff: (forall (m : Count (N + M)), N <= proj1_sig m -> In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)). move=> H7. suff: (forall (n : nat), n <= M -> forall (m : Count M), proj1_sig m < n -> In (VT K V) (SpanVS K V (Count N) F) (G m)). move=> H8 m. apply (H8 M (le_n M) m (proj2_sig m)). elim. move=> H8 m H9. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig m) H9). move=> n H8 H9 m H10. elim (le_lt_or_eq (proj1_sig m) n). apply (H8 (le_trans n (S n) M (le_S n n (le_n n)) H9) m). move=> H11. suff: (In (VT K V) (SpanVS K V {l : Count (N + M) | proj1_sig l < N + n} (fun k : {l : Count (N + M) | proj1_sig l < N + n} => F2 (proj1_sig k))) (G m)). elim. move=> x H12. rewrite H12. apply MySumF2Induction. apply conj. apply (proj2 (proj2 (SpanSubspaceVS K V (Count N) F))). move=> cm u H13 H14. apply (proj1 (SpanSubspaceVS K V (Count N) F) cm). apply H14. apply (proj1 (proj2 (SpanSubspaceVS K V (Count N) F)) (proj1_sig x u) (F2 (proj1_sig u))). unfold F2. elim (excluded_middle_informative (proj1_sig (proj1_sig u) < N)). move=> H15. apply (SpanContainSelfVS K V (Count N) F (exist (fun k : nat => k < N) (proj1_sig (proj1_sig u)) H15)). move=> H15. apply (H8 (le_trans n (S n) M (le_S n n (le_n n)) H9) (exist (fun k : nat => k < M) (proj1_sig (proj1_sig u) - N) (H5 (proj1_sig u) H15))). simpl. apply (Plus.plus_lt_reg_l (proj1_sig (proj1_sig u) - N) n N). rewrite (Minus.le_plus_minus_r N (proj1_sig (proj1_sig u))). apply (proj2_sig u). elim (le_or_lt N (proj1_sig (proj1_sig u))). apply. move=> H16. apply False_ind. apply (H15 H16). suff: (N + n < N + M). move=> H12. suff: (G m = F2 (exist (fun (k : nat) => k < N + M) (N + n) H12)). move=> H13. rewrite H13. apply (H7 (exist (fun (k : nat) => k < N + M) (N + n) H12)). apply (Plus.le_plus_l N n). unfold F2. simpl. elim (excluded_middle_informative (N + n < N)). move=> H13. apply False_ind. apply (lt_irrefl N). apply (le_trans (S N) (S (N + n)) N). apply (le_n_S N (N + n) (Plus.le_plus_l N n)). apply H13. move=> H13. suff: (m = (exist (fun k : nat => k < M) (N + n - N) (H5 (exist (fun k : nat => k < N + M) (N + n) H12) H13))). move=> H14. rewrite H14. reflexivity. apply sig_map. simpl. rewrite (Minus.minus_plus N n). apply H11. rewrite - H11. apply (Plus.plus_lt_compat_l (proj1_sig m) M N (proj2_sig m)). apply (le_S_n (proj1_sig m) n H10). move=> m H7. apply NNPP. move=> H8. apply (lt_irrefl N). unfold lt. rewrite - {2} H3. suff: (forall (l : nat) (H : l < N), In (Count (N + M)) (fun (m : Count (N + M)) => proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (exist (fun (n : nat) => n < N + M) l (le_trans (S l) N (N + M) H (Plus.le_plus_l N M)))). move=> H9. suff: (In (Count (N + M)) (fun (m : Count (N + M)) => proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) m). move=> H10. apply (Corollary_5_7_3 K V (S N) (compose (fun k : {m : Count (N + M) | proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} => F2 (proj1_sig k)) (fun (l : Count (S N)) => match excluded_middle_informative (proj1_sig l < N) with | left H => exist (fun m : Count (N + M) => proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (exist (fun n : nat => n < N + M) (proj1_sig l) (PeanoNat.Nat.le_trans (S (proj1_sig l)) N (N + M) H (Plus.le_plus_l N M))) (H9 (proj1_sig l) H) | right _ => exist (fun m : Count (N + M) => proj1_sig m < N \/ N <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) m H10 end))). apply (InjectiveSaveLinearlyIndependentVS K V (Count (S N)) {m0 : Count (N + M) | proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)} (fun l : Count (S N) => match excluded_middle_informative (proj1_sig l < N) with | left H => exist (fun m0 : Count (N + M) => proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (exist (fun n : nat => n < N + M) (proj1_sig l) (PeanoNat.Nat.le_trans (S (proj1_sig l)) N (N + M) H (Plus.le_plus_l N M))) (H9 (proj1_sig l) H) | right _ => exist (fun m0 : Count (N + M) => proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n0 : Count (N + M) | proj1_sig n0 < proj1_sig m0} (fun k : {n0 : Count (N + M) | proj1_sig n0 < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) m H10 end) (fun k : {m0 : Count (N + M) | proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)} => F2 (proj1_sig k))). move=> n1 n2. elim (excluded_middle_informative (proj1_sig n1 < N)). move=> H11. elim (excluded_middle_informative (proj1_sig n2 < N)). move=> H12 H13. apply sig_map. suff: (proj1_sig n1 = proj1_sig (proj1_sig (exist (fun m0 : Count (N + M) => proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (exist (fun n : nat => n < N + M) (proj1_sig n1) (PeanoNat.Nat.le_trans (S (proj1_sig n1)) N (N + M) H11 (Plus.le_plus_l N M))) (H9 (proj1_sig n1) H11)))). move=> H14. rewrite H14. rewrite H13. reflexivity. reflexivity. move=> H12 H13. apply False_ind. apply (le_not_lt N (proj1_sig (proj1_sig (exist (fun m0 : Count (N + M) => proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (exist (fun n : nat => n < N + M) (proj1_sig n1) (PeanoNat.Nat.le_trans (S (proj1_sig n1)) N (N + M) H11 (Plus.le_plus_l N M))) (H9 (proj1_sig n1) H11))))). rewrite H13. apply H7. apply H11. move=> H11. elim (excluded_middle_informative (proj1_sig n2 < N)). move=> H12 H13. apply False_ind. apply (le_not_lt N (proj1_sig (proj1_sig (exist (fun m0 : Count (N + M) => proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n0 : Count (N + M) | proj1_sig n0 < proj1_sig m0} (fun k : {n0 : Count (N + M) | proj1_sig n0 < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) m H10)))). apply H7. rewrite H13. apply H12. move=> H12 H13. apply sig_map. elim (le_lt_or_eq (proj1_sig n1) N). move=> H14. apply False_ind. apply (H11 H14). move=> H14. rewrite H14. elim (le_lt_or_eq (proj1_sig n2) N). move=> H15. apply False_ind. apply (H12 H15). move=> H15. rewrite H15. reflexivity. apply (le_S_n (proj1_sig n2) N (proj2_sig n2)). apply (le_S_n (proj1_sig n1) N (proj2_sig n1)). apply (proj1 (BasisLIGeVS K V {m0 : Count (N + M) | proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)} (fun k : {m0 : Count (N + M) | proj1_sig m0 < N \/ N <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (N + M) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (N + M) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)} => F2 (proj1_sig k)))). suff: (forall m : Count N, proj1_sig m < N + M). move=> H11. apply (Theorem_5_6 K V N (N + M) (Plus.le_plus_l N M) H11 F2). suff: ((fun m0 : Count N => F2 (exist (fun n : nat => n < N + M) (proj1_sig m0) (H11 m0))) = F). move=> H12. rewrite H12. apply H1. apply functional_extensionality. move=> k. unfold F2. simpl. elim (excluded_middle_informative (proj1_sig k < N)). move=> H12. suff: ((exist (fun k0 : nat => k0 < N) (proj1_sig k) H12) = k). move=> H13. rewrite H13. reflexivity. apply sig_map. reflexivity. move=> H12. apply False_ind. apply (H12 (proj2_sig k)). apply Extensionality_Ensembles. apply conj. rewrite (proj2 (proj1 (BasisLIGeVS K V (Count M) G) H4)). move=> k. elim. move=> x H12. rewrite H12. apply MySumF2Induction. apply conj. apply (proj2 (proj2 (SpanSubspaceVS K V (Count (N + M)) F2))). move=> cm u H13 H14. apply (proj1 (SpanSubspaceVS K V (Count (N + M)) F2)). apply H14. apply (proj1 (proj2 (SpanSubspaceVS K V (Count (N + M)) F2)) (proj1_sig x u) (G u)). suff: (N + proj1_sig u < N + M). move=> H15. suff: (G u = F2 (exist (fun (k : nat) => k < N + M) (N + proj1_sig u) H15)). move=> H16. rewrite H16. apply (SpanContainSelfVS K V (Count (N + M)) F2 (exist (fun k0 : nat => k0 < N + M) (N + proj1_sig u) H15)). unfold F2. simpl. elim (excluded_middle_informative (N + proj1_sig u < N)). move=> H16. apply False_ind. apply (lt_irrefl N). apply (le_trans (S N) (S (N + proj1_sig u)) N). apply (le_n_S N (N + proj1_sig u)). apply (Plus.le_plus_l N (proj1_sig u)). apply H16. move=> H16. suff: (u = (exist (fun k0 : nat => k0 < M) (N + proj1_sig u - N) (H5 (exist (fun k0 : nat => k0 < N + M) (N + proj1_sig u) H15) H16))). move=> H17. rewrite {1} H17. reflexivity. apply sig_map. simpl. rewrite (Minus.minus_plus N (proj1_sig u)). reflexivity. apply (Plus.plus_lt_compat_l (proj1_sig u) M N). apply (proj2_sig u). move=> v H12. apply (Full_intro (VT K V) v). move=> k. apply (le_trans (S (proj1_sig k)) N (N + M) (proj2_sig k) (Plus.le_plus_l N M)). right. apply conj. apply H7. apply H8. move=> l H9. left. apply H9. move=> m H5. apply (Plus.plus_lt_reg_l (proj1_sig m - N) M N). rewrite (Minus.le_plus_minus_r N (proj1_sig m)). apply (proj2_sig m). elim (le_or_lt N (proj1_sig m)). apply. move=> H6. apply False_ind. apply (H5 H6). Qed. Lemma Corollary_5_8_1_1 : forall (K : Field) (V : VectorSpace K), FiniteDimensionVS K V -> exists (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F. Proof. move=> K V. elim. move=> N. elim. move=> F H1. exists N. exists F. apply (proj2 (proj1 (BasisLIGeVS K V (Count N) F) H1)). Qed. Lemma Corollary_5_8_1_2 : forall (K : Field) (V : VectorSpace K), (exists (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F) -> exists (M : nat), forall (N : nat) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count N) F -> N <= M. Proof. move=> K V. elim. move=> N. elim. move=> F H1. exists N. move=> L G H2. apply (Corollary_5_7_trans K V L N G F H2 H1). Qed. Lemma Corollary_5_8_1_3 : forall (K : Field) (V : VectorSpace K), (exists (M : nat), forall (N : nat) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count N) F -> N <= M) -> FiniteDimensionVS K V. Proof. move=> K V H1. elim (min_nat_exist (fun (M : nat) => forall (N : nat) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count N) F -> N <= M)). suff: (forall (L : nat), is_min_nat (fun M : nat => forall (N : nat) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count N) F -> N <= M) L -> exists (F : Count L -> VT K V), LinearlyIndependentVS K V (Count L) F). move=> H2 L H3. exists L. elim (H2 L H3). move=> F H4. exists F. apply (proj2 (BasisLIGeVS K V (Count L) F)). apply conj. apply H4. apply Extensionality_Ensembles. apply conj. move=> v H5. apply NNPP. move=> H6. apply (lt_irrefl L). suff: (LinearlyIndependentVS K V (Count (S L)) (fun (m : Count (S L)) => match excluded_middle_informative (proj1_sig m < L) with | left H => F (exist (fun (k : nat) => k < L) (proj1_sig m) H) | right _ => v end)). move=> H7. apply (proj1 H3 (S L) (fun (m : Count (S L)) => match excluded_middle_informative (proj1_sig m < L) with | left H => F (exist (fun (k : nat) => k < L) (proj1_sig m) H) | right _ => v end) H7). elim (Proposition_5_2_exists K V L). move=> H7. elim. move=> H8 H9. apply (proj2 (H9 (fun (m : Count (S L)) => match excluded_middle_informative (proj1_sig m < L) with | left H => F (exist (fun (k : nat) => k < L) (proj1_sig m) H) | right _ => v end))). apply conj. simpl. suff: ((fun m : Count L => match excluded_middle_informative (proj1_sig m < L) with | left H => F (exist (fun k : nat => k < L) (proj1_sig m) H) | right _ => v end) = F). move=> H10. rewrite H10. apply H4. apply functional_extensionality. move=> m. elim (excluded_middle_informative (proj1_sig m < L)). move=> H10. suff: ((exist (fun k : nat => k < L) (proj1_sig m) H10) = m). move=> H11. rewrite H11. reflexivity. apply sig_map. reflexivity. move=> H10. apply False_ind. apply (H10 (proj2_sig m)). simpl. elim (excluded_middle_informative (L < L)). move=> H10. apply False_ind. apply (lt_irrefl L H10). move=> H10. suff: ((fun m : Count L => match excluded_middle_informative (proj1_sig m < L) with | left H => F (exist (fun k : nat => k < L) (proj1_sig m) H) | right _ => v end) = F). move=> H11. rewrite H11. apply H6. apply functional_extensionality. move=> m. elim (excluded_middle_informative (proj1_sig m < L)). move=> H11. suff: ((exist (fun k : nat => k < L) (proj1_sig m) H11) = m). move=> H12. rewrite H12. reflexivity. apply sig_map. reflexivity. move=> H11. apply False_ind. apply (H11 (proj2_sig m)). move=> v H5. apply (Full_intro (VT K V) v). elim. move=> H2. exists (fun (m : Count O) => VO K V). apply (LinearlyIndependentVSDef3 K V (Count O) (fun _ : Count 0 => VO K V)). move=> a A H3 m H4. apply False_ind. apply (PeanoNat.Nat.nlt_0_r (proj1_sig m) (proj2_sig m)). move=> n H2 H3. apply NNPP. move=> H4. apply (lt_irrefl n). apply (proj2 H3 n). move=> k F H5. apply (le_S_n k n). elim (le_lt_or_eq k (S n)). apply. move=> H6. apply False_ind. apply H4. rewrite - H6. exists F. apply H5. apply (proj1 H3 k F H5). elim H1. move=> M H2. apply (Inhabited_intro nat (fun L : nat => forall (N : nat) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count N) F -> N <= L) M H2). Qed. Lemma Corollary_5_8_1_4 : forall (K : Field) (V : VectorSpace K), FiniteDimensionVS K V -> exists M : nat, forall (N : nat) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count N) F -> N <= M. Proof. move=> K V H1. apply (Corollary_5_8_1_2 K V). apply (Corollary_5_8_1_1 K V H1). Qed. Lemma Corollary_5_8_1_5 : forall (K : Field) (V : VectorSpace K), (exists (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F) -> FiniteDimensionVS K V. Proof. move=> K V H1. apply (Corollary_5_8_1_3 K V). apply (Corollary_5_8_1_2 K V H1). Qed. Lemma Corollary_5_8_1_6 : forall (K : Field) (V : VectorSpace K), (exists M : nat, forall (N : nat) (F : Count N -> VT K V), LinearlyIndependentVS K V (Count N) F -> N <= M) -> exists (N : nat) (F : Count N -> VT K V), GeneratingSystemVS K V (Count N) F. Proof. move=> K V H1. apply (Corollary_5_8_1_1 K V). apply (Corollary_5_8_1_3 K V H1). Qed. Lemma Corollary_5_8_2_1 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V) (H : FiniteDimensionVS K V), BasisVS K V (Count N) F -> (GeneratingSystemVS K V (Count N) F /\ DimensionVS K V H = N). Proof. move=> K V N F H1 H2. apply conj. apply (proj2 (proj1 (BasisLIGeVS K V (Count N) F) H2)). apply (DimensionVSNature2 K V H1 N F H2). Qed. Lemma Corollary_5_8_2_3 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V) (H : FiniteDimensionVS K V), (LinearlyIndependentVS K V (Count N) F /\ DimensionVS K V H = N) -> BasisVS K V (Count N) F. Proof. move=> K V N F H1 H2. apply (Corollary_5_7_5 K V N F (proj1 H2) H1 (proj2 H2)). Qed. Lemma Corollary_5_8_2_4 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V) (H : FiniteDimensionVS K V), BasisVS K V (Count N) F -> (LinearlyIndependentVS K V (Count N) F /\ DimensionVS K V H = N). Proof. move=> K V N F H1 H2. apply conj. apply (proj1 (proj1 (BasisLIGeVS K V (Count N) F) H2)). apply (DimensionVSNature2 K V H1 N F H2). Qed. Lemma Corollary_5_8_2_5 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V) (H : FiniteDimensionVS K V), (GeneratingSystemVS K V (Count N) F /\ DimensionVS K V H = N) -> BasisVS K V (Count N) F. Proof. move=> K V N F H1 H2. apply (Corollary_5_7_4 K V N F (proj1 H2) H1 (proj2 H2)). Qed. Lemma Corollary_5_8_2_2 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V) (H : FiniteDimensionVS K V), (GeneratingSystemVS K V (Count N) F /\ DimensionVS K V H = N) -> (LinearlyIndependentVS K V (Count N) F /\ DimensionVS K V H = N). Proof. move=> K V N F H1 H2. apply (Corollary_5_8_2_4 K V N F H1). apply (Corollary_5_8_2_5 K V N F H1 H2). Qed. Lemma Corollary_5_8_2_6 : forall (K : Field) (V : VectorSpace K) (N : nat) (F : Count N -> VT K V) (H : FiniteDimensionVS K V), (LinearlyIndependentVS K V (Count N) F /\ DimensionVS K V H = N) -> (GeneratingSystemVS K V (Count N) F /\ DimensionVS K V H = N). Proof. move=> K V N F H1 H2. apply (Corollary_5_8_2_1 K V N F H1). apply (Corollary_5_8_2_3 K V N F H1 H2). Qed. Lemma IsomorphicSaveFiniteDimensionVS : forall (K : Field) (V1 V2 : VectorSpace K) (G : VT K V1 -> VT K V2), IsomorphicVS K V1 V2 G -> FiniteDimensionVS K V1 -> FiniteDimensionVS K V2. Proof. move=> K V1 V2 G H1. elim. move=> N. elim. move=> F H2. exists N. exists (compose G F). apply (IsomorphicSaveBasisVS K V1 V2 (Count N) F G H1 H2). Qed. Lemma SurjectiveSaveFiniteDimensionVS : forall (K : Field) (V1 V2 : VectorSpace K) (G : VT K V1 -> VT K V2), Surjective (VT K V1) (VT K V2) G /\ (forall x y : VT K V1, G (Vadd K V1 x y) = Vadd K V2 (G x) (G y)) /\ (forall (c : FT K) (x : VT K V1), G (Vmul K V1 c x) = Vmul K V2 c (G x)) -> FiniteDimensionVS K V1 -> FiniteDimensionVS K V2. Proof. move=> K V1 V2 G H1 H2. apply (Corollary_5_8_1_5 K V2). elim (Corollary_5_8_1_1 K V1 H2). move=> N. elim. move=> F H3. exists N. exists (compose G F). apply (SurjectiveSaveGeneratingSystemVS2 K V1 V2 (Count N) F G H1 H3). Qed. Lemma IsomorphicSaveDimensionVS : forall (K : Field) (V1 V2 : VectorSpace K) (G : VT K V1 -> VT K V2) (H1 : FiniteDimensionVS K V1) (H2 : FiniteDimensionVS K V2), IsomorphicVS K V1 V2 G -> DimensionVS K V1 H1 = DimensionVS K V2 H2. Proof. move=> K V1 V2 G H1 H2 H3. elim H1. move=> N. elim. move=> F H4. rewrite (DimensionVSNature2 K V2 H2 N (compose G F)). apply (DimensionVSNature2 K V1 H1 N F H4). apply (IsomorphicSaveBasisVS K V1 V2 (Count N) F G H3 H4). Qed. Lemma IsomorphicSaveDimensionVS_exists : forall (K : Field) (V1 V2 : VectorSpace K) (G : VT K V1 -> VT K V2) (H1 : FiniteDimensionVS K V1), IsomorphicVS K V1 V2 G -> exists (H2 : FiniteDimensionVS K V2), DimensionVS K V1 H1 = DimensionVS K V2 H2. Proof. move=> K V1 V2 G H1 H2. exists (IsomorphicSaveFiniteDimensionVS K V1 V2 G H2 H1). apply (IsomorphicSaveDimensionVS K V1 V2 G H1 (IsomorphicSaveFiniteDimensionVS K V1 V2 G H2 H1) H2). Qed. Lemma Proposition_5_9_1_1 : forall (K : Field) (V : VectorSpace K), FiniteDimensionVS K V -> forall (W : Ensemble (VT K V)) (H : SubspaceVS K V W), FiniteDimensionVS K (SubspaceMakeVS K V W H). Proof. move=> K V H1 W H2. apply (Corollary_5_8_1_3 K (SubspaceMakeVS K V W H2)). elim (Corollary_5_8_1_4 K V H1). move=> M H3. exists M. move=> N F H4. apply (H3 N (compose (fun (v : {w : VT K V | In (VT K V) W w}) => proj1_sig v) F)). apply (InjectiveSaveLinearlyIndependentVS2 K (SubspaceMakeVS K V W H2) V (Count N) F (fun v : {w : VT K V | In (VT K V) W w} => proj1_sig v)). apply conj. move=> v1 v2. apply sig_map. apply conj. move=> v1 v2. reflexivity. move=> c v. reflexivity. apply H4. Qed. Lemma Proposition_5_9_1_2 : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H1 : SubspaceVS K V W) (H2 : FiniteDimensionVS K V) (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W H1)), DimensionVS K V H2 >= DimensionSubspaceVS K V W H1 H3. Proof. move=> K V W H1 H2 H3. elim (DimensionVSNature K (SubspaceMakeVS K V W H1) H3). move=> F H4. apply (Corollary_5_7_3 K V (DimensionSubspaceVS K V W H1 H3) (compose (fun (v : {w : VT K V | In (VT K V) W w}) => proj1_sig v) F)). apply (InjectiveSaveLinearlyIndependentVS2 K (SubspaceMakeVS K V W H1) V (Count (DimensionSubspaceVS K V W H1 H3)) F (fun v : {w : VT K V | In (VT K V) W w} => proj1_sig v)). apply conj. move=> v1 v2. apply sig_map. apply conj. move=> v1 v2. reflexivity. move=> c v. reflexivity. apply (proj1 (proj1 (BasisLIGeVS K (SubspaceMakeVS K V W H1) (Count (DimensionSubspaceVS K V W H1 H3)) F) H4)). Qed. Lemma Proposition_5_9_1_2_exists : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H1 : SubspaceVS K V W) (H2 : FiniteDimensionVS K V), exists (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W H1)), DimensionVS K V H2 >= DimensionSubspaceVS K V W H1 H3. Proof. move=> K V W H1 H2. exists (Proposition_5_9_1_1 K V H2 W H1). apply (Proposition_5_9_1_2 K V W H1 H2 (Proposition_5_9_1_1 K V H2 W H1)). Qed. Lemma Proposition_5_9_1_3 : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H1 : SubspaceVS K V W) (H2 : FiniteDimensionVS K V) (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W H1)), DimensionVS K V H2 = DimensionSubspaceVS K V W H1 H3 <-> W = (Full_set (VT K V)). Proof. move=> K V W H1 H2 H3. apply conj. move=> H4. apply Extensionality_Ensembles. apply conj. move=> w H5. apply (Full_intro (VT K V) w). elim (DimensionSubspaceVSNature K V W H1 H3). move=> F H5. suff: (GeneratingSystemVS K V (Count (DimensionSubspaceVS K V W H1 H3)) F). move=> H6. rewrite H6. move=> v. elim. move=> x H7. rewrite H7. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H1)). move=> cm u H8 H9. apply (proj1 H1). apply H9. apply (proj1 (proj2 H1)). elim H5. move=> H10 H11. apply (H10 u). apply (Corollary_5_8_2_6 K V (DimensionSubspaceVS K V W H1 H3) F H2). apply conj. apply (SubspaceBasisLinearlyIndependentVS K V W H1 (Count (DimensionSubspaceVS K V W H1 H3)) F H5). apply H4. move=> H4. suff: (forall (v : VT K V), In (VT K V) W v). move=> H5. unfold DimensionSubspaceVS. apply (IsomorphicSaveDimensionVS K V (SubspaceMakeVS K V W H1) (fun (v : VT K V) => exist W v (H5 v)) H2 H3). apply conj. exists (fun (v : {w : VT K V | In (VT K V) W w}) => proj1_sig v). apply conj. move=> x. reflexivity. move=> y. apply sig_map. reflexivity. apply conj. move=> v1 v2. apply sig_map. reflexivity. move=> c v. apply sig_map. reflexivity. rewrite H4. move=> v. apply (Full_intro (VT K V) v). Qed. Lemma Proposition_5_9_1_3_exists : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H1 : SubspaceVS K V W) (H2 : FiniteDimensionVS K V), exists (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W H1)), DimensionVS K V H2 = DimensionSubspaceVS K V W H1 H3 <-> W = (Full_set (VT K V)). Proof. move=> K V W H1 H2. exists (Proposition_5_9_1_1 K V H2 W H1). apply (Proposition_5_9_1_3 K V W H1 H2 (Proposition_5_9_1_1 K V H2 W H1)). Qed. Lemma Proposition_5_9_2 : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H1 : SubspaceVS K V W) (H2 : FiniteDimensionVS K V) (M : nat) (F : Count M -> VT K V) (H3 : forall (m : Count (DimensionVS K V H2)), ~ proj1_sig m < M -> proj1_sig m - M < DimensionVS K V H2 - M), BasisSubspaceVS K V W H1 (Count M) F -> exists (G : Count (DimensionVS K V H2 - M) -> VT K V), BasisVS K V (Count (DimensionVS K V H2)) (fun (m : Count (DimensionVS K V H2)) => match excluded_middle_informative (proj1_sig m < M) with | left H => F (exist (fun (n : nat) => n < M) (proj1_sig m) H) | right H => G (exist (fun (n : nat) => n < DimensionVS K V H2 - M) (proj1_sig m - M) (H3 m H)) end). Proof. move=> K V W H1 H2 M F H20 H3. elim H2. move=> N. elim. move=> G H4. suff: (forall m : Count M, proj1_sig m < M + N). move=> H5. suff: (forall m : Count (M + N), ~ proj1_sig m < M -> proj1_sig m - M < N). move=> H6. suff: (let F2 := (fun (m : Count (M + N)) => match excluded_middle_informative (proj1_sig m < M) with | left H => F (exist (fun (n : nat) => n < M) (proj1_sig m) H) | right H => G (exist (fun (n : nat) => n < N) (proj1_sig m - M) (H6 m H)) end) in exists G0 : Count (DimensionVS K V H2 - M) -> VT K V, BasisVS K V (Count (DimensionVS K V H2)) (fun m : Count (DimensionVS K V H2) => match excluded_middle_informative (proj1_sig m < M) with | left H => F (exist (fun n : nat => n < M) (proj1_sig m) H) | right H => G0 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig m - M) (H20 m H)) end)). apply. move=> F2. suff: (BasisVS K V {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} (fun k : {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} => F2 (proj1_sig k))). move=> H18. elim (proj2 (CountCardinalBijective {m : Count (M + N) | M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} (DimensionVS K V H2 - M))). move=> G2 H7. exists (fun (m : Count (DimensionVS K V H2 - M)) => F2 (proj1_sig (G2 m))). suff: (forall (m : Count (DimensionVS K V H2)) (H : proj1_sig m < M), In (Count (M + N)) (fun (m : Count (M + N)) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (exist (fun (n : nat) => n < M + N) (proj1_sig m) (H5 (exist (fun (n : nat) => n < M) (proj1_sig m) H)))). move=> H9. suff: (forall (m : Count (DimensionVS K V H2)) (H : ~ proj1_sig m < M), In (Count (M + N)) (fun (m : Count (M + N)) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig m - M) (H20 m H))))). move=> H10. suff: ((fun m : Count (DimensionVS K V H2) => match excluded_middle_informative (proj1_sig m < M) with | left H => F (exist (fun n : nat => n < M) (proj1_sig m) H) | right H => F2 (proj1_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig m - M) (H20 m H)))) end) = compose (fun k : {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} => F2 (proj1_sig k)) (fun (m : Count (DimensionVS K V H2)) => match excluded_middle_informative (proj1_sig m < M) with | left H => exist (fun (m : Count (M + N)) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (exist (fun n : nat => n < M + N) (proj1_sig m) (H5 (exist (fun n : nat => n < M) (proj1_sig m) H))) (H9 m H) | right H => exist (fun (m : Count (M + N)) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig m - M) (H20 m H)))) (H10 m H) end)). move=> H11. rewrite H11. apply (BijectiveSaveBasisVS K V (Count (DimensionVS K V H2)) {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} (fun m : Count (DimensionVS K V H2) => match excluded_middle_informative (proj1_sig m < M) with | left H => exist (fun m0 : Count (M + N) => proj1_sig m0 < M \/ M <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (exist (fun n : nat => n < M + N) (proj1_sig m) (H5 (exist (fun n : nat => n < M) (proj1_sig m) H))) (H9 m H) | right H => exist (fun m0 : Count (M + N) => proj1_sig m0 < M \/ M <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (proj1_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig m - M) (H20 m H)))) (H10 m H) end) (fun k : {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} => F2 (proj1_sig k))). apply InjSurjBij. move=> k1 k2. elim (excluded_middle_informative (proj1_sig k1 < M)). move=> H12. elim (excluded_middle_informative (proj1_sig k2 < M)). move=> H13 H14. apply sig_map. suff: (proj1_sig k1 = proj1_sig (proj1_sig (exist (fun m0 : Count (M + N) => proj1_sig m0 < M \/ M <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (exist (fun n : nat => n < M + N) (proj1_sig k1) (H5 (exist (fun n : nat => n < M) (proj1_sig k1) H12))) (H9 k1 H12)))). move=> H15. rewrite H15. rewrite H14. reflexivity. reflexivity. move=> H13 H14. apply False_ind. apply (le_not_lt M (proj1_sig (proj1_sig (exist (fun m0 : Count (M + N) => proj1_sig m0 < M \/ M <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (exist (fun n : nat => n < M + N) (proj1_sig k1) (H5 (exist (fun n : nat => n < M) (proj1_sig k1) H12))) (H9 k1 H12))))). rewrite H14. apply (proj1 (proj2_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig k2 - M) (H20 k2 H13))))). apply H12. move=> H12. elim (excluded_middle_informative (proj1_sig k2 < M)). move=> H13 H14. apply False_ind. apply (le_not_lt M (proj1_sig (proj1_sig (exist (fun m0 : Count (M + N) => proj1_sig m0 < M \/ M <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (proj1_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig k1 - M) (H20 k1 H12)))) (H10 k1 H12))))). apply (proj1 (proj2_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig k1 - M) (H20 k1 H12))))). rewrite H14. apply H13. move=> H13 H14. apply sig_map. suff: (proj1_sig k1 - M = proj1_sig k2 - M). move=> H15. rewrite - (Minus.le_plus_minus_r M (proj1_sig k1)). rewrite - (Minus.le_plus_minus_r M (proj1_sig k2)). rewrite H15. reflexivity. elim (le_or_lt M (proj1_sig k2)). apply. move=> H16. apply False_ind. apply (H13 H16). elim (le_or_lt M (proj1_sig k1)). apply. move=> H16. apply False_ind. apply (H12 H16). suff: ((exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig k1 - M) (H20 k1 H12)) = (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig k2 - M) (H20 k2 H13))). move=> H15. suff: (proj1_sig k1 - M = proj1_sig (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig k1 - M) (H20 k1 H12))). move=> H16. rewrite H16. rewrite H15. reflexivity. reflexivity. apply (BijInj {n : nat | n < DimensionVS K V H2 - M} {m : Count (M + N) | M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} G2 H7). apply sig_map. suff: (proj1_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig k1 - M) (H20 k1 H12))) = proj1_sig (exist (fun m0 : Count (M + N) => proj1_sig m0 < M \/ M <= proj1_sig m0 /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m0} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m0} => F2 (proj1_sig k))) (F2 m0)) (proj1_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig k1 - M) (H20 k1 H12)))) (H10 k1 H12))). move=> H15. rewrite H15. rewrite H14. reflexivity. reflexivity. move=> v. elim (classic (proj1_sig (proj1_sig v) < M)). move=> H12. suff: (M <= DimensionVS K V H2). move=> H13. exists (exist (fun (n : nat) => n < DimensionVS K V H2) (proj1_sig (proj1_sig v)) (le_trans (S (proj1_sig (proj1_sig v))) M (DimensionVS K V H2) H12 H13)). simpl. elim (excluded_middle_informative (proj1_sig (proj1_sig v) < M)). move=> H14. apply sig_map. apply sig_map. reflexivity. move=> H15. apply False_ind. apply (H15 H12). suff: (FiniteDimensionVS K (SubspaceMakeVS K V W H1)). move=> H13. rewrite - (DimensionSubspaceVSNature2 K V W H1 H13 M F). apply (Proposition_5_9_1_2 K V W H1 H2 H13). apply H3. apply (Proposition_5_9_1_1 K V H2 W H1). move=> H12. elim H7. move=> G2Inv H13. suff: (M <= proj1_sig (proj1_sig v) /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig (proj1_sig v)} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig (proj1_sig v)} => F2 (proj1_sig k))) (F2 (proj1_sig v))). move=> H14. suff: (proj1_sig (G2Inv (exist (fun (m : Count (M + N)) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H14)) + M < DimensionVS K V H2). move=> H15. exists (exist (fun (n : nat) => n < DimensionVS K V H2) (proj1_sig (G2Inv (exist (fun (m : Count (M + N)) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H14)) + M) H15). simpl. elim (excluded_middle_informative (proj1_sig (G2Inv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H14)) + M < M)). move=> H16. apply False_ind. apply (le_not_lt M (proj1_sig (G2Inv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H14)) + M)). apply Plus.le_plus_r. apply H16. move=> H16. apply sig_map. simpl. suff: ((exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig (G2Inv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H14)) + M - M) (H20 (exist (fun n : nat => n < DimensionVS K V H2) (proj1_sig (G2Inv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H14)) + M) H15) H16)) = (G2Inv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H14))). move=> H17. rewrite H17. rewrite (proj2 H13). reflexivity. apply sig_map. simpl. rewrite Plus.plus_comm. apply Minus.minus_plus. rewrite - {2} (Minus.le_plus_minus_r M (DimensionVS K V H2)). rewrite Plus.plus_comm. apply Plus.plus_lt_compat_l. apply (proj2_sig (G2Inv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H14))). suff: (FiniteDimensionVS K (SubspaceMakeVS K V W H1)). move=> H15. rewrite - (DimensionSubspaceVSNature2 K V W H1 H15 M F). apply (Proposition_5_9_1_2 K V W H1 H2 H15). apply H3. apply (Proposition_5_9_1_1 K V H2 W H1). apply conj. elim (le_or_lt M (proj1_sig (proj1_sig v))). apply. move=> H14. apply False_ind. apply (H12 H14). elim (proj2_sig v). move=> H14. apply False_ind. apply (H12 H14). move=> H14. apply (proj2 H14). apply H18. apply functional_extensionality. move=> m. unfold compose. elim (excluded_middle_informative (proj1_sig m < M)). move=> H11. simpl. unfold F2. simpl. elim (excluded_middle_informative (proj1_sig m < M)). move=> H12. suff: (H11 = H12). move=> H13. rewrite H13. reflexivity. apply proof_irrelevance. move=> H12. apply False_ind. apply (H12 H11). move=> H11. reflexivity. move=> m H10. right. apply (proj2_sig (G2 (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig m - M) (H20 m H10)))). move=> m H9. left. apply H9. elim (proj2 (CountFiniteBijective {m : Count (M + N) | M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)})). move=> L. elim. move=> f H7. suff: (DimensionVS K V H2 - M = L). move=> H8. rewrite H8. apply CountCardinalBijective. exists f. apply H7. apply (Plus.plus_reg_l (DimensionVS K V H2 - M) L M). rewrite (Minus.le_plus_minus_r M (DimensionVS K V H2)). suff: (exists (g : {n : nat | n < M + L} -> {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)}), Bijective {n : nat | n < M + L} {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} g). elim. move=> g H8. apply (DimensionVSNature2 K V H2 (M + L) (compose (fun k : {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} => F2 (proj1_sig k)) g)). apply (BijectiveSaveBasisVS K V (Count (M + L)) {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} g (fun k : {m : Count (M + N) | proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} => F2 (proj1_sig k))). apply H8. apply H18. suff: (forall (m : Count (M + L)) (H : proj1_sig m < M), (fun m : Count (M + N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (exist (fun (n : nat) => n < M + N) (proj1_sig m) (H5 (exist (fun (n : nat) => n < M) (proj1_sig m) H)))). move=> H8. suff: (forall (m : Count (M + L)), ~ proj1_sig m < M -> proj1_sig m - M < L). move=> H9. suff: (forall (m : Count (M + L)) (H : ~ proj1_sig m < M), (fun m : Count (M + N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig (f (exist (fun (n : nat) => n < L) (proj1_sig m - M) (H9 m H))))). move=> H10. exists (fun (m : Count (M + L)) => match excluded_middle_informative (proj1_sig m < M) with | left H => exist (fun m : Count (M + N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (exist (fun (n : nat) => n < M + N) (proj1_sig m) (H5 (exist (fun (n : nat) => n < M) (proj1_sig m) H))) (H8 m H) | right H => exist (fun m : Count (M + N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig (f (exist (fun (n : nat) => n < L) (proj1_sig m - M) (H9 m H)))) (H10 m H) end). apply InjSurjBij. move=> k1 k2. elim (excluded_middle_informative (proj1_sig k1 < M)). move=> H11. elim (excluded_middle_informative (proj1_sig k2 < M)). move=> H12 H13. suff: (proj1_sig k1 = proj1_sig (proj1_sig (exist (fun m : Count (M + N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (exist (fun n : nat => n < M + N) (proj1_sig k1) (H5 (exist (fun n : nat => n < M) (proj1_sig k1) H11))) (H8 k1 H11)))). move=> H14. apply sig_map. rewrite H14. rewrite H13. reflexivity. reflexivity. move=> H12 H13. apply False_ind. apply (le_not_lt M (proj1_sig (proj1_sig (exist (fun m : Count (M + N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (exist (fun n : nat => n < M + N) (proj1_sig k1) (H5 (exist (fun n : nat => n < M) (proj1_sig k1) H11))) (H8 k1 H11))))). rewrite H13. apply (proj1 (proj2_sig (f (exist (fun n : nat => n < L) (proj1_sig k2 - M) (H9 k2 H12))))). apply H11. move=> H11. elim (excluded_middle_informative (proj1_sig k2 < M)). move=> H12 H13. apply False_ind. apply (le_not_lt M (proj1_sig (proj1_sig (exist (fun m : Count (M + N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig (f (exist (fun n : nat => n < L) (proj1_sig k1 - M) (H9 k1 H11)))) (H10 k1 H11))))). apply (proj1 (proj2_sig (f (exist (fun n : nat => n < L) (proj1_sig k1 - M) (H9 k1 H11))))). rewrite H13. apply H12. move=> H12 H13. apply sig_map. suff: (proj1_sig k1 - M = proj1_sig k2 - M). move=> H14. rewrite - (Minus.le_plus_minus_r M (proj1_sig k1)). rewrite - (Minus.le_plus_minus_r M (proj1_sig k2)). rewrite H14. reflexivity. elim (le_or_lt M (proj1_sig k2)). apply. move=> H15. apply False_ind. apply (H12 H15). elim (le_or_lt M (proj1_sig k1)). apply. move=> H15. apply False_ind. apply (H11 H15). suff: ((exist (fun n : nat => n < L) (proj1_sig k1 - M) (H9 k1 H11)) = (exist (fun n : nat => n < L) (proj1_sig k2 - M) (H9 k2 H12))). move=> H14. suff: (proj1_sig k1 - M = proj1_sig (exist (fun n : nat => n < L) (proj1_sig k1 - M) (H9 k1 H11))). move=> H15. rewrite H15. rewrite H14. reflexivity. reflexivity. apply (BijInj {n : nat | n < L} {m : Count (M + N) | M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)} f H7). apply sig_map. suff: (proj1_sig (f (exist (fun n : nat => n < L) (proj1_sig k1 - M) (H9 k1 H11))) = proj1_sig (exist (fun m : Count (M + N) => proj1_sig m < M \/ M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig (f (exist (fun n : nat => n < L) (proj1_sig k1 - M) (H9 k1 H11)))) (H10 k1 H11))). move=> H14. rewrite H14. rewrite H13. reflexivity. reflexivity. move=> v. elim (proj2_sig v). move=> H11. exists (exist (fun (n : nat) => n < M + L) (proj1_sig (proj1_sig v)) (le_trans (S (proj1_sig (proj1_sig v))) M (M + L) H11 (Plus.le_plus_l M L))). simpl. elim (excluded_middle_informative (proj1_sig (proj1_sig v) < M)). move=> H12. apply sig_map. apply sig_map. reflexivity. move=> H12. apply False_ind. apply (H12 H11). move=> H11. elim H7. move=> finv H12. suff: (M + proj1_sig (finv (exist (fun (m : Count (M + N)) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H11)) < M + L). move=> H13. exists (exist (fun (n : nat) => n < M + L) (M + proj1_sig (finv (exist (fun (m : Count (M + N)) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H11))) H13). simpl. elim (excluded_middle_informative (M + proj1_sig (finv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H11)) < M)). move=> H14. apply False_ind. apply (lt_irrefl M). apply (le_trans (S M) (S (M + proj1_sig (finv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H11)))) M). apply le_n_S. apply (Plus.le_plus_l M). apply H14. move=> H14. apply sig_map. apply sig_map. simpl. suff: ((exist (fun n : nat => n < L) (M + proj1_sig (finv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H11)) - M) (H9 (exist (fun n : nat => n < M + L) (M + proj1_sig (finv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H11))) H13) H14)) = (finv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H11))). move=> H15. rewrite H15. rewrite (proj2 H12). reflexivity. apply sig_map. apply Minus.minus_plus. apply Plus.plus_lt_compat_l. apply (proj2_sig (finv (exist (fun m : Count (M + N) => M <= proj1_sig m /\ ~ In (VT K V) (SpanVS K V {n : Count (M + N) | proj1_sig n < proj1_sig m} (fun k : {n : Count (M + N) | proj1_sig n < proj1_sig m} => F2 (proj1_sig k))) (F2 m)) (proj1_sig v) H11))). move=> m H10. right. apply (proj2_sig (f (exist (fun n : nat => n < L) (proj1_sig m - M) (H9 m H10)))). move=> m H9. apply (Plus.plus_lt_reg_l (proj1_sig m - M) L M). rewrite - (Minus.le_plus_minus M (proj1_sig m)). apply (proj2_sig m). elim (le_or_lt M (proj1_sig m)). apply. move=> H10. apply False_ind. apply (H9 H10). move=> m H8. left. apply H8. apply (Corollary_5_7_3 K V M F H2). apply (SubspaceBasisLinearlyIndependentVS K V W H1 (Count M) F H3). apply (FiniteSigSame (Count (M + N))). apply (Finite_downward_closed (Count (M + N)) (Full_set (Count (M + N))) (CountFinite (M + N))). move=> v H7. apply (Full_intro (Count (M + N)) v). apply (Theorem_5_6 K V M (M + N) (Plus.le_plus_l M N) H5 F2). suff: ((fun m : Count M => F2 (exist (fun n : nat => n < M + N) (proj1_sig m) (H5 m))) = F). move=> H12. rewrite H12. apply (SubspaceBasisLinearlyIndependentVS K V W H1 (Count M) F H3). apply functional_extensionality. move=> m. unfold F2. simpl. elim (excluded_middle_informative (proj1_sig m < M)). move=> H12. suff: ((exist (fun n : nat => n < M) (proj1_sig m) H12) = m). move=> H13. rewrite H13. reflexivity. apply sig_map. reflexivity. move=> H12. apply False_ind. apply (H12 (proj2_sig m)). apply Extensionality_Ensembles. apply conj. rewrite (proj2 (proj1 (BasisLIGeVS K V (Count N) G) H4)). move=> v. elim. move=> x H12. rewrite H12. apply MySumF2Induction. apply conj. apply (proj2 (proj2 (SpanSubspaceVS K V (Count (M + N)) F2))). move=> cm u H13 H14. apply (proj1 (SpanSubspaceVS K V (Count (M + N)) F2)). apply H14. apply (proj1 (proj2 (SpanSubspaceVS K V (Count (M + N)) F2))). suff: (M + proj1_sig u < M + N). move=> H15. suff: (G u = F2 (exist (fun (n : nat) => n < M + N) (M + proj1_sig u) H15)). move=> H16. rewrite H16. apply (SpanContainSelfVS K V (Count (M + N)) F2 (exist (fun (n : nat) => n < M + N) (M + proj1_sig u) H15)). unfold F2. simpl. elim (excluded_middle_informative (M + proj1_sig u < M)). move=> H16. apply False_ind. apply (lt_irrefl M). apply (le_trans (S M) (S (M + proj1_sig u)) M). apply (le_n_S M (M + proj1_sig u) (Plus.le_plus_l M (proj1_sig u))). apply H16. move=> H16. suff: (u = (exist (fun n : nat => n < N) (M + proj1_sig u - M) (H6 (exist (fun n : nat => n < M + N) (M + proj1_sig u) H15) H16))). move=> H17. rewrite {1} H17. reflexivity. apply sig_map. simpl. rewrite Minus.minus_plus. reflexivity. apply (Plus.plus_lt_compat_l (proj1_sig u) N M (proj2_sig u)). move=> v H12. apply (Full_intro (VT K V) v). move=> m H6. apply (Plus.plus_lt_reg_l (proj1_sig m - M) N M). rewrite (Minus.le_plus_minus_r M (proj1_sig m)). apply (proj2_sig m). elim (le_or_lt M (proj1_sig m)). apply. move=> H7. apply False_ind. apply (H6 H7). move=> m. apply (le_trans (S (proj1_sig m)) M (M + N) (proj2_sig m) (Plus.le_plus_l M N)). Qed. Lemma Proposition_5_9_2_exists : forall (K : Field) (V : VectorSpace K) (W : Ensemble (VT K V)) (H1 : SubspaceVS K V W) (H2 : FiniteDimensionVS K V) (M : nat) (F : Count M -> VT K V), exists (H3 : forall m : Count (DimensionVS K V H2), ~ proj1_sig m < M -> proj1_sig m - M < DimensionVS K V H2 - M), BasisSubspaceVS K V W H1 (Count M) F -> exists G : Count (DimensionVS K V H2 - M) -> VT K V, BasisVS K V (Count (DimensionVS K V H2)) (fun m : Count (DimensionVS K V H2) => match excluded_middle_informative (proj1_sig m < M) with | left H => F (exist (fun n : nat => n < M) (proj1_sig m) H) | right H => G (exist (fun n : nat => n < DimensionVS K V H2 - M) (proj1_sig m - M) (H3 m H)) end). Proof. move=> K V W H1 H2 M F. suff: (forall m : Count (DimensionVS K V H2), ~ proj1_sig m < M -> proj1_sig m - M < DimensionVS K V H2 - M). move=> H3. exists H3. apply (Proposition_5_9_2 K V W H1 H2 M F H3). move=> m H3. apply (Plus.plus_lt_reg_l (proj1_sig m - M) (DimensionVS K V H2 - M) M). suff: (M <= proj1_sig m). move=> H4. rewrite (Minus.le_plus_minus_r M (proj1_sig m) H4). rewrite (Minus.le_plus_minus_r M (DimensionVS K V H2)). apply (proj2_sig m). apply (le_trans M (proj1_sig m) (DimensionVS K V H2) H4 (lt_le_weak (proj1_sig m) (DimensionVS K V H2) (proj2_sig m))). elim (le_or_lt M (proj1_sig m)). apply. move=> H4. apply False_ind. apply (H3 H4). Qed. Lemma Proposition_5_9_3 : forall (K : Field) (V : VectorSpace K) (W1 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : FiniteDimensionVS K V), exists (W2 : Ensemble (VT K V)), (SubspaceVS K V W2) /\ (Full_set (VT K V) = SumEnsembleVS K V W1 W2) /\ (Singleton (VT K V) (VO K V) = Intersection (VT K V) W1 W2). Proof. move=> K V W1 H1 H2. elim (DimensionSubspaceVSNature K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)). move=> F H3. elim (Proposition_5_9_2_exists K V W1 H1 H2 (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) F). move=> H4. elim. move=> G H5. exists (SpanVS K V (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) G). apply conj. apply SpanSubspaceVS. apply conj. apply Extensionality_Ensembles. apply conj. rewrite (proj2 (proj1 (BasisLIGeVS K V (Count (DimensionVS K V H2)) (fun m : Count (DimensionVS K V H2) => match excluded_middle_informative (proj1_sig m < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left H => F (exist (fun n : nat => n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m) H) | right H => G (exist (fun n : nat => n < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 m H)) end)) H5)). move=> v. elim. move=> x H6. rewrite H6. rewrite (MySumF2Excluded (Count (DimensionVS K V H2)) (VSPCM K V) (fun t : Count (DimensionVS K V H2) => Vmul K V (proj1_sig x t) match excluded_middle_informative (proj1_sig t < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left H => F (exist (fun n : nat => n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig t) H) | right H => G (exist (fun n : nat => n < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig t - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 t H)) end) (exist (Finite (Count (DimensionVS K V H2))) (fun t : Count (DimensionVS K V H2) => proj1_sig x t <> FO K) (proj2_sig x)) (fun t : Count (DimensionVS K V H2) => proj1_sig t < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). apply SumEnsembleVS_intro. apply MySumF2Induction. apply conj. apply (proj2 (proj2 H1)). move=> cm u H7 H8. apply (proj1 H1). apply H8. apply (proj1 (proj2 H1)). elim (excluded_middle_informative (proj1_sig u < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). move=> H9. elim H3. move=> H10 H11. apply H10. move=> H9. apply False_ind. apply H9. elim H7. move=> t H10 H11. apply H10. apply MySumF2Induction. apply conj. apply SpanSubspaceVS. move=> cm u H7 H8. apply SpanSubspaceVS. apply H8. apply SpanSubspaceVS. elim (excluded_middle_informative (proj1_sig u < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). elim H7. move=> t H9 H10 H11. apply False_ind. apply (H9 H11). move=> H9. apply SpanContainSelfVS. move=> v H6. apply (Full_intro (VT K V) v). apply Extensionality_Ensembles. apply conj. move=> v. elim. apply Intersection_intro. apply (proj2 (proj2 H1)). apply SpanSubspaceVS. move=> v. elim. move=> v0 H6 H7. elim H3. move=> H8 H9. elim (proj1 (FiniteBasisVS K (SubspaceMakeVS K V W1 H1) (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (fun t : Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) => exist W1 (F t) (H8 t))) H9 (exist W1 v0 H6)). move=> x H10. suff: (In (VT K V) (fun v : VT K V => exists a : Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) -> FT K, v = MySumF2 (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (Finite (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (Full_set (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (CountFinite (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (VSPCM K V) (fun n : Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) => Vmul K V (a n) (G n))) v0). elim. move=> y H11. suff: ((fun (m : Count (DimensionVS K V H2)) => match excluded_middle_informative (proj1_sig m < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left H => x (exist (fun (n : nat) => n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m) H) | right _ => FO K end) = (fun (m : Count (DimensionVS K V H2)) => match excluded_middle_informative (proj1_sig m < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left _ => FO K | right H => y (exist (fun n : nat => n < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 m H)) end)). move=> H12. suff: (forall (m : Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))), x m = FO K). move=> H13. suff: (v0 = proj1_sig (exist W1 v0 H6)). move=> H14. rewrite H14. rewrite (proj1 H10). suff: ((proj1_sig (MySumF2 (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (Finite (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (Full_set (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (CountFinite (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (VSPCM K (SubspaceMakeVS K V W1 H1)) (fun n : Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) => Vmul K (SubspaceMakeVS K V W1 H1) (x n) (exist W1 (F n) (H8 n))))) = VO K V). move=> H15. rewrite H15. apply In_singleton. apply MySumF2Induction. apply conj. reflexivity. move=> cm u H15 H16. rewrite (H13 u). rewrite (Vmul_O_l K). simpl. rewrite H16. apply (Vadd_O_l K V (VO K V)). reflexivity. move=> m. suff: (proj1_sig m < DimensionVS K V H2). move=> H13. suff: (x m = let temp := (fun m : Count (DimensionVS K V H2) => match excluded_middle_informative (proj1_sig m < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left _ => FO K | right H => y (exist (fun n : nat => n < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 m H)) end) in temp (exist (fun (n : nat) => n < DimensionVS K V H2) (proj1_sig m) H13)). move=> H14. rewrite H14. simpl. elim (excluded_middle_informative (proj1_sig m < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). move=> H15. reflexivity. move=> H15. apply False_ind. apply (H15 (proj2_sig m)). rewrite - H12. simpl. elim (excluded_middle_informative (proj1_sig m < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). move=> H14. suff: (m = (exist (fun n : nat => n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m) H14)). move=> H15. rewrite {1} H15. reflexivity. apply sig_map. reflexivity. move=> H14. apply False_ind. apply (H14 (proj2_sig m)). apply (le_trans (S (proj1_sig m)) (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (DimensionVS K V H2) (proj2_sig m)). apply (Proposition_5_9_1_2 K V W1 H1 H2 (Proposition_5_9_1_1 K V H2 W1 H1)). apply (proj2 (unique_existence (fun (a : Count (DimensionVS K V H2) -> FT K) => v0 = MySumF2 (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (VSPCM K V) (fun n : Count (DimensionVS K V H2) => Vmul K V (a n) match excluded_middle_informative (proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left H => F (exist (fun n0 : nat => n0 < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig n) H) | right H => G (exist (fun n0 : nat => n0 < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig n - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 n H)) end)))). apply (proj1 (FiniteBasisVS K V (DimensionVS K V H2) (fun m : Count (DimensionVS K V H2) => match excluded_middle_informative (proj1_sig m < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left H => F (exist (fun n : nat => n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m) H) | right H => G (exist (fun n : nat => n < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 m H)) end)) H5 v0). rewrite (MySumF2Included (Count (DimensionVS K V H2)) (FiniteIntersection (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (fun n : Count (DimensionVS K V H2) => proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2)))). rewrite (MySumF2O (Count (DimensionVS K V H2)) (FiniteIntersection (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (Complement (Count (DimensionVS K V H2)) (proj1_sig (FiniteIntersection (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (fun n : Count (DimensionVS K V H2) => proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))))))). simpl. rewrite (Vadd_O_r K V). suff: (v0 = proj1_sig (exist W1 v0 H6)). move=> H13. rewrite H13. rewrite (proj1 H10). suff: (forall (m : Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))), proj1_sig m < DimensionVS K V H2). move=> H12. rewrite - (MySumF2BijectiveSame (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (Finite (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (Full_set (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (CountFinite (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (Count (DimensionVS K V H2)) (FiniteIntersection (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (fun n : Count (DimensionVS K V H2) => proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (VSPCM K V) (fun n : Count (DimensionVS K V H2) => Vmul K V match excluded_middle_informative (proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left H => x (exist (fun n0 : nat => n0 < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig n) H) | right _ => FO K end match excluded_middle_informative (proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left H => F (exist (fun n0 : nat => n0 < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig n) H) | right H => G (exist (fun n0 : nat => n0 < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig n - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 n H)) end) (fun (m : Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) => exist (fun (n : nat) => n < DimensionVS K V H2) (proj1_sig m) (H12 m))). apply (FiniteSetInduction (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (Finite (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (Full_set (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (CountFinite (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H14 H15 H16 H17. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H17. elim (excluded_middle_informative (proj1_sig b < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). move=> H18. suff: ((exist (fun n0 : nat => n0 < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig b) H18) = b). move=> H19. rewrite H19. reflexivity. apply sig_map. reflexivity. move=> H18. apply False_ind. apply (H18 (proj2_sig b)). apply H16. apply H16. move=> u H14. apply Intersection_intro. apply (proj2_sig u). apply (Full_intro (Count (DimensionVS K V H2))). move=> H14. simpl. apply InjSurjBij. move=> k1 k2 H15. apply sig_map. apply sig_map. suff: (proj1_sig (proj1_sig k1) = proj1_sig (proj1_sig (exist (Intersection (Count (DimensionVS K V H2)) (fun n : Count (DimensionVS K V H2) => proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (Full_set (Count (DimensionVS K V H2)))) (exist (fun n : nat => n < DimensionVS K V H2) (proj1_sig (proj1_sig k1)) (H12 (proj1_sig k1))) (H14 (proj1_sig k1) (proj2_sig k1))))). move=> H16. rewrite H16. rewrite H15. reflexivity. reflexivity. move=> u. suff: (proj1_sig (proj1_sig u) < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)). move=> H15. exists (exist (Full_set (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (exist (fun (n : nat) => n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig (proj1_sig u)) H15) (Full_intro (Count (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (fun (n : nat) => n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig (proj1_sig u)) H15))). apply sig_map. apply sig_map. reflexivity. elim (proj2_sig u). move=> u0 H15 H16. apply H15. move=> m. apply (le_trans (S (proj1_sig m)) (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (DimensionVS K V H2) (proj2_sig m)). apply (Proposition_5_9_1_2 K V W1 H1 H2 (Proposition_5_9_1_1 K V H2 W1 H1)). reflexivity. move=> u H12. elim (excluded_middle_informative (proj1_sig u < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). elim H12. move=> u0 H13 H14 H15. apply False_ind. apply H13. apply Intersection_intro. apply H15. apply Full_intro. move=> H13. apply (Vmul_O_l K V). move=> m H12. apply (Full_intro (Count (DimensionVS K V H2)) m). rewrite H11. rewrite (MySumF2Included (Count (DimensionVS K V H2)) (FiniteIntersection (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (fun n : Count (DimensionVS K V H2) => ~ proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2)))). rewrite (MySumF2O (Count (DimensionVS K V H2)) (FiniteIntersection (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (Complement (Count (DimensionVS K V H2)) (proj1_sig (FiniteIntersection (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (fun n : Count (DimensionVS K V H2) => ~ proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))))))). simpl. rewrite (Vadd_O_r K V). suff: (forall (m : Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))), proj1_sig m + (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) < DimensionVS K V H2). move=> H12. rewrite - (MySumF2BijectiveSame (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (Finite (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (Full_set (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (CountFinite (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (Count (DimensionVS K V H2)) (FiniteIntersection (Count (DimensionVS K V H2)) (exist (Finite (Count (DimensionVS K V H2))) (Full_set (Count (DimensionVS K V H2))) (CountFinite (DimensionVS K V H2))) (fun n : Count (DimensionVS K V H2) => ~ proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (VSPCM K V) (fun n : Count (DimensionVS K V H2) => Vmul K V match excluded_middle_informative (proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left _ => FO K | right H => y (exist (fun n0 : nat => n0 < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig n - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 n H)) end match excluded_middle_informative (proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) with | left H => F (exist (fun n0 : nat => n0 < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig n) H) | right H => G (exist (fun n0 : nat => n0 < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig n - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 n H)) end) (fun (m : Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) => exist (fun (n : nat) => n < DimensionVS K V H2) (proj1_sig m + DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H12 m))). apply (FiniteSetInduction (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (Finite (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (Full_set (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (CountFinite (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. reflexivity. move=> B b H13 H14 H15 H16. rewrite MySumF2Add. rewrite MySumF2Add. simpl. rewrite H16. elim (excluded_middle_informative (proj1_sig b + DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1) < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). move=> H17. apply False_ind. apply (lt_not_le (proj1_sig b + DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) H17 (Plus.le_plus_r (proj1_sig b) (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))). move=> H17. suff: ((exist (fun n0 : nat => n0 < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig b + DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1) - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H4 (exist (fun n : nat => n < DimensionVS K V H2) (proj1_sig b + DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H12 b)) H17)) = b). move=> H18. rewrite H18. reflexivity. apply sig_map. simpl. rewrite Plus.plus_comm. apply Minus.minus_plus. apply H15. apply H15. move=> u H13. apply Intersection_intro. move=> H14. apply False_ind. apply (le_not_lt (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig u + DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (Plus.le_plus_r (proj1_sig u) (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) H14). apply (Full_intro (Count (DimensionVS K V H2))). move=> H13. simpl. apply InjSurjBij. move=> k1 k2 H14. apply sig_map. apply sig_map. apply (Plus.plus_reg_l (proj1_sig (proj1_sig k1)) (proj1_sig (proj1_sig k2)) (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). rewrite (Plus.plus_comm (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). rewrite (Plus.plus_comm (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). suff: (proj1_sig (proj1_sig k1) + DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1) = proj1_sig (proj1_sig (exist (Intersection (Count (DimensionVS K V H2)) (fun n : Count (DimensionVS K V H2) => ~ proj1_sig n < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (Full_set (Count (DimensionVS K V H2)))) (exist (fun n : nat => n < DimensionVS K V H2) (proj1_sig (proj1_sig k1) + DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (H12 (proj1_sig k1))) (H13 (proj1_sig k1) (proj2_sig k1))))). move=> H15. rewrite H15. rewrite H14. reflexivity. reflexivity. move=> u. suff: (proj1_sig (proj1_sig u) - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1) < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)). move=> H14. exists (exist (Full_set (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)))) (exist (fun (n : nat) => n < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig (proj1_sig u) - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) H14) (Full_intro (Count (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))) (exist (fun (n : nat) => n < DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig (proj1_sig u) - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) H14))). apply sig_map. apply sig_map. simpl. rewrite Plus.plus_comm. apply Minus.le_plus_minus_r. elim (proj2_sig u). move=> m H15 H16. elim (le_or_lt (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig m)). apply. move=> H17. apply False_ind. apply (H15 H17). apply (Plus.plus_lt_reg_l (proj1_sig (proj1_sig u) - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). rewrite (Minus.le_plus_minus_r (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (DimensionVS K V H2)). rewrite (Minus.le_plus_minus_r (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig (proj1_sig u))). apply (proj2_sig (proj1_sig u)). elim (proj2_sig u). move=> u0 H14 H15. elim (le_or_lt (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (proj1_sig u0)). apply. move=> H16. apply False_ind. apply (H14 H16). apply (Proposition_5_9_1_2 K V W1 H1 H2 (Proposition_5_9_1_1 K V H2 W1 H1)). move=> m. rewrite - {2} (Minus.le_plus_minus_r (DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) (DimensionVS K V H2)). rewrite Plus.plus_comm. apply Plus.plus_lt_compat_l. apply (proj2_sig m). apply (Proposition_5_9_1_2 K V W1 H1 H2 (Proposition_5_9_1_1 K V H2 W1 H1)). move=> u H12. elim (excluded_middle_informative (proj1_sig u < DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1))). move=> H13. apply (Vmul_O_l K V). elim H12. move=> u0 H13 H14 H15. apply False_ind. apply H13. apply Intersection_intro. apply H15. apply (Full_intro (Count (DimensionVS K V H2)) u0). move=> m H12. apply (Full_intro (Count (DimensionVS K V H2)) m). rewrite - (FiniteSpanVS K V (DimensionVS K V H2 - DimensionSubspaceVS K V W1 H1 (Proposition_5_9_1_1 K V H2 W1 H1)) G). apply H7. apply H3. Qed. Lemma Proposition_5_9_1_1_subspace : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), Included (VT K V) W1 W2 -> FiniteDimensionVS K (SubspaceMakeVS K V W2 H2) -> FiniteDimensionVS K (SubspaceMakeVS K V W1 H1). Proof. move=> K V W1 W2 H1 H2 H3 H4. suff: (SubspaceVS K (SubspaceMakeVS K V W2 H2) (fun (v : (SubspaceMakeVST K V W2 H2)) => In (VT K V) W1 (proj1_sig v))). move=> H5. suff: (FiniteDimensionVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H5)). apply (IsomorphicSaveFiniteDimensionVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H5) (SubspaceMakeVS K V W1 H1) (fun (v : (SubspaceMakeVST K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H5)) => exist W1 (proj1_sig (proj1_sig v)) (proj2_sig v))). apply conj. exists (fun (v : (SubspaceMakeVST K V W1 H1)) => exist (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) (exist W2 (proj1_sig v) (H3 (proj1_sig v) (proj2_sig v))) (proj2_sig v)). apply conj. move=> x. apply sig_map. apply sig_map. reflexivity. move=> y. apply sig_map. reflexivity. apply conj. move=> x y. apply sig_map. reflexivity. move=> c x. apply sig_map. reflexivity. apply (Proposition_5_9_1_1 K (SubspaceMakeVS K V W2 H2) H4). apply conj. move=> v1 v2 H5 H6. apply (proj1 H1 (proj1_sig v1) (proj1_sig v2) H5 H6). apply conj. move=> c v H5. apply (proj1 (proj2 H1) c (proj1_sig v) H5). apply (proj2 (proj2 H1)). Qed. Lemma Proposition_5_9_1_2_subspace : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), Included (VT K V) W1 W2 -> forall (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)) (H4 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)), DimensionSubspaceVS K V W2 H2 H3 >= DimensionSubspaceVS K V W1 H1 H4. Proof. move=> K V W1 W2 H1 H2 H3 H5 H4. suff: (SubspaceVS K (SubspaceMakeVS K V W2 H2) (fun (v : (SubspaceMakeVST K V W2 H2)) => In (VT K V) W1 (proj1_sig v))). move=> H6. suff: (IsomorphicVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6) (SubspaceMakeVS K V W1 H1) (fun v : SubspaceMakeVST K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6 => exist W1 (proj1_sig (proj1_sig v)) (proj2_sig v))). move=> H7. suff: (FiniteDimensionVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6)). move=> H8. unfold DimensionSubspaceVS. rewrite - (IsomorphicSaveDimensionVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6) (SubspaceMakeVS K V W1 H1) (fun v : SubspaceMakeVST K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6 => exist W1 (proj1_sig (proj1_sig v)) (proj2_sig v)) H8 H4 H7). apply (Proposition_5_9_1_2 K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6 H5 H8). apply (Proposition_5_9_1_1 K (SubspaceMakeVS K V W2 H2) H5). apply conj. exists (fun (v : (SubspaceMakeVST K V W1 H1)) => exist (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) (exist W2 (proj1_sig v) (H3 (proj1_sig v) (proj2_sig v))) (proj2_sig v)). apply conj. move=> x. apply sig_map. apply sig_map. reflexivity. move=> y. apply sig_map. reflexivity. apply conj. move=> x y. apply sig_map. reflexivity. move=> c x. apply sig_map. reflexivity. apply conj. move=> v1 v2 H6 H7. apply (proj1 H1 (proj1_sig v1) (proj1_sig v2) H6 H7). apply conj. move=> c v H6. apply (proj1 (proj2 H1) c (proj1_sig v) H6). apply (proj2 (proj2 H1)). Qed. Lemma Proposition_5_9_1_2_subspace_exists : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), Included (VT K V) W1 W2 -> forall (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), exists (H4 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)), DimensionSubspaceVS K V W2 H2 H3 >= DimensionSubspaceVS K V W1 H1 H4. Proof. move=> K V W1 W2 H1 H2 H3 H4. suff: (FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)). move=> H5. exists H5. apply (Proposition_5_9_1_2_subspace K V W1 W2 H1 H2 H3 H4 H5). apply (Proposition_5_9_1_1_subspace K V W1 W2 H1 H2 H3 H4). Qed. Lemma Proposition_5_9_1_3_subspace : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), Included (VT K V) W1 W2 -> forall (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)) (H4 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)), DimensionSubspaceVS K V W1 H1 H4 = DimensionSubspaceVS K V W2 H2 H3 <-> W1 = W2. Proof. move=> K V W1 W2 H1 H2 H3 H5 H4. suff: (SubspaceVS K (SubspaceMakeVS K V W2 H2) (fun (v : (SubspaceMakeVST K V W2 H2)) => In (VT K V) W1 (proj1_sig v))). move=> H6. suff: (IsomorphicVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6) (SubspaceMakeVS K V W1 H1) (fun v : SubspaceMakeVST K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6 => exist W1 (proj1_sig (proj1_sig v)) (proj2_sig v))). move=> H7. suff: (FiniteDimensionVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6)). move=> H8. unfold DimensionSubspaceVS. rewrite - (IsomorphicSaveDimensionVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6) (SubspaceMakeVS K V W1 H1) (fun v : SubspaceMakeVST K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6 => exist W1 (proj1_sig (proj1_sig v)) (proj2_sig v)) H8 H4 H7). suff: (DimensionVS K (SubspaceMakeVS K V W2 H2) H5 = DimensionVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6) H8 <-> (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) = Full_set (SubspaceMakeVST K V W2 H2)). move=> H9. apply conj. move=> H10. suff: ((fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) = Full_set (SubspaceMakeVST K V W2 H2)). move=> H11. apply Extensionality_Ensembles. apply conj. move=> v. apply (H3 v). move=> v H12. suff: (In (SubspaceMakeVST K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) (exist W2 v H12)). apply. rewrite H11. apply (Full_intro (SubspaceMakeVST K V W2 H2)). apply (proj1 H9). rewrite H10. reflexivity. move=> H10. rewrite (proj2 H9). reflexivity. apply Extensionality_Ensembles. apply conj. move=> v H11. apply (Full_intro (SubspaceMakeVST K V W2 H2) v). move=> v H11. rewrite H10. apply (proj2_sig v). apply (Proposition_5_9_1_3 K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H6 H5 H8). apply (Proposition_5_9_1_1 K (SubspaceMakeVS K V W2 H2) H5). apply conj. exists (fun (v : (SubspaceMakeVST K V W1 H1)) => exist (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) (exist W2 (proj1_sig v) (H3 (proj1_sig v) (proj2_sig v))) (proj2_sig v)). apply conj. move=> x. apply sig_map. apply sig_map. reflexivity. move=> y. apply sig_map. reflexivity. apply conj. move=> x y. apply sig_map. reflexivity. move=> c x. apply sig_map. reflexivity. apply conj. move=> v1 v2 H6 H7. apply (proj1 H1 (proj1_sig v1) (proj1_sig v2) H6 H7). apply conj. move=> c v H6. apply (proj1 (proj2 H1) c (proj1_sig v) H6). apply (proj2 (proj2 H1)). Qed. Lemma Proposition_5_9_1_3_subspace_exists : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), Included (VT K V) W1 W2 -> forall (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), exists (H4 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)), DimensionSubspaceVS K V W1 H1 H4 = DimensionSubspaceVS K V W2 H2 H3 <-> W1 = W2. Proof. move=> K V W1 W2 H1 H2 H3 H4. suff: (FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)). move=> H5. exists H5. apply (Proposition_5_9_1_3_subspace K V W1 W2 H1 H2 H3 H4 H5). apply (Proposition_5_9_1_1_subspace K V W1 W2 H1 H2 H3 H4). Qed. Lemma Proposition_5_9_2_subspace : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2) (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), Included (VT K V) W1 W2 -> forall (M : nat) (F : Count M -> VT K V) (H4 : forall m : Count (DimensionSubspaceVS K V W2 H2 H3), ~ proj1_sig m < M -> proj1_sig m - M < DimensionSubspaceVS K V W2 H2 H3 - M), BasisSubspaceVS K V W1 H1 (Count M) F -> exists (G : Count (DimensionSubspaceVS K V W2 H2 H3 - M) -> VT K V), BasisSubspaceVS K V W2 H2 (Count (DimensionSubspaceVS K V W2 H2 H3)) (fun m : Count (DimensionSubspaceVS K V W2 H2 H3) => match excluded_middle_informative (proj1_sig m < M) with | left H => F (exist (fun n : nat => n < M) (proj1_sig m) H) | right H => G (exist (fun n : nat => n < DimensionSubspaceVS K V W2 H2 H3 - M) (proj1_sig m - M) (H4 m H)) end). Proof. move=> K V W1 W2 H1 H2 H3 H4 M F H5 H6. suff: (SubspaceVS K (SubspaceMakeVS K V W2 H2) (fun (v : (SubspaceMakeVST K V W2 H2)) => In (VT K V) W1 (proj1_sig v))). move=> H7. suff: (IsomorphicVS K (SubspaceMakeVS K V W1 H1) (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H7) (fun (v : SubspaceMakeVST K V W1 H1) => exist (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) (exist W2 (proj1_sig v) (H4 (proj1_sig v) (proj2_sig v))) (proj2_sig v))). move=> H8. suff: (FiniteDimensionVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H7)). move=> H9. suff: (forall (m : Count M), In (VT K V) W2 (F m)). move=> H10. elim (Proposition_5_9_2 K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H7 H3 M (fun (m : Count M) => exist W2 (F m) (H10 m)) H5). move=> G H11. exists (fun (m : Count (DimensionSubspaceVS K V W2 H2 H3 - M)) => proj1_sig (G m)). suff: (forall t : Count (DimensionSubspaceVS K V W2 H2 H3), In (VT K V) W2 match excluded_middle_informative (proj1_sig t < M) with | left H => F (exist (fun n : nat => n < M) (proj1_sig t) H) | right H => proj1_sig (G (exist (fun n : nat => n < DimensionSubspaceVS K V W2 H2 H3 - M) (proj1_sig t - M) (H5 t H))) end). move=> H12. exists H12. suff: ((fun t : Count (DimensionSubspaceVS K V W2 H2 H3) => exist W2 match excluded_middle_informative (proj1_sig t < M) with | left H => F (exist (fun n : nat => n < M) (proj1_sig t) H) | right H => proj1_sig (G (exist (fun n : nat => n < DimensionSubspaceVS K V W2 H2 H3 - M) (proj1_sig t - M) (H5 t H))) end (H12 t)) = (fun m : Count (DimensionVS K (SubspaceMakeVS K V W2 H2) H3) => match excluded_middle_informative (proj1_sig m < M) with | left H => exist W2 (F (exist (fun n : nat => n < M) (proj1_sig m) H)) (H10 (exist (fun n : nat => n < M) (proj1_sig m) H)) | right H => G (exist (fun n : nat => n < DimensionVS K (SubspaceMakeVS K V W2 H2) H3 - M) (proj1_sig m - M) (H5 m H)) end)). move=> H13. rewrite H13. apply H11. apply functional_extensionality. move=> m. apply sig_map. simpl. elim (excluded_middle_informative (lt (@proj1_sig nat (fun n : nat => lt n (DimensionVS K (SubspaceMakeVS K V W2 H2) H3)) m) M)). move=> H13. elim (excluded_middle_informative (proj1_sig m < M)). move=> H14. simpl. suff: (H14 = H13). move=> H15. rewrite H15. reflexivity. apply proof_irrelevance. move=> H14. apply False_ind. apply (H14 H13). move=> H13. elim (excluded_middle_informative (proj1_sig m < M)). move=> H14. apply False_ind. apply (H13 H14). move=> H14. suff: (H14 = H13). move=> H15. rewrite H15. reflexivity. apply proof_irrelevance. move=> m. elim (excluded_middle_informative (proj1_sig m < M)). move=> H12. apply (H4 (F (exist (fun n : nat => n < M) (proj1_sig m) H12))). elim H6. move=> H13 H14. apply (H13 (exist (fun n : nat => n < M) (proj1_sig m) H12)). move=> H12. apply (proj2_sig (G (exist (fun n : nat => n < DimensionSubspaceVS K V W2 H2 H3 - M) (proj1_sig m - M) (H5 m H12)))). elim H6. move=> H11 H12. exists H11. suff: ((fun t : Count M => exist (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) (exist W2 (F t) (H10 t)) (H11 t)) = (fun t : Count M => exist (fun v0 : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v0)) (exist W2 (proj1_sig (exist W1 (F t) (H11 t))) (H4 (proj1_sig (exist W1 (F t) (H11 t))) (proj2_sig (exist W1 (F t) (H11 t))))) (proj2_sig (exist W1 (F t) (H11 t))))). move=> H13. rewrite H13. apply (IsomorphicSaveBasisVS K (SubspaceMakeVS K V W1 H1) (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H7) (Count M) (fun t : Count M => exist W1 (F t) (H11 t)) (fun v : SubspaceMakeVST K V W1 H1 => exist (fun v0 : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v0)) (exist W2 (proj1_sig v) (H4 (proj1_sig v) (proj2_sig v))) (proj2_sig v)) H8 H12). apply functional_extensionality. move=> m. apply sig_map. apply sig_map. reflexivity. elim H6. move=> H10 H11 m. apply (H4 (F m) (H10 m)). apply (Proposition_5_9_1_1 K (SubspaceMakeVS K V W2 H2) H3 (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H7). apply conj. exists (fun (t : (SubspaceMakeVST K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H7)) => exist W1 (proj1_sig (proj1_sig t)) (proj2_sig t)). apply conj. move=> x. apply sig_map. reflexivity. move=> y. apply sig_map. apply sig_map. reflexivity. apply conj. move=> x y. apply sig_map. apply sig_map. reflexivity. move=> c x. apply sig_map. apply sig_map. reflexivity. apply conj. move=> x y H7 H8. apply (proj1 H1 (proj1_sig x) (proj1_sig y) H7 H8). apply conj. move=> f x H7. apply (proj1 (proj2 H1) f (proj1_sig x) H7). apply (proj2 (proj2 H1)). Qed. Lemma Proposition_5_9_2_subspace_exists : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2) (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), Included (VT K V) W1 W2 -> forall (M : nat) (F : Count M -> VT K V), exists (H4 : forall m : Count (DimensionSubspaceVS K V W2 H2 H3), ~ proj1_sig m < M -> proj1_sig m - M < DimensionSubspaceVS K V W2 H2 H3 - M), BasisSubspaceVS K V W1 H1 (Count M) F -> exists (G : Count (DimensionSubspaceVS K V W2 H2 H3 - M) -> VT K V), BasisSubspaceVS K V W2 H2 (Count (DimensionSubspaceVS K V W2 H2 H3)) (fun m : Count (DimensionSubspaceVS K V W2 H2 H3) => match excluded_middle_informative (proj1_sig m < M) with | left H => F (exist (fun n : nat => n < M) (proj1_sig m) H) | right H => G (exist (fun n : nat => n < DimensionSubspaceVS K V W2 H2 H3 - M) (proj1_sig m - M) (H4 m H)) end). Proof. move=> K V W1 W2 H1 H2 H3 H4 M F. suff: (forall m : Count (DimensionSubspaceVS K V W2 H2 H3), ~ proj1_sig m < M -> proj1_sig m - M < DimensionSubspaceVS K V W2 H2 H3 - M). move=> H5. exists H5. apply (Proposition_5_9_2_subspace K V W1 W2 H1 H2 H3 H4 M F H5). move=> m H5. apply (Plus.plus_lt_reg_l (proj1_sig m - M) (DimensionSubspaceVS K V W2 H2 H3 - M) M). suff: (M <= proj1_sig m). move=> H6. rewrite (Minus.le_plus_minus_r M (proj1_sig m) H6). rewrite (Minus.le_plus_minus_r M (DimensionSubspaceVS K V W2 H2 H3)). apply (proj2_sig m). apply (le_trans M (proj1_sig m) (DimensionSubspaceVS K V W2 H2 H3) H6 (lt_le_weak (proj1_sig m) (DimensionSubspaceVS K V W2 H2 H3) (proj2_sig m))). elim (le_or_lt M (proj1_sig m)). apply. move=> H6. apply False_ind. apply (H5 H6). Qed. Lemma Proposition_5_9_3_subspace : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)), SubspaceVS K V W1 -> forall (H1 : SubspaceVS K V W2) (H2 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H1)), Included (VT K V) W1 W2 -> exists (W3 : Ensemble (VT K V)), SubspaceVS K V W3 /\ W2 = SumEnsembleVS K V W1 W3 /\ Singleton (VT K V) (VO K V) = Intersection (VT K V) W1 W3. Proof. move=> K V W1 W2 H1 H2 H3 H4. suff: (SubspaceVS K (SubspaceMakeVS K V W2 H2) (fun (v : (SubspaceMakeVST K V W2 H2)) => In (VT K V) W1 (proj1_sig v))). move=> H5. suff: (IsomorphicVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H5) (SubspaceMakeVS K V W1 H1) (fun v : SubspaceMakeVST K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) H5 => exist W1 (proj1_sig (proj1_sig v)) (proj2_sig v))). move=> H6. elim (Proposition_5_9_3 K (SubspaceMakeVS K V W2 H2) (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v))). move=> W3 H7. exists (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W2 H2), v = proj1_sig w /\ In (SubspaceMakeVST K V W2 H2) W3 w). apply conj. apply conj. move=> v1 v2 H8 H9. elim H8. move=> w1 H10. elim H9. move=> w2 H11. exists (SubspaceMakeVSVadd K V W2 H2 w1 w2). apply conj. rewrite (proj1 H10). rewrite (proj1 H11). reflexivity. apply (proj1 (proj1 H7) w1 w2 (proj2 H10) (proj2 H11)). apply conj. move=> f v. elim. move=> w H8. exists (SubspaceMakeVSVmul K V W2 H2 f w). apply conj. rewrite (proj1 H8). reflexivity. apply (proj1 (proj2 (proj1 H7)) f w (proj2 H8)). exists (SubspaceMakeVSVO K V W2 H2). apply conj. reflexivity. apply (proj2 (proj2 (proj1 H7))). apply conj. apply Extensionality_Ensembles. apply conj. move=> w H8. suff: (In (SubspaceMakeVST K V W2 H2) (Full_set (VT K (SubspaceMakeVS K V W2 H2))) (exist W2 w H8)). rewrite (proj1 (proj2 H7)). suff: (w = proj1_sig (exist W2 w H8)). move=> H9. rewrite {2} H9. elim. move=> v1 v2 H10 H11. apply SumEnsembleVS_intro. apply H10. exists v2. apply conj. reflexivity. apply H11. reflexivity. apply Full_intro. move=> v. elim. move=> v1 v2 H8 H9. apply (proj1 H2 v1 v2 (H4 v1 H8)). elim H9. move=> w2 H10. rewrite (proj1 H10). apply (proj2_sig w2). apply Extensionality_Ensembles. apply conj. move=> w. elim. apply Intersection_intro. apply (proj2 (proj2 H1)). exists (SubspaceMakeVSVO K V W2 H2). apply conj. reflexivity. apply (proj2 (proj2 (proj1 H7))). move=> w H8. suff: (In (VT K V) W2 w). move=> H9. suff: (w = proj1_sig (exist W2 w H9)). move=> H10. rewrite H10. suff: (In (VT K (SubspaceMakeVS K V W2 H2)) (Singleton (VT K (SubspaceMakeVS K V W2 H2)) (VO K (SubspaceMakeVS K V W2 H2))) (exist W2 w H9)). elim. apply (In_singleton (VT K V) (VO K V)). rewrite (proj2 (proj2 H7)). apply Intersection_intro. suff: (In (VT K V) W1 w). apply. elim H8. move=> v H11 H12. apply H11. suff: (exists u : SubspaceMakeVST K V W2 H2, w = proj1_sig u /\ In (SubspaceMakeVST K V W2 H2) W3 u). elim. move=> u H11. suff: ((exist W2 w H9) = u). move=> H12. rewrite H12. apply (proj2 H11). apply sig_map. apply (proj1 H11). elim H8. move=> v H11 H12. apply H12. reflexivity. apply (H4 w). elim H8. move=> v H9 H10. apply H9. apply H5. apply H3. apply conj. exists (fun (v : SubspaceMakeVST K V W1 H1) => exist (fun v : SubspaceMakeVST K V W2 H2 => In (VT K V) W1 (proj1_sig v)) (exist W2 (proj1_sig v) (H4 (proj1_sig v) (proj2_sig v))) (proj2_sig v)). apply conj. move=> x. apply sig_map. apply sig_map. reflexivity. move=> y. apply sig_map. reflexivity. apply conj. move=> x y. apply sig_map. reflexivity. move=> c x. apply sig_map. reflexivity. apply conj. move=> v1 v2 H5 H6. apply (proj1 H1 (proj1_sig v1) (proj1_sig v2) H5 H6). apply conj. move=> f v H5. apply (proj1 (proj2 H1) f (proj1_sig v) H5). apply (proj2 (proj2 H1)). Qed. Lemma LinearlyIndependentSpanIntersectionVS : forall (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V) (A B : Ensemble T), LinearlyIndependentVS K V T F -> Intersection (VT K V) (SpanVS K V {t : T | In T A t} (fun (x : {t : T | In T A t}) => F (proj1_sig x))) (SpanVS K V {t : T | In T B t} (fun (x : {t : T | In T B t}) => F (proj1_sig x))) = (SpanVS K V {t : T | In T (Intersection T A B) t} (fun (x : {t : T | In T (Intersection T A B) t}) => F (proj1_sig x))). Proof. move=> K V T F A B H1. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v0 H2 H3. elim H2. move=> x1 H4. elim H3. move=> x2 H5. suff: (forall (t0 : {t : T | In T A t}), ~ In T B (proj1_sig t0) -> proj1_sig x1 t0 = FO K). move=> H6. suff: (forall (t0 : {t : T | In T (Intersection T A B) t}), In T A (proj1_sig t0)). move=> H7. suff: (Finite {t : T | In T (Intersection T A B) t} (fun (t0 : {t : T | In T (Intersection T A B) t}) => proj1_sig x1 (exist A (proj1_sig t0) (H7 t0)) <> FO K)). move=> H8. exists (exist (fun (G : {t : T | In T (Intersection T A B) t} -> FT K) => Finite {t : T | In T (Intersection T A B) t} (fun (t0 : {t : T | In T (Intersection T A B) t}) => G t0 <> FO K)) (fun (t0 : {t : T | In T (Intersection T A B) t}) => proj1_sig x1 (exist A (proj1_sig t0) (H7 t0))) H8). simpl. rewrite H4. suff: ((exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1)) = FiniteIm {t : T | In T (Intersection T A B) t} {t : T | In T A t} (fun (t0 : {t : T | In T (Intersection T A B) t}) => exist A (proj1_sig t0) (H7 t0)) (exist (Finite {t : T | In T (Intersection T A B) t}) (fun t : {t : T | In T (Intersection T A B) t} => proj1_sig x1 (exist A (proj1_sig t) (H7 t)) <> FO K) H8)). move=> H9. rewrite H9. rewrite - (MySumF2BijectiveSame2 {t : T | In T (Intersection T A B) t} {t : T | In T A t} (exist (Finite {t : T | In T (Intersection T A B) t}) (fun t : {t : T | In T (Intersection T A B) t} => proj1_sig x1 (exist A (proj1_sig t) (H7 t)) <> FO K) H8) (fun (t0 : {t : T | In T (Intersection T A B) t}) => exist A (proj1_sig t0) (H7 t0))). reflexivity. move=> u1 u2 H10 H11 H12. apply sig_map. suff: (proj1_sig u1 = proj1_sig (exist A (proj1_sig u1) (H7 u1))). move=> H13. rewrite H13. rewrite H12. reflexivity. reflexivity. apply sig_map. simpl. apply Extensionality_Ensembles. apply conj. move=> t H9. suff: (In T (Intersection T A B) (proj1_sig t)). move=> H10. apply (Im_intro {t0 : T | In T (Intersection T A B) t0} {t0 : T | In T A t0} (fun t0 : {t0 : T | In T (Intersection T A B) t0} => proj1_sig x1 (exist A (proj1_sig t0) (H7 t0)) <> FO K) (fun t0 : {t0 : T | In T (Intersection T A B) t0} => exist A (proj1_sig t0) (H7 t0)) (exist (Intersection T A B) (proj1_sig t) H10)). unfold In. simpl. suff: ((exist A (proj1_sig t) (H7 (exist (Intersection T A B) (proj1_sig t) H10))) = t). move=> H11. rewrite H11. apply H9. apply sig_map. reflexivity. apply sig_map. reflexivity. apply (Intersection_intro T A B (proj1_sig t) (proj2_sig t)). apply NNPP. move=> H10. apply H9. apply (H6 t H10). move=> t0. elim. move=> x H9 y H10. rewrite H10. apply H9. suff: (Finite {t : {t : T | In T A t} | proj1_sig x1 t <> FO K} (Full_set {t : {t : T | In T A t} | proj1_sig x1 t <> FO K})). move=> H8. suff: (forall (t : {t : {t : T | In T A t} | proj1_sig x1 t <> FO K}), Intersection T A B (proj1_sig (proj1_sig t))). move=> H9. apply (Finite_downward_closed {t : T | In T (Intersection T A B) t} (Im {t : {t : T | In T A t} | proj1_sig x1 t <> FO K} {t : T | In T (Intersection T A B) t} (Full_set {t : {t : T | In T A t} | proj1_sig x1 t <> FO K}) (fun (t : {t : {t : T | In T A t} | proj1_sig x1 t <> FO K}) => exist (Intersection T A B) (proj1_sig (proj1_sig t)) (H9 t)))). apply finite_image. apply (FiniteSigSame {t : T | In T A t}). apply (proj2_sig x1). move=> t H10. apply (Im_intro {t0 : {t0 : T | In T A t0} | proj1_sig x1 t0 <> FO K} {t0 : T | In T (Intersection T A B) t0} (Full_set {t0 : {t0 : T | In T A t0} | proj1_sig x1 t0 <> FO K}) (fun t0 : {t0 : {t0 : T | In T A t0} | proj1_sig x1 t0 <> FO K} => exist (Intersection T A B) (proj1_sig (proj1_sig t0)) (H9 t0)) (exist (fun (t0 : {t0 : T | In T A t0}) => proj1_sig x1 t0 <> FO K) (exist A (proj1_sig t) (H7 t)) H10)). apply Full_intro. apply sig_map. reflexivity. move=> t. apply Intersection_intro. apply (proj2_sig (proj1_sig t)). apply NNPP. move=> H9. apply (proj2_sig t). apply (H6 (proj1_sig t) H9). apply (FiniteSigSame {t : T | In T A t}). apply (proj2_sig x1). move=> t. elim (proj2_sig t). move=> x H7 H8. apply H7. suff: (forall (t : T), ~ In T B t -> (fun (t : T) => match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end) t = FO K). move=> H6 t H7. suff: (proj1_sig x1 t = (fun (t : T) => match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end) (proj1_sig t)). move=> H8. rewrite H8. apply (H6 (proj1_sig t) H7). elim (excluded_middle_informative (A (proj1_sig t))). move=> H8. suff: (t = (exist A (proj1_sig t) H8)). move=> H9. rewrite {1} H9. reflexivity. apply sig_map. reflexivity. move=> H8. apply False_ind. apply (H8 (proj2_sig t)). suff: ((fun (t : T) => match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end) = (fun (t : T) => match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end)). move=> H6 t H7. suff: (match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end = let temp := (fun t : T => match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end) in temp t). move=> H8. rewrite H8. rewrite H6. simpl. elim (excluded_middle_informative (B t)). move=> H9. apply False_ind. apply (H7 H9). move=> H9. reflexivity. reflexivity. suff: (forall (t : T), In T (proj1_sig (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun (t : {t : T | In T A t}) => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun (t : {t : T | In T A t}) => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun (t : {t : T | In T B t}) => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun (t : {t : T | In T B t}) => proj1_sig x2 t <> FO K) (proj2_sig x2))))) t -> (Fadd K ((fun t : T => match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end) t) (Fopp K ((fun t : T => match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end) t)) = FO K)). move=> H6. apply functional_extensionality. move=> t. elim (classic (In T (proj1_sig (FiniteUnion T (FiniteIm {t0 : T | In T A t0} T (fun t0 : {t0 : T | In T A t0} => proj1_sig t0) (exist (Finite {t0 : T | In T A t0}) (fun t0 : {t0 : T | In T A t0} => proj1_sig x1 t0 <> FO K) (proj2_sig x1))) (FiniteIm {t0 : T | In T B t0} T (fun t0 : {t0 : T | In T B t0} => proj1_sig t0) (exist (Finite {t0 : T | In T B t0}) (fun t0 : {t0 : T | In T B t0} => proj1_sig x2 t0 <> FO K) (proj2_sig x2))))) t)). move=> H7. apply (Fminus_diag_uniq K). apply (H6 t H7). move=> H7. elim (excluded_middle_informative (A t)). move=> H8. suff: (proj1_sig x1 (exist A t H8) = FO K). move=> H9. rewrite H9. elim (excluded_middle_informative (B t)). move=> H10. apply NNPP. move=> H11. apply H7. right. apply (Im_intro {t0 : T | In T B t0} T (fun t0 : {t0 : T | In T B t0} => proj1_sig x2 t0 <> FO K) (fun t0 : {t0 : T | In T B t0} => proj1_sig t0) (exist B t H10)). move=> H12. apply H11. rewrite H12. reflexivity. reflexivity. move=> H10. reflexivity. apply NNPP. move=> H9. apply H7. left. apply (Im_intro {t0 : T | In T A t0} T (fun t0 : {t0 : T | In T A t0} => proj1_sig x1 t0 <> FO K) (fun t0 : {t0 : T | In T A t0} => proj1_sig t0) (exist A t H8)). apply H9. reflexivity. move=> H8. elim (excluded_middle_informative (B t)). move=> H9. apply NNPP. move=> H10. apply H7. right. apply (Im_intro {t0 : T | In T B t0} T (fun t0 : {t0 : T | In T B t0} => proj1_sig x2 t0 <> FO K) (fun t0 : {t0 : T | In T B t0} => proj1_sig t0) (exist B t H9)). move=> H11. apply H10. rewrite H11. reflexivity. reflexivity. move=> H9. reflexivity. apply (proj1 (LinearlyIndependentVSDef3 K V T F) H1). suff: (MySumF2 T (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2)))) (VSPCM K V) (fun t : T => Vmul K V (Fadd K match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end (Fopp K match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end)) (F t)) = Vadd K V (MySumF2 T (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2)))) (VSPCM K V) (fun t : T => Vmul K V (match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end) (F t))) (Vopp K V (MySumF2 T (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2)))) (VSPCM K V) (fun t : T => Vmul K V (match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end) (F t))))). move=> H6. rewrite H6. apply (Vminus_diag_eq K V). suff: (MySumF2 T (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2)))) (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end (F t)) = v0). move=> H7. suff: (MySumF2 T (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2)))) (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end (F t)) = v0). move=> H8. rewrite H7. rewrite H8. reflexivity. rewrite H5. rewrite (MySumF2Included T (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2))) (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2))))). rewrite (MySumF2O T (FiniteIntersection T (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2)))) (Complement T (proj1_sig (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2))))))). rewrite (CM_O_r (VSPCM K V)). rewrite - (MySumF2BijectiveSame2 {t : T | In T B t} T (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2)) (fun t : {t : T | In T B t} => proj1_sig t)). suff: ((compose (fun t : T => Vmul K V match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end (F t)) (fun t : {t : T | In T B t} => proj1_sig t)) = (fun t : {t : T | In T B t} => Vmul K V (proj1_sig x2 t) (F (proj1_sig t)))). move=> H8. rewrite H8. reflexivity. apply functional_extensionality. move=> t. unfold compose. elim (excluded_middle_informative (B (proj1_sig t))). move=> H8. suff: ((exist B (proj1_sig t) H8) = t). move=> H9. rewrite H9. reflexivity. apply sig_map. reflexivity. move=> H8. apply False_ind. apply (H8 (proj2_sig t)). move=> u1 u2 H8 H9. apply sig_map. move=> u H8. elim (excluded_middle_informative (B u)). move=> H9. suff: ((proj1_sig x2 (exist B u H9)) = FO K). move=> H10. rewrite H10. apply (Vmul_O_l K V). suff: ((Complement T (proj1_sig (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2))))) u). move=> H10. apply NNPP. move=> H11. apply H10. apply (Im_intro {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (fun t : {t : T | In T B t} => proj1_sig t) (exist B u H9)). apply H11. reflexivity. elim H8. move=> t H10 H11. apply H10. move=> H9. apply (Vmul_O_l K V). move=> t H8. right. apply H8. rewrite H4. rewrite (MySumF2Included T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2))))). rewrite (MySumF2O T (FiniteIntersection T (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2)))) (Complement T (proj1_sig (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))))))). rewrite (CM_O_r (VSPCM K V)). rewrite - (MySumF2BijectiveSame2 {t : T | In T A t} T (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1)) (fun t : {t : T | In T A t} => proj1_sig t)). suff: ((compose (fun t : T => Vmul K V match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end (F t)) (fun t : {t : T | In T A t} => proj1_sig t)) = (fun t : {t : T | In T A t} => Vmul K V (proj1_sig x1 t) (F (proj1_sig t)))). move=> H7. rewrite H7. reflexivity. apply functional_extensionality. move=> t. unfold compose. elim (excluded_middle_informative (A (proj1_sig t))). move=> H7. suff: ((exist A (proj1_sig t) H7) = t). move=> H8. rewrite H8. reflexivity. apply sig_map. reflexivity. move=> H7. apply False_ind. apply (H7 (proj2_sig t)). move=> u1 u2 H7 H8. apply sig_map. move=> u H7. elim (excluded_middle_informative (A u)). move=> H8. suff: ((proj1_sig x1 (exist A u H8)) = FO K). move=> H9. rewrite H9. apply (Vmul_O_l K V). suff: ((Complement T (proj1_sig (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))))) u). move=> H9. apply NNPP. move=> H10. apply H9. apply (Im_intro {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (fun t : {t : T | In T A t} => proj1_sig t) (exist A u H8)). apply H10. reflexivity. elim H7. move=> t H9 H10. apply H9. move=> H8. apply (Vmul_O_l K V). move=> t H7. left. apply H7. apply (FiniteSetInduction T (FiniteUnion T (FiniteIm {t : T | In T A t} T (fun t : {t : T | In T A t} => proj1_sig t) (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => proj1_sig x1 t <> FO K) (proj2_sig x1))) (FiniteIm {t : T | In T B t} T (fun t : {t : T | In T B t} => proj1_sig t) (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => proj1_sig x2 t <> FO K) (proj2_sig x2))))). apply conj. rewrite MySumF2Empty. rewrite MySumF2Empty. rewrite MySumF2Empty. simpl. rewrite (Vadd_opp_r K V). reflexivity. move=> C c H6 H7 H8 H9. rewrite MySumF2Add. rewrite MySumF2Add. rewrite MySumF2Add. rewrite H9. simpl. rewrite (Vopp_add_distr K V). rewrite - (Vadd_assoc K V (Vadd K V (MySumF2 T C (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end (F t))) (Vmul K V match excluded_middle_informative (A c) with | left H => proj1_sig x1 (exist A c H) | right _ => FO K end (F c))) (Vopp K V (MySumF2 T C (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end (F t))))). rewrite (Vadd_assoc K V (MySumF2 T C (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end (F t))) (Vmul K V match excluded_middle_informative (A c) with | left H => proj1_sig x1 (exist A c H) | right _ => FO K end (F c))). rewrite (Vadd_comm K V (Vmul K V match excluded_middle_informative (A c) with | left H => proj1_sig x1 (exist A c H) | right _ => FO K end (F c)) (Vopp K V (MySumF2 T C (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end (F t))))). rewrite - (Vadd_assoc K V (MySumF2 T C (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end (F t))) (Vopp K V (MySumF2 T C (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end (F t))))). rewrite (Vadd_assoc K V (Vadd K V (MySumF2 T C (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (A t) with | left H => proj1_sig x1 (exist A t H) | right _ => FO K end (F t))) (Vopp K V (MySumF2 T C (VSPCM K V) (fun t : T => Vmul K V match excluded_middle_informative (B t) with | left H => proj1_sig x2 (exist B t H) | right _ => FO K end (F t))))) (Vmul K V match excluded_middle_informative (A c) with | left H => proj1_sig x1 (exist A c H) | right _ => FO K end (F c))). rewrite (Vmul_add_distr_r K V). rewrite (Vopp_mul_distr_l K V). reflexivity. apply H8. apply H8. apply H8. move=> v. elim. move=> x H2. rewrite H2. apply Intersection_intro. suff: (forall (t : {t : T | In T (Intersection T A B) t}), In T A (proj1_sig t)). move=> H3. suff: ((fun t : {t : T | In T (Intersection T A B) t} => Vmul K V (proj1_sig x t) (F (proj1_sig t))) = compose (fun t : {t : T | In T A t} => Vmul K V match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end (F (proj1_sig t))) (fun (t : {t : T | In T (Intersection T A B) t}) => exist A (proj1_sig t) (H3 t))). move=> H4. rewrite H4. rewrite (MySumF2BijectiveSame2 {t : T | In T (Intersection T A B) t} {t : T | In T A t} (exist (Finite {t : T | In T (Intersection T A B) t}) (fun t : {t : T | In T (Intersection T A B) t} => proj1_sig x t <> FO K) (proj2_sig x)) (fun (t : {t : T | In T (Intersection T A B) t}) => exist A (proj1_sig t) (H3 t)) (VSPCM K V)). suff: (Finite {t : T | In T A t} (fun t : {t : T | In T A t} => match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end <> FO K)). move=> H5. exists (exist (fun (G : {t : T | In T A t} -> FT K) => Finite {t : T | In T A t} (fun (t : {t : T | In T A t}) => G t <> FO K)) (fun t : {t : T | In T A t} => match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end) H5). simpl. suff: ((FiniteIm {t : T | In T (Intersection T A B) t} {t : T | In T A t} (fun t : {t : T | In T (Intersection T A B) t} => exist A (proj1_sig t) (H3 t)) (exist (Finite {t : T | In T (Intersection T A B) t}) (fun t : {t : T | In T (Intersection T A B) t} => proj1_sig x t <> FO K) (proj2_sig x))) = (exist (Finite {t : T | In T A t}) (fun t : {t : T | In T A t} => match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end <> FO K) H5)). move=> H6. rewrite H6. reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> t. elim. move=> x0 H6 y0 H7. rewrite H7. unfold In. simpl. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => Intersection T A B t0) x0))). move=> H8. suff: ((exist (Intersection T A B) (proj1_sig x0) H8) = x0). move=> H9. rewrite H9. apply H6. apply sig_map. reflexivity. move=> H8 H9. apply (H8 (proj2_sig x0)). simpl. move=> t. unfold In. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => A t0) t))). move=> H6 H7. apply (Im_intro {t0 : T | Intersection T A B t0} {t0 : T | A t0} (fun t0 : {t0 : T | Intersection T A B t0} => proj1_sig x t0 <> FO K) (fun t0 : {t0 : T | Intersection T A B t0} => exist A (proj1_sig t0) (H3 t0)) (exist (Intersection T A B) (proj1_sig t) H6)). apply H7. apply sig_map. reflexivity. move=> H6 H7. apply False_ind. apply H7. reflexivity. suff: (Im {t : T | In T (Intersection T A B) t} {t : T | In T A t} (fun t : {t : T | In T (Intersection T A B) t} => proj1_sig x t <> FO K) (fun t : {t : T | In T (Intersection T A B) t} => exist A (proj1_sig t) (H3 t)) = (fun t : {t : T | In T A t} => match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end <> FO K)). move=> H5. rewrite - H5. apply finite_image. apply (proj2_sig x). apply Extensionality_Ensembles. apply conj. move=> t. elim. move=> x0 H5 y0 H6. rewrite H6. unfold In. simpl. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => Intersection T A B t0) x0))). move=> H7. suff: ((exist (Intersection T A B) (proj1_sig x0) H7) = x0). move=> H8. rewrite H8. apply H5. apply sig_map. reflexivity. move=> H7 H8. apply (H7 (proj2_sig x0)). simpl. move=> t. unfold In. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => A t0) t))). move=> H5 H6. apply (Im_intro {t0 : T | Intersection T A B t0} {t0 : T | A t0} (fun t0 : {t0 : T | Intersection T A B t0} => proj1_sig x t0 <> FO K) (fun t0 : {t0 : T | Intersection T A B t0} => exist A (proj1_sig t0) (H3 t0)) (exist (Intersection T A B) (proj1_sig t) H5)). apply H6. apply sig_map. reflexivity. move=> H5 H6. apply False_ind. apply H6. reflexivity. move=> u1 u2 H5 H6 H7. apply sig_map. suff: (proj1_sig u1 = proj1_sig (exist A (proj1_sig u1) (H3 u1))). move=> H8. rewrite H8. rewrite H7. reflexivity. reflexivity. apply functional_extensionality. move=> t. unfold compose. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => In T A t0) (@exist T A (@proj1_sig T (fun t0 : T => In T (Intersection T A B) t0) t) (H3 t))))). move=> H4. simpl. suff: ((exist (Intersection T A B) (proj1_sig t) H4) = t). move=> H5. rewrite H5. reflexivity. apply sig_map. reflexivity. move=> H4. apply False_ind. apply (H4 (proj2_sig t)). move=> t. elim (proj2_sig t). move=> t0 H3 H4. apply H3. suff: (forall (t : {t : T | In T (Intersection T A B) t}), In T B (proj1_sig t)). move=> H3. suff: ((fun t : {t : T | In T (Intersection T A B) t} => Vmul K V (proj1_sig x t) (F (proj1_sig t))) = compose (fun t : {t : T | In T B t} => Vmul K V match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end (F (proj1_sig t))) (fun (t : {t : T | In T (Intersection T A B) t}) => exist B (proj1_sig t) (H3 t))). move=> H4. rewrite H4. rewrite (MySumF2BijectiveSame2 {t : T | In T (Intersection T A B) t} {t : T | In T B t} (exist (Finite {t : T | In T (Intersection T A B) t}) (fun t : {t : T | In T (Intersection T A B) t} => proj1_sig x t <> FO K) (proj2_sig x)) (fun (t : {t : T | In T (Intersection T A B) t}) => exist B (proj1_sig t) (H3 t)) (VSPCM K V)). suff: (Finite {t : T | In T B t} (fun t : {t : T | In T B t} => match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end <> FO K)). move=> H5. exists (exist (fun (G : {t : T | In T B t} -> FT K) => Finite {t : T | In T B t} (fun (t : {t : T | In T B t}) => G t <> FO K)) (fun t : {t : T | In T B t} => match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end) H5). simpl. suff: ((FiniteIm {t : T | In T (Intersection T A B) t} {t : T | In T B t} (fun t : {t : T | In T (Intersection T A B) t} => exist B (proj1_sig t) (H3 t)) (exist (Finite {t : T | In T (Intersection T A B) t}) (fun t : {t : T | In T (Intersection T A B) t} => proj1_sig x t <> FO K) (proj2_sig x))) = (exist (Finite {t : T | In T B t}) (fun t : {t : T | In T B t} => match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end <> FO K) H5)). move=> H6. rewrite H6. reflexivity. apply sig_map. apply Extensionality_Ensembles. apply conj. move=> t. elim. move=> x0 H6 y0 H7. rewrite H7. unfold In. simpl. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => Intersection T A B t0) x0))). move=> H8. suff: ((exist (Intersection T A B) (proj1_sig x0) H8) = x0). move=> H9. rewrite H9. apply H6. apply sig_map. reflexivity. move=> H8 H9. apply (H8 (proj2_sig x0)). simpl. move=> t. unfold In. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => B t0) t))). move=> H6 H7. apply (Im_intro {t0 : T | Intersection T A B t0} {t0 : T | B t0} (fun t0 : {t0 : T | Intersection T A B t0} => proj1_sig x t0 <> FO K) (fun t0 : {t0 : T | Intersection T A B t0} => exist B (proj1_sig t0) (H3 t0)) (exist (Intersection T A B) (proj1_sig t) H6)). apply H7. apply sig_map. reflexivity. move=> H6 H7. apply False_ind. apply H7. reflexivity. suff: (Im {t : T | In T (Intersection T A B) t} {t : T | In T B t} (fun t : {t : T | In T (Intersection T A B) t} => proj1_sig x t <> FO K) (fun t : {t : T | In T (Intersection T A B) t} => exist B (proj1_sig t) (H3 t)) = (fun t : {t : T | In T B t} => match excluded_middle_informative (Intersection T A B (proj1_sig t)) with | left H => proj1_sig x (exist (Intersection T A B) (proj1_sig t) H) | right _ => FO K end <> FO K)). move=> H5. rewrite - H5. apply finite_image. apply (proj2_sig x). apply Extensionality_Ensembles. apply conj. move=> t. elim. move=> x0 H5 y0 H6. rewrite H6. unfold In. simpl. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => Intersection T A B t0) x0))). move=> H7. suff: ((exist (Intersection T A B) (proj1_sig x0) H7) = x0). move=> H8. rewrite H8. apply H5. apply sig_map. reflexivity. move=> H7 H8. apply (H7 (proj2_sig x0)). simpl. move=> t. unfold In. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => B t0) t))). move=> H5 H6. apply (Im_intro {t0 : T | Intersection T A B t0} {t0 : T | B t0} (fun t0 : {t0 : T | Intersection T A B t0} => proj1_sig x t0 <> FO K) (fun t0 : {t0 : T | Intersection T A B t0} => exist B (proj1_sig t0) (H3 t0)) (exist (Intersection T A B) (proj1_sig t) H5)). apply H6. apply sig_map. reflexivity. move=> H5 H6. apply False_ind. apply H6. reflexivity. move=> u1 u2 H5 H6 H7. apply sig_map. suff: (proj1_sig u1 = proj1_sig (exist B (proj1_sig u1) (H3 u1))). move=> H8. rewrite H8. rewrite H7. reflexivity. reflexivity. apply functional_extensionality. move=> t. unfold compose. elim (excluded_middle_informative (Intersection T A B (@proj1_sig T (fun t0 : T => In T B t0) (@exist T B (@proj1_sig T (fun t0 : T => In T (Intersection T A B) t0) t) (H3 t))))). move=> H4. simpl. suff: ((exist (Intersection T A B) (proj1_sig t) H4) = t). move=> H5. rewrite H5. reflexivity. apply sig_map. reflexivity. move=> H4. apply False_ind. apply (H4 (proj2_sig t)). move=> t. elim (proj2_sig t). move=> t0 H3 H4. apply H4. Qed. Lemma LinearlyIndependentSpanIntersectionVS2 : forall (K : Field) (V : VectorSpace K) (T : Type) (F : T -> VT K V) (A B : Ensemble T), LinearlyIndependentVS K V T F -> Intersection T A B = Empty_set T -> Intersection (VT K V) (SpanVS K V {t : T | In T A t} (fun (x : {t : T | In T A t}) => F (proj1_sig x))) (SpanVS K V {t : T | In T B t} (fun (x : {t : T | In T B t}) => F (proj1_sig x))) = Singleton (VT K V) (VO K V). Proof. move=> K V T F A B H1 H2. rewrite (LinearlyIndependentSpanIntersectionVS K V T F A B H1). rewrite H2. apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> x H3. rewrite H3. rewrite MySumF2O. apply (In_singleton (VT K V) (VO K V)). move=> u. elim (proj2_sig u). move=> v. elim. apply SpanSubspaceVS. Qed. Lemma DimensionSumEnsembleVS : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2) (H3 : SubspaceVS K V (Intersection (VT K V) W1 W2)) (H4 : SubspaceVS K V (SumEnsembleVS K V W1 W2)) (H5 : FiniteDimensionVS K (SubspaceMakeVS K V (SumEnsembleVS K V W1 W2) H4)) (H6 : FiniteDimensionVS K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) H3)) (H7 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)) (H8 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), DimensionSubspaceVS K V (SumEnsembleVS K V W1 W2) H4 H5 + DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 = DimensionSubspaceVS K V W1 H1 H7 + DimensionSubspaceVS K V W2 H2 H8. Proof. move=> K V W1 W2 H1 H2 H3 H4 H5 H6 H7 H8. elim (Proposition_5_9_3 K (SubspaceMakeVS K V W1 H1) (fun (t : (SubspaceMakeVST K V W1 H1)) => In (VT K V) (Intersection (VT K V) W1 W2) (proj1_sig t))). move=> W3 H9. elim (Proposition_5_9_3 K (SubspaceMakeVS K V W2 H2) (fun (t : (SubspaceMakeVST K V W2 H2)) => In (VT K V) (Intersection (VT K V) W1 W2) (proj1_sig t))). move=> W4 H10. elim (DimensionSubspaceVSNature K V (Intersection (VT K V) W1 W2) H3 H6). move=> F1 H11. elim (Proposition_5_9_1_1 K (SubspaceMakeVS K V W1 H1) H7 W3 (proj1 H9)). move=> N2. elim. move=> F2 H12. elim (Proposition_5_9_1_1 K (SubspaceMakeVS K V W2 H2) H8 W4 (proj1 H10)). move=> N3. elim. move=> F3 H13. suff: (BasisSubspaceVS K V W1 H1 (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + (Count N2)) (fun t : (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + (Count N2)) => match t with | inl t0 => F1 t0 | inr t0 => proj1_sig (proj1_sig (F2 t0)) end)). move=> H14. suff: (BasisSubspaceVS K V W2 H2 (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + (Count N3)) (fun t : (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + (Count N3)) => match t with | inl t0 => F1 t0 | inr t0 => proj1_sig (proj1_sig (F3 t0)) end)). move=> H15. suff: (BasisSubspaceVS K V (SumEnsembleVS K V W1 W2) H4 (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + (Count N2) + (Count N3)) (fun t : (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + (Count N2) + (Count N3)) => match t with | inl (inl t1) => F1 t1 | inl (inr t1) => proj1_sig (proj1_sig (F2 t1)) | inr t0 => proj1_sig (proj1_sig (F3 t0)) end)). move=> H16. suff: (forall (N M : nat), {f : Count (N + M) -> Count N + Count M | Bijective (Count (N + M)) (Count N + Count M) f}). move=> H17. suff: (DimensionSubspaceVS K V (SumEnsembleVS K V W1 W2) H4 H5 = DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3). move=> H18. rewrite H18. suff: (DimensionSubspaceVS K V W1 H1 H7 = DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2). move=> H19. rewrite H19. suff: (DimensionSubspaceVS K V W2 H2 H8 = DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N3). move=> H20. rewrite H20. rewrite - (Plus.plus_assoc (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2)). rewrite (Plus.plus_comm N3). reflexivity. apply (DimensionSubspaceVSNature2 K V W2 H2 H8 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N3) (compose (fun t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N3 => match t with | inl t0 => F1 t0 | inr t0 => proj1_sig (proj1_sig (F3 t0)) end) (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N3)))). elim H15. move=> H20 H21. exists (fun (t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N3)) => H20 (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N3) t)). apply (BijectiveSaveBasisVS K (SubspaceMakeVS K V W2 H2) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N3)) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N3) (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N3)) (fun t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N3 => exist W2 match t with | inl t0 => F1 t0 | inr t0 => proj1_sig (proj1_sig (F3 t0)) end (H20 t)) (proj2_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N3)) H21). apply (DimensionSubspaceVSNature2 K V W1 H1 H7 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) (compose (fun t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2 => match t with | inl t0 => F1 t0 | inr t0 => proj1_sig (proj1_sig (F2 t0)) end) (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2)))). elim H14. move=> H19 H20. exists (fun (t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2)) => H19 (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2) t)). apply (BijectiveSaveBasisVS K (SubspaceMakeVS K V W1 H1) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2)) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2) (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2)) (fun t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2 => exist W1 match t with | inl t0 => F1 t0 | inr t0 => proj1_sig (proj1_sig (F2 t0)) end (H19 t)) (proj2_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2)) H20). suff: {f : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3) -> Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2 + Count N3 | Bijective (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3)) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2 + Count N3) f}. move=> H18. elim H16. move=> H19 H20. apply (DimensionSubspaceVSNature2 K V (SumEnsembleVS K V W1 W2) H4 H5 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3) (compose (fun t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2 + Count N3 => match t with | inl (inl t1) => F1 t1 | inl (inr t1) => proj1_sig (proj1_sig (F2 t1)) | inr t0 => proj1_sig (proj1_sig (F3 t0)) end) (proj1_sig H18))). exists (fun (t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3)) => H19 (proj1_sig H18 t)). apply (BijectiveSaveBasisVS K (SubspaceMakeVS K V (SumEnsembleVS K V W1 W2) H4) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3)) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2 + Count N3) (proj1_sig H18) (fun t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2 + Count N3 => exist (SumEnsembleVS K V W1 W2) match t with | inl (inl t1) => F1 t1 | inl (inr t1) => proj1_sig (proj1_sig (F2 t1)) | inr t0 => proj1_sig (proj1_sig (F3 t0)) end (H19 t)) (proj2_sig H18) H20). exists (fun (t : Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3)) => match proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) N3) t with | inl t => inl (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2) t) | inr t => inr t end). elim (proj2_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) N3)). move=> ginv1 H18. elim (proj2_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2)). move=> ginv2 H19. exists (fun (t : (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2 + Count N3)) => match t with | inl (inl t0) => ginv1 (inl (ginv2 (inl t0))) | inl (inr t0) => ginv1 (inl (ginv2 (inr t0))) | inr t0 => ginv1 (inr t0) end). apply conj. move=> x. apply (BijInj (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3)) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) + Count N3) (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) N3)) (proj2_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) N3))). elim (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) N3) x). move=> x2. apply (BijInj (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) + Count N3) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2 + N3)) ginv1). exists (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2) N3)). apply conj. apply (proj2 H18). apply (proj1 H18). rewrite (proj1 H18). suff: (match proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2) x2 with | inl t0 => ginv2 (inl t0) | inr t0 => ginv2 (inr t0) end = x2). move=> H20. rewrite - {2} H20. elim (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2) x2). move=> x3. reflexivity. move=> x3. reflexivity. apply (BijInj (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 + N2)) (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) + Count N2) (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2)) (proj2_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2))). elim (proj1_sig (H17 (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6) N2) x2). move=> x3. apply (proj2 H19). move=> x3. apply (proj2 H19). move=> x3. apply (proj2 H18). move=> y. elim y. move=> y1. elim y1. move=> y2. rewrite (proj2 H18). rewrite (proj2 H19). reflexivity. move=> y2. rewrite (proj2 H18). rewrite (proj2 H19). reflexivity. move=> y2. rewrite (proj2 H18). reflexivity. move=> N M. suff: (forall (m : Count (N + M)), ~ proj1_sig m < N -> proj1_sig m - N < M). move=> H17. exists (fun (m : Count (N + M)) => match excluded_middle_informative (proj1_sig m < N) with | left H => inl (exist (fun (n : nat) => n < N) (proj1_sig m) H) | right H => inr (exist (fun (n : nat) => n < M) (proj1_sig m - N) (H17 m H)) end). suff: (forall (m : Count N), proj1_sig m < N + M). move=> H18. suff: (forall (m : Count M), N + proj1_sig m < N + M). move=> H19. exists (fun (m : Count N + Count M) => match m with | inl t0 => exist (fun (n : nat) => n < N + M) (proj1_sig t0) (H18 t0) | inr t0 => exist (fun (n : nat) => n < N + M) (N + proj1_sig t0) (H19 t0) end). apply conj. move=> x. elim (excluded_middle_informative (proj1_sig x < N)). move=> H20. apply sig_map. reflexivity. move=> H20. apply sig_map. simpl. apply (Minus.le_plus_minus_r N (proj1_sig x)). elim (le_or_lt N (proj1_sig x)). apply. move=> H21. apply False_ind. apply (H20 H21). move=> y. elim (excluded_middle_informative (proj1_sig match y with | inl t0 => exist (fun n : nat => n < N + M) (proj1_sig t0) (H18 t0) | inr t0 => exist (fun n : nat => n < N + M) (N + proj1_sig t0) (H19 t0) end < N)). elim y. move=> y1 H20. suff: ((exist (fun n : nat => n < N) (proj1_sig (exist (fun n : nat => n < N + M) (proj1_sig y1) (H18 y1))) H20) = y1). move=> H21. rewrite H21. reflexivity. apply sig_map. reflexivity. move=> y1 H20. apply False_ind. apply (lt_irrefl N). apply (le_trans (S N) (S (N + proj1_sig y1)) N). apply (le_n_S N (N + proj1_sig y1) (Plus.le_plus_l N (proj1_sig y1))). apply H20. elim y. move=> y1 H20. apply False_ind. apply (H20 (proj2_sig y1)). move=> y1 H20. suff: ((exist (fun n : nat => n < M) (proj1_sig (exist (fun n : nat => n < N + M) (N + proj1_sig y1) (H19 y1)) - N) (H17 (exist (fun n : nat => n < N + M) (N + proj1_sig y1) (H19 y1)) H20)) = y1). move=> H21. rewrite H21. reflexivity. apply sig_map. simpl. apply (Minus.minus_plus N (proj1_sig y1)). move=> m. apply (Plus.plus_lt_compat_l (proj1_sig m) M N). apply (proj2_sig m). move=> m. apply (le_trans (S (proj1_sig m)) N (N + M) (proj2_sig m) (Plus.le_plus_l N M)). move=> m H17. apply (Plus.plus_lt_reg_l (proj1_sig m - N) M N). rewrite (Minus.le_plus_minus_r N (proj1_sig m)). apply (proj2_sig m). elim (le_or_lt N (proj1_sig m)). apply. move=> H18. apply False_ind. apply (H17 H18). apply (Corollary_4_10 K V W1 W2 H1 H2 H3 H4 (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6)) (Count N2) (Count N3)). apply H11. apply H14. apply H15. suff: (SubspaceVS K V (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W2 H2), In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w)). move=> H15. suff: (W2 = SumEnsembleVS K V (Intersection (VT K V) W1 W2) (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W2 H2), In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w)). move=> H16. suff: (SubspaceVS K V (SumEnsembleVS K V (Intersection (VT K V) W1 W2) (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W2 H2), In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w))). move=> H17. suff: (BasisSubspaceVS K V W2 H2 = BasisSubspaceVS K V (SumEnsembleVS K V (Intersection (VT K V) W1 W2) (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W2 H2), In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w)) H17). move=> H18. rewrite H18. apply (SumEnsembleBasisVS K V (Intersection (VT K V) W1 W2) (fun v : VT K V => exists w : SubspaceMakeVST K V W2 H2, In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w) H3 H15 H17 (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6)) (Count N3)). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v1. elim. move=> v2 H19 H20 H21. suff: (v2 = proj1_sig (exist W2 v2 H20)). move=> H22. rewrite H22. suff: (In (VT K (SubspaceMakeVS K V W2 H2)) (Singleton (VT K (SubspaceMakeVS K V W2 H2)) (VO K (SubspaceMakeVS K V W2 H2))) (exist W2 v2 H20)). elim. apply (In_singleton (VT K V) (VO K V)). rewrite (proj2 (proj2 H10)). apply Intersection_intro. apply Intersection_intro. apply H19. apply H20. elim H21. move=> v3 H23. suff: ((exist W2 v2 H20) = v3). move=> H24. rewrite H24. apply (proj1 H23). apply sig_map. apply (proj2 H23). reflexivity. move=> v. elim. apply Intersection_intro. apply H3. apply H15. apply H11. suff: (forall v : VT K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) W4 (proj1 H10)), In (VT K V) (fun v : VT K V => exists w : SubspaceMakeVST K V W2 H2, In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w) (proj1_sig (proj1_sig v))). move=> H19. exists (fun (t : Count N3) => H19 (F3 t)). apply (IsomorphicSaveBasisVS K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) W4 (proj1 H10)) (SubspaceMakeVS K V (fun v : VT K V => exists w : SubspaceMakeVST K V W2 H2, In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w) H15) (Count N3) F3 (fun v0 : VT K (SubspaceMakeVS K (SubspaceMakeVS K V W2 H2) W4 (proj1 H10)) => exist (fun v : VT K V => exists w : SubspaceMakeVST K V W2 H2, In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w) (proj1_sig (proj1_sig v0)) (H19 v0))). apply conj. apply InjSurjBij. move=> x1 x2 H20. apply sig_map. apply sig_map. suff: (proj1_sig (proj1_sig x1) = proj1_sig (exist (fun v : VT K V => exists w : SubspaceMakeVST K V W2 H2, In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w) (proj1_sig (proj1_sig x1)) (H19 x1))). move=> H21. rewrite H21. rewrite H20. reflexivity. reflexivity. move=> v. elim (proj2_sig v). move=> v1 H20. exists (exist W4 v1 (proj1 H20)). apply sig_map. rewrite {3} (proj2 H20). reflexivity. apply conj. move=> x y. apply sig_map. reflexivity. move=> c x. apply sig_map. reflexivity. apply H13. move=> v. exists (proj1_sig v). apply conj. apply (proj2_sig v). reflexivity. suff: (forall (W1 W2 : Ensemble (VT K V)), W1 = W2 -> forall (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), BasisSubspaceVS K V W1 H1 = BasisSubspaceVS K V W2 H2). move=> H18. apply (H18 W2 (SumEnsembleVS K V (Intersection (VT K V) W1 W2) (fun v : VT K V => exists w : SubspaceMakeVST K V W2 H2, In (SubspaceMakeVST K V W2 H2) W4 w /\ v = proj1_sig w)) H16 H2 H17). move=> W5 W6 H18. rewrite H18. move=> H19 H20. suff: (H19 = H20). move=> H21. rewrite H21. reflexivity. apply proof_irrelevance. rewrite - H16. apply H2. apply Extensionality_Ensembles. apply conj. move=> w H16. suff: (w = proj1_sig (exist W2 w H16)). move=> H17. rewrite H17. suff: (In (VT K (SubspaceMakeVS K V W2 H2)) (Full_set (VT K (SubspaceMakeVS K V W2 H2))) (exist W2 w H16)). rewrite (proj1 (proj2 H10)). elim. move=> u1 u2 H18 H19. apply SumEnsembleVS_intro. apply H18. exists u2. apply conj. apply H19. reflexivity. apply Full_intro. reflexivity. move=> u. elim. move=> u1 u2 H16 H17. apply (proj1 H2 u1 u2). elim H16. move=> u3 H18 H19. apply H19. elim H17. move=> u3 H18. rewrite (proj2 H18). apply (proj2_sig u3). apply conj. move=> v1 v2 H15 H16. elim H15. move=> w1 H17. elim H16. move=> w2 H18. exists (SubspaceMakeVSVadd K V W2 H2 w1 w2). apply conj. apply (proj1 (proj1 H10) w1 w2 (proj1 H17) (proj1 H18)). rewrite (proj2 H17). rewrite (proj2 H18). reflexivity. apply conj. move=> f v. elim. move=> w H15. exists (SubspaceMakeVSVmul K V W2 H2 f w). apply conj. apply (proj1 (proj2 (proj1 H10)) f w (proj1 H15)). rewrite (proj2 H15). reflexivity. exists (SubspaceMakeVSVO K V W2 H2). apply conj. apply (proj2 (proj2 (proj1 H10))). reflexivity. suff: (SubspaceVS K V (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W1 H1), In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w)). move=> H14. suff: (W1 = SumEnsembleVS K V (Intersection (VT K V) W1 W2) (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W1 H1), In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w)). move=> H15. suff: (SubspaceVS K V (SumEnsembleVS K V (Intersection (VT K V) W1 W2) (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W1 H1), In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w))). move=> H16. suff: (BasisSubspaceVS K V W1 H1 = BasisSubspaceVS K V (SumEnsembleVS K V (Intersection (VT K V) W1 W2) (fun (v : VT K V) => exists (w : SubspaceMakeVST K V W1 H1), In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w)) H16). move=> H17. rewrite H17. apply (SumEnsembleBasisVS K V (Intersection (VT K V) W1 W2) (fun v : VT K V => exists w : SubspaceMakeVST K V W1 H1, In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w) H3 H14 H16 (Count (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6)) (Count N2)). apply Extensionality_Ensembles. apply conj. move=> v. elim. move=> v1. elim. move=> v2 H18 H19 H20. suff: (v2 = proj1_sig (exist W1 v2 H18)). move=> H21. rewrite H21. suff: (In (VT K (SubspaceMakeVS K V W1 H1)) (Singleton (VT K (SubspaceMakeVS K V W1 H1)) (VO K (SubspaceMakeVS K V W1 H1))) (exist W1 v2 H18)). elim. apply (In_singleton (VT K V) (VO K V)). rewrite (proj2 (proj2 H9)). apply Intersection_intro. apply Intersection_intro. apply H18. apply H19. elim H20. move=> v3 H22. suff: ((exist W1 v2 H18) = v3). move=> H23. rewrite H23. apply (proj1 H22). apply sig_map. apply (proj2 H22). reflexivity. move=> v. elim. apply Intersection_intro. apply H3. apply H14. apply H11. suff: (forall v : VT K (SubspaceMakeVS K (SubspaceMakeVS K V W1 H1) W3 (proj1 H9)), In (VT K V) (fun v : VT K V => exists w : SubspaceMakeVST K V W1 H1, In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w) (proj1_sig (proj1_sig v))). move=> H18. exists (fun (t : Count N2) => H18 (F2 t)). apply (IsomorphicSaveBasisVS K (SubspaceMakeVS K (SubspaceMakeVS K V W1 H1) W3 (proj1 H9)) (SubspaceMakeVS K V (fun v : VT K V => exists w : SubspaceMakeVST K V W1 H1, In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w) H14) (Count N2) F2 (fun v0 : VT K (SubspaceMakeVS K (SubspaceMakeVS K V W1 H1) W3 (proj1 H9)) => exist (fun v : VT K V => exists w : SubspaceMakeVST K V W1 H1, In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w) (proj1_sig (proj1_sig v0)) (H18 v0))). apply conj. apply InjSurjBij. move=> x1 x2 H19. apply sig_map. apply sig_map. suff: (proj1_sig (proj1_sig x1) = proj1_sig (exist (fun v : VT K V => exists w : SubspaceMakeVST K V W1 H1, In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w) (proj1_sig (proj1_sig x1)) (H18 x1))). move=> H20. rewrite H20. rewrite H19. reflexivity. reflexivity. move=> v. elim (proj2_sig v). move=> v1 H19. exists (exist W3 v1 (proj1 H19)). apply sig_map. rewrite {3} (proj2 H19). reflexivity. apply conj. move=> x y. apply sig_map. reflexivity. move=> c x. apply sig_map. reflexivity. apply H12. move=> v. exists (proj1_sig v). apply conj. apply (proj2_sig v). reflexivity. suff: (forall (W1 W2 : Ensemble (VT K V)), W1 = W2 -> forall (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), BasisSubspaceVS K V W1 H1 = BasisSubspaceVS K V W2 H2). move=> H17. apply (H17 W1 (SumEnsembleVS K V (Intersection (VT K V) W1 W2) (fun v : VT K V => exists w : SubspaceMakeVST K V W1 H1, In (SubspaceMakeVST K V W1 H1) W3 w /\ v = proj1_sig w)) H15 H1 H16). move=> W5 W6 H17. rewrite H17. move=> H18 H19. suff: (H18 = H19). move=> H20. rewrite H20. reflexivity. apply proof_irrelevance. rewrite - H15. apply H1. apply Extensionality_Ensembles. apply conj. move=> w H15. suff: (w = proj1_sig (exist W1 w H15)). move=> H16. rewrite H16. suff: (In (VT K (SubspaceMakeVS K V W1 H1)) (Full_set (VT K (SubspaceMakeVS K V W1 H1))) (exist W1 w H15)). rewrite (proj1 (proj2 H9)). elim. move=> u1 u2 H17 H18. apply SumEnsembleVS_intro. apply H17. exists u2. apply conj. apply H18. reflexivity. apply Full_intro. reflexivity. move=> u. elim. move=> u1 u2 H15 H16. apply (proj1 H1 u1 u2). elim H15. move=> u3 H17 H18. apply H17. elim H16. move=> u3 H17. rewrite (proj2 H17). apply (proj2_sig u3). apply conj. move=> v1 v2 H14 H15. elim H14. move=> w1 H16. elim H15. move=> w2 H17. exists (SubspaceMakeVSVadd K V W1 H1 w1 w2). apply conj. apply (proj1 (proj1 H9) w1 w2 (proj1 H16) (proj1 H17)). rewrite (proj2 H16). rewrite (proj2 H17). reflexivity. apply conj. move=> f v. elim. move=> w H14. exists (SubspaceMakeVSVmul K V W1 H1 f w). apply conj. apply (proj1 (proj2 (proj1 H9)) f w (proj1 H14)). rewrite (proj2 H14). reflexivity. exists (SubspaceMakeVSVO K V W1 H1). apply conj. apply (proj2 (proj2 (proj1 H9))). reflexivity. apply conj. move=> v1 v2 H10 H11. apply (proj1 H3 (proj1_sig v1) (proj1_sig v2) H10 H11). apply conj. move=> f v H10. apply (proj1 (proj2 H3) f (proj1_sig v) H10). apply (proj2 (proj2 H3)). apply H8. apply conj. move=> v1 v2 H9 H10. apply (proj1 H3 (proj1_sig v1) (proj1_sig v2) H9 H10). apply conj. move=> f v H9. apply (proj1 (proj2 H3) f (proj1_sig v) H9). apply (proj2 (proj2 H3)). apply H7. Qed. Lemma DimensionSumEnsembleVS_exists : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), exists (H3 : SubspaceVS K V (Intersection (VT K V) W1 W2)) (H4 : SubspaceVS K V (SumEnsembleVS K V W1 W2)), forall (H5 : FiniteDimensionVS K (SubspaceMakeVS K V (SumEnsembleVS K V W1 W2) H4)), exists (H6 : FiniteDimensionVS K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) H3)) (H7 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)) (H8 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), DimensionSubspaceVS K V (SumEnsembleVS K V W1 W2) H4 H5 + DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H3 H6 = DimensionSubspaceVS K V W1 H1 H7 + DimensionSubspaceVS K V W2 H2 H8. Proof. move=> K V W1 W2 H1 H2. exists (IntersectionSubspaceVS K V W1 W2 H1 H2). exists (SumSubspaceVS K V W1 W2 H1 H2). move=> H3. suff: (FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)). move=> H4. suff: (FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)). move=> H5. suff: (FiniteDimensionVS K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) (IntersectionSubspaceVS K V W1 W2 H1 H2))). move=> H6. exists H6. exists H4. exists H5. apply (DimensionSumEnsembleVS K V W1 W2 H1 H2 (IntersectionSubspaceVS K V W1 W2 H1 H2) (SumSubspaceVS K V W1 W2 H1 H2) H3 H6 H4 H5). apply (Proposition_5_9_1_1_subspace K V (Intersection (VT K V) W1 W2) W1 (IntersectionSubspaceVS K V W1 W2 H1 H2) H1). move=> v. elim. move=> w H6 H7. apply H6. apply H4. apply (Proposition_5_9_1_1_subspace K V W2 (SumEnsembleVS K V W1 W2) H2 (SumSubspaceVS K V W1 W2 H1 H2)). move=> w H5. rewrite - (Vadd_O_l K V w). apply (SumEnsembleVS_intro K V W1 W2 (VO K V) w (proj2 (proj2 H1)) H5). apply H3. apply (Proposition_5_9_1_1_subspace K V W1 (SumEnsembleVS K V W1 W2) H1 (SumSubspaceVS K V W1 W2 H1 H2)). move=> w H5. rewrite - (Vadd_O_r K V w). apply (SumEnsembleVS_intro K V W1 W2 w (VO K V) H5 (proj2 (proj2 H2))). apply H3. Qed. Lemma DimensionSumEnsembleVS2 : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2) (H3 : SubspaceVS K V (SumEnsembleVS K V W1 W2)) (H4 : FiniteDimensionVS K (SubspaceMakeVS K V (SumEnsembleVS K V W1 W2) H3)) (H5 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)) (H6 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), Intersection (VT K V) W1 W2 = Singleton (VT K V) (VO K V) -> DimensionSubspaceVS K V (SumEnsembleVS K V W1 W2) H3 H4 = DimensionSubspaceVS K V W1 H1 H5 + DimensionSubspaceVS K V W2 H2 H6. Proof. move=> K V W1 W2 H1 H2 H3 H4 H5 H6 H7. suff: (SubspaceVS K V (Intersection (VT K V) W1 W2)). move=> H8. suff: (FiniteDimensionVS K (SubspaceMakeVS K V (Intersection (VT K V) W1 W2) H8)). move=> H9. rewrite - (DimensionSumEnsembleVS K V W1 W2 H1 H2 H8 H3 H4 H9 H5 H6). elim (VOSubspaceVSDimension K V). move=> H10 H11. suff: (DimensionSubspaceVS K V (Intersection (VT K V) W1 W2) H8 H9 = DimensionSubspaceVS K V (Singleton (VT K V) (VO K V)) (VOSubspaceVS K V) H10). move=> H12. rewrite H12. rewrite H11. rewrite (Plus.plus_0_r (DimensionSubspaceVS K V (SumEnsembleVS K V W1 W2) H3 H4)). reflexivity. suff: (forall (W1 W2 : Ensemble (VT K V)), W1 = W2 -> forall (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2) (H3 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)) (H4 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), DimensionSubspaceVS K V W1 H1 H3 = DimensionSubspaceVS K V W2 H2 H4). move=> H12. apply (H12 (Intersection (VT K V) W1 W2) (Singleton (VT K V) (VO K V)) H7 H8 (VOSubspaceVS K V) H9 H10). move=> W3 W4 H12. rewrite H12. move=> H13 H14. suff: (H13 = H14). move=> H15. rewrite H15. move=> H16 H17. suff: (H16 = H17). move=> H18. rewrite H18. reflexivity. apply proof_irrelevance. apply proof_irrelevance. suff: (forall (W1 W2 : Ensemble (VT K V)), W1 = W2 -> forall (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), FiniteDimensionVS K (SubspaceMakeVS K V W1 H1) = FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)). move=> H9. rewrite (H9 (Intersection (VT K V) W1 W2) (Singleton (VT K V) (VO K V)) H7 H8 (VOSubspaceVS K V)). elim (VOSubspaceVSDimension K V). move=> H10 H11. apply H10. move=> W3 W4 H9. rewrite H9. move=> H10 H11. suff: (H10 = H11). move=> H12. rewrite H12. reflexivity. apply proof_irrelevance. apply (IntersectionSubspaceVS K V W1 W2 H1 H2). Qed. Lemma DimensionSumEnsembleVS2_exists : forall (K : Field) (V : VectorSpace K) (W1 W2 : Ensemble (VT K V)) (H1 : SubspaceVS K V W1) (H2 : SubspaceVS K V W2), exists (H3 : SubspaceVS K V (SumEnsembleVS K V W1 W2)), forall (H4 : FiniteDimensionVS K (SubspaceMakeVS K V (SumEnsembleVS K V W1 W2) H3)), exists (H5 : FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)) (H6 : FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)), Intersection (VT K V) W1 W2 = Singleton (VT K V) (VO K V) -> DimensionSubspaceVS K V (SumEnsembleVS K V W1 W2) H3 H4 = DimensionSubspaceVS K V W1 H1 H5 + DimensionSubspaceVS K V W2 H2 H6. Proof. move=> K V W1 W2 H1 H2. exists (SumSubspaceVS K V W1 W2 H1 H2). move=> H3. suff: (FiniteDimensionVS K (SubspaceMakeVS K V W1 H1)). move=> H4. suff: (FiniteDimensionVS K (SubspaceMakeVS K V W2 H2)). move=> H5. exists H4. exists H5. move=> H6. apply (DimensionSumEnsembleVS2 K V W1 W2 H1 H2 (SumSubspaceVS K V W1 W2 H1 H2) H3 H4 H5 H6). apply (Proposition_5_9_1_1_subspace K V W2 (SumEnsembleVS K V W1 W2) H2 (SumSubspaceVS K V W1 W2 H1 H2)). move=> w H5. rewrite - (Vadd_O_l K V w). apply (SumEnsembleVS_intro K V W1 W2 (VO K V) w (proj2 (proj2 H1)) H5). apply H3. apply (Proposition_5_9_1_1_subspace K V W1 (SumEnsembleVS K V W1 W2) H1 (SumSubspaceVS K V W1 W2 H1 H2)). move=> w H5. rewrite - (Vadd_O_r K V w). apply (SumEnsembleVS_intro K V W1 W2 w (VO K V) H5 (proj2 (proj2 H2))). apply H3. Qed. End Senkeidaisuunosekai1.
theory Lift_Fst imports "../Lifter" begin (* * fst *) definition fst_l :: "('x, 'a, 'b1 :: Pord_Weak) lifting \<Rightarrow> ('x, 'a, 'b1 * ('b2 :: Pord_Weakb)) lifting" where "fst_l t = LMake (\<lambda> s a b . (case b of (b1, b2) \<Rightarrow> (LUpd t s a b1, b2))) (\<lambda> s x . (LOut t s (fst x))) (\<lambda> s . (LBase t s, \<bottom>))" definition fst_l_S :: "('x, 'b1 :: Pord_Weak) valid_set \<Rightarrow> ('x, ('b1 * 'b2 :: Pord_Weakb)) valid_set" where "fst_l_S S s = { b . case b of (b1, _) \<Rightarrow> (b1 \<in> S s) }" locale fst_l_valid_weak = lifting_valid_weak sublocale fst_l_valid_weak \<subseteq> out:lifting_valid_weak "fst_l l" "fst_l_S S" proof fix s a fix b :: "('c :: Pord_Weak) * ('e :: Pord_Weakb)" show "LOut (fst_l l) s (LUpd (fst_l l) s a b) = a" using put_get by(auto simp add: fst_l_def split:prod.splits) next fix s fix b :: "('c :: Pord_Weak) * ('e :: Pord_Weakb)" assume Hb : "b \<in> fst_l_S S s" thus "b <[ LUpd (fst_l l) s (LOut (fst_l l) s b) b" using get_put_weak by(auto simp add: fst_l_def prod_pleq leq_refl fst_l_S_def split:prod.splits) next fix s a fix b :: "('c :: Pord_Weak) * ('e :: Pord_Weakb)" show "LUpd (fst_l l) s a b \<in> fst_l_S S s" using put_S by(auto simp add: fst_l_def prod_pleq leq_refl fst_l_S_def split:prod.splits) qed lemma (in fst_l_valid_weak) ax: shows "lifting_valid_weak (fst_l l) (fst_l_S S)" using out.lifting_valid_weak_axioms by auto lemma (in fst_l_valid_weak) ax_g : assumes H : "\<And> x . S' x = fst_l_S S x" shows "lifting_valid_weak (fst_l l) S'" proof- have "S' = fst_l_S S" using assms by auto then show ?thesis using out.lifting_valid_weak_axioms assms by auto qed locale fst_l_valid_ext = lifting_valid_ext sublocale fst_l_valid_ext \<subseteq> out : lifting_valid_ext "fst_l l" "fst_l_S S" proof fix s a fix b :: "('c :: Pord_Weak) * ('e :: Pord_Weakb)" (*assume Hb : "b \<in> fst_l_S S s"*) show "b <[ LUpd (fst_l l) s a b" using get_put by(auto simp add: fst_l_def prod_pleq fst_l_S_def leq_refl split:prod.splits) qed lemma (in fst_l_valid_ext) ax: shows "lifting_valid_ext (fst_l l)" using out.lifting_valid_ext_axioms by auto locale fst_l_valid_base_ext = lifting_valid_base_ext sublocale fst_l_valid_base_ext \<subseteq> out : lifting_valid_base_ext "fst_l l" "fst_l_S S" proof fix s show "LBase (fst_l l) s = \<bottom>" using base by(auto simp add: fst_l_def prod_bot) qed lemma (in fst_l_valid_base_ext) ax : shows "lifting_valid_base_ext (fst_l l)" using out.lifting_valid_base_ext_axioms by auto locale fst_l_valid_ok_ext = lifting_valid_ok_ext sublocale fst_l_valid_ok_ext \<subseteq> out : lifting_valid_ok_ext "fst_l l" "fst_l_S S" proof fix s show "ok_S \<subseteq> fst_l_S S s" using ok_S_valid by(auto simp add: prod_ok_S fst_l_S_def) next fix s a fix b :: "('c * 'd)" assume B: "b \<in> ok_S" then show "LUpd (fst_l l) s a b \<in> ok_S" using ok_S_put by(auto simp add: fst_l_def prod_ok_S) qed lemma (in fst_l_valid_ok_ext) ax : shows "lifting_valid_ok_ext (fst_l l) (fst_l_S S)" using out.lifting_valid_ok_ext_axioms by auto lemma (in fst_l_valid_ok_ext) ax_g : assumes H: "\<And> x . S' x = fst_l_S S x" shows "lifting_valid_ok_ext (fst_l l) S'" proof- have "S' = fst_l_S S" using assms by auto then show ?thesis using out.lifting_valid_ok_ext_axioms assms by auto qed locale fst_l_valid_pres_ext = lifting_valid_pres_ext sublocale fst_l_valid_pres_ext \<subseteq> out : lifting_valid_pres_ext "fst_l l" "fst_l_S S" proof fix v supr :: "('c * 'd)" fix V f s assume HV : "v \<in> V" assume HS : "V \<subseteq> fst_l_S S s" assume Hsupr : "is_sup V supr" assume Hsupr_S : "supr \<in> fst_l_S S s" show "is_sup (LMap (fst_l l) f s ` V) (LMap (fst_l l) f s supr)" proof(rule is_supI) fix x assume Xin : "x \<in> LMap (fst_l l) f s ` V" obtain x1 x2 where X: "x = (x1, x2)" by(cases x; auto) obtain xi xi1 xi2 where Xi : "xi = (xi1, xi2)" "xi \<in> V" "LMap (fst_l l) f s xi = x" using Xin by auto obtain supr1 supr2 where Supr : "supr = (supr1, supr2)" by(cases supr; auto) have "xi <[ supr" using is_supD1[OF Hsupr Xi(2)] by simp hence "xi1 <[ supr1" "xi2 <[ supr2" using Xi Supr by(auto simp add: prod_pleq split: prod.splits) have "x2 = xi2" using Xi X by(cases l; auto simp add: fst_l_def) have "x1 = LMap l f s xi1" using Xi X by(cases l; auto simp add: fst_l_def) have "LMap (fst_l l) f s supr = (LMap l f s supr1, supr2)" using Supr by(cases l; auto simp add: fst_l_def) have Xi1_in : "xi1 \<in> fst ` V" using imageI[OF `xi \<in> V`, of fst] Xi by(auto simp add: fst_l_S_def) have Fst_V_sub : "fst ` V \<subseteq> S s" using HS by(auto simp add: fst_l_S_def) have "supr1 \<in> S s" using Hsupr_S Supr by(auto simp add: fst_l_S_def) have Supr1_sup : "is_sup (fst ` V) supr1" proof(rule is_supI) fix w1 assume "w1 \<in> fst ` V" then obtain w2 where "(w1, w2) \<in> V" by auto hence "(w1, w2) <[ supr" using is_supD1[OF Hsupr, of "(w1, w2)"] by auto thus "w1 <[ supr1" using Supr by(auto simp add: prod_pleq) next fix z1 assume Hub : "is_ub (fst ` V) z1" have "is_ub V (z1, supr2)" proof(rule is_ubI) fix w assume "w \<in> V" obtain w1 w2 where W: "w = (w1, w2)" by(cases w; auto) have "w1 \<in> (fst ` V)" using imageI[OF `w \<in> V`, of fst] W by auto hence "w1 <[ z1" using is_ubE[OF Hub] by auto have "w2 <[ supr2" using is_supD1[OF Hsupr `w \<in> V`] Supr W by(auto simp add: prod_pleq) then show "w <[ (z1, supr2)" using W `w1 <[ z1` by(auto simp add: prod_pleq) qed show "supr1 <[ z1" using is_supD2[OF Hsupr `is_ub V (z1, supr2)`] Supr by(auto simp add: prod_pleq) qed have Supr1_map : "is_sup (LMap l f s ` fst ` V) (LMap l f s supr1)" using pres using pres[OF Xi1_in Fst_V_sub Supr1_sup `supr1 \<in> S s` , of f] by simp have X1_in : "x1 \<in> LMap l f s ` fst ` V" using X Xi imageI[OF `xi \<in> V`, of fst] by(cases l; auto simp add: fst_l_def) have "x1 <[ LMap l f s supr1" using is_supD1[OF Supr1_map X1_in] by simp have "x2 <[ supr2" using `x2 = xi2` `xi2 <[ supr2` by simp then show "x <[ LMap (fst_l l) f s supr" using X Supr `x1 <[ LMap l f s supr1` by(cases l; auto simp add: fst_l_def prod_pleq) next fix x assume Xub : "is_ub (LMap (fst_l l) f s ` V) x" obtain supr1 supr2 where Supr : "supr = (supr1, supr2)" by(cases supr; auto) (* TODO: copy-pasted from first case *) have "LMap (fst_l l) f s supr = (LMap l f s supr1, supr2)" using Supr by(cases l; auto simp add: fst_l_def) have Fst_V_sub : "fst ` V \<subseteq> S s" using HS by(auto simp add: fst_l_S_def) have "supr1 \<in> S s" using Hsupr_S Supr by(auto simp add: fst_l_S_def) have Supr1_sup : "is_sup (fst ` V) supr1" proof(rule is_supI) fix w1 assume "w1 \<in> fst ` V" then obtain w2 where "(w1, w2) \<in> V" by auto hence "(w1, w2) <[ supr" using is_supD1[OF Hsupr, of "(w1, w2)"] by auto thus "w1 <[ supr1" using Supr by(auto simp add: prod_pleq) next fix z1 assume Hub : "is_ub (fst ` V) z1" have "is_ub V (z1, supr2)" proof(rule is_ubI) fix w assume "w \<in> V" obtain w1 w2 where W: "w = (w1, w2)" by(cases w; auto) have "w1 \<in> (fst ` V)" using imageI[OF `w \<in> V`, of fst] W by auto hence "w1 <[ z1" using is_ubE[OF Hub] by auto have "w2 <[ supr2" using is_supD1[OF Hsupr `w \<in> V`] Supr W by(auto simp add: prod_pleq) then show "w <[ (z1, supr2)" using W `w1 <[ z1` by(auto simp add: prod_pleq) qed show "supr1 <[ z1" using is_supD2[OF Hsupr `is_ub V (z1, supr2)`] Supr by(auto simp add: prod_pleq) qed obtain v1 v2 where V : "v = (v1, v2)" "v1 \<in> fst ` V" using imageI[OF HV, of fst] by(cases v; auto) have Supr1_map : "is_sup (LMap l f s ` fst ` V) (LMap l f s supr1)" using pres[OF V(2) Fst_V_sub Supr1_sup `supr1 \<in> S s` ] by simp obtain x1 x2 where X: "x = (x1, x2)" by(cases x; auto) have X1_ub : "is_ub (LMap l f s ` fst ` V) x1" proof fix w1 assume W1: "w1 \<in> LMap l f s ` fst ` V" then obtain wi wi1 wi2 where Wi : "wi \<in> V" "LMap l f s wi1 = w1" "wi = (wi1, wi2)" by(auto) have Wi_in : "LMap (fst_l l) f s wi \<in> LMap (fst_l l) f s ` V" using imageI[OF Wi(1), of "LMap (fst_l l) f s"] by simp have "LMap (fst_l l) f s wi <[ x" using is_ubE[OF Xub Wi_in] by simp then show "w1 <[ x1" using W1 Wi X by(cases l; auto simp add: prod_pleq fst_l_def) qed have "LMap l f s supr1 <[ x1" using is_supD2[OF Supr1_map X1_ub] by simp have "is_ub V (supr1, x2)" proof(rule is_ubI) fix w assume Win : "w \<in> V" obtain w1 w2 where W: "w = (w1, w2)" by(cases w; auto) have W1_in : "w1 \<in> fst ` V" using imageI[OF Win, of fst] W by simp have "w1 <[ supr1" using is_supD1[OF Supr1_sup W1_in] by simp have "LMap (fst_l l) f s w <[ x" using is_ubE[OF Xub imageI[OF Win]] by simp hence "w2 <[ x2" using W X by(cases l; auto simp add: fst_l_def prod_pleq) show "w <[ (supr1, x2)" using `w1 <[ supr1` `w2 <[ x2` W by(auto simp add: prod_pleq) qed have "supr2 <[ x2" using is_supD2[OF Hsupr `is_ub V (supr1, x2)`] Supr by(auto simp add: prod_pleq) show "LMap (fst_l l) f s supr <[ x" using `LMap l f s supr1 <[ x1` `supr2 <[ x2` X Supr by(cases l; auto simp add: fst_l_def prod_pleq) qed qed lemma (in fst_l_valid_pres_ext) ax : shows "lifting_valid_pres_ext (fst_l l) (fst_l_S S)" using out.lifting_valid_pres_ext_axioms by auto lemma (in fst_l_valid_pres_ext) ax_g : assumes H: "\<And> x . S' x = fst_l_S S x" shows "lifting_valid_pres_ext (fst_l l) S'" proof- have "S' = fst_l_S S" using assms by auto then show ?thesis using out.lifting_valid_pres_ext_axioms by auto qed locale fst_l_valid_base_pres_ext = fst_l_valid_pres_ext + fst_l_valid_base_ext + lifting_valid_base_pres_ext sublocale fst_l_valid_base_pres_ext \<subseteq> out : lifting_valid_base_pres_ext "fst_l l" "fst_l_S S" proof fix s show "\<bottom> \<notin> fst_l_S S s" using bot_bad[of s] by(auto simp add: fst_l_S_def prod_bot) qed lemma (in fst_l_valid_base_pres_ext) ax : shows "lifting_valid_base_pres_ext (fst_l l) (fst_l_S S)" using out.lifting_valid_base_pres_ext_axioms by auto lemma (in fst_l_valid_base_pres_ext) ax_g : assumes H : "\<And> x . S' x = fst_l_S S x" shows "lifting_valid_base_pres_ext (fst_l l) S'" proof- have "S' = fst_l_S S" using assms by auto then show ?thesis using out.lifting_valid_base_pres_ext_axioms by auto qed locale fst_l_ortho = l_ortho sublocale fst_l_ortho \<subseteq> out : l_ortho "fst_l l1" "fst_l_S S1" "fst_l l2" "fst_l_S S2" proof fix s show "LBase (fst_l l1) s = LBase (fst_l l2) s" using eq_base by(auto simp add: fst_l_def) next fix b :: "'c * 'e" fix s fix a1 :: 'b fix a2 :: 'd obtain b1 b2 where B: "b = (b1, b2)" by(cases b; auto) have Compat1 : "LUpd l1 s a1 (LUpd l2 s a2 b1) = LUpd l2 s a2 (LUpd l1 s a1 b1)" using compat[of s a1 a2 b1] by(auto) then show "LUpd (fst_l l1) s a1 (LUpd (fst_l l2) s a2 b) = LUpd (fst_l l2) s a2 (LUpd (fst_l l1) s a1 b)" using B by(auto simp add: fst_l_def) next fix b :: "('c * 'e)" fix a1 fix s obtain b1 b2 where B: "b = (b1, b2)" by(cases b; auto) have Compat1 : "LOut l2 s (LUpd l1 s a1 b1) = LOut l2 s b1" using put1_get2 by auto then show "LOut (fst_l l2) s (LUpd (fst_l l1) s a1 b) = LOut (fst_l l2) s b" using B by (auto simp add: fst_l_def) next fix b :: "('c * 'e)" fix s a2 obtain b1 b2 where B: "b = (b1, b2)" by(cases b; auto) have Compat1 : "LOut l1 s (LUpd l2 s a2 b1) = LOut l1 s b1" using put2_get1 by auto then show "LOut (fst_l l1) s (LUpd (fst_l l2) s a2 b) = LOut (fst_l l1) s b" using B by(auto simp add: fst_l_def) next fix b :: "'c * 'e" fix s a1 assume B_in : "b \<in> fst_l_S S2 s" then obtain b1 b2 where B : "b = (b1, b2)" "b1 \<in> S2 s" by(auto simp add: fst_l_S_def) have Compat1 : "LUpd l1 s a1 b1 \<in> S2 s" using put1_S2[OF B(2)] by auto then show "LUpd (fst_l l1) s a1 b \<in> fst_l_S S2 s" using B by(auto simp add: fst_l_def fst_l_S_def) next fix b :: "'c * 'e" fix s a2 assume B_in : "b \<in> fst_l_S S1 s" then obtain b1 b2 where B : "b = (b1, b2)" "b1 \<in> S1 s" by(auto simp add: fst_l_S_def) have Compat2 : "LUpd l2 s a2 b1 \<in> S1 s" using put2_S1[OF B(2)] by auto then show "LUpd (fst_l l2) s a2 b \<in> fst_l_S S1 s" using B by(auto simp add: fst_l_def fst_l_S_def) qed lemma (in fst_l_ortho) ax : shows "l_ortho (fst_l l1) (fst_l_S S1) (fst_l l2) (fst_l_S S2)" using out.l_ortho_axioms by auto lemma (in fst_l_ortho) ax_g : assumes H1 : "\<And> x . S'1 x = fst_l_S S1 x" assumes H2 : "\<And> x . S'2 x = fst_l_S S2 x" shows "l_ortho (fst_l l1) S'1 (fst_l l2) S'2" proof- have H1' : "S'1 = fst_l_S S1" using H1 by auto have H2' : "S'2 = fst_l_S S2" using H2 by auto show ?thesis using ax unfolding H1' H2' by auto qed locale fst_l_ortho_base_ext = l_ortho_base_ext sublocale fst_l_ortho_base_ext \<subseteq> out : l_ortho_base_ext "fst_l l1" "fst_l l2" proof fix s show "LBase (fst_l l1) s = \<bottom>" using compat_base1 by(auto simp add: fst_l_def prod_bot) fix s show "LBase (fst_l l2) s = \<bottom>" using compat_base2 by(auto simp add: fst_l_def prod_bot) qed lemma (in fst_l_ortho_base_ext) ax : shows "l_ortho_base_ext (fst_l l1) (fst_l l2)" using out.l_ortho_base_ext_axioms by auto locale fst_l_ortho_ok_ext = l_ortho_ok_ext sublocale fst_l_ortho_ok_ext \<subseteq> out : l_ortho_ok_ext "fst_l l1" "fst_l l2" . (* locale fst_l_ortho_pres = l_ortho_pres_ext sublocale fst_l_ortho_pres \<subseteq> l_ortho_pres "fst_l l1" "fst_l_S S1" "fst_l l2" "fst_l_S S2" proof fix a1 a2 s fix x :: "('c * 'e)" obtain x1 x2 where X : "x = (x1, x2)" by(cases x; auto) have Sup : "is_sup {LUpd (l1) s a1 x1, LUpd (l2) s a2 x1} (LUpd (l1) s a1 (LUpd (l2) s a2 x1))" using compat_pres_sup by auto have Conc' : "is_sup ((\<lambda>w. (w, x2)) ` {LUpd l1 s a1 x1, LUpd l2 s a2 x1}) (LUpd l1 s a1 (LUpd l2 s a2 x1), x2)" using is_sup_fst[OF _ Sup] by auto then show "is_sup {LUpd (fst_l l1) s a1 x, LUpd (fst_l l2) s a2 x} (LUpd (fst_l l1) s a1 (LUpd (fst_l l2) s a2 x))" using X by(auto simp add: fst_l_def) qed *) end
By early spring of 1794 , the situation in France was dire . With famine looming after the failure of the harvest and the blockade of French ports and trade , the French government was forced to look overseas for sustenance . Turning to France 's colonies in the Americas , and the agricultural bounty of the United States , the National Convention gave orders for the formation of a large convoy of sailing vessels to gather at Hampton Roads in the Chesapeake Bay , where Admiral Vanstabel would wait for them . According to contemporary historian William James this conglomeration of ships was said to be over 350 strong , although he disputes this figure , citing the number as 117 ( in addition to the French warships ) .
C ---- SPES.F INTEGER*2 HIGH8(5) COMMON /SPES/ HIGH8
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once #include <algorithm> #include <boost/iostreams/categories.hpp> #include <gsl/gsl> #include <iosfwd> #include <vector> namespace mira { class memory_device { public: using char_type = char; using category = boost::iostreams::seekable_device_tag; memory_device(std::vector<char>& memory, std::streamoff pos) : m_pos{ pos } , m_memory{ memory } {} std::streamoff position() const { return m_pos; } void reset() { m_pos = 0; } std::streamsize read(char* s, std::streamsize n) { // Read up to n characters from the underlying data source // into the buffer s, returning the number of characters // read; return -1 to indicate EOF std::streamsize read = std::min<std::streamsize>(m_memory.size() - m_pos, n); if (read == 0) return -1; std::copy(pointer(), pointer() + gsl::narrow_cast<ptrdiff_t>(read), s); m_pos += read; return read; } std::streamsize write(const char* s, std::streamsize n) { // Write up to n characters to the underlying // data sink into the buffer s, returning the // number of characters written std::streamsize written = 0ll; if (m_pos != gsl::narrow<std::streamoff>(m_memory.size())) { written = std::min<std::streamsize>(n, m_memory.size() - m_pos); std::copy(s, s + gsl::narrow_cast<ptrdiff_t>(written), m_memory.begin() + gsl::narrow_cast<ptrdiff_t>(m_pos)); m_pos += written; } if (written < n) { m_memory.insert(m_memory.end(), s + written, s + n); m_pos = gsl::narrow<std::streamoff>(m_memory.size()); } return n; } std::streamoff seek(std::streamoff off, std::ios_base::seekdir way) { // Seek to position off and return the new stream // position. The argument way indicates how off is // interpretted: // - std::ios_base::beg indicates an offset from the // sequence beginning // - std::ios_base::cur indicates an offset from the // current character position // - std::ios_base::end indicates an offset from the // sequence end std::streamoff next; if (way == std::ios_base::beg) { next = off; } else if (way == std::ios_base::cur) { next = m_pos + off; } else if (way == std::ios_base::end) { next = m_memory.size() + off - 1; } else { throw std::ios_base::failure("bad seek direction"); } // Check for errors if (next < 0 || next > gsl::narrow<std::streamoff>(m_memory.size())) { throw std::ios_base::failure("bad seek offset"); } m_pos = next; return m_pos; } private: char* pointer() { return &m_memory[gsl::narrow_cast<ptrdiff_t>(m_pos)]; } std::streamoff m_pos{0}; std::vector<char>& m_memory; }; }
function countingsort!(v::Vector{<:Integer}) mini, maxi = extrema(v) keys = zeros(Int, maxi-mini+1) for key in v keys[key-mini+1] += 1 end i = 1 for (key, amount) in enumerate(keys) v[i:i+amount-1] .= key+mini-1 i += amount end return v end v = [144, 89, 4, 9, 95, 12, 86, 25] println("unsorted array = ",v) countingsort!(v) println("counting sorted array = ", v)
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import cohomology.ChainComplex open import cohomology.Theory open import groups.KernelImage open import cw.CW module cw.cohomology.ReconstructedZerothCohomologyGroup {i : ULevel} (OT : OrdinaryTheory i) where open OrdinaryTheory OT import cw.cohomology.TipCoboundary OT as TC import cw.cohomology.TipAndAugment OT as TAA open import cw.cohomology.Descending OT open import cw.cohomology.ReconstructedCochainComplex OT import cw.cohomology.ZerothCohomologyGroup OT as ZCG import cw.cohomology.ZerothCohomologyGroupOnDiag OT as ZCGD private ≤-dec-has-all-paths : {m n : ℕ} → has-all-paths (Dec (m ≤ n)) ≤-dec-has-all-paths = prop-has-all-paths (Dec-level ≤-is-prop) private abstract zeroth-cohomology-group-descend : ∀ {n} (⊙skel : ⊙Skeleton {i} (2 + n)) → cohomology-group (cochain-complex ⊙skel) 0 == cohomology-group (cochain-complex (⊙cw-init ⊙skel)) 0 zeroth-cohomology-group-descend {n = O} ⊙skel = ap (λ δ → Ker/Im δ (TAA.cw-coε (⊙cw-take (lteSR lteS) ⊙skel)) (TAA.C2×CX₀-is-abelian (⊙cw-take (lteSR lteS) ⊙skel) 0)) (coboundary-first-template-descend-from-two ⊙skel) zeroth-cohomology-group-descend {n = S n} ⊙skel = ap (λ δ → Ker/Im δ (TAA.cw-coε (⊙cw-take (inr (O<S (2 + n))) ⊙skel)) (TAA.C2×CX₀-is-abelian (⊙cw-take (inr (O<S (2 + n))) ⊙skel) 0)) (coboundary-first-template-descend-from-far ⊙skel (O<S (1 + n)) (<-+-l 1 (O<S n))) zeroth-cohomology-group-β : ∀ (⊙skel : ⊙Skeleton {i} 1) → cohomology-group (cochain-complex ⊙skel) 0 == Ker/Im (TC.cw-co∂-head ⊙skel) (TAA.cw-coε (⊙cw-init ⊙skel)) (TAA.C2×CX₀-is-abelian (⊙cw-init ⊙skel) 0) zeroth-cohomology-group-β ⊙skel = ap (λ δ → Ker/Im δ (TAA.cw-coε (⊙cw-init ⊙skel)) (TAA.C2×CX₀-is-abelian (⊙cw-init ⊙skel) 0)) (coboundary-first-template-β ⊙skel) abstract zeroth-cohomology-group : ∀ {n} (⊙skel : ⊙Skeleton {i} n) → ⊙has-cells-with-choice 0 ⊙skel i → C 0 ⊙⟦ ⊙skel ⟧ ≃ᴳ cohomology-group (cochain-complex ⊙skel) 0 zeroth-cohomology-group {n = 0} ⊙skel ac = ZCGD.C-cw-iso-ker/im ⊙skel ac zeroth-cohomology-group {n = 1} ⊙skel ac = coe!ᴳ-iso (zeroth-cohomology-group-β ⊙skel) ∘eᴳ ZCG.C-cw-iso-ker/im ⊙skel ac zeroth-cohomology-group {n = S (S n)} ⊙skel ac = coe!ᴳ-iso (zeroth-cohomology-group-descend ⊙skel) ∘eᴳ zeroth-cohomology-group (⊙cw-init ⊙skel) (⊙init-has-cells-with-choice ⊙skel ac) ∘eᴳ C-cw-descend-at-lower ⊙skel (O<S n) ac
subroutine bhsetparam(ival, fval, cval) integer ival(8) real fval(4) character *(*) cval INTEGER GENMOD ! "rate only" mode (0) ! or "MC generator" mode (1) ! or "read from file" mode (2) INTEGER LHC_B1 ! LHC beam 1 is (off/on = 0/1) INTEGER LHC_B2 ! LHC beam 1 is (off/on = 0/1) INTEGER IW_MUO ! I want muons (no/yes = 0/1) INTEGER IW_HAD ! I want hadrons (no/yes = 0/1) REAL EG_MIN ! minimum energy [GeV] REAL EG_MAX ! maximum energy [GeV] INTEGER NEVENT ! INTEGER OFFSET ! INTEGER idx_shift_bx ! e.g. -2, -1 for previous bunch-crossing REAL BXNS ! time between 2 bx's, in ns REAL W0 ! external per second normalization CHARACTER*100 G3FNAME ! Genmod = 3 file name COMMON /BHGCTRL/ GENMOD,LHC_B1,LHC_B2,IW_MUO,IW_HAD, + NEVENT,OFFSET,idx_shift_bx, + EG_MIN,EG_MAX,BXNS, + W0,G3FNAME c GENMOD = ival(1) LHC_B1 = ival(2) LHC_B2 = ival(3) IW_MUO = ival(4) IW_HAD = ival(5) NEVENT = ival(6) OFFSET = ival(7) idx_shift_bx = ival(8) EG_MIN = fval(1) EG_MAX = fval(2) W0 = fval(4) BXNS = fval(3) G3FNAME = cval c write(6,*) 'GENMOD is ', GENMOD write(6,*) 'LHC_B1 is ', LHC_B1 write(6,*) 'LHC_B2 is ', LHC_B2 write(6,*) 'IW_MUO is ',IW_MUO write(6,*) 'IW_HAD is ',IW_HAD write(6,*) 'NEVENT is ',NEVENT write(6,*) 'OFFSET is ',OFFSET write(6,*) 'EG_MIN is ',EG_MIN write(6,*) 'EG_MAX is ',EG_MAX write(6,*) 'idx_shift_bx is ',idx_shift_bx write(6,*) 'BXNS is ',BXNS write(6,*) 'W0 is ',W0 write(6,*) 'G3FNAME is ',G3FNAME return end
type ExternalResolveBurgerSS <: ExternalAdectionResolver n_off :: Int64 x :: BurgerData end type ExternalResolveBurgerLS <: ExternalAdectionResolver n_off :: Int64 x :: BurgerData end type ExternalResolveBurgerSL <: ExternalAdectionResolver n_off :: Int64 x :: BurgerData end type ExternalResolveBurgerLL <: ExternalAdectionResolver n_off :: Int64 x :: BurgerData end export ExternalResolveBurgerLL, ExternalResolveBurgerLS, ExternalResolveBurgerSL, ExternalResolveBurgerSS include("advectionResolves.jl") include("advectionExternals.jl") export advection
! ! ------------------------------------------------------------- ! C 0 T 5 S ! ------------------------------------------------------------- ! ! * ! THIS PACKAGE DETERMINES THE VALUES OF FOLLOWING * ! --- --- * ! I Q 1/2 C I * ! CLEBSCH - GORDAN COEFFICIENT: I I * ! I QM SM CM I * ! --- --- * ! * ! Written by G. Gaigalas, * ! Vilnius, Lithuania December 1993 * ! SUBROUTINE C0T5S(Q, QM, SM, C, CM, A) !----------------------------------------------- ! M o d u l e s !----------------------------------------------- USE vast_kind_param, ONLY: DOUBLE USE CONSTS_C !...Translated by Pacific-Sierra Research 77to90 4.3E 09:56:00 11/16/01 !...Switches: !----------------------------------------------- ! I n t e r f a c e B l o c k s !----------------------------------------------- USE ittk_I IMPLICIT NONE !----------------------------------------------- ! D u m m y A r g u m e n t s !----------------------------------------------- REAL(DOUBLE) , INTENT(IN) :: Q REAL(DOUBLE) , INTENT(IN) :: QM REAL(DOUBLE) , INTENT(IN) :: SM REAL(DOUBLE) , INTENT(IN) :: C REAL(DOUBLE) , INTENT(IN) :: CM REAL(DOUBLE) , INTENT(OUT) :: A !----------------------------------------------- ! L o c a l V a r i a b l e s !----------------------------------------------- INTEGER :: IIQ, IIC, IE REAL(DOUBLE), DIMENSION(2) :: GC !----------------------------------------------- GC(1) = ONE GC(2) = -ONE A = ZERO IIQ = TWO*Q + TENTH IIC = TWO*C + TENTH IF (ITTK(IIQ,IIC,1) == 0) RETURN IF (DABS(QM + SM - CM) > EPS) RETURN IF (HALF + TENTH < DABS(SM)) RETURN IF (Q + TENTH < DABS(QM)) RETURN IF (C + TENTH < DABS(CM)) RETURN IE = DABS(HALF - SM) + ONE + TENTH IF (DABS(Q + HALF - C) < EPS) THEN A = DSQRT((C + GC(IE)*CM)/(TWO*C)) ELSE IF (DABS(Q - HALF - C) > EPS) RETURN A = -GC(IE)*DSQRT((C - GC(IE)*CM+ONE)/(TWO*C+TWO)) ENDIF RETURN END SUBROUTINE C0T5S
If $f$ and $g$ converge to $a$ and $b$, respectively, then $f + g$ converges to $a + b$.
Wilde continually revised the text over the next months : no line was left untouched , and " in a play so economical with its language and effects , [ the revisions ] had serious consequences " . Sos <unk> describes Wilde 's revisions as a refined art at work : the earliest , longest handwritten drafts of the play labour over farcical incidents , broad puns , nonsense dialogue and conventional comic turns . In revising as he did , " Wilde transformed standard nonsense into the more systemic and disconcerting illogicality which characterises Earnest 's dialogue " . Richard Ellmann argues that Wilde had reached his artistic maturity and wrote this work more surely and rapidly than before .
#!/usr/bin/env Rscript suppressPackageStartupMessages({ if(!require(data.table)){ install.packages("data.table"); library(data.table) } if(!require(tidyverse)){ install.packages("tidyverse"); library(tidyverse) } if(!require(optparse)){ install.packages("optparse"); library(optparse) } }) ######################################### ## ## Script used to make sparse GRM file for fastGWA ## for the analyses in the REGENIE 2020 paper ## For more details, visit: https://rgcgithub.github.io/regenie/ ## ######################################### option_list = list( make_option("--step1File", type="character", default="", help="bed file prefix for step 1", metavar="string"), make_option("--prefix", type="character", default="", help="output files prefix", metavar="string"), make_option("--partition", type="integer", default=0, help="partition number for fastGWA GRM computation"), make_option("--npartitions", type="integer", default=250, help="number of partitions for fastGWA GRM computation") ); opt_parser = OptionParser(option_list=option_list); opt = parse_args(opt_parser); total.partitions <- opt$npartitions if( opt$partition > total.partitions) stop("Invalid argument") print(opt) ########### Functions ############ fastGWA.computeGRM <- function(){ fastGWA.call <- paste0("gcta64 ", "--bfile ", bed.file, " ", "--thread-num ", parallel::detectCores(), " ", "--out ", outprefix, " ", "--make-grm-part ", total.partitions, " ", opt$partition) print(fastGWA.call) tot.time <- system.time({ system(fastGWA.call) }) write( tot.time, paste0(outprefix, "_time_pt_", opt$partition), ncol = length(tot.time)) } fastGWA.compute.sparseGRM <- function(){ ## Combine the partitions system( paste0("cat ", outprefix, ".part_",total.partitions,"_*.grm.id > ",outprefix, ".grm.id") ) system( paste0("cat ", outprefix, ".part_",total.partitions,"_*.grm.bin > ",outprefix, ".grm.bin") ) system( paste0("cat ", outprefix, ".part_",total.partitions,"_*.grm.N.bin > ",outprefix, ".grm.N.bin") ) # compute sparse GRM fastGWA.call <- paste0("gcta64 ", "--grm ", outprefix, " ", "--make-bK-sparse 0.05 ", "--out ", outprefix, "_sp ") system(fastGWA.call) if(file.exists( paste0(outprefix, "_sp.grm.id") )){ # in case of error so no need to redo system( paste0("rm ", outprefix,".part_",total.partitions,"_*.grm.*") ) } } ################################# outprefix <- opt$prefix bed.file <- opt$step1File if( opt$partition > 0 ){ # run fastGWA GRM computation partitions fastGWA.computeGRM() } else if(opt$partition == 0){ # finish fastGWA sparse GRM computation tot.time <- system.time({ fastGWA.compute.sparseGRM() }) write( tot.time, paste0(outprefix, "_time_compSparseGRM"), ncol = length(tot.time)) }
module mod_gfm use mod_param implicit none private public gfm4p, gfm4diff contains !------------------------------------------------------ !-- The ghost fluid method (GFM) for the computation of !-- surface tenseion across a sharp interface. ! subroutine gfm4p(p_jump) use mod_common use mod_interface use mod_bound use mod_common_mpi integer :: i,j,k,l, nx,ny,nz,flag, cnt real :: nondi, factor,idvndn, t1,tmax real :: icurv, jump_x, jump_y, jump_z real :: cmax,cmin, cmax_all,cmin_all !# real, dimension(-1:1) :: ph,cv,ps, jp_x, jp_y, jp_z real, dimension(0:i1,0:j1,0:k1) :: curvature, p_exjump, cux,cuy,cuz, re_curv !# real, dimension(0:i1,0:j1,0:k1,1:lmax) :: px_sep,py_sep,pz_sep, pj_sep real, dimension(0:i1,0:j1,0:k1), intent(out) :: p_jump nondi = 1./We ! non-dimensional surface tension coef select case (NS_diff_discretization) case('del') factor = 0. case('GFM') factor = 2.*visc*(miu2-miu1) if (myid .eq. 0) then write(*,*) 'This method seems unrobust. Use at your own risk.' write(*,*) 'Program aborted. (Comment these if you insist.)' endif call mpi_finalize(error) stop end select select case (surface_tension_method) case('CSF') ! add nothing p_jump = 0. case('GFM') call ipot ! get minimal distances between interfaces !-- Update jump at time level (n-1) --! p_xold = p_x p_yold = p_y p_zold = p_z !-- Compute jump at time level (n) --! px_sep = 0. py_sep = 0. pz_sep = 0. pj_sep = 0. p_jump = 0. p_exjump = 0. p_x = 0. p_y = 0. p_z = 0. do l=1,lmax !-- Obtain cell-center curvature of each drop --! call get_curvature(lvset(:,:,:,l),curv_cmn) call boundc(curv_cmn) !# if (.not. TwoD) then call re_curvature(lvset(:,:,:,l),curv_cmn,re_curv) curv_cmn = re_curv call boundc(curv_cmn) endif !# do k=1,kmax do j=1,jmax do i=1,imax if ( abs(lvset(i,j,k,l)) .le. 2.*dz) then ! jump only occurs across cut cells jump_x = 0. jump_y = 0. jump_z = 0. jp_x = 0. jp_y = 0. jp_z = 0. !-- x component --! do nx = -1,1,2 ph(-1:1) = lvset(i-1:i+1,j,k,l) cv(-1:1) = curv_cmn(i-1:i+1,j,k) if ( ph(0)*ph(nx) .lt. 0.) then call icurvature(nx, ph,cv, icurv) !-- jump due to surface tension jp_x(nx) = nondi*(-icurv) !-- jump due to discontinuous viscosity !#idvndn = ( dvndn(i,j,k)*abs(ph(nx)) + dvndn(i+nx,j,k)*abs(ph(0)) ) & !# /( abs(ph(0)) + abs(ph(nx)) ) !# !#jump_x = jump_x + factor*idvndn if (nx .eq. 1) px_sep(i,j,k,l) = jp_x(nx) endif enddo jump_x = sum(jp_x) !-- y component --! do ny = -1,1,2 ph(-1:1) = lvset(i,j-1:j+1,k,l) cv(-1:1) = curv_cmn(i,j-1:j+1,k) if ( ph(0)*ph(ny) .lt. 0.) then call icurvature(ny, ph,cv, icurv) !-- jump due to surface tension jp_y(ny) = nondi*(-icurv) !-- jump due to discontinuous viscosity !#idvndn = ( dvndn(i,j,k)*abs(ph(ny)) + dvndn(i,j+ny,k)*abs(ph(0)) ) & !# /( abs(ph(0)) + abs(ph(ny)) ) !# !#jump_y = jump_y + factor*idvndn if (ny .eq. 1) py_sep(i,j,k,l) = jp_y(ny) endif enddo jump_y = sum(jp_y) !-- z component --! do nz = -1,1,2 ph(-1:1) = lvset(i,j,k-1:k+1,l) cv(-1:1) = curv_cmn(i,j,k-1:k+1) if ( ph(0)*ph(nz) .lt. 0.) then call icurvature(nz, ph,cv, icurv) !-- jump due to surface tension jp_z(nz) = nondi*(-icurv) !-- jump due to discontinuous viscosity !#idvndn = ( dvndn(i,j,k)*abs(ph(nz)) + dvndn(i,j,k+nz)*abs(ph(0)) ) & !# /( abs(ph(0)) + abs(ph(nz)) ) !# !#jump_z = jump_z + factor*idvndn if (nz .eq. 1) pz_sep(i,j,k,l) = jp_z(nz) endif enddo jump_z = sum(jp_z) !-- "Laplacian" of pressure jump (separately) --! if (lvset(i,j,k,l) .gt. 0.) then ! jump higher pj_sep(i,j,k,l) = (jump_x/dx**2 + jump_y/dy**2 + jump_z/dz**2) elseif (lvset(i,j,k,l) .lt. 0.) then ! drop lower pj_sep(i,j,k,l) = - (jump_x/dx**2 + jump_y/dy**2 + jump_z/dz**2) px_sep(i,j,k,l) = - px_sep(i,j,k,l) py_sep(i,j,k,l) = - py_sep(i,j,k,l) pz_sep(i,j,k,l) = - pz_sep(i,j,k,l) else pj_sep(i,j,k,l) = 0. px_sep(i,j,k,l) = 0. py_sep(i,j,k,l) = 0. pz_sep(i,j,k,l) = 0. write(*,*) 'Happens to be at the interface (highly unlikely)!' endif !-- Account for close neighbors --! if (l .eq. 1) then ! initialize p_jump(i,j,k) = pj_sep(i,j,k,l) p_x(i,j,k) = px_sep(i,j,k,l) p_y(i,j,k) = py_sep(i,j,k,l) p_z(i,j,k) = pz_sep(i,j,k,l) else ! superimpose each separate jump p_jump(i,j,k) = p_jump(i,j,k) + pj_sep(i,j,k,l) p_x(i,j,k) = p_x(i,j,k) + px_sep(i,j,k,l) p_y(i,j,k) = p_y(i,j,k) + py_sep(i,j,k,l) p_z(i,j,k) = p_z(i,j,k) + pz_sep(i,j,k,l) endif endif ! jump shell enddo ! i enddo ! j enddo ! k enddo ! l !!########### ! ! cmax = maxval(cuz(:,:,:)) ! call mpi_allreduce(cmax,cmax_all,1,mpi_real8,mpi_max,comm_cart,error) ! cmin = minval(cuz(:,:,:)) ! call mpi_allreduce(cmin,cmin_all,1,mpi_real8,mpi_min,comm_cart,error) ! ! ! if (myid .eq. 2) then ! open(60,file=datadir//'curv.txt',position='append') ! write(60,'(2ES12.4)') cmax_all,cmin_all ! close(60) ! endif ! !!########### !-- Extral jump due to depletion --! if (attractive) then call exjump(p_exjump) p_jump = p_jump + p_exjump endif end select return end subroutine gfm4p !----------------------------------------------- !-- A hydrodynamic model for the depletion force !-- using MLS and GFM ! subroutine exjump(p_jump) use mod_common use mod_common_mpi use mod_bound integer :: i,j,k,l, m,n, nx,ny,nz real :: phi, phx,phy,phz real :: jump_x, jump_y, jump_z real :: del_r, dvol,vol_ex, pot_tot, cp, c0,c1, osp real, dimension(-1:1) :: fo, pf, jp_x, jp_y, jp_z real, dimension(0:i1,0:j1,0:k1) :: phim,phin, flago, pfactor, px_osp,py_osp,pz_osp !-- Model Parameters --! real, parameter :: rsm = 2.0*dz ! radius of surfactant micelles real, parameter :: rs1 = 0.1*rsm ! reduce osp when less than this distance real, parameter :: rs2 = 0.0*rsm ! negative osp when less than this distance real, parameter :: osp0 = -40. ! osmotic pressure due to surfactant micelles real, dimension(0:i1,0:j1,0:k1), intent(out) :: p_jump px_osp = 0. py_osp = 0. pz_osp = 0. p_jump = 0. dvol = dx*dy*dz do m = 1,lmax-1 phim = lvset(0:i1,0:j1,0:k1,m) ! droplet m do n = m+1,lmax phin = lvset(0:i1,0:j1,0:k1,n) ! droplet n !-- Reduce magnitude if too close --! if (dmin(m,n) .gt. rs1) then osp = osp0 else del_r = (rs1-dmin(m,n))/(rs1-rs2) osp = osp0*(1.-del_r) endif !-- Identify overlap of surfactant shell --! where (phim .le. rsm .and. phin .le. rsm) flago = 1. ! inside overlap elsewhere flago = 0. ! outside overlap end where call boundc(flago) !-- Compute overlap volume --! vol_ex = sum( flago(1:imax,1:jmax,1:kmax) )*dvol ! a rough count call mpi_allreduce(mpi_in_place,vol_ex,1,mpi_real8,mpi_sum,comm_cart,error) pot_tot = osp*vol_ex ! total potential energy !-- Compute the spatially varying osmotic pressure --! pfactor = 0. do k=1,kmax do j=1,jmax do i=1,imax if (flago(i,j,k) .eq. 1.) then pfactor(i,j,k) = (phim(i,j,k) + phin(i,j,k))/(2.*rsm) -1. endif enddo enddo enddo call boundc(pfactor) c0 = sum( pfactor(1:imax,1:jmax,1:kmax) )*dvol call mpi_allreduce(mpi_in_place,c0,1,mpi_real8,mpi_sum,comm_cart,error) cp = pot_tot/c0 ! a constant prefactor !-- Impose the osmotic pressure jump --! px_osp = 0. py_osp = 0. pz_osp = 0. do k=1,kmax do j=1,jmax do i=1,imax if (abs(slset(i,j,k)) .le. 2.*rsm) then ! jump within this shell jump_x = 0. jump_y = 0. jump_z = 0. jp_x = 0. jp_y = 0. jp_z = 0. !-- x component do nx = -1,1,2 fo(-1:1) = flago(i-1:i+1,j,k) pf(-1:1) = pfactor(i-1:i+1,j,k) if ( fo(0) .ne. fo(nx) ) then if ( fo(0) .eq. 1.) then ! (i,j,k) is inside overlap c1 = pf(0) else c1 = pf(nx) endif jp_x(nx) = cp*c1 if (nx .eq. 1) px_osp(i,j,k) = jp_x(nx) endif enddo jump_x = sum(jp_x) !-- y component do ny = -1,1,2 fo(-1:1) = flago(i,j-1:j+1,k) pf(-1:1) = pfactor(i,j-1:j+1,k) if ( fo(0) .ne. fo(ny) ) then if ( fo(0) .eq. 1.) then ! (i,j,k) is inside overlap c1 = pf(0) else c1 = pf(ny) endif jp_y(ny) = cp*c1 if (ny .eq. 1) py_osp(i,j,k) = jp_y(ny) endif enddo jump_y = sum(jp_y) !-- z component do nz = -1,1,2 fo(-1:1) = flago(i,j,k-1:k+1) pf(-1:1) = pfactor(i,j,k-1:k+1) if ( fo(0) .ne. fo(nz) ) then if ( fo(0) .eq. 1.) then ! (i,j,k) is inside overlap c1 = pf(0) else c1 = pf(nz) endif jp_z(nz) = cp*c1 if (nz .eq. 1) pz_osp(i,j,k) = jp_z(nz) endif enddo jump_z = sum(jp_z) !-- "Laplacian" of osmotic pressure jump (superimposed) --! if (flago(i,j,k) .gt. 0.) then ! jump from overlap to outside p_jump(i,j,k) = p_jump(i,j,k) + (jump_x/dx**2 + jump_y/dy**2 + jump_z/dz**2) else ! jump from outside to overlap p_jump(i,j,k) = p_jump(i,j,k) - (jump_x/dx**2 + jump_y/dy**2 + jump_z/dz**2) px_osp(i,j,k) = - px_osp(i,j,k) py_osp(i,j,k) = - py_osp(i,j,k) pz_osp(i,j,k) = - pz_osp(i,j,k) endif !-- Correction to the pressure gradient --! p_x(i,j,k) = p_x(i,j,k) + px_osp(i,j,k) p_y(i,j,k) = p_y(i,j,k) + py_osp(i,j,k) p_z(i,j,k) = p_z(i,j,k) + pz_osp(i,j,k) endif ! jump shell enddo ! i enddo ! j enddo ! k enddo ! n enddo ! m return end subroutine exjump !--------------------------------------------------- !-- The lengthy code below is for the computation of !-- a discontinuous viscosity using GFM ! subroutine ls_c2f(dir,phi) ! Average level set values from cell centers to faces use mod_common use mod_bound character(len=6), intent(in) :: dir real, dimension(0:i1,0:j1,0:k1), intent(out) :: phi integer :: i,j,k, cnt phi = lvset(0:i1,0:j1,0:k1, 1) !## now only consider the first level set ##temp select case (dir) case('u-grid') do cnt = 1,nb_cnt i = nb_i(cnt) j = nb_j(cnt) k = nb_k(cnt) phi(i,j,k) = ( lvset(i,j,k,1) +lvset(i+1,j,k,1) )/2. !##temp enddo case('v-grid') do cnt = 1,nb_cnt i = nb_i(cnt) j = nb_j(cnt) k = nb_k(cnt) phi(i,j,k) = ( lvset(i,j,k,1) +lvset(i,j+1,k,1) )/2. !##temp enddo case('w-grid') do cnt = 1,nb_cnt i = nb_i(cnt) j = nb_j(cnt) k = nb_k(cnt) phi(i,j,k) = ( lvset(i,j,k,1) +lvset(i,j,k+1,1) )/2. !##temp enddo end select call boundc(phi) !# wall halos untouched return end subroutine ls_c2f !------------------------ ! ! subroutine gradjump(jump) ! Compute the jumpy velocity-gradient matrix use mod_common use mod_bound use mod_interface use mod_newtypes type (real_3by3_matrix), dimension(-2:i1+2,-2:j1+2,-2:k1+2), intent(out) :: jump !temp bigger than needed integer :: i,j,k, cnt, m real :: mag real, dimension(3) :: dummy, tan_vec1,tan_vec2 real, dimension(1,3) :: nor_vec, temp real, dimension(3,3) :: grad_vel, nor_sq,tan_sq, subt, term1,term2,term3 real, dimension(0:i1,0:j1,0:k1) :: u,v,w u = 0. v = 0. w = 0. subt = 0. dvndn = 0. ! initialize gradient jump matrix forall(i=-2:i1+2,j=-2:j1+2,k=-2:k1+2) jump(i,j,k)%grad = subt end forall if (miu1 .eq. miu2) return ! obtain cell-center velocities do k = 1,kmax do j = 1,jmax do i = 1,imax u(i,j,k) = (unew(i,j,k) + unew(i-1,j,k))/2. v(i,j,k) = (vnew(i,j,k) + vnew(i,j-1,k))/2. w(i,j,k) = (wnew(i,j,k) + wnew(i,j,k-1))/2. enddo enddo enddo call bounduvw(u,v,w) ! obtain normals (also curvature but not used now, can improve efficiency later) call get_curvature(lvset(:,:,:,1),curv_cmn) !## now only the first level set ##temp call boundc(curv_cmn) ! construct matrices within a narrow band do cnt = 1,nb_cnt i = nb_i(cnt) j = nb_j(cnt) k = nb_k(cnt) ! velocity gradient matrix grad_vel(1,1) = (u(i+1,j,k) - u(i-1,j,k))/2./dx grad_vel(1,2) = (u(i,j+1,k) - u(i,j-1,k))/2./dy grad_vel(1,3) = (u(i,j,k+1) - u(i,j,k-1))/2./dz grad_vel(2,1) = (v(i+1,j,k) - v(i-1,j,k))/2./dx grad_vel(2,2) = (v(i,j+1,k) - v(i,j-1,k))/2./dy grad_vel(2,3) = (v(i,j,k+1) - v(i,j,k-1))/2./dz grad_vel(3,1) = (w(i+1,j,k) - w(i-1,j,k))/2./dx grad_vel(3,2) = (w(i,j+1,k) - w(i,j-1,k))/2./dy grad_vel(3,3) = (w(i,j,k+1) - w(i,j,k-1))/2./dz ! normal and tangential vectors nor_vec(1,1) = normal(i,j,k)%x nor_vec(1,2) = normal(i,j,k)%y nor_vec(1,3) = normal(i,j,k)%z dummy(:) = abs(nor_vec(1,:)) m = minloc(dummy, dim=1) dummy(:) = 0. dummy(m) = 1. tan_vec1(1) = nor_vec(1,2)*dummy(3) - nor_vec(1,3)*dummy(2) tan_vec1(2) = - nor_vec(1,1)*dummy(3) + nor_vec(1,3)*dummy(1) tan_vec1(3) = nor_vec(1,1)*dummy(2) - nor_vec(1,2)*dummy(1) mag = dot_product(tan_vec1, tan_vec1) tan_vec1 = tan_vec1/sqrt(mag) tan_vec2(1) = nor_vec(1,2)*tan_vec1(3) - nor_vec(1,3)*tan_vec1(2) tan_vec2(2) = - nor_vec(1,1)*tan_vec1(3) + nor_vec(1,3)*tan_vec1(1) tan_vec2(3) = nor_vec(1,1)*tan_vec1(2) - nor_vec(1,2)*tan_vec1(1) ! corresponding matrices nor_sq = matmul(transpose(nor_vec),nor_vec) tan_sq(1,:) = 0. tan_sq(2,:) = tan_vec1(:) tan_sq(3,:) = tan_vec2(:) ! first-derivative jump matrix (w/o viscosity term) subt = matmul(grad_vel, transpose(tan_sq)) term1 = matmul(subt, tan_sq) subt = matmul(nor_sq, grad_vel) term2 = matmul(subt, nor_sq) term3 = matmul(transpose(tan_sq), tan_sq) subt = matmul(term3, transpose(grad_vel)) term3 = matmul(subt, nor_sq) jump(i,j,k)%grad = term1 + term2 - term3 ! normal derivative of normal velocity (part of pressure jump) temp = matmul(nor_vec,grad_vel) dvndn(i,j,k) = dot_product( temp(1,:) ,nor_vec(1,:) ) enddo call boundj(jump) call boundc(dvndn) return end subroutine gradjump !--------------------------------------------------------- ! ! subroutine gfm4diff(RDu,RDv,RDw, u,v,w, rho_u,rho_v,rho_w) use mod_newtypes real, dimension(0:,0:,0:), intent(in) :: u,v,w real, dimension(1:imax,1:jmax,1:kmax), intent(in) :: rho_u, rho_v, rho_w real, dimension(1:imax,1:jmax,1:kmax), intent(out) :: RDu,RDv,RDw integer :: i,j,k, im,ip,jm,jp,km,kp, nb real :: s1, theta, miu_pls,miu_mns,miuh real :: dudxp,dudxm,dudyp,dudym,dudzp,dudzm real :: dvdxp,dvdxm,dvdyp,dvdym,dvdzp,dvdzm real :: dwdxp,dwdxm,dwdyp,dwdym,dwdzp,dwdzm real :: RD1,RD2,RD3,RD4,RD5 real :: J_l,J_m,J_r, Ji real, dimension(-1:1) :: ph, jmean real, dimension(-1:1) :: dudx,dudy,dudz, dvdx,dvdy,dvdz, dwdx,dwdy,dwdz real, dimension(0:i1,0:j1,0:k1) :: phi type (real_3by3_matrix), dimension(-2:i1+2,-2:j1+2,-2:k1+2) :: jump !== Obtain velocity-gradient-jump matrix at cell centers ==! call gradjump(jump) ! visc jump is NOT multiplied !-- v-component --! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< call ls_c2f('v-grid',phi) ! get level set on the v grid ph = 0. ! level set buffer s1 = 3.*dz ! tube half width dvdx = 0. dudy = 0. dvdy = 0. dvdz = 0. dwdy = 0. do k = 1,kmax do j = 1,jmax do i = 1,imax ip = i + 1 jp = j + 1 kp = k + 1 im = i - 1 jm = j - 1 km = k - 1 ! continuous first derivatives dvdxp = (v(ip,j,k)-v(i ,j,k))/dx dvdxm = (v(i ,j,k)-v(im,j,k))/dx dudyp = (u(i ,jp,k)-u(i ,j,k))/dy dudym = (u(im,jp,k)-u(im,j,k))/dy dvdyp = (v(i,jp,k)-v(i,j ,k))/dy dvdym = (v(i,j ,k)-v(i,jm,k))/dy dvdzp = (v(i,j,kp)-v(i,j,k ))/dz dvdzm = (v(i,j,k )-v(i,j,km))/dz dwdyp = (w(i,jp,k )-w(i,j,k ))/dy dwdym = (w(i,jp,km)-w(i,j,km))/dy RD1 = (dvdxp - dvdxm)/dx ! d/dx(dv/dx) RD3 = (dvdyp - dvdym)/dy ! d/dy(dv/dy) RD4 = (dvdzp - dvdzm)/dz ! d/dz(dv/dz) ph(0) = phi(i,j,k) if (ph(0) .gt. s1) then ! safely in fluid 1 RDv(i,j,k) = miu1*(RD1+RD3+RD4)/rho1 elseif (ph(0) .lt. -s1) then ! safely in fluid 2 RDv(i,j,k) = miu2*(RD1+RD3+RD4)/rho2 else !- 2nd x-derivative -! if (TwoD) then RD1 = 0. RD2 = 0. else ph(-1) = phi(i-1,j,k) ph( 1) = phi(i+1,j,k) if (minval(ph) .gt. 0.) then ! in fluid 1 RD1 = miu1*RD1 RD2 = 0. elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD1 = miu2*RD1 RD2 = 0. else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i-1,j,k)%grad(2,1) + jump(i-1,j+1,k)%grad(2,1))/2.!# else nb = 1 jmean(1) = (jump(i+1,j,k)%grad(2,1) + jump(i+1,j+1,k)%grad(2,1))/2.!# endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(2,1) + jump(i,j+1,k)%grad(2,1))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dvdx(-1) = dvdxm dvdx( 1) = dvdxp dvdx( nb) = miuh*dvdx(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dvdx(-nb) = miu_pls*dvdx(-nb) RD1 = (dvdx(1)-dvdx(-1))/dx ! d/dx(miu*dv/dx) ! Below L and R locates on the vertices ph(-1) = (phi(i,j,k)+phi(i-1,j,k))/2. ph( 1) = (phi(i,j,k)+phi(i+1,j,k))/2. if (minval(ph) .gt. 0.) then ! in fluid 1 RD2 = miu1*(dudyp-dudym)/dx elseif ( maxval(ph) .lt. 0. ) then ! in fluid 2 RD2 = miu2*(dudyp-dudym)/dx else ! between L and R if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i-1,j,k)%grad(1,2) + jump(i-1,j+1,k)%grad(1,2) & +jump(i,j ,k)%grad(1,2) + jump(i,j+1 ,k)%grad(1,2))/4. elseif ( ph(1)*ph(0) .lt. 0.) then nb = 1 jmean(1) = (jump(i+1,j,k)%grad(1,2) + jump(i+1,j+1,k)%grad(1,2) & +jump(i,j ,k)%grad(1,2) + jump(i,j+1 ,k)%grad(1,2))/4. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(1,2) + jump(i,j+1,k)%grad(1,2))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dudy(-1) = dudym dudy( 1) = dudyp dudy( nb) = miuh*dudy(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dudy(-nb) = miu_pls*dudy(-nb) RD2 = (dudy(1)-dudy(-1))/dx ! d/dx(miu*du/dy) endif endif endif !- 2nd y-derivative -! ph(-1) = phi(i,j-1,k) ph( 1) = phi(i,j+1,k) if (minval(ph) .gt. 0.) then ! in fluid 1 RD3 = miu1*RD3 elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD3 = miu2*RD3 else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j,k)%grad(2,2) + jump(i,j-1,k)%grad(2,2))/2. else nb = 1 jmean(1) = (jump(i,j+1,k)%grad(2,2) + jump(i,j+2,k)%grad(2,2))/2. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(2,2) + jump(i,j+1,k)%grad(2,2))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dvdy(-1) = dvdym dvdy( 1) = dvdyp dvdy( nb) = miuh*dvdy(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dvdy(-nb) = miu_pls*dvdy(-nb) RD3 = 2.*(dvdy(1)-dvdy(-1))/dy ! d/dy(2.*miu*dv/dy) endif !- 2nd z-derivative -! ph(-1) = phi(i,j,k-1) ph( 1) = phi(i,j,k+1) if (minval(ph) .gt. 0.) then ! in fluid 1 RD4 = miu1*RD4 RD5 = 0. elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD4 = miu2*RD4 RD5 = 0. else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j,k-1)%grad(2,3) + jump(i,j+1,k-1)%grad(2,3))/2. else nb = 1 jmean(1) = (jump(i,j,k+1)%grad(2,3) + jump(i,j+1,k+1)%grad(2,3))/2. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(2,3) + jump(i,j+1,k)%grad(2,3))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dvdz(-1) = dvdzm dvdz( 1) = dvdzp dvdz( nb) = miuh*dvdz(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dvdz(-nb) = miu_pls*dvdz(-nb) RD4 = (dvdz(1)-dvdz(-1))/dz ! d/dz(miu*dv/dz) ! Below L and R locates on the vertices, separated by dz (not 2dz) ph(-1) = (phi(i,j,k)+phi(i,j,k-1))/2. ph( 1) = (phi(i,j,k)+phi(i,j,k+1))/2. if (minval(ph) .gt. 0.) then ! in fluid 1 RD5 = miu1*(dwdyp-dwdym)/dz elseif ( maxval(ph) .lt. 0. ) then ! in fluid 2 RD5 = miu2*(dwdyp-dwdym)/dz else ! between L and R if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j,k-1)%grad(2,3) + jump(i,j+1,k-1)%grad(2,3) & +jump(i,j ,k)%grad(2,3) + jump(i,j+1 ,k)%grad(2,3))/4. elseif ( ph(1)*ph(0) .lt. 0.) then nb = 1 jmean(1) = (jump(i,j,k+1)%grad(2,3) + jump(i,j+1,k+1)%grad(2,3) & +jump(i,j ,k)%grad(2,3) + jump(i,j+1 ,k)%grad(2,3))/4. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(2,3) + jump(i,j+1,k)%grad(2,3))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dwdy(-1) = dwdym dwdy( 1) = dwdyp dwdy( nb) = miuh*dwdy(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dwdy(-nb) = miu_pls*dwdy(-nb) RD5 = (dwdy(1)-dwdy(-1))/dz ! d/dz(miu*dw/dy) endif endif RDv(i,j,k) = (RD1+RD2+RD3+RD4+RD5)/rho_v(i,j,k) endif enddo enddo enddo !-- w-component --! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< call ls_c2f('w-grid',phi) ! get level set on the w grid ph = 0. ! level set buffer s1 = 3.*dz ! tube half width dwdx = 0. dudz = 0. dwdy = 0. dvdz = 0. dwdz = 0. do k = 1,kmax do j = 1,jmax do i = 1,imax ip = i + 1 jp = j + 1 kp = k + 1 im = i - 1 jm = j - 1 km = k - 1 ! continuous first derivatives dwdxp = (w(ip,j,k)-w(i ,j,k))/dx dwdxm = (w(i ,j,k)-w(im,j,k))/dx dudzp = (u(i ,j,kp)-u(i ,j,k))/dz dudzm = (u(im,j,kp)-u(im,j,k))/dz dwdyp = (w(i,jp,k)-w(i,j ,k))/dy dwdym = (w(i,j ,k)-w(i,jm,k))/dy dvdzp = (v(i,j ,kp)-v(i,j ,k))/dz dvdzm = (v(i,jm,kp)-v(i,jm,k))/dz dwdzp = (w(i,j,kp)-w(i,j,k ))/dz dwdzm = (w(i,j,k )-w(i,j,km))/dz RD1 = (dwdxp - dwdxm)/dx ! d/dx(dw/dx) RD3 = (dwdyp - dwdym)/dy ! d/dy(dw/dy) RD5 = (dwdzp - dwdzm)/dz ! d/dz(dw/dz) ph(0) = phi(i,j,k) if (ph(0) .gt. s1) then ! (most likely) safely in fluid 1 RDw(i,j,k) = miu1*(RD1+RD3+RD5)/rho1 elseif (ph(0) .lt. -s1) then ! (most likely) safely in fluid 2 RDw(i,j,k) = miu2*(RD1+RD3+RD5)/rho2 else !- 2nd x-derivative -! if (TwoD) then RD1 = 0. RD2 = 0. else ph(-1) = phi(i-1,j,k) ph( 1) = phi(i+1,j,k) if (minval(ph) .gt. 0.) then ! in fluid 1 RD1 = miu1*RD1 RD2 = 0. elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD1 = miu2*RD1 RD2 = 0. else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i-1,j,k)%grad(3,1) + jump(i-1,j,k+1)%grad(3,1))/2.!# else nb = 1 jmean(1) = (jump(i+1,j,k)%grad(3,1) + jump(i+1,j,k+1)%grad(3,1))/2.!# endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(3,1) + jump(i,j,k+1)%grad(3,1))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dwdx(-1) = dwdxm dwdx( 1) = dwdxp dwdx( nb) = miuh*dwdx(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dwdx(-nb) = miu_pls*dwdx(-nb) RD1 = (dwdx(1)-dwdx(-1))/dx ! d/dx(miu*dw/dx) ! Below L and R locates on the vertices ph(-1) = (phi(i,j,k)+phi(i-1,j,k))/2. ph( 1) = (phi(i,j,k)+phi(i+1,j,k))/2. if (minval(ph) .gt. 0.) then ! in fluid 1 RD2 = miu1*(dudzp-dudzm)/dx elseif ( maxval(ph) .lt. 0. ) then ! in fluid 2 RD2 = miu2*(dudzp-dudzm)/dx else ! between L and R if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i-1,j,k)%grad(1,3) + jump(i-1,j,k+1)%grad(1,3) & +jump(i,j ,k)%grad(1,3) + jump(i,j ,k+1)%grad(1,3))/4. elseif ( ph(1)*ph(0) .lt. 0.) then nb = 1 jmean(1) = (jump(i+1,j,k)%grad(1,3) + jump(i+1,j,k+1)%grad(1,3) & +jump(i,j ,k)%grad(1,3) + jump(i,j ,k+1)%grad(1,3))/4. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(1,3) + jump(i,j,k+1)%grad(1,3))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dudz(-1) = dudzm dudz( 1) = dudzp dudz( nb) = miuh*dudz(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dudz(-nb) = miu_pls*dudz(-nb) RD2 = (dudz(1)-dudz(-1))/dx ! d/dx(miu*du/dz) endif endif endif !- 2nd y-derivative -! ph(-1) = phi(i,j-1,k) ph( 1) = phi(i,j+1,k) if (minval(ph) .gt. 0.) then ! in fluid 1 RD3 = miu1*RD3 RD4 = 0. elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD3 = miu2*RD3 RD4 = 0. else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j-1,k)%grad(3,2) + jump(i,j-1,k+1)%grad(3,2))/2. else nb = 1 jmean(1) = (jump(i,j+1,k)%grad(3,2) + jump(i,j+1,k+1)%grad(3,2))/2. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(3,2) + jump(i,j,k+1)%grad(3,2))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dwdy(-1) = dwdym dwdy( 1) = dwdyp dwdy( nb) = miuh*dwdy(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dwdy(-nb) = miu_pls*dwdy(-nb) RD3 = (dwdy(1)-dwdy(-1))/dy ! d/dy(miu*dw/dy) ! Below L and R locates on the vertices ph(-1) = (phi(i,j,k)+phi(i,j-1,k))/2. ph( 1) = (phi(i,j,k)+phi(i,j+1,k))/2. if (minval(ph) .gt. 0.) then ! in fluid 1 RD4 = miu1*(dvdzp-dvdzm)/dy elseif ( maxval(ph) .lt. 0. ) then ! in fluid 2 RD4 = miu2*(dvdzp-dvdzm)/dy else ! between L and R if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j-1,k)%grad(2,3) + jump(i,j-1,k+1)%grad(2,3) & +jump(i,j ,k)%grad(2,3) + jump(i,j ,k+1)%grad(2,3))/4. elseif ( ph(1)*ph(0) .lt. 0.) then nb = 1 jmean(1) = (jump(i,j+1,k)%grad(2,3) + jump(i,j+1,k+1)%grad(2,3) & +jump(i,j ,k)%grad(2,3) + jump(i,j ,k+1)%grad(2,3))/4. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(2,3) + jump(i,j,k+1)%grad(2,3))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dvdz(-1) = dvdzm dvdz( 1) = dvdzp dvdz( nb) = miuh*dvdz(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dvdz(-nb) = miu_pls*dvdz(-nb) RD4 = (dvdz(1)-dvdz(-1))/dy ! d/dy(miu*dv/dz) endif endif !- 2nd z-derivative -! ph(-1) = phi(i,j,k-1) ph( 1) = phi(i,j,k+1) if (minval(ph) .gt. 0.) then ! in fluid 1 RD5 = miu1*RD5 elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD5 = miu2*RD5 else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j,k)%grad(3,3) + jump(i,j,k-1)%grad(3,3))/2. else nb = 1 jmean(1) = (jump(i,j,k+1)%grad(3,3) + jump(i,j,k+2)%grad(3,3))/2. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(3,3) + jump(i,j,k+1)%grad(3,3))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dwdz(-1) = dwdzm dwdz( 1) = dwdzp dwdz( nb) = miuh*dwdz(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dwdz(-nb) = miu_pls*dwdz(-nb) RD5 = 2.*(dwdz(1)-dwdz(-1))/dz ! d/dz(2.*miu*dw/dz) endif RDw(i,j,k) = (RD1+RD2+RD3+RD4+RD5)/rho_w(i,j,k) endif enddo enddo enddo !-- u-component --! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< if (TwoD) then RDu = 0. return endif call ls_c2f('u-grid',phi) ! get level set on the u grid ph = 0. ! level set buffer s1 = 3.*dz ! tube half width dudx = 0. dudy = 0. dvdx = 0. dudz = 0. dwdx = 0. do k = 1,kmax do j = 1,jmax do i = 1,imax ip = i + 1 jp = j + 1 kp = k + 1 im = i - 1 jm = j - 1 km = k - 1 ! continuous first derivatives dudxp = (u(ip,j,k)-u(i ,j,k))/dx dudxm = (u(i ,j,k)-u(im,j,k))/dx dudyp = (u(i,jp,k)-u(i,j ,k))/dy dudym = (u(i,j ,k)-u(i,jm,k))/dy dvdxp = (v(ip,j ,k)-v(i,j ,k))/dx dvdxm = (v(ip,jm,k)-v(i,jm,k))/dx dudzp = (u(i,j,kp)-u(i,j,k ))/dz dudzm = (u(i,j,k )-u(i,j,km))/dz dwdxp = (w(ip,j,k )-w(i,j,k ))/dx dwdxm = (w(ip,j,km)-w(i,j,km))/dx RD1 = (dudxp -dudxm)/dx ! d/dx(du/dx) RD2 = (dudyp -dudym)/dy ! d/dy(du/dy) RD4 = (dudzp -dudzm)/dz ! d/dz(du/dz) ph(0) = phi(i,j,k) if (ph(0) .gt. s1) then ! (most likely) safely in fluid 1 RDu(i,j,k) = miu1*(RD1+RD2+RD4)/rho1 elseif (ph(0) .lt. -s1) then ! (most likely) safely in fluid 2 RDu(i,j,k) = miu2*(RD1+RD2+RD4)/rho2 else !- 2nd x-derivative -! ph(-1) = phi(i-1,j,k) ph( 1) = phi(i+1,j,k) if (minval(ph) .gt. 0.) then ! in fluid 1 RD1 = miu1*RD1 elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD1 = miu2*RD1 else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j,k)%grad(1,1) + jump(i-1,j,k)%grad(1,1))/2. else nb = 1 jmean(1) = (jump(i+1,j,k)%grad(1,1) + jump(i+2,j,k)%grad(1,1))/2. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(1,1) + jump(i+1,j,k)%grad(1,1))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dudx(-1) = dudxm dudx( 1) = dudxp dudx( nb) = miuh*dudx(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dudx(-nb) = miu_pls*dudx(-nb) RD1 = 2.*(dudx(1)-dudx(-1))/dx ! d/dx(2.*miu*du/dx) endif !- 2nd y-derivative -! ph(-1) = phi(i,j-1,k) ph( 1) = phi(i,j+1,k) if (minval(ph) .gt. 0.) then ! in fluid 1 RD2 = miu1*RD2 RD3 = 0. elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD2 = miu2*RD2 RD3 = 0. else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j-1,k)%grad(1,2) + jump(i+1,j-1,k)%grad(1,2))/2. else nb = 1 jmean(1) = (jump(i,j+1,k)%grad(1,2) + jump(i+1,j+1,k)%grad(1,2))/2. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(1,2) + jump(i+1,j,k)%grad(1,2))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dudy(-1) = dudym dudy( 1) = dudyp dudy( nb) = miuh*dudy(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dudy(-nb) = miu_pls*dudy(-nb) RD2 = (dudy(1)-dudy(-1))/dy ! d/dy(miu*du/dy) ! Below L and R locates on the vertices ph(-1) = (phi(i,j,k)+phi(i,j-1,k))/2. ph( 1) = (phi(i,j,k)+phi(i,j+1,k))/2. if (minval(ph) .gt. 0.) then ! in fluid 1 RD3 = miu1*(dvdxp-dvdxm)/dy elseif ( maxval(ph) .lt. 0. ) then ! in fluid 2 RD3 = miu2*(dvdxp-dvdxm)/dy else ! between L and R if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j-1,k)%grad(2,1) + jump(i+1,j-1,k)%grad(2,1) & +jump(i,j ,k)%grad(2,1) + jump(i+1,j ,k)%grad(2,1))/4. elseif ( ph(1)*ph(0) .lt. 0.) then nb = 1 jmean(1) = (jump(i,j+1,k)%grad(2,1) + jump(i+1,j+1,k)%grad(2,1) & +jump(i,j ,k)%grad(2,1) + jump(i+1,j ,k)%grad(2,1))/4. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(2,1) + jump(i+1,j,k)%grad(2,1))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dvdx(-1) = dvdxm dvdx( 1) = dvdxp dvdx( nb) = miuh*dvdx(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dvdx(-nb) = miu_pls*dvdx(-nb) RD3 = (dvdx(1)-dvdx(-1))/dy ! d/dy(miu*dv/dx) endif endif !- 2nd z-derivative -! ph(-1) = phi(i,j,k-1) ph( 1) = phi(i,j,k+1) if (minval(ph) .gt. 0.) then ! in fluid 1 RD4 = miu1*RD4 RD5 = 0. elseif (maxval(ph) .lt. 0.) then ! in fluid 2 RD4 = miu2*RD4 RD5 = 0. else if (ph(0) .gt. 0.) then miu_pls = miu1 miu_mns = miu2 else miu_pls = miu2 miu_mns = miu1 endif if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j,k-1)%grad(1,3) + jump(i+1,j,k-1)%grad(1,3))/2. else nb = 1 jmean(1) = (jump(i,j,k+1)%grad(1,3) + jump(i+1,j,k+1)%grad(1,3))/2. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(1,3) + jump(i+1,j,k)%grad(1,3))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dudz(-1) = dudzm dudz( 1) = dudzp dudz( nb) = miuh*dudz(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dudz(-nb) = miu_pls*dudz(-nb) RD4 = (dudz(1)-dudz(-1))/dz ! d/dz(miu*du/dz) ! Below L and R locates on the vertices ph(-1) = (phi(i,j,k)+phi(i,j,k-1))/2. ph( 1) = (phi(i,j,k)+phi(i,j,k+1))/2. if (minval(ph) .gt. 0.) then ! in fluid 1 RD5 = miu1*(dwdxp-dwdxm)/dz elseif ( maxval(ph) .lt. 0. ) then ! in fluid 2 RD5 = miu2*(dwdxp-dwdxm)/dz else ! between L and R if ( ph(-1)*ph(0) .le. 0.) then nb = -1 jmean(-1) = (jump(i,j,k-1)%grad(3,1) + jump(i+1,j,k-1)%grad(3,1) & +jump(i,j ,k)%grad(3,1) + jump(i+1,j ,k)%grad(3,1))/4. elseif ( ph(1)*ph(0) .lt. 0.) then nb = 1 jmean(1) = (jump(i,j,k+1)%grad(3,1) + jump(i+1,j,k+1)%grad(3,1) & +jump(i,j ,k)%grad(3,1) + jump(i+1,j ,k)%grad(3,1))/4. endif theta = abs(ph(nb))/( abs(ph(nb)) +abs(ph(0)) ) ! linear interpln. jmean(0) = (jump(i,j,k)%grad(3,1) + jump(i+1,j,k)%grad(3,1))/2. Ji = theta*jmean(0) +(1.-theta)*jmean(nb) ! interpolated jump at the interface Ji = Ji*(miu_pls-miu_mns) miuh = miu_pls*miu_mns/(miu_pls*theta+miu_mns*(1.-theta)) ! effective viscosity dwdx(-1) = dwdxm dwdx( 1) = dwdxp dwdx( nb) = miuh*dwdx(nb) + miuh/miu_mns*theta*Ji ! interface btw 0 and nb dwdx(-nb) = miu_pls*dwdx(-nb) RD5 = (dwdx(1)-dwdx(-1))/dz ! d/dz(miu*dw/dx) endif endif RDu(i,j,k) = (RD1+RD2+RD3+RD4+RD5)/rho_u(i,j,k) endif enddo enddo enddo return end subroutine gfm4diff end module mod_gfm
#!/usr/bin/env Rscript # dpois, ppois, qpois, rposi # d-密度函数后分布律 # p-分布函数 # q-分布函数的反函数,即给定概率p下,求其下分为点 # r-仿真(产生相同分布随机数) # eg.1 # Binom distribution par(mfrow=c(3,3)) for (i in seq(.1, .9, .1)) { barplot(dbinom(0:5, 5, i)) # p == that 使用list里面的变量值变换替换 title(main=(substitute(p == that, list(that = i)))) } # eg.2 # Possion distribution # type = "b": both - 点线 # pch = n: 控制连接点的symbol plot(dpois(0:20, 3), type="b", pch=15, xlab="k", ylab="p(k)") points(dpois(0:20, 6), type="b", pch=17) points(dpois(0:20, 10), type="b", pch=19) # text 在指定坐标输入txt text(c(3.5, 6.5, 11.5), c(.18, .14, .09), c(expression(lambda==3), expression(lambda==6), expression(lambda==10))) title(main="Possion Distribution") # eg.3 理解概率密度, 当连续型变量, 在某个值上的频数, 实际上非常小(因为连续分母很大) x = rnorm(100000) par(mfrow=c(2,2)) # hist: 按n分成相等的份, 在该区间的频数和 hist(x, 14, col="blue", xlab="", ylab="", main="Histogram 1") hist(x, 50, col="blue", axes=FALSE, xlab="", ylab="", main="Histogram 2") hist(x, 100, col="blue", xlab="", ylab="", main="Histogram 2") # 正态分布x>4, y接近0 (因为sigma=1, mu=0, 3*sigma --> 99%) # dnorm 是密度函数, 给定xs, 返回ys xs = seq(-4, 4, l=1000) ys = dnorm(xs) plot(xs, ys, type="l", axes=FALSE, xlab="", ylab="", main="Density") # 多边形填充 polygon(c(xs[xs>-4]), c(dnorm(c(xs[xs>-4]))), col="blue") # eg.4 正态分布 不同值, 形状 xs = seq(-5, 5, .001) par(mfrow=c(1,1)) ys1 = dnorm(xs, mean=-2, sd = .5) ys2 = dnorm(xs, mean=0, sd = 1) # lty: line type plot(xs, ys1, type="l", lty=2, xlab="", ylab="") lines(xs, ys2) text(c(-2, 0), c(.3, .2), c("N(-2, 0.5)", "N(0,1)")) # eg.5 pdf 密度函数积分(r1 --> r2) xs = c(seq(-4, 4, length=1000)) ys = dnorm(xs) r1 = 0.51 r2 = 1.57 xs2 = c(r1, r1, xs[xs>r1&xs<r2], r2, r2) ys2 = dnorm(c(r1, xs[xs>r1&xs<r2], r2)) ys2 = c(0, ys2, 0) par(mfrow=c(1,1)) plot(xs, ys, type="l", ylab=expression(phi(x))) # 画底下一条线 abline(h = 0) polygon(xs2, ys2, col="gray") # eg6. 卡方分布 xs = seq(0, 10, l=1000) ys1 = dchisq(xs, 2) ys2 = dchisq(xs, 3) ys3 = dchisq(xs, 5) par(mfrow=c(1,1)) plot(xs, ys1, type="l", xlab="", ylab="") lines(xs, ys2, lty=2) lines(xs, ys3, lty=3) text(c(0, 1, 7), c(.35, .2, .1), c( expression(chi^2(2)), expression(chi^2(3)), expression(chi^2(5)))) # eg7. t分布 -- 标准化过程中没有使用总体的标准差sigma, 而是使用了样本中的标准差s xs = seq(-4, 4, l=1000) ys1 = dnorm(xs) ys2 = dt(xs, 1) par(mfrow=c(1,1)) plot(xs, ys1, type="l", xlab="", ylab="") lines(xs, ys2, lty=2)
-- Copyright (c) 2018 Scott Morrison. All rights reserved. -- Released under Apache 2.0 license as described in the file LICENSE. -- Authors: Scott Morrison import category_theory.products import category_theory.limits.preserves open category_theory category_theory.category namespace category_theory.limits universes v u -- declare the `v`'s first; see `category_theory.category` for an explanation variables {C : Type u} [𝒞 : category.{v} C] include 𝒞 variables {J K : Type v} [small_category J] [small_category K] @[simp] lemma cone.functor_w {F : J ⥤ (K ⥤ C)} (c : cone F) {j j' : J} (f : j ⟶ j') (k : K) : (c.π.app j).app k ≫ (F.map f).app k = (c.π.app j').app k := by convert ←nat_trans.congr_app (c.π.naturality f).symm k; apply id_comp @[simp] lemma cocone.functor_w {F : J ⥤ (K ⥤ C)} (c : cocone F) {j j' : J} (f : j ⟶ j') (k : K) : (F.map f).app k ≫ (c.ι.app j').app k = (c.ι.app j).app k := by convert ←nat_trans.congr_app (c.ι.naturality f) k; apply comp_id @[simp] def functor_category_limit_cone [has_limits_of_shape J C] (F : J ⥤ K ⥤ C) : cone F := { X := F.flip ⋙ lim, π := { app := λ j, { app := λ k, limit.π (F.flip.obj k) j }, naturality' := λ j j' f, by ext k; convert (limit.w (F.flip.obj k) _).symm using 1; apply id_comp } } @[simp] def functor_category_colimit_cocone [has_colimits_of_shape J C] (F : J ⥤ K ⥤ C) : cocone F := { X := F.flip ⋙ colim, ι := { app := λ j, { app := λ k, colimit.ι (F.flip.obj k) j }, naturality' := λ j j' f, by ext k; convert (colimit.w (F.flip.obj k) _) using 1; apply comp_id } } @[simp] def evaluate_functor_category_limit_cone [has_limits_of_shape J C] (F : J ⥤ K ⥤ C) (k : K) : ((evaluation K C).obj k).map_cone (functor_category_limit_cone F) ≅ limit.cone (F.flip.obj k) := cones.ext (iso.refl _) (by tidy) @[simp] def evaluate_functor_category_colimit_cocone [has_colimits_of_shape J C] (F : J ⥤ K ⥤ C) (k : K) : ((evaluation K C).obj k).map_cocone (functor_category_colimit_cocone F) ≅ colimit.cocone (F.flip.obj k) := cocones.ext (iso.refl _) (by tidy) def functor_category_is_limit_cone [has_limits_of_shape J C] (F : J ⥤ K ⥤ C) : is_limit (functor_category_limit_cone F) := { lift := λ s, { app := λ k, limit.lift (F.flip.obj k) (((evaluation K C).obj k).map_cone s), naturality' := λ k k' f, by ext; dsimp; simpa using (s.π.app j).naturality f }, uniq' := λ s m w, begin ext1 k, exact is_limit.uniq _ (((evaluation K C).obj k).map_cone s) (m.app k) (λ j, nat_trans.congr_app (w j) k) end } def functor_category_is_colimit_cocone [has_colimits_of_shape.{v} J C] (F : J ⥤ K ⥤ C) : is_colimit (functor_category_colimit_cocone F) := { desc := λ s, { app := λ k, colimit.desc (F.flip.obj k) (((evaluation K C).obj k).map_cocone s), naturality' := λ k k' f, begin ext, rw [←assoc, ←assoc], dsimp [functor.flip], simpa using (s.ι.app j).naturality f end }, uniq' := λ s m w, begin ext1 k, exact is_colimit.uniq _ (((evaluation K C).obj k).map_cocone s) (m.app k) (λ j, nat_trans.congr_app (w j) k) end } instance functor_category_has_limits_of_shape [has_limits_of_shape J C] : has_limits_of_shape J (K ⥤ C) := λ F, { cone := functor_category_limit_cone F, is_limit := functor_category_is_limit_cone F } instance functor_category_has_colimits_of_shape [has_colimits_of_shape J C] : has_colimits_of_shape J (K ⥤ C) := λ F, { cocone := functor_category_colimit_cocone F, is_colimit := functor_category_is_colimit_cocone F } instance functor_category_has_limits [has_limits C] : has_limits (K ⥤ C) := λ J 𝒥, by resetI; apply_instance instance functor_category_has_colimits [has_colimits C] : has_colimits (K ⥤ C) := λ J 𝒥, by resetI; apply_instance instance evaluation_preserves_limits_of_shape [has_limits_of_shape J C] (k : K) : preserves_limits_of_shape J ((evaluation K C).obj k) := λ F, preserves_limit_of_preserves_limit_cone (limit.is_limit _) $ is_limit.of_iso_limit (limit.is_limit _) (evaluate_functor_category_limit_cone F k).symm instance evaluation_preserves_colimits_of_shape [has_colimits_of_shape J C] (k : K) : preserves_colimits_of_shape J ((evaluation K C).obj k) := λ F, preserves_colimit_of_preserves_colimit_cocone (colimit.is_colimit _) $ is_colimit.of_iso_colimit (colimit.is_colimit _) (evaluate_functor_category_colimit_cocone F k).symm instance evaluation_preserves_limits [has_limits C] (k : K) : preserves_limits ((evaluation K C).obj k) := λ J 𝒥, by resetI; apply_instance instance evaluation_preserves_colimits [has_colimits C] (k : K) : preserves_colimits ((evaluation K C).obj k) := λ J 𝒥, by resetI; apply_instance end category_theory.limits
#!/usr/bin/gap # https://cp4space.wordpress.com/2020/05/10/minimalistic-quantum-computation/ Print("running universal.gap\n");; r2 := Sqrt(2);; ir2 := 1/r2;; i := [[1, 0], [0, 1]];; w := [[E(4), 0], [0, E(4)]];; x := [[0, 1], [1, 0]];; z := [[1, 0], [0, -1]];; s := [[1, 0], [0, E(4)]];; h := [[ir2, ir2], [ir2, -ir2]];; Cliff1 := Group(w, s, h);; # Order 192 Pauli1 := Group(w, x, z);; # Order 32 xi := KroneckerProduct(x, i);; ix := KroneckerProduct(i, x);; zi := KroneckerProduct(z, i);; iz := KroneckerProduct(i, z);; si := KroneckerProduct(s, i);; is := KroneckerProduct(i, s);; hi := KroneckerProduct(h, i);; ih := KroneckerProduct(i, h);; wi := KroneckerProduct(w, i);; cz := [ [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, -1]];; Cliff2 := Group(si, is, hi, ih, wi, cz);; # Order 92160 #for g in Cliff2 do Print(g, "\n"); od; Pauli2 := Group(wi, xi, ix, zi, iz);; xii := KroneckerProduct(xi, i);; ixi := KroneckerProduct(i, xi);; iix := KroneckerProduct(i, ix);; zii := KroneckerProduct(zi, i);; izi := KroneckerProduct(i, zi);; iiz := KroneckerProduct(i, iz);; sii := KroneckerProduct(si, i);; isi := KroneckerProduct(i, si);; iis := KroneckerProduct(i, is);; hii := KroneckerProduct(hi, i);; ihi := KroneckerProduct(i, hi);; iih := KroneckerProduct(i, ih);; wii := KroneckerProduct(wi, i);; icz := KroneckerProduct(i, cz);; czi := KroneckerProduct(cz, i);; Tofolli := [ [1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0]];; zhh := zii*ihi*iih; hzh := izi*hii*iih; hhz := iiz*hii*ihi; xhh := xii*ihi*iih; hxh := ixi*hii*iih; hhx := iix*hii*ihi; Gx := Group(Tofolli, xhh, hxh, hhx); Gz := Group(Tofolli, zhh, hzh, hhz); Print("Order(Gz) = ", Order(Gz), "\n"); Print("Order(Gx) = ", Order(Gx), "\n"); L7:= SimpleLieAlgebra("E", 7, Rationals);; R7:= RootSystem(L7);; W7:= WeylGroup(R7); Print("Order(W7) = ", Order(W7), "\n"); f := IsomorphismGroups(Gz, W7); Print("IsomorphismGroups(Gz, E7) = ", f, "\n"); L8:= SimpleLieAlgebra("E", 8, Rationals);; R8:= RootSystem(L8);; W8:= WeylGroup(R8); Print("Order(W8) = ", Order(W8), "\n"); f := IsomorphismGroups(Gx, W8); Print("IsomorphismGroups(Gx, E8) = ", f, "\n");
State Before: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R ⊢ degrees (p + q) ≤ degrees p ⊔ degrees q State After: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R ⊢ (Finset.sup (support (p + q)) fun s => ↑toMultiset s) ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s Tactic: simp_rw [degrees_def] State Before: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R ⊢ (Finset.sup (support (p + q)) fun s => ↑toMultiset s) ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s State After: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s Tactic: refine' Finset.sup_le fun b hb => _ State Before: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s State After: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) this : b ∈ p.support ∪ q.support ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s Tactic: have := Finsupp.support_add hb State Before: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) this : b ∈ p.support ∪ q.support ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s State After: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) this : b ∈ p.support ∨ b ∈ q.support ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s Tactic: rw [Finset.mem_union] at this State Before: R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) this : b ∈ p.support ∨ b ∈ q.support ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s State After: case inl R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) h : b ∈ p.support ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s case inr R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) h : b ∈ q.support ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s Tactic: cases' this with h h State Before: case inl R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) h : b ∈ p.support ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s State After: no goals Tactic: exact le_sup_of_le_left (Finset.le_sup h) State Before: case inr R : Type u S : Type v σ : Type u_1 τ : Type ?u.31525 r : R e : ℕ n m : σ s : σ →₀ ℕ inst✝¹ : CommSemiring R p✝ q✝ : MvPolynomial σ R inst✝ : DecidableEq σ p q : MvPolynomial σ R b : σ →₀ ℕ hb : b ∈ support (p + q) h : b ∈ q.support ⊢ ↑toMultiset b ≤ (Finset.sup (support p) fun s => ↑toMultiset s) ⊔ Finset.sup (support q) fun s => ↑toMultiset s State After: no goals Tactic: exact le_sup_of_le_right (Finset.le_sup h)
If youre politically active, youve probably seen John Green. If you like hanging out with people who like to rant about the evils of the capitalist system, youve probably seen John Green. If youve passed by peace rallies, youve probably seen John Green. If you ride any of the MU stop buses, youve probably seen John Green. This foo be everywhere. John Green has at various times been: An Irish Catholic in Students for Justice in Palestine The president of UC Davis Chapter of the International Socialist Organization An California Aggie Aggie columnist see also The College Republicans Drinking Game An employee of Sodexho Distinguishing Feature: sideways baseball cap (upturned brim?)
PROGRAM SNDELT C************************************************************************ C* SNDELT * C* * C* This program deletes data from a sounding data file. * C* * C* Log: * C* M. desJardins/GSFC 10/88 From SFDELT * C* K. Brill/NMC 10/90 Declare TTT * C* L. Williams/EAI 3/94 Clean up declarations of user input * C* variables * C* L. Williams/EAI 6/94 Removed call to SNDUPD * C* K. Tyle/GSC 8/96 Added FL_MFIL to search for file type * C* S. Maxwell/GSC 7/97 Increased input character length * C* T. Piper/SAIC 4/02 Fixed UMR; initialized snfcur * C************************************************************************ INCLUDE 'GEMPRM.PRM' C* CHARACTER snfile*(LLMXLN), dattim*(LLMXLN), area*(LLMXLN) C* LOGICAL respnd, done, proces, allflg CHARACTER timdst (LLMXTM)*20 CHARACTER times (LLMXTM)*20, ttt*20 CHARACTER stn*8, snfcur*72, filnam*72 C----------------------------------------------------------------------- snfcur = ' ' C C* Initilaize user interface. C CALL IP_INIT ( respnd, iperr ) IF ( iperr .ne. 0 ) THEN CALL ER_WMSG ( 'SNDELT', iperr, ' ', ier ) CALL SS_EXIT END IF CALL IP_IDNT ( 'SNDELT', ier ) C C* Main loop. C done = .false. isnfln = 0 DO WHILE ( .not. done ) C C* Get user input and exit if there is an error. C CALL SNDINP ( snfile, dattim, area, iperr ) IF ( iperr .ne. 0 ) THEN CALL ER_WMSG ( 'SNDELT', iperr, ' ', ier ) CALL SS_EXIT END IF proces = .true. C C* Open the sounding data file. C CALL FL_MFIL ( snfile, ' ', filnam, iret ) IF ( iret .ne. 0 ) CALL ER_WMSG ( 'FL', iret, ' ', ier ) CALL SNDFIL ( filnam, snfcur, isnfln, ntdset, timdst, ier ) IF ( ier .ne. 0 ) proces = .false. C C* Find the times to delete. C IF ( proces ) THEN CALL TI_FIND ( dattim, ntdset, timdst, ttt, + ntime, times, ier ) IF ( ier .ne. 0 ) proces = .false. END IF C C* Check area for DSET or ALL. Otherwise, set area. C IF ( proces ) THEN CALL ST_LCUC ( area, area, ier ) IF (( area .eq. 'DSET' ) .or. ( area .eq. 'ALL' )) THEN allflg = .true. ELSE allflg = .false. CALL LC_SARE ( area, isnfln, stn, ier ) IF ( ier .ne. 0 ) proces = .false. END IF END IF C C* Loop through all times. C itime = 1 DO WHILE ( proces .and. ( itime .le. ntime ) ) C C* Give the user a chance to exit. C CALL SNDOPT ( times (itime), filnam, area, + ier ) C C* If user wants to exit, do not process any more times. C IF ( ier .ne. 0 ) THEN proces = .false. C C* Otherwise, process time. C ELSE IF ( allflg ) THEN C C* Delete all data for this time. C CALL SN_DTIM ( isnfln, times (itime), ier ) IF ( ier .ne. 0 ) THEN CALL ER_WMSG ('SN', ier, times (itime), ierr) CALL ER_WMSG ('SNDELT', -3, times (itime), ier) END IF ELSE C C* Set the time. Then loop through deleting data from C* stations. C CALL SN_STIM ( isnfln, times (itime), ier ) ier = 0 DO WHILE ( ier .eq. 0 ) CALL SN_SNXT ( isnfln, stn, istnm, slat, + slon, selv, ier ) IF ( ier .eq. 0 ) CALL SN_DDAT ( isnfln, i ) END DO END IF C C* Go to next time. C itime = itime + 1 END DO C C* Call the dynamic tutor. C CALL IP_DYNM ( done, ier ) END DO C C* Close any file that is open. C CALL SN_CLOS ( isnfln, ier ) C C* Exit. C CALL IP_EXIT ( iret ) END
[STATEMENT] lemma Infinitesimal_approx_minus: "x - y \<in> Infinitesimal \<longleftrightarrow> x \<approx> y" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (x - y \<in> Infinitesimal) = (x \<approx> y) [PROOF STEP] by (simp add: approx_minus_iff [symmetric] mem_infmal_iff)
Require Import Kami.Syntax Kami.Semantics Kami.RefinementFacts Kami.Renaming Kami.Wf. Require Import Kami.Inline Kami.InlineFacts Kami.Tactics Lib.CommonTactics. Require Import Ex.SC Ex.MemTypes Ex.ProcThreeStage. Set Implicit Arguments. Section Inlined. Variables addrSize iaddrSize instBytes dataBytes rfIdx: nat. Variables (fetch: AbsFetch addrSize iaddrSize instBytes dataBytes) (dec: AbsDec addrSize instBytes dataBytes rfIdx) (exec: AbsExec addrSize instBytes dataBytes rfIdx). Variable (d2eElt: Kind). Variable (d2ePack: forall ty, Expr ty (SyntaxKind (Bit 2)) -> (* opTy *) Expr ty (SyntaxKind (Bit rfIdx)) -> (* dst *) Expr ty (SyntaxKind (Bit addrSize)) -> (* addr *) Expr ty (SyntaxKind (Array Bool dataBytes)) -> (* byteEn *) Expr ty (SyntaxKind (Data dataBytes)) -> (* val1 *) Expr ty (SyntaxKind (Data dataBytes)) -> (* val2 *) Expr ty (SyntaxKind (Data instBytes)) -> (* rawInst *) Expr ty (SyntaxKind (Pc addrSize)) -> (* curPc *) Expr ty (SyntaxKind (Pc addrSize)) -> (* nextPc *) Expr ty (SyntaxKind Bool) -> (* epoch *) Expr ty (SyntaxKind d2eElt)). Variables (d2eOpType: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind (Bit 2))) (d2eDst: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind (Bit rfIdx))) (d2eAddr: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind (Bit addrSize))) (d2eByteEn: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind (Array Bool dataBytes))) (d2eVal1 d2eVal2: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind (Data dataBytes))) (d2eRawInst: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind (Data instBytes))) (d2eCurPc: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind (Pc addrSize))) (d2eNextPc: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind (Pc addrSize))) (d2eEpoch: forall ty, fullType ty (SyntaxKind d2eElt) -> Expr ty (SyntaxKind Bool)). Variable (e2wElt: Kind). Variable (e2wPack: forall ty, Expr ty (SyntaxKind d2eElt) -> (* decInst *) Expr ty (SyntaxKind (Data dataBytes)) -> (* execVal *) Expr ty (SyntaxKind e2wElt)). Variables (e2wDecInst: forall ty, fullType ty (SyntaxKind e2wElt) -> Expr ty (SyntaxKind d2eElt)) (e2wVal: forall ty, fullType ty (SyntaxKind e2wElt) -> Expr ty (SyntaxKind (Data dataBytes))). Variable (init: ProcInit addrSize dataBytes rfIdx). Definition p3st := p3st fetch dec exec d2ePack d2eOpType d2eDst d2eAddr d2eByteEn d2eVal1 d2eVal2 d2eRawInst d2eCurPc d2eNextPc d2eEpoch e2wPack e2wDecInst e2wVal init. #[local] Hint Unfold p3st: ModuleDefs. (* for kinline_compute *) Definition p3stInl: sigT (fun m: Modules => p3st <<== m). Proof. (* SKIP_PROOF_ON kinline_refine p3st. END_SKIP_PROOF_ON *) apply cheat. Defined. End Inlined.
subsection \<open> Instances for Partial Monoids \<close> theory Partial_Monoids_Instances imports Partial_Monoids "Z_Toolkit.Z_Toolkit" begin subsection \<open> Partial Functions \<close> instantiation pfun :: (type, type) pas begin definition compat_pfun :: "('a, 'b) pfun \<Rightarrow> ('a, 'b) pfun \<Rightarrow> bool" where "f ## g = (pdom(f) \<inter> pdom(g) = {})" instance proof fix x y z :: "('a, 'b) pfun" assume "x ## y" thus "y ## x" by (auto simp add: compat_pfun_def) assume a: "x ## y" "x + y ## z" thus "x ## y + z" by (auto simp add: compat_pfun_def) from a show "y ## z" by (auto simp add: compat_pfun_def) from a show "x + y + z = x + (y + z)" by (simp add: add.assoc) next fix x y :: "('a, 'b) pfun" assume "x ## y" thus "x + y = y + x" by (meson compat_pfun_def pfun_plus_commute) qed end instance pfun :: (type, type) pam proof fix x :: "('a, 'b) pfun" show "{}\<^sub>p ## x" by (simp add: compat_pfun_def) show "{}\<^sub>p + x = x" by (simp) show "x + {}\<^sub>p = x" by (simp) qed instance pfun :: (type, type) pam_cancel_pos proof fix x y z :: "('a, 'b) pfun" assume "z ## x" "z ## y" "z + x = z + y" thus "x = y" by (auto simp add: compat_pfun_def, metis Int_commute pfun_minus_plus pfun_plus_commute) next fix x y :: "('a, 'b) pfun" show "x + y = {}\<^sub>p \<Longrightarrow> x = {}\<^sub>p" using pfun_plus_pos by blast qed lemma pfun_compat_minus: fixes x y :: "('a, 'b) pfun" assumes "y \<subseteq>\<^sub>p x" shows "y ## x - y" using assms by (simp add: compat_pfun_def) instance pfun :: (type, type) sep_alg proof show 1: "\<And> x y :: ('a, 'b) pfun. (x \<subseteq>\<^sub>p y) = (x \<preceq>\<^sub>G y)" by (simp add: green_preorder_def compat_pfun_def) (metis compat_pfun_def pfun_compat_minus pfun_le_plus pfun_plus_commute pfun_plus_minus) show "\<And>x y :: ('a, 'b) pfun. (x \<subset>\<^sub>p y) = (x \<prec>\<^sub>G y)" by (simp add: "1" green_strict_def less_le_not_le) show "\<And>x y :: ('a, 'b) pfun. y \<subseteq>\<^sub>p x \<Longrightarrow> x - y = x -\<^sub>G y" apply (rule sym) apply (auto simp add: green_subtract_def 1[THEN sym]) apply (rule the_equality) apply (auto simp add: pfun_compat_minus) using pfun_compat_minus pfun_plus_minus plus_pcomm apply fastforce apply (metis Int_commute compat_pfun_def pfun_minus_plus plus_pcomm) done qed instance pfun :: (type, type) sep_alg_cancel_pos .. subsection \<open> Finite Functions \<close> instantiation ffun :: (type, type) pas begin definition compat_ffun :: "('a, 'b) ffun \<Rightarrow> ('a, 'b) ffun \<Rightarrow> bool" where "f ## g = (fdom(f) \<inter> fdom(g) = {})" instance proof fix x y z :: "('a, 'b) ffun" assume "x ## y" thus "y ## x" by (simp add: compat_ffun_def inf_commute) assume a:"x ## y" "x + y ## z" thus "x ## y + z" by (metis (mono_tags, lifting) Partial_Monoids_Instances.compat_ffun_def compat_pfun_def compat_property fdom.rep_eq fdom_plus pdom_plus) from a show "y ## z" by (metis Partial_Monoids_Instances.compat_ffun_def compat_pfun_def compat_property fdom.rep_eq plus_ffun.rep_eq) from a show "x + y + z = x + (y + z)" by (simp add: add.assoc) next fix x y :: "('a, 'b) ffun" assume "x ## y" thus "x + y = y + x" by (meson compat_ffun_def ffun_plus_commute) qed end instance ffun :: (type, type) pam proof fix x :: "('a, 'b) ffun" show "{}\<^sub>f ## x" by (simp add: compat_ffun_def) show "{}\<^sub>f + x = x" by (simp) show "x + {}\<^sub>f = x" by (simp) qed instance ffun :: (type, type) pam_cancel_pos proof fix x y z :: "('a, 'b) ffun" assume "z ## x" "z ## y" "z + x = z + y" thus "x = y" by (metis compat_comm compat_ffun_def ffun_minus_plus plus_pcomm) next fix x y :: "('a, 'b) ffun" show "x + y = {}\<^sub>f \<Longrightarrow> x = {}\<^sub>f" using ffun_plus_pos by auto qed lemma ffun_compat_minus: fixes x y :: "('a, 'b) ffun" assumes "y \<subseteq>\<^sub>f x" shows "y ## x - y" by (metis assms compat_ffun_def compat_pfun_def fdom.rep_eq less_eq_ffun.rep_eq minus_ffun.rep_eq pfun_compat_minus) instance ffun :: (type, type) sep_alg proof show 1: "\<And> x y :: ('a, 'b) ffun. (x \<subseteq>\<^sub>f y) = (x \<preceq>\<^sub>G y)" using compat_ffun_def ffun_compat_minus ffun_le_plus ffun_plus_minus green_preorder_def plus_pcomm by fastforce show "\<And>x y :: ('a, 'b) ffun. (x \<subset>\<^sub>f y) = (x \<prec>\<^sub>G y)" by (simp add: "1" green_strict_def less_le_not_le) show "\<And>x y :: ('a, 'b) ffun. y \<subseteq>\<^sub>f x \<Longrightarrow> x - y = x -\<^sub>G y" apply (rule sym) apply (auto simp add: green_subtract_def 1[THEN sym]) apply (rule the_equality) apply (auto simp add: ffun_compat_minus) using ffun_compat_minus ffun_plus_minus plus_pcomm apply fastforce apply (metis compat_comm compat_ffun_def ffun_minus_plus plus_pcomm) done qed instance ffun :: (type, type) sep_alg_cancel_pos .. end
State Before: C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ ⊢ EqId A ↔ A.fst = Δ State After: case mp C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ ⊢ EqId A → A.fst = Δ case mpr C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ ⊢ A.fst = Δ → EqId A Tactic: constructor State Before: case mp C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ ⊢ EqId A → A.fst = Δ State After: case mp C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ h : EqId A ⊢ A.fst = Δ Tactic: intro h State Before: case mp C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ h : EqId A ⊢ A.fst = Δ State After: case mp C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ h : A = id Δ ⊢ A.fst = Δ Tactic: dsimp at h State Before: case mp C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ h : A = id Δ ⊢ A.fst = Δ State After: case mp C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ h : A = id Δ ⊢ (id Δ).fst = Δ Tactic: rw [h] State Before: case mp C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ h : A = id Δ ⊢ (id Δ).fst = Δ State After: no goals Tactic: rfl State Before: case mpr C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ ⊢ A.fst = Δ → EqId A State After: case mpr C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ h : A.fst = Δ ⊢ EqId A Tactic: intro h State Before: case mpr C : Type ?u.4324 inst✝ : Category C Δ : SimplexCategoryᵒᵖ A : IndexSet Δ h : A.fst = Δ ⊢ EqId A State After: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C Δ fst✝ : SimplexCategoryᵒᵖ f : Δ.unop ⟶ fst✝.unop hf : Epi f h : { fst := fst✝, snd := { val := f, property := hf } }.fst = Δ ⊢ EqId { fst := fst✝, snd := { val := f, property := hf } } Tactic: rcases A with ⟨_, ⟨f, hf⟩⟩ State Before: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C Δ fst✝ : SimplexCategoryᵒᵖ f : Δ.unop ⟶ fst✝.unop hf : Epi f h : { fst := fst✝, snd := { val := f, property := hf } }.fst = Δ ⊢ EqId { fst := fst✝, snd := { val := f, property := hf } } State After: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C Δ fst✝ : SimplexCategoryᵒᵖ f : Δ.unop ⟶ fst✝.unop hf : Epi f h : fst✝ = Δ ⊢ EqId { fst := fst✝, snd := { val := f, property := hf } } Tactic: simp only at h State Before: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C Δ fst✝ : SimplexCategoryᵒᵖ f : Δ.unop ⟶ fst✝.unop hf : Epi f h : fst✝ = Δ ⊢ EqId { fst := fst✝, snd := { val := f, property := hf } } State After: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C fst✝ : SimplexCategoryᵒᵖ f : fst✝.unop ⟶ fst✝.unop hf : Epi f ⊢ EqId { fst := fst✝, snd := { val := f, property := hf } } Tactic: subst h State Before: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C fst✝ : SimplexCategoryᵒᵖ f : fst✝.unop ⟶ fst✝.unop hf : Epi f ⊢ EqId { fst := fst✝, snd := { val := f, property := hf } } State After: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C fst✝ : SimplexCategoryᵒᵖ f : fst✝.unop ⟶ fst✝.unop hf : Epi f ⊢ e { fst := fst✝, snd := { val := f, property := hf } } ≫ eqToHom (_ : { fst := fst✝, snd := { val := f, property := hf } }.fst.unop = (id fst✝).fst.unop) = e (id fst✝) Tactic: refine' ext _ _ rfl _ State Before: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C fst✝ : SimplexCategoryᵒᵖ f : fst✝.unop ⟶ fst✝.unop hf : Epi f ⊢ e { fst := fst✝, snd := { val := f, property := hf } } ≫ eqToHom (_ : { fst := fst✝, snd := { val := f, property := hf } }.fst.unop = (id fst✝).fst.unop) = e (id fst✝) State After: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C fst✝ : SimplexCategoryᵒᵖ f : fst✝.unop ⟶ fst✝.unop hf this : Epi f ⊢ e { fst := fst✝, snd := { val := f, property := hf } } ≫ eqToHom (_ : { fst := fst✝, snd := { val := f, property := hf } }.fst.unop = (id fst✝).fst.unop) = e (id fst✝) Tactic: haveI := hf State Before: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C fst✝ : SimplexCategoryᵒᵖ f : fst✝.unop ⟶ fst✝.unop hf this : Epi f ⊢ e { fst := fst✝, snd := { val := f, property := hf } } ≫ eqToHom (_ : { fst := fst✝, snd := { val := f, property := hf } }.fst.unop = (id fst✝).fst.unop) = e (id fst✝) State After: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C fst✝ : SimplexCategoryᵒᵖ f : fst✝.unop ⟶ fst✝.unop hf this : Epi f ⊢ e { fst := fst✝, snd := { val := f, property := hf } } = e (id fst✝) Tactic: simp only [eqToHom_refl, comp_id] State Before: case mpr.mk.mk C : Type ?u.4324 inst✝ : Category C fst✝ : SimplexCategoryᵒᵖ f : fst✝.unop ⟶ fst✝.unop hf this : Epi f ⊢ e { fst := fst✝, snd := { val := f, property := hf } } = e (id fst✝) State After: no goals Tactic: exact eq_id_of_epi f
% Test file for @deltafun/isempty.m function pass = test_isempty(pref) if (nargin < 1) pref = chebfunpref(); end %% d = deltafun(); pass(1) = isempty(d); f = bndfun([]); d = deltafun(f); pass(2) = isempty(d); d = deltafun(f, []); pass(3) = isempty(d); d = deltafun(f, struct('deltaMag', [], 'deltaLoc', [])); pass(4) = isempty(d); end
(* Title: HOL/Library/Finite_Map.thy Author: Lars Hupel, TU München *) section \<open>Type of finite maps defined as a subtype of maps\<close> theory Finite_Map imports FSet AList Conditional_Parametricity abbrevs "(=" = "\<subseteq>\<^sub>f" begin subsection \<open>Auxiliary constants and lemmas over \<^type>\<open>map\<close>\<close> parametric_constant map_add_transfer[transfer_rule]: map_add_def parametric_constant map_of_transfer[transfer_rule]: map_of_def context includes lifting_syntax begin abbreviation rel_map :: "('b \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('a \<rightharpoonup> 'b) \<Rightarrow> ('a \<rightharpoonup> 'c) \<Rightarrow> bool" where "rel_map f \<equiv> (=) ===> rel_option f" lemma ran_transfer[transfer_rule]: "(rel_map A ===> rel_set A) ran ran" proof fix m n assume "rel_map A m n" show "rel_set A (ran m) (ran n)" proof (rule rel_setI) fix x assume "x \<in> ran m" then obtain a where "m a = Some x" unfolding ran_def by auto have "rel_option A (m a) (n a)" using \<open>rel_map A m n\<close> by (auto dest: rel_funD) then obtain y where "n a = Some y" "A x y" unfolding \<open>m a = _\<close> by cases auto then show "\<exists>y \<in> ran n. A x y" unfolding ran_def by blast next fix y assume "y \<in> ran n" then obtain a where "n a = Some y" unfolding ran_def by auto have "rel_option A (m a) (n a)" using \<open>rel_map A m n\<close> by (auto dest: rel_funD) then obtain x where "m a = Some x" "A x y" unfolding \<open>n a = _\<close> by cases auto then show "\<exists>x \<in> ran m. A x y" unfolding ran_def by blast qed qed lemma ran_alt_def: "ran m = (the \<circ> m) ` dom m" unfolding ran_def dom_def by force parametric_constant dom_transfer[transfer_rule]: dom_def definition map_upd :: "'a \<Rightarrow> 'b \<Rightarrow> ('a \<rightharpoonup> 'b) \<Rightarrow> ('a \<rightharpoonup> 'b)" where "map_upd k v m = m(k \<mapsto> v)" parametric_constant map_upd_transfer[transfer_rule]: map_upd_def definition map_filter :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<rightharpoonup> 'b) \<Rightarrow> ('a \<rightharpoonup> 'b)" where "map_filter P m = (\<lambda>x. if P x then m x else None)" parametric_constant map_filter_transfer[transfer_rule]: map_filter_def lemma map_filter_map_of[simp]: "map_filter P (map_of m) = map_of [(k, _) \<leftarrow> m. P k]" proof fix x show "map_filter P (map_of m) x = map_of [(k, _) \<leftarrow> m. P k] x" by (induct m) (auto simp: map_filter_def) qed lemma map_filter_finite[intro]: assumes "finite (dom m)" shows "finite (dom (map_filter P m))" proof - have "dom (map_filter P m) = Set.filter P (dom m)" unfolding map_filter_def Set.filter_def dom_def by auto then show ?thesis using assms by (simp add: Set.filter_def) qed definition map_drop :: "'a \<Rightarrow> ('a \<rightharpoonup> 'b) \<Rightarrow> ('a \<rightharpoonup> 'b)" where "map_drop a = map_filter (\<lambda>a'. a' \<noteq> a)" parametric_constant map_drop_transfer[transfer_rule]: map_drop_def definition map_drop_set :: "'a set \<Rightarrow> ('a \<rightharpoonup> 'b) \<Rightarrow> ('a \<rightharpoonup> 'b)" where "map_drop_set A = map_filter (\<lambda>a. a \<notin> A)" parametric_constant map_drop_set_transfer[transfer_rule]: map_drop_set_def definition map_restrict_set :: "'a set \<Rightarrow> ('a \<rightharpoonup> 'b) \<Rightarrow> ('a \<rightharpoonup> 'b)" where "map_restrict_set A = map_filter (\<lambda>a. a \<in> A)" parametric_constant map_restrict_set_transfer[transfer_rule]: map_restrict_set_def definition map_pred :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('a \<rightharpoonup> 'b) \<Rightarrow> bool" where "map_pred P m \<longleftrightarrow> (\<forall>x. case m x of None \<Rightarrow> True | Some y \<Rightarrow> P x y)" parametric_constant map_pred_transfer[transfer_rule]: map_pred_def definition rel_map_on_set :: "'a set \<Rightarrow> ('b \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('a \<rightharpoonup> 'b) \<Rightarrow> ('a \<rightharpoonup> 'c) \<Rightarrow> bool" where "rel_map_on_set S P = eq_onp (\<lambda>x. x \<in> S) ===> rel_option P" definition set_of_map :: "('a \<rightharpoonup> 'b) \<Rightarrow> ('a \<times> 'b) set" where "set_of_map m = {(k, v)|k v. m k = Some v}" lemma set_of_map_alt_def: "set_of_map m = (\<lambda>k. (k, the (m k))) ` dom m" unfolding set_of_map_def dom_def by auto lemma set_of_map_finite: "finite (dom m) \<Longrightarrow> finite (set_of_map m)" unfolding set_of_map_alt_def by auto lemma set_of_map_inj: "inj set_of_map" proof fix x y assume "set_of_map x = set_of_map y" hence "(x a = Some b) = (y a = Some b)" for a b unfolding set_of_map_def by auto hence "x k = y k" for k by (metis not_None_eq) thus "x = y" .. qed lemma dom_comp: "dom (m \<circ>\<^sub>m n) \<subseteq> dom n" unfolding map_comp_def dom_def by (auto split: option.splits) lemma dom_comp_finite: "finite (dom n) \<Longrightarrow> finite (dom (map_comp m n))" by (metis finite_subset dom_comp) parametric_constant map_comp_transfer[transfer_rule]: map_comp_def end subsection \<open>Abstract characterisation\<close> typedef ('a, 'b) fmap = "{m. finite (dom m)} :: ('a \<rightharpoonup> 'b) set" morphisms fmlookup Abs_fmap proof show "Map.empty \<in> {m. finite (dom m)}" by auto qed setup_lifting type_definition_fmap lemma dom_fmlookup_finite[intro, simp]: "finite (dom (fmlookup m))" using fmap.fmlookup by auto lemma fmap_ext: assumes "\<And>x. fmlookup m x = fmlookup n x" shows "m = n" using assms by transfer' auto subsection \<open>Operations\<close> context includes fset.lifting begin lift_definition fmran :: "('a, 'b) fmap \<Rightarrow> 'b fset" is ran parametric ran_transfer by (rule finite_ran) lemma fmlookup_ran_iff: "y |\<in>| fmran m \<longleftrightarrow> (\<exists>x. fmlookup m x = Some y)" by transfer' (auto simp: ran_def) lemma fmranI: "fmlookup m x = Some y \<Longrightarrow> y |\<in>| fmran m" by (auto simp: fmlookup_ran_iff) lemma fmranE[elim]: assumes "y |\<in>| fmran m" obtains x where "fmlookup m x = Some y" using assms by (auto simp: fmlookup_ran_iff) lift_definition fmdom :: "('a, 'b) fmap \<Rightarrow> 'a fset" is dom parametric dom_transfer . lemma fmlookup_dom_iff: "x |\<in>| fmdom m \<longleftrightarrow> (\<exists>a. fmlookup m x = Some a)" by transfer' auto lemma fmdom_notI: "fmlookup m x = None \<Longrightarrow> x |\<notin>| fmdom m" by (simp add: fmlookup_dom_iff) lemma fmdomI: "fmlookup m x = Some y \<Longrightarrow> x |\<in>| fmdom m" by (simp add: fmlookup_dom_iff) lemma fmdom_notD[dest]: "x |\<notin>| fmdom m \<Longrightarrow> fmlookup m x = None" by (simp add: fmlookup_dom_iff) lemma fmdomE[elim]: assumes "x |\<in>| fmdom m" obtains y where "fmlookup m x = Some y" using assms by (auto simp: fmlookup_dom_iff) lift_definition fmdom' :: "('a, 'b) fmap \<Rightarrow> 'a set" is dom parametric dom_transfer . lemma fmlookup_dom'_iff: "x \<in> fmdom' m \<longleftrightarrow> (\<exists>a. fmlookup m x = Some a)" by transfer' auto lemma fmdom'_notI: "fmlookup m x = None \<Longrightarrow> x \<notin> fmdom' m" by (simp add: fmlookup_dom'_iff) lemma fmdom'I: "fmlookup m x = Some y \<Longrightarrow> x \<in> fmdom' m" by (simp add: fmlookup_dom'_iff) lemma fmdom'_notD[dest]: "x \<notin> fmdom' m \<Longrightarrow> fmlookup m x = None" by (simp add: fmlookup_dom'_iff) lemma fmdom'E[elim]: assumes "x \<in> fmdom' m" obtains x y where "fmlookup m x = Some y" using assms by (auto simp: fmlookup_dom'_iff) lemma fmdom'_alt_def: "fmdom' m = fset (fmdom m)" by transfer' force lemma finite_fmdom'[simp]: "finite (fmdom' m)" unfolding fmdom'_alt_def by simp lemma dom_fmlookup[simp]: "dom (fmlookup m) = fmdom' m" by transfer' simp lift_definition fmempty :: "('a, 'b) fmap" is Map.empty by simp lemma fmempty_lookup[simp]: "fmlookup fmempty x = None" by transfer' simp lemma fmdom_empty[simp]: "fmdom fmempty = {||}" by transfer' simp lemma fmdom'_empty[simp]: "fmdom' fmempty = {}" by transfer' simp lemma fmran_empty[simp]: "fmran fmempty = fempty" by transfer' (auto simp: ran_def map_filter_def) lift_definition fmupd :: "'a \<Rightarrow> 'b \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" is map_upd parametric map_upd_transfer unfolding map_upd_def[abs_def] by simp lemma fmupd_lookup[simp]: "fmlookup (fmupd a b m) a' = (if a = a' then Some b else fmlookup m a')" by transfer' (auto simp: map_upd_def) lemma fmdom_fmupd[simp]: "fmdom (fmupd a b m) = finsert a (fmdom m)" by transfer (simp add: map_upd_def) lemma fmdom'_fmupd[simp]: "fmdom' (fmupd a b m) = insert a (fmdom' m)" by transfer (simp add: map_upd_def) lemma fmupd_reorder_neq: assumes "a \<noteq> b" shows "fmupd a x (fmupd b y m) = fmupd b y (fmupd a x m)" using assms by transfer' (auto simp: map_upd_def) lemma fmupd_idem[simp]: "fmupd a x (fmupd a y m) = fmupd a x m" by transfer' (auto simp: map_upd_def) lift_definition fmfilter :: "('a \<Rightarrow> bool) \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" is map_filter parametric map_filter_transfer by auto lemma fmdom_filter[simp]: "fmdom (fmfilter P m) = ffilter P (fmdom m)" by transfer' (auto simp: map_filter_def Set.filter_def split: if_splits) lemma fmdom'_filter[simp]: "fmdom' (fmfilter P m) = Set.filter P (fmdom' m)" by transfer' (auto simp: map_filter_def Set.filter_def split: if_splits) lemma fmlookup_filter[simp]: "fmlookup (fmfilter P m) x = (if P x then fmlookup m x else None)" by transfer' (auto simp: map_filter_def) lemma fmfilter_empty[simp]: "fmfilter P fmempty = fmempty" by transfer' (auto simp: map_filter_def) lemma fmfilter_true[simp]: assumes "\<And>x y. fmlookup m x = Some y \<Longrightarrow> P x" shows "fmfilter P m = m" proof (rule fmap_ext) fix x have "fmlookup m x = None" if "\<not> P x" using that assms by fastforce then show "fmlookup (fmfilter P m) x = fmlookup m x" by simp qed lemma fmfilter_false[simp]: assumes "\<And>x y. fmlookup m x = Some y \<Longrightarrow> \<not> P x" shows "fmfilter P m = fmempty" using assms by transfer' (fastforce simp: map_filter_def) lemma fmfilter_comp[simp]: "fmfilter P (fmfilter Q m) = fmfilter (\<lambda>x. P x \<and> Q x) m" by transfer' (auto simp: map_filter_def) lemma fmfilter_comm: "fmfilter P (fmfilter Q m) = fmfilter Q (fmfilter P m)" unfolding fmfilter_comp by meson lemma fmfilter_cong[cong]: assumes "\<And>x y. fmlookup m x = Some y \<Longrightarrow> P x = Q x" shows "fmfilter P m = fmfilter Q m" proof (rule fmap_ext) fix x have "fmlookup m x = None" if "P x \<noteq> Q x" using that assms by fastforce then show "fmlookup (fmfilter P m) x = fmlookup (fmfilter Q m) x" by auto qed lemma fmfilter_cong'[fundef_cong]: assumes "m = n" "\<And>x. x \<in> fmdom' m \<Longrightarrow> P x = Q x" shows "fmfilter P m = fmfilter Q n" using assms(2) unfolding assms(1) by (rule fmfilter_cong) (metis fmdom'I) lemma fmfilter_upd[simp]: "fmfilter P (fmupd x y m) = (if P x then fmupd x y (fmfilter P m) else fmfilter P m)" by transfer' (auto simp: map_upd_def map_filter_def) lift_definition fmdrop :: "'a \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" is map_drop parametric map_drop_transfer unfolding map_drop_def by auto lemma fmdrop_lookup[simp]: "fmlookup (fmdrop a m) a = None" by transfer' (auto simp: map_drop_def map_filter_def) lift_definition fmdrop_set :: "'a set \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" is map_drop_set parametric map_drop_set_transfer unfolding map_drop_set_def by auto lift_definition fmdrop_fset :: "'a fset \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" is map_drop_set parametric map_drop_set_transfer unfolding map_drop_set_def by auto lift_definition fmrestrict_set :: "'a set \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" is map_restrict_set parametric map_restrict_set_transfer unfolding map_restrict_set_def by auto lift_definition fmrestrict_fset :: "'a fset \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" is map_restrict_set parametric map_restrict_set_transfer unfolding map_restrict_set_def by auto lemma fmfilter_alt_defs: "fmdrop a = fmfilter (\<lambda>a'. a' \<noteq> a)" "fmdrop_set A = fmfilter (\<lambda>a. a \<notin> A)" "fmdrop_fset B = fmfilter (\<lambda>a. a |\<notin>| B)" "fmrestrict_set A = fmfilter (\<lambda>a. a \<in> A)" "fmrestrict_fset B = fmfilter (\<lambda>a. a |\<in>| B)" by (transfer'; simp add: map_drop_def map_drop_set_def map_restrict_set_def)+ lemma fmdom_drop[simp]: "fmdom (fmdrop a m) = fmdom m - {|a|}" unfolding fmfilter_alt_defs by auto lemma fmdom'_drop[simp]: "fmdom' (fmdrop a m) = fmdom' m - {a}" unfolding fmfilter_alt_defs by auto lemma fmdom'_drop_set[simp]: "fmdom' (fmdrop_set A m) = fmdom' m - A" unfolding fmfilter_alt_defs by auto lemma fmdom_drop_fset[simp]: "fmdom (fmdrop_fset A m) = fmdom m - A" unfolding fmfilter_alt_defs by auto lemma fmdom'_restrict_set: "fmdom' (fmrestrict_set A m) \<subseteq> A" unfolding fmfilter_alt_defs by auto lemma fmdom_restrict_fset: "fmdom (fmrestrict_fset A m) |\<subseteq>| A" unfolding fmfilter_alt_defs by auto lemma fmdrop_fmupd: "fmdrop x (fmupd y z m) = (if x = y then fmdrop x m else fmupd y z (fmdrop x m))" by transfer' (auto simp: map_drop_def map_filter_def map_upd_def) lemma fmdrop_idle: "x |\<notin>| fmdom B \<Longrightarrow> fmdrop x B = B" by transfer' (auto simp: map_drop_def map_filter_def) lemma fmdrop_idle': "x \<notin> fmdom' B \<Longrightarrow> fmdrop x B = B" by transfer' (auto simp: map_drop_def map_filter_def) lemma fmdrop_fmupd_same: "fmdrop x (fmupd x y m) = fmdrop x m" by transfer' (auto simp: map_drop_def map_filter_def map_upd_def) lemma fmdom'_restrict_set_precise: "fmdom' (fmrestrict_set A m) = fmdom' m \<inter> A" unfolding fmfilter_alt_defs by auto lemma fmdom'_restrict_fset_precise: "fmdom (fmrestrict_fset A m) = fmdom m |\<inter>| A" unfolding fmfilter_alt_defs by auto lemma fmdom'_drop_fset[simp]: "fmdom' (fmdrop_fset A m) = fmdom' m - fset A" unfolding fmfilter_alt_defs by transfer' (auto simp: map_filter_def split: if_splits) lemma fmdom'_restrict_fset: "fmdom' (fmrestrict_fset A m) \<subseteq> fset A" unfolding fmfilter_alt_defs by transfer' (auto simp: map_filter_def) lemma fmlookup_drop[simp]: "fmlookup (fmdrop a m) x = (if x \<noteq> a then fmlookup m x else None)" unfolding fmfilter_alt_defs by simp lemma fmlookup_drop_set[simp]: "fmlookup (fmdrop_set A m) x = (if x \<notin> A then fmlookup m x else None)" unfolding fmfilter_alt_defs by simp lemma fmlookup_drop_fset[simp]: "fmlookup (fmdrop_fset A m) x = (if x |\<notin>| A then fmlookup m x else None)" unfolding fmfilter_alt_defs by simp lemma fmlookup_restrict_set[simp]: "fmlookup (fmrestrict_set A m) x = (if x \<in> A then fmlookup m x else None)" unfolding fmfilter_alt_defs by simp lemma fmlookup_restrict_fset[simp]: "fmlookup (fmrestrict_fset A m) x = (if x |\<in>| A then fmlookup m x else None)" unfolding fmfilter_alt_defs by simp lemma fmrestrict_set_dom[simp]: "fmrestrict_set (fmdom' m) m = m" by (rule fmap_ext) auto lemma fmrestrict_fset_dom[simp]: "fmrestrict_fset (fmdom m) m = m" by (rule fmap_ext) auto lemma fmdrop_empty[simp]: "fmdrop a fmempty = fmempty" unfolding fmfilter_alt_defs by simp lemma fmdrop_set_empty[simp]: "fmdrop_set A fmempty = fmempty" unfolding fmfilter_alt_defs by simp lemma fmdrop_fset_empty[simp]: "fmdrop_fset A fmempty = fmempty" unfolding fmfilter_alt_defs by simp lemma fmdrop_fset_fmdom[simp]: "fmdrop_fset (fmdom A) A = fmempty" by transfer' (auto simp: map_drop_set_def map_filter_def) lemma fmdrop_set_fmdom[simp]: "fmdrop_set (fmdom' A) A = fmempty" by transfer' (auto simp: map_drop_set_def map_filter_def) lemma fmrestrict_set_empty[simp]: "fmrestrict_set A fmempty = fmempty" unfolding fmfilter_alt_defs by simp lemma fmrestrict_fset_empty[simp]: "fmrestrict_fset A fmempty = fmempty" unfolding fmfilter_alt_defs by simp lemma fmdrop_set_null[simp]: "fmdrop_set {} m = m" by (rule fmap_ext) auto lemma fmdrop_fset_null[simp]: "fmdrop_fset {||} m = m" by (rule fmap_ext) auto lemma fmdrop_set_single[simp]: "fmdrop_set {a} m = fmdrop a m" unfolding fmfilter_alt_defs by simp lemma fmdrop_fset_single[simp]: "fmdrop_fset {|a|} m = fmdrop a m" unfolding fmfilter_alt_defs by simp lemma fmrestrict_set_null[simp]: "fmrestrict_set {} m = fmempty" unfolding fmfilter_alt_defs by simp lemma fmrestrict_fset_null[simp]: "fmrestrict_fset {||} m = fmempty" unfolding fmfilter_alt_defs by simp lemma fmdrop_comm: "fmdrop a (fmdrop b m) = fmdrop b (fmdrop a m)" unfolding fmfilter_alt_defs by (rule fmfilter_comm) lemma fmdrop_set_insert[simp]: "fmdrop_set (insert x S) m = fmdrop x (fmdrop_set S m)" by (rule fmap_ext) auto lemma fmdrop_fset_insert[simp]: "fmdrop_fset (finsert x S) m = fmdrop x (fmdrop_fset S m)" by (rule fmap_ext) auto lemma fmrestrict_set_twice[simp]: "fmrestrict_set S (fmrestrict_set T m) = fmrestrict_set (S \<inter> T) m" unfolding fmfilter_alt_defs by auto lemma fmrestrict_fset_twice[simp]: "fmrestrict_fset S (fmrestrict_fset T m) = fmrestrict_fset (S |\<inter>| T) m" unfolding fmfilter_alt_defs by auto lemma fmrestrict_set_drop[simp]: "fmrestrict_set S (fmdrop b m) = fmrestrict_set (S - {b}) m" unfolding fmfilter_alt_defs by auto lemma fmrestrict_fset_drop[simp]: "fmrestrict_fset S (fmdrop b m) = fmrestrict_fset (S - {| b |}) m" unfolding fmfilter_alt_defs by auto lemma fmdrop_fmrestrict_set[simp]: "fmdrop b (fmrestrict_set S m) = fmrestrict_set (S - {b}) m" by (rule fmap_ext) auto lemma fmdrop_fmrestrict_fset[simp]: "fmdrop b (fmrestrict_fset S m) = fmrestrict_fset (S - {| b |}) m" by (rule fmap_ext) auto lemma fmdrop_idem[simp]: "fmdrop a (fmdrop a m) = fmdrop a m" unfolding fmfilter_alt_defs by auto lemma fmdrop_set_twice[simp]: "fmdrop_set S (fmdrop_set T m) = fmdrop_set (S \<union> T) m" unfolding fmfilter_alt_defs by auto lemma fmdrop_fset_twice[simp]: "fmdrop_fset S (fmdrop_fset T m) = fmdrop_fset (S |\<union>| T) m" unfolding fmfilter_alt_defs by auto lemma fmdrop_set_fmdrop[simp]: "fmdrop_set S (fmdrop b m) = fmdrop_set (insert b S) m" by (rule fmap_ext) auto lemma fmdrop_fset_fmdrop[simp]: "fmdrop_fset S (fmdrop b m) = fmdrop_fset (finsert b S) m" by (rule fmap_ext) auto lift_definition fmadd :: "('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" (infixl "++\<^sub>f" 100) is map_add parametric map_add_transfer by simp lemma fmlookup_add[simp]: "fmlookup (m ++\<^sub>f n) x = (if x |\<in>| fmdom n then fmlookup n x else fmlookup m x)" by transfer' (auto simp: map_add_def split: option.splits) lemma fmdom_add[simp]: "fmdom (m ++\<^sub>f n) = fmdom m |\<union>| fmdom n" by transfer' auto lemma fmdom'_add[simp]: "fmdom' (m ++\<^sub>f n) = fmdom' m \<union> fmdom' n" by transfer' auto lemma fmadd_drop_left_dom: "fmdrop_fset (fmdom n) m ++\<^sub>f n = m ++\<^sub>f n" by (rule fmap_ext) auto lemma fmadd_restrict_right_dom: "fmrestrict_fset (fmdom n) (m ++\<^sub>f n) = n" by (rule fmap_ext) auto lemma fmfilter_add_distrib[simp]: "fmfilter P (m ++\<^sub>f n) = fmfilter P m ++\<^sub>f fmfilter P n" by transfer' (auto simp: map_filter_def map_add_def) lemma fmdrop_add_distrib[simp]: "fmdrop a (m ++\<^sub>f n) = fmdrop a m ++\<^sub>f fmdrop a n" unfolding fmfilter_alt_defs by simp lemma fmdrop_set_add_distrib[simp]: "fmdrop_set A (m ++\<^sub>f n) = fmdrop_set A m ++\<^sub>f fmdrop_set A n" unfolding fmfilter_alt_defs by simp lemma fmdrop_fset_add_distrib[simp]: "fmdrop_fset A (m ++\<^sub>f n) = fmdrop_fset A m ++\<^sub>f fmdrop_fset A n" unfolding fmfilter_alt_defs by simp lemma fmrestrict_set_add_distrib[simp]: "fmrestrict_set A (m ++\<^sub>f n) = fmrestrict_set A m ++\<^sub>f fmrestrict_set A n" unfolding fmfilter_alt_defs by simp lemma fmrestrict_fset_add_distrib[simp]: "fmrestrict_fset A (m ++\<^sub>f n) = fmrestrict_fset A m ++\<^sub>f fmrestrict_fset A n" unfolding fmfilter_alt_defs by simp lemma fmadd_empty[simp]: "fmempty ++\<^sub>f m = m" "m ++\<^sub>f fmempty = m" by (transfer'; auto)+ lemma fmadd_idempotent[simp]: "m ++\<^sub>f m = m" by transfer' (auto simp: map_add_def split: option.splits) lemma fmadd_assoc[simp]: "m ++\<^sub>f (n ++\<^sub>f p) = m ++\<^sub>f n ++\<^sub>f p" by transfer' simp lemma fmadd_fmupd[simp]: "m ++\<^sub>f fmupd a b n = fmupd a b (m ++\<^sub>f n)" by (rule fmap_ext) simp lift_definition fmpred :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('a, 'b) fmap \<Rightarrow> bool" is map_pred parametric map_pred_transfer . lemma fmpredI[intro]: assumes "\<And>x y. fmlookup m x = Some y \<Longrightarrow> P x y" shows "fmpred P m" using assms by transfer' (auto simp: map_pred_def split: option.splits) lemma fmpredD[dest]: "fmpred P m \<Longrightarrow> fmlookup m x = Some y \<Longrightarrow> P x y" by transfer' (auto simp: map_pred_def split: option.split_asm) lemma fmpred_iff: "fmpred P m \<longleftrightarrow> (\<forall>x y. fmlookup m x = Some y \<longrightarrow> P x y)" by auto lemma fmpred_alt_def: "fmpred P m \<longleftrightarrow> fBall (fmdom m) (\<lambda>x. P x (the (fmlookup m x)))" unfolding fmpred_iff apply auto apply (rename_tac x y) apply (erule_tac x = x in fBallE) apply simp by (simp add: fmlookup_dom_iff) lemma fmpred_mono_strong: assumes "\<And>x y. fmlookup m x = Some y \<Longrightarrow> P x y \<Longrightarrow> Q x y" shows "fmpred P m \<Longrightarrow> fmpred Q m" using assms unfolding fmpred_iff by auto lemma fmpred_mono[mono]: "P \<le> Q \<Longrightarrow> fmpred P \<le> fmpred Q" apply rule apply (rule fmpred_mono_strong[where P = P and Q = Q]) apply auto done lemma fmpred_empty[intro!, simp]: "fmpred P fmempty" by auto lemma fmpred_upd[intro]: "fmpred P m \<Longrightarrow> P x y \<Longrightarrow> fmpred P (fmupd x y m)" by transfer' (auto simp: map_pred_def map_upd_def) lemma fmpred_updD[dest]: "fmpred P (fmupd x y m) \<Longrightarrow> P x y" by auto lemma fmpred_add[intro]: "fmpred P m \<Longrightarrow> fmpred P n \<Longrightarrow> fmpred P (m ++\<^sub>f n)" by transfer' (auto simp: map_pred_def map_add_def split: option.splits) lemma fmpred_filter[intro]: "fmpred P m \<Longrightarrow> fmpred P (fmfilter Q m)" by transfer' (auto simp: map_pred_def map_filter_def) lemma fmpred_drop[intro]: "fmpred P m \<Longrightarrow> fmpred P (fmdrop a m)" by (auto simp: fmfilter_alt_defs) lemma fmpred_drop_set[intro]: "fmpred P m \<Longrightarrow> fmpred P (fmdrop_set A m)" by (auto simp: fmfilter_alt_defs) lemma fmpred_drop_fset[intro]: "fmpred P m \<Longrightarrow> fmpred P (fmdrop_fset A m)" by (auto simp: fmfilter_alt_defs) lemma fmpred_restrict_set[intro]: "fmpred P m \<Longrightarrow> fmpred P (fmrestrict_set A m)" by (auto simp: fmfilter_alt_defs) lemma fmpred_restrict_fset[intro]: "fmpred P m \<Longrightarrow> fmpred P (fmrestrict_fset A m)" by (auto simp: fmfilter_alt_defs) lemma fmpred_cases[consumes 1]: assumes "fmpred P m" obtains (none) "fmlookup m x = None" | (some) y where "fmlookup m x = Some y" "P x y" using assms by auto lift_definition fmsubset :: "('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> bool" (infix "\<subseteq>\<^sub>f" 50) is map_le . lemma fmsubset_alt_def: "m \<subseteq>\<^sub>f n \<longleftrightarrow> fmpred (\<lambda>k v. fmlookup n k = Some v) m" by transfer' (auto simp: map_pred_def map_le_def dom_def split: option.splits) lemma fmsubset_pred: "fmpred P m \<Longrightarrow> n \<subseteq>\<^sub>f m \<Longrightarrow> fmpred P n" unfolding fmsubset_alt_def fmpred_iff by auto lemma fmsubset_filter_mono: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmfilter P m \<subseteq>\<^sub>f fmfilter P n" unfolding fmsubset_alt_def fmpred_iff by auto lemma fmsubset_drop_mono: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmdrop a m \<subseteq>\<^sub>f fmdrop a n" unfolding fmfilter_alt_defs by (rule fmsubset_filter_mono) lemma fmsubset_drop_set_mono: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmdrop_set A m \<subseteq>\<^sub>f fmdrop_set A n" unfolding fmfilter_alt_defs by (rule fmsubset_filter_mono) lemma fmsubset_drop_fset_mono: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmdrop_fset A m \<subseteq>\<^sub>f fmdrop_fset A n" unfolding fmfilter_alt_defs by (rule fmsubset_filter_mono) lemma fmsubset_restrict_set_mono: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmrestrict_set A m \<subseteq>\<^sub>f fmrestrict_set A n" unfolding fmfilter_alt_defs by (rule fmsubset_filter_mono) lemma fmsubset_restrict_fset_mono: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmrestrict_fset A m \<subseteq>\<^sub>f fmrestrict_fset A n" unfolding fmfilter_alt_defs by (rule fmsubset_filter_mono) lemma fmfilter_subset[simp]: "fmfilter P m \<subseteq>\<^sub>f m" unfolding fmsubset_alt_def fmpred_iff by auto lemma fmsubset_drop[simp]: "fmdrop a m \<subseteq>\<^sub>f m" unfolding fmfilter_alt_defs by (rule fmfilter_subset) lemma fmsubset_drop_set[simp]: "fmdrop_set S m \<subseteq>\<^sub>f m" unfolding fmfilter_alt_defs by (rule fmfilter_subset) lemma fmsubset_drop_fset[simp]: "fmdrop_fset S m \<subseteq>\<^sub>f m" unfolding fmfilter_alt_defs by (rule fmfilter_subset) lemma fmsubset_restrict_set[simp]: "fmrestrict_set S m \<subseteq>\<^sub>f m" unfolding fmfilter_alt_defs by (rule fmfilter_subset) lemma fmsubset_restrict_fset[simp]: "fmrestrict_fset S m \<subseteq>\<^sub>f m" unfolding fmfilter_alt_defs by (rule fmfilter_subset) lift_definition fset_of_fmap :: "('a, 'b) fmap \<Rightarrow> ('a \<times> 'b) fset" is set_of_map by (rule set_of_map_finite) lemma fset_of_fmap_inj[intro, simp]: "inj fset_of_fmap" apply rule apply transfer' using set_of_map_inj unfolding inj_def by auto lemma fset_of_fmap_iff[simp]: "(a, b) |\<in>| fset_of_fmap m \<longleftrightarrow> fmlookup m a = Some b" by transfer' (auto simp: set_of_map_def) lemma fset_of_fmap_iff'[simp]: "(a, b) \<in> fset (fset_of_fmap m) \<longleftrightarrow> fmlookup m a = Some b" by transfer' (auto simp: set_of_map_def) lift_definition fmap_of_list :: "('a \<times> 'b) list \<Rightarrow> ('a, 'b) fmap" is map_of parametric map_of_transfer by (rule finite_dom_map_of) lemma fmap_of_list_simps[simp]: "fmap_of_list [] = fmempty" "fmap_of_list ((k, v) # kvs) = fmupd k v (fmap_of_list kvs)" by (transfer, simp add: map_upd_def)+ lemma fmap_of_list_app[simp]: "fmap_of_list (xs @ ys) = fmap_of_list ys ++\<^sub>f fmap_of_list xs" by transfer' simp lemma fmupd_alt_def: "fmupd k v m = m ++\<^sub>f fmap_of_list [(k, v)]" by transfer' (auto simp: map_upd_def) lemma fmpred_of_list[intro]: assumes "\<And>k v. (k, v) \<in> set xs \<Longrightarrow> P k v" shows "fmpred P (fmap_of_list xs)" using assms by (induction xs) (transfer'; auto simp: map_pred_def)+ lemma fmap_of_list_SomeD: "fmlookup (fmap_of_list xs) k = Some v \<Longrightarrow> (k, v) \<in> set xs" by transfer' (auto dest: map_of_SomeD) lemma fmdom_fmap_of_list[simp]: "fmdom (fmap_of_list xs) = fset_of_list (map fst xs)" apply transfer' apply (subst dom_map_of_conv_image_fst) apply auto done lift_definition fmrel_on_fset :: "'a fset \<Rightarrow> ('b \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'c) fmap \<Rightarrow> bool" is rel_map_on_set . lemma fmrel_on_fset_alt_def: "fmrel_on_fset S P m n \<longleftrightarrow> fBall S (\<lambda>x. rel_option P (fmlookup m x) (fmlookup n x))" by transfer' (auto simp: rel_map_on_set_def eq_onp_def rel_fun_def) lemma fmrel_on_fsetI[intro]: assumes "\<And>x. x |\<in>| S \<Longrightarrow> rel_option P (fmlookup m x) (fmlookup n x)" shows "fmrel_on_fset S P m n" using assms unfolding fmrel_on_fset_alt_def by auto lemma fmrel_on_fset_mono[mono]: "R \<le> Q \<Longrightarrow> fmrel_on_fset S R \<le> fmrel_on_fset S Q" unfolding fmrel_on_fset_alt_def[abs_def] apply (intro le_funI fBall_mono) using option.rel_mono by auto lemma fmrel_on_fsetD: "x |\<in>| S \<Longrightarrow> fmrel_on_fset S P m n \<Longrightarrow> rel_option P (fmlookup m x) (fmlookup n x)" unfolding fmrel_on_fset_alt_def by auto lemma fmrel_on_fsubset: "fmrel_on_fset S R m n \<Longrightarrow> T |\<subseteq>| S \<Longrightarrow> fmrel_on_fset T R m n" unfolding fmrel_on_fset_alt_def by auto lemma fmrel_on_fset_unionI: "fmrel_on_fset A R m n \<Longrightarrow> fmrel_on_fset B R m n \<Longrightarrow> fmrel_on_fset (A |\<union>| B) R m n" unfolding fmrel_on_fset_alt_def by auto lemma fmrel_on_fset_updateI: assumes "fmrel_on_fset S P m n" "P v\<^sub>1 v\<^sub>2" shows "fmrel_on_fset (finsert k S) P (fmupd k v\<^sub>1 m) (fmupd k v\<^sub>2 n)" using assms unfolding fmrel_on_fset_alt_def by auto lift_definition fmimage :: "('a, 'b) fmap \<Rightarrow> 'a fset \<Rightarrow> 'b fset" is "\<lambda>m S. {b|a b. m a = Some b \<and> a \<in> S}" subgoal for m S apply (rule finite_subset[where B = "ran m"]) apply (auto simp: ran_def)[] by (rule finite_ran) done lemma fmimage_alt_def: "fmimage m S = fmran (fmrestrict_fset S m)" by transfer' (auto simp: ran_def map_restrict_set_def map_filter_def) lemma fmimage_empty[simp]: "fmimage m fempty = fempty" by transfer' auto lemma fmimage_subset_ran[simp]: "fmimage m S |\<subseteq>| fmran m" by transfer' (auto simp: ran_def) lemma fmimage_dom[simp]: "fmimage m (fmdom m) = fmran m" by transfer' (auto simp: ran_def) lemma fmimage_inter: "fmimage m (A |\<inter>| B) |\<subseteq>| fmimage m A |\<inter>| fmimage m B" by transfer' auto lemma fimage_inter_dom[simp]: "fmimage m (fmdom m |\<inter>| A) = fmimage m A" "fmimage m (A |\<inter>| fmdom m) = fmimage m A" by (transfer'; auto)+ lemma fmimage_union[simp]: "fmimage m (A |\<union>| B) = fmimage m A |\<union>| fmimage m B" by transfer' auto lemma fmimage_Union[simp]: "fmimage m (ffUnion A) = ffUnion (fmimage m |`| A)" by transfer' auto lemma fmimage_filter[simp]: "fmimage (fmfilter P m) A = fmimage m (ffilter P A)" by transfer' (auto simp: map_filter_def) lemma fmimage_drop[simp]: "fmimage (fmdrop a m) A = fmimage m (A - {|a|})" by transfer' (auto simp: map_filter_def map_drop_def) lemma fmimage_drop_fset[simp]: "fmimage (fmdrop_fset B m) A = fmimage m (A - B)" by transfer' (auto simp: map_filter_def map_drop_set_def) lemma fmimage_restrict_fset[simp]: "fmimage (fmrestrict_fset B m) A = fmimage m (A |\<inter>| B)" by transfer' (auto simp: map_filter_def map_restrict_set_def) lemma fmfilter_ran[simp]: "fmran (fmfilter P m) = fmimage m (ffilter P (fmdom m))" by transfer' (auto simp: ran_def map_filter_def) lemma fmran_drop[simp]: "fmran (fmdrop a m) = fmimage m (fmdom m - {|a|})" by transfer' (auto simp: ran_def map_drop_def map_filter_def) lemma fmran_drop_fset[simp]: "fmran (fmdrop_fset A m) = fmimage m (fmdom m - A)" by transfer' (auto simp: ran_def map_drop_set_def map_filter_def) lemma fmran_restrict_fset: "fmran (fmrestrict_fset A m) = fmimage m (fmdom m |\<inter>| A)" by transfer' (auto simp: ran_def map_restrict_set_def map_filter_def) lemma fmlookup_image_iff: "y |\<in>| fmimage m A \<longleftrightarrow> (\<exists>x. fmlookup m x = Some y \<and> x |\<in>| A)" by transfer' (auto simp: ran_def) lemma fmimageI: "fmlookup m x = Some y \<Longrightarrow> x |\<in>| A \<Longrightarrow> y |\<in>| fmimage m A" by (auto simp: fmlookup_image_iff) lemma fmimageE[elim]: assumes "y |\<in>| fmimage m A" obtains x where "fmlookup m x = Some y" "x |\<in>| A" using assms by (auto simp: fmlookup_image_iff) lift_definition fmcomp :: "('b, 'c) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'c) fmap" (infixl "\<circ>\<^sub>f" 55) is map_comp parametric map_comp_transfer by (rule dom_comp_finite) lemma fmlookup_comp[simp]: "fmlookup (m \<circ>\<^sub>f n) x = Option.bind (fmlookup n x) (fmlookup m)" by transfer' (auto simp: map_comp_def split: option.splits) end subsection \<open>BNF setup\<close> lift_bnf ('a, fmran': 'b) fmap [wits: Map.empty] for map: fmmap rel: fmrel by auto declare fmap.pred_mono[mono] lemma fmran'_alt_def: "fmran' m = fset (fmran m)" including fset.lifting by transfer' (auto simp: ran_def fun_eq_iff) lemma fmlookup_ran'_iff: "y \<in> fmran' m \<longleftrightarrow> (\<exists>x. fmlookup m x = Some y)" by transfer' (auto simp: ran_def) lemma fmran'I: "fmlookup m x = Some y \<Longrightarrow> y \<in> fmran' m" by (auto simp: fmlookup_ran'_iff) lemma fmran'E[elim]: assumes "y \<in> fmran' m" obtains x where "fmlookup m x = Some y" using assms by (auto simp: fmlookup_ran'_iff) lemma fmrel_iff: "fmrel R m n \<longleftrightarrow> (\<forall>x. rel_option R (fmlookup m x) (fmlookup n x))" by transfer' (auto simp: rel_fun_def) lemma fmrelI[intro]: assumes "\<And>x. rel_option R (fmlookup m x) (fmlookup n x)" shows "fmrel R m n" using assms by transfer' auto lemma fmrel_upd[intro]: "fmrel P m n \<Longrightarrow> P x y \<Longrightarrow> fmrel P (fmupd k x m) (fmupd k y n)" by transfer' (auto simp: map_upd_def rel_fun_def) lemma fmrelD[dest]: "fmrel P m n \<Longrightarrow> rel_option P (fmlookup m x) (fmlookup n x)" by transfer' (auto simp: rel_fun_def) lemma fmrel_addI[intro]: assumes "fmrel P m n" "fmrel P a b" shows "fmrel P (m ++\<^sub>f a) (n ++\<^sub>f b)" using assms apply transfer' apply (auto simp: rel_fun_def map_add_def) by (metis option.case_eq_if option.collapse option.rel_sel) lemma fmrel_cases[consumes 1]: assumes "fmrel P m n" obtains (none) "fmlookup m x = None" "fmlookup n x = None" | (some) a b where "fmlookup m x = Some a" "fmlookup n x = Some b" "P a b" proof - from assms have "rel_option P (fmlookup m x) (fmlookup n x)" by auto then show thesis using none some by (cases rule: option.rel_cases) auto qed lemma fmrel_filter[intro]: "fmrel P m n \<Longrightarrow> fmrel P (fmfilter Q m) (fmfilter Q n)" unfolding fmrel_iff by auto lemma fmrel_drop[intro]: "fmrel P m n \<Longrightarrow> fmrel P (fmdrop a m) (fmdrop a n)" unfolding fmfilter_alt_defs by blast lemma fmrel_drop_set[intro]: "fmrel P m n \<Longrightarrow> fmrel P (fmdrop_set A m) (fmdrop_set A n)" unfolding fmfilter_alt_defs by blast lemma fmrel_drop_fset[intro]: "fmrel P m n \<Longrightarrow> fmrel P (fmdrop_fset A m) (fmdrop_fset A n)" unfolding fmfilter_alt_defs by blast lemma fmrel_restrict_set[intro]: "fmrel P m n \<Longrightarrow> fmrel P (fmrestrict_set A m) (fmrestrict_set A n)" unfolding fmfilter_alt_defs by blast lemma fmrel_restrict_fset[intro]: "fmrel P m n \<Longrightarrow> fmrel P (fmrestrict_fset A m) (fmrestrict_fset A n)" unfolding fmfilter_alt_defs by blast lemma fmrel_on_fset_fmrel_restrict: "fmrel_on_fset S P m n \<longleftrightarrow> fmrel P (fmrestrict_fset S m) (fmrestrict_fset S n)" unfolding fmrel_on_fset_alt_def fmrel_iff by auto lemma fmrel_on_fset_refl_strong: assumes "\<And>x y. x |\<in>| S \<Longrightarrow> fmlookup m x = Some y \<Longrightarrow> P y y" shows "fmrel_on_fset S P m m" unfolding fmrel_on_fset_fmrel_restrict fmrel_iff using assms by (simp add: option.rel_sel) lemma fmrel_on_fset_addI: assumes "fmrel_on_fset S P m n" "fmrel_on_fset S P a b" shows "fmrel_on_fset S P (m ++\<^sub>f a) (n ++\<^sub>f b)" using assms unfolding fmrel_on_fset_fmrel_restrict by auto lemma fmrel_fmdom_eq: assumes "fmrel P x y" shows "fmdom x = fmdom y" proof - have "a |\<in>| fmdom x \<longleftrightarrow> a |\<in>| fmdom y" for a proof - have "rel_option P (fmlookup x a) (fmlookup y a)" using assms by (simp add: fmrel_iff) thus ?thesis by cases (auto intro: fmdomI) qed thus ?thesis by auto qed lemma fmrel_fmdom'_eq: "fmrel P x y \<Longrightarrow> fmdom' x = fmdom' y" unfolding fmdom'_alt_def by (metis fmrel_fmdom_eq) lemma fmrel_rel_fmran: assumes "fmrel P x y" shows "rel_fset P (fmran x) (fmran y)" proof - { fix b assume "b |\<in>| fmran x" then obtain a where "fmlookup x a = Some b" by auto moreover have "rel_option P (fmlookup x a) (fmlookup y a)" using assms by auto ultimately have "\<exists>b'. b' |\<in>| fmran y \<and> P b b'" by (metis option_rel_Some1 fmranI) } moreover { fix b assume "b |\<in>| fmran y" then obtain a where "fmlookup y a = Some b" by auto moreover have "rel_option P (fmlookup x a) (fmlookup y a)" using assms by auto ultimately have "\<exists>b'. b' |\<in>| fmran x \<and> P b' b" by (metis option_rel_Some2 fmranI) } ultimately show ?thesis unfolding rel_fset_alt_def by auto qed lemma fmrel_rel_fmran': "fmrel P x y \<Longrightarrow> rel_set P (fmran' x) (fmran' y)" unfolding fmran'_alt_def by (metis fmrel_rel_fmran rel_fset_fset) lemma pred_fmap_fmpred[simp]: "pred_fmap P = fmpred (\<lambda>_. P)" unfolding fmap.pred_set fmran'_alt_def including fset.lifting apply transfer' apply (rule ext) apply (auto simp: map_pred_def ran_def split: option.splits dest: ) done lemma pred_fmap_id[simp]: "pred_fmap id (fmmap f m) \<longleftrightarrow> pred_fmap f m" unfolding fmap.pred_set fmap.set_map by simp lemma pred_fmapD: "pred_fmap P m \<Longrightarrow> x |\<in>| fmran m \<Longrightarrow> P x" by auto lemma fmlookup_map[simp]: "fmlookup (fmmap f m) x = map_option f (fmlookup m x)" by transfer' auto lemma fmpred_map[simp]: "fmpred P (fmmap f m) \<longleftrightarrow> fmpred (\<lambda>k v. P k (f v)) m" unfolding fmpred_iff pred_fmap_def fmap.set_map by auto lemma fmpred_id[simp]: "fmpred (\<lambda>_. id) (fmmap f m) \<longleftrightarrow> fmpred (\<lambda>_. f) m" by simp lemma fmmap_add[simp]: "fmmap f (m ++\<^sub>f n) = fmmap f m ++\<^sub>f fmmap f n" by transfer' (auto simp: map_add_def fun_eq_iff split: option.splits) lemma fmmap_empty[simp]: "fmmap f fmempty = fmempty" by transfer auto lemma fmdom_map[simp]: "fmdom (fmmap f m) = fmdom m" including fset.lifting by transfer' simp lemma fmdom'_map[simp]: "fmdom' (fmmap f m) = fmdom' m" by transfer' simp lemma fmran_fmmap[simp]: "fmran (fmmap f m) = f |`| fmran m" including fset.lifting by transfer' (auto simp: ran_def) lemma fmran'_fmmap[simp]: "fmran' (fmmap f m) = f ` fmran' m" by transfer' (auto simp: ran_def) lemma fmfilter_fmmap[simp]: "fmfilter P (fmmap f m) = fmmap f (fmfilter P m)" by transfer' (auto simp: map_filter_def) lemma fmdrop_fmmap[simp]: "fmdrop a (fmmap f m) = fmmap f (fmdrop a m)" unfolding fmfilter_alt_defs by simp lemma fmdrop_set_fmmap[simp]: "fmdrop_set A (fmmap f m) = fmmap f (fmdrop_set A m)" unfolding fmfilter_alt_defs by simp lemma fmdrop_fset_fmmap[simp]: "fmdrop_fset A (fmmap f m) = fmmap f (fmdrop_fset A m)" unfolding fmfilter_alt_defs by simp lemma fmrestrict_set_fmmap[simp]: "fmrestrict_set A (fmmap f m) = fmmap f (fmrestrict_set A m)" unfolding fmfilter_alt_defs by simp lemma fmrestrict_fset_fmmap[simp]: "fmrestrict_fset A (fmmap f m) = fmmap f (fmrestrict_fset A m)" unfolding fmfilter_alt_defs by simp lemma fmmap_subset[intro]: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmmap f m \<subseteq>\<^sub>f fmmap f n" by transfer' (auto simp: map_le_def) lemma fmmap_fset_of_fmap: "fset_of_fmap (fmmap f m) = (\<lambda>(k, v). (k, f v)) |`| fset_of_fmap m" including fset.lifting by transfer' (auto simp: set_of_map_def) lemma fmmap_fmupd: "fmmap f (fmupd x y m) = fmupd x (f y) (fmmap f m)" by transfer' (auto simp: fun_eq_iff map_upd_def) subsection \<open>\<^const>\<open>size\<close> setup\<close> definition size_fmap :: "('a \<Rightarrow> nat) \<Rightarrow> ('b \<Rightarrow> nat) \<Rightarrow> ('a, 'b) fmap \<Rightarrow> nat" where [simp]: "size_fmap f g m = size_fset (\<lambda>(a, b). f a + g b) (fset_of_fmap m)" instantiation fmap :: (type, type) size begin definition size_fmap where size_fmap_overloaded_def: "size_fmap = Finite_Map.size_fmap (\<lambda>_. 0) (\<lambda>_. 0)" instance .. end lemma size_fmap_overloaded_simps[simp]: "size x = size (fset_of_fmap x)" unfolding size_fmap_overloaded_def by simp lemma fmap_size_o_map: "inj h \<Longrightarrow> size_fmap f g \<circ> fmmap h = size_fmap f (g \<circ> h)" unfolding size_fmap_def apply (auto simp: fun_eq_iff fmmap_fset_of_fmap) apply (subst sum.reindex) subgoal for m using prod.inj_map[unfolded map_prod_def, of "\<lambda>x. x" h] unfolding inj_on_def by auto subgoal by (rule sum.cong) (auto split: prod.splits) done setup \<open> BNF_LFP_Size.register_size_global \<^type_name>\<open>fmap\<close> \<^const_name>\<open>size_fmap\<close> @{thm size_fmap_overloaded_def} @{thms size_fmap_def size_fmap_overloaded_simps} @{thms fmap_size_o_map} \<close> subsection \<open>Additional operations\<close> lift_definition fmmap_keys :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'c) fmap" is "\<lambda>f m a. map_option (f a) (m a)" unfolding dom_def by simp lemma fmpred_fmmap_keys[simp]: "fmpred P (fmmap_keys f m) = fmpred (\<lambda>a b. P a (f a b)) m" by transfer' (auto simp: map_pred_def split: option.splits) lemma fmdom_fmmap_keys[simp]: "fmdom (fmmap_keys f m) = fmdom m" including fset.lifting by transfer' auto lemma fmlookup_fmmap_keys[simp]: "fmlookup (fmmap_keys f m) x = map_option (f x) (fmlookup m x)" by transfer' simp lemma fmfilter_fmmap_keys[simp]: "fmfilter P (fmmap_keys f m) = fmmap_keys f (fmfilter P m)" by transfer' (auto simp: map_filter_def) lemma fmdrop_fmmap_keys[simp]: "fmdrop a (fmmap_keys f m) = fmmap_keys f (fmdrop a m)" unfolding fmfilter_alt_defs by simp lemma fmdrop_set_fmmap_keys[simp]: "fmdrop_set A (fmmap_keys f m) = fmmap_keys f (fmdrop_set A m)" unfolding fmfilter_alt_defs by simp lemma fmdrop_fset_fmmap_keys[simp]: "fmdrop_fset A (fmmap_keys f m) = fmmap_keys f (fmdrop_fset A m)" unfolding fmfilter_alt_defs by simp lemma fmrestrict_set_fmmap_keys[simp]: "fmrestrict_set A (fmmap_keys f m) = fmmap_keys f (fmrestrict_set A m)" unfolding fmfilter_alt_defs by simp lemma fmrestrict_fset_fmmap_keys[simp]: "fmrestrict_fset A (fmmap_keys f m) = fmmap_keys f (fmrestrict_fset A m)" unfolding fmfilter_alt_defs by simp lemma fmmap_keys_subset[intro]: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmmap_keys f m \<subseteq>\<^sub>f fmmap_keys f n" by transfer' (auto simp: map_le_def dom_def) definition sorted_list_of_fmap :: "('a::linorder, 'b) fmap \<Rightarrow> ('a \<times> 'b) list" where "sorted_list_of_fmap m = map (\<lambda>k. (k, the (fmlookup m k))) (sorted_list_of_fset (fmdom m))" lemma list_all_sorted_list[simp]: "list_all P (sorted_list_of_fmap m) = fmpred (curry P) m" unfolding sorted_list_of_fmap_def curry_def list.pred_map apply (auto simp: list_all_iff) including fset.lifting by (transfer; auto simp: dom_def map_pred_def split: option.splits)+ lemma map_of_sorted_list[simp]: "map_of (sorted_list_of_fmap m) = fmlookup m" unfolding sorted_list_of_fmap_def including fset.lifting by transfer (simp add: map_of_map_keys) subsection \<open>Additional properties\<close> lemma fmchoice': assumes "finite S" "\<forall>x \<in> S. \<exists>y. Q x y" shows "\<exists>m. fmdom' m = S \<and> fmpred Q m" proof - obtain f where f: "Q x (f x)" if "x \<in> S" for x using assms by (metis bchoice) define f' where "f' x = (if x \<in> S then Some (f x) else None)" for x have "eq_onp (\<lambda>m. finite (dom m)) f' f'" unfolding eq_onp_def f'_def dom_def using assms by auto show ?thesis apply (rule exI[where x = "Abs_fmap f'"]) apply (subst fmpred.abs_eq, fact) apply (subst fmdom'.abs_eq, fact) unfolding f'_def dom_def map_pred_def using f by auto qed subsection \<open>Lifting/transfer setup\<close> context includes lifting_syntax begin lemma fmempty_transfer[simp, intro, transfer_rule]: "fmrel P fmempty fmempty" by transfer auto lemma fmadd_transfer[transfer_rule]: "(fmrel P ===> fmrel P ===> fmrel P) fmadd fmadd" by (intro fmrel_addI rel_funI) lemma fmupd_transfer[transfer_rule]: "((=) ===> P ===> fmrel P ===> fmrel P) fmupd fmupd" by auto end lemma Quotient_fmap_bnf[quot_map]: assumes "Quotient R Abs Rep T" shows "Quotient (fmrel R) (fmmap Abs) (fmmap Rep) (fmrel T)" unfolding Quotient_alt_def4 proof safe fix m n assume "fmrel T m n" then have "fmlookup (fmmap Abs m) x = fmlookup n x" for x apply (cases rule: fmrel_cases[where x = x]) using assms unfolding Quotient_alt_def by auto then show "fmmap Abs m = n" by (rule fmap_ext) next fix m show "fmrel T (fmmap Rep m) m" unfolding fmap.rel_map apply (rule fmap.rel_refl) using assms unfolding Quotient_alt_def by auto next from assms have "R = T OO T\<inverse>\<inverse>" unfolding Quotient_alt_def4 by simp then show "fmrel R = fmrel T OO (fmrel T)\<inverse>\<inverse>" by (simp add: fmap.rel_compp fmap.rel_conversep) qed subsection \<open>View as datatype\<close> lemma fmap_distinct[simp]: "fmempty \<noteq> fmupd k v m" "fmupd k v m \<noteq> fmempty" by (transfer'; auto simp: map_upd_def fun_eq_iff)+ lifting_update fmap.lifting lemma fmap_exhaust[cases type: fmap]: obtains (fmempty) "m = fmempty" | (fmupd) x y m' where "m = fmupd x y m'" "x |\<notin>| fmdom m'" using that including fmap.lifting fset.lifting proof transfer fix m P assume "finite (dom m)" assume empty: P if "m = Map.empty" assume map_upd: P if "finite (dom m')" "m = map_upd x y m'" "x \<notin> dom m'" for x y m' show P proof (cases "m = Map.empty") case True thus ?thesis using empty by simp next case False hence "dom m \<noteq> {}" by simp then obtain x where "x \<in> dom m" by blast let ?m' = "map_drop x m" show ?thesis proof (rule map_upd) show "finite (dom ?m')" using \<open>finite (dom m)\<close> unfolding map_drop_def by auto next show "m = map_upd x (the (m x)) ?m'" using \<open>x \<in> dom m\<close> unfolding map_drop_def map_filter_def map_upd_def by auto next show "x \<notin> dom ?m'" unfolding map_drop_def map_filter_def by auto qed qed qed lemma fmap_induct[case_names fmempty fmupd, induct type: fmap]: assumes "P fmempty" assumes "(\<And>x y m. P m \<Longrightarrow> fmlookup m x = None \<Longrightarrow> P (fmupd x y m))" shows "P m" proof (induction "fmdom m" arbitrary: m rule: fset_induct_stronger) case empty hence "m = fmempty" by (metis fmrestrict_fset_dom fmrestrict_fset_null) with assms show ?case by simp next case (insert x S) hence "S = fmdom (fmdrop x m)" by auto with insert have "P (fmdrop x m)" by auto have "x |\<in>| fmdom m" using insert by auto then obtain y where "fmlookup m x = Some y" by auto hence "m = fmupd x y (fmdrop x m)" by (auto intro: fmap_ext) show ?case apply (subst \<open>m = _\<close>) apply (rule assms) apply fact apply simp done qed subsection \<open>Code setup\<close> instantiation fmap :: (type, equal) equal begin definition "equal_fmap \<equiv> fmrel HOL.equal" instance proof fix m n :: "('a, 'b) fmap" have "fmrel (=) m n \<longleftrightarrow> (m = n)" by transfer' (simp add: option.rel_eq rel_fun_eq) then show "equal_class.equal m n \<longleftrightarrow> (m = n)" unfolding equal_fmap_def by (simp add: equal_eq[abs_def]) qed end lemma fBall_alt_def: "fBall S P \<longleftrightarrow> (\<forall>x. x |\<in>| S \<longrightarrow> P x)" by force lemma fmrel_code: "fmrel R m n \<longleftrightarrow> fBall (fmdom m) (\<lambda>x. rel_option R (fmlookup m x) (fmlookup n x)) \<and> fBall (fmdom n) (\<lambda>x. rel_option R (fmlookup m x) (fmlookup n x))" unfolding fmrel_iff fmlookup_dom_iff fBall_alt_def by (metis option.collapse option.rel_sel) lemmas [code] = fmrel_code fmran'_alt_def fmdom'_alt_def fmfilter_alt_defs pred_fmap_fmpred fmsubset_alt_def fmupd_alt_def fmrel_on_fset_alt_def fmpred_alt_def code_datatype fmap_of_list quickcheck_generator fmap constructors: fmap_of_list context includes fset.lifting begin lemma fmlookup_of_list[code]: "fmlookup (fmap_of_list m) = map_of m" by transfer simp lemma fmempty_of_list[code]: "fmempty = fmap_of_list []" by transfer simp lemma fmran_of_list[code]: "fmran (fmap_of_list m) = snd |`| fset_of_list (AList.clearjunk m)" by transfer (auto simp: ran_map_of) lemma fmdom_of_list[code]: "fmdom (fmap_of_list m) = fst |`| fset_of_list m" by transfer (auto simp: dom_map_of_conv_image_fst) lemma fmfilter_of_list[code]: "fmfilter P (fmap_of_list m) = fmap_of_list (filter (\<lambda>(k, _). P k) m)" by transfer' auto lemma fmadd_of_list[code]: "fmap_of_list m ++\<^sub>f fmap_of_list n = fmap_of_list (AList.merge m n)" by transfer (simp add: merge_conv') lemma fmmap_of_list[code]: "fmmap f (fmap_of_list m) = fmap_of_list (map (apsnd f) m)" apply transfer apply (subst map_of_map[symmetric]) apply (auto simp: apsnd_def map_prod_def) done lemma fmmap_keys_of_list[code]: "fmmap_keys f (fmap_of_list m) = fmap_of_list (map (\<lambda>(a, b). (a, f a b)) m)" apply transfer subgoal for f m by (induction m) (auto simp: apsnd_def map_prod_def fun_eq_iff) done lemma fmimage_of_list[code]: "fmimage (fmap_of_list m) A = fset_of_list (map snd (filter (\<lambda>(k, _). k |\<in>| A) (AList.clearjunk m)))" apply (subst fmimage_alt_def) apply (subst fmfilter_alt_defs) apply (subst fmfilter_of_list) apply (subst fmran_of_list) apply transfer' apply (subst AList.restrict_eq[symmetric]) apply (subst clearjunk_restrict) apply (subst AList.restrict_eq) by auto lemma fmcomp_list[code]: "fmap_of_list m \<circ>\<^sub>f fmap_of_list n = fmap_of_list (AList.compose n m)" by (rule fmap_ext) (simp add: fmlookup_of_list compose_conv map_comp_def split: option.splits) end subsection \<open>Instances\<close> lemma exists_map_of: assumes "finite (dom m)" shows "\<exists>xs. map_of xs = m" using assms proof (induction "dom m" arbitrary: m) case empty hence "m = Map.empty" by auto moreover have "map_of [] = Map.empty" by simp ultimately show ?case by blast next case (insert x F) hence "F = dom (map_drop x m)" unfolding map_drop_def map_filter_def dom_def by auto with insert have "\<exists>xs'. map_of xs' = map_drop x m" by auto then obtain xs' where "map_of xs' = map_drop x m" .. moreover obtain y where "m x = Some y" using insert unfolding dom_def by blast ultimately have "map_of ((x, y) # xs') = m" using \<open>insert x F = dom m\<close> unfolding map_drop_def map_filter_def by auto thus ?case .. qed lemma exists_fmap_of_list: "\<exists>xs. fmap_of_list xs = m" by transfer (rule exists_map_of) lemma fmap_of_list_surj[simp, intro]: "surj fmap_of_list" proof - have "x \<in> range fmap_of_list" for x :: "('a, 'b) fmap" unfolding image_iff using exists_fmap_of_list by (metis UNIV_I) thus ?thesis by auto qed instance fmap :: (countable, countable) countable proof obtain to_nat :: "('a \<times> 'b) list \<Rightarrow> nat" where "inj to_nat" by (metis ex_inj) moreover have "inj (inv fmap_of_list)" using fmap_of_list_surj by (rule surj_imp_inj_inv) ultimately have "inj (to_nat \<circ> inv fmap_of_list)" by (rule inj_compose) thus "\<exists>to_nat::('a, 'b) fmap \<Rightarrow> nat. inj to_nat" by auto qed instance fmap :: (finite, finite) finite proof show "finite (UNIV :: ('a, 'b) fmap set)" by (rule finite_imageD) auto qed lifting_update fmap.lifting lifting_forget fmap.lifting subsection \<open>Tests\<close> \<comment> \<open>Code generation\<close> export_code fBall fmrel fmran fmran' fmdom fmdom' fmpred pred_fmap fmsubset fmupd fmrel_on_fset fmdrop fmdrop_set fmdrop_fset fmrestrict_set fmrestrict_fset fmimage fmlookup fmempty fmfilter fmadd fmmap fmmap_keys fmcomp checking SML Scala Haskell? OCaml? \<comment> \<open>\<open>lifting\<close> through \<^type>\<open>fmap\<close>\<close> experiment begin context includes fset.lifting begin lift_definition test1 :: "('a, 'b fset) fmap" is "fmempty :: ('a, 'b set) fmap" by auto lift_definition test2 :: "'a \<Rightarrow> 'b \<Rightarrow> ('a, 'b fset) fmap" is "\<lambda>a b. fmupd a {b} fmempty" by auto end end end
#include "xtreme/mmus/notify_router.h" #include "xtreme/mmus/types.h" #include "xtreme/common/request_id.h" #include "xtreme/common/notification_def.h" #include "xtreme/common/notification_criteria.h" #include "xtreme/common/notification_def.h" #include "xtreme/common/event_notification.h" #include "xtreme/common/curlwrapper/http_client_factory.h" #include "xtreme/common/curlwrapper/http_client_base.h" #include "xtreme/common/curlwrapper/http_client_post.h" #include "xtreme/mmus/parameter_mgr.h" #include <boost/lexical_cast.hpp> #include <exception> namespace xtreme { namespace mmus { void CNotifyRouter::Run() { MMUS_INFO("CNotifyRouter start..."); // keep routing the events; while (b_running_flag_) { //#if 0 try { EventPtr event_ptr = NULL; event_q_.pop(event_ptr); if (event_ptr->type() == kEVENT_EOF) { break; } if (event_ptr->type() != kEVENT_NOTIFICATION) { MMUS_ERROR("type = " << event_ptr->type() << " not a notification event!" ); continue; } NotificationEvent* notify = static_cast<NotificationEvent*>(event_ptr.get()); assert(notify != NULL); std::string notify_str = notify->ToString(); this->SendNotify(notify_str); if (this->is_last_send_success_ == false) { this->q_failed_notify_.push(notify_str); } this->ProcessFailedNotify(); } catch(boost::thread_interrupted const& e) { MMUS_INFO("notify_router thread interrupted"); break; } catch(std::exception & ee) { MMUS_ERROR("Exception: " << ee.what()); } //#endif } MMUS_INFO("CNotifyRouter quit..."); } void CNotifyRouter::ReceiveEvent(EventPtr& event_ptr) { //MMUS_DEBUG("enqueue event of type " << event_ptr->type()); event_q_.push(event_ptr); } void CNotifyRouter::ProcessFailedNotify() { while (this->q_failed_notify_.size() != 0) { MMUS_DEBUG("q_failed_notify_.size()=" << q_failed_notify_.size()); if (this->is_last_send_success_ == false) { boost::this_thread::sleep(boost::posix_time::seconds(CParameterMgr::GetInstance()->notify_try_send_interval())); } this->SendNotify(this->q_failed_notify_.front()); if (this->is_last_send_success_ == true) { this->q_failed_notify_.pop(); } } } void CNotifyRouter::SendNotify(std::string &notify_str) { using namespace xtreme::curlwrapper; MMUS_DEBUG("notify : " << notify_str); CHttpClientBase * post_client = CHttpClientFactory::CreateClient(kPostClient); post_client->SetSSLCertFile(CParameterMgr::GetInstance()->ssl_cer_file()); post_client->SetSSLkeyFile(CParameterMgr::GetInstance()->ssl_key_file()); post_client->SetSSLPeerAuthCaFile(CParameterMgr::GetInstance()->ssl_ca_file(), true); post_client->SetConnTimeout(CParameterMgr::GetInstance()->conn_timeout()); post_client->SetProcTimeout(CParameterMgr::GetInstance()->proc_timeout()); std::string out; std::string cmd_ip; unsigned int cmd_port; CParameterMgr::GetInstance()->GetCmdIpPort(cmd_ip, cmd_port); std::string url = "https://" + cmd_ip + ":" + boost::lexical_cast<std::string>(cmd_port); MMUS_DEBUG("cmd ip is" << cmd_ip ); MMUS_DEBUG("url=" << url ); if (cmd_ip != "deregistered"){ CPerformResult result = post_client->Perform(url, CUtil::REQ_DATA_KEY, notify_str); if (result.result_code_ == 0) { this->is_last_send_success_ = true; } else { this->is_last_send_success_ = false; } MMUS_DEBUG("result_code=" << result.result_code_ << "; result_info=" << result.info_); MMUS_DEBUG("http_return: " << out ); } delete post_client; } void CNotifyRouter::MakeSub(xtreme::EventType event_type) { MMUS_INFO("event_type = " << event_type); IPublisherList lst = cs_.GetPublisherForType(event_type); MMUS_INFO("num of publishers = " << lst.size()); if (lst.size() != 1) { MMUS_ERROR("num of publishers is expected to be 1"); } sub_ = new xtreme::Subscription(event_type, new NotificationCriteria()); (*lst.begin())->AddSubscription(this, sub_); MMUS_INFO("Adding a subscription for event type = " << event_type); } void CNotifyRouter::unsubscribe(xtreme::EventType event_type) { if (sub_) { IPublisherList lst = cs_.GetPublisherForType(event_type); (*lst.begin())->RemoveSubscription(sub_); MMUS_INFO("unsubscribing to event type = " << event_type); delete sub_; } } RouterStats CNotifyRouter::GetTelemetryRouterStats() { telemetry_.input_queue_size_ = event_q_.size(); return telemetry_; } }}
function TF = raisedCos (f,Tb,r) % Raised Cosine Filter % f = Frequency Matrix % Tb = Bit Period % r = Rolloff Factor W0 = 1/(2*Tb); W = (r+1)*W0; x = abs(f)*(1/(W-W0)); x = x + ((W - 2*W0)/(W-W0))*ones(size(x)); TF = cos((pi/4)*x).^2; xx = find(abs(f) < (2*W0 - W)); for ll = xx, TF(ll) = 1;end xx = find(abs(f) > W); for ll = xx, TF(ll) = 0;end
lemma continuous_at_within_inverse[continuous_intros]: fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_div_algebra" assumes "continuous (at a within s) f" and "f a \<noteq> 0" shows "continuous (at a within s) (\<lambda>x. inverse (f x))"
If $S$ is homeomorphic to $T$ and $T$ is homeomorphic to $U$, then $S$ is homeomorphic to $U$.
using Burgers using Test @testset "Burgers" begin include("data.jl") include("deeponet.jl") end
args <- commandArgs(trailingOnly=TRUE) if (length(args) != 8) { stop("Usage: points.r common.r input.csv output.pdf evaluator1 evaluator2 name indication1 indication2") } common <- args[1] inFile <- args[2] outPdf <- args[3] e1 <- args[4] e2 <- args[5] name <- args[6] i1 <- args[7] i2 <- args[8] source(common) res = read.csv(inFile, header=TRUE) if (length(res$output) != 0) { res$origin <- paste(res$path, res$focus) res1 <- res[res$evaluator == e1,] res2 <- res[res$evaluator == e2,] dat <- merge(res1, res2, by = "origin") dat <- dat[!is.na(dat$output.x),] dat <- dat[!is.na(dat$output.y),] startPdf(outPdf) par(xpd=TRUE, mar=c(0.4,0.4,0.4,3.5)) plot(dat$output.x , dat$output.y , xlab = paste(e1, paste("(", i1, ")", sep="")) , ylab = paste(e2, paste("(", i2, ")", sep="")) , type = "n" # Don't plot yet. , main = paste(name, "Correlation:", format(round(cor(dat$output.x, dat$output.y), 2), nsmall = 2)) ) strats = unique(res$strategy) for (i in seq_along(strats)) { strat = strats[i] sdat <- dat[dat$strategy.x == strat,] points(sdat$output.x , sdat$output.y , col = i ) } # To draw legend outside of graph legend("right" , inset=c(-0.8, 0) , legend=levels(factor(strats)) , col=as.numeric(unique(factor(strats))) , lty = 1 ) } else { invalidDataPdf(outPdf) }
#include <stdlib.h> #include <stdio.h> #include <math.h> #include <assert.h> #include <gsl/gsl_math.h> #include "cosmocalc.h" double weff(double a) { if(a != 1.0) return cosmoData.w0 + cosmoData.wa - cosmoData.wa*(a - 1.0)/log(a); else return cosmoData.w0; } double hubble_noscale(double a) { return sqrt(cosmoData.OmegaM/a/a/a + cosmoData.OmegaK/a/a + cosmoData.OmegaL/pow(a,3.0*(1.0 + weff(a)))); }
State Before: α : Type u_1 β : Type ?u.116357 γ : Type ?u.116360 p✝ : Pmf α f : (a : α) → a ∈ support p✝ → Pmf β p : Pmf α ⊢ (bindOnSupport p fun a x => pure a) = p State After: no goals Tactic: simp only [Pmf.bind_pure, Pmf.bindOnSupport_eq_bind]
postulate admit : ∀ {i} {X : Set i} → X X Y Z : Set data Id (z : Z) : Z → Set where refl : Id z z record Square : Set₁ where field U : Set u : U open Square record RX : Set where field x : X open RX record R : Set where -- This definition isn't used; without it, -- the internal error disappears. r : Square r .U = admit r .u = admit module M (z₀ z₁ : Z) where f : Id z₀ z₁ → RX f refl = {!λ where .x → ?!}
/* -*-c++-*-------------------------------------------------------------------- * 2018 Bernd Pfrommer [email protected] */ #include "tagslam/simple_body.h" #include "tagslam/yaml_utils.h" #include <boost/range/irange.hpp> #include <XmlRpcException.h> namespace tagslam { using boost::irange; bool SimpleBody::parse(XmlRpc::XmlRpcValue body, const BodyPtr &bp) { if (body.hasMember("tags")) { TagVec tv = Tag::parseTags(body["tags"], defaultTagSize_, bp); addTags(tv); } return (true); } bool SimpleBody::write(std::ostream &os, const std::string &prefix) const { // write common section if (!Body::writeCommon(os, prefix)) { return (false); } /* // Don't write tag poses here anymore const std::string ind = prefix + " "; // indent os << ind << "tags: " << std::endl; PoseNoise smallNoise = PoseNoise::make(0.001, 0.001); for (const auto &tm: tags_) { const auto &tag = tm.second; os << ind << "- id: " << tag->getId() << std::endl; os << ind << " size: " << tag->getSize() << std::endl; if (tag->getPoseWithNoise().isValid()) { yaml_utils::write_pose(os, ind + " ", tag->getPoseWithNoise().getPose(), smallNoise, true); } } */ return (true); } } // namespace
#coding=utf8 import argparse import random import numpy import properties_loader import sys import torch import collections from utils import * DIR="./data/" parser = argparse.ArgumentParser(description="Experiemts\n") parser.add_argument("-data",default = DIR, required=True,type=str, help="saved vectorized data") parser.add_argument("-raw_data",default = "./data/zp_data/", type=str, help="raw_data") parser.add_argument("-bert_dir",default = "/home/miaojingjing/data/Attention_bert/BertPretrainedModel/chinese_L-12_H-768_A-12/",type=str, help="saved BERT model") parser.add_argument("-props",default = "./properties/prob", type=str, help="properties") parser.add_argument("-reduced",default = 0, type=int, help="reduced") parser.add_argument("-gpu",default = 0, type=int, help="GPU number") parser.add_argument("-random_seed",default=0,type=int,help="random seed") ## Fine tune Required parameters # parser.add_argument("--data_dir", # default=None, # type=str, # required=True, # help="The input data dir. Should contain the .tsv files (or other data files) for the task.") # parser.add_argument("--bert_model", default=None, type=str, required=True, # help="Bert pre-trained model selected in the list: bert-base-uncased, " # "bert-large-uncased, bert-base-cased, bert-base-multilingual, bert-base-chinese.") # parser.add_argument("--task_name", # default=None, # type=str, # required=True, # help="The name of the task to train.") # parser.add_argument("--output_dir", # default=None, # type=str, # required=True, # help="The output directory where the model checkpoints will be written.") ## Other parameters parser.add_argument("--max_seq_length", default=128, type=int, help="The maximum total input sequence length after WordPiece tokenization. \n" "Sequences longer than this will be truncated, and sequences shorter \n" "than this will be padded.") parser.add_argument("--do_train", default=False, action='store_true', help="Whether to run training.") parser.add_argument("--do_eval", default=False, action='store_true', help="Whether to run eval on the dev set.") # parser.add_argument("--train_batch_size", # default=32, # type=int, # help="Total batch size for training.") # parser.add_argument("--eval_batch_size", # default=8, # type=int, # help="Total batch size for eval.") parser.add_argument("--learning_rate", default=5e-5, type=float, help="The initial learning rate for Adam.") parser.add_argument("--num_train_epochs", default=100, type=int, help="Total number of training epochs to perform.") parser.add_argument("--warmup_proportion", default=0.1, type=float, help="Proportion of training to perform linear learning rate warmup for. " "E.g., 0.1 = 10%% of training.") parser.add_argument("--no_cuda", default=False, action='store_true', help="Whether not to use CUDA when available") parser.add_argument("--local_rank", type=int, default=-1, help="local_rank for distributed training on gpus") parser.add_argument('--seed', type=int, default=42, help="random seed for initialization") parser.add_argument('--gradient_accumulation_steps', type=int, default=1, help="Number of updates steps to accumualte before performing a backward/update pass.") parser.add_argument('--optimize_on_cpu', default=False, action='store_true', help="Whether to perform optimization and keep the optimizer averages on CPU") parser.add_argument('--fp16', default=False, action='store_true', help="Whether to use 16-bit float precision instead of 32-bit") parser.add_argument('--loss_scale', type=float, default=128, help='Loss scaling, positive power of 2 values can improve fp16 convergence.') parser.add_argument("--train_batch_size", default=32, type=int, help="Total batch size for training.") parser.add_argument("--predict_batch_size", default=8, type=int, help="Total batch size for predictions.") parser.add_argument("--verbose_logging", default=False, action='store_true', help="If true, all of the warnings related to data processing will be printed. " "A number of warnings are expected for a normal SQuAD evaluation.") parser.add_argument("--layers", default="-1", type=str) parser.add_argument("--batch_size", default=10, type=int, help="Batch size for predictions.") parser.add_argument("--data_batch_size", default=10, type=int, help="Batch size for generating bert output.") parser.add_argument("--max_sent_len", default=400, type=int, help="max sentence length.") args = parser.parse_args() # random.seed(0) # numpy.random.seed(0) # torch.manual_seed(args.random_seed) # torch.cuda.manual_seed(args.random_seed) nnargs = properties_loader.read_pros(args.props)#from prob
Formal statement is: lemma convex_hull_subset: "s \<subseteq> convex hull t \<Longrightarrow> convex hull s \<subseteq> convex hull t" Informal statement is: If $s$ is a subset of the convex hull of $t$, then the convex hull of $s$ is a subset of the convex hull of $t$.
[GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } ⊢ snorm (↑↑↑(↑(condexpL2 E 𝕜 hm) f)) 2 μ ≤ snorm (↑↑f) 2 μ [PROOFSTEP] rw [lpMeas_coe, ← ENNReal.toReal_le_toReal (Lp.snorm_ne_top _) (Lp.snorm_ne_top _), ← Lp.norm_def, ← Lp.norm_def, Submodule.norm_coe] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } ⊢ ‖↑(condexpL2 E 𝕜 hm) f‖ ≤ ‖f‖ [PROOFSTEP] exact norm_condexpL2_le hm f [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } ⊢ ‖↑(↑(condexpL2 E 𝕜 hm) f)‖ ≤ ‖f‖ [PROOFSTEP] rw [Lp.norm_def, Lp.norm_def, ← lpMeas_coe] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } ⊢ ENNReal.toReal (snorm (↑↑↑(↑(condexpL2 E 𝕜 hm) f)) 2 μ) ≤ ENNReal.toReal (snorm (↑↑f) 2 μ) [PROOFSTEP] refine' (ENNReal.toReal_le_toReal _ (Lp.snorm_ne_top _)).mpr (snorm_condexpL2_le hm f) [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } ⊢ snorm (↑↑↑(↑(condexpL2 E 𝕜 hm) f)) 2 μ ≠ ⊤ [PROOFSTEP] exact Lp.snorm_ne_top _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E ⊢ ↑(↑(condexpL2 E 𝕜 hm) (indicatorConstLp 2 (_ : MeasurableSet s) hμs c)) = indicatorConstLp 2 (_ : MeasurableSet s) hμs c [PROOFSTEP] rw [condexpL2] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E ⊢ ↑(↑(orthogonalProjection (lpMeas E 𝕜 m 2 μ)) (indicatorConstLp 2 (_ : MeasurableSet s) hμs c)) = indicatorConstLp 2 (_ : MeasurableSet s) hμs c [PROOFSTEP] haveI : Fact (m ≤ m0) := ⟨hm⟩ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E this : Fact (m ≤ m0) ⊢ ↑(↑(orthogonalProjection (lpMeas E 𝕜 m 2 μ)) (indicatorConstLp 2 (_ : MeasurableSet s) hμs c)) = indicatorConstLp 2 (_ : MeasurableSet s) hμs c [PROOFSTEP] have h_mem : indicatorConstLp 2 (hm s hs) hμs c ∈ lpMeas E 𝕜 m 2 μ := mem_lpMeas_indicatorConstLp hm hs hμs [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E this : Fact (m ≤ m0) h_mem : indicatorConstLp 2 (_ : MeasurableSet s) hμs c ∈ lpMeas E 𝕜 m 2 μ ⊢ ↑(↑(orthogonalProjection (lpMeas E 𝕜 m 2 μ)) (indicatorConstLp 2 (_ : MeasurableSet s) hμs c)) = indicatorConstLp 2 (_ : MeasurableSet s) hμs c [PROOFSTEP] let ind := (⟨indicatorConstLp 2 (hm s hs) hμs c, h_mem⟩ : lpMeas E 𝕜 m 2 μ) [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E this : Fact (m ≤ m0) h_mem : indicatorConstLp 2 (_ : MeasurableSet s) hμs c ∈ lpMeas E 𝕜 m 2 μ ind : { x // x ∈ lpMeas E 𝕜 m 2 μ } := { val := indicatorConstLp 2 (_ : MeasurableSet s) hμs c, property := h_mem } ⊢ ↑(↑(orthogonalProjection (lpMeas E 𝕜 m 2 μ)) (indicatorConstLp 2 (_ : MeasurableSet s) hμs c)) = indicatorConstLp 2 (_ : MeasurableSet s) hμs c [PROOFSTEP] have h_coe_ind : (ind : α →₂[μ] E) = indicatorConstLp 2 (hm s hs) hμs c := by rfl [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E this : Fact (m ≤ m0) h_mem : indicatorConstLp 2 (_ : MeasurableSet s) hμs c ∈ lpMeas E 𝕜 m 2 μ ind : { x // x ∈ lpMeas E 𝕜 m 2 μ } := { val := indicatorConstLp 2 (_ : MeasurableSet s) hμs c, property := h_mem } ⊢ ↑ind = indicatorConstLp 2 (_ : MeasurableSet s) hμs c [PROOFSTEP] rfl [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E this : Fact (m ≤ m0) h_mem : indicatorConstLp 2 (_ : MeasurableSet s) hμs c ∈ lpMeas E 𝕜 m 2 μ ind : { x // x ∈ lpMeas E 𝕜 m 2 μ } := { val := indicatorConstLp 2 (_ : MeasurableSet s) hμs c, property := h_mem } h_coe_ind : ↑ind = indicatorConstLp 2 (_ : MeasurableSet s) hμs c ⊢ ↑(↑(orthogonalProjection (lpMeas E 𝕜 m 2 μ)) (indicatorConstLp 2 (_ : MeasurableSet s) hμs c)) = indicatorConstLp 2 (_ : MeasurableSet s) hμs c [PROOFSTEP] have h_orth_mem := orthogonalProjection_mem_subspace_eq_self ind [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E this : Fact (m ≤ m0) h_mem : indicatorConstLp 2 (_ : MeasurableSet s) hμs c ∈ lpMeas E 𝕜 m 2 μ ind : { x // x ∈ lpMeas E 𝕜 m 2 μ } := { val := indicatorConstLp 2 (_ : MeasurableSet s) hμs c, property := h_mem } h_coe_ind : ↑ind = indicatorConstLp 2 (_ : MeasurableSet s) hμs c h_orth_mem : ↑(orthogonalProjection (lpMeas E 𝕜 m 2 μ)) ↑ind = ind ⊢ ↑(↑(orthogonalProjection (lpMeas E 𝕜 m 2 μ)) (indicatorConstLp 2 (_ : MeasurableSet s) hμs c)) = indicatorConstLp 2 (_ : MeasurableSet s) hμs c [PROOFSTEP] rw [← h_coe_ind, h_orth_mem] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f g : { x // x ∈ Lp E 2 } hg : AEStronglyMeasurable' m (↑↑g) μ ⊢ inner (↑(↑(condexpL2 E 𝕜 hm) f)) g = inner f g [PROOFSTEP] symm [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f g : { x // x ∈ Lp E 2 } hg : AEStronglyMeasurable' m (↑↑g) μ ⊢ inner f g = inner (↑(↑(condexpL2 E 𝕜 hm) f)) g [PROOFSTEP] rw [← sub_eq_zero, ← inner_sub_left, condexpL2] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f g : { x // x ∈ Lp E 2 } hg : AEStronglyMeasurable' m (↑↑g) μ ⊢ inner (f - ↑(↑(orthogonalProjection (lpMeas E 𝕜 m 2 μ)) f)) g = 0 [PROOFSTEP] simp only [mem_lpMeas_iff_aeStronglyMeasurable'.mpr hg, orthogonalProjection_inner_eq_zero f g] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp 𝕜 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ⊢ ∫ (x : α) in s, ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) f) x ∂μ = ∫ (x : α) in s, ↑↑f x ∂μ [PROOFSTEP] rw [← L2.inner_indicatorConstLp_one (𝕜 := 𝕜) (hm s hs) hμs f] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp 𝕜 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ⊢ ∫ (x : α) in s, ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) f) x ∂μ = inner (indicatorConstLp 2 (_ : MeasurableSet s) hμs 1) f [PROOFSTEP] have h_eq_inner : ∫ x in s, (condexpL2 𝕜 𝕜 hm f : α → 𝕜) x ∂μ = inner (indicatorConstLp 2 (hm s hs) hμs (1 : 𝕜)) (condexpL2 𝕜 𝕜 hm f) := by rw [L2.inner_indicatorConstLp_one (hm s hs) hμs] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp 𝕜 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ⊢ ∫ (x : α) in s, ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) f) x ∂μ = inner (indicatorConstLp 2 (_ : MeasurableSet s) hμs 1) ↑(↑(condexpL2 𝕜 𝕜 hm) f) [PROOFSTEP] rw [L2.inner_indicatorConstLp_one (hm s hs) hμs] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp 𝕜 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ h_eq_inner : ∫ (x : α) in s, ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) f) x ∂μ = inner (indicatorConstLp 2 (_ : MeasurableSet s) hμs 1) ↑(↑(condexpL2 𝕜 𝕜 hm) f) ⊢ ∫ (x : α) in s, ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) f) x ∂μ = inner (indicatorConstLp 2 (_ : MeasurableSet s) hμs 1) f [PROOFSTEP] rw [h_eq_inner, ← inner_condexpL2_left_eq_right, condexpL2_indicator_of_measurable hm hs hμs] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ ≤ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ [PROOFSTEP] let h_meas := lpMeas.aeStronglyMeasurable' (condexpL2 ℝ ℝ hm f) [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ ≤ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ [PROOFSTEP] let g := h_meas.choose [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ ≤ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ [PROOFSTEP] have hg_meas : StronglyMeasurable[m] g := h_meas.choose_spec.1 [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ ≤ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ [PROOFSTEP] have hg_eq : g =ᵐ[μ] condexpL2 ℝ ℝ hm f := h_meas.choose_spec.2.symm [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ ≤ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ [PROOFSTEP] have hg_eq_restrict : g =ᵐ[μ.restrict s] condexpL2 ℝ ℝ hm f := ae_restrict_of_ae hg_eq [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ ≤ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ [PROOFSTEP] have hg_nnnorm_eq : (fun x => (‖g x‖₊ : ℝ≥0∞)) =ᵐ[μ.restrict s] fun x => (‖(condexpL2 ℝ ℝ hm f : α → ℝ) x‖₊ : ℝ≥0∞) := by refine' hg_eq_restrict.mono fun x hx => _ dsimp only simp_rw [hx] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) ⊢ (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ [PROOFSTEP] refine' hg_eq_restrict.mono fun x hx => _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x : α hx : g x = ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x ⊢ (fun x => ↑‖g x‖₊) x = (fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊) x [PROOFSTEP] dsimp only [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x : α hx : g x = ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x ⊢ ↑‖Exists.choose (_ : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ) x‖₊ = ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ [PROOFSTEP] simp_rw [hx] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ ≤ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ [PROOFSTEP] rw [lintegral_congr_ae hg_nnnorm_eq.symm] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ⊢ ∫⁻ (a : α) in s, ↑‖g a‖₊ ∂μ ≤ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ [PROOFSTEP] refine' lintegral_nnnorm_le_of_forall_fin_meas_integral_eq hm (Lp.stronglyMeasurable f) _ _ _ _ hs hμs [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ⊢ IntegrableOn (fun x => ↑↑f x) s [PROOFSTEP] exact integrableOn_Lp_of_measure_ne_top f fact_one_le_two_ennreal.elim hμs [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ⊢ StronglyMeasurable fun a => g a [PROOFSTEP] exact hg_meas [GOAL] case refine'_3 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ⊢ IntegrableOn (fun a => g a) s [PROOFSTEP] rw [IntegrableOn, integrable_congr hg_eq_restrict] [GOAL] case refine'_3 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ⊢ Integrable ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) [PROOFSTEP] exact integrableOn_condexpL2_of_measure_ne_top hm hμs f [GOAL] case refine'_4 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ⊢ ∀ (t : Set α), MeasurableSet t → ↑↑μ t < ⊤ → ∫ (x : α) in t, g x ∂μ = ∫ (x : α) in t, ↑↑f x ∂μ [PROOFSTEP] intro t ht hμt [GOAL] case refine'_4 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ t : Set α ht : MeasurableSet t hμt : ↑↑μ t < ⊤ ⊢ ∫ (x : α) in t, g x ∂μ = ∫ (x : α) in t, ↑↑f x ∂μ [PROOFSTEP] rw [← integral_condexpL2_eq_of_fin_meas_real f ht hμt.ne] [GOAL] case refine'_4 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ t : Set α ht : MeasurableSet t hμt : ↑↑μ t < ⊤ ⊢ ∫ (x : α) in t, g x ∂μ = ∫ (x : α) in t, ↑↑↑(↑(condexpL2 ℝ ℝ ?m.662736) f) x ∂μ α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } h_meas : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) f)) μ := lpMeas.aeStronglyMeasurable' (↑(condexpL2 ℝ ℝ hm) f) g : α → ℝ := Exists.choose h_meas hg_meas : StronglyMeasurable g hg_eq : g =ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_eq_restrict : g =ᵐ[Measure.restrict μ s] ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) hg_nnnorm_eq : (fun x => ↑‖g x‖₊) =ᵐ[Measure.restrict μ s] fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ t : Set α ht : MeasurableSet t hμt : ↑↑μ t < ⊤ ⊢ m ≤ m0 [PROOFSTEP] exact set_integral_congr_ae (hm t ht) (hg_eq.mono fun x hx _ => hx) [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 ⊢ ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) =ᵐ[Measure.restrict μ s] 0 [PROOFSTEP] suffices h_nnnorm_eq_zero : ∫⁻ x in s, ‖(condexpL2 ℝ ℝ hm f : α → ℝ) x‖₊ ∂μ = 0 [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ = 0 ⊢ ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) =ᵐ[Measure.restrict μ s] 0 [PROOFSTEP] rw [lintegral_eq_zero_iff] at h_nnnorm_eq_zero [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : (fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊) =ᵐ[Measure.restrict μ s] 0 ⊢ ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) =ᵐ[Measure.restrict μ s] 0 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ = 0 ⊢ Measurable fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ [PROOFSTEP] refine' h_nnnorm_eq_zero.mono fun x hx => _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : (fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊) =ᵐ[Measure.restrict μ s] 0 x : α hx : (fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊) x = OfNat.ofNat 0 x ⊢ ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x = OfNat.ofNat 0 x α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ = 0 ⊢ Measurable fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ [PROOFSTEP] dsimp only at hx [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : (fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊) =ᵐ[Measure.restrict μ s] 0 x : α hx : ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ = OfNat.ofNat 0 x ⊢ ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x = OfNat.ofNat 0 x α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ = 0 ⊢ Measurable fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ [PROOFSTEP] rw [Pi.zero_apply] at hx ⊢ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : (fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊) =ᵐ[Measure.restrict μ s] 0 x : α hx : ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ = 0 ⊢ ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x = 0 [PROOFSTEP] rwa [ENNReal.coe_eq_zero, nnnorm_eq_zero] at hx [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ = 0 ⊢ Measurable fun x => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ [PROOFSTEP] refine' Measurable.coe_nnreal_ennreal (Measurable.nnnorm _) [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ = 0 ⊢ Measurable fun x => ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x [PROOFSTEP] rw [lpMeas_coe] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 h_nnnorm_eq_zero : ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ = 0 ⊢ Measurable fun x => ↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x [PROOFSTEP] exact (Lp.stronglyMeasurable _).measurable [GOAL] case h_nnnorm_eq_zero α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ = 0 [PROOFSTEP] refine' le_antisymm _ (zero_le _) [GOAL] case h_nnnorm_eq_zero α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 ⊢ ∫⁻ (x : α) in s, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) f) x‖₊ ∂μ ≤ 0 [PROOFSTEP] refine' (lintegral_nnnorm_condexpL2_le hs hμs f).trans (le_of_eq _) [GOAL] case h_nnnorm_eq_zero α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 ⊢ ∫⁻ (x : α) in s, ↑‖↑↑f x‖₊ ∂μ = 0 [PROOFSTEP] rw [lintegral_eq_zero_iff] [GOAL] case h_nnnorm_eq_zero α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 ⊢ (fun x => ↑‖↑↑f x‖₊) =ᵐ[Measure.restrict μ s] 0 [PROOFSTEP] refine' hf.mono fun x hx => _ [GOAL] case h_nnnorm_eq_zero α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 x : α hx : ↑↑f x = OfNat.ofNat 0 x ⊢ (fun x => ↑‖↑↑f x‖₊) x = OfNat.ofNat 0 x [PROOFSTEP] dsimp only [GOAL] case h_nnnorm_eq_zero α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 x : α hx : ↑↑f x = OfNat.ofNat 0 x ⊢ ↑‖↑↑f x‖₊ = OfNat.ofNat 0 x [PROOFSTEP] rw [hx] [GOAL] case h_nnnorm_eq_zero α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 x : α hx : ↑↑f x = OfNat.ofNat 0 x ⊢ ↑‖OfNat.ofNat 0 x‖₊ = OfNat.ofNat 0 x [PROOFSTEP] simp [GOAL] case h_nnnorm_eq_zero α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ f : { x // x ∈ Lp ℝ 2 } hf : ↑↑f =ᵐ[Measure.restrict μ s] 0 ⊢ Measurable fun x => ↑‖↑↑f x‖₊ [PROOFSTEP] exact (Lp.stronglyMeasurable _).ennnorm [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ ∂μ ≤ ↑↑μ (s ∩ t) [PROOFSTEP] refine' (lintegral_nnnorm_condexpL2_le ht hμt _).trans (le_of_eq _) [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ↑↑μ (s ∩ t) [PROOFSTEP] have h_eq : ∫⁻ x in t, ‖(indicatorConstLp 2 hs hμs (1 : ℝ)) x‖₊ ∂μ = ∫⁻ x in t, s.indicator (fun _ => (1 : ℝ≥0∞)) x ∂μ := by refine' lintegral_congr_ae (ae_restrict_of_ae _) refine' (@indicatorConstLp_coeFn _ _ _ 2 _ _ _ hs hμs (1 : ℝ)).mono fun x hx => _ dsimp only rw [hx] classical simp_rw [Set.indicator_apply] split_ifs <;> simp [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ∫⁻ (x : α) in t, Set.indicator s (fun x => 1) x ∂μ [PROOFSTEP] refine' lintegral_congr_ae (ae_restrict_of_ae _) [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∀ᵐ (x : α) ∂μ, (fun x => ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊) x = (fun x => Set.indicator s (fun x => 1) x) x [PROOFSTEP] refine' (@indicatorConstLp_coeFn _ _ _ 2 _ _ _ hs hμs (1 : ℝ)).mono fun x hx => _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ x : α hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = Set.indicator s (fun x => 1) x ⊢ (fun x => ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊) x = (fun x => Set.indicator s (fun x => 1) x) x [PROOFSTEP] dsimp only [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ x : α hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = Set.indicator s (fun x => 1) x ⊢ ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ = Set.indicator s (fun x => 1) x [PROOFSTEP] rw [hx] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ x : α hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = Set.indicator s (fun x => 1) x ⊢ ↑‖Set.indicator s (fun x => 1) x‖₊ = Set.indicator s (fun x => 1) x [PROOFSTEP] classical simp_rw [Set.indicator_apply] split_ifs <;> simp [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ x : α hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = Set.indicator s (fun x => 1) x ⊢ ↑‖Set.indicator s (fun x => 1) x‖₊ = Set.indicator s (fun x => 1) x [PROOFSTEP] simp_rw [Set.indicator_apply] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ x : α hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = Set.indicator s (fun x => 1) x ⊢ ↑‖if x ∈ s then 1 else 0‖₊ = if x ∈ s then 1 else 0 [PROOFSTEP] split_ifs [GOAL] case pos α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ x : α hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = Set.indicator s (fun x => 1) x h✝ : x ∈ s ⊢ ↑‖1‖₊ = 1 [PROOFSTEP] simp [GOAL] case neg α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ x : α hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = Set.indicator s (fun x => 1) x h✝ : ¬x ∈ s ⊢ ↑‖0‖₊ = 0 [PROOFSTEP] simp [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ h_eq : ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ∫⁻ (x : α) in t, Set.indicator s (fun x => 1) x ∂μ ⊢ ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ↑↑μ (s ∩ t) [PROOFSTEP] rw [h_eq, lintegral_indicator _ hs, lintegral_const, Measure.restrict_restrict hs] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ h_eq : ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ∫⁻ (x : α) in t, Set.indicator s (fun x => 1) x ∂μ ⊢ 1 * ↑↑(Measure.restrict μ (s ∩ t)) Set.univ = ↑↑μ (s ∩ t) [PROOFSTEP] simp only [one_mul, Set.univ_inter, MeasurableSet.univ, Measure.restrict_apply] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E ⊢ ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2))) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) [PROOFSTEP] rw [lpMeas_coe] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E ⊢ ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2))) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) [PROOFSTEP] have h_mem_Lp : Memℒp (fun a => ⟪c, (condexpL2 E 𝕜 hm f : α → E) a⟫) 2 μ := by refine' Memℒp.const_inner _ _; rw [lpMeas_coe]; exact Lp.memℒp _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E ⊢ Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 [PROOFSTEP] refine' Memℒp.const_inner _ _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E ⊢ Memℒp (fun a => ↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) 2 [PROOFSTEP] rw [lpMeas_coe] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E ⊢ Memℒp (fun a => ↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) 2 [PROOFSTEP] exact Lp.memℒp _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 ⊢ ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2))) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) [PROOFSTEP] have h_eq : h_mem_Lp.toLp _ =ᵐ[μ] fun a => ⟪c, (condexpL2 E 𝕜 hm f : α → E) a⟫ := h_mem_Lp.coeFn_toLp [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) ⊢ ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2))) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) [PROOFSTEP] refine' EventuallyEq.trans _ h_eq [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) ⊢ ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2))) =ᵐ[μ] ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) [PROOFSTEP] refine' Lp.ae_eq_of_forall_set_integral_eq' 𝕜 hm _ _ two_ne_zero ENNReal.coe_ne_top (fun s _ hμs => integrableOn_condexpL2_of_measure_ne_top hm hμs.ne _) _ _ _ _ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) ⊢ ∀ (s : Set α), MeasurableSet s → ↑↑μ s < ⊤ → IntegrableOn (↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp)) s [PROOFSTEP] intro s _ hμs [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s✝ t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) s : Set α a✝ : MeasurableSet s hμs : ↑↑μ s < ⊤ ⊢ IntegrableOn (↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp)) s [PROOFSTEP] rw [IntegrableOn, integrable_congr (ae_restrict_of_ae h_eq)] [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s✝ t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) s : Set α a✝ : MeasurableSet s hμs : ↑↑μ s < ⊤ ⊢ Integrable fun x => (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) x [PROOFSTEP] exact (integrableOn_condexpL2_of_measure_ne_top hm hμs.ne _).const_inner _ [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) ⊢ ∀ (s : Set α), MeasurableSet s → ↑↑μ s < ⊤ → ∫ (x : α) in s, ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2))) x ∂μ = ∫ (x : α) in s, ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) x ∂μ [PROOFSTEP] intro s hs hμs [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s✝ t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) s : Set α hs : MeasurableSet s hμs : ↑↑μ s < ⊤ ⊢ ∫ (x : α) in s, ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2))) x ∂μ = ∫ (x : α) in s, ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) x ∂μ [PROOFSTEP] rw [← lpMeas_coe, integral_condexpL2_eq_of_fin_meas_real _ hs hμs.ne, integral_congr_ae (ae_restrict_of_ae h_eq), lpMeas_coe, ← L2.inner_indicatorConstLp_eq_set_integral_inner 𝕜 (↑(condexpL2 E 𝕜 hm f)) (hm s hs) c hμs.ne, ← inner_condexpL2_left_eq_right, condexpL2_indicator_of_measurable _ hs, L2.inner_indicatorConstLp_eq_set_integral_inner 𝕜 f (hm s hs) c hμs.ne, set_integral_congr_ae (hm s hs) ((Memℒp.coeFn_toLp ((Lp.memℒp f).const_inner c)).mono fun x hx _ => hx)] [GOAL] case refine'_3 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) ⊢ AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2)))) μ [PROOFSTEP] rw [← lpMeas_coe] [GOAL] case refine'_3 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) ⊢ AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2)))) μ [PROOFSTEP] exact lpMeas.aeStronglyMeasurable' _ [GOAL] case refine'_4 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) ⊢ AEStronglyMeasurable' m (↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp)) μ [PROOFSTEP] refine' AEStronglyMeasurable'.congr _ h_eq.symm [GOAL] case refine'_4 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E 2 } c : E h_mem_Lp : Memℒp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) 2 h_eq : ↑↑(Memℒp.toLp (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) h_mem_Lp) =ᵐ[μ] fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a) ⊢ AEStronglyMeasurable' m (fun a => inner c (↑↑↑(↑(condexpL2 E 𝕜 hm) f) a)) μ [PROOFSTEP] exact (lpMeas.aeStronglyMeasurable' _).const_inner _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ⊢ ∫ (x : α) in s, ↑↑↑(↑(condexpL2 E' 𝕜 hm) f) x ∂μ = ∫ (x : α) in s, ↑↑f x ∂μ [PROOFSTEP] rw [← sub_eq_zero, lpMeas_coe, ← integral_sub' (integrableOn_Lp_of_measure_ne_top _ fact_one_le_two_ennreal.elim hμs) (integrableOn_Lp_of_measure_ne_top _ fact_one_le_two_ennreal.elim hμs)] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ⊢ ∫ (a : α) in s, (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) - ↑↑f) a ∂μ = 0 [PROOFSTEP] refine' integral_eq_zero_of_forall_integral_inner_eq_zero 𝕜 _ _ _ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ⊢ Integrable fun a => (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) - ↑↑f) a [PROOFSTEP] rw [integrable_congr (ae_restrict_of_ae (Lp.coeFn_sub (↑(condexpL2 E' 𝕜 hm f)) f).symm)] [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ⊢ Integrable fun x => ↑↑(↑(↑(condexpL2 E' 𝕜 hm) f) - f) x [PROOFSTEP] exact integrableOn_Lp_of_measure_ne_top _ fact_one_le_two_ennreal.elim hμs [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ ⊢ ∀ (c : E'), ∫ (x : α) in s, inner c ((↑↑↑(↑(condexpL2 E' 𝕜 hm) f) - ↑↑f) x) ∂μ = 0 [PROOFSTEP] intro c [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E' ⊢ ∫ (x : α) in s, inner c ((↑↑↑(↑(condexpL2 E' 𝕜 hm) f) - ↑↑f) x) ∂μ = 0 [PROOFSTEP] simp_rw [Pi.sub_apply, inner_sub_right] [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E' ⊢ ∫ (x : α) in s, inner c (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) x) - inner c (↑↑f x) ∂μ = 0 [PROOFSTEP] rw [integral_sub ((integrableOn_Lp_of_measure_ne_top _ fact_one_le_two_ennreal.elim hμs).const_inner c) ((integrableOn_Lp_of_measure_ne_top _ fact_one_le_two_ennreal.elim hμs).const_inner c)] [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E' ⊢ ∫ (a : α) in s, inner c (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) a) ∂μ - ∫ (a : α) in s, inner c (↑↑f a) ∂μ = 0 [PROOFSTEP] have h_ae_eq_f := Memℒp.coeFn_toLp (E := 𝕜) ((Lp.memℒp f).const_inner c) [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E' h_ae_eq_f : ↑↑(Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2)) =ᵐ[μ] fun a => inner c (↑↑f a) ⊢ ∫ (a : α) in s, inner c (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) a) ∂μ - ∫ (a : α) in s, inner c (↑↑f a) ∂μ = 0 [PROOFSTEP] rw [← lpMeas_coe, sub_eq_zero, ← set_integral_congr_ae (hm s hs) ((condexpL2_const_inner hm f c).mono fun x hx _ => hx), ← set_integral_congr_ae (hm s hs) (h_ae_eq_f.mono fun x hx _ => hx)] [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹³ : IsROrC 𝕜 inst✝¹² : NormedAddCommGroup E inst✝¹¹ : InnerProductSpace 𝕜 E inst✝¹⁰ : CompleteSpace E inst✝⁹ : NormedAddCommGroup E' inst✝⁸ : InnerProductSpace 𝕜 E' inst✝⁷ : CompleteSpace E' inst✝⁶ : NormedSpace ℝ E' inst✝⁵ : NormedAddCommGroup F inst✝⁴ : NormedSpace 𝕜 F inst✝³ : NormedAddCommGroup G inst✝² : NormedAddCommGroup G' inst✝¹ : NormedSpace ℝ G' inst✝ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α hm : m ≤ m0 f : { x // x ∈ Lp E' 2 } hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : E' h_ae_eq_f : ↑↑(Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2)) =ᵐ[μ] fun a => inner c (↑↑f a) ⊢ ∫ (x : α) in s, ↑↑↑(↑(condexpL2 𝕜 𝕜 hm) (Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2))) x ∂μ = ∫ (x : α) in s, ↑↑(Memℒp.toLp (fun a => inner c (↑↑f a)) (_ : Memℒp (fun a => inner c (↑↑f a)) 2)) x ∂μ [PROOFSTEP] exact integral_condexpL2_eq_of_fin_meas_real _ hs hμs [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } ⊢ ↑↑↑(↑(condexpL2 E'' 𝕜' hm) (compLp T f)) =ᵐ[μ] ↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f)) [PROOFSTEP] refine' Lp.ae_eq_of_forall_set_integral_eq' 𝕜' hm _ _ two_ne_zero ENNReal.coe_ne_top (fun s _ hμs => integrableOn_condexpL2_of_measure_ne_top hm hμs.ne _) (fun s _ hμs => integrableOn_Lp_of_measure_ne_top _ fact_one_le_two_ennreal.elim hμs.ne) _ _ _ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } ⊢ ∀ (s : Set α), MeasurableSet s → ↑↑μ s < ⊤ → ∫ (x : α) in s, ↑↑↑(↑(condexpL2 E'' 𝕜' hm) (compLp T f)) x ∂μ = ∫ (x : α) in s, ↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f)) x ∂μ [PROOFSTEP] intro s hs hμs [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s✝ t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } s : Set α hs : MeasurableSet s hμs : ↑↑μ s < ⊤ ⊢ ∫ (x : α) in s, ↑↑↑(↑(condexpL2 E'' 𝕜' hm) (compLp T f)) x ∂μ = ∫ (x : α) in s, ↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f)) x ∂μ [PROOFSTEP] rw [T.set_integral_compLp _ (hm s hs), T.integral_comp_comm (integrableOn_Lp_of_measure_ne_top _ fact_one_le_two_ennreal.elim hμs.ne), ← lpMeas_coe, ← lpMeas_coe, integral_condexpL2_eq hm f hs hμs.ne, integral_condexpL2_eq hm (T.compLp f) hs hμs.ne, T.set_integral_compLp _ (hm s hs), T.integral_comp_comm (integrableOn_Lp_of_measure_ne_top f fact_one_le_two_ennreal.elim hμs.ne)] [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } ⊢ AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 E'' 𝕜' hm) (compLp T f))) μ [PROOFSTEP] rw [← lpMeas_coe] [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } ⊢ AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 E'' 𝕜' hm) (compLp T f))) μ [PROOFSTEP] exact lpMeas.aeStronglyMeasurable' _ [GOAL] case refine'_3 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } ⊢ AEStronglyMeasurable' m (↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f))) μ [PROOFSTEP] have h_coe := T.coeFn_compLp (condexpL2 E' 𝕜 hm f : α →₂[μ] E') [GOAL] case refine'_3 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } h_coe : ∀ᵐ (a : α) ∂μ, ↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f)) a = ↑T (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) a) ⊢ AEStronglyMeasurable' m (↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f))) μ [PROOFSTEP] rw [← EventuallyEq] at h_coe [GOAL] case refine'_3 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } h_coe : (fun a => ↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f)) a) =ᵐ[μ] fun a => ↑T (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) a) ⊢ AEStronglyMeasurable' m (↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f))) μ [PROOFSTEP] refine' AEStronglyMeasurable'.congr _ h_coe.symm [GOAL] case refine'_3 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 T : E' →L[ℝ] E'' f : { x // x ∈ Lp E' 2 } h_coe : (fun a => ↑↑(compLp T ↑(↑(condexpL2 E' 𝕜 hm) f)) a) =ᵐ[μ] fun a => ↑T (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) a) ⊢ AEStronglyMeasurable' m (fun a => ↑T (↑↑↑(↑(condexpL2 E' 𝕜 hm) f) a)) μ [PROOFSTEP] exact (lpMeas.aeStronglyMeasurable' (condexpL2 E' 𝕜 hm f)).continuous_comp T.continuous [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ ↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) =ᵐ[μ] fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x [PROOFSTEP] rw [indicatorConstLp_eq_toSpanSingleton_compLp hs hμs x] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ ↑↑↑(↑(condexpL2 E' 𝕜 hm) (compLp (toSpanSingleton ℝ x) (indicatorConstLp 2 hs hμs 1))) =ᵐ[μ] fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x [PROOFSTEP] have h_comp := condexpL2_comp_continuousLinearMap ℝ 𝕜 hm (toSpanSingleton ℝ x) (indicatorConstLp 2 hs hμs (1 : ℝ)) [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' h_comp : ↑↑↑(↑(condexpL2 E' 𝕜 hm) (compLp (toSpanSingleton ℝ x) (indicatorConstLp 2 hs hμs 1))) =ᵐ[μ] ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) ⊢ ↑↑↑(↑(condexpL2 E' 𝕜 hm) (compLp (toSpanSingleton ℝ x) (indicatorConstLp 2 hs hμs 1))) =ᵐ[μ] fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x [PROOFSTEP] rw [← lpMeas_coe] at h_comp [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' h_comp : ↑↑↑(↑(condexpL2 E' 𝕜 hm) (compLp (toSpanSingleton ℝ x) (indicatorConstLp 2 hs hμs 1))) =ᵐ[μ] ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) ⊢ ↑↑↑(↑(condexpL2 E' 𝕜 hm) (compLp (toSpanSingleton ℝ x) (indicatorConstLp 2 hs hμs 1))) =ᵐ[μ] fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x [PROOFSTEP] refine' h_comp.trans _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' h_comp : ↑↑↑(↑(condexpL2 E' 𝕜 hm) (compLp (toSpanSingleton ℝ x) (indicatorConstLp 2 hs hμs 1))) =ᵐ[μ] ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) ⊢ ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) =ᵐ[μ] fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x [PROOFSTEP] exact (toSpanSingleton ℝ x).coeFn_compLp _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ ↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) = compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) [PROOFSTEP] ext1 [GOAL] case h α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ ↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) =ᵐ[μ] ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) [PROOFSTEP] rw [← lpMeas_coe] [GOAL] case h α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ ↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) =ᵐ[μ] ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) [PROOFSTEP] refine' (condexpL2_indicator_ae_eq_smul 𝕜 hm hs hμs x).trans _ [GOAL] case h α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ (fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x) =ᵐ[μ] ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) [PROOFSTEP] have h_comp := (toSpanSingleton ℝ x).coeFn_compLp (condexpL2 ℝ ℝ hm (indicatorConstLp 2 hs hμs 1) : α →₂[μ] ℝ) [GOAL] case h α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' h_comp : ∀ᵐ (a : α) ∂μ, ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) a = ↑(toSpanSingleton ℝ x) (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a) ⊢ (fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x) =ᵐ[μ] ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) [PROOFSTEP] rw [← EventuallyEq] at h_comp [GOAL] case h α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' h_comp : (fun a => ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) a) =ᵐ[μ] fun a => ↑(toSpanSingleton ℝ x) (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a) ⊢ (fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x) =ᵐ[μ] ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) [PROOFSTEP] refine' EventuallyEq.trans _ h_comp.symm [GOAL] case h α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' h_comp : (fun a => ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) a) =ᵐ[μ] fun a => ↑(toSpanSingleton ℝ x) (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a) ⊢ (fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x) =ᵐ[μ] fun a => ↑(toSpanSingleton ℝ x) (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a) [PROOFSTEP] refine' eventually_of_forall fun y => _ [GOAL] case h α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' h_comp : (fun a => ↑↑(compLp (toSpanSingleton ℝ x) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) a) =ᵐ[μ] fun a => ↑(toSpanSingleton ℝ x) (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a) y : α ⊢ (fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x) y = (fun a => ↑(toSpanSingleton ℝ x) (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a)) y [PROOFSTEP] rfl [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ a : α ha : ↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) a = (fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x) a x✝ : a ∈ t ⊢ ↑‖↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) a‖₊ = ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x‖₊ [PROOFSTEP] rw [ha] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x‖₊ ∂μ = (∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ ∂μ) * ↑‖x‖₊ [PROOFSTEP] simp_rw [nnnorm_smul, ENNReal.coe_mul] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ * ↑‖x‖₊ ∂μ = (∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ ∂μ) * ↑‖x‖₊ [PROOFSTEP] rw [lintegral_mul_const, lpMeas_coe] [GOAL] case hf α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁸ : IsROrC 𝕜 inst✝¹⁷ : NormedAddCommGroup E inst✝¹⁶ : InnerProductSpace 𝕜 E inst✝¹⁵ : CompleteSpace E inst✝¹⁴ : NormedAddCommGroup E' inst✝¹³ : InnerProductSpace 𝕜 E' inst✝¹² : CompleteSpace E' inst✝¹¹ : NormedSpace ℝ E' inst✝¹⁰ : NormedAddCommGroup F inst✝⁹ : NormedSpace 𝕜 F inst✝⁸ : NormedAddCommGroup G inst✝⁷ : NormedAddCommGroup G' inst✝⁶ : NormedSpace ℝ G' inst✝⁵ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁴ : IsROrC 𝕜' inst✝³ : NormedAddCommGroup E'' inst✝² : InnerProductSpace 𝕜' E'' inst✝¹ : CompleteSpace E'' inst✝ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ Measurable fun a => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ [PROOFSTEP] exact (Lp.stronglyMeasurable _).ennnorm [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' inst✝ : SigmaFinite (Measure.trim μ hm) ⊢ ∫⁻ (a : α), ↑‖↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) a‖₊ ∂μ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] refine' lintegral_le_of_forall_fin_meas_le' hm (μ s * ‖x‖₊) _ fun t ht hμt => _ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' inst✝ : SigmaFinite (Measure.trim μ hm) ⊢ AEMeasurable fun a => ↑‖↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) a‖₊ [PROOFSTEP] rw [lpMeas_coe] [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' inst✝ : SigmaFinite (Measure.trim μ hm) ⊢ AEMeasurable fun a => ↑‖↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) a‖₊ [PROOFSTEP] exact (Lp.aestronglyMeasurable _).ennnorm [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' inst✝ : SigmaFinite (Measure.trim μ hm) t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (x_1 : α) in t, ↑‖↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) x_1‖₊ ∂μ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] refine' (set_lintegral_nnnorm_condexpL2_indicator_le hm hs hμs x ht hμt).trans _ [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' inst✝ : SigmaFinite (Measure.trim μ hm) t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ↑↑μ (s ∩ t) * ↑‖x‖₊ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] exact mul_le_mul_right' (measure_mono (Set.inter_subset_left _ _)) _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ Integrable ↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) [PROOFSTEP] refine' integrable_of_forall_fin_meas_le' hm (μ s * ‖x‖₊) (ENNReal.mul_lt_top hμs ENNReal.coe_ne_top) _ _ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ AEStronglyMeasurable (↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x))) μ [PROOFSTEP] rw [lpMeas_coe] [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ AEStronglyMeasurable (↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x))) μ [PROOFSTEP] exact Lp.aestronglyMeasurable _ [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' ⊢ ∀ (s_1 : Set α), MeasurableSet s_1 → ↑↑μ s_1 ≠ ⊤ → ∫⁻ (x_1 : α) in s_1, ↑‖↑↑↑(↑(condexpL2 E' 𝕜 hm) (indicatorConstLp 2 hs hμs x)) x_1‖₊ ∂μ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] refine' fun t ht hμt => (set_lintegral_nnnorm_condexpL2_indicator_le hm hs hμs x ht hμt).trans _ [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E' t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ↑↑μ (s ∩ t) * ↑‖x‖₊ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] exact mul_le_mul_right' (measure_mono (Set.inter_subset_left _ _)) _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G ⊢ AEStronglyMeasurable' m (↑↑(condexpIndSMul hm hs hμs x)) μ [PROOFSTEP] have h : AEStronglyMeasurable' m (condexpL2 ℝ ℝ hm (indicatorConstLp 2 hs hμs 1) : α → ℝ) μ := aeStronglyMeasurable'_condexpL2 _ _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ AEStronglyMeasurable' m (↑↑(condexpIndSMul hm hs hμs x)) μ [PROOFSTEP] rw [condexpIndSMul] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ AEStronglyMeasurable' m (↑↑(↑(compLpL 2 μ (toSpanSingleton ℝ x)) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)))) μ [PROOFSTEP] suffices AEStronglyMeasurable' m (toSpanSingleton ℝ x ∘ condexpL2 ℝ ℝ hm (indicatorConstLp 2 hs hμs 1)) μ by refine' AEStronglyMeasurable'.congr this _ refine' EventuallyEq.trans _ (coeFn_compLpL _ _).symm rfl [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ this : AEStronglyMeasurable' m (↑(toSpanSingleton ℝ x) ∘ ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ AEStronglyMeasurable' m (↑↑(↑(compLpL 2 μ (toSpanSingleton ℝ x)) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)))) μ [PROOFSTEP] refine' AEStronglyMeasurable'.congr this _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ this : AEStronglyMeasurable' m (↑(toSpanSingleton ℝ x) ∘ ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ ↑(toSpanSingleton ℝ x) ∘ ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) =ᵐ[μ] ↑↑(↑(compLpL 2 μ (toSpanSingleton ℝ x)) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) [PROOFSTEP] refine' EventuallyEq.trans _ (coeFn_compLpL _ _).symm [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ this : AEStronglyMeasurable' m (↑(toSpanSingleton ℝ x) ∘ ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ ↑(toSpanSingleton ℝ x) ∘ ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) =ᵐ[μ] fun a => ↑(toSpanSingleton ℝ x) (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a) [PROOFSTEP] rfl [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ AEStronglyMeasurable' m (↑(toSpanSingleton ℝ x) ∘ ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ [PROOFSTEP] exact AEStronglyMeasurable'.continuous_comp (toSpanSingleton ℝ x).continuous h [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x y : G ⊢ condexpIndSMul hm hs hμs (x + y) = condexpIndSMul hm hs hμs x + condexpIndSMul hm hs hμs y [PROOFSTEP] simp_rw [condexpIndSMul] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x y : G ⊢ ↑(compLpL 2 μ (toSpanSingleton ℝ (x + y))) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) = ↑(compLpL 2 μ (toSpanSingleton ℝ x)) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) + ↑(compLpL 2 μ (toSpanSingleton ℝ y)) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) [PROOFSTEP] rw [toSpanSingleton_add, add_compLpL, add_apply] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : ℝ x : G ⊢ condexpIndSMul hm hs hμs (c • x) = c • condexpIndSMul hm hs hμs x [PROOFSTEP] simp_rw [condexpIndSMul] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : ℝ x : G ⊢ ↑(compLpL 2 μ (toSpanSingleton ℝ (c • x))) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) = c • ↑(compLpL 2 μ (toSpanSingleton ℝ x)) ↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) [PROOFSTEP] rw [toSpanSingleton_smul, smul_compLpL, smul_apply] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²¹ : IsROrC 𝕜 inst✝²⁰ : NormedAddCommGroup E inst✝¹⁹ : InnerProductSpace 𝕜 E inst✝¹⁸ : CompleteSpace E inst✝¹⁷ : NormedAddCommGroup E' inst✝¹⁶ : InnerProductSpace 𝕜 E' inst✝¹⁵ : CompleteSpace E' inst✝¹⁴ : NormedSpace ℝ E' inst✝¹³ : NormedAddCommGroup F inst✝¹² : NormedSpace 𝕜 F inst✝¹¹ : NormedAddCommGroup G inst✝¹⁰ : NormedAddCommGroup G' inst✝⁹ : NormedSpace ℝ G' inst✝⁸ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁷ : IsROrC 𝕜' inst✝⁶ : NormedAddCommGroup E'' inst✝⁵ : InnerProductSpace 𝕜' E'' inst✝⁴ : CompleteSpace E'' inst✝³ : NormedSpace ℝ E'' inst✝² : NormedSpace ℝ G hm : m ≤ m0 inst✝¹ : NormedSpace ℝ F inst✝ : SMulCommClass ℝ 𝕜 F hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ c : 𝕜 x : F ⊢ condexpIndSMul hm hs hμs (c • x) = c • condexpIndSMul hm hs hμs x [PROOFSTEP] rw [condexpIndSMul, condexpIndSMul, toSpanSingleton_smul', (toSpanSingleton ℝ x).smul_compLpL c, smul_apply] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ a : α ha : ↑↑(condexpIndSMul hm hs hμs x) a = (fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x) a x✝ : a ∈ t ⊢ ↑‖↑↑(condexpIndSMul hm hs hμs x) a‖₊ = ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x‖₊ [PROOFSTEP] rw [ha] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x‖₊ ∂μ = (∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ ∂μ) * ↑‖x‖₊ [PROOFSTEP] simp_rw [nnnorm_smul, ENNReal.coe_mul] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ * ↑‖x‖₊ ∂μ = (∫⁻ (a : α) in t, ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ ∂μ) * ↑‖x‖₊ [PROOFSTEP] rw [lintegral_mul_const, lpMeas_coe] [GOAL] case hf α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ Measurable fun a => ↑‖↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ [PROOFSTEP] exact (Lp.stronglyMeasurable _).ennnorm [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G inst✝ : SigmaFinite (Measure.trim μ hm) ⊢ ∫⁻ (a : α), ↑‖↑↑(condexpIndSMul hm hs hμs x) a‖₊ ∂μ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] refine' lintegral_le_of_forall_fin_meas_le' hm (μ s * ‖x‖₊) _ fun t ht hμt => _ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G inst✝ : SigmaFinite (Measure.trim μ hm) ⊢ AEMeasurable fun a => ↑‖↑↑(condexpIndSMul hm hs hμs x) a‖₊ [PROOFSTEP] exact (Lp.aestronglyMeasurable _).ennnorm [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G inst✝ : SigmaFinite (Measure.trim μ hm) t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ∫⁻ (x_1 : α) in t, ↑‖↑↑(condexpIndSMul hm hs hμs x) x_1‖₊ ∂μ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] refine' (set_lintegral_nnnorm_condexpIndSMul_le hm hs hμs x ht hμt).trans _ [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G inst✝ : SigmaFinite (Measure.trim μ hm) t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ↑↑μ (s ∩ t) * ↑‖x‖₊ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] exact mul_le_mul_right' (measure_mono (Set.inter_subset_left _ _)) _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G ⊢ Integrable ↑↑(condexpIndSMul hm hs hμs x) [PROOFSTEP] refine' integrable_of_forall_fin_meas_le' hm (μ s * ‖x‖₊) (ENNReal.mul_lt_top hμs ENNReal.coe_ne_top) _ _ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G ⊢ AEStronglyMeasurable (↑↑(condexpIndSMul hm hs hμs x)) μ [PROOFSTEP] exact Lp.aestronglyMeasurable _ [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G ⊢ ∀ (s_1 : Set α), MeasurableSet s_1 → ↑↑μ s_1 ≠ ⊤ → ∫⁻ (x_1 : α) in s_1, ↑‖↑↑(condexpIndSMul hm hs hμs x) x_1‖₊ ∂μ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] refine' fun t ht hμt => (set_lintegral_nnnorm_condexpIndSMul_le hm hs hμs x ht hμt).trans _ [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : G t : Set α ht : MeasurableSet t hμt : ↑↑μ t ≠ ⊤ ⊢ ↑↑μ (s ∩ t) * ↑‖x‖₊ ≤ ↑↑μ s * ↑‖x‖₊ [PROOFSTEP] exact mul_le_mul_right' (measure_mono (Set.inter_subset_left _ _)) _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm : m ≤ m0 x : G ⊢ condexpIndSMul hm (_ : MeasurableSet ∅) (_ : ↑↑μ ∅ ≠ ⊤) x = 0 [PROOFSTEP] rw [condexpIndSMul, indicatorConstLp_empty] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm : m ≤ m0 x : G ⊢ ↑(compLpL 2 μ (toSpanSingleton ℝ x)) ↑(↑(condexpL2 ℝ ℝ hm) 0) = 0 [PROOFSTEP] simp only [Submodule.coe_zero, ContinuousLinearMap.map_zero] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm : m ≤ m0 hs : MeasurableSet s ht : MeasurableSet t hμs : ↑↑μ s ≠ ⊤ hμt : ↑↑μ t ≠ ⊤ ⊢ ENNReal.toReal (↑↑μ (t ∩ s)) • 1 = ENNReal.toReal (↑↑μ (t ∩ s)) [PROOFSTEP] rw [smul_eq_mul, mul_one] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝¹⁹ : IsROrC 𝕜 inst✝¹⁸ : NormedAddCommGroup E inst✝¹⁷ : InnerProductSpace 𝕜 E inst✝¹⁶ : CompleteSpace E inst✝¹⁵ : NormedAddCommGroup E' inst✝¹⁴ : InnerProductSpace 𝕜 E' inst✝¹³ : CompleteSpace E' inst✝¹² : NormedSpace ℝ E' inst✝¹¹ : NormedAddCommGroup F inst✝¹⁰ : NormedSpace 𝕜 F inst✝⁹ : NormedAddCommGroup G inst✝⁸ : NormedAddCommGroup G' inst✝⁷ : NormedSpace ℝ G' inst✝⁶ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁵ : IsROrC 𝕜' inst✝⁴ : NormedAddCommGroup E'' inst✝³ : InnerProductSpace 𝕜' E'' inst✝² : CompleteSpace E'' inst✝¹ : NormedSpace ℝ E'' inst✝ : NormedSpace ℝ G hm : m ≤ m0 hs : MeasurableSet s ht : MeasurableSet t hμs : ↑↑μ s ≠ ⊤ hμt : ↑↑μ t ≠ ⊤ x : G' ⊢ (∫ (a : α) in s, ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 ht hμt 1)) a ∂μ) • x = ENNReal.toReal (↑↑μ (t ∩ s)) • x [PROOFSTEP] rw [set_integral_condexpL2_indicator hs ht hμs hμt] [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) ⊢ 0 ≤ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) [PROOFSTEP] have h : AEStronglyMeasurable' m (condexpL2 ℝ ℝ hm (indicatorConstLp 2 hs hμs 1) : α → ℝ) μ := aeStronglyMeasurable'_condexpL2 _ _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ 0 ≤ᵐ[μ] ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) [PROOFSTEP] refine' EventuallyLE.trans_eq _ h.ae_eq_mk.symm [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ 0 ≤ᵐ[μ] AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h [PROOFSTEP] refine' @ae_le_of_ae_le_trim _ _ _ _ _ _ hm (0 : α → ℝ) _ _ [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ 0 ≤ᵐ[Measure.trim μ hm] AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h [PROOFSTEP] refine' ae_nonneg_of_forall_set_integral_nonneg_of_sigmaFinite _ _ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ ∀ (s_1 : Set α), MeasurableSet s_1 → ↑↑(Measure.trim μ hm) s_1 < ⊤ → IntegrableOn (AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h) s_1 [PROOFSTEP] rintro t - - [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ⊢ IntegrableOn (AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h) t [PROOFSTEP] refine @Integrable.integrableOn _ _ m _ _ _ _ ?_ [GOAL] case refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ⊢ Integrable (AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h) [PROOFSTEP] refine' Integrable.trim hm _ _ [GOAL] case refine'_1.refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ⊢ Integrable (AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h) [PROOFSTEP] rw [integrable_congr h.ae_eq_mk.symm] [GOAL] case refine'_1.refine'_1 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ⊢ Integrable ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) [PROOFSTEP] exact integrable_condexpL2_indicator hm hs hμs _ [GOAL] case refine'_1.refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ⊢ StronglyMeasurable (AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h) [PROOFSTEP] exact h.stronglyMeasurable_mk [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ ⊢ ∀ (s_1 : Set α), MeasurableSet s_1 → ↑↑(Measure.trim μ hm) s_1 < ⊤ → 0 ≤ ∫ (x : α) in s_1, AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x ∂Measure.trim μ hm [PROOFSTEP] intro t ht hμt [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ht : MeasurableSet t hμt : ↑↑(Measure.trim μ hm) t < ⊤ ⊢ 0 ≤ ∫ (x : α) in t, AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x ∂Measure.trim μ hm [PROOFSTEP] rw [← set_integral_trim hm h.stronglyMeasurable_mk ht] [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ht : MeasurableSet t hμt : ↑↑(Measure.trim μ hm) t < ⊤ ⊢ 0 ≤ ∫ (x : α) in t, AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x ∂μ [PROOFSTEP] have h_ae : ∀ᵐ x ∂μ, x ∈ t → h.mk _ x = (condexpL2 ℝ ℝ hm (indicatorConstLp 2 hs hμs 1) : α → ℝ) x := by filter_upwards [h.ae_eq_mk] with x hx exact fun _ => hx.symm [GOAL] α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ht : MeasurableSet t hμt : ↑↑(Measure.trim μ hm) t < ⊤ ⊢ ∀ᵐ (x : α) ∂μ, x ∈ t → AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x = ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) x [PROOFSTEP] filter_upwards [h.ae_eq_mk] with x hx [GOAL] case h α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ht : MeasurableSet t hμt : ↑↑(Measure.trim μ hm) t < ⊤ x : α hx : ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) x = AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x ⊢ x ∈ t → AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x = ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) x [PROOFSTEP] exact fun _ => hx.symm [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ht : MeasurableSet t hμt : ↑↑(Measure.trim μ hm) t < ⊤ h_ae : ∀ᵐ (x : α) ∂μ, x ∈ t → AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x = ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) x ⊢ 0 ≤ ∫ (x : α) in t, AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x ∂μ [PROOFSTEP] rw [set_integral_congr_ae (hm t ht) h_ae, set_integral_condexpL2_indicator ht hs ((le_trim hm).trans_lt hμt).ne hμs] [GOAL] case refine'_2 α : Type u_1 E : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²⁰ : IsROrC 𝕜 inst✝¹⁹ : NormedAddCommGroup E inst✝¹⁸ : InnerProductSpace 𝕜 E inst✝¹⁷ : CompleteSpace E inst✝¹⁶ : NormedAddCommGroup E' inst✝¹⁵ : InnerProductSpace 𝕜 E' inst✝¹⁴ : CompleteSpace E' inst✝¹³ : NormedSpace ℝ E' inst✝¹² : NormedAddCommGroup F inst✝¹¹ : NormedSpace 𝕜 F inst✝¹⁰ : NormedAddCommGroup G inst✝⁹ : NormedAddCommGroup G' inst✝⁸ : NormedSpace ℝ G' inst✝⁷ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t✝ : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁶ : IsROrC 𝕜' inst✝⁵ : NormedAddCommGroup E'' inst✝⁴ : InnerProductSpace 𝕜' E'' inst✝³ : CompleteSpace E'' inst✝² : NormedSpace ℝ E'' inst✝¹ : NormedSpace ℝ G hm✝ hm : m ≤ m0 hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ inst✝ : SigmaFinite (Measure.trim μ hm) h : AEStronglyMeasurable' m (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) μ t : Set α ht : MeasurableSet t hμt : ↑↑(Measure.trim μ hm) t < ⊤ h_ae : ∀ᵐ (x : α) ∂μ, x ∈ t → AEStronglyMeasurable'.mk (↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1))) h x = ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) x ⊢ 0 ≤ ENNReal.toReal (↑↑μ (s ∩ t)) [PROOFSTEP] exact ENNReal.toReal_nonneg [GOAL] α : Type u_1 E✝ : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²³ : IsROrC 𝕜 inst✝²² : NormedAddCommGroup E✝ inst✝²¹ : InnerProductSpace 𝕜 E✝ inst✝²⁰ : CompleteSpace E✝ inst✝¹⁹ : NormedAddCommGroup E' inst✝¹⁸ : InnerProductSpace 𝕜 E' inst✝¹⁷ : CompleteSpace E' inst✝¹⁶ : NormedSpace ℝ E' inst✝¹⁵ : NormedAddCommGroup F inst✝¹⁴ : NormedSpace 𝕜 F inst✝¹³ : NormedAddCommGroup G inst✝¹² : NormedAddCommGroup G' inst✝¹¹ : NormedSpace ℝ G' inst✝¹⁰ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁹ : IsROrC 𝕜' inst✝⁸ : NormedAddCommGroup E'' inst✝⁷ : InnerProductSpace 𝕜' E'' inst✝⁶ : CompleteSpace E'' inst✝⁵ : NormedSpace ℝ E'' inst✝⁴ : NormedSpace ℝ G hm : m ≤ m0 E : Type u_10 inst✝³ : NormedLatticeAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : OrderedSMul ℝ E inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E hx : 0 ≤ x ⊢ 0 ≤ᵐ[μ] ↑↑(condexpIndSMul hm hs hμs x) [PROOFSTEP] refine' EventuallyLE.trans_eq _ (condexpIndSMul_ae_eq_smul hm hs hμs x).symm [GOAL] α : Type u_1 E✝ : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²³ : IsROrC 𝕜 inst✝²² : NormedAddCommGroup E✝ inst✝²¹ : InnerProductSpace 𝕜 E✝ inst✝²⁰ : CompleteSpace E✝ inst✝¹⁹ : NormedAddCommGroup E' inst✝¹⁸ : InnerProductSpace 𝕜 E' inst✝¹⁷ : CompleteSpace E' inst✝¹⁶ : NormedSpace ℝ E' inst✝¹⁵ : NormedAddCommGroup F inst✝¹⁴ : NormedSpace 𝕜 F inst✝¹³ : NormedAddCommGroup G inst✝¹² : NormedAddCommGroup G' inst✝¹¹ : NormedSpace ℝ G' inst✝¹⁰ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁹ : IsROrC 𝕜' inst✝⁸ : NormedAddCommGroup E'' inst✝⁷ : InnerProductSpace 𝕜' E'' inst✝⁶ : CompleteSpace E'' inst✝⁵ : NormedSpace ℝ E'' inst✝⁴ : NormedSpace ℝ G hm : m ≤ m0 E : Type u_10 inst✝³ : NormedLatticeAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : OrderedSMul ℝ E inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E hx : 0 ≤ x ⊢ 0 ≤ᵐ[μ] fun a => ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x [PROOFSTEP] filter_upwards [condexpL2_indicator_nonneg hm hs hμs] with a ha [GOAL] case h α : Type u_1 E✝ : Type u_2 E' : Type u_3 F : Type u_4 G : Type u_5 G' : Type u_6 𝕜 : Type u_7 p : ℝ≥0∞ inst✝²³ : IsROrC 𝕜 inst✝²² : NormedAddCommGroup E✝ inst✝²¹ : InnerProductSpace 𝕜 E✝ inst✝²⁰ : CompleteSpace E✝ inst✝¹⁹ : NormedAddCommGroup E' inst✝¹⁸ : InnerProductSpace 𝕜 E' inst✝¹⁷ : CompleteSpace E' inst✝¹⁶ : NormedSpace ℝ E' inst✝¹⁵ : NormedAddCommGroup F inst✝¹⁴ : NormedSpace 𝕜 F inst✝¹³ : NormedAddCommGroup G inst✝¹² : NormedAddCommGroup G' inst✝¹¹ : NormedSpace ℝ G' inst✝¹⁰ : CompleteSpace G' m m0 : MeasurableSpace α μ : Measure α s t : Set α E'' : Type u_8 𝕜' : Type u_9 inst✝⁹ : IsROrC 𝕜' inst✝⁸ : NormedAddCommGroup E'' inst✝⁷ : InnerProductSpace 𝕜' E'' inst✝⁶ : CompleteSpace E'' inst✝⁵ : NormedSpace ℝ E'' inst✝⁴ : NormedSpace ℝ G hm : m ≤ m0 E : Type u_10 inst✝³ : NormedLatticeAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : OrderedSMul ℝ E inst✝ : SigmaFinite (Measure.trim μ hm) hs : MeasurableSet s hμs : ↑↑μ s ≠ ⊤ x : E hx : 0 ≤ x a : α ha : OfNat.ofNat 0 a ≤ ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a ⊢ OfNat.ofNat 0 a ≤ ↑↑↑(↑(condexpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a • x [PROOFSTEP] exact smul_nonneg ha hx
# Inductive bias in GCN: a spectral perspective __author: [Marc Lelarge](https://www.di.ens.fr/~lelarge/), [code](https://github.com/dataflowr/notebooks/blob/master/graphs/GCN_inductivebias_spectral.ipynb), course: [dataflowr](https://dataflowr.github.io/website/)__ Here, we focus on Graph Convolution Networks (GCN) introduced by Kipf and Welling in their paper [Semi-Supervised Classification with Graph Convolutional Networks](https://arxiv.org/abs/1609.02907). The GCN layer is one of the simplest Graph Neural Network layer defined by: \begin{equation} \label{eq:gcn_layer} h_i^{(\ell+1)} = \frac{1}{d_i+1}h_i^{(\ell)}W^{(\ell)} + \sum_{j\sim i} \frac{h_j^{(\ell)}W^{(\ell)}}{\sqrt{(d_i+1)(d_j+1)}}, \end{equation} where $i\sim j$ means that nodes $i$ and $j$ are neighbors in the graph $G$, $d_i$ and $d_j$ are the respective degrees of nodes $i$ and $j$ (i.e. their number of neighbors in the graph) and $h_i^{(\ell)}$ is the embedding representation of node $i$ at layer $\ell$ and $W^{(\ell)}$ is a trainable weight matrix of shape `[size_input_feature, size_output_feature]`. The [inductive bias](https://en.wikipedia.org/wiki/Inductive_bias) of a learning algorithm is the set of assumptions that the learner uses to predict outputs of given inputs that it has not encountered. For GCN, we argue that the inductive bias can be formulated as a simple spectral property of the algorithm: GCN acts as low-pass filters. This arguments follows from recent works [Simplifying Graph Convolutional Networks](http://proceedings.mlr.press/v97/wu19e.html) by Wu, Souza, Zhang, Fifty, Yu, Weinberger and [Revisiting Graph Neural Networks: All We Have is Low-Pass Filters](https://arxiv.org/abs/1905.09550) by NT and Maehara. Here we will study a very simple case and relate the inductive bias of GCN to the property of the Fiedler vector of the graph. We'll consider the more general setting in a subsequent post. ## Notations We consider undirected graphs $G=(V,E)$ with $n$ vertices denoted by $i,j \in [n]$. $i\sim j$ means that nodes $i$ and $j$ are neighbors in $G$, i.e. $\{i,j\}\in E$. We denote by $A$ its [adjacency matrix](https://en.wikipedia.org/wiki/Adjacency_matrix) and by $D$ the diagonal matrix of degrees. The vector of degrees is denoted by $d$ so that $d= A1$. The components of a vector $x\in \mathbb{R}^n$ are denoted $x_i$ but sometimes it is convenient to see the vector $x$ as a function from $V$ to $\mathbb{R}$ and use the notation $x(i)$ instead of $x_i$. ```python # Install required packages. !pip install -q torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cu101.html !pip install -q torch-sparse -f https://pytorch-geometric.com/whl/torch-1.8.0+cu101.html !pip install -q torch-geometric ``` ```python # Helper function for visualization. %matplotlib inline import torch import networkx as nx import matplotlib.pyplot as plt import numpy as np from sklearn.metrics.cluster import normalized_mutual_info_score def visualize(h, color, cmap="Set1"): plt.figure(figsize=(7,7)) plt.xticks([]) plt.yticks([]) if torch.is_tensor(h): h = h.detach().cpu().numpy() plt.scatter(h[:, 0], h[:, 1], s=140, c=color, cmap=cmap) [m0,m1] = np.median(h,axis=0) [min0, min1] = np.min(h,axis=0) [max0, max1] = np.max(h,axis=0) plt.vlines(m0,min1,max1) plt.hlines(m1,min0,max0) for i in range(h.shape[0]): plt.text(h[i,0], h[i,1], str(i)) else: nx.draw_networkx(G, pos=nx.spring_layout(G, seed=42), with_labels=True, node_color=color, cmap=cmap) plt.show() ``` ## Community detection in the Karate Club We'll start with an unsupervised problem: given one graph, find a partition of its node in communities. In this case, we make the hypothesis that individuals tend to associate and bond with similar others, which is known as [homophily](https://en.wikipedia.org/wiki/Homophily). To study this problem, we will focus on the [Zachary's karate club](https://en.wikipedia.org/wiki/Zachary%27s_karate_club) and try to recover the split of the club from the graph of connections. The [pytorch-geometric](https://pytorch-geometric.readthedocs.io/en/latest/#) library will be very convenient. Note that GCN are not appropriate in an unsupervised setting as no learning is possible without any label on the vertices. However, this is not a problem here as we will not train the GCN! In more practical settings, GCN are used in a semi-supervised setting where a few labels are revealed for a few nodes (more on this in the section with the Cora dataset). ```python from torch_geometric.datasets import KarateClub dataset = KarateClub() print(f'Dataset: {dataset}:') print('======================') print(f'Number of graphs: {len(dataset)}') print(f'Number of features: {dataset.num_features}') print(f'Number of classes: {dataset.num_classes}') ``` As shown above, the default number of classes (i.e. subgroups) in pytorch-geometric is 4, for simplicity, we'll focus on a partition in two groups only: ```python data = dataset[0] biclasses = [int(b) for b in ((data.y == data.y[0]) + (data.y==data.y[5]))] ``` We will use [networkx](https://networkx.org/) for drawing the graph. On the picture below, the color of each node is given by its "true" class. ```python from torch_geometric.utils import to_networkx G = to_networkx(data, to_undirected=True) visualize(G, color=biclasses) ``` ```python def acc(predicitions, classes): n_tot = len(classes) acc = np.sum([int(pred)==cla for pred,cla in zip(predicitions,classes)]) return max(acc, n_tot-acc), n_tot ``` The [Kernighan Lin algorithm](https://en.wikipedia.org/wiki/Kernighan%E2%80%93Lin_algorithm) is a heuristic algorithm for finding partitions of graphs and the results below show that it captures well our homophily assumption. Indeed the algorithm tries to minimize the number of crossing edges between the 2 communities. ```python c1,c2 = nx.algorithms.community.kernighan_lin_bisection(G) classes_kl = [0 if i in c1 else 1 for i in range(34)] visualize(G, color=classes_kl, cmap="Set2") ``` ```python acc(classes_kl, biclasses) ``` ```python n_simu = 1000 all_acc = np.zeros(n_simu) for i in range(n_simu): c1,c2 = nx.algorithms.community.kernighan_lin_bisection(G) classes_kl = [0 if i in c1 else 1 for i in range(34)] all_acc[i],_ = acc(classes_kl, biclasses) ``` The algorithm is not deterministic but performs poorly only a small fractions of the trials as shown below: ```python bin_list = range(17,35) _ = plt.hist(all_acc, bins=bin_list,rwidth=0.8) ``` ## Inductive bias for GCN To demonstrate the inductive bias for the GCN architecture, we consider a simple GCN with 3 layers and look at its performance without any training. To be more precise, the GCN takes as input the graph and outputs a vector $(x_i,y_i)\in \mathbb{R}^2$ for each node $i$. ```python import torch from torch.nn import Linear from torch_geometric.nn import GCNConv import torch.nn.functional as F class GCN(torch.nn.Module): def __init__(self): super(GCN, self).__init__() self.conv1 = GCNConv(data.num_nodes, 4)# no feature... self.conv2 = GCNConv(4, 4) self.conv3 = GCNConv(4, 2) def forward(self, x, edge_index): h = self.conv1(x, edge_index) h = h.tanh() h = self.conv2(h, edge_index) h = h.tanh() h = self.conv3(h, edge_index) return h torch.manual_seed(12345) model = GCN() print(model) ``` Below, we draw all the points $(x_i,y_i)$ for all nodes $i$ of the graph. The vertical and horizontal lines are the medians of the $x_i$'s and $y_i$'s respectively. The colors are the true classes. We see that __without any learning__ the points are almost separated in the lower-left and upper-right corners according to their community! ```python h = model(data.x, data.edge_index) visualize(h, color=biclasses) ``` ```python def color_from_vec(vec,m=None): if torch.is_tensor(vec): vec = vec.detach().cpu().numpy() if not(m): m = np.median(vec,axis=0) return np.array(vec < m) ``` Note that by drawing the medians above, we enforce a balanced partition of the graph. Below, we draw the original graph where the color for node $i$ depends if $x_i$ is larger or smaller than the median. ```python color_out = color_from_vec(h[:,0]) visualize(G, color=color_out, cmap="Set2") ``` We made only a few errors without any training! ```python acc(color_out,biclasses) ``` Our result might depend on the particular initialization, so we run a few more experiments below: ```python all_acc = np.zeros(n_simu) for i in range(n_simu): model = GCN() h = model(data.x, data.edge_index) color_out = color_from_vec(h[:,0]) all_acc[i],_ = acc(color_out,biclasses) ``` ```python _ = plt.hist(all_acc, bins=bin_list,rwidth=0.8) ``` ```python np.mean(all_acc) ``` We see that on average, we have an accuracy over $24/34$ which is much better than chance! We now explain why the GCN architecture with random initialization achieves such good results. ## Spectral analysis of GCN We start by rewriting the equation \eqref{eq:gcn_layer} in matrix form: $$ h^{(\ell+1)} = S h^{(\ell)}W^{(\ell)} , $$ where the scaled adjacency matrix $S\in\mathbb{R}^{n\times n}$ is defined by $S_{ij} = \frac{1}{\sqrt{(d_i+1)(d_j+1)}}$ if $i\sim j$ or $i=j$ and $S_{ij}=0$ otherwise and $h^{(\ell)}\in \mathbb{R}^{n\times f^{(\ell)}}$ is the embedding representation of the nodes at layer $\ell$ and $W^{(\ell)}$ is the learnable weight matrix in $\mathbb{R}^{f^{(\ell)}\times f^{(\ell+1)}}$. To simplify, we now ignore the $tanh$ non-linearities in our GCN above so that we get $$ y = S^3 W^{(1)}W^{(2)}W^{(3)}, $$ where $W^{(1)}\in \mathbb{R}^{n,4}$, $W^{(2)}\in \mathbb{R}^{4,4}$ and $W^{(3)}\in \mathbb{R}^{4,2}$ and $y\in \mathbb{R}^{n\times 2}$ is the output of the network (note that `data.x` is the identity matrix here). The vector $W^{(1)}W^{(2)}W^{(3)}\in \mathbb{R}^{n\times 2}$ is a random vector with no particular structure so that to understand the inductive bias of our GCN, we need to understand the action of the matrix $S^3$. The matrix $S$ is symmetric with eigenvalues $\nu_1\geq \nu_2\geq ...$ and associated eigenvectors $U_1,U_2,...$ We can show that indeed $1=\nu_1>\nu_2\geq ...\geq \nu_n\geq -1$ by applying Perron-Frobenius theorem. This is illustrated below. ```python from numpy import linalg as LA A = nx.adjacency_matrix(G).todense() A_l = A + np.eye(A.shape[0],dtype=int) deg_l = np.dot(A_l,np.ones(A.shape[0])) scaling = np.dot(np.transpose(1/np.sqrt(deg_l)),(1/np.sqrt(deg_l))) S = np.multiply(scaling,A_l) eigen_values, eigen_vectors = LA.eigh(S) _ = plt.hist(eigen_values, bins = 40) ``` But the most interesting fact for us here concerns the eigenvector $U_2$ associated with the second largest eigenvalues which is also known as the [Fiedler vector](https://en.wikipedia.org/wiki/Algebraic_connectivity). A first result due to Fiedler tells us that the subgraph induced by $G$ on vertices with $U_2(i)\geq 0$ is connected. This is known as Fiedler’s Nodal Domain Theorem (see Chapter 24 in [Spectral and Algebraic Graph Theory](http://cs-www.cs.yale.edu/homes/spielman/sagt/) by Daniel Spielman). We check this fact below both on $U_2$ and $-U_2$ so that here we get a partition of our graph in 2 connected graphs (since we do not have any node $i$ with $U_2(i)=0$). ```python fiedler = np.array(eigen_vectors[:,-2]).squeeze() H1 = G.subgraph([i for (i,f) in enumerate(fiedler) if f>=0]) H2 = G.subgraph([i for (i,f) in enumerate(fiedler) if -f>=0]) H = nx.union(H1,H2) plt.figure(figsize=(7,7)) plt.xticks([]) plt.yticks([]) nx.draw_networkx(H, pos=nx.spring_layout(G, seed=42), with_labels=True) ``` There are many possible partitions of our graph in 2 connected graphs and we see here that the Fiedler vector actually gives a very particular partition corresponding almost exactly to the true communities! ```python visualize(G, color=[fiedler>=0], cmap="Set2") ``` There are actually very few errors made by Fiedler's vector. Another way to see the performance of the Fiedler's vector is to sort its entries and color each dot with its community label as done below: ```python fiedler_c = np.sort([biclasses,fiedler], axis=1) fiedler_1 = [v for (c,v) in np.transpose(fiedler_c) if c==1] l1 = len(fiedler_1) fiedler_0 = [v for (c,v) in np.transpose(fiedler_c) if c==0] l0 = len(fiedler_0) plt.plot(range(l0),fiedler_0,'o',color='red') plt.plot(range(l0,l1+l0),fiedler_1,'o',color='grey') plt.plot([0]*35); ``` To understand why the partition of Fiedler's vector is so good requires a bit of calculus. To simplify a bit, we will make a small modification about the matrix $S$ and define it to be $S_{ij} = \frac{1}{\sqrt{d_i d_j}}$ if $i\sim j$ or $i=j$ and $S_{ij}=0$ otherwise. Define the (normalized) Laplacian $L=Id-S$ so that the eigenvalues of $L$ are $\lambda_i=1-\nu_i$ associated with the same eigenvector $U_i$ as for $S$. We also define the combinatorial [Laplacian](https://en.wikipedia.org/wiki/Laplacian_matrix) $L^* = D-A$. We then have \begin{equation} \frac{x^TLx}{x^Tx} = \frac{x^TD^{-1/2}L^* D^{-1/2}x}{x^Tx}\\ = \frac{y^T L^* y}{y^TDy}, \end{equation} where $y = D^{-1/2}x$. In particular, we get: \begin{equation} \lambda_2 = 1-\nu_2 = \min_{x\perp U_1}\frac{x^TLx}{x^Tx}\\ = \min_{y\perp d} \frac{y^T L^* y}{y^TDy}, \end{equation} where $d$ is the vector of degrees. Rewriting this last equation, we obtain \begin{equation} \label{eq:minlambda}\lambda_2 = \min \frac{\sum_{i\sim j}\left(y(i)-y(j)\right)^2}{\sum_i d_i y(i)^2}, \end{equation} where the minimum is taken over vector $y$ such that $\sum_i d_i y_i =0$. Now if $y^*$ is a vector achieving the minimum then we get the Fiedler vector (up to a sign) by $U_2 = \frac{D^{1/2}y^*}{\|D^{1/2}y^*\|}$. In particular, we see that the sign of the elements of $U_2$ are the same as the elements of $y^*$. To get an intuition about \eqref{eq:minlambda}, consider the same minimization but with the constraint that $y(i) \in \{-1,1\}$ with the meaning that if $y(i)=1$, then node $i$ is in community $0$ and if $y(i)=-1$ then node $i$ is in community $1$. In this case, we see that the numerator $\sum_{i\sim j}\left(y(i)-y(j)\right)^2$ is the number of edges between the two communities multiplied by 4 and the denominator $\sum_i d_i y(i)^2$ is twice the total number of edges in the graph. Hence the minimization problem is now a combinatorial problem asking for a graph partition $(P_1,P_2)$ of the graph under the constraint that $\sum_{i\in P_1}d_i= \sum_{j\in P_2} d_j$. This last condition is simply saying that the number of edges in the graph induced by $G$ on $P_1$ should be the same as the number of edges in the graph induced by $G$ on $P_2$ (note that this condition might not have a solution). Hence the minimization problem defining $y^*$ in \eqref{eq:minlambda} can be seen as a relaxation of this [bisection problem](https://en.wikipedia.org/wiki/Graph_partition#Spectral_partitioning_and_spectral_bisection). We can then expect the Fiedler vector to be close to $y^*$ at least the signs of its elements which would explain that the partition obtained thanks to the Fiedler vector is balanced and with a small cut, corresponding exactly to our goal here. So now that we understand the Fiedler vector, we are ready to go back toi GCN. First, we check that the small simplification we made (removing non-linearities...) are really unimportant: ```python torch.manual_seed(12345) model = GCN() W1 = model.conv1.weight.detach().numpy() W2 = model.conv2.weight.detach().numpy() W3 = model.conv3.weight.detach().numpy() iteration = S**3*W1*W2*W3 visualize(torch.tensor(iteration), color=biclasses) ``` OK, we get the same embedding as with the untrained network but we now have a simpler math formula for the output: $$ [Y_1,Y_2] = S^3 [R_1, R_2], $$ where $R_1,R_2$ are $\mathbb{R}^n$ random vectors and $Y_1, Y_2$ are the output vectors in $\mathbb{R}^n$ used to do the scatter plot above. But we can rewrite $S = \sum_{i}\nu_i U_i U_i^T$ so that we get $S^3 = \sum_{i}\nu_i^3 U_i U_i^T \approx U_1U_1^T + \nu_2^3 U_2U_2^T$ because all others $\nu_i<< \nu_2^3$. Hence, we get \begin{equation} Y_1 \approx U_1^T R_1 U_1 + \nu_2^3 U_2^T R_1 U_2 \\ Y_2 \approx U_1^T R_2 U_1 + \nu_2^3 U_2^T R_2 U_2 \end{equation} Recall that the signal about the communities is in the $U_2$ vector so that we can rewrite it more explicitly as \begin{equation} Y_1(i) \approx a_1 + b_1 U_2(i)\\ Y_2(i) \approx a_2 + b_2 U_2(i), \end{equation} where $a_1,a_2,b_1,b_2$ are random numbers of the same magnitude. In other words, the points $(Y_1(i), Y_2(i))$ should be approximately aligned on a line and the two extremes of the corresponding segment correspond to the 2 communities $U_2(i)\geq 0$ or $U_2(i)\leq 0$. ```python from sklearn import linear_model from sklearn.metrics import mean_squared_error regr = linear_model.LinearRegression() regr.fit(iteration[:,0].reshape(-1, 1), iteration[:,1]) plt.figure(figsize=(7,7)) plt.xticks([]) plt.yticks([]) h = np.array(iteration) plt.scatter(h[:, 0], h[:, 1], s=140, c=biclasses, cmap="Set1") plt.plot(h[:, 0],regr.predict(iteration[:,0].reshape(-1, 1))) ``` ```python def glorot_normal(in_c,out_c): sigma = np.sqrt(2/(in_c+out_c)) return sigma*np.random.randn(in_c,out_c) ``` ```python coef = np.zeros(n_simu) base = np.zeros(n_simu) for i in range(n_simu): iteration = glorot_normal(34,4)@glorot_normal(4,4)@glorot_normal(4,2) regr.fit(iteration[:,0].reshape(-1, 1), iteration[:,1]) base[i] = mean_squared_error(iteration[:,1],regr.predict(iteration[:,0].reshape(-1, 1))) iteration = np.array(S**3) @ iteration regr.fit(iteration[:,0].reshape(-1, 1), iteration[:,1]) coef[i] = mean_squared_error(iteration[:,1],regr.predict(iteration[:,0].reshape(-1, 1))) ``` Below, we run a few simulations and compute the mean squared error between the points and the best interpolating line for the random input $[R_1,R_2]$ in blue and for the output $[Y_1, Y_2]$ in orange (that you can hardly see because the error is much smaller). Our theory seems to be nicely validated ;-) ```python _ = plt.hist(base, bins = 34) _ = plt.hist(coef, bins = 34) ``` Here we studied a very simple case but more general statements are possible as we will see in a subsequent post. To generalize the analysis made about Fiedler vector requires a little bit of spectral graph theory as explained in the module on spectral Graph Neural Networks, see [Deep Learning on graphs (2)](https://dataflowr.github.io/website/modules/graph2/) Follow on [twitter](https://twitter.com/marc_lelarge)! ## Thanks for reading!
$$ \LaTeX \text{ command declarations here.} \newcommand{\R}{\mathbb{R}} \renewcommand{\vec}[1]{\mathbf{#1}} \newcommand{\X}{\mathcal{X}} \newcommand{\D}{\mathcal{D}} \newcommand{\G}{\mathcal{G}} \newcommand{\L}{\mathcal{L}} \newcommand{\X}{\mathcal{X}} \newcommand{\Parents}{\mathrm{Parents}} \newcommand{\NonDesc}{\mathrm{NonDesc}} \newcommand{\I}{\mathcal{I}} \newcommand{\dsep}{\text{d-sep}} \newcommand{\Cat}{\mathrm{Categorical}} \newcommand{\Bin}{\mathrm{Binomial}} $$ # HMMs and the Forward Backward Algorithm ## Derivations Let's start by deriving the forward and backward algorithms from lecture. It's really important you understand how the recursion comes into play. We covered it in lecture, please try not to cheat during this exercise, you won't get anything out of it if you don't try! ### Review Recall that a Hidden Markov Model (HMM) is a particular factorization of a joint distribution representing noisy observations $X_k$ generated from *discrete* hidden Markov chain $Z_k$. $$ P(\vec{X}, \vec{Z}) = P(Z_1) P(X_1 \mid Z_1) \prod_{k=2}^T P(Z_k \mid Z_{k-1}) P(X_k \mid Z_k) $$ and as a bayesian network: ### HMM: Parameters For a Hidden Markov Model with $N$ hidden states and $M$ observed states, there are three *row-stochastic* parameters $\theta=(A,B,\pi)$, - Transition matrix $A \in \R^{N \times N}$ $$ A_{ij} = p(Z_t = j | Z_{t-1} = i) $$ - Emission matrix $B \in \R^{N \times M}$ $$ B_{jk} = p(X_t = k | Z_t = j) $$ - Initial distribution $\pi \in \R^N$, $$ \pi_j = p(Z_1 = j) $$ ### HMM: Filtering Problem **Filtering** means to compute the current *belief state* $p(z_t | x_1, \dots, x_t,\theta)$. $$ p(z_t | x_1,\dots,x_t) = \frac{p(x_1,\dots,x_t,z_t)}{p(x_1,\dots,x_t)} $$ - Given observations $x_{1:t}$ so far, infer $z_t$. > Solved by the **forward algorithm**. ## How do we infer values of hidden variables? - One of the most challenging part of HMMs is to try to "predict" what are the values of the hidden variables $z_t$, having observed all the $x_1, \ldots, x_T$. - Computing $p(z_t \mid \X)$ is known on *smoothing*. More on this soon. - But it turns out that this probability can be computed from two other quantities: - $p(x_1,\dots,x_t,z_t)$, which we are going to label $\alpha_t(z_t)$ - $p(x_{t+1},\dots,x_{T} | z_t)$, which we are going to label $\beta_t(z_t)$ ### Problem: Derive the Forward Algorithm The **forward algorithm** computes $\alpha_t(z_t) \equiv p(x_1,\dots,x_t,z_t)$. The challenge is to frame this in terms of $\alpha_{t-1}(z_{t-1})$. We'll get you started by marginalizing over "one step back". You need to fill in the rest! $$ \begin{align} \alpha_t(z_t) &= \sum_{z_{t-1}} p(x_1, \dots, x_t, z_{t-1}, z_t) \\ \dots \\ &= B_{z_t,x_t} \sum_{z_{t-1}} \alpha_{t-1}(z_{t-1}) A_{z_{t-1}, z_t} \end{align} $$ Hints: 1. You are trying to pull out $\alpha_{t-1}(z_{t-1}) = p(x_1, \dots, x_{k-1}, z_{t-1})$ Can you factor out $p(x_k)$ and $p(z_k)$ using bayes theorem ($P(A,B) = P(A|B)P(B)$)? 2. Once you do, conditional independence (look for d-separation!) should help simplify ### Problem: Derive the Backward Algorithm The **backward algorithm** computes $\beta_t(z_t) \equiv p(x_{t+1},\dots,x_{T} | z_t)$ $$ \begin{align} \beta(z_t) &= \sum_{z_{t+1}} p(x_{t+1},\dots,x_{T},z_{t+1} | z_t) \\ \dots \\ &= \sum_{z_{t+1}} A_{z_t, z_{t+1}} B_{z_{t+1}, x_{t+1}} \beta_{t+1}(z_{t+1}) \end{align} $$ Similar to deriving the forward algorithm, we've gotten you started by marginalizing over "one step forward". Use applications of bayes rule $P(A,B) = P(A|B)P(B)$ and simplifications from conditional independence to get the rest of the way there. ## Code example: part of speech tagger Now that we're comfortable with the theory behind the forward and backward algorithm, let's set up a real example and implement both procedures. In this example, we observe a sequence of words backed by a latent part of speech variable. $X$: discrete distribution over bag of words $Z$: discrete distribution over parts of speech $A$: the probability of a part of speech given a previous part of speech, e.g, what do we expect to see after a noun? $B$: the distribution of words given a particular part of speech, e.g, what words are we likely to see if we know it is a verb? $x_{i}s$ a sequence of observed words (a sentence). Note: in for both variables we have a special "end" outcome that signals the end of a sentence. This makes sense as a part of speech tagger would like to have a sense of sentence boundaries. ```python import numpy as np parts_of_speech = DETERMINER, NOUN, VERB, END = 0, 1, 2, 3 words = THE, DOG, WALKED, IN, PARK, END = 0, 1, 2, 3, 4, 5 # transition probabilities A = np.array([ # D N V E [0.1, 0.8, 0.1, 0.0], # D: determiner most likely to go to noun [0.1, 0.1, 0.6, 0.2], # N: noun most likely to go to verb [0.4, 0.3, 0.2, 0.1], # V [0.0, 0.0, 0.0, 1.0]]) # E: end always goes to end # distribution of parts of speech for the first word of a sentence pi = np.array([0.4, 0.3, 0.3, 0.0]) # emission probabilities B = np.array([ # D N V E [ 0.8, 0.1, 0.1, 0. ], # the [ 0.1, 0.8, 0.1, 0. ], # dog [ 0. , 0. , 1. , 0. ], # walked [ 1. , 0. , 0. , 0. ], # in [ 0. , 0.1, 0.9, 0. ], # park [ 0. , 0. , 0. , 1. ]]) # end ``` ### Problem: Implement the Forward Algorithm Now it's time to put it all together. We create a table to hold the results and build them up from the front to back. Along with the results, we return the marginal probability that can be compared with the backward algorithm's below. ```python import numpy as np np.set_printoptions(suppress=True) def forward(params, observations): pi, A, B = params N = len(observations) S = pi.shape[0] alpha = np.zeros((N, S)) # base case # p(z1) * p(x1|z1) alpha[0, :] = pi * B[observations[0], :] # recursive case - YOUR CODE GOES HERE return (alpha, np.sum(alpha[N-1,:])) forward((pi, A, B), [THE, DOG, WALKED, IN, THE, PARK, END]) ``` (array([[ 0.32, 0.03, 0.03, 0. ], [ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ]]), 0.0) ### Problem: Implement the Backward Algorithm If you implemented both correctly, the second return value (the marginals) from each method should match. ```python def backward(params, observations): pi, A, B = params N = len(observations) S = pi.shape[0] beta = np.zeros((N, S)) # base case beta[N-1, :] = 1 # recursive case -- YOUR CODE GOES HERE! return (beta, np.sum(pi * B[observations[0], :] * beta[0,:])) backward((pi, A, B), [THE, DOG, WALKED, IN, THE, PARK, END]) ``` (array([[ 0., 0., 0., 0.], [ 0., 0., 0., 0.], [ 0., 0., 0., 0.], [ 0., 0., 0., 0.], [ 0., 0., 0., 0.], [ 0., 0., 0., 0.], [ 1., 1., 1., 1.]]), 0.0)
\name{generate_fit_only} \alias{generate_fit_only} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Simulating networks from the Caldarelli model} \description{ This function generates networks from the Caldarelli model. In this model, the preferential attachment function is constant, i.e. \eqn{A_k = 1}, and node fitnesses are sampled from some probability distribution. } \usage{ generate_fit_only(N = 1000 , num_seed = 2 , multiple_node = 1 , m = 1 , mode_f = "gamma", s = 10 ) } %- maybe also 'usage' for other objects documented here. \arguments{ The parameters can be divided into two groups. The first group specifies basic properties of the network: \item{N}{ Integer. Total number of nodes in the network (including the nodes in the seed graph). Default value is \code{1000}. } \item{num_seed}{ Integer. The number of nodes of the seed graph (the initial state of the network). The seed graph is a cycle. Default value is \code{2}. } \item{multiple_node}{ Positive integer. The number of new nodes at each time-step. Default value is \code{1}. } \item{m}{ Positive integer. The number of edges of each new node. Default value is \code{1}. } The final group of parameters specifies the distribution from which node fitnesses are generated: \item{mode_f}{ String. Possible values:\code{"gamma"}, \code{"log_normal"} or \code{"power_law"}. This parameter indicates the true distribution for node fitness. \code{"gamma"} = gamma distribution, \code{"log_normal"} = log-normal distribution. \code{"power_law"} = power-law (pareto) distribution. Default value is "gamma". } \item{s}{ Non-negative numeric. The inverse variance parameter. The mean of the distribution is kept at \eqn{1} and the variance is \eqn{1/s} (since node fitnesses are only meaningful up to scale). This is achieved by setting shape and rate parameters of the Gamma distribution to \eqn{s}; setting mean and standard deviation in log-scale of the log-normal distribution to \eqn{-1/2*log (1/s + 1)} and \eqn{(log (1/s + 1))^{0.5}}; and setting shape and scale parameters of the pareto distribution to \eqn{(s+1)^{0.5} + 1} and \eqn{(s+1)^{0.5}/((s+1)^{0.5} + 1)}. If \code{s} is \code{0}, all node fitnesses \eqn{\eta} are fixed at \code{1} (i.e., \enc{Barabási}{Barabasi}-Albert model). The default value is \code{10}. } } \value{ The output is a \code{PAFit_net} object, which is a List contains the following four fields: \item{graph}{a three-column matrix, where each row contains information of one edge, in the form of \code{(from_id, to_id, time_stamp)}. \code{from_id} is the id of the source, \code{to_id} is the id of the destination.} \item{type}{a string indicates whether the network is \code{"directed"} or \code{"undirected"}.} \item{PA}{a numeric vector contains the true PA function.} \item{fitness}{fitness values of nodes in the network. The name of each value is the ID of the node.} } \author{ Thong Pham \email{[email protected]} } \references{ 1. Caldarelli, G., Capocci, A. , De Los Rios, P. & \enc{Muñoz}{Munoz}, M.A. (2002). Scale-Free Networks from Varying Vertex Intrinsic Fitness. Phys. Rev. Lett., 89, 258702 (\url{http://link.aps.org/doi/10.1103/PhysRevLett.89.258702}). } \seealso{ For subsequent estimation procedures, see \code{\link{get_statistics}}. For other functions to generate networks, see \code{\link{generate_net}}, \code{\link{generate_BA}}, \code{\link{generate_ER}} and \code{\link{generate_BB}}. } \examples{ library("PAFit") # generate a network from the Caldarelli model with alpha = 1, N = 100, m = 1 # the inverse variance of distribution of node fitnesses is s = 10 net <- generate_fit_only(N = 100,m = 1,mode = 1, s = 10) str(net) plot(net) } % Add one or more standard keywords, see file 'KEYWORDS' in the % R documentation directory. \concept{ fitness model }% __ONLY ONE__ keyword per line
[STATEMENT] lemma uminus_aform_float: "uminus_aform (aa, bb) = (a, b) \<Longrightarrow> aa \<in> float \<Longrightarrow> a \<in> float" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>uminus_aform (aa, bb) = (a, b); aa \<in> float\<rbrakk> \<Longrightarrow> a \<in> float [PROOF STEP] by (auto simp: uminus_aform_def)
module ConvHMM using BSON using ExpFamilyDistributions using LinearAlgebra using PaddedViews using MarkovModels export Regressors1D include("regressor.jl") export ARNormal1D export ARNormal1DSet export DARNormal1D export accstats_λ export accstats_ξ export accstats_h export elbo export loglikelihood export predict export save export update_λ! export update_h! include("arnormal.jl") include("darnormal.jl") end
! ! CalculiX - A 3-dimensional finite element program ! Copyright (C) 1998-2020 Guido Dhondt ! ! 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 2); ! ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! C C 1.TASK INTERPOLATION OF A TWO DIMENSIONAL FUNCTION DEFINED POINT BY POINT C ********* THE X COORDINATES ARE USER SPECIFIED. c THE INTERPOLATION TYPE CAN BE INDEPENDANTLY CHOSEN IN THE TWO DIRECTIONS C EITHER CONSTANT, LINEAR OR DOUBLE QUADRATIC. C BEYOND THE FIELD OF INTERPOLATION AN EXTRAOLATION IS CARRIED OUT. C FOR ALL FOUR EXTRAPOLATION DIRECTIONS DIFFERENT EXTRAPOLATION METHOD C (C ONSTANT,LINEAR,QUADRATIC) CAN BE CHOSEN, WHICH ORDER MUST NOT BE HIGHER C THAN THE IONTERPOLATION ORDER C C 2.UP-AUFRUF CALL TWODINT(T,LSP,IART,XA,YA,ZA,NA,IEXP,IER) C *********** T = MATRIX OF THE SAMPLE POINTS FORMATED AS FOLLOW C T(1,1) = NX + NY * 0.001 C NX = NUMBER OF LINES T C NY = NUMBER OF COLUMNS T C T(1,2) ... T(1,NY) C VECTOR OF THE Y COORDINATES OF THE T MATRIX C T(2,1) ... T(NX,1) C VECTOR OF THE X COORDINATES OF THE T MATRIX C REST OF T-MATRIX: C POINT(X,Y) OF THE T MATRIX C C LSP = COLUMN STEPOF T C IART = TYPE OF INTERPOLATION C IART = INTX * 10 + INTY C INTX INTERPOLATION TYPE IN X-DIRECTION C INTY INTERPOLATION TYPE IN Y-DIRECTION C XA = VECTOR OF THE X COORDINATES OF THE VALUE TO BE INTERPOLATED C YA = VECTOR OF THE Y COORDINATES OF THE VALUE TO BE INTERPOLATED C ZA = VECTOR OF THE INTERPOLATED VALUES C NA = ACTUAL LENGTH OF THE 3 PREVIOUS VECTORS C IEXP = TWO ELEMENT VECTOR CONTRAINING THE TYPE OF EXTRAPOLATION C CHOSEN BEYOND THE INTERPOLATION DOMAIN C IEXP(1): EXTRAPOLATION IN X-DIRECTION C IEXP(1) = IEXPX1 * 10 + IEXPXN C IEXPX1: EXTRAPOLATION BENEATH THE FIRST POINT C IEXPXN: EXTRAPOLATION BEYOND THE LAST POINT C IEXP(2): EXTRAPOLATION IN Y-DIRECTION C IEXP(2) = IEXPY1 * 10 + IEXPYN C SAME METHOD AS FOR IEXP(1): C IER = ERROR CODE C IER = 0: NORMAL PROCEEDING C IER = -1: ERROR INPUTDATA C C REMARK: CHOICE OF THE INTER- EXTRAPOLATION TYPE IART AND IEXP - C -------- ASSIGNEMENT OF INTX,INTY,IEXPX1, C IEXPXN,IEXPY1,IEXPYN: C = 0 : CONSTANT C = 1 : LINEAR C = 2 : DOUBLE QUADRATIC FROM C THE SECOND UNTIL PENULTIMATE C INTERVAL IN THE INTERPOLATION MATRIX T,OTHERWISE QUADRATIC C C 3.RESTRICTIONS THE SAMPLING POINT VECTORS (X UND Y COORDINATES C *************** OF THE MATRICX T MUST BE STRICTLY MONOTONIC INCREASING SORTED C THE PARAMETER FOR THE TYPE OF EXTRAPOLATION c MUST NOT BE GREATER THAN THE ONE FOR TH EINTERPOLATION TYPE C OTHERWISE THE VALUE IS AUTOMATICALLY ADAPTATED C IF THE NUMBER OF THE SAMPLING POINTS FOR THE REQUIRED TYPE OF INTERPOLATION IS TOO SMALL, C THE DEGREE OF INTERPOLATION WILL BE ACCORDINGLY ADAPTATED C C 4.USED UP'S ONEDINT (ONE DIMENSIONAL INTERPOLATION ANALOG TO THIS PROGRAMM) C SUBROUTINE TWODINT (T,LSP,IART,XA,YA,ZA,NA,IEXP,IER) implicit none INTEGER IEXP(2),IYU,IYO,IXU,IXO,IDX,IDY,LL,INPY,IEXPX1,IEXPXN, & IEXPY1,IEXPYN,LX,LY,INPX,IART,LSP,IER,NX,NY,L,NA,one REAL*8 T(LSP,1),XA(1),YA(1),ZA(1) REAL*8 Z1(4),Z2(4) C ENTRY ZWEINT (T,LSP,IART,XA,YA,ZA,NA,IEXP,IER) IER = 0 one=1 NX = T(1,1) NY = (T(1,1)-NX)*1000 + 0.1d0 C C TESTING INPUT C-------------- IF ((NX-2).lt.0) then go to 900 elseif((nx-2).eq.0) then go to 30 else go to 10 endif 10 DO 20 L = 3,NX 20 IF ((T(L,1)-T(L-1,1)) .LE. 0) GO TO 900 30 IF ((NY-2).lt.0) then go to 900 elseif((ny-2).eq.0) then go to 60 else go to 40 endif 40 DO 50 L = 3,NY 50 IF ((T(1,L)-T(1,L-1)) .LE. 0) GO TO 900 60 IF (NA .LE. 0) GO TO 900 C C DEFINING THE CONTROL VALUES C--------------------------- INPX = IART/10 INPY = IART - INPX*10 + 0.1d0 IEXPX1 = IEXP(1)/10 IEXPXN = IEXP(1) - IEXPX1*10 IEXPY1 = IEXP(2)/10 IEXPYN = IEXP(2) - IEXPY1*10 IF (NX-2 .LT. INPX) INPX = NX - 2 IF (NY-2 .LT. INPY) INPY = NY - 2 IF (IEXPX1 .GT. INPX) IEXPX1 = INPX IF (IEXPXN .GT. INPX) IEXPXN = INPX IF (IEXPY1 .GT. INPY) IEXPY1 = INPY IF (IEXPYN .GT. INPY) IEXPYN = INPY C C SUCCESSIVE PROCESSING THE INTERPOLATION EXIGENCES C------------------------------------------------------- DO 400 L = 1,NA LX = 2 C C SETTING REFERENCE POINTS (LX,LY) C--------------------------------- 200 IF (XA(L) .LT. T(LX,1)) GO TO 220 LX = LX + 1 IF ((LX-NX).le.0) then go to 200 else go to 210 endif 210 LX = NX 220 DO 230 LY = 2,NY 230 IF (YA(L) .LT. T(1,LY)) GO TO 235 LY = NY 235 IYU = LY - INPY IYO = LY + INPY - 1 IF (IYU .GE. 2) GO TO 240 IYU = 2 IYO = IYU + INPY 240 IF (IYO .GT. NY) IYO = NY IXU = LX - INPX IXO = LX + INPX - 1 IF (IXU .GE. 2) GO TO 245 IXU = 2 IXO = IXU + INPX 245 IF (IXO .GT. NX) IXO = NX IDX = IXO - IXU + 1 IF (IXU .LT. IXO) GO TO 270 IF (IYU .LT. IYO) GO TO 250 C C CONSTANT INTERPOLATION C------------------------ IF (LX .GT. 2 .AND. XA(L) .LT. T(NX,1)) LX = LX - 1 IF (LY .GT. 2 .AND. YA(L) .LT. T(1,NY)) LY = LY - 1 ZA(L) = T(LX,LY) GO TO 400 C C LINEAR AND QUADRATIC INTERPOLATION USING ONEDINT (ONEDIMENSIONAL) C--------------------------------------------------------------------- C C INTERPOLATION ONLY IN Y-DIRECTION C 250 IDY = 0 DO 260 LL = IYU,IYO IDY = IDY + 1 Z1(IDY) = T(1,LL) 260 Z2(IDY) = T(LX,LL) GO TO 300 C C INTERPOLATION ONLY IN X-DIRECTION C 270 IF (IYU .LT. IYO) GO TO 280 CALL ONEDINT(T(IXU,1),T(IXU,LY),IDX,XA(L),ZA(L),one,INPX,IEXP(1), 1 IER) IF (IER.eq.0) then go to 400 else go to 900 endif C C 1.INTERPOLATION STEP IN X-DIRECTION C 280 IDY = 0 DO 290 LL = IYU,IYO IDY = IDY + 1 Z1(IDY) = T(1,LL) CALL ONEDINT (T(IXU,1),T(IXU,LL),IDX,XA(L),Z2(IDY),one,INPX, 1 IEXP(1),IER) IF (IER.eq.0) then go to 290 else go to 900 endif 290 CONTINUE C C 1.OR 2.INTERPOLATION STEP IN Y-DIRECTION C 300 CALL ONEDINT (Z1,Z2,IDY,YA(L),ZA(L),one,INPY,IEXP(2),IER) IF (IER.eq.0) then go to 400 else go to 900 endif C C RETURN BY NORMAL PROCEEDING C-------------------------------- 400 CONTINUE IER = 0 RETURN C C ERROR RETURN C------------- 900 IER = -1 RETURN END
import tactic -- BEGIN variables {α : Type*} [partial_order α] variables a b : α example : a < b ↔ a ≤ b ∧ a ≠ b := begin rw lt_iff_le_not_le, split, intro hl, split, cases hl with hl1 hl2, exact hl1, contrapose! hl, intro h', rw hl, intro hr, cases hr with hr1 hr2, split, exact hr1, contrapose! hr2, exact le_antisymm hr1 hr2, end -- END
[STATEMENT] lemma SA_car_closed: assumes "f \<in> carrier (SA m)" assumes "x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>)" shows "f x \<in> carrier Q\<^sub>p" [PROOF STATE] proof (prove) goal (1 subgoal): 1. f x \<in> carrier Q\<^sub>p [PROOF STEP] using assms SA_car_memE(3) [PROOF STATE] proof (prove) using this: f \<in> carrier (SA m) x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) ?f \<in> carrier (SA ?n) \<Longrightarrow> ?f \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>) \<rightarrow> carrier Q\<^sub>p goal (1 subgoal): 1. f x \<in> carrier Q\<^sub>p [PROOF STEP] by blast
# Derivatives ```python import numpy as np from itertools import product import matplotlib.pylab as plt import scipy.special as spec ``` # Finite difference dispersion There is a one to one corespondence between a finite step derivative and the dispersion of the corresponding momentum operator on the lattice. E.g. for a Laplace finite step derivative of the form $$ \frac{\partial^2}{\partial^2x}f(x) \mapsto \frac{1}{\epsilon^2}\sum_{n=-N_s}^{N_s} c_n^{N_s} f(\epsilon n_x + \epsilon n) \, , x = \epsilon n_x \, , $$ where $\epsilon$ is the lattice spacing, corresponds to the momentum dispersion $$ p^2 \mapsto D^{N_s}(p) = - \frac{1}{\epsilon^2}\sum_{n=-N_s}^{N_s} c_n^{N_s} \cos(n p \epsilon) \, . $$ In general, one wants to identify the coefficients $c_n^{N_s}$ such that $D^{N_s}(p) = p^2 + \mathcal O \left( (\epsilon p)^{2 N_s} \right)$. If one now expands $$ \cos(n p \epsilon) = \sum_{m=0}^\infty \frac{(-)^m}{(2m)!} (n p \epsilon)^{2m}\, , $$ one finds that the coefficients $c_n$ are determined by the liner equation \begin{align} v_m &= \sum_{n=0}^{N_s} A_{m n} \gamma_n \, , & A_{mn} &= \frac{(-)^m}{(2m)!} n^{2m} \, , \\ v_1 &= 1 \, , & v_m &= 0 \, \forall \, m \neq 1 \\ c_0 &= - \gamma_0 \, , & c_{\pm n} &= - \frac{\gamma_n}{2} \, \forall \, n > 0 \end{align} where $n$ and $m$ run from $0$ to $N_s$. ```python def derivative_coeffs(Nstep: int): """Computes the derivative coefficient for the lapace operator up to step range Nstep. The dispersion of the related momentum squared operator is equal to p**2 up to order P**(2*NStep). **Arguments** Nstep: int The number of momentum steps in each direction. """ v = np.zeros(Nstep + 1) v[1] = 1 nn, mm = np.meshgrid(*[np.arange(Nstep + 1)] * 2) A = 1 / spec.gamma(2 * mm + 1) * (-1) ** mm * nn ** (2 * mm) gamma = np.linalg.solve(A, v) coeffs = {} for nstep, coeff in enumerate(gamma): if nstep == 0: coeffs[nstep] = -coeff else: coeffs[+nstep] = -coeff / 2 coeffs[-nstep] = -coeff / 2 return coeffs ``` ```python fig, ax = plt.subplots(figsize=(3, 2), dpi=250) p = np.linspace(-1, 1, 1000) for nstep in range(2, 10, 2): coeffs = derivative_coeffs(nstep) Dp = np.sum([-cn * np.cos(n * p) for n, cn in coeffs.items()], axis=0) ax.plot(p, p ** 2 - Dp, label=f"$D^{{({nstep})}}(p)$", lw=1) ax.legend(fontsize=6, frameon=False) ax.set_xlabel("$p$") ax.set_ylabel("$p^2 - D(p)$") ax.set_yscale("log") ax.set_ylim(1.0e-12, 1) plt.show(fig) ``` ```python fig, ax = plt.subplots(figsize=(3, 2), dpi=250) p = np.linspace(-1, 1, 1000) for nstep in range(10, 30, 5): coeffs = derivative_coeffs(nstep) nrange = np.array(list(coeffs.keys())) crange = np.array(list(coeffs.values())) inds = np.argsort(nrange) ax.plot(nrange[inds], np.abs(crange[inds]), label=f"$N_s = {nstep}$", ls="-", marker=".", ms=1, lw=1) ax.legend(fontsize=6, frameon=False) ax.set_xlabel("$p$") ax.set_ylabel("$|c_n|$") ax.set_yscale("log") plt.show(fig) ``` ```python ```
{-# OPTIONS --safe #-} module Cubical.Algebra.CommSemiring.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.SIP using (TypeWithStr) open import Cubical.Algebra.CommMonoid open import Cubical.Algebra.Monoid private variable ℓ ℓ' : Level record IsCommSemiring {R : Type ℓ} (0r 1r : R) (_+_ _·_ : R → R → R) : Type ℓ where field +IsCommMonoid : IsCommMonoid 0r _+_ ·IsCommMonoid : IsCommMonoid 1r _·_ ·LDist+ : (x y z : R) → x · (y + z) ≡ (x · y) + (x · z) AnnihilL : (x : R) → 0r · x ≡ 0r open IsCommMonoid +IsCommMonoid public renaming ( isSemigroup to +IsSemigroup ; isMonoid to +IsMonoid) open IsCommMonoid ·IsCommMonoid public renaming ( isSemigroup to ·IsSemigroup ; isMonoid to ·IsMonoid) hiding ( is-set ) -- We only want to export one proof of this record CommSemiringStr (A : Type ℓ) : Type (ℓ-suc ℓ) where field 0r : A 1r : A _+_ : A → A → A _·_ : A → A → A isCommSemiring : IsCommSemiring 0r 1r _+_ _·_ infixl 7 _·_ infixl 6 _+_ open IsCommSemiring isCommSemiring public CommSemiring : ∀ ℓ → Type (ℓ-suc ℓ) CommSemiring ℓ = TypeWithStr ℓ CommSemiringStr
State Before: α : Type u_1 β : Type ?u.14060 γ : Type ?u.14063 inst✝² : BooleanRing α inst✝¹ : BooleanRing β inst✝ : BooleanRing γ a b : α ⊢ a + a * b + a * (a * b) = a State After: no goals Tactic: rw [← mul_assoc, mul_self, add_assoc, add_self, add_zero]
# https://en.wikipedia.org/wiki/Finite_difference Three forms are commonly considered: forward, backward, and central differences.[1][2][3] A forward difference is an expression of the form $$ \displaystyle \Delta _{h}[f](x)=f(x+\Delta x)-f(x).$$ Depending on the application, the spacing h may be variable or constant. When omitted, $\Delta x=h$ is taken to be 1: Δ[ f ](x) = Δ1[ f ](x). A backward difference uses the function values at x and x − \Delta, instead of the values at x + \Delta and x: $$ \displaystyle \nabla _{h}[f](x)=f(x)-f(x-\Delta x).$$ Finally, the central difference is given by $$\displaystyle \delta _{h}[f](x) = f\left(x+{\tfrac {1}{2}}\Delta x\right)-f\left(x-{\tfrac {1}{2}}\Delta x \right) $$ The derivative of a function f at a point x is defined by the limit. $$ f'(x)=\lim_{h\to 0} {\frac {f(x+h)-f(x)}{h}} $$ ```python # red dashes, blue squares and green triangles #Example: [a,b], n # https://matplotlib.org/users/pyplot_tutorial.html import numpy as np import matplotlib.pyplot as plt a=0 b=1 n=3 deltax=(b-a)/n deltax # evenly sampled time at delta x intervals x = np.arange(a, b+deltax, deltax) #x = np.linspace(a, b, n+1) x x = np.linspace(-3, 3, 50) y2 = x**2+1 plt.figure() #set x limits plt.xlim((0, 2)) plt.ylim((0, 3)) # set new sticks new_sticks = np.linspace(0, 2, 5) plt.xticks(new_sticks) # set tick labels plt.yticks(np.arange(0, 5, step=1)) # set line styles l2, = plt.plot(x, y2, color='red', linewidth=1.0, linestyle='--', label='f(x)= x^2+1') plt.legend(loc='upper left') plt.show() ``` plot a secant line pass the points (0,1) and (1,2) ```python import matplotlib.pyplot as plt import numpy as np def main(): # x = np.linspace(-2,2,100) a=-2 b=3 divx=0.01 x = np.arange(a, b, divx) x1=0 p1 = int((x1-a)/divx) #starts from zero deltax=1 count_deltax=int(deltax/divx) p2 = p1+ count_deltax #starts from zero y1 = main_func(x) y2 = calculate_secant(x, y1, p1, p2) plot(x, y1, y2) plt.show() def main_func(x): return x**2+1 def calculate_secant(x, y, p1, p2): points = [p1, p2] m, b = np.polyfit(x[points], y[points], 1) return m * x + b def plot(x, y1, y2): plt.plot(x, y1) plt.plot(x, y2) #set x limits plt.xlim((-2, 2)) #set x limits plt.ylim((0, 4)) main() ``` forward difference ```python x=0 deltax=1 main_func(x+deltax)-main_func(x) ``` 1 ```python plot a tangent secant line pass the points (0,1) ``` ```python import matplotlib.pyplot as plt import numpy as np def main(): # x = np.linspace(-2,2,100) a=-2 b=3 divx=0.01 x = np.arange(a, b, divx) x1=1 p1 = int((x1-a)/divx) #starts from zero deltax=0.02 count_deltax=int(deltax/divx) p2 = p1+ count_deltax #starts from zero y1 = main_func(x) y2 = calculate_secant(x, y1, p1, p2) plot(x, y1, y2) plt.show() def main_func(x): return x**2+1 def calculate_secant(x, y, p1, p2): points = [p1, p2] m, b = np.polyfit(x[points], y[points], 1) return m * x + b def plot(x, y1, y2): plt.plot(x, y1) plt.plot(x, y2) #set x limits plt.xlim((-2, 2)) #set x limits plt.ylim((0, 4)) main() ``` ```python import matplotlib.pyplot as plt import numpy as np def main(): # x = np.linspace(-2,2,100) a=-2 b=3 divx=0.01 x = np.arange(a, b, divx) x1=1 p1 = int((x1-a)/divx) #starts from zero deltax=0.01 count_deltax=int(deltax/divx) p2 = p1+ count_deltax #starts from zero y1 = main_func(x) y2 = calculate_secant(x, y1, p1, p2) plot(x, y1, y2) plt.show() def main_func(x): return x**2+1 def calculate_secant(x, y, p1, p2): points = [p1, p2] m, b = np.polyfit(x[points], y[points], 1) print(m) return m * x + b def plot(x, y1, y2): plt.plot(x, y1) plt.plot(x, y2) #set x limits plt.xlim((-2, 2)) #set x limits plt.ylim((0, 4)) main() ``` ```python x=1 deltax=0.00000000001 (main_func(x+deltax)-main_func(x))/deltax ``` 2.000000165480742 ### $$ f'(x)=\lim_{h\to 0} {\frac {f(x+h)-f(x)}{h}} $$ $$ f'(x)={\frac {f(1+2)-f(1)}{2}} = 4$$ The derivative of a function f at a point x is defined by the limit. $$ f'(x)=\lim_{h\to 0} {\frac {f(x+h)-f(x)}{h}} $$ http://www.math.unl.edu/~s-bbockel1/833-notes/node23.html forward difference approximation: $$ f'(x)={\frac {f(x+h)-f(x)}{h}}+O(h) $$ $$ f'(1)=?$$ ```python from sympy import diff, Symbol, sin, tan, limit x = Symbol('x') diff(main_func(x), x) limit(main_func(x), x, 1) ``` 2 ```python import matplotlib.pyplot as plt import numpy as np def main(): # x = np.linspace(-2,2,100) a=-2 b=3 divx=0.01 x = np.arange(a, b, divx) x1=1 p1 = int((x1-a)/divx) #starts from zero deltax=0.01 count_deltax=int(deltax/divx) p2 = p1+ count_deltax #starts from zero y1 = main_func(x) y2 = calculate_secant(x, y1, p1, p2) plot(x, y1, y2) plt.show() def main_func(x): return x**2+1 def calculate_secant(x, y, p1, p2): points = [p1, p2] m, b = np.polyfit(x[points], y[points], 1) print(m) return m * x + b def plot(x, y1, y2): plt.plot(x, y1) plt.plot(x, y2) #set x limits plt.xlim((-2, 2)) #set x limits plt.ylim((0, 4)) main() ``` A backward difference uses the function values at x and x − \Delta, instead of the values at x + \Delta and x: $$ f'(x)=\lim_{h\to 0} {\tfrac{f(x)-f(x-\Delta x)}{\Delta x}}$$ ```python x=1 deltax=0.0001 (main_func(x)-main_func(x-deltax))/deltax ``` 1.9999000000003875 Finally, the central difference is given by $$f'(x)=\lim_{h\to 0} {\tfrac {f\left(x+{\tfrac {1}{2}}\Delta x\right)-f\left(x-{\tfrac {1}{2}}\Delta x \right)}{\Delta x}} $$ ```python x=1 deltax=0.0001 (main_func(x+deltax*(1/2))-main_func(x-deltax*(1/2)))/deltax ``` 1.9999999999997797 ```python ```
lemma poly_cont: fixes p :: "'a::{comm_semiring_0,real_normed_div_algebra} poly" assumes ep: "e > 0" shows "\<exists>d >0. \<forall>w. 0 < norm (w - z) \<and> norm (w - z) < d \<longrightarrow> norm (poly p w - poly p z) < e"
[STATEMENT] lemma total_eval_const: assumes "k \<in> carrier R" shows "total_eval R g (indexed_const k) = k" [PROOF STATE] proof (prove) goal (1 subgoal): 1. total_eval R g (indexed_const k) = k [PROOF STEP] unfolding total_eval_def eval_in_ring_def [PROOF STATE] proof (prove) goal (1 subgoal): 1. poly_eval R UNIV g (indexed_const k) {#} = k [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: k \<in> carrier R goal (1 subgoal): 1. poly_eval R UNIV g (indexed_const k) {#} = k [PROOF STEP] by (metis indexed_const_def poly_eval_constant)
[STATEMENT] lemma (in Module) unique_prepression5_0:"\<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g;\<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n\<rbrakk> \<Longrightarrow> False" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n\<rbrakk> \<Longrightarrow> False [PROOF STEP] apply (cut_tac sc_Ring, frule Ring.ring_is_ag, frule Ring.whole_ideal, frule free_generator_sub[of H]) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> False [PROOF STEP] apply (cut_tac l_comb_Suc[of H "carrier R" s "n - Suc 0" f], simp, thin_tac "l_comb R M n s f = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n") [PROOF STATE] proof (prove) goal (5 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (frule free_generator_sub[of H], frule l_comb_mem[of "carrier R" H t m g], assumption+, frule l_comb_mem[of "carrier R" H s "n - Suc 0" f], assumption+, rule func_pre, simp, rule func_pre, simp, cut_tac sc_mem[of "s n" "f n"]) [PROOF STATE] proof (prove) goal (7 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (frule ag_pOp_closed[of "l_comb R M (n - Suc 0) s f" "s n \<cdot>\<^sub>s f n"], assumption+, frule ag_mOp_closed[of "l_comb R M (n - Suc 0) s f"]) [PROOF STATE] proof (prove) goal (7 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (frule ag_pOp_add_l[of "l_comb R M m t g" "l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n" "-\<^sub>a (l_comb R M (n - Suc 0) s f)"], assumption+, thin_tac "l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n") [PROOF STATE] proof (prove) goal (7 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> (l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n)\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (simp add:ag_pOp_assoc[THEN sym, of "-\<^sub>a (l_comb R M (n - Suc 0) s f)" "l_comb R M (n - Suc 0) s f" "s n \<cdot>\<^sub>s f n"], simp add:ag_l_inv1 ag_l_zero) [PROOF STATE] proof (prove) goal (7 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (cut_tac func_pre[of f "n - Suc 0" H], cut_tac func_pre[of s "n - Suc 0" "carrier R"]) [PROOF STATE] proof (prove) goal (9 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (frule linear_span_iOp_closedTr2[of "carrier R" "H" f "n - Suc 0" s], assumption+) [PROOF STATE] proof (prove) goal (9 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; -\<^sub>a l_comb R M (n - Suc 0) s f = l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (simp, thin_tac "-\<^sub>a (l_comb R M (n - Suc 0) s f) = l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) f") [PROOF STATE] proof (prove) goal (9 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (subgoal_tac "(\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R") [PROOF STATE] proof (prove) goal (10 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (simp add:l_comb_add[THEN sym, of "carrier R" H "\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)" "n - Suc 0" f t m g], thin_tac "l_comb R M m t g \<in> carrier M", thin_tac "l_comb R M (n - Suc 0) s f \<in> carrier M", thin_tac "l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M", thin_tac "l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) f \<in> carrier M") [PROOF STATE] proof (prove) goal (10 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (frule jointfun_hom[of f "n - Suc 0" H g m H], assumption+, frule jointfun_hom[of "\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)" "n - Suc 0" "carrier R" t m "carrier R"], assumption+, simp) [PROOF STATE] proof (prove) goal (10 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] (* to apply unique_expression3_1, we show f n \<notin> (jointfun (n - Suc 0) f m g) ` {j. j \<le> n + m} *) [PROOF STATE] proof (prove) goal (10 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (frule im_jointfun[of f "n - Suc 0" H g m H], assumption+) [PROOF STATE] proof (prove) goal (10 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] apply (frule unique_expression3_1[of H "jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0::nat}. (f n))" "n + m" "jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0::nat}. -\<^sub>a\<^bsub>R\<^esub> (s n))"]) [PROOF STATE] proof (prove) goal (13 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {l. l \<le> Suc (n + m)} \<rightarrow> H 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {l. l \<le> Suc (n + m)} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) \<notin> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) ` ({l. l \<le> Suc (n + m)} - {Suc (n + m)}) 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma ta. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M A total of 13 subgoals... [PROOF STEP] apply (rule Pi_I, case_tac "x \<le> (n + m)", simp, simp add:jointfun_def[of "n+m"], simp add:Pi_def, simp add:jointfun_def[of "n+m"] sliden_def, simp add:Pi_def) [PROOF STATE] proof (prove) goal (12 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {l. l \<le> Suc (n + m)} \<rightarrow> carrier R 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) \<notin> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) ` ({l. l \<le> Suc (n + m)} - {Suc (n + m)}) 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma ta. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) A total of 12 subgoals... [PROOF STEP] apply (rule Pi_I, case_tac "x \<le> (n + m)", simp, simp add:jointfun_def[of "n+m"], simp add:Pi_def) [PROOF STATE] proof (prove) goal (12 subgoals): 1. \<And>x. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; x \<in> {l. l \<le> Suc (n + m)}; \<not> x \<le> n + m\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) x \<in> carrier R 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) \<notin> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) ` ({l. l \<le> Suc (n + m)} - {Suc (n + m)}) 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma ta. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) A total of 12 subgoals... [PROOF STEP] apply (simp add:jointfun_def[of "n+m"] sliden_def, frule Ring.ring_is_ag[of R], rule aGroup.ag_mOp_closed, assumption, simp add:Pi_def) [PROOF STATE] proof (prove) goal (11 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) \<notin> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) ` ({l. l \<le> Suc (n + m)} - {Suc (n + m)}) 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma ta. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R A total of 11 subgoals... [PROOF STEP] apply (thin_tac "s \<in> {j. j \<le> n} \<rightarrow> carrier R", thin_tac "t \<in> {j. j \<le> m} \<rightarrow> carrier R", thin_tac "\<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>", thin_tac "\<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>", thin_tac "l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n", thin_tac "s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R") [PROOF STATE] proof (prove) goal (11 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) \<notin> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) ` ({l. l \<le> Suc (n + m)} - {Suc (n + m)}) 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma ta. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R A total of 11 subgoals... [PROOF STEP] apply (thin_tac "(\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R", thin_tac "jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R") [PROOF STATE] proof (prove) goal (11 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) \<notin> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) ` ({l. l \<le> Suc (n + m)} - {Suc (n + m)}) 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma ta. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R A total of 11 subgoals... [PROOF STEP] apply (simp add:Nset_pre1, simp add:im_jointfunTr1[of "n + m" "jointfun (n - Suc 0) f m g" 0 "\<lambda>x\<in>{0}. f n"], thin_tac "jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H", thin_tac "jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}", simp add:jointfun_def[of "n+m"] sliden_def) [PROOF STATE] proof (prove) goal (11 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> f n \<notin> f ` {l. l \<le> n - Suc 0} 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> Suc (n - Suc 0 + m)} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma ta. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R A total of 11 subgoals... [PROOF STEP] apply (rule contrapos_pp, simp+, simp add:image_def, erule exE,erule conjE, simp add:inj_on_def[of f], drule_tac a = n in forall_spec, simp, thin_tac "\<forall>xa\<le>m. f x \<noteq> g xa", drule_tac a = x in forall_spec, rule_tac i = x and j = "n - Suc 0" and k = n in Nat.le_trans, assumption+, subst Suc_le_mono[THEN sym], simp, simp, cut_tac n1 = x and m1 = "x - Suc 0" in Suc_le_mono[THEN sym], simp) [PROOF STATE] proof (prove) goal (10 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> (\<exists>ta. ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)))\<rbrakk> \<Longrightarrow> False 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H [PROOF STEP] defer [PROOF STATE] proof (prove) goal (10 subgoals): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<in> carrier M; l_comb R M (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R 2. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 3. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<in> carrier M; -\<^sub>a l_comb R M (n - Suc 0) s f \<plusminus> l_comb R M m t g = s n \<cdot>\<^sub>s f n\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 4. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> s n \<in> carrier R 5. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; l_comb R M m t g = l_comb R M (n - Suc 0) s f \<plusminus> s n \<cdot>\<^sub>s f n; H \<subseteq> carrier M; l_comb R M m t g \<in> carrier M; l_comb R M (n - Suc 0) s f \<in> carrier M\<rbrakk> \<Longrightarrow> f n \<in> carrier M 6. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 7. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> ideal R (carrier R) 8. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> carrier R 9. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; l_comb R M n s f = l_comb R M m t g; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> Suc (n - Suc 0)} \<rightarrow> H 10. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> (\<exists>ta. ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)))\<rbrakk> \<Longrightarrow> False [PROOF STEP] apply (rule Pi_I, simp, rule aGroup.ag_mOp_closed, assumption, cut_tac i = x and j = "n - Suc 0" and k = n in Nat.le_trans, assumption, subst Suc_le_mono[THEN sym], simp, simp add:Pi_def, simp, simp, simp add:Pi_def, simp add:Pi_def, simp add:Pi_def subsetD, assumption+, simp, simp) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; \<exists>ga ma. ga \<in> {l. l \<le> ma} \<rightarrow> H \<and> inj_on ga {l. l \<le> ma} \<and> (\<exists>ta. ta \<in> {l. l \<le> ma} \<rightarrow> carrier R \<and> l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga \<and> ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<and> ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)))\<rbrakk> \<Longrightarrow> False [PROOF STEP] apply ((erule exE)+, (erule conjE)+, erule exE, (erule conjE)+) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False [PROOF STEP] apply (cut_tac l_comb_Suc[of H "carrier R" "jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n))" "n + m" "jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)"], simp) [PROOF STATE] proof (prove) goal (5 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)); l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga\<rbrakk> \<Longrightarrow> False 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply ( thin_tac "l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n))) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga") [PROOF STATE] proof (prove) goal (5 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (subgoal_tac "l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n))) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n)) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero>\<^bsub>M\<^esub>", simp, thin_tac "l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n))) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n)) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga", thin_tac "l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n", thin_tac "jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H", thin_tac "jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R", thin_tac "jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}") [PROOF STATE] proof (prove) goal (6 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; \<zero> = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> False 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 6. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (simp add:jointfun_def[of "n+m"] sliden_def) [PROOF STATE] proof (prove) goal (6 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; \<zero> = l_comb R M ma ta ga; ta ma = -\<^sub>a\<^bsub>R\<^esub> s n; ga ma = f n\<rbrakk> \<Longrightarrow> False 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 6. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (rotate_tac -3, frule sym, thin_tac "\<zero> = l_comb R M ma ta ga") [PROOF STATE] proof (prove) goal (6 subgoals): 1. \<And>ga ma ta. \<lbrakk>ta ma = -\<^sub>a\<^bsub>R\<^esub> s n; ga ma = f n; free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M ma ta ga = \<zero>\<rbrakk> \<Longrightarrow> False 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 6. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (frule_tac s = ta and n = ma and m = ga in unique_expression1[of H], assumption+) [PROOF STATE] proof (prove) goal (6 subgoals): 1. \<And>ga ma ta. \<lbrakk>ta ma = -\<^sub>a\<^bsub>R\<^esub> s n; ga ma = f n; free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M ma ta ga = \<zero>; \<forall>j\<in>{j. j \<le> ma}. ta j = \<zero>\<^bsub>R\<^esub>\<rbrakk> \<Longrightarrow> False 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 6. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (rotate_tac -1, drule_tac x = ma in bspec, simp) [PROOF STATE] proof (prove) goal (6 subgoals): 1. \<And>ga ma ta. \<lbrakk>ta ma = -\<^sub>a\<^bsub>R\<^esub> s n; ga ma = f n; free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M ma ta ga = \<zero>; ta ma = \<zero>\<^bsub>R\<^esub>\<rbrakk> \<Longrightarrow> False 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 6. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (frule_tac funcset_mem[of s "{j. j \<le> n}" "carrier R" n], simp, frule sym, thin_tac "ta ma = -\<^sub>a\<^bsub>R\<^esub> (s n)", frule aGroup.ag_inv_inv[of R "s n"], assumption+, simp, thin_tac " -\<^sub>a\<^bsub>R\<^esub> (s n) = \<zero>\<^bsub>R\<^esub>", rotate_tac -1, frule sym, thin_tac " -\<^sub>a\<^bsub>R\<^esub> \<zero>\<^bsub>R\<^esub> = s n", simp add:aGroup.ag_inv_zero[of R]) [PROOF STATE] proof (prove) goal (5 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (thin_tac "l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n))) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n)) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = l_comb R M ma ta ga", thin_tac "ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> (s n)) (Suc (n + m))") [PROOF STATE] proof (prove) goal (5 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> l_comb R M (n + m) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (subst l_comb_jointfun_jj1[of H "carrier R"], assumption+, rule Pi_I, simp, rule aGroup.ag_mOp_closed, assumption, simp add:Pi_def, simp add:Pi_def) [PROOF STATE] proof (prove) goal (5 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (simp, thin_tac "l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n", thin_tac "jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H", thin_tac "jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> (s x)) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R", thin_tac "jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}") [PROOF STATE] proof (prove) goal (5 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> s n \<cdot>\<^sub>s f n \<plusminus> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)) \<cdot>\<^sub>s jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m)) = \<zero> 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> H \<subseteq> carrier M 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 4. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 5. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (simp add:jointfun_def[of "n+m"] sliden_def, subst sc_minus_am1[THEN sym], simp add:Pi_def, simp add:Pi_def subsetD, simp add:ag_r_inv1, simp add:free_generator_sub) [PROOF STATE] proof (prove) goal (3 subgoals): 1. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> ideal R (carrier R) 2. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> carrier R 3. \<And>ga ma ta. \<lbrakk>free_generator R M H; f \<in> {j. j \<le> n} \<rightarrow> H; inj_on f {j. j \<le> n}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; g \<in> {j. j \<le> m} \<rightarrow> H; inj_on g {j. j \<le> m}; t \<in> {j. j \<le> m} \<rightarrow> carrier R; \<forall>j\<le>n. s j \<noteq> \<zero>\<^bsub>R\<^esub>; \<forall>k\<le>m. t k \<noteq> \<zero>\<^bsub>R\<^esub>; f n \<notin> g ` {j. j \<le> m}; 0 < n; Ring R; aGroup R; ideal R (carrier R); H \<subseteq> carrier M; s n \<cdot>\<^sub>s f n \<in> carrier M; l_comb R M (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) (jointfun (n - Suc 0) f m g) = s n \<cdot>\<^sub>s f n; f \<in> {j. j \<le> n - Suc 0} \<rightarrow> H; s \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) \<in> {j. j \<le> n - Suc 0} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g \<in> {j. j \<le> n + m} \<rightarrow> H; jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t \<in> {j. j \<le> n + m} \<rightarrow> carrier R; jointfun (n - Suc 0) f m g ` {j. j \<le> n + m} = f ` {j. j \<le> n - Suc 0} \<union> g ` {j. j \<le> m}; ga \<in> {l. l \<le> ma} \<rightarrow> H; inj_on ga {l. l \<le> ma}; ta \<in> {l. l \<le> ma} \<rightarrow> carrier R; l_comb R M (Suc (n + m)) (jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n)) (jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n)) = l_comb R M ma ta ga; ta ma = jointfun (n + m) (jointfun (n - Suc 0) (\<lambda>x\<in>{j. j \<le> n - Suc 0}. -\<^sub>a\<^bsub>R\<^esub> s x) m t) 0 (\<lambda>x\<in>{0}. -\<^sub>a\<^bsub>R\<^esub> s n) (Suc (n + m)); ga ma = jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun (n + m) (jointfun (n - Suc 0) f m g) 0 (\<lambda>x\<in>{0}. f n) \<in> {j. j \<le> Suc (n + m)} \<rightarrow> H [PROOF STEP] apply (assumption+, rule Pi_I, case_tac "x \<le> n + m", simp add:jointfun_def[of "n+m"], simp add:Pi_def, simp add:jointfun_def[of "n+m"] sliden_def, rule aGroup.ag_mOp_closed, assumption, simp add:Pi_def, rule Pi_I, simp, case_tac "x \<le> n+m", simp add:jointfun_def[of "n+m"], simp add:Pi_def, simp add:jointfun_def[of "n+m"] sliden_def, simp add:Pi_def) [PROOF STATE] proof (prove) goal: No subgoals! [PROOF STEP] done
/- Copyright (c) 2014 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro Natural homomorphism from the natural numbers into a monoid with one. -/ import algebra.ordered_field import data.nat.basic namespace nat variables {α : Type*} section variables [has_zero α] [has_one α] [has_add α] /-- Canonical homomorphism from `ℕ` to a type `α` with `0`, `1` and `+`. -/ protected def cast : ℕ → α | 0 := 0 | (n+1) := cast n + 1 /-- Computationally friendlier cast than `nat.cast`, using binary representation. -/ protected def bin_cast (n : ℕ) : α := @nat.binary_rec (λ _, α) 0 (λ odd k a, cond odd (a + a + 1) (a + a)) n /-- Coercions such as `nat.cast_coe` that go from a concrete structure such as `ℕ` to an arbitrary ring `α` should be set up as follows: ```lean @[priority 900] instance : has_coe_t ℕ α := ⟨...⟩ ``` It needs to be `has_coe_t` instead of `has_coe` because otherwise type-class inference would loop when constructing the transitive coercion `ℕ → ℕ → ℕ → ...`. The reduced priority is necessary so that it doesn't conflict with instances such as `has_coe_t α (option α)`. For this to work, we reduce the priority of the `coe_base` and `coe_trans` instances because we want the instances for `has_coe_t` to be tried in the following order: 1. `has_coe_t` instances declared in mathlib (such as `has_coe_t α (with_top α)`, etc.) 2. `coe_base`, which contains instances such as `has_coe (fin n) n` 3. `nat.cast_coe : has_coe_t ℕ α` etc. 4. `coe_trans` If `coe_trans` is tried first, then `nat.cast_coe` doesn't get a chance to apply. -/ library_note "coercion into rings" attribute [instance, priority 950] coe_base attribute [instance, priority 500] coe_trans -- see note [coercion into rings] @[priority 900] instance cast_coe : has_coe_t ℕ α := ⟨nat.cast⟩ @[simp, norm_cast] theorem cast_zero : ((0 : ℕ) : α) = 0 := rfl theorem cast_add_one (n : ℕ) : ((n + 1 : ℕ) : α) = n + 1 := rfl @[simp, norm_cast, priority 500] theorem cast_succ (n : ℕ) : ((succ n : ℕ) : α) = n + 1 := rfl @[simp, norm_cast] theorem cast_ite (P : Prop) [decidable P] (m n : ℕ) : (((ite P m n) : ℕ) : α) = ite P (m : α) (n : α) := by { split_ifs; refl, } end @[simp, norm_cast] theorem cast_one [add_monoid α] [has_one α] : ((1 : ℕ) : α) = 1 := zero_add _ @[simp, norm_cast] theorem cast_add [add_monoid α] [has_one α] (m) : ∀ n, ((m + n : ℕ) : α) = m + n | 0 := (add_zero _).symm | (n+1) := show ((m + n : ℕ) : α) + 1 = m + (n + 1), by rw [cast_add n, add_assoc] @[simp] lemma bin_cast_eq [add_monoid α] [has_one α] (n : ℕ) : (nat.bin_cast n : α) = ((n : ℕ) : α) := begin rw nat.bin_cast, apply binary_rec _ _ n, { rw [binary_rec_zero, cast_zero] }, { intros b k h, rw [binary_rec_eq, h], { cases b; simp [bit, bit0, bit1] }, { simp } }, end /-- `coe : ℕ → α` as an `add_monoid_hom`. -/ def cast_add_monoid_hom (α : Type*) [add_monoid α] [has_one α] : ℕ →+ α := { to_fun := coe, map_add' := cast_add, map_zero' := cast_zero } @[simp] lemma coe_cast_add_monoid_hom [add_monoid α] [has_one α] : (cast_add_monoid_hom α : ℕ → α) = coe := rfl @[simp, norm_cast] theorem cast_bit0 [add_monoid α] [has_one α] (n : ℕ) : ((bit0 n : ℕ) : α) = bit0 n := cast_add _ _ @[simp, norm_cast] theorem cast_bit1 [add_monoid α] [has_one α] (n : ℕ) : ((bit1 n : ℕ) : α) = bit1 n := by rw [bit1, cast_add_one, cast_bit0]; refl lemma cast_two {α : Type*} [add_monoid α] [has_one α] : ((2 : ℕ) : α) = 2 := by simp @[simp, norm_cast] theorem cast_pred [add_group α] [has_one α] : ∀ {n}, 0 < n → ((n - 1 : ℕ) : α) = n - 1 | (n+1) h := (add_sub_cancel (n:α) 1).symm @[simp, norm_cast] theorem cast_sub [add_group α] [has_one α] {m n} (h : m ≤ n) : ((n - m : ℕ) : α) = n - m := eq_sub_of_add_eq $ by rw [← cast_add, nat.sub_add_cancel h] @[simp, norm_cast] theorem cast_mul [semiring α] (m) : ∀ n, ((m * n : ℕ) : α) = m * n | 0 := (mul_zero _).symm | (n+1) := (cast_add _ _).trans $ show ((m * n : ℕ) : α) + m = m * (n + 1), by rw [cast_mul n, left_distrib, mul_one] @[simp] theorem cast_dvd {α : Type*} [field α] {m n : ℕ} (n_dvd : n ∣ m) (n_nonzero : (n:α) ≠ 0) : ((m / n : ℕ) : α) = m / n := begin rcases n_dvd with ⟨k, rfl⟩, have : n ≠ 0, {rintro rfl, simpa using n_nonzero}, rw nat.mul_div_cancel_left _ (pos_iff_ne_zero.2 this), rw [nat.cast_mul, mul_div_cancel_left _ n_nonzero], end /-- `coe : ℕ → α` as a `ring_hom` -/ def cast_ring_hom (α : Type*) [semiring α] : ℕ →+* α := { to_fun := coe, map_one' := cast_one, map_mul' := cast_mul, .. cast_add_monoid_hom α } @[simp] lemma coe_cast_ring_hom [semiring α] : (cast_ring_hom α : ℕ → α) = coe := rfl lemma cast_commute [semiring α] (n : ℕ) (x : α) : commute ↑n x := nat.rec_on n (commute.zero_left x) $ λ n ihn, ihn.add_left $ commute.one_left x lemma cast_comm [semiring α] (n : ℕ) (x : α) : (n : α) * x = x * n := (cast_commute n x).eq lemma commute_cast [semiring α] (x : α) (n : ℕ) : commute x n := (n.cast_commute x).symm section variables [ordered_semiring α] @[simp] theorem cast_nonneg : ∀ n : ℕ, 0 ≤ (n : α) | 0 := le_refl _ | (n+1) := add_nonneg (cast_nonneg n) zero_le_one theorem mono_cast : monotone (coe : ℕ → α) := λ m n h, let ⟨k, hk⟩ := le_iff_exists_add.1 h in by simp [hk] variable [nontrivial α] theorem strict_mono_cast : strict_mono (coe : ℕ → α) := λ m n h, nat.le_induction (lt_add_of_pos_right _ zero_lt_one) (λ n _ h, lt_add_of_lt_of_pos h zero_lt_one) _ h @[simp, norm_cast] theorem cast_le {m n : ℕ} : (m : α) ≤ n ↔ m ≤ n := strict_mono_cast.le_iff_le @[simp, norm_cast] theorem cast_lt {m n : ℕ} : (m : α) < n ↔ m < n := strict_mono_cast.lt_iff_lt @[simp] theorem cast_pos {n : ℕ} : (0 : α) < n ↔ 0 < n := by rw [← cast_zero, cast_lt] lemma cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 := add_pos_of_nonneg_of_pos n.cast_nonneg zero_lt_one @[simp, norm_cast] theorem one_lt_cast {n : ℕ} : 1 < (n : α) ↔ 1 < n := by rw [← cast_one, cast_lt] @[simp, norm_cast] theorem one_le_cast {n : ℕ} : 1 ≤ (n : α) ↔ 1 ≤ n := by rw [← cast_one, cast_le] @[simp, norm_cast] theorem cast_lt_one {n : ℕ} : (n : α) < 1 ↔ n = 0 := by rw [← cast_one, cast_lt, lt_succ_iff, le_zero_iff] @[simp, norm_cast] theorem cast_le_one {n : ℕ} : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le] end @[simp, norm_cast] theorem cast_min [linear_ordered_semiring α] {a b : ℕ} : (↑(min a b) : α) = min a b := by by_cases a ≤ b; simp [h, min] @[simp, norm_cast] theorem cast_max [linear_ordered_semiring α] {a b : ℕ} : (↑(max a b) : α) = max a b := by by_cases a ≤ b; simp [h, max] @[simp, norm_cast] theorem abs_cast [linear_ordered_ring α] (a : ℕ) : abs (a : α) = a := abs_of_nonneg (cast_nonneg a) lemma coe_nat_dvd [comm_semiring α] {m n : ℕ} (h : m ∣ n) : (m : α) ∣ (n : α) := ring_hom.map_dvd (nat.cast_ring_hom α) h alias coe_nat_dvd ← has_dvd.dvd.nat_cast section linear_ordered_field variables [linear_ordered_field α] lemma inv_pos_of_nat {n : ℕ} : 0 < ((n : α) + 1)⁻¹ := inv_pos.2 $ add_pos_of_nonneg_of_pos n.cast_nonneg zero_lt_one lemma one_div_pos_of_nat {n : ℕ} : 0 < 1 / ((n : α) + 1) := by { rw one_div, exact inv_pos_of_nat } lemma one_div_le_one_div {n m : ℕ} (h : n ≤ m) : 1 / ((m : α) + 1) ≤ 1 / ((n : α) + 1) := by { refine one_div_le_one_div_of_le _ _, exact nat.cast_add_one_pos _, simpa } lemma one_div_lt_one_div {n m : ℕ} (h : n < m) : 1 / ((m : α) + 1) < 1 / ((n : α) + 1) := by { refine one_div_lt_one_div_of_lt _ _, exact nat.cast_add_one_pos _, simpa } end linear_ordered_field end nat namespace add_monoid_hom variables {A B : Type*} [add_monoid A] @[ext] lemma ext_nat {f g : ℕ →+ A} (h : f 1 = g 1) : f = g := ext $ λ n, nat.rec_on n (f.map_zero.trans g.map_zero.symm) $ λ n ihn, by simp only [nat.succ_eq_add_one, *, map_add] variables [has_one A] [add_monoid B] [has_one B] lemma eq_nat_cast (f : ℕ →+ A) (h1 : f 1 = 1) : ∀ n : ℕ, f n = n := congr_fun $ show f = nat.cast_add_monoid_hom A, from ext_nat (h1.trans nat.cast_one.symm) lemma map_nat_cast (f : A →+ B) (h1 : f 1 = 1) (n : ℕ) : f n = n := (f.comp (nat.cast_add_monoid_hom A)).eq_nat_cast (by simp [h1]) _ end add_monoid_hom namespace monoid_with_zero_hom variables {A : Type*} [monoid_with_zero A] /-- If two `monoid_with_zero_hom`s agree on the positive naturals they are equal. -/ @[ext] theorem ext_nat {f g : monoid_with_zero_hom ℕ A} (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) : f = g := begin ext (_ | n), { rw [f.map_zero, g.map_zero] }, { exact h_pos n.zero_lt_succ, }, end end monoid_with_zero_hom namespace ring_hom variables {R : Type*} {S : Type*} [semiring R] [semiring S] @[simp] lemma eq_nat_cast (f : ℕ →+* R) (n : ℕ) : f n = n := f.to_add_monoid_hom.eq_nat_cast f.map_one n @[simp] lemma map_nat_cast (f : R →+* S) (n : ℕ) : f n = n := (f.comp (nat.cast_ring_hom R)).eq_nat_cast n lemma ext_nat (f g : ℕ →+* R) : f = g := coe_add_monoid_hom_injective $ add_monoid_hom.ext_nat $ f.map_one.trans g.map_one.symm end ring_hom @[simp, norm_cast] theorem nat.cast_id (n : ℕ) : ↑n = n := ((ring_hom.id ℕ).eq_nat_cast n).symm @[simp] theorem nat.cast_with_bot : ∀ (n : ℕ), @coe ℕ (with_bot ℕ) (@coe_to_lift _ _ nat.cast_coe) n = n | 0 := rfl | (n+1) := by rw [with_bot.coe_add, nat.cast_add, nat.cast_with_bot n]; refl instance nat.subsingleton_ring_hom {R : Type*} [semiring R] : subsingleton (ℕ →+* R) := ⟨ring_hom.ext_nat⟩ namespace with_top variables {α : Type*} variables [has_zero α] [has_one α] [has_add α] @[simp, norm_cast] lemma coe_nat : ∀(n : nat), ((n : α) : with_top α) = n | 0 := rfl | (n+1) := by { push_cast, rw [coe_nat n] } @[simp] lemma nat_ne_top (n : nat) : (n : with_top α) ≠ ⊤ := by { rw [←coe_nat n], apply coe_ne_top } @[simp] lemma top_ne_nat (n : nat) : (⊤ : with_top α) ≠ n := by { rw [←coe_nat n], apply top_ne_coe } lemma add_one_le_of_lt {i n : with_top ℕ} (h : i < n) : i + 1 ≤ n := begin cases n, { exact le_top }, cases i, { exact (not_le_of_lt h le_top).elim }, exact with_top.coe_le_coe.2 (with_top.coe_lt_coe.1 h) end lemma one_le_iff_pos {n : with_top ℕ} : 1 ≤ n ↔ 0 < n := ⟨λ h, (coe_lt_coe.2 zero_lt_one).trans_le h, λ h, by simpa only [zero_add] using add_one_le_of_lt h⟩ @[elab_as_eliminator] lemma nat_induction {P : with_top ℕ → Prop} (a : with_top ℕ) (h0 : P 0) (hsuc : ∀n:ℕ, P n → P n.succ) (htop : (∀n : ℕ, P n) → P ⊤) : P a := begin have A : ∀n:ℕ, P n := λ n, nat.rec_on n h0 hsuc, cases a, { exact htop A }, { exact A a } end end with_top
!======================================================================= ! Generated by : PSCAD v4.6.3.0 ! ! Warning: The content of this file is automatically generated. ! Do not modify, as any changes made here will be lost! !----------------------------------------------------------------------- ! Component : Main ! Description : !----------------------------------------------------------------------- !======================================================================= SUBROUTINE MainDyn() !--------------------------------------- ! Standard includes !--------------------------------------- INCLUDE 'nd.h' INCLUDE 'emtconst.h' INCLUDE 'emtstor.h' INCLUDE 's0.h' INCLUDE 's1.h' INCLUDE 's2.h' INCLUDE 's4.h' INCLUDE 'branches.h' INCLUDE 'pscadv3.h' INCLUDE 'fnames.h' INCLUDE 'radiolinks.h' INCLUDE 'matlab.h' INCLUDE 'rtconfig.h' !--------------------------------------- ! Function/Subroutine Declarations !--------------------------------------- ! SUBR EMTDC_X2COMP ! 'Comparator with Interpolation' !--------------------------------------- ! Variable Declarations !--------------------------------------- ! Subroutine Arguments ! Electrical Node Indices ! Control Signals INTEGER gaB, gbB, gcB REAL gbT, gcT, refc, trig, refb, RT_1 REAL RT_2, RT_3, RT_4, RT_5, RT_6, RT_7 REAL RT_8, RT_9, gaT, Ig(3), refa ! Internal Variables REAL RVD2_1(2), RVD1_1, RVD1_2, RVD1_3 REAL RVD1_4 ! Indexing variables INTEGER ICALL_NO ! Module call num INTEGER ISTOI, ISTOF, IT_0 ! Storage Indices INTEGER IPGB ! Control/Monitoring INTEGER SS, INODE, IBRCH ! SS/Node/Branch/Xfmr !--------------------------------------- ! Local Indices !--------------------------------------- ! Dsdyn <-> Dsout transfer index storage NTXFR = NTXFR + 1 TXFR(NTXFR,1) = NSTOL TXFR(NTXFR,2) = NSTOI TXFR(NTXFR,3) = NSTOF TXFR(NTXFR,4) = NSTOC ! Define electric network subsystem number SS = NODE(NNODE+1) ! Increment and assign runtime configuration call indices ICALL_NO = NCALL_NO NCALL_NO = NCALL_NO + 1 ! Increment global storage indices ISTOI = NSTOI NSTOI = NSTOI + 3 ISTOF = NSTOF NSTOF = NSTOF + 19 IPGB = NPGB NPGB = NPGB + 6 INODE = NNODE + 2 NNODE = NNODE + 7 IBRCH = NBRCH(SS) NBRCH(SS) = NBRCH(SS) + 28 NCSCS = NCSCS + 0 NCSCR = NCSCR + 0 !--------------------------------------- ! Transfers from storage arrays !--------------------------------------- gaB = STOI(ISTOI + 1) gbB = STOI(ISTOI + 2) gbT = STOF(ISTOF + 1) gcB = STOI(ISTOI + 3) gcT = STOF(ISTOF + 2) refc = STOF(ISTOF + 3) trig = STOF(ISTOF + 4) refb = STOF(ISTOF + 5) RT_1 = STOF(ISTOF + 6) RT_2 = STOF(ISTOF + 7) RT_3 = STOF(ISTOF + 8) RT_4 = STOF(ISTOF + 9) RT_5 = STOF(ISTOF + 10) RT_6 = STOF(ISTOF + 11) RT_7 = STOF(ISTOF + 12) RT_8 = STOF(ISTOF + 13) RT_9 = STOF(ISTOF + 14) gaT = STOF(ISTOF + 15) refa = STOF(ISTOF + 19) ! Array (1:3) quantities... DO IT_0 = 1,3 Ig(IT_0) = STOF(ISTOF + 15 + IT_0) END DO !--------------------------------------- ! Electrical Node Lookup !--------------------------------------- !--------------------------------------- ! Configuration of Models !--------------------------------------- IF ( TIMEZERO ) THEN FILENAME = 'Main.dta' CALL EMTDC_OPENFILE SECTION = 'DATADSD:' CALL EMTDC_GOTOSECTION ENDIF !--------------------------------------- ! Generated code from module definition !--------------------------------------- ! 20:[const] Real Constant RT_2 = 0.0 ! 30:[const] Real Constant RT_1 = 1.0 ! 40:[const] Real Constant RT_3 = 60.0 ! 60:[const] Real Constant RT_5 = -120.0 ! 70:[const] Real Constant RT_4 = 1.0 ! 80:[const] Real Constant RT_6 = 60.0 ! 90:[const] Real Constant RT_8 = 120.0 ! 100:[const] Real Constant RT_7 = 1.0 ! 110:[const] Real Constant RT_9 = 60.0 ! 120:[signalgen] Signal Generator /w Interpolation CALL COMPONENT_ID(ICALL_NO,1430419306) CALL E_XSGEN1_EXE(1,2000.0,RVD2_1) trig = RVD2_1(1) ! 130:[modulator] Amplitude/Frequency/Phase Modulator ! AM/FM/PM MODULATOR refa = RT_1 * SIN(STORF(NSTORF) + RT_2*PI_BY180) STORF(NSTORF) = STORF(NSTORF) + TWO_PI*RT_3*DELT IF (STORF(NSTORF) .GT. TWO_PI) STORF(NSTORF) = STORF(NSTORF) - T& &WO_PI IF (STORF(NSTORF) .LT. -TWO_PI) STORF(NSTORF) = STORF(NSTORF) + T& &WO_PI NSTORF = NSTORF+1 ! ! 140:[compar] Two Input Comparator ! CALL EMTDC_X2COMP(0,0,refa,trig,1.0,0.0,0.0,RVD2_1) gaT = RVD2_1(1) ! 150:[modulator] Amplitude/Frequency/Phase Modulator ! AM/FM/PM MODULATOR refb = RT_4 * SIN(STORF(NSTORF) + RT_5*PI_BY180) STORF(NSTORF) = STORF(NSTORF) + TWO_PI*RT_6*DELT IF (STORF(NSTORF) .GT. TWO_PI) STORF(NSTORF) = STORF(NSTORF) - T& &WO_PI IF (STORF(NSTORF) .LT. -TWO_PI) STORF(NSTORF) = STORF(NSTORF) + T& &WO_PI NSTORF = NSTORF+1 ! ! 160:[compar] Two Input Comparator ! CALL EMTDC_X2COMP(0,0,refb,trig,1.0,0.0,0.0,RVD2_1) gbT = RVD2_1(1) ! 170:[modulator] Amplitude/Frequency/Phase Modulator ! AM/FM/PM MODULATOR refc = RT_7 * SIN(STORF(NSTORF) + RT_8*PI_BY180) STORF(NSTORF) = STORF(NSTORF) + TWO_PI*RT_9*DELT IF (STORF(NSTORF) .GT. TWO_PI) STORF(NSTORF) = STORF(NSTORF) - T& &WO_PI IF (STORF(NSTORF) .LT. -TWO_PI) STORF(NSTORF) = STORF(NSTORF) + T& &WO_PI NSTORF = NSTORF+1 ! ! 180:[compar] Two Input Comparator ! CALL EMTDC_X2COMP(0,0,refc,trig,1.0,0.0,0.0,RVD2_1) gcT = RVD2_1(1) ! 190:[inv] Interpolated Logic Inverter IF (NINT(gcT) .NE. 0) THEN gcB = 0 ELSE gcB = 1 ENDIF ! 200:[inv] Interpolated Logic Inverter IF (NINT(gbT) .NE. 0) THEN gbB = 0 ELSE gbB = 1 ENDIF ! 210:[pgb] Output Channel 'trig' PGB(IPGB+4) = trig ! 220:[inv] Interpolated Logic Inverter IF (NINT(gaT) .NE. 0) THEN gaB = 0 ELSE gaB = 1 ENDIF ! 230:[pgb] Output Channel 'gaT' PGB(IPGB+5) = gaT ! 240:[pgb] Output Channel 'refa' PGB(IPGB+6) = refa ! 250:[peswitch] Power electronic switch ! Power Electronic Switch Model: IGBT CALL COMPONENT_ID(ICALL_NO,1075157795) CALL PESWITCH1_EXE(SS, (IBRCH+18), gcB, 0.0) ! 260:[peswitch] Power electronic switch ! Power Electronic Switch Model: IGBT CALL COMPONENT_ID(ICALL_NO,1097613992) CALL PESWITCH1_EXE(SS, (IBRCH+10), gbB, 0.0) ! 270:[peswitch] Power electronic switch ! Power Electronic Switch Model: IGBT CALL COMPONENT_ID(ICALL_NO,1757427102) CALL PESWITCH1_EXE(SS, (IBRCH+7), gaB, 0.0) ! 280:[peswitch] Power electronic switch ! Power Electronic Switch Model: IGBT CALL COMPONENT_ID(ICALL_NO,919193464) CALL PESWITCH1_EXE(SS, (IBRCH+24), NINT(gcT), 0.0) ! 290:[peswitch] Power electronic switch ! Power Electronic Switch Model: IGBT CALL COMPONENT_ID(ICALL_NO,1065325783) CALL PESWITCH1_EXE(SS, (IBRCH+16), NINT(gbT), 0.0) ! 300:[peswitch] Power electronic switch ! Power Electronic Switch Model: IGBT CALL COMPONENT_ID(ICALL_NO,102682175) CALL PESWITCH1_EXE(SS, (IBRCH+1), NINT(gaT), 0.0) ! 1:[peswitch] Power electronic switch ! Power Electronic Switch Model: Diode CALL COMPONENT_ID(ICALL_NO,832789285) CALL PESWITCH1_EXE(SS, (IBRCH+3), 1, 0.0) ! 1:[peswitch] Power electronic switch ! Power Electronic Switch Model: Diode CALL COMPONENT_ID(ICALL_NO,1954537221) CALL PESWITCH1_EXE(SS, (IBRCH+14), 1, 0.0) ! 1:[peswitch] Power electronic switch ! Power Electronic Switch Model: Diode CALL COMPONENT_ID(ICALL_NO,1548052404) CALL PESWITCH1_EXE(SS, (IBRCH+22), 1, 0.0) ! 1:[source_1] Single Phase Voltage Source Model 2 'Source1' ! DC source: Type: Ideal RVD1_1 = RTCF(NRTCF) RVD1_2 = RTCF(NRTCF+1) RVD1_3 = RTCF(NRTCF+2) RVD1_4 = RTCF(NRTCF+3) NRTCF = NRTCF + 4 CALL EMTDC_1PVSRC(SS, (IBRCH+9),RVD1_4,0,RVD1_1,RVD1_2,RVD1_3) ! 1:[peswitch] Power electronic switch ! Power Electronic Switch Model: Diode CALL COMPONENT_ID(ICALL_NO,897052400) CALL PESWITCH1_EXE(SS, (IBRCH+5), 1, 0.0) ! 1:[peswitch] Power electronic switch ! Power Electronic Switch Model: Diode CALL COMPONENT_ID(ICALL_NO,1554158286) CALL PESWITCH1_EXE(SS, (IBRCH+12), 1, 0.0) ! 1:[peswitch] Power electronic switch ! Power Electronic Switch Model: Diode CALL COMPONENT_ID(ICALL_NO,217224708) CALL PESWITCH1_EXE(SS, (IBRCH+20), 1, 0.0) !--------------------------------------- ! Feedbacks and transfers to storage !--------------------------------------- STOI(ISTOI + 1) = gaB STOI(ISTOI + 2) = gbB STOF(ISTOF + 1) = gbT STOI(ISTOI + 3) = gcB STOF(ISTOF + 2) = gcT STOF(ISTOF + 3) = refc STOF(ISTOF + 4) = trig STOF(ISTOF + 5) = refb STOF(ISTOF + 6) = RT_1 STOF(ISTOF + 7) = RT_2 STOF(ISTOF + 8) = RT_3 STOF(ISTOF + 9) = RT_4 STOF(ISTOF + 10) = RT_5 STOF(ISTOF + 11) = RT_6 STOF(ISTOF + 12) = RT_7 STOF(ISTOF + 13) = RT_8 STOF(ISTOF + 14) = RT_9 STOF(ISTOF + 15) = gaT STOF(ISTOF + 19) = refa ! Array (1:3) quantities... DO IT_0 = 1,3 STOF(ISTOF + 15 + IT_0) = Ig(IT_0) END DO !--------------------------------------- ! Transfer to Exports !--------------------------------------- !--------------------------------------- ! Close Model Data read !--------------------------------------- IF ( TIMEZERO ) CALL EMTDC_CLOSEFILE RETURN END !======================================================================= SUBROUTINE MainOut() !--------------------------------------- ! Standard includes !--------------------------------------- INCLUDE 'nd.h' INCLUDE 'emtconst.h' INCLUDE 'emtstor.h' INCLUDE 's0.h' INCLUDE 's1.h' INCLUDE 's2.h' INCLUDE 's4.h' INCLUDE 'branches.h' INCLUDE 'pscadv3.h' INCLUDE 'fnames.h' INCLUDE 'radiolinks.h' INCLUDE 'matlab.h' INCLUDE 'rtconfig.h' !--------------------------------------- ! Function/Subroutine Declarations !--------------------------------------- REAL VBRANCH ! Voltage across the branch !--------------------------------------- ! Variable Declarations !--------------------------------------- ! Electrical Node Indices ! Control Signals REAL RT_1, RT_2, RT_3, RT_4, RT_5, RT_6 REAL RT_7, RT_8, RT_9, Ig(3) ! Internal Variables INTEGER IVD1_1 ! Indexing variables INTEGER ICALL_NO ! Module call num INTEGER ISTOL, ISTOI, ISTOF, ISTOC, IT_0 ! Storage Indices INTEGER IPGB ! Control/Monitoring INTEGER SS, INODE, IBRCH ! SS/Node/Branch/Xfmr !--------------------------------------- ! Local Indices !--------------------------------------- ! Dsdyn <-> Dsout transfer index storage NTXFR = NTXFR + 1 ISTOL = TXFR(NTXFR,1) ISTOI = TXFR(NTXFR,2) ISTOF = TXFR(NTXFR,3) ISTOC = TXFR(NTXFR,4) ! Define electric network subsystem number SS = NODE(NNODE+1) ! Increment and assign runtime configuration call indices ICALL_NO = NCALL_NO NCALL_NO = NCALL_NO + 1 ! Increment global storage indices IPGB = NPGB NPGB = NPGB + 6 INODE = NNODE + 2 NNODE = NNODE + 7 IBRCH = NBRCH(SS) NBRCH(SS) = NBRCH(SS) + 28 NCSCS = NCSCS + 0 NCSCR = NCSCR + 0 !--------------------------------------- ! Transfers from storage arrays !--------------------------------------- RT_1 = STOF(ISTOF + 6) RT_2 = STOF(ISTOF + 7) RT_3 = STOF(ISTOF + 8) RT_4 = STOF(ISTOF + 9) RT_5 = STOF(ISTOF + 10) RT_6 = STOF(ISTOF + 11) RT_7 = STOF(ISTOF + 12) RT_8 = STOF(ISTOF + 13) RT_9 = STOF(ISTOF + 14) ! Array (1:3) quantities... DO IT_0 = 1,3 Ig(IT_0) = STOF(ISTOF + 15 + IT_0) END DO !--------------------------------------- ! Electrical Node Lookup !--------------------------------------- !--------------------------------------- ! Configuration of Models !--------------------------------------- IF ( TIMEZERO ) THEN FILENAME = 'Main.dta' CALL EMTDC_OPENFILE SECTION = 'DATADSO:' CALL EMTDC_GOTOSECTION ENDIF !--------------------------------------- ! Generated code from module definition !--------------------------------------- ! 10:[multimeter] Multimeter IVD1_1 = NRTCF NRTCF = NRTCF + 5 Ig(1) = ( CBR((IBRCH+26), SS)) Ig(2) = ( CBR((IBRCH+27), SS)) Ig(3) = ( CBR((IBRCH+28), SS)) ! 20:[const] Real Constant RT_2 = 0.0 ! 30:[const] Real Constant RT_1 = 1.0 ! 40:[const] Real Constant RT_3 = 60.0 ! 50:[pgb] Output Channel 'Ig' DO IVD1_1 = 1, 3 PGB(IPGB+1+IVD1_1-1) = Ig(IVD1_1) ENDDO ! 60:[const] Real Constant RT_5 = -120.0 ! 70:[const] Real Constant RT_4 = 1.0 ! 80:[const] Real Constant RT_6 = 60.0 ! 90:[const] Real Constant RT_8 = 120.0 ! 100:[const] Real Constant RT_7 = 1.0 ! 110:[const] Real Constant RT_9 = 60.0 !--------------------------------------- ! Feedbacks and transfers to storage !--------------------------------------- STOF(ISTOF + 6) = RT_1 STOF(ISTOF + 7) = RT_2 STOF(ISTOF + 8) = RT_3 STOF(ISTOF + 9) = RT_4 STOF(ISTOF + 10) = RT_5 STOF(ISTOF + 11) = RT_6 STOF(ISTOF + 12) = RT_7 STOF(ISTOF + 13) = RT_8 STOF(ISTOF + 14) = RT_9 ! Array (1:3) quantities... DO IT_0 = 1,3 STOF(ISTOF + 15 + IT_0) = Ig(IT_0) END DO !--------------------------------------- ! Close Model Data read !--------------------------------------- IF ( TIMEZERO ) CALL EMTDC_CLOSEFILE RETURN END !======================================================================= SUBROUTINE MainDyn_Begin() !--------------------------------------- ! Standard includes !--------------------------------------- INCLUDE 'nd.h' INCLUDE 'emtconst.h' INCLUDE 's0.h' INCLUDE 's1.h' INCLUDE 's4.h' INCLUDE 'branches.h' INCLUDE 'pscadv3.h' INCLUDE 'radiolinks.h' INCLUDE 'rtconfig.h' !--------------------------------------- ! Function/Subroutine Declarations !--------------------------------------- !--------------------------------------- ! Variable Declarations !--------------------------------------- ! Subroutine Arguments ! Electrical Node Indices ! Control Signals REAL RT_1, RT_2, RT_3, RT_4, RT_5, RT_6 REAL RT_7, RT_8, RT_9 ! Internal Variables ! Indexing variables INTEGER ICALL_NO ! Module call num INTEGER IT_0 ! Storage Indices INTEGER SS, INODE, IBRCH ! SS/Node/Branch/Xfmr !--------------------------------------- ! Local Indices !--------------------------------------- ! Define electric network subsystem number SS = NODE(NNODE+1) ! Increment and assign runtime configuration call indices ICALL_NO = NCALL_NO NCALL_NO = NCALL_NO + 1 ! Increment global storage indices INODE = NNODE + 2 NNODE = NNODE + 7 IBRCH = NBRCH(SS) NBRCH(SS) = NBRCH(SS) + 28 NCSCS = NCSCS + 0 NCSCR = NCSCR + 0 !--------------------------------------- ! Electrical Node Lookup !--------------------------------------- !--------------------------------------- ! Generated code from module definition !--------------------------------------- ! 20:[const] Real Constant RT_2 = 0.0 ! 30:[const] Real Constant RT_1 = 1.0 ! 40:[const] Real Constant RT_3 = 60.0 ! 60:[const] Real Constant RT_5 = -120.0 ! 70:[const] Real Constant RT_4 = 1.0 ! 80:[const] Real Constant RT_6 = 60.0 ! 90:[const] Real Constant RT_8 = 120.0 ! 100:[const] Real Constant RT_7 = 1.0 ! 110:[const] Real Constant RT_9 = 60.0 ! 120:[signalgen] Signal Generator /w Interpolation CALL COMPONENT_ID(ICALL_NO,1430419306) CALL E_XSGEN1_CFG(1,0.0,50.0,1.0,-1.0) ! 130:[modulator] Amplitude/Frequency/Phase Modulator ! 140:[compar] Two Input Comparator ! 150:[modulator] Amplitude/Frequency/Phase Modulator ! 160:[compar] Two Input Comparator ! 170:[modulator] Amplitude/Frequency/Phase Modulator ! 180:[compar] Two Input Comparator ! 190:[inv] Interpolated Logic Inverter ! 200:[inv] Interpolated Logic Inverter ! 210:[pgb] Output Channel 'trig' ! 220:[inv] Interpolated Logic Inverter ! 230:[pgb] Output Channel 'gaT' ! 240:[pgb] Output Channel 'refa' ! 250:[peswitch] Power electronic switch CALL PESWITCH1_CFG(3, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+19),SS,1,0,1,5000.0,0.0,0.05) ! 260:[peswitch] Power electronic switch CALL PESWITCH1_CFG(3, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+11),SS,1,0,1,5000.0,0.0,0.05) ! 270:[peswitch] Power electronic switch CALL PESWITCH1_CFG(3, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+8),SS,1,0,1,5000.0,0.0,0.05) ! 280:[peswitch] Power electronic switch CALL PESWITCH1_CFG(3, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+25),SS,1,0,1,5000.0,0.0,0.05) ! 290:[peswitch] Power electronic switch CALL PESWITCH1_CFG(3, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+17),SS,1,0,1,5000.0,0.0,0.05) ! 300:[peswitch] Power electronic switch CALL PESWITCH1_CFG(3, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+2),SS,1,0,1,5000.0,0.0,0.05) ! 1:[peswitch] Power electronic switch CALL PESWITCH1_CFG(0, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+4),SS,1,0,1,5000.0,0.0,0.05) ! 1:[peswitch] Power electronic switch CALL PESWITCH1_CFG(0, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+15),SS,1,0,1,5000.0,0.0,0.05) ! 1:[peswitch] Power electronic switch CALL PESWITCH1_CFG(0, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+23),SS,1,0,1,5000.0,0.0,0.05) ! 1:[source_1] Single Phase Voltage Source Model 2 'Source1' CALL E_1PVSRC_CFG(0,0,6,0.5,60.0,0.0,0.0,0.0,0.0,0.0,0.0,0.01) ! 1:[peswitch] Power electronic switch CALL PESWITCH1_CFG(0, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+6),SS,1,0,1,5000.0,0.0,0.05) ! 1:[peswitch] Power electronic switch CALL PESWITCH1_CFG(0, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+13),SS,1,0,1,5000.0,0.0,0.05) ! 1:[peswitch] Power electronic switch CALL PESWITCH1_CFG(0, 0,0.01, 1000000.0, 100000.0, 100000.0, 0.0, & &0.0) CALL E_BRANCH_CFG( (IBRCH+21),SS,1,0,1,5000.0,0.0,0.05) RETURN END !======================================================================= SUBROUTINE MainOut_Begin() !--------------------------------------- ! Standard includes !--------------------------------------- INCLUDE 'nd.h' INCLUDE 'emtconst.h' INCLUDE 's0.h' INCLUDE 's1.h' INCLUDE 's4.h' INCLUDE 'branches.h' INCLUDE 'pscadv3.h' INCLUDE 'radiolinks.h' INCLUDE 'rtconfig.h' !--------------------------------------- ! Function/Subroutine Declarations !--------------------------------------- !--------------------------------------- ! Variable Declarations !--------------------------------------- ! Subroutine Arguments ! Electrical Node Indices ! Control Signals REAL RT_1, RT_2, RT_3, RT_4, RT_5, RT_6 REAL RT_7, RT_8, RT_9 ! Internal Variables INTEGER IVD1_1 ! Indexing variables INTEGER ICALL_NO ! Module call num INTEGER IT_0 ! Storage Indices INTEGER SS, INODE, IBRCH ! SS/Node/Branch/Xfmr !--------------------------------------- ! Local Indices !--------------------------------------- ! Define electric network subsystem number SS = NODE(NNODE+1) ! Increment and assign runtime configuration call indices ICALL_NO = NCALL_NO NCALL_NO = NCALL_NO + 1 ! Increment global storage indices INODE = NNODE + 2 NNODE = NNODE + 7 IBRCH = NBRCH(SS) NBRCH(SS) = NBRCH(SS) + 28 NCSCS = NCSCS + 0 NCSCR = NCSCR + 0 !--------------------------------------- ! Electrical Node Lookup !--------------------------------------- !--------------------------------------- ! Generated code from module definition !--------------------------------------- ! 10:[multimeter] Multimeter IVD1_1 = NRTCF NRTCF = NRTCF + 5 ! 20:[const] Real Constant RT_2 = 0.0 ! 30:[const] Real Constant RT_1 = 1.0 ! 40:[const] Real Constant RT_3 = 60.0 ! 50:[pgb] Output Channel 'Ig' ! 60:[const] Real Constant RT_5 = -120.0 ! 70:[const] Real Constant RT_4 = 1.0 ! 80:[const] Real Constant RT_6 = 60.0 ! 90:[const] Real Constant RT_8 = 120.0 ! 100:[const] Real Constant RT_7 = 1.0 ! 110:[const] Real Constant RT_9 = 60.0 RETURN END
{-# OPTIONS --without-K --safe #-} open import Categories.Category -- Some basic facts about Spans in some category 𝒞. -- -- For the Category instances for these, you can look at the following modules -- Categories.Category.Construction.Spans -- Categories.Bicategory.Construction.Spans module Categories.Category.Diagram.Span {o ℓ e} (𝒞 : Category o ℓ e) where open import Level open import Function using (_$_) open import Categories.Diagram.Pullback 𝒞 open import Categories.Morphism.Reasoning 𝒞 open Category 𝒞 open HomReasoning open Equiv open Pullback private variable A B C D E : Obj -------------------------------------------------------------------------------- -- Spans, and Span morphisms infixr 9 _∘ₛ_ record Span (X Y : Obj) : Set (o ⊔ ℓ) where field M : Obj dom : M ⇒ X cod : M ⇒ Y open Span id-span : Span A A id-span {A} = record { M = A ; dom = id ; cod = id } record Span⇒ {X Y} (f g : Span X Y) : Set (o ⊔ ℓ ⊔ e) where field arr : M f ⇒ M g commute-dom : dom g ∘ arr ≈ dom f commute-cod : cod g ∘ arr ≈ cod f open Span⇒ id-span⇒ : ∀ {f : Span A B} → Span⇒ f f id-span⇒ = record { arr = id ; commute-dom = identityʳ ; commute-cod = identityʳ } _∘ₛ_ : ∀ {f g h : Span A B} → (α : Span⇒ g h) → (β : Span⇒ f g) → Span⇒ f h _∘ₛ_ {f = f} {g = g} {h = h} α β = record { arr = arr α ∘ arr β ; commute-dom = begin dom h ∘ arr α ∘ arr β ≈⟨ pullˡ (commute-dom α) ⟩ dom g ∘ arr β ≈⟨ commute-dom β ⟩ dom f ∎ ; commute-cod = begin cod h ∘ arr α ∘ arr β ≈⟨ pullˡ (commute-cod α) ⟩ cod g ∘ arr β ≈⟨ commute-cod β ⟩ cod f ∎ } -------------------------------------------------------------------------------- -- Span Compositions module Compositions (_×ₚ_ : ∀ {X Y Z} (f : X ⇒ Z) → (g : Y ⇒ Z) → Pullback f g) where _⊚₀_ : Span B C → Span A B → Span A C f ⊚₀ g = let g×ₚf = (cod g) ×ₚ (dom f) in record { M = P g×ₚf ; dom = dom g ∘ p₁ g×ₚf ; cod = cod f ∘ p₂ g×ₚf } _⊚₁_ : {f f′ : Span B C} {g g′ : Span A B} → Span⇒ f f′ → Span⇒ g g′ → Span⇒ (f ⊚₀ g) (f′ ⊚₀ g′) _⊚₁_ {f = f} {f′ = f′} {g = g} {g′ = g′} α β = let pullback = (cod g) ×ₚ (dom f) pullback′ = (cod g′) ×ₚ (dom f′) in record { arr = universal pullback′ {h₁ = arr β ∘ p₁ pullback} {h₂ = arr α ∘ p₂ pullback} $ begin cod g′ ∘ arr β ∘ p₁ pullback ≈⟨ pullˡ (commute-cod β) ⟩ cod g ∘ p₁ pullback ≈⟨ commute pullback ⟩ dom f ∘ p₂ pullback ≈⟨ pushˡ (⟺ (commute-dom α)) ⟩ dom f′ ∘ arr α ∘ p₂ pullback ∎ ; commute-dom = begin (dom g′ ∘ p₁ pullback′) ∘ universal pullback′ _ ≈⟨ pullʳ (p₁∘universal≈h₁ pullback′) ⟩ dom g′ ∘ arr β ∘ p₁ pullback ≈⟨ pullˡ (commute-dom β) ⟩ dom g ∘ p₁ pullback ∎ ; commute-cod = begin (cod f′ ∘ p₂ pullback′) ∘ universal pullback′ _ ≈⟨ pullʳ (p₂∘universal≈h₂ pullback′) ⟩ cod f′ ∘ arr α ∘ p₂ pullback ≈⟨ pullˡ (commute-cod α) ⟩ cod f ∘ p₂ pullback ∎ }
box::use( extrafont, grDevices[embedFonts, pdfFonts, postscriptFonts, Type1Font], stats[setNames] ) ensure_font_exists = function (font, path) { if (! all(file.exists(file.path(path, paste0(font, complete_font_set))))) { # Build font metrics extrafont$ttf_import(pattern = rx_escape(font)) } } rx_escape = function (regex) { # Adapted from <https://github.com/benjamingr/RegExp.escape> gsub('([\\\\^$*+?.()|[\\]{}])', '\\\\\\1', regex, perl = TRUE) } font_paths = function (font, path) { file.path(path, paste0(font, complete_font_set)) } make_font = function (name, basename, path) { ensure_font_exists(basename, path) Type1Font(name, font_paths(basename, path)) } #' Register a PDF/postscript font #' #' @param name the font name. #' @param basename the base filename used in the font metric filenames, if it #' differs from the \code{name}. #' @export register_font = function (name, basename = name) { font = make_font(name, basename, extrafontdb_path) font_args = setNames(list(font), name) # TODO: Should this be a parameter? do.call('pdfFonts', font_args) do.call('postscriptFonts', font_args) } #' Embed fonts into a generated plot file #' #' @param filename the filename of the plot file. #' @param format the format for the new file; see #' \code{\link[grDevices]{embedFonts}}. If not provided, \code{"eps2write"} is #' used for EPS files, \code{"ps2write"} for PS, and \code{"pdfwrite"} for PDF. #' @export embed = function (filename, format) { box::use(tools) if (missing(format)) { format = switch( tolower(tools$file_ext(filename)), eps = 'eps2write', ps = 'ps2write', pdf = 'pdfwrite' ) } fontmap = system.file('fontmap', package = 'extrafontdb') embedFonts( filename, format, filename, options = paste0('-I', shQuote(fontmap)) ) } .on_load = function(ns) { ns$extrafontdb_path = system.file('metrics', package = 'extrafontdb', mustWork = TRUE) ns$complete_font_set = paste0(c('-Regular', '-Bold', '-Italic', '-BoldItalic'), '.afm.gz') }
function [V,F] = engraving(im,w,t,s,l) % ENGRAVING Create an engraving of an image % % [V,F] = engraving(im,w,t,s) % % Inputs: % im width by height grayscale image % w desired width of engraving model (in mm) % t desired thickness of engraving model (in mm) % s desired span of thickness devoted to levels (in mm) % l number of levels % Outputs: % V #V by 3 list of vertex positions % F #F by 3 list of triangle indices % % Example: % % load image % im = imresize(rgb2gray(im2double(imread('hans-hass.jpg'))),0.5); % % pad image by 10% of width % im = padarray(im,ceil(0.1*repmat(size(im,2),1,2))); % % engrave: 50mm wide, 5mm thick, 1mm devoted to 4 layers % [V,F] = engraving(im,50,5,1,4); % assert(isfloat(im)); [V,F] = create_regular_grid(size(im,2),size(im,1),0,0); V(:,1) = V(:,1)*w; V(:,2) = (1-V(:,2))*size(im,1)/size(im,2)*w; [V,F] = extrude(V,F); V(:,3) = V(:,3)*t; V(1:numel(im),3) = V(1:numel(im),3)-s*round(im(:)*(l-1))/(l-1); end
#Regresion lineal #se cargan los datos colocando como parametros que los decimales seran separados por un "," data <- read.table("muestra_estudiantes.txt",header=TRUE) data #Nombre de columnas a ignorar para este experimento, calclulo de ignora pues es la salida deseada drops <- c("cant_mat","escuela","gestion_plantel","tipo_plantel","nivel_socioeco","nivel_estudios_padres","genero","opsu") #se descarta Cant_cats por tener correlacion poco significativa data <- data[ , !(names(data) %in% drops)] data pairs(data) cor(data) y <- data[,6] y x <- data[,1:5] x x11() par(mfrow=c(1,2)) plot(y,x[,1]) plot(y,x[,2]) x11() par(mfrow=c(1,2)) plot(y,x[,3]) plot(y,x[,4]) x11() par(mfrow=c(1,1)) plot(y,x[,5]) # mod1 <- lm(y ~ x[,1] + x[,2] + x[,3] + x[,4] + x[,5]) #Analsis de Modelo summary(mod1) # Other useful functions coefficients(mod1) # model coefficients confint(mod1, level=0.95) # CIs for model parameters fitted(mod1) # predicted values residuals(mod1) # residuals anova(mod1) # anova table vcov(mod1) # covariance matrix for model parameters influence(mod1) # regression diagnostics resi = residuals(mod1) #para la prueba de No normalidad shapiro.test(residuals(mod1)) #para la prueba de Homogenidad de los datos #crear un factor library(Rcmdr) fac=NULL for(i in 1:6){ fac=c(fac,rep(i,21))} fac levene.test(resi, fac) #Prueba de Aletoridad de los datos secu=c(seq(1,126)) x11() plot(secu,resi,col="red",type="l") abline(h = 0, v = 0, lty = 2, col = 4) # diagnostic plots layout(matrix(c(1,2,3,4),2,2)) # optional 4 graphs/page plot(mod1) ECM <- mean(resi^2) ECM
(* This program is free software; you can redistribute it and/or *) (* modify it under the terms of the GNU Lesser General Public License *) (* as published by the Free Software Foundation; either version 2.1 *) (* of the License, or (at your option) any later version. *) (* *) (* This program is distributed in the hope that it will be useful, *) (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) (* GNU General Public License for more details. *) (* *) (* You should have received a copy of the GNU Lesser General Public *) (* License along with this program; if not, write to the Free *) (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) (* 02110-1301 USA *) Set Implicit Arguments. Unset Strict Implicit. Require Export Sub_sgroup. Require Export Monoid_facts. Section Def. Variable G : MONOID. Section Sub_monoid. Variable H : subsgroup G. Hypothesis Hunit : in_part (monoid_unit G) H. Definition submonoid_monoid : monoid. apply (Build_monoid (monoid_sgroup:=H)). apply (Build_monoid_on (A:=H) (monoid_unit:=Build_subtype Hunit)). red in |- *. simpl in |- *. unfold subtype_image_equal in |- *. simpl in |- *. auto with algebra. red in |- *. simpl in |- *. unfold subtype_image_equal in |- *. simpl in |- *. auto with algebra. Defined. End Sub_monoid. Record submonoid : Type := {submonoid_subsgroup : subsgroup G; submonoid_prop : in_part (monoid_unit G) submonoid_subsgroup}. Definition monoid_of_submonoid (H : submonoid) := submonoid_monoid (submonoid_prop H). End Def. Coercion monoid_of_submonoid : submonoid >-> monoid. Coercion submonoid_subsgroup : submonoid >-> subsgroup. Section Injection. Variable G : MONOID. Variable H : submonoid G. Lemma submonoid_in_prop : in_part (monoid_unit G) H. apply (submonoid_prop (G:=G) H); auto with algebra. Qed. Definition inj_submonoid : Hom (H:MONOID) G. apply (Build_monoid_hom (E:=H) (F:=G) (monoid_sgroup_hom:=inj_subsgroup H)). red in |- *. auto with algebra. Defined. Lemma inj_subsmonoid_injective : injective inj_submonoid. red in |- *. auto with algebra. Qed. End Injection. Hint Resolve submonoid_in_prop inj_subsmonoid_injective: algebra.
lemma smallomega_iff_smallo: "g \<in> \<omega>[F](f) \<longleftrightarrow> f \<in> o[F](g)"
proposition seq_compact_imp_Heine_Borel: fixes S :: "'a :: metric_space set" assumes "seq_compact S" shows "compact S"
#include <libral/libral.hpp> #include <boost/nowide/iostream.hpp> #include <boost/nowide/args.hpp> #include <boost/filesystem.hpp> #include <leatherman/logging/logging.hpp> #include <leatherman/util/environment.hpp> #include <libral/emitter/puppet_emitter.hpp> #include <libral/emitter/json_emitter.hpp> #include <libral/emitter/quiet_emitter.hpp> #include <stdint.h> #include <iomanip> #include <config.hpp> // boost includes are not always warning-clean. Disable warnings that // cause problems before including the headers, then re-enable the warnings. #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wattributes" #ifdef HAS_SUGGEST_OVERRIDE # pragma GCC diagnostic ignored "-Wsuggest-override" #endif #include <boost/program_options.hpp> #pragma GCC diagnostic pop // We distinguish between failure to find something (EXIT_FAILURE) and // other errors (EXIT_ERROR) const static int EXIT_ERROR = 2; using namespace std; using namespace leatherman::logging; namespace lib = libral; namespace po = boost::program_options; using namespace leatherman::locale; namespace fs = boost::filesystem; namespace util = leatherman::util; namespace color { // Very poor man's output coloring. Call init() to fill these // with color escape sequences std::string cyan, green, yellow, red, magenta, blue, reset; void init() { if (isatty(1)) { cyan = "\33[0;36m"; green = "\33[0;32m"; yellow = "\33[0;33m"; red = "\33[0;31m"; magenta = "\33[0;35m"; blue = "\33[0;34m"; reset = "\33[0m"; } } } void help(po::options_description& desc) { const static std::string help1 = R"txt(Usage: ralsh [OPTION]... [TYPE [NAME [ATTRIBUTE=VALUE] ... ] ] Print resources managed by libral and modify them. The positional arguments make ralsh behave in the following way: ralsh : list all the types that libral knows about. ralsh TYPE : list all instances of TYPE ralsh TYPE NAME : list just TYPE[NAME] ralsh TYPE NAME ATTRIBUTE=VALUE ... : modify TYPE[NAME] by setting the provided attributes to the corresponding values. Print the resulting resource and a list of the changes that were made. Options: )txt"; const static std::string help2 = R"txt(Exit status: 0 on success 1 when no resource was found 2 when an error happened )txt"; boost::nowide::cout << help1 << desc << endl; boost::nowide::cout << help2 << endl; } static void print_attr_explanation(const std::string& name, const lib::attr::spec& attr, uint16_t maxlen) { cout << " " << color::green << left << setw(maxlen) << name << color::reset << " : " << attr.desc() << endl; cout << " " << left << setw(maxlen) << " " << " . kind = " << color::blue << attr.kind() << color::reset << endl; cout << " " << left << setw(maxlen) << " " << " . type = " << color::blue << attr.data_type() << color::reset << endl; } static void print_explanation(lib::provider& prov) { auto& spec = prov.spec(); if (!spec) { cerr << _("internal error: failed to get metadata for {1}", prov.qname()) << endl; return; } uint16_t maxlen = 0; for (auto a = spec->attr_begin(); a != spec->attr_end(); ++a) { if (a->first.length() > maxlen) maxlen = a->first.length(); } cout << color::magenta << _("Provider {1}", spec->qname()) << endl << " " << _("source: {1}", prov.source()) << color::reset << endl; cout << spec->desc() << endl; if (auto attr = spec->attr("name")) { print_attr_explanation("name", *attr, maxlen); } if (auto attr = spec->attr("ensure")) { print_attr_explanation("ensure", *attr, maxlen); } for (auto attr = spec->attr_begin(); attr != spec->attr_end(); attr++) { if (attr->first == "name" || attr->first == "ensure") { continue; } print_attr_explanation(attr->first, attr->second, maxlen); } } std::string progname(const char* argv0) { const char *progname = rindex(argv0, '/'); if (progname == NULL) { progname = argv0; } else { progname += 1; } return progname; } void append_to_env(const std::string& var, const fs::path& path) { std::string value; if (util::environment::get(var, value)) { util::environment::set(var, value + ":" + path.native()); } else { util::environment::set(var, path.native()); } } void use_fixed_layout(const char *argv0, const std::string& progname) { #ifdef USE_FIXED_LAYOUT auto topdir = fs::canonical(fs::path(argv0).parent_path().parent_path()); append_to_env("RALSH_DATA_DIR", (topdir / "data").native()); append_to_env("RALSH_LIBEXEC_DIR", (topdir / "bin").native()); if (progname == "mruby" || progname == "mirb") { append_to_env("AUGEAS_LENS_LIB", (topdir / "data/lenses").native()); } #endif } extern "C" { int prog_mruby(int argc, char **argv); int prog_mirb(int argc, char **argv); } int main(int argc, char **argv) { std::string name = progname(argv[0]); use_fixed_layout(argv[0], name); if (name == "mruby") { return prog_mruby(argc, argv); } else if (name == "mirb") { return prog_mirb(argc, argv); } try { // Fix args on Windows to be UTF-8 boost::nowide::args arg_utf8(argc, argv); // Setup logging setup_logging(boost::nowide::cerr); color::init(); po::options_description command_line_options(""); command_line_options.add_options() ("explain,e", "print an explanation of TYPE, which must be provided") ("target,t", po::value<std::string>(), "run commands on target TARGET (ssh only)") ("sudo,s", "use sudo when running on a target") ("keep,k", "keep the tempdir on a target") ("help,h", "produce help message") ("include,I", po::value<std::vector<std::string>>(), "search directory '$arg/providers' for providers.") ("log-level,l", po::value<log_level>()->default_value(log_level::warning, "warn"), "Set logging level.\nSupported levels are: none, trace, debug, info, warn, error, and fatal.") ("json,j", "produce JSON output") ("quiet,q", "suppress all normal output") ("absent,a", "consider resources with ensure=absent as missing") ("version", "print the version and exit"); po::options_description all_options(command_line_options); /* Positional options */ all_options.add_options() ("type", po::value<std::string>()) ("name", po::value<std::string>()) ("attr-value", po::value<std::vector<std::string>>()); po::positional_options_description positional_options; positional_options.add("type", 1); positional_options.add("name", 1); positional_options.add("attr-value", -1); po::variables_map vm; try { po::store(po::command_line_parser(argc, argv). options(all_options). positional(positional_options).run(), vm); if (vm.count("help")) { help(command_line_options); return EXIT_SUCCESS; } po::notify(vm); } catch (exception& ex) { colorize(boost::nowide::cerr, log_level::error); boost::nowide::cerr << "error: " << ex.what() << "\n" << endl; colorize(boost::nowide::cerr); boost::nowide::cerr << "try 'ralsh -h' for more information." << endl; return EXIT_ERROR; } // Get the logging level auto lvl = vm["log-level"].as<log_level>(); set_level(lvl); if (vm.count("version")) { boost::nowide::cout << libral::version() << endl; return EXIT_SUCCESS; } bool explain = vm.count("explain"); bool err_on_absent = vm.count("absent"); if (explain && vm.count("json")) { boost::nowide::cerr << "error: " << "you can not specify --json and --explain at the same time" << endl; boost::nowide::cerr << "error: " << "running 'ralsh --json' will contain explanations for all providers" << endl; } if ((vm.count("sudo") || vm.count("keep")) && ! vm.count("target")) { boost::nowide::cerr << color::yellow << "warning: using --keep or --sudo without --target has no effect" << color::reset << endl; } // Figure out our include path std::vector<std::string> data_dirs; if (vm.count("include")) { data_dirs = vm["include"].as<std::vector<std::string>>(); } // Do the actual work auto ral = lib::ral::create(data_dirs); if (vm.count("target")) { auto target = vm["target"].as<std::string>(); auto res = ral->connect(target, vm.count("sudo"), vm.count("keep")); if (res.is_err()) { boost::nowide::cerr << color::red << _("failed to connect to {1}", target) << endl << res.err().detail << color::reset << endl; return EXIT_ERROR; } } std::unique_ptr<lib::emitter> emp; if (vm.count("quiet")) { emp = std::unique_ptr<lib::emitter>(new lib::quiet_emitter()); } else if (vm.count("json")) { emp = std::unique_ptr<lib::emitter>(new lib::json_emitter()); } else { emp = std::unique_ptr<lib::emitter>(new lib::puppet_emitter()); } lib::emitter& em = *emp; if (vm.count("type")) { // We have a type name auto type_name = vm["type"].as<std::string>(); auto opt_prov = ral->find_provider(type_name); if (opt_prov == boost::none) { boost::nowide::cout << color::red << _("unknown provider: '{1}'", type_name) << color::reset << endl; boost::nowide::cout << _("run 'ralsh' to see a list of all providers") << color::reset << endl; return EXIT_ERROR; } auto& prov = **opt_prov; if (explain) { print_explanation(prov); return EXIT_SUCCESS; } if (vm.count("name")) { // We have a resource name auto name = vm["name"].as<std::string>(); if (vm.count("attr-value")) { // We have attributes, modify resource auto av = vm["attr-value"].as<std::vector<std::string>>(); lib::resource should = prov.create(name); for (const auto& arg : av) { auto found = arg.find("="); if (found != string::npos) { auto attr = arg.substr(0, found); auto value = prov.parse(attr, arg.substr(found+1)); if (value) { should[attr] = value.ok(); } else { boost::nowide::cerr << color::red << _("failed to read attribute {1}: {2}", attr, value.err().detail) << color::reset << endl; boost::nowide::cerr << _("run 'ralsh -e {1}' to get a list of attributes and valid values", prov.qname()) << endl; return EXIT_ERROR; } } } auto res = prov.set({ should }); em.print_set(prov, res); if (!res) { return EXIT_ERROR; } } else { // No attributes, dump the resource auto inst = prov.find(name); em.print_find(prov, inst); if (!inst) { return EXIT_ERROR; } if (! inst.ok() || (err_on_absent && (*inst.ok())["ensure"] == lib::value("absent"))) { return EXIT_FAILURE; } } } else { // No resource name, dump all resources of the provider auto insts = prov.get(); em.print_list(prov, insts); if (!insts) { return EXIT_ERROR; } } } else { if (explain) { boost::nowide::cout << color::red << _("please provide a type") << color::reset << endl; boost::nowide::cout << _("run 'ralsh' to see a list of all types") << color::reset << endl; return EXIT_ERROR; } // No type given, list known providers auto provs = ral->providers(); em.print_providers(provs); } } catch (domain_error& ex) { colorize(boost::nowide::cerr, log_level::fatal); boost::nowide::cerr << _("unhandled exception: {1}\n", ex.what()) << endl; colorize(boost::nowide::cerr); return EXIT_ERROR; } return error_has_been_logged() ? EXIT_ERROR : EXIT_SUCCESS; }
function packit(ti) tbname, tbio = mktemp(cleanup = false) mktempdir(SystemPath) do path rowi = NamedTuple(ti) tbl = merge(rowi, (resfile = basename(rowi.resfile), poi_videofile = basename(rowi.poi_videofile), calib_videofile = basename(rowi.calib_videofile))) CSV.write(joinpath(path, "csvfile.csv"), [tbl]) cp(rowi.resfile, joinpath(path, basename(rowi.resfile))) map(unique((rowi.poi_videofile, rowi.calib_videofile))) do file cp(file, joinpath(path, basename(file))) end Tar.create(string(path), tbio) close(tbio) @info "an error has occurred! please send me this file:" tbname end end function debugging(ti, ex::Exception) packit(ti) throw(ex) end debugging(csvfile, i::Int; delim = nothing) = packit(loadcsv(csvfile, delim)[i]) function debug(tbname) Memoization.empty_all_caches!(); tmp = pwd() for file in readdir(tmp, join = true) if last(splitext(file)) ≠ ".toml" rm(file, force = true, recursive = true) end end tbname = download(tbname) files = Tar.extract(tbname) map(readdir(files, join = true)) do file mv(file, joinpath(tmp, basename(file))) end process_csv("csvfile.csv") end