text
stringlengths 0
3.34M
|
---|
////////////////////////////////////////////////////////////////////////////////////////////////////
// case.hpp
// Contains the behavior of proto::case when used as a grammar element.
//
// Copyright 2012 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROTO_V5_GRAMMAR_CASE_HPP_INCLUDED
#define BOOST_PROTO_V5_GRAMMAR_CASE_HPP_INCLUDED
#include <boost/proto/v5/proto_fwd.hpp>
#include <boost/proto/v5/tags.hpp>
#include <boost/proto/v5/matches.hpp>
#include <boost/proto/v5/grammar/basic_grammar.hpp>
namespace boost
{
namespace proto
{
inline namespace v5
{
namespace extension
{
////////////////////////////////////////////////////////////////////////////////////
// case_
template<typename Grammar, typename ...Actions>
struct grammar_impl<proto::v5::case_(Grammar, Actions...)>
{
template<typename Expr>
struct apply
: result_of::matches<Expr, Grammar>
{};
};
////////////////////////////////////////////////////////////////////////////////////
// default_
template<typename ...Actions>
struct grammar_impl<proto::v5::default_(Actions...)>
{
template<typename Expr>
struct apply
: std::true_type
{};
};
}
}
}
}
#endif
|
module FFI.MachineWord where
import Lvl
open import Data.Boolean
open import Numeral.Natural
open import String
open import Syntax.Number
open import Type
postulate Word64 : Type{Lvl.π}
{-# BUILTIN WORD64 Word64 #-}
private
module Primitives where
primitive primWord64ToNat : Word64 β β
primitive primWord64FromNat : β β Word64
module Word64 where
open Primitives renaming
( primWord64ToNat to toβ
; primWord64FromNat to fromβ
) public
instance
Word64-infiniteNumeral : InfiniteNumeral(Word64)
Word64-infiniteNumeral = InfiniteNumeral.intro fromβ
|
program ifst;
var ch : char;
begin
readln(ch);
if ch = 'a' then
writeln('It is ''a'' ')
else
writeln('It is not ''a'' ')
end. |
If each set in a nonempty collection of sets is compact, then the intersection of the collection is compact. |
{-# OPTIONS --cubical #-}
open import Cubical.Core.Everything
Sq : {A : Set} {a0 a1 b0 b1 : A}
(u : a0 β‘ a1) (v : b0 β‘ b1)
(r0 : a0 β‘ b0) (r1 : a1 β‘ b1)
β Set
Sq u v r0 r1 = PathP (Ξ» i β r0 i β‘ r1 i) u v
ConstSq : {A : Set} {a : A} (p : a β‘ a) β
Sq p p p p
ConstSq {A} p i j = compCCHM (Ξ» _ β A)
(~ i β¨ i β¨ ~ j β¨ j)
(Ξ» k β Ξ» { (i = i0) β p j
; (i = i1) β p (k β§ j)
; (j = i0) β p i
; (j = i1) β p (k β§ i)
})
(p (i β¨ j))
|
Require Export GeoCoq.Elements.OriginalProofs.lemma_angletrichotomy.
Require Export GeoCoq.Elements.OriginalProofs.proposition_18.
Require Export GeoCoq.Elements.OriginalProofs.lemma_trichotomy1.
Section Euclid.
Context `{Ax:euclidean_neutral_ruler_compass}.
Lemma proposition_19 :
forall A B C,
Triangle A B C -> LtA B C A A B C ->
Lt A B A C.
Proof.
intros.
assert (nCol A B C) by (conclude_def Triangle ).
assert (nCol B C A) by (forward_using lemma_NCorder).
assert (nCol A C B) by (forward_using lemma_NCorder).
assert (~ Cong A C A B).
{
intro.
assert (Cong A B A C) by (conclude lemma_congruencesymmetric).
assert (isosceles A B C) by (conclude_def isosceles ).
assert (CongA A B C A C B) by (conclude proposition_05).
assert (CongA A C B A B C) by (conclude lemma_equalanglessymmetric).
assert (CongA B C A A C B) by (conclude lemma_ABCequalsCBA).
assert (CongA B C A A B C) by (conclude lemma_equalanglestransitive).
assert (LtA B C A B C A) by (conclude lemma_angleorderrespectscongruence).
assert (~ LtA B C A B C A) by (conclude lemma_angletrichotomy).
contradict.
}
assert (~ Lt A C A B).
{
intro.
assert (Triangle A C B) by (conclude_def Triangle ).
assert (LtA C B A A C B) by (conclude proposition_18).
assert (CongA A B C C B A) by (conclude lemma_ABCequalsCBA).
assert (LtA A B C A C B) by (conclude lemma_angleorderrespectscongruence2).
assert (CongA B C A A C B) by (conclude lemma_ABCequalsCBA).
assert (LtA A B C B C A) by (conclude lemma_angleorderrespectscongruence).
assert (~ LtA A B C B C A) by (conclude lemma_angletrichotomy).
contradict.
}
assert (CongA A B C A B C) by (conclude lemma_equalanglesreflexive).
assert (neq A B) by (forward_using lemma_angledistinct).
assert (neq A C) by (forward_using lemma_angledistinct).
assert (~ ~ Lt A B A C).
{
intro.
assert (Cong A B A C) by (conclude lemma_trichotomy1).
assert (Cong A C A B) by (conclude lemma_congruencesymmetric).
contradict.
}
close.
Qed.
End Euclid.
|
Sky News correspondent Nick Martin gave three pieces of advice to those looking to get into mobile reporting at news:rewired β media in motion.
He identified how essential it is that journalists are engaging in mobile reporting and shared some of his experiences reporting from various stories using just an iPhone, including the London Riots.
Nick Martin also highlighted the importance of investigating accessories that can be added to enhance the quality of video and sound. One example he showed was an adapter to be able to plug in an XLR cable to record high quality audio.
Martinβs one big piece of advice is to practise. The key to getting better with mobile reporting is to βtake the rough with the smoothβ.
He also advised beginners not to panic. While it can seem daunting at times, Martin showcased examples where there was no choice but for reporters to get involved with recording video from their mobiles, such as when reporting from numerous locations on one story with only one cameraman. Martin told a story of how he was covering the deportation of two buses of illegal immigrants in America with one cameraman. They each went on one bus and it was his bus that gave the more interesting story β βlike a scene from Scarfaceβ. Martin was left with no choice but to use his iphone footage.
Martinβs final piece of advice was to use mobile reporting only when it was appropriate. He said it is not worth setting up a tripod and XLR cables for an iPhone when the cameraman is just five minutes away and time could be much better spent working out the story and what has happened. |
[STATEMENT]
lemma fun_dual8: "(f = (`) \<partial> \<circ> g \<circ> \<partial>) = ((`) \<partial> \<circ> f \<circ> \<partial> = g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (f = (`) \<partial> \<circ> g \<circ> \<partial>) = ((`) \<partial> \<circ> f \<circ> \<partial> = g)
[PROOF STEP]
by (simp add: comp_assoc fun_dual1 fun_dual4) |
"""Return the indices of the elements that are non-zero."""
from __future__ import annotations
from typing import Any, Tuple
import numpy
import numpoly
from ..baseclass import PolyLike
from ..dispatch import implements
@implements(numpy.nonzero)
def nonzero(x: PolyLike, **kwargs: Any) -> Tuple[numpy.ndarray, ...]:
"""
Return the indices of the elements that are non-zero.
Args:
x:
Input array.
Returns:
Indices of elements that are non-zero.
Examples:
>>> q0, q1 = numpoly.variable(2)
>>> poly = numpoly.polynomial([[3*q0, 0, 0],
... [0, 4*q1, 0],
... [5*q0+q1, 6*q0, 0]])
>>> poly
polynomial([[3*q0, 0, 0],
[0, 4*q1, 0],
[q1+5*q0, 6*q0, 0]])
>>> numpoly.nonzero(poly)
(array([0, 1, 2, 2]), array([0, 1, 0, 1]))
>>> poly[numpoly.nonzero(poly)]
polynomial([3*q0, 4*q1, q1+5*q0, 6*q0])
"""
x = numpoly.aspolynomial(x)
return numpy.nonzero(numpy.any(numpy.asarray(x.coefficients), axis=0))
|
using BlackBoxOptim: MutationClock, apply, PolynomialMutation
count_mutations(origvector, mutatedvector) = sum(origvector .!= mutatedvector)
describe("count_mutations") do
test("counts changes") do
@check count_mutations([0,0], [0,0]) == 0
@check count_mutations([0,0], [1,0]) == 1
@check count_mutations([0,0], [0,1]) == 1
@check count_mutations([0,0], [1,1]) == 2
@check count_mutations([0,1], [1,1]) == 1
@check count_mutations([1,1], [1,1]) == 0
@check count_mutations([0.0, 0.0], [1.8, 0.0]) == 1
@check count_mutations([0.0, 11.32], [1.8, 0.0]) == 2
end
end
describe("Mutation Clock genetic operator") do
@repeat test("expected number of mutations are done (if passed vectors of same size)") do
probmutate = rand(0.000001:0.001:1.0)
pmut = PolynomialMutation(0.0, 1.0)
mc = MutationClock(pmut, probmutate)
size = rand(1:100)
# Now apply mutation clock operator to a large number of vectors and count the total
# number of mutations
nmutations = 0
nreps = 100
for i in 1:nreps
vector = rand(size)
nmutations += count_mutations(vector, apply(mc, copy(vector)))
end
# Not sure why the interval must be so wide. Seems we always get lower than the
# expected number of mutations.
nexpected = probmutate * size * nreps
@check ifloor(0.50 * nexpected) <= nmutations <= iceil(1.50 * nexpected)
end
end |
\input{SingleAssignmentSetup.tex}
\input{../WeekTitles.tex}
\begin{document}
\begin{center}
\subsection*{MNTC P01 - Week \#7 - \WeekTitleSeven}
\end{center}
\begin{enumerate}
\subsection*{Verifying Solutions}
% ******************************
\item
\begin{Question} %9.1 - 1
Show that $\ds y = \frac{2}{3}\text{e}^{x} + \text{e}^{-2x}$ is a solution of the differential equation $y' + 2y = 2\text{e}^{x}$. \\
\end{Question}
% 1 - Solution
\begin{Solution}
\begin{equation*}
y = \frac{2}{3}\text{e}^{x} + \text{e}^{-2x} \Rightarrow
y' = \frac{2}{3}\text{e}^{x} - 2\text{e}^{-2x}
\end{equation*}
To show that $y$ is a solution of the differential equation, we will substitute the expressions for $y$ and $y'$ in the left-hand side of the equation and show that the left-hand side of the equation and show that the left-hand side is equal to the right-hand side.
\begin{align*}
\text{LHS} &= y' + 2y = \frac{2}{3}\text{e}^{x} - 2\text{e}^{-2x} + 2(\frac{2}{3}\text{e}^{x} + \text{e}^{-2x}) \\
&= \frac{2}{3}\text{e}^{x} - 2\text{e}^{-2x} +
\frac{4}{3}\text{e}^{x} + 2\text{e}^{-2x} =
\frac{6}{3}\text{e}^{x} = 2\text{e}^{x} \\
&= \text{RHS}
\end{align*}
\end{Solution}
%%%%%%%%%%%%%%%%%%
%9.1 - 3
\item
\begin{Question}
\begin{enumerate}[(a)]
\item For what values of $r$ does the function $y = \text{e}^{rx}$ satisfy the differential equation $2y'' + y' - y = 0$?
\item If $r_1$ and $r_2$ are the values of $r$ that you found in part (a), show that every member of the family of functions $y = a\text{e}^{r_{1}x} + b\text{e}^{r_{2}x}$ is also a solution.
\end{enumerate}
\end{Question}
\begin{Solution}
\begin{enumerate}[(a)]
\item \begin{equation*}
y = \text{e}^{rx} \Rightarrow
y' = r\text{e}^{rx} \Rightarrow
y'' = r^2\text{e}^{rx}
\end{equation*}
Substituting these expressions into the differential equation
$2y'' + y' - y = 0$, we get
\begin{align*}
&2r^2\text{e}^{rx} + r\text{e}^{rx} - \text{e}^{rx} = 0 \\
\Rightarrow \quad &(2r^2 + r - 1)\text{e}^{rx} = 0 \\
\Rightarrow \quad &(2r - 1)(r + 1) = 0
\end{align*}
(since $\text{e}^{rx}$ is never zero) $r = \frac{1}{2}$ or -1.
\item Let $r_1 = \frac{1}{2}$ and $r_2 = -1$, so we need to show that every member of the family of functions $y = a\text{e}^{x/2} + b\text{e}^{-x}$ is a solution of the differential equation $2y'' + y' - y = 0$.\\
\begin{align*}
&y = a\text{e}^{x/2} + b\text{e}^{-x} \\
\Rightarrow \quad &y' = \frac{1}{2}a\text{e}^{x/2} - b\text{e}^{-x}\\
\Rightarrow \quad &y'' = \frac{1}{4}a\text{e}^{x/2} + b\text{e}^{-x}
\end{align*}
\begin{align*}
\text{LHS} &= 2y'' + y' - y \\
&= 2(\frac{1}{4}a\text{e}^{x/2} + b\text{e}^{-x}) + (\frac{1}{2}a\text{e}^{x/2} - b\text{e}^{-x}) \\ & \hspace{4mm}- (a\text{e}^{x/2} + b\text{e}^{-x}) \\
&= \frac{1}{2}a\text{e}^{x/2} + 2b\text{e}^{-x} + \frac{1}{2}a\text{e}^{x/2} - b\text{e}^{-x} \\
& \hspace{4mm}- a\text{e}^{x/2} - b\text{e}^{-x} \\
&= (\frac{1}{2}a + \frac{1}{2}a - a)\text{e}^{x/2} + (2b - b -b)\text{e}^{-x} \\
&= 0 \\ &= \text{RHS}
\end{align*}
\end{enumerate}
\end{Solution}
%%%%%%%%%%%%%%%%%%
%9.1 - 4
\item
\begin{Question}
\begin{enumerate}[(a)]
\item For what values of $k$ does the function $y = \cos(kt)$ satisfy
the differential equation $4y'' = -25y$?
\item For those values of $k$, verify that every member of the vamily of functions $y = A\sin kt + B\cos kt$ is also a solution.
\end{enumerate}
\end{Question}
\begin{Solution}
\begin{enumerate}[(a)]
\item \begin{equation*}
y = \cos kt \ \Rightarrow \ y' = -k \sin kt \ \Rightarrow \ y'' = -k^2 \cos kt
\end{equation*}
Substituting expressions into the differential equation $4y'' = -25y$, we get
\begin{align*}
&4(-k^2\cos kt) = -25(\cos kt) \\
\Rightarrow \quad &(25 - 4k^2) \cos kt = 0 (\text{for all } t)\\
\Rightarrow \quad &25 - 4k^2 = 0 \\
\Rightarrow \quad &k^2 = \frac{25}{4} \ \Rightarrow \ k = \pm \frac{5}{2}
\end{align*}
\item \begin{align*}
&y = A\sin kt + B \cos kt \\
\Rightarrow \quad &y' = Ak\cos kt - Bk \sin kt \\
\Rightarrow \quad &y'' = -Ak^2 \sin kt - Bk^2 \cos kt
\end{align*}
The given differential equation $4y'' = -25y$ is equivalent to $4y'' + 25y = 0$. Thus,
\begin{align*}
\text{LHS} &= 4y'' + 25y \\
&= 4(-Ak^2 \sin kt - Bk^2 \cos kt) \\
& \quad + 25(A\sin kt + B\cos kt) \\
&= -4Ak^2 \sin kt - 4Bk^2 \cos kt \\
& \quad+ 25A\sin kt + 25B \cos kt \\
&= (25 - 4k^2)A\sin kt + (25 - 4k^2)B\cos kt \\
&= 0 \hspace{4mm} \text{since } k^2 = \frac{25}{4}
\end{align*}
\end{enumerate}
\end{Solution}
%%%%%%%%%%%%%%%%%%
%9.1 - 7
\item
\begin{Question}
Consider the differential equation $\ds \frac{dy}{dx} = -y^2$.
\begin{enumerate}[(a)]
\item If you were asked whether the solutions to this equation would
{\em increase} or {\em decrease} as $x$ increased, what could you
say based on only the equation itself?
\item Verify that all members of the family $y = 1/(x + C)$ are
solutions of the equation in part (a).
\item Can you think of a (very simple) solution of the differential
equation $y' = -y^2$ that is {\em not} a member of the family in
part (b)?
\item Find the solution to the initial-value problem
\begin{equation*}
y' = -y^2 \hspace{6mm} y(0) = 0.5
\end{equation*}
\end{enumerate}
\end{Question}
\begin{Solution}
\begin{enumerate}[(a)]
\item Since the derivative of $y' = -y^2$ is always negative (or 0 if
$y = 0$), the function $y$ must be {\bf decreasing} (or maybe
horizontal) on any interval on which it is defined.
\item We sub in the proposed solution into the original equation. To do this, we will need the derivative of $y$: $\ds y = \frac{1}{x + C} \Rightarrow y' = -\frac{1}{(x + C)^2}$.\\
$\text{LHS} = y' = -\frac{1}{(x + C)^2} = -\left(\frac{1}{x + C}
\right)^2 = -y^2 = \text{RHS}$ Therefore, any function of the form
$y(x) = \frac{1}{x+C}$ {\bf is} a solution to $y' = -y^2$.
\item $y=0$ is a simple solution to $y'=-y^2$ that is not a member of
the family in part (b). We can confirm this by subbing $y=0$ into
the DE and checking the LHS equals the RHS. If $y=0$, then $y'= 0$
as well, so $\text{LHS} = y' = 0 = -y^2 = RHS$.
\item We already know that the solutions will be of the form
$y(x) = \frac{1}{x+C}$; we just need to sub in the initial value to
solve for $C$.
If $y(x) = \frac{1}{x + C}$, then
$y(0) = \frac{1}{0 + C} = \frac{1}{C}$. Since $y(0) = 0.5$,
$\frac{1}{C} \frac{1}{2} \Rightarrow C = 2$, so $y =\frac{1}{x + 2}$
\end{enumerate}
\end{Solution}
%%%%%%%%%%%%%%%%%%
\hrulefill
\subsection*{Numerical ODE Solutions With MATLAB}
%*******************************
\item
\begin{Question}
Create a plot for the solution to the differential equation
$y' - \frac{y^2}{x^3} = 0$ if y(2) = 1. Include a large enough
\verb#xspan# to see the long-term behaviour.
\end{Question}
\begin{Solution}
For this first example of use MATLAB to build a numerical solution
to a DE, we will show the full listing of a script that generates a
solution to the given differential equation. In later solutions, we
will only include the key lines for the MATLAB script.
Notes:
\begin{itemize}
\item We set \verb#xspan# to start at 2 in the line
\verb#xspan = [2, 30]#. This is used because the solution MATLAB
is generating will start at the coordinates $x_0$ = first element
of \verb#xspan#, and $y_0$ = \verb#y0# in the code, and our
initial condition is $x = 2$, $y=1$.
\item We find the second value in the time span with some trial and
error. Any value larger than 15 or 20 would be sufficient to show
the long-term trend in the solution.
\end{itemize}
\lstinputlisting[showstringspaces=false]{MATLAB/W07DE01.m}
Link to the MATLAB code: \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W07DE01.m}{W07DE01.m}
Here is the graph of the solution.
\includegraphics[width = 0.5\linewidth]{graphics/Week07_DESolutions/W07DE01}
\end{Solution}
%*******************************
\item
\begin{Question}
Create a plot for the solution to the differential equation
$(2y - 4)y' - 3x^2 = 4x - 4$, if y(1) = 3.
\end{Question}
\begin{Solution}
To generate a first-order DE solution in MATLAB, the differential
equation must be written first in the form $y' = \ldots$.
\begin{align*}
(2y - 4)y' - 3x^2 & = 4x - 4 \\
(2y - 4)y' & = 3x^2 +4x - 4 \\
y' & = \frac{(3x^2 +4x - 4)}{(2y - 4)} \\
\end{align*}
Link to the MATLAB code: \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W07DE02.m}{W07DE02.m}
Here is the graph of the solution.
\includegraphics[width = 0.5\linewidth]{graphics/Week07_DESolutions/W07DE02}
\end{Solution}
%*******************************
\item
\begin{Question}
Create a plot for the solution to the differential equation
$y' = e^{-y}(2t - 4)$ if $y(0) = 5$
\end{Question}
\begin{Solution}
This DE is already in the form $y' = \ldots$, so we can input it
into MATLAB as-is. Note that the independent variable in this
example is $t$, so we will use that in MATLAB instead of the
variable $x$.
Link to the MATLAB code: \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W07DE03.m}{W07DE03.m}
Here is the graph of the solution.
\includegraphics[width = 0.5\linewidth]{graphics/Week07_DESolutions/W07DE03}
\end{Solution}
%*******************************
\item
\begin{Question}
Create a plot for the solution to the differential equation
$ty' - 2y = t^5 \sin (2t) - t^3 + 4t^4$, if
$y(\pi) = \frac{3}{2}\pi^4$
\end{Question}
\begin{Solution}
To generate a first-order DE solution in MATLAB, the differential
equation must be written first in the form $y' = \ldots$.
\begin{align*}
ty' - 2y & = t^5 \sin (2t) - t^3 + 4t^4 \\
ty' & = 2y + t^5 \sin(2t) - t^3 + 4t^4 \\
y' & = \frac{1}{t} (2y + t^5 \sin(2t) - t^3 + 4t^4) \\
\end{align*}
Link to the MATLAB code: \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W07DE04.m}{W07DE04.m}
Here is the graph of the solution.
\includegraphics[width = 0.5\linewidth]{graphics/Week07_DESolutions/W07DE04}
Note that in this example, because of the $\sin(2t)$ introducing an
oscillation in the system, the solution won't look at simple as some
of the other examples.
\end{Solution}
%*******************************
\item
\begin{Question}
Create a plot for the solution to the differential equation
$ty' + 2y = t^2 - t + 1$, if $y(1) = 0.5$.
\end{Question}
\begin{Solution}
To generate a first-order DE solution in MATLAB, the differential
equation must be written first in the form $y' = \ldots$.
\begin{align*}
ty' + 2y = t^2 - t + 1 \\
ty' = -2y + t^2 - t + 1 \\
y' = \frac{1}{t} (-2y + t^2 - t + 1) \\
\end{align*}
Link to the MATLAB code: \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W07DE05.m}{W07DE05.m}
Here is the graph of the solution.
\includegraphics[width = 0.5\linewidth]{graphics/Week07_DESolutions/W07DE05}
\end{Solution}
%*******************************
\item
\begin{Question}
Create a plot for the solution to the differential equation
$2xy^2 + 4 = 2(3 - x^2y)y'$ if $y(5) = 8$.
\end{Question}
\begin{Solution}
To generate a first-order DE solution in MATLAB, the differential
equation must be written first in the form $y' = \ldots$. We start
by switching both sides of the equation to put $y'$ on the left.
\begin{align*}
2(3 - x^2y)y' & = 2xy^2 + 4 \\
y' & = \frac{ 2xy^2 + 4}{2 (3-x^2 y)}
\end{align*}
Link to the MATLAB code: \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W07DE06.m}{W07DE06.m}
Here is the graph of the solution.
\includegraphics[width = 0.5\linewidth]{graphics/Week07_DESolutions/W07DE06}
\end{Solution}
\end{enumerate}
\end{document}
|
module module_scf
implicit none
! Convergence
double precision :: dE = 0.0d0
logical :: SCFconv = .false.
contains
!#############################################
!# Run SCF Loop
!#############################################
subroutine run_SCF(DoPrint)
use module_data, only : MaxSCF,Damp,doSCGKT,dim_1e,Fock,doGKSCF,doFTSCF,Occ,Spins,ResetOcc
use module_energy, only : Eold,calc_Energy,Etot,Eelec,E1e,E2e
use module_wavefun, only : ort_Fock,dia_Fock,deort_Fock
use module_wavefun, only : calc_Dens,calc_Fock
use module_wavefun, only : Drmsd
use module_wavefun, only : Fock_to_MO,Fock_to_AO,Semicanonical
use module_occupy, only : run_corrF,calc_GKT
use module_trans, only : trans_full
use module_io, only : print_Mat,print_Vec,print_SVec
implicit none
integer :: iSCF
real :: time, starttime
logical, intent(IN) :: DoPrint
starttime=secnds(0.0)
if(DoPrint)then
write(*,*) ""
write(*,*) " starting SCF ..."
write(*,*) ""
write(*,*) " # Etot dE Drmsd Damp"
endif
SCFconv = .false.
dE = 0.0d0
do iSCF=1,MaxSCF
if(doGKSCF .or. doFTSCF)then
call set_Occupations()
endif
Eold = Etot
call ort_Fock()
call dia_Fock()
call deort_Fock()
call calc_Dens()
call calc_Energy()
! call calc_DynDamp()
dE = Etot - Eold
! iSCF Etot dE Drmsd
if(DoPrint)then
write(*,'(" SCF ",I5," ",3(F18.10," "),F5.2)') iSCF, Etot, dE, Drmsd, Damp
endif
call check_Conv(DoPrint)
if(SCFconv .or. (iSCF==MaxSCF-1) ) exit
call calc_Fock()
if(doSCGKT .and. abs(dE)<1.0d-10)then
call Fock_to_MO()
call SemiCanonical()
call Fock_to_AO()
call trans_full(.false.)
call calc_GKT(.false.)
call run_corrF(.true.)
endif
enddo
if(.not.SCFconv)then
write(*,*) ""
write(*,*) " (!) Warning: The SCF seems to be lost in a kafkaesque nightmare and has NOT converged (!)"
write(*,*) ""
endif
if(ResetOcc)then
if(DoPrint)then
write(*,*) " Resetting MO occupations to integer numbers "
endif
call Reset_Occupations()
call Calc_Dens()
call Calc_Fock()
call Fock_to_MO()
call SemiCanonical()
call Fock_to_AO()
call Calc_Energy()
else
if(doGKSCF .or. doFTSCF)then
call set_Occupations()
endif
endif
if(DoPrint)then
write(*,*) " E1e =",E1e
write(*,*) " E2e =",E2e
write(*,*) " Eelec =",Eelec
write(*,*) " Final Etot =",Etot
if(Spins==1)then
call print_Vec(Occ(:,1),dim_1e,18,"Occupation Numbers")
elseif(Spins==2)then
call print_SVec(Occ(:,:),dim_1e,18,"Occupation Numbers")
endif
endif
time=secnds(starttime)
if(DoPrint)then
write(*,*) " SCF done in ",time," s"
endif
! call Fock_to_MO()
! call print_Mat(Fock(:,:,1),dim_1e,7,"MO Fock")
! call print_Mat(Fock(:,:,2),dim_1e,7,"MO Fock")
! call SemiCanonical()
! call print_Mat(Fock(:,:,1),dim_1e,7,"MO Fock")
! call print_Mat(Fock(:,:,2),dim_1e,7,"MO Fock")
! call Fock_to_AO()
end subroutine run_SCF
!#############################################
!# Recalculate WF non-SCF
!#############################################
subroutine recalc_WF()
use module_data, only : MaxSCF
use module_energy, only : Eold,calc_Energy,Etot,Eelec
use module_wavefun, only : ort_Fock,dia_Fock,deort_Fock
use module_wavefun, only : calc_Dens,calc_Fock
implicit none
write(*,*) ""
write(*,*) " non-SCF recalculation of WF ..."
write(*,*) ""
Eold = Etot
call calc_Dens()
call calc_Fock()
call ort_Fock()
call dia_Fock()
call deort_Fock()
call calc_Dens()
call calc_Energy()
dE = Etot - Eold
! iSCF Etot dE Drmsd
write(*,'(" Modified WF: "," ",2(F18.10," "))') Etot, dE
! write(*,*) " Eelec=",Eelec
! write(*,*) " Final Etot=",Etot
end subroutine recalc_WF
!#############################################
!# Check Convergence
!#############################################
subroutine check_Conv(DoPrint)
use module_data, only : Econv
use module_data, only : Dconv
use module_data, only : DoDamp, Damp,DampTol
use module_energy, only : Eelec, Etot
use module_wavefun, only : Drmsd
implicit none
logical, intent(IN) :: DoPrint
if(abs(dE) < 1.0d-2 .and. Damp /= 1.0d0 &
.and. Damp /= 0.7d0 &
.and. DoDamp)then
Damp = 0.7d0
if(DoPrint)then
write(*,*) " Damping set to 0.7"
endif
endif
if(abs(dE) < DampTol .and. Damp /= 1.0d0 &
.and. DoDamp)then
Damp = 1.0d0
DoDamp =.false.
if(DoPrint)then
write(*,*) " Damping turned off"
endif
endif
if(Drmsd<Dconv .and. abs(dE)<Econv)then
if(DoPrint)then
write(*,*) " "
write(*,*) " SCF converged (hurra)!"
write(*,*) " "
!if(.true.)then
! call print_TB()
!endif
!call print_Mat(Fock(:,:,1),dim_1e,7,"AO Fock")
endif
! write(*,*) " Eelec=",Eelec
! write(*,*) " Final Etot=",Etot
SCFconv = .true.
endif
end subroutine check_Conv
!#############################################
!# Set MO Occupations for GK or FT Calcs
!#############################################
subroutine set_Occupations
use module_data, only : doFTSCF,Efermi
implicit none
double precision :: N
if(doFTSCF)then
call set_FermiLevel()
endif
call calc_Occupations(N)
!write(*,*) ' particle number: ', N,Efermi
end subroutine set_Occupations
!#############################################
!# Reset MO Occupations to Aufbau
!#############################################
subroutine Reset_Occupations
use module_data, only : Occ,spins,nOccA,nOccB,dim_1e
implicit none
integer :: iSpin,i
Occ = 0.0d0
do iSpin=1,spins
if(iSpin==1)then
do i=1,nOccA
Occ(i,iSpin) = 2.0d0 * 1.0d0/dble(spins)
enddo
endif
if(iSpin==2)then
do i=1,nOccB
Occ(i,iSpin) = 2.0d0 * 1.0d0/dble(spins)
enddo
endif
enddo
end subroutine Reset_Occupations
!#############################################
!# Determine Fermi-Level
!#############################################
subroutine set_FermiLevel
use module_data, only : Efermi,nel,Spins,nOccA,nOccB,Eps
implicit none
double precision :: Nconv,N,Nplu,Nmin,diffN
double precision :: Estep = 1.0d-8
double precision :: Maxstep = 0.5d0
integer :: i,iOrb
Nconv = 1.0d-9
Efermi = 0.5d0*(Eps(nOccA,1)+Eps(nOccA+1,1))
do i=1,100
call calc_Occupations(N)
if (abs(N-nel)<Nconv)then
exit
endif
Efermi = Efermi + Estep
call calc_Occupations(Nplu)
Efermi = Efermi - 2.0d0*Estep
call calc_Occupations(Nmin)
Efermi = Efermi + Estep
diffN = ((Nplu-nel)-(Nmin-nel))/(2.0d0*Estep)
if(abs((N-nel)/diffN)<Maxstep)then
Efermi = Efermi - (N-nel)/diffN
else
Efermi = Efermi - sign(Maxstep,(N-nel)/diffN)
endif
!write(*,*) ' particle number: ', i,N,Efermi
enddo
end subroutine set_FermiLevel
!#############################################
!# Calc Orbital Occupations for Efermi
!#############################################
subroutine calc_Occupations(N)
use module_data, only : dim_1e,Occ,Efermi,Eps,doGKSCF,doFTSCF,Tel,Spins
use module_constants, only : kb
implicit none
integer :: i,iSpin
double precision :: N
N = 0.0d0
do iSpin = 1,Spins
do i=1,dim_1e
Occ(i,iSpin) = (2.0d0/dble(Spins)) / (1.0d0+exp((Eps(i,iSpin)-Efermi)/(kb*Tel)))
N = N + Occ(i,iSpin)
enddo
enddo
end subroutine calc_Occupations
!#############################################
!# Print Hamiltonian for TB calcs
!#############################################
subroutine print_TB()
use module_data, only : dim_1e,Fock,Bastype,Basis,atom,xyz,DropMO,Sij
implicit none
integer :: i,j,MOZero
double precision :: rx, ry, rz, absr
character(len=1) :: angmomi,angmomj
! MOZero = DropMO + 1
write(*,*) "atomA atomB Bastype Sij Fij rx ry rz |r| "
do i=1,dim_1e
if((Bastype(i)==1) .and. (atom(Basis(i))/="H") ) cycle
do j=i,dim_1e
if((Bastype(j)==1) .and. (atom(Basis(j))/="H") ) cycle
if(Bastype(i)==1)then
angmomi = "s"
elseif (Bastype(i)==2)then
angmomi = "s"
elseif (Bastype(i)==3)then
angmomi = "p"
else
angmomi = "x"
endif
if(Bastype(j)==1)then
angmomj = "s"
elseif (Bastype(j)==2)then
angmomj = "s"
elseif (Bastype(j)==3)then
angmomj = "p"
else
angmomj = "x"
endif
rx = xyz(Basis(i),1) - xyz(Basis(j),1)
ry = xyz(Basis(i),2) - xyz(Basis(j),2)
rz = xyz(Basis(i),3) - xyz(Basis(j),3)
absr = sqrt(rx*rx+ry*ry+rz*rz)
if (absr==0.0d0) cycle
rx = rx/absr
ry = ry/absr
rz = rz/absr
write(*,*) atom(Basis(i)),Basis(i),atom(Basis(j)),Basis(j),angmomi,angmomj,Sij(i,j),Fock(i,j,1),rx,ry,rz,absr
enddo
enddo
!call print_Mat(Fock(:,:,1),dim_1e,7,"AO Fock")
end subroutine print_TB
end module module_scf
|
% This section contains the content for the Terms and Definitions
\numberedformat
\chapter{Terms and Definitions}
The following terms and definitions are used in this document.
%% Modify below this line %%
\term{Academy Color Encoding Specification (ACES)}
RGB color encoding for exchange of image data that have not been color rendered, between and throughout production and postproduction, within the Academy Color Encoding System. ACES is specified in SMPTE ST 2065-1.
\term{American Society of Cinematographers Color Decision List (ASC CDL)}
A set of file formats for the exchange of basic primary color grading information between equipment and software from different manufacturers. ASC CDL provides for Slope, Offset and Power operations applied to each of the red, green and blue channels and for an overall Saturation operation affecting all three.
\term{High Definition Serial Digital Interface (HD-SDI)}
Transport specifications for a set of bit-serial data structures for digital component signals. HD-SDI allowing 10-bit and 12-bit 4:4:4 signals is specified in SMPTE Standards 372M and 424M.
\term{Stop (photographic)}
A unit used to quantify ratios of light or exposure, with each added stop meaning a factor of two, and each subtracted stop meaning a factor of one-half.
\term{Code value}
In any integer encoding, any single value may be referred to as a code value, abbreviated as CV.
|
I wanted to send a huge thank you to you all for the efforts made in getting my clientβs bed out to her last week. I feel that you went above and beyond and the family and I are so grateful for her bed being delivered in such a timely manner. My clientβs daughter was so relieved that the bed was delivered that she became very teary on the phone. Itβs not every day in our jobs that we are recognised for going above and beyond, and I wanted to pass on my thanks for your hard work. Thank you for being such a pleasure to work with, this is why I always recommend Astris to my colleagues.
I wanted to express to your team the great customer service that I always receive from Able Rehab. Your response times are excellent, and the communication is always courteous and helpful to meeting our needs. In the context of a busy hospital setting, this is greatly appreciated! Thank you once again.
I would like to let you know that your team have been nothing but professional and courteous in helping me source the products required for this project. Turnaround time for quotations have far exceeded any other supplier I have worked with as well. Itβs been a pleasure to work with the Able Rehab team. |
/*
*
* ML fitting of size (sigma, s) and number of photons (n)
* of already localized dots using a 2D Gaussian model provided by gaussianInt2.
*
* Only one dot at a time is considered, hence the 1 in mlfit1sn
*
* Uses 3D images however only a xy-plane at at time is used for the
* fitting.
*
* See also:
* mlfit1.c, fitting of xy
* df_mlfit1sn.c, a MATLAB interface
*
* 2017.04.12. Valgrind ok.
*
* Future work:
* - Return the fitting status
* - Study the failed cases
* - More restrictions on the search domain, i.e., cap sigma depending
* on the window size
==9245== Invalid write of size 8
==9245== at 0x1094C9: mlfit1sn_dot (mlfit1sn.c:227)
==9245== by 0x109A9B: mlfit1sn (mlfit1sn.c:278)
==9245== by 0x109A9B: unit_tests (mlfit1sn.c:346)
==9245== by 0x57F73F0: (below main) (libc-start.c:291)
==9245== Address 0x5babf98 is 24 bytes after a block of size 32,000 in arena "client"
==9245==
*/
#include <assert.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <gsl/gsl_multimin.h>
#include <gsl/gsl_statistics.h>
#include "gaussianInt2.h"
#include "mlfit.h"
#include "blit3.h"
//
// Headers
//
// Number of photons in signal
double estimateNphot(double *, size_t);
// Locate multiple dots in a volume
int mlfit1sn(double * , size_t , size_t , size_t ,
double * , size_t , double * );
// Localization for single dot
int mlfit1sn_dot(double *, size_t, double *, double *);
// Cost function
double my_f (const gsl_vector *, void *);
// Random number in a range
double rand_range(double, double);
int unit_tests(void);
// 0: no information, 1: per dot, 2: even more
#ifndef verbose
#define verbose 0
#endif
// When low on bugs,
// replace gsl_vector_get(v,i) by v->data[i*v->stride]
// #define GSL_RANGE_CHECK_OFF
// Globals
#if verbose>1
uint32_t maxInterations = 5;
#else
uint32_t maxInterations = 5000;
#endif
double convCriteria = 1e-6;
// In theory also the window size, denoted Ws in most places
// Optimization constants
typedef struct {
double * R; // local region
double * G; // A already allocated temporary space for the Gaussian kernel
size_t Rw; // R and G has size Rw*Rw
double sigma; // For constant sigma fitting
double bg;
double x;
double y;
double midvalue; // value of central pixel in model - bg
} optParams;
double my_f (const gsl_vector *v, void *params)
// The function to optimize
{
optParams *p = (optParams *) params;
size_t Rw = p->Rw;
double * R = p->R;
double * GI = p->G;
double bg = p->bg;
double x = p->x;
double y = p->y;
// Get the other parameters ...
double sigma = gsl_vector_get(v, 0);
double Nphot = gsl_vector_get(v, 1);
#if verbose > 1
printf("Rw: %lu\n", Rw);
printf("Nphot: %f\n", Nphot);
printf("sigma: %f\n", sigma);
printf("bg : %f\n", bg);
printf("x: %f, y: %f\n", x, y);
printf("GI:\n");
showRegion(GI, Rw);
#endif
if(sigma<0)
return(INFINITY);
if(Nphot<0)
return(INFINITY);
// Create Gaussian ...
double mu[] = {x,y};
gaussianInt2(GI, mu, &sigma, Rw);
p->midvalue = Nphot*GI[ (Rw*Rw-1)/2 ];
for(size_t kk = 0; kk<Rw*Rw; kk++)
GI[kk] = bg+Nphot*GI[kk];
/*
* from LL2PG.m
* model = x(3)+x(4)*gaussianInt2([x(1), x(2)], x(5), (size(patch, 1)-1)/2);
* mask = disk2d((size(patch,1)-1)/2);
* %L = -sum(sum(-(patch-model).^2./model - .5*log(model)));
* L = -sum(sum( mask.*( -(patch-model).^2./model - .5*log(model) ) ));
*/
double E = 0;
for (size_t kk=0; kk<Rw*Rw; kk++)
{
E+= (GI[kk]-R[kk])*(GI[kk]-R[kk])/GI[kk] - .5*log(GI[kk]); // ML
//E+= (GI[kk]-R[kk])*(GI[kk]-R[kk]); // Quadratic
}
// E = -E;
#if verbose > 1
printf("E: %f\n", E);
#endif
return E;
}
int mlfit1sn_dot(double * V, size_t Vm,
double * D, double * F)
// Localization for a dot roughly centered in V of size Vm x Vm
// D[0], D[1], D[3] are the global coordinates of the dot
// F are the fitted coordinates
{
// Non-optimized parameters
optParams par;
par.R = V;
par.Rw = Vm;
par.x = D[0]-nearbyint(D[0]);
par.y = D[1]-nearbyint(D[1]);
// par.z required for accurate nphot counting, sigma is invariant to
// this shift
par.bg = estimateBG(V, Vm);
par.G = malloc(Vm*Vm*sizeof(double));
#if verbose>0
printf("localizeDot\n");
printf("x: %f y: %f\n", par.x, par.y);
printf("bg: %f\n", par.bg);
#endif
const gsl_multimin_fminimizer_type *T =
gsl_multimin_fminimizer_nmsimplex2;
gsl_multimin_fminimizer *s = NULL;
gsl_vector *ss, *x;
gsl_multimin_function minex_func;
size_t iter = 0;
int status;
double size;
/* Starting point */
x = gsl_vector_alloc (2);
gsl_vector_set(x, 0, 1.2); // sigma
double nphot0 =estimateNphot(V, Vm);
gsl_vector_set(x, 1, nphot0); // Nphot
/* Set initial step sizes */
ss = gsl_vector_alloc(2);
gsl_vector_set(ss, 0, 0.1); // sigma
gsl_vector_set(ss, 1, nphot0/100); // Number of photons
/* Initialize method and iterate */
minex_func.n = 2;
minex_func.f = my_f;
minex_func.params = ∥
s = gsl_multimin_fminimizer_alloc (T, 2);
gsl_multimin_fminimizer_set (s, &minex_func, x, ss);
do
{
iter++;
status = gsl_multimin_fminimizer_iterate(s);
if (status)
break;
size = gsl_multimin_fminimizer_size(s);
status = gsl_multimin_test_size(size, convCriteria);
if (status == GSL_SUCCESS)
{
#if verbose > 0
printf ("converged to minimum at\n");
printf ("%5lu sigma:%10.3e NP:%10.3e f() = %7.3f size = %10.3e\n",
iter,
gsl_vector_get (s->x, 0),
gsl_vector_get (s->x, 1),
s->fval, size);
#endif
}
}
while (status == GSL_CONTINUE && iter < maxInterations);
F[0] = gsl_vector_get(s->x, 0);
F[1] = par.midvalue;
F[2] = s->fval;
F[3] = status;
F[4] = par.bg;
gsl_vector_free(x);
gsl_vector_free(ss);
gsl_multimin_fminimizer_free(s);
free(par.G);
return status;
}
int mlfit1sn(double * V, size_t Vm, size_t Vn, size_t Vp,
double * D, size_t Dm, double * F)
// run the localization routine for a list of dots, D [3xDm]
{
// Return values have to be checked
gsl_set_error_handler_off();
// as a custom error handler can also be used.
int Ws_pref = 15; // Window size is Ws x Ws
int Ws = Ws_pref;
double * W = malloc(Ws_pref*Ws_pref*sizeof(double));
for(size_t kk =0; kk<Dm; kk++)
{
// Copy the neighbourhood around each D into W
int hasRegion = 0;
for(Ws = Ws_pref; Ws>7; Ws = Ws-2) {
if(getRegion(W, Ws, V, Vm, Vn, Vp, D+kk*3) == 0) {
hasRegion = 1;
break;
} else {
#if verbose >0
printf("Ws: %d not possible\n", Ws);
#endif
}
}
#if verbose>0
printf("Ws: %d\n", Ws);
#endif
if(hasRegion == 1) {
#if verbose > 1
printf("W:\n");
showRegion(W, Ws);
#endif
// Local fitting in W
#if verbose > 0
int status = mlfit1sn_dot(W, Ws, D+kk*3, F+kk*5);
printf("Status: %d\n", status);
#else
mlfit1sn_dot(W, Ws, D+kk*3, F+kk*5);
#endif
}
else
{
F[kk*5] = -1;
F[kk*5+1] = -1;
F[kk*5+2] = -1;
F[kk*5+3] = -3;
F[kk*5+4] = 0;
}
}
free(W);
return 0;
}
#ifdef standalone
int unit_tests()
{
double * V; // image
int Vm = 1024; int Vn = 1024; int Vp = 60;
double * D; // list of dots
size_t Dm = 1000; // number of dots
double * F; // fitted dots
printf("Image size: %dx%dx%d\n", Vm, Vn, Vp);
printf("Localizing %lu dots\n", Dm);
V = malloc(Vm*Vn*Vp*sizeof(double));
D = malloc(3*Dm*sizeof(double));
F = malloc(4*Dm*sizeof(double));
// Initialize the data
for(int kk=0; kk<Vm*Vn*Vp; kk++)
V[kk] = rand_range(0,0);
for(uint32_t kk=0; kk<Dm; kk++)
{
size_t pos = kk*3;
D[pos] = rand_range(-1, Vm+1);
D[pos+1] = rand_range(6, Vn-7);
D[pos+2] = rand_range(6, Vp-7);
if(D[pos] < 6)
D[pos] = 6;
if(D[pos+1] < 6)
D[pos+1] = 6;
if(D[pos+2] < 6)
D[pos+2] = 6;
#if verbose > 0
printf("D %03d %f %f %f\n", kk, D[pos], D[pos+1], D[pos+2]);
#endif
}
for(uint32_t kk=0; kk<Dm; kk++)
{
size_t pos = D[kk*3] + D[kk*3+1]*Vm + D[kk*3+2]*Vm*Vn;
V[pos] = 5;
}
D[0] = 100; D[1] = 100; D[2] = 30;
V[(int) D[0]+(int) D[1]*Vm+(int) D[2]*Vm*Vn] = 7;
V[(int) D[0]+1+(int) D[1]*Vm+(int) D[2]*Vm*Vn] = 6;
// Run the optimization
mlfit1sn(V, Vm, Vn, Vp, D, Dm, F);
// In next version, also supply clustering information
#if verbose >0
for(size_t kk = 0; kk<Dm; kk++)
{
size_t pos = kk*3;
size_t dpos = kk*4;
printf("%6lu (%f, %f, %f) : s: %f, n: %f e: %f status: %d\n", kk,
D[pos], D[pos+1], D[pos+2],
F[dpos], F[dpos+1], F[dpos+2], (int) F[dpos+3]);
}
#endif
free(F);
free(D);
free(V);
return 0;
}
int main(int argc, char ** argv)
// For testing, not used any more, see the MATLAB interface in
// df_mlfit.c
{
printf("%s\n", argv[0]);
if(argc == 1) {
return unit_tests();
}
return 1;
}
#endif
|
(********************************)
(********************************)
(**** ****)
(**** Product categories ****)
(**** ****)
(********************************)
(********************************)
Require Import Main.CategoryTheory.Category.
Require Import Main.CategoryTheory.Functor.
Require Import Main.Tactics.
#[local] Set Universe Polymorphism.
#[local] Open Scope type. (* Parse `*` as `prod` rather than `mul`. *)
#[local] Theorem productCategoryCAssoc
{C D}
(w x y z : object C * object D)
(f : arrow (fst w) (fst x) * arrow (snd w) (snd x))
(g : arrow (fst x) (fst y) * arrow (snd x) (snd y))
(h : arrow (fst y) (fst z) * arrow (snd y) (snd z))
: (
compose
(fst h)
(fst (compose (fst g) (fst f), compose (snd g) (snd f))),
compose
(snd h)
(snd (compose (fst g) (fst f), compose (snd g) (snd f)))
) = (
compose
(fst (compose (fst h) (fst g), compose (snd h) (snd g)))
(fst f),
compose
(snd (compose (fst h) (fst g), compose (snd h) (snd g)))
(snd f)
).
Proof.
search.
Qed.
#[local] Theorem productCategoryCIdentLeft
{C D}
(x y : object C * object D)
(f : arrow (fst x) (fst y) * arrow (snd x) (snd y))
: (
compose (fst (@id C (fst y), @id D (snd y))) (fst f),
compose (snd (@id C (fst y), @id D (snd y))) (snd f)
) = f.
Proof.
search.
Qed.
#[local] Theorem productCategoryCIdentRight
{C D : category}
(x y : object C * object D)
(f : arrow (fst x) (fst y) * arrow (snd x) (snd y))
: (
compose (fst f) (fst (@id C (fst x), @id D (snd x))),
compose (snd f) (snd (@id C (fst x), @id D (snd x)))
) = f.
Proof.
search.
Qed.
Definition productCategory C D : category := newCategory
(object C * object D)
(fun x y => arrow (fst x) (fst y) * arrow (snd x) (snd y))
(fun _ _ _ f g => (compose (fst f) (fst g), compose (snd f) (snd g)))
(fun _ => (id, id))
productCategoryCAssoc
productCategoryCIdentLeft
productCategoryCIdentRight.
#[local] Theorem productCategoryProj1FIdent
{C D}
(x : object (productCategory C D))
: fst (@id (productCategory C D) x) = id.
Proof.
search.
Qed.
#[local] Theorem productCategoryProj1FComp
{C D}
(x y z : object (productCategory C D))
(f : arrow x y)
(g : arrow y z)
: compose (fst g) (fst f) = fst (compose g f).
Proof.
search.
Qed.
Definition productCategoryProj1 C D :
functor (productCategory C D) C := newFunctor
(productCategory C D)
C
fst
(fun _ _ => fst) productCategoryProj1FIdent productCategoryProj1FComp.
#[local] Theorem productCategoryProj2FIdent
{C D}
(x : object (productCategory C D))
: snd (@id (productCategory C D) x) = id.
Proof.
search.
Qed.
#[local] Theorem productCategoryProj2FComp
{C D}
(x y z : object (productCategory C D))
(f : arrow x y)
(g : arrow y z)
: compose (snd g) (snd f) = snd (compose g f).
Proof.
search.
Qed.
Definition productCategoryProj2 C D :
functor (productCategory C D) D := newFunctor
(productCategory C D)
D
snd
(fun _ _ => snd) productCategoryProj2FIdent productCategoryProj2FComp.
|
using PyCall
math = pyimport("math")
math.sin(math.pi / 4) # returns β 1/β2 = 0.70710678...
plt = pyimport("matplotlib.pyplot")
x = range(0;stop=2*pi,length=1000); y = sin.(3*x + 4*cos.(2*x));
plt.plot(x, y, color="red", linewidth=2.0, linestyle="--")
plt.show()
so = pyimport("scipy.optimize")
so.newton(x -> cos(x) - x, 1)
plot1 = pyimport("einsteinpy")
plot = pyimport("einsteinpy.plotting")
a = plot.StaticGeodesicPlotter()
a.animate
pyversion
PyCall.libpython
PyCall.conda
|
from sys import getsizeof
from time import time
import numpy as np
import pandas as pd
import torch as tc
from scipy.special import ellipk, ellipe
#from scipy.integrate import dblquad, tplquad
from scipy.spatial.transform import Rotation
#from tqdm.notebook import tqdm
from tqdm import tqdm
import multiprocessing
from joblib import Parallel, delayed
# imports from this library
from helicalc.tools import get_gpu_memory_map
from helicalc.integrate import trapz_2d
from helicalc.constants import MAXMEM, mu0
# move these functions elsewhere?
def k2(r, z, a):
return (4*a*r) / ((a+r)**2 + z**2)
def Br_Bz_integrands(r, z, a, j):
# shared elements
cutoff = 1e-5
k2_ = k2(r, z, a)
K = ellipk(k2_)
E = ellipe(k2_)
prefac = (mu0 * j) / (2 * np.pi * ((a + r)**2 + z**2)**(1/2))
denom = ((a-r)**2 + z**2)
# individual calculations
if r < cutoff:
if hasattr(z, '__iter__'):
Br = np.zeros_like(z)
else:
Br = 0
else:
Br = prefac * z/r * (-K + (a**2 + r**2 + z**2)/denom * E)
Bz = prefac * (K + (a**2 - r**2 - z**2)/denom * E)
return Br, Bz
def Br_Bz_integrands_vec(r, z, a, j):
# shared elements
cutoff = 1e-5
k2_ = k2(r, z, a)
K = ellipk(k2_)
E = ellipe(k2_)
# calculate
prefac = (mu0 * j) / (2 * np.pi * ((a + r)**2 + z**2)**(1/2))
denom = ((a-r)**2 + z**2)
# mask
m = (r*np.ones_like(K)) < cutoff
Br = np.zeros_like(K)
Br[~m] = prefac[~m] * (z+np.zeros_like(K))[~m]/(r+np.zeros_like(K))[~m] * (-K[~m] + (a**2 + r**2 + z**2)[~m]/denom[~m] * E[~m])
Bz = prefac * (K + (a**2 - r**2 - z**2)/denom * E)
return Br, Bz
# main integrator class
class SolCalcIntegrator(object):
def __init__(self, geom_coil, drz, use_basic_geom=True, layer=1, int_func=np.trapz, lib=np, dev=3):
if lib is tc:
# set device
tc.cuda.set_device(dev)
self.start_dev_mem = get_gpu_memory_map()[dev]
self.mem_err_expected = False
raise NotImplementedError('GPU implementation is not completed and will fail.')
else:
#print('ERROR! NOT IMPLEMENTED!')
pass
self.use_basic_geom = use_basic_geom
if use_basic_geom:
self.r0 = geom_coil.Ri
self.r1 = geom_coil.Ro
self.z0 = -geom_coil.L/2
self.z1 = geom_coil.L/2
self.I_tot = geom_coil.I_turn*geom_coil.N_turns*geom_coil.N_layers
else:
# set r0 and r1 based on layer
self.r0 = geom_coil.rho0_a + (layer-1)*(geom_coil.h_cable + 2*geom_coil.t_ci + geom_coil.t_il)
self.r1 = self.r0 + geom_coil.h_sc
dz = geom_coil.t_ci + geom_coil.t_gi + (geom_coil.w_cable - geom_coil.w_sc)/2
self.z0 = -geom_coil.L/2 + dz
self.z1 = geom_coil.L/2 - dz
self.I_tot = geom_coil.I_turn*geom_coil.N_turns
# calculate currrent density
self.area = (self.r1-self.r0)*(self.z1-self.z0)
self.j_tot = self.I_tot/self.area
# limits of integration
r_lims = [self.r0, self.r1]
# z limits (in coil coordinates)
z_lims = [-geom_coil.L/2, geom_coil.L/2]
# combine limits
rz_lims = [r_lims, z_lims]
# define base R, Z grid to calculate integrands on
if lib is tc:
# only once ellipe & ellipk in torch
# self.rs = tc.linspace(rz_lims[0][0], rz_lims[0][1], abs(int((rz_lims[0][1]-rz_lims[0][0])/drz[0] + 1))).cuda()
# self.zs = tc.linspace(rz_lims[1][0], rz_lims[1][1], abs(int((rz_lims[1][1]-rz_lims[1][0])/drz[1] + 1))).cuda()
self.rs = np.linspace(rz_lims[0][0], rz_lims[0][1], abs(int((rz_lims[0][1]-rz_lims[0][0])/drz[0] + 1)))
self.zs = np.linspace(rz_lims[1][0], rz_lims[1][1], abs(int((rz_lims[1][1]-rz_lims[1][0])/drz[1] + 1)))
else:
self.rs = np.linspace(rz_lims[0][0], rz_lims[0][1], abs(int((rz_lims[0][1]-rz_lims[0][0])/drz[0] + 1)))
self.zs = np.linspace(rz_lims[1][0], rz_lims[1][1], abs(int((rz_lims[1][1]-rz_lims[1][0])/drz[1] + 1)))
# estimate memory / limit of number of field points to calulate at once
# FIXME!
# set R, Z grid
# only once ellipe & ellipk in torch
## self.R, self.Z = lib.meshgrid(self.rs, self.zs, indexing='xy')
self.R, self.Z = np.meshgrid(self.rs, self.zs, indexing='ij')
# add extra things to self
self.geom_coil = geom_coil
self.int_func = int_func
self.layer = layer
self.lib = lib
self.dev = dev
# rotations!
self.XYZ_rot = geom_coil[[f'rot{i:d}' for i in [0,1,2]]].values
self.XYZ_rot_rad = np.radians(self.XYZ_rot)
self.mu2e_to_coil = Rotation.from_euler('XYZ', -self.XYZ_rot_rad)
self.coil_to_mu2e = self.mu2e_to_coil.inv()
self.xc, self.yc, self.zc = geom_coil[['x','y','z']].values
# saved results
self.x_calcs = []
self.y_calcs = []
self.z_calcs = []
# test lists before final rotations
self.Br_calcs_prerot = []
self.Bz_calcs_prerot = []
# lists we actually want (after rotations)
self.Bx_calcs = []
self.By_calcs = []
self.Bz_calcs = []
# determine actual memory footprint
sizes = []
if lib is tc:
for o in [self.rs, self.zs, self.R, self.Z]:
try:
sizes.append(getsizeof(o.storage())*1e-6)
except:
sizes.append(o.nbytes*1e-6)
else:
for o in [self.rs, self.zs, self.R, self.Z]:
sizes.append(o.nbytes*1e-6)
self.getsizeof_init_mb = np.array(sizes)
def integrate_single(self, x0=0, y0=0, z0=0, debug=False):
# append to lists
self.x_calcs.append(x0)
self.y_calcs.append(y0)
self.z_calcs.append(z0)
# rotate & translate based on geom
x0, y0, z0 = self.mu2e_to_coil.apply(np.array([x0-self.xc, y0-self.yc, z0-self.zc]))
r0 = (x0**2+y0**2)**(1/2)
phi0 = np.arctan2(y0, x0)
# TEST
if debug:
print(x0, y0, z0)
print(r0)
print(phi0)
# calculate integrands
Br_integrand_calcs, Bz_integrand_calcs = Br_Bz_integrands(r0, self.Z+z0, self.R, self.j_tot)
# save integrands (testing)
self.Br_int = Br_integrand_calcs
self.Bz_int = Bz_integrand_calcs
# integrate Br
if self.lib is tc:
Br = trapz_2d(self.rs, self.zs, Br_integrand_calcs, self.int_func).item()
Bz = trapz_2d(self.rs, self.zs, Bz_integrand_calcs, self.int_func).item()
else:
Br = trapz_2d(self.rs, self.zs, Br_integrand_calcs, self.int_func)
Bz = trapz_2d(self.rs, self.zs, Bz_integrand_calcs, self.int_func)
# save results in coil's coordinates
self.Br_calcs_prerot.append(Br)
self.Bz_calcs_prerot.append(Bz)
# calculate cartesian
Bx = Br * np.cos(phi0)
By = Br * np.sin(phi0)
# rotate back to Mu2e coordinates
B_vec = np.array([Bx, By, Bz])
B_vec_rot = self.coil_to_mu2e.apply(B_vec)
self.Bx_calcs.append(B_vec_rot[0])
self.By_calcs.append(B_vec_rot[1])
self.Bz_calcs.append(B_vec_rot[2])
return B_vec_rot
def integrate_vec(self, x0=np.array([0]), y0=np.array([0]), z0=np.array([0]), debug=False):
# append to lists
self.x_calcs.append(x0)
self.y_calcs.append(y0)
self.z_calcs.append(z0)
# rotate & translate based on geom
x0, y0, z0 = self.mu2e_to_coil.apply(np.array([x0-self.xc, y0-self.yc, z0-self.zc]).T).T
r0 = (x0**2+y0**2)**(1/2)
phi0 = np.arctan2(y0, x0)
# TEST
if debug:
print(x0, y0, z0)
print(r0)
print(phi0)
# calculate integrands
Br_integrand_calcs, Bz_integrand_calcs = Br_Bz_integrands_vec(r0[:,None,None],
self.Z[None,...]+z0[:,None,None],
self.R[None,...], self.j_tot)
# save integrands (testing)
self.Br_int = Br_integrand_calcs
self.Bz_int = Bz_integrand_calcs
# integrate Br
if self.lib is tc:
Br = trapz_2d(self.rs, self.zs, Br_integrand_calcs, self.int_func).item()
Bz = trapz_2d(self.rs, self.zs, Bz_integrand_calcs, self.int_func).item()
else:
Br = trapz_2d(self.rs, self.zs, Br_integrand_calcs, self.int_func)
Bz = trapz_2d(self.rs, self.zs, Bz_integrand_calcs, self.int_func)
# save results in coil's coordinates
self.Br_calcs_prerot.append(Br)
self.Bz_calcs_prerot.append(Bz)
# calculate cartesian
Bx = Br * np.cos(phi0)
By = Br * np.sin(phi0)
# rotate back to Mu2e coordinates
B_vec = np.array([Bx, By, Bz]).T
B_vec_rot = self.coil_to_mu2e.apply(B_vec).T
self.Bx_calcs.append(B_vec_rot[0])
self.By_calcs.append(B_vec_rot[1])
self.Bz_calcs.append(B_vec_rot[2])
return B_vec_rot
def integrate_grid(self, df, N_proc=None, OPTIMAL=None, tqdm=tqdm, verbose=False):
# initial time
t0 = time()
i = int(round(self.geom_coil.Coil_Num))
print(f'Coil {i}: grid with {len(df):E} points')
# add dataframe to object
self.df = df.copy() # passed in dataframe with columns X, Y, Z [m]
# defaults if necessary
if N_proc is None:
N_proc = 32 # or num.cpu for long calculation (warn others)
if OPTIMAL is None:
# should tune this
#OPTIMAL = 5000000
OPTIMAL = 500000
# calculate best chunk size
N_per_chunk = int(OPTIMAL/self.R.size)+1
N_chunks = int(len(df)/N_per_chunk) + 1
# let user know chunk size
print(f'Chunk size: {N_per_chunk}, Number of chunks: {N_chunks}')
# generate padded arrays corresponding to chunk size and number of chunks
vals_list = []
for col in ['X', 'Y', 'Z']:
vals = np.zeros(N_per_chunk * N_chunks)
vals[:len(self.df)] = self.df[col]
vals = vals.reshape((N_chunks, N_per_chunk))
vals_list.append(vals)
# parallel calculations
num_cpu = multiprocessing.cpu_count()
num_cpu = N_proc
if verbose:
print(f"CPU Cores available: {num_cpu}")
print(f'Using {num_cpu} cores')
# calculate chunks
output_tuples = Parallel(n_jobs=num_cpu)\
(delayed(self.integrate_vec)(x_, y_, z_) for x_, y_, z_ in tqdm(zip(*vals_list), desc='Chunk #', total=len(vals_list[0])))
# sort and store results
Bxs = []
Bys = []
Bzs = []
for t in output_tuples:
Bxs.append(t[0])
Bys.append(t[1])
Bzs.append(t[2])
Bxs = np.array(Bxs).flatten()[:len(self.df)]
Bys = np.array(Bys).flatten()[:len(self.df)]
Bzs = np.array(Bzs).flatten()[:len(self.df)]
xs = vals_list[0].flatten()[:len(self.df)]
ys = vals_list[1].flatten()[:len(self.df)]
zs = vals_list[2].flatten()[:len(self.df)]
self.df.loc[:, f'Bx_solcalc_{i}'] = Bxs
self.df.loc[:, f'By_solcalc_{i}'] = Bys
self.df.loc[:, f'Bz_solcalc_{i}'] = Bzs
# final time, report total time
tf = time()
print(f'Calculation time: {(tf - t0):0.2f} s\n')
return self.df
def save_grid_calc(self, savetype='pkl', savename='data/Mau13.PS_region.standard.coil0', all_solcalc_cols=False):
# determine which columns to save
i = int(round(self.geom_coil.Coil_Num))
cols = ['X', 'Y', 'Z']
for col in self.df.columns:
if all_solcalc_cols:
if 'solcalc' in col:
cols.append(col)
else:
if f'solcalc_{i}' in col:
cols.append(col)
# save
df_to_save = self.df[cols]
if savetype == 'pkl':
df_to_save.to_pickle(f'{savename}.{savetype}')
else:
raise NotImplementedError('Allowed savetype: ["pkl"]')
# see if this works outside class defn.
def integrate_grid(SolCalc, df, N_proc=None, OPTIMAL=None, tqdm=tqdm, verbose=False):
i = round(SolCalc.geom_coil.Coil_Num)
print(f'Coil {i}: grid with {len(df):E} points')
## add dataframe to object
##df = df.copy() # passed in dataframe with columns X, Y, Z [m]
# defaults if necessary
if N_proc is None:
N_proc = 32 # or num.cpu for long calculation (warn others)
if OPTIMAL is None:
# should tune this
#OPTIMAL = 5000000
OPTIMAL = 500000
# calculate best chunk size
N_per_chunk = int(OPTIMAL/SolCalc.R.size)+1
N_chunks = int(len(df)/N_per_chunk) + 1
# let user know chunk size
print(f'Chunk size: {N_per_chunk}, Number of chunks: {N_chunks}')
# generate padded arrays corresponding to chunk size and number of chunks
vals_list = []
for col in ['X', 'Y', 'Z']:
vals = np.zeros(N_per_chunk * N_chunks)
vals[:len(df)] = df[col]
vals = vals.reshape((N_chunks, N_per_chunk))
vals_list.append(vals)
# parallel calculations
num_cpu = multiprocessing.cpu_count()
num_cpu = N_proc
if verbose:
print(f"CPU Cores available: {num_cpu}")
print(f'Using {num_cpu} cores')
# calculate chunks
output_tuples = Parallel(n_jobs=num_cpu)\
(delayed(SolCalc.integrate_vec)(x_, y_, z_) for x_, y_, z_ in tqdm(zip(*vals_list), desc='Chunk #', total=len(vals_list[0])))
# sort and store results
Bxs = []
Bys = []
Bzs = []
for t in output_tuples:
Bxs.append(t[0])
Bys.append(t[1])
Bzs.append(t[2])
Bxs = np.array(Bxs).flatten()[:len(df)]
Bys = np.array(Bys).flatten()[:len(df)]
Bzs = np.array(Bzs).flatten()[:len(df)]
xs = vals_list[0].flatten()[:len(df)]
ys = vals_list[1].flatten()[:len(df)]
zs = vals_list[2].flatten()[:len(df)]
df.loc[:, f'Bx_solcalc_{i}'] = Bxs
df.loc[:, f'By_solcalc_{i}'] = Bys
df.loc[:, f'Bz_solcalc_{i}'] = Bzs
return df
if __name__=='__main__':
from helicalc import helicalc_dir
from helicalc.geometry import read_solenoid_geom_combined
geom_df_mu2e = read_solenoid_geom_combined(helicalc_dir+'dev/params/','Mu2e_V13')
i = 0 # 1st coil in the PS
#i = 5 # coil in the TS
# testing grid
# df_PS = pd.read_pickle('/home/ckampa/coding/mu2e_utils/BField_plot/data/PSMap_no-offset.pkl')
# step size
drz = np.array([5e-3, 1e-2])
# set up integrator
mySolCalc = SolCalcIntegrator(geom_df_mu2e.iloc[i], drz=drz)
print(f'Sample Calc @ x,y,z = (3.904, 0, -6.8): Bx, By, Bz = {mySolCalc.integrate_single(3.904, 0, -6.8)}')
# grid does not work from this file
# integrate on PS map
# should take ~10 seconds
# class method
#mySolCalc.integrate_grid(df_PS)
# global method
#df = integrate_grid(mySolCalc, df_PS)
|
This Car is a Rare Genuine 350 T400 LS Monaro as attached document shows it was Amethyst ( Purple) This car has matching body to chassis and the two tags match the car. Also have Document from Holden.
Body has been blasted and primed.
No engine . no Gearbox or glass etc. Only what is seen in images. No interior etc. Has Salisbury diff.
Includes the 2 large tags. missing the smaller vin tag but its not needed for rego. This Tag can be reproduced by a company in oz.
Payment within 7 days unless you contact me with an arrangement prior to auction ending.
This car is still for sale?
Can email me if is there..
Hello, is this still for sale? I have been searching for a factory purple one!
Hi I am interested in your Monaro if it is still available please email me your contact details.
Is your HQ still available? |
Boron Nitride ceramic is a kind of refractory ceramic with low expansion and high thermal conductivity. This makes it to be an ideal choice to molten metals. Itβs very easy to be machined to custom design with precision and tight tolerance because of its machinability.
Boron nitride can be long-term used at 1800 degrees under vacuum atmosphere. With gas protection, Boron Nitride can be used at 2100 Β°C. Boron Nitride is with high thermal shock resistance, no cracks under extreme cold & high temperature. If you take out Boron Nitride from 1000 degree-furnace and cooling it within short minutes. It still wonβt break even repeat this test with 100 times. |
[STATEMENT]
lemma filter_dropWhile:
"filter (\<lambda>x. \<not>P x) (dropWhile P xs) = filter (\<lambda>x. \<not>P x) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. filter (\<lambda>x. \<not> P x) (dropWhile P xs) = filter (\<lambda>x. \<not> P x) xs
[PROOF STEP]
by (induction xs) simp_all |
Located on the stunning seafront at Cleveleys is a privately owned, multi-award winning complex of restaurants, bars and function suites. Providing unparralled wining, dining and entertainment facilities for all age groups. In fact, it is the complete venue for any occasion. Open daily from 12 noon till late and 2am on Fridays and Saturdays, The Venue offers a fabulous choice of meals, snacks, coffees and alcoholic refreshment and provides regular entertainment in the evenings, especially every weekend, when we feature top live bands and DJs.
Sky UK Limited accept no responsibility for images uploaded by the individual venues. |
The Euclidean real numbers are contractible. |
open classical
variable A : Prop
example : Β¬ (Β¬ ( A β¨ Β¬ A)) :=
(assume h1 : Β¬ (A β¨ Β¬ A),
have h2 : Β¬ A, from
assume h3 : A,
have h4 : A β¨ Β¬ A, from or.inl h3,
show false, from h1 h4,
have h5 : A β¨ Β¬ A, from or.inr h2,
show false, from h1 h5) |
theory Eplus_assoc
imports Main "$HIPSTER_HOME/IsaHipster"
begin
setup Tactic_Data.set_coinduct_sledgehammer
codatatype ENat = is_zero: EZ | ESuc (epred: ENat)
primcorec eplus :: "ENat \<Rightarrow> ENat \<Rightarrow> ENat" where
"eplus m n = (if is_zero m then n else ESuc (eplus (epred m) n))"
theorem eplus_assoc: "eplus a (eplus b c) = eplus (eplus a b) c"
by hipster_coinduct_sledgehammer
end |
# This file is a part of Julia. License is MIT: https://julialang.org/license
__precompile__()
module LocalModule
using Distributed
export myapp
function myapp()
p = addprocs(1)
@everywhere p println("Taking over the world...")
rmprocs(p)
nothing
end
end
|
(*
This is the definition of formal syntax for Dan Grossman's Thesis,
"SAFE PROGRAMMING AT THE C LEVEL OF ABSTRACTION".
Return Preservation
*)
Set Implicit Arguments.
Require Export Cyclone_Formal_Syntax Cyclone_Static_Semantics_Kinding_And_Context_Well_Formedness.
Require Export Cyclone_Dynamic_Semantics.
Require Export Cyclone_Classes Cyclone_Inductions Cyclone_LN_Tactics Cyclone_LN_Extra_Lemmas_And_Automation.
Require Export Cyclone_WFC_Lemmas.
Require Export Cyclone_WFU_Lemmas.
Require Export Cyclone_Context_Weakening_Proof.
Require Export Cyclone_Substitutions_Proof.
Require Export Cyclone_LN_Types_Lemmas.
Require Export Cyclone_Get_Lemmas.
Require Export Cyclone_Admit_Environment.
Close Scope list_scope.
Import LibEnvNotations.
Import LVPE.LibVarPathEnvNotations.
Lemma open_term_preserves_ret:
forall s x,
ret s ->
forall n,
ret (TM.open_rec_st n x s).
Proof.
introv Rd.
induction Rd; simpl; auto.
Qed.
Lemma open_type_preserves_ret:
forall s x,
ret s ->
ret (TTM.open_rec_st 0 x s).
Proof.
introv Rd.
induction Rd; simpl; auto.
Qed.
Ltac inversion_complex_ret :=
match goal with
| H : ret (_ _) |- _ => inversions* H
| H : ret (_ _ _) |- _ => inversions* H
end.
Lemma A_8_Return_Preservation:
forall s H H' s',
ret s ->
S H s H' s' ->
ret s'.
Proof.
introv Rs Sd.
induction Sd; try solve[auto];
try solve[inversion_complex_ret ; try inversion_complex_ret];
try solve[inversion_complex_ret;
try constructor;
try applys* open_type_preserves_ret;
try applys* open_term_preserves_ret].
Qed.
|
From your morning juice to your evening gin, find a glass for every occasion at freedom. We've got elegantly simple drinking glasses, sweetly sculpted tumblers, mason jars with lids, and even milk bar bottles to fill with your favourite milkshake flavour. All of our glassware is carefully crafted to look beautiful on your set table. |
-- Andreas, 2018-10-16, runtime erasure
id : (@0 A : Set) (@0 x : A) β A
id A x = x
-- Expected error:
--
-- Variable x is declared erased, so it cannot be used here
-- when checking that the expression x has type A
|
(* Author: Tobias Nipkow, 2002 *)
section "Arrow's Theorem for Utility Functions"
theory Arrow_Utility imports Complex_Main
begin
text\<open>This theory formalizes the first proof due to
Geanakoplos~\cite{Geanakoplos05}. In contrast to the standard model
of preferences as linear orders, we model preferences as \emph{utility
functions} mapping each alternative to a real number. The type of
alternatives and voters is assumed to be finite.\<close>
typedecl alt
typedecl indi
axiomatization where
alt3: "\<exists>a b c::alt. distinct[a,b,c]" and
finite_alt: "finite(UNIV:: alt set)" and
finite_indi: "finite(UNIV:: indi set)"
lemma third_alt: "a \<noteq> b \<Longrightarrow> \<exists>c::alt. distinct[a,b,c]"
using alt3 by simp metis
lemma alt2: "\<exists>b::alt. b \<noteq> a"
using alt3 by simp metis
type_synonym pref = "alt \<Rightarrow> real"
type_synonym prof = "indi \<Rightarrow> pref"
definition
top :: "pref \<Rightarrow> alt \<Rightarrow> bool" (infixr "<\<cdot>" 60) where
"p <\<cdot> b \<equiv> \<forall>a. a \<noteq> b \<longrightarrow> p a < p b"
definition
bot :: "alt \<Rightarrow> pref \<Rightarrow> bool" (infixr "\<cdot><" 60) where
"b \<cdot>< p \<equiv> \<forall>a. a \<noteq> b \<longrightarrow> p b < p a"
definition
extreme :: "pref \<Rightarrow> alt \<Rightarrow> bool" where
"extreme p b \<equiv> b \<cdot>< p \<or> p <\<cdot> b"
abbreviation
"Extreme P b == \<forall>i. extreme (P i) b"
lemma less_if_bot[simp]: "\<lbrakk> b \<cdot>< p; x \<noteq> b \<rbrakk> \<Longrightarrow> p b < p x"
by(simp add:bot_def)
lemma [simp]: "\<lbrakk> p <\<cdot> b; x \<noteq> b \<rbrakk> \<Longrightarrow> p x < p b"
by(simp add:top_def)
lemma [simp]: assumes top: "p <\<cdot> b" shows "\<not> p b < p c"
proof (cases)
assume "b = c" thus ?thesis by simp
next
assume "b \<noteq> c"
with top have "p c < p b" by (simp add:eq_sym_conv)
thus ?thesis by simp
qed
lemma not_less_if_bot[simp]:
assumes bot: "b \<cdot>< p" shows "\<not> p c < p b"
proof (cases)
assume "b = c" thus ?thesis by simp
next
assume "b \<noteq> c"
with bot have "p b < p c" by (simp add:eq_sym_conv)
thus ?thesis by simp
qed
lemma top_impl_not_bot[simp]: "p <\<cdot> b \<Longrightarrow> \<not> b \<cdot>< p"
by(unfold bot_def, simp add:alt2)
lemma [simp]: "extreme p b \<Longrightarrow> (\<not> p <\<cdot> b) = (b \<cdot>< p)"
apply(unfold extreme_def)
apply(fastforce dest:top_impl_not_bot)
done
lemma [simp]: "extreme p b \<Longrightarrow> (\<not> b \<cdot>< p) = (p <\<cdot> b)"
apply(unfold extreme_def)
apply(fastforce dest:top_impl_not_bot)
done
text\<open>Auxiliary construction to hide details of preference model.\<close>
definition
mktop :: "pref \<Rightarrow> alt \<Rightarrow> pref" where
"mktop p b \<equiv> p(b := Max(range p) + 1)"
definition
mkbot :: "pref \<Rightarrow> alt \<Rightarrow> pref" where
"mkbot p b \<equiv> p(b := Min(range p) - 1)"
definition
between :: "pref \<Rightarrow> alt \<Rightarrow> alt \<Rightarrow> alt \<Rightarrow> pref" where
"between p a b c \<equiv> p(b := (p a + p c)/2)"
text\<open>To make things simpler:\<close>
declare between_def[simp]
lemma [simp]: "a \<noteq> b \<Longrightarrow> mktop p b a = p a"
by(simp add:mktop_def)
lemma [simp]: "a \<noteq> b \<Longrightarrow> mkbot p b a = p a"
by(simp add:mkbot_def)
lemma [simp]: "a \<noteq> b \<Longrightarrow> p a < mktop p b b"
by(simp add:mktop_def finite_alt)
lemma [simp]: "a \<noteq> b \<Longrightarrow> mkbot p b b < p a"
by(simp add:mkbot_def finite_alt)
lemma [simp]: "mktop p b <\<cdot> b"
by(simp add:mktop_def top_def finite_alt)
lemma [simp]: "\<not> b \<cdot>< mktop p b"
by(simp add:mktop_def bot_def alt2 finite_alt)
lemma [simp]: "a \<noteq> b \<Longrightarrow> \<not> P p a < mkbot (P p) b b"
proof (simp add:mkbot_def finite_alt)
have "\<not> P p a + 1 < P p a" by simp
thus "\<exists>x. \<not> P p a + 1 < P p x" ..
qed
text\<open>The proof starts here.\<close>
locale arrow =
fixes F :: "prof \<Rightarrow> pref"
assumes unanimity: "(\<And>i. P i a < P i b) \<Longrightarrow> F P a < F P b"
and IIA:
"(\<And>i. (P i a < P i b) = (P' i a < P' i b)) \<Longrightarrow>
(F P a < F P b) = (F P' a < F P' b)"
begin
lemmas IIA' = IIA[THEN iffD1]
definition
dictates :: "indi \<Rightarrow> alt \<Rightarrow> alt \<Rightarrow> bool" ("_ dictates _ < _") where
"(i dictates a < b) \<equiv> \<forall>P. P i a < P i b \<longrightarrow> F P a < F P b"
definition
dictates2 :: "indi \<Rightarrow> alt \<Rightarrow> alt \<Rightarrow> bool" ("_ dictates _,_") where
"(i dictates a,b) \<equiv> (i dictates a < b) \<and> (i dictates b < a)"
definition
dictatesx:: "indi \<Rightarrow> alt \<Rightarrow> bool" ("_ dictates'_except _") where
"(i dictates_except c) \<equiv> \<forall>a b. c \<notin> {a,b} \<longrightarrow> (i dictates a<b)"
definition
dictator :: "indi \<Rightarrow> bool" where
"dictator i \<equiv> \<forall>a b. (i dictates a<b)"
definition
pivotal :: "indi \<Rightarrow> alt \<Rightarrow> bool" where
"pivotal i b \<equiv>
\<exists>P. Extreme P b \<and> b \<cdot>< P i \<and> b \<cdot>< F P \<and>
F (P(i := mktop (P i) b)) <\<cdot> b"
lemma all_top[simp]: "\<forall>i. P i <\<cdot> b \<Longrightarrow> F P <\<cdot> b"
by (unfold top_def) (simp add: unanimity)
lemma not_extreme:
assumes nex: "\<not> extreme p b"
shows "\<exists>a c. distinct[a,b,c] \<and> \<not> p a < p b \<and> \<not> p b < p c"
proof -
obtain a c where abc: "a \<noteq> b \<and> \<not> p a < p b" "b \<noteq> c \<and> \<not> p b < p c"
using nex by (unfold extreme_def top_def bot_def) fastforce
show ?thesis
proof (cases "a = c")
assume "a \<noteq> c" thus ?thesis using abc by simp blast
next
assume ac: "a = c"
obtain d where d: "distinct[a,b,d]" using abc third_alt by blast
show ?thesis
proof (cases "p b < p d")
case False thus ?thesis using abc d by blast
next
case True
hence db: "\<not> p d < p b" by arith
from d have "distinct[d,b,c]" by(simp add:ac eq_sym_conv)
thus ?thesis using abc db by blast
qed
qed
qed
lemma extremal:
assumes extremes: "Extreme P b" shows "extreme (F P) b"
proof (rule ccontr)
assume nec: "\<not> extreme (F P) b"
hence "\<exists>a c. distinct[a,b,c] \<and> \<not> F P a < F P b \<and> \<not> F P b < F P c"
by(rule not_extreme)
then obtain a c where d: "distinct[a,b,c]" and
ab: "\<not> F P a < F P b" and bc: "\<not> F P b < F P c" by blast
let ?P = "\<lambda>i. if P i <\<cdot> b then between (P i) a c b
else (P i)(c := P i a + 1)"
have "\<not> F ?P a < F ?P b"
using extremes d by(simp add:IIA[of _ _ _ P] ab)
moreover have "\<not> F ?P b < F ?P c"
using extremes d by(simp add:IIA[of _ _ _ P] bc eq_sym_conv)
moreover have "F ?P a < F ?P c" by(rule unanimity)(insert d, simp)
ultimately show False by arith
qed
lemma pivotal_ind: assumes fin: "finite D"
shows "\<And>P. \<lbrakk> D = {i. b \<cdot>< P i}; Extreme P b; b \<cdot>< F P \<rbrakk>
\<Longrightarrow> \<exists>i. pivotal i b" (is "\<And>P. ?D D P \<Longrightarrow> ?E P \<Longrightarrow> ?B P \<Longrightarrow> _")
using fin
proof (induct)
case (empty P)
from empty(1,2) have "\<forall>i. P i <\<cdot> b" by simp
hence "F P <\<cdot> b" by simp
hence False using empty by(blast dest:top_impl_not_bot)
thus ?case ..
next
fix D i P
assume IH: "\<And>P. ?D D P \<Longrightarrow> ?E P \<Longrightarrow> ?B P \<Longrightarrow> \<exists>i. pivotal i b"
and "?E P" and "?B P" and insert: "insert i D = {i. b \<cdot>< P i}" and "i \<notin> D"
from insert have "b \<cdot>< P i" by blast
let ?P = "P(i := mktop (P i) b)"
show "\<exists>i. pivotal i b"
proof (cases "F ?P <\<cdot> b")
case True
have "pivotal i b"
proof -
from \<open>?E P\<close> \<open>?B P\<close> \<open>b \<cdot>< P i\<close> True
show ?thesis by(unfold pivotal_def, blast)
qed
thus ?thesis ..
next
case False
have "D = {i. b \<cdot>< ?P i}"
by (rule set_eqI) (simp add:\<open>i \<notin> D\<close>, insert insert, blast)
moreover have "Extreme ?P b"
using \<open>?E P\<close> by (simp add:extreme_def)
moreover have "b \<cdot>< F ?P"
using extremal[OF \<open>Extreme ?P b\<close>] False by(simp del:fun_upd_apply)
ultimately show ?thesis by(rule IH)
qed
qed
lemma pivotal_exists: "\<exists>i. pivotal i b"
proof -
let ?P = "(\<lambda>_ a. if a=b then 0 else 1)::prof"
have "Extreme ?P b" by(simp add:extreme_def bot_def)
moreover have "b \<cdot>< F ?P"
by(simp add:bot_def unanimity del: less_if_bot not_less_if_bot)
ultimately show "\<exists>i. pivotal i b"
by (rule pivotal_ind[OF finite_subset[OF subset_UNIV finite_indi] refl])
qed
lemma pivotal_xdictates: assumes pivo: "pivotal i b"
shows "i dictates_except b"
proof -
have "\<And>a c. \<lbrakk> a \<noteq> b; b \<noteq> c \<rbrakk> \<Longrightarrow> i dictates a < c"
proof (unfold dictates_def, intro allI impI)
fix a c and P::prof
assume abc: "a \<noteq> b" "b \<noteq> c" and
ac: "P i a < P i c"
show "F P a < F P c"
proof -
obtain P1 P2 where
"Extreme P1 b" and "b \<cdot>< F P1" and "b \<cdot>< P1 i" and "F P2 <\<cdot> b" and
[simp]: "P2 = P1(i := mktop (P1 i) b)"
using pivo by (unfold pivotal_def) fast
let ?P = "\<lambda>j. if j=i then between (P j) a b c
else if P1 j <\<cdot> b then mktop (P j) b else mkbot (P j) b"
have eq: "(F P a < F P c) = (F ?P a < F ?P c)"
using abc by - (rule IIA, auto)
have "F ?P a < F ?P b"
proof (rule IIA')
fix j show "(P2 j a < P2 j b) = (?P j a < ?P j b)"
using \<open>Extreme P1 b\<close> by(simp add: ac)
next
show "F P2 a < F P2 b"
using \<open>F P2 <\<cdot> b\<close> abc by(simp add: eq_sym_conv)
qed
also have "\<dots> < F ?P c"
proof (rule IIA')
fix j show "(P1 j b < P1 j c) = (?P j b < ?P j c)"
using \<open>Extreme P1 b\<close> \<open>b \<cdot>< P1 i\<close> by(simp add: ac)
next
show "F P1 b < F P1 c"
using \<open>b \<cdot>< F P1\<close> abc by(simp add: eq_sym_conv)
qed
finally show ?thesis by(simp add:eq)
qed
qed
thus ?thesis by(unfold dictatesx_def) fast
qed
lemma pivotal_is_dictator:
assumes pivo: "pivotal i b" and ab: "a \<noteq> b" and d: "j dictates a,b"
shows "i = j"
proof (rule ccontr)
assume pd: "i \<noteq> j"
obtain P1 P2 where "Extreme P1 b" and "b \<cdot>< F P1" and "F P2 <\<cdot> b" and
P2: "P2 = P1(i := mktop (P1 i) b)"
using pivo by (unfold pivotal_def) fast
have "~(P1 j a < P1 j b)" (is "~ ?ab")
proof
assume "?ab"
hence "F P1 a < F P1 b" using d by(simp add: dictates_def dictates2_def)
with \<open>b \<cdot>< F P1\<close> show False by simp
qed
hence "P1 j b < P1 j a" using \<open>Extreme P1 b\<close>[THEN spec, of j] ab
unfolding extreme_def top_def bot_def by metis
hence "P2 j b < P2 j a" using pd by (simp add:P2)
hence "F P2 b < F P2 a" using d by(simp add: dictates_def dictates2_def)
with \<open>F P2 <\<cdot> b\<close> show False by simp
qed
theorem dictator: "\<exists>i. dictator i"
proof-
from pivotal_exists[of b] obtain i where pivo: "pivotal i b" ..
{ fix a assume neq: "a \<noteq> b" have "i dictates a,b"
proof -
obtain c where dist: "distinct[a,b,c]"
using neq third_alt by blast
obtain j where "pivotal j c" using pivotal_exists by fast
hence "j dictates_except c" by(rule pivotal_xdictates)
hence b: "j dictates a,b"
using dist by(simp add:dictatesx_def dictates2_def eq_sym_conv)
with pivo neq have "i = j" by(rule pivotal_is_dictator)
thus ?thesis using b by simp
qed
}
with pivotal_xdictates[OF pivo] have "dictator i"
by(simp add: dictates_def dictatesx_def dictates2_def dictator_def)
(metis less_le)
thus ?thesis ..
qed
end
end
|
include("help.jl")
function full_field_in_marks!(r::Robot)
num_vert = get_num_steps_movements!(r, Sud)
num_hor = get_num_steps_movements!(r, West)
#ΠΡ Π² Π»Π΅Π²ΠΎΠΌ Π½ΠΈΠΆΠ½Π΅ΠΌ ΡΠ³Π»Ρ ΠΈ ΠΏΠΎΠΌΠ½ΠΈΠΌ Π½Π°ΡΠ΅ ΡΠΈΡΠ»ΠΎ ΡΠ°Π³ΠΎΠ²
side = Ost
mark_row!(r,side)
putmarker!(r)
movements!(r,Sud)
movements!(r, West)
#ΠΠΎΠ·Π²ΡΠ°ΡΠ΅Π½ΠΈΠ΅ Π² ΠΏΠ΅ΡΠ²ΠΎΠ½Π°ΡΠ°Π»ΡΠ½ΡΡ ΠΏΠΎΠ·ΠΈΡΠΈΡ
movements!(r,Ost,num_hor)
movements!(r,Nord,num_vert)
end
invers(side::HorizonSide) = HorizonSide(mod(Int(side) + 2,4))
function mark_row!(r::Robot,side::HorizonSide) #ΠΠ²ΠΈΠΆΠ΅Π½ΠΈΠ΅ Π·ΠΌΠ΅ΠΉΠΊΠΎΠΉ
while isborder(r,side) == false #ΠΠΎ Π³ΠΎΡΠΈΠ·ΠΎΠ½ΡΠ°Π»ΠΈ
putmarker!(r)
move!(r,side)
end
if (isborder(r,Nord) == false) #ΠΠΎ Π²Π΅ΡΡΠΈΠΊΠ°Π»ΠΈ
putmarker!(r)
move!(r,Nord)
side = invers(side::HorizonSide)
mark_row!(r,side)
end
end
function get_num_steps_movements!(r::Robot, side::HorizonSide) #ΠΏΠΎΠΊΠ° Π½Π΅Ρ ΡΡΠ΅Π½ΠΊΠΈ ΠΈΠ΄Π΅ΠΌ Π² Π½Π°ΠΏΡΠ°Π²Π»Π΅Π½ΠΈΠΈ side ΠΈ Π·Π°ΠΏΠΎΠΌΠΈΠ½Π°Π΅ΠΌ ΠΊΠΎΠ»-Π²ΠΎ ΡΠ°Π³ΠΎΠ²
num_steps = 0
while isborder(r, side) == false
move!(r,side)
num_steps += 1
end
return num_steps
end
function movements!(r::Robot,side::HorizonSide) #ΠΠ²ΠΈΠΆΠ΅Π½ΠΈΠ΅ Π΄ΠΎ ΡΡΠ΅Π½ΠΊΠΈ
while isborder(r,side) == false
move!(r,side)
end
end
function movements!(r::Robot,side::HorizonSide,num_steps::Int) #Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅ΠΌΡΡ Π½Π° num_steps ΡΠ°Π³ΠΎΠ²
for _ in 1:num_steps
move!(r,side)
end
end |
Require Import compcert.lib.Integers.
Require Import Recdef.
Require Import List. Import ListNotations.
Require Import Arith Lia.
Require Import compcert.lib.Coqlib.
Require Import sha.general_lemmas.
Require Import sha.hmac_pure_lemmas.
Require Import sha.ByteBitRelations.
Require Import sha.HMAC_common_defs.
Require Import sha.SHA256.
Require Import sha.HMAC_functional_prog.
Require Import sha.HMAC256_functional_prog.
Require Import sha.hmac_common_lemmas.
Require Import sha.pure_lemmas.
Require Import sha.sha_padding_lemmas.
Require Import VST.zlist.sublist. (*for Forall_repeat*)
Import List.
Definition c := (32 * 8)%nat.
Definition p := (32 * 8)%nat.
Definition b := (c + p)%nat.
Definition BlockSize := 64.
Definition BlockSize_Bits := BlockSize * 8.
Definition sha_iv : Blist :=
intsToBits SHA256.init_registers.
Definition sha_h (regs : Blist) (block : Blist) : Blist :=
intsToBits (SHA256.hash_block (bitsToInts regs) (bitsToInts block)).
Definition sha_splitandpad (msg : Blist) : Blist :=
bytesToBits (sha_padding_lemmas.pad (bitsToBytes msg)).
(* artifact of app_fpad definition *)
Definition fpad_inner (msg : list byte) : list byte :=
(let n := BlockSize + Zlength msg in
[Byte.repr 128%Z]
++ repeat Byte.zero (Z.to_nat (-(n + 9) mod 64))
++ intlist_to_bytelist ([Int.repr (n * 8 / Int.modulus); Int.repr (n * 8)]))%list.
Lemma fpad_inner_length l (L:length l = p): (length (fpad_inner (bitsToBytes l)) * 8)%nat = p.
Proof.
unfold fpad_inner. repeat rewrite app_length.
rewrite repeat_length, length_intlist_to_bytelist.
rewrite (mult_comm 4), plus_comm, Zlength_correct.
rewrite bitsToBytes_len_gen with (n:=32%nat).
reflexivity.
apply L.
Qed.
Definition fpad (msg : Blist) : Blist :=
bytesToBits (fpad_inner (bitsToBytes msg)).
Lemma fpad_length msg (M:length msg = c): length (fpad msg) = p.
unfold fpad. rewrite bytesToBits_len. apply fpad_inner_length.
apply M. (*we're exploiting the fact that c=p here*)
Qed.
(* --------------- *)
Lemma xor_equiv_byte: forall xpad XPAD k K,
bytes_bits_lists xpad (HMAC_SHA256.sixtyfour XPAD) ->
((length K) * 8)%nat = (c + p)%nat ->
bytes_bits_lists k K ->
bytes_bits_lists (BLxor k xpad) (HMAC_SHA256.mkArg K XPAD).
Proof. intros. apply inner_general_mapByte; try assumption.
Qed.
Lemma fold_left_iv_length: forall k (HK: forall iv x, length iv = k -> length (sha_h iv x) = k) l iv x ,
length iv = k ->
length (fold_left sha_h l (sha_h iv x)) = k.
Proof. intros k HK l.
induction l. simpl. apply HK.
simpl. intros. rewrite IHl. trivial. apply HK. trivial.
Qed.
(* modified version of sha_padding_lemmas.pad *)
Definition pad_inc (msg : list byte) : list byte :=
let n := BlockSize + Zlength msg in
msg ++ [Byte.repr 128%Z]
++ repeat Byte.zero (Z.to_nat (-(n + 9) mod 64))
++ intlist_to_bytelist ([Int.repr (n * 8 / Int.modulus); Int.repr (n * 8)]).
Definition sha_splitandpad_inc (msg : Blist) : Blist :=
bytesToBits (pad_inc (bitsToBytes msg)).
Lemma sha_splitandpad_inc_nil: length (sha_splitandpad_inc nil) = 512%nat.
Proof. reflexivity. Qed.
Lemma pad_inc_length: forall l, exists k, (0 < k /\ length (pad_inc l) = k*64)%nat.
Proof. unfold pad_inc.
induction l.
simpl. exists (1%nat). lia.
destruct IHl as [k [K HK]]. repeat rewrite app_length in *. rewrite repeat_length in *.
rewrite length_intlist_to_bytelist in *.
remember (BinInt.Z.to_nat
(BinInt.Z.modulo
(BinInt.Z.opp
(BinInt.Z.add (BinInt.Z.add BlockSize (Zcomplements.Zlength l))
9)) 64)).
remember (BinInt.Z.to_nat
(BinInt.Z.modulo
(BinInt.Z.opp
(BinInt.Z.add
(BinInt.Z.add BlockSize (Zcomplements.Zlength (a :: l))) 9))
64)).
simpl. simpl in HK.
assert ((BinInt.Z.add
(BinInt.Z.add BlockSize (Zcomplements.Zlength (a :: l))) 9) =
BinInt.Z.add 1 (BinInt.Z.add
(BinInt.Z.add BlockSize (Zcomplements.Zlength l)) 9)).
rewrite BinInt.Z.add_assoc. f_equal.
rewrite BinInt.Z.add_assoc. rewrite (BinInt.Z.add_comm 1). rewrite <- (BinInt.Z.add_assoc _ 1).
f_equal.
repeat rewrite Zcomplements.Zlength_correct.
apply (Znat.Nat2Z.inj_add 1 (length l)).
rewrite H in Heqn0; clear H.
remember (BinInt.Z.add (BinInt.Z.add BlockSize (Zcomplements.Zlength l)) 9). clear Heqz.
subst n n0. rewrite Z.opp_add_distr. rewrite <- (Z.add_comm (-z)). remember (-z) as zz. clear Heqzz.
simpl.
destruct (zeq (zz mod 64) 0).
rewrite e in HK.
assert ((zz+-1) mod 64 = 63). clear - e. apply Zmod_divides in e. 2:lia.
destruct e. subst. rewrite Zplus_mod. rewrite Z.mul_comm. rewrite Z_mod_mult. simpl.
reflexivity. (* rewrite Zmod_mod. apply Zmod_unique with (a:=(-1)). lia. lia.*)
rewrite H. clear H e. simpl in *. exists (S k). lia.
assert ((zz + -1) mod 64 = (zz mod 64) - 1 /\ 0 <= (zz mod 64) - 1).
clear -n. rewrite Zplus_mod. assert (0 <= zz mod 64 < 64). apply Z.mod_pos_bound. lia.
split. 2: lia.
symmetry. eapply Z.mod_unique. left. lia.
assert (63 = -1 mod 64). eapply Z.mod_unique. left; lia. instantiate (1:=-1). lia.
rewrite <- H0. instantiate (1:=1). lia.
destruct H. rewrite H. clear H.
assert (Z.to_nat (zz mod 64 - 1) = minus (Z.to_nat (zz mod 64)) 1).
clear - n H0. remember (zz mod 64). clear Heqz. rewrite Z2Nat.inj_sub. reflexivity. lia.
rewrite H; clear H. rewrite <- NPeano.Nat.add_sub_swap. rewrite minus_Sn_m. simpl. exists k. lia.
lia. apply (Z2Nat.inj_le 1). lia. lia. lia.
Qed.
Lemma sha_splitandpad_inc_length: forall m, exists k,
(0<k /\ length (sha_splitandpad_inc m) = k * 512)%nat.
Proof. intros. unfold sha_splitandpad_inc.
destruct (pad_inc_length (bitsToBytes m)) as [k [K HK]].
rewrite bytesToBits_len, HK. exists k. split. trivial. lia.
Qed.
Lemma sha_splitandpad_inc_InBlocks m : InBlocks 512 (sha_splitandpad_inc m).
Proof. intros. apply InBlocks_len.
destruct (sha_splitandpad_inc_length m) as [k [K HK]].
rewrite HK. exists k. trivial.
Qed.
Lemma sha_iv_length: length sha_iv = 256%nat.
Proof. reflexivity. Qed.
(*now in HMAC_common_defs
Lemma hash_blocks_bits_len: forall h
(HH: forall x y, length x = c -> length y = b -> length (h x y) = c)
r l, length r = c ->
InBlocks b l ->
length (hash_blocks_bits h r l) = c.
Proof. intros h HH r l.
apply hash_blocks_bits_ind.
intros. trivial.
intros. destruct _x. contradiction. subst msg; clear y.
inv H1.
apply H; clear H. rewrite HH. trivial. trivial.
rewrite H3, firstn_exact. apply H2. apply H2.
rewrite H3, skipn_exact. assumption. apply H2.
Qed.*)
Lemma B: (0<b)%nat. unfold b; simpl. lia. Qed.
Lemma hash_blocks_bits_len': forall r l, length r = 256%nat ->
InBlocks 512 l ->
length (hash_blocks_bits _ B sha_h r l) = 256%nat.
Proof. intros r l.
apply hash_blocks_bits_ind.
intros. trivial.
intros. destruct _x. contradiction. subst msg; clear y.
inv H1.
apply H; clear H. unfold sha_h, intsToBits.
rewrite bytesToBits_len, length_intlist_to_bytelist.
rewrite length_hash_block. lia.
unfold bitsToInts. erewrite length_bytelist_to_intlist. reflexivity.
rewrite bitsToBytes_len_gen with (n:=32%nat). reflexivity. apply H0.
unfold bitsToInts. erewrite length_bytelist_to_intlist. reflexivity.
erewrite bitsToBytes_len_gen with (n:=64%nat). reflexivity.
rewrite H3, firstn_exact. apply H2. apply H2.
rewrite H3, skipn_exact. assumption. apply H2.
Qed.
Lemma sha_h_length iv blk: length iv = c -> length blk = b ->
length (sha_h iv blk) = c.
Proof. intros.
unfold sha_h, intsToBits.
rewrite bytesToBits_len, length_intlist_to_bytelist.
rewrite common_lemmas.length_hash_block. reflexivity.
unfold bitsToInts. erewrite pure_lemmas.length_bytelist_to_intlist. reflexivity.
erewrite bitsToBytes_len_gen. reflexivity.
rewrite H; reflexivity.
unfold bitsToInts. erewrite pure_lemmas.length_bytelist_to_intlist. reflexivity.
erewrite bitsToBytes_len_gen. reflexivity.
rewrite H0; reflexivity.
Qed.
(*******Injectivity of pad_inc*************************)
Lemma pad_injective_aux (l1 l2: list byte) k
(K : k * Int.modulus + (BlockSize + Zlength l1) * 8 =
(BlockSize + Zlength l2) * 8)
(N : k <> 0):
- (BlockSize + Zlength l2 + 9) mod 64 = - (BlockSize + Zlength l1 + 9) mod 64.
Proof. repeat rewrite <- Z.add_assoc. unfold BlockSize.
repeat rewrite Z.opp_add_distr.
rewrite (Zplus_mod (-(64))).
assert (- (64) mod 64 = 0). reflexivity. rewrite H.
rewrite (Zplus_mod (-(64))). rewrite H. simpl.
repeat rewrite Zmod_mod.
f_equal. f_equal.
rewrite Zplus_mod. rewrite (Zplus_mod (- Zlength l1)).
assert (Z12: - Zlength l2 mod 64 = - Zlength l1 mod 64).
{ clear H. repeat rewrite Z.mul_add_distr_r in K.
assert (k * Int.modulus + Zlength l1 * 8 = Zlength l2 * 8). lia.
clear K.
assert (KK: k * (Int.modulus/8) + Zlength l1 = Zlength l2).
rewrite <- (Zdiv_unique (k * Int.modulus + Zlength l1 * 8) 8 (Zlength l2) 0).
2: rewrite Z.add_0_r; trivial. 2: lia.
clear H. remember (Zlength l1) as z; clear Heqz.
remember ((Int.modulus / 8)).
assert (Int.modulus = z0 * 8). subst.
rewrite <- max_unsigned_modulus, int_max_unsigned_eq. trivial.
rewrite H; clear H Heqz0. rewrite Z.mul_assoc.
rewrite (Z_div_plus_full_l (k*z0) 8 (z*8)). 2: lia.
rewrite Z_div_mult_full. trivial. lia.
rewrite <- KK; clear H KK.
rewrite Z.opp_add_distr.
rewrite Zplus_mod.
assert (KM: - (k * (Int.modulus / 8)) mod 64 = 0).
apply Zmod_unique with (a:=-k * 8388608). 2: lia. rewrite Zplus_0_r.
rewrite <- max_unsigned_modulus, int_max_unsigned_eq. simpl.
rewrite Zopp_mult_distr_l, <- Z.mul_assoc. reflexivity.
rewrite KM. simpl. apply Z.mod_mod. lia.
}
rewrite Z12; trivial.
Qed.
Lemma pad_injective_Case5 l1 l2
(H0 : (l1 ++ Byte.repr 128 :: nil) ++
repeat Byte.zero (Z.to_nat (- (BlockSize + Zlength l1 + 9) mod 64)) =
(l2 ++ Byte.repr 128 :: nil) ++
repeat Byte.zero (Z.to_nat (- (BlockSize + Zlength l2 + 9) mod 64)))
(H : (BlockSize + Zlength l1) * 8 =
((BlockSize + Zlength l2) * 8) mod Int.modulus)
(Nonneg1 : 0 <= (BlockSize + Zlength l1) * 8)
(l : (BlockSize + Zlength l1) * 8 < Int.modulus):
length l1 = length l2.
Proof. symmetry in H.
destruct (mod_exists _ _ _ H) as [k K].
specialize Int.modulus_pos; intros; lia.
destruct (zeq k 0).
subst. clear - K.
assert (Zlength l1 = Zlength l2). lia.
repeat rewrite Zlength_correct in H.
rewrite <- (Nat2Z.id (length l1)).
rewrite <- (Nat2Z.id (length l2)).
rewrite H. reflexivity.
clear H.
assert (length ((l1 ++ Byte.repr 128 :: nil) ++
repeat Byte.zero (Z.to_nat (- (BlockSize + Zlength l1 + 9) mod 64)))
= length ((l2 ++ Byte.repr 128 :: nil) ++
repeat Byte.zero (Z.to_nat (- (BlockSize + Zlength l2 + 9) mod 64)))).
rewrite H0; trivial.
clear H0. repeat rewrite app_length in H.
repeat rewrite repeat_length in H.
clear - K n H.
rewrite (pad_injective_aux l1 l2 k K n) in H. lia.
Qed.
Lemma pad_inc_injective: forall l1 l2, pad_inc l1 = pad_inc l2 -> l1=l2.
Proof. intros.
remember (beq_nat (length l1) (length l2)) as d.
destruct d.
{ apply beq_nat_eq in Heqd.
unfold pad_inc in H. repeat rewrite Zlength_correct in H.
rewrite <- Heqd in H.
eapply app_inv_tail. apply H. }
{ symmetry in Heqd; apply beq_nat_false in Heqd.
unfold pad_inc in H.
repeat rewrite app_assoc in H.
destruct (app_inv_length2 _ _ _ _ H); clear H. reflexivity.
apply intlist_to_bytelist_inj in H1.
apply cons_inv in H1. destruct H1 as [_ Y].
apply cons_inv in Y. destruct Y as [Y _].
assert (Int.unsigned (Int.repr ((BlockSize + Zlength l1) * 8)) = Int.unsigned (Int.repr ((BlockSize + Zlength l2) * 8))).
rewrite Y; trivial.
elim Heqd; clear Heqd Y.
repeat rewrite Int.unsigned_repr_eq in H.
assert (Nonneg1: 0 <= (BlockSize + Zlength l1) * 8).
specialize (Zlength_nonneg l1). intros; unfold BlockSize; lia.
assert (Nonneg2: 0 <= (BlockSize + Zlength l2) * 8).
specialize (Zlength_nonneg l2). intros; unfold BlockSize; lia.
remember (zlt ((BlockSize + Zlength l1) * 8) Int.modulus).
destruct s; clear Heqs.
{ rewrite Zmod_small in H. 2: split; assumption.
remember (zlt ((BlockSize + Zlength l2) * 8) Int.modulus).
destruct s; clear Heqs.
{ (*Case 3*)
rewrite Zmod_small in H. 2: split; assumption.
clear - H.
assert (Zlength l1 = Zlength l2). lia.
repeat rewrite Zlength_correct in H0.
rewrite <- (Nat2Z.id (length l1)).
rewrite <- (Nat2Z.id (length l2)).
rewrite H0. reflexivity. }
{ (*Case 5*) clear g Nonneg2.
apply pad_injective_Case5; assumption. } }
{ clear g Nonneg1.
remember (zlt ((BlockSize + Zlength l2) * 8) Int.modulus).
destruct s; clear Heqs.
{ (*Case 5, symmetric version*)
rewrite (Zmod_small ((BlockSize + Zlength l2) * 8)) in H. 2: split; assumption.
symmetry. symmetry in H. symmetry in H0.
apply pad_injective_Case5; assumption. }
{ clear Nonneg2 g.
remember ((BlockSize + Zlength l1) * 8) as z1.
remember ((BlockSize + Zlength l2) * 8) as z2.
rewrite Zmod_eq in H. 2: apply Int.modulus_pos. remember (z1 / Int.modulus) as k1; clear Heqk1.
rewrite Zmod_eq in H. 2: apply Int.modulus_pos. remember (z2 / Int.modulus) as k2; clear Heqk2.
destruct (zeq k1 k2).
{ subst. clear -H.
assert (Zlength l1 = Zlength l2). lia.
repeat rewrite Zlength_correct in H0.
rewrite <- (Nat2Z.id (length l1)).
rewrite <- (Nat2Z.id (length l2)).
rewrite H0. reflexivity. }
{ assert (length ((l1 ++ Byte.repr 128 :: nil) ++
repeat Byte.zero (Z.to_nat (- (BlockSize + Zlength l1 + 9) mod 64)))
= length ((l2 ++ Byte.repr 128 :: nil) ++
repeat Byte.zero (Z.to_nat (- (BlockSize + Zlength l2 + 9) mod 64)))).
rewrite H0; trivial.
clear H0. repeat rewrite app_length in H1.
repeat rewrite repeat_length in H1.
rewrite (pad_injective_aux l2 l1 (k1-k2)) in H1.
lia.
rewrite Z.mul_sub_distr_r; lia.
lia. } } } }
Qed.
(********************************************************************)
Lemma block_8 A (l:list A): length l = b -> InBlocks 8 l.
Proof.
intros len. apply InBlocks_len. exists 64%nat. apply len.
Qed.
Lemma sha_splitandpad_app : forall (l m : Blist),
length l = b ->
sha_splitandpad (l ++ m) = l ++ sha_splitandpad_inc m.
Proof.
intros l m len.
unfold sha_splitandpad. unfold sha_splitandpad_inc.
unfold pad. unfold pad_inc.
rewrite -> bitsToBytes_app.
rewrite -> Zlength_app.
repeat rewrite -> bytesToBits_app.
rewrite -> bits_bytes_bits_id.
rewrite <- app_assoc.
repeat f_equal.
unfold b, c, p in *. simpl in *.
* apply bitsToBytes_len. apply len.
* apply bitsToBytes_len. apply len.
* apply bitsToBytes_len. apply len.
* apply block_8. apply len.
* apply block_8. apply len.
Qed.
(*
Module SHAHF <: Hashfunction.
(* TODO use neater definition with conversion functions *)
(* TODO split out of HMAC_spec_pad *)
Definition c := (32 * 8)%nat.
Definition p := (32 * 8)%nat.
Definition b := (c + p)%nat.
Definition BlockSize := 64.
Definition sha_iv : Blist :=
intsToBits SHA256.init_registers.
Definition sha_h (regs : Blist) (block : Blist) : Blist :=
intsToBits (SHA256.hash_block (bitsToInts regs) (bitsToInts block)).
Definition sha_splitandpad (msg : Blist) : Blist :=
bytesToBits (sha_padding_lemmas.pad (bitsToBytes msg)).
(* artifact of app_fpad definition *)
Definition fpad_inner (msg : list Z) : list Z :=
(let n := BlockSize + Zlength msg in
[128%Z]
++ repeat 0 (Z.to_nat (-(n + 9) mod 64))
++ intlist_to_Zlist ([Int.repr (n * 8 / Int.modulus); Int.repr (n * 8)]))%list.
Definition fpad (msg : Blist) : Blist :=
bytesToBits (fpad_inner (bitsToBytes msg)).
Lemma fold_left_iv_length: forall k (HK: forall iv x, length iv = k -> length (sha_h iv x) = k) l iv x ,
length iv = k ->
length (fold_left sha_h l (sha_h iv x)) = k.
Proof. intros k HK l.
induction l. simpl. apply HK.
simpl. intros. rewrite IHl. trivial. apply HK. trivial.
Qed.
(* modified version of sha_padding_lemmas.pad *)
Definition pad_inc (msg : list Z) : list Z :=
let n := BlockSize + Zlength msg in
msg ++ [128%Z]
++ repeat 0 (Z.to_nat (-(n + 9) mod 64))
++ intlist_to_Zlist ([Int.repr (n * 8 / Int.modulus); Int.repr (n * 8)]).
Definition sha_splitandpad_inc (msg : Blist) : Blist :=
bytesToBits (pad_inc (bitsToBytes msg)).
Lemma sha_splitandpad_inc_nil: length (sha_splitandpad_inc nil) = 512%nat.
Proof. reflexivity. Qed.
Lemma isbyteZ_pad_inc l (B:Forall isbyteZ l): Forall isbyteZ (pad_inc l).
Proof. unfold pad_inc.
apply Forall_app. split. trivial.
apply Forall_app. split. constructor. split; lia. trivial.
apply Forall_app. split. apply Forall_repeat. split; lia.
apply isbyte_intlist_to_Zlist.
Qed.
Lemma pad_inc_length: forall l, exists k, (0 < k /\ length (pad_inc l) = k*64)%nat.
Proof. unfold pad_inc.
induction l.
simpl. exists (1%nat). lia.
destruct IHl as [k [K HK]]. repeat rewrite app_length in *. rewrite repeat_length in *.
rewrite pure_lemmas.length_intlist_to_Zlist in *.
remember (BinInt.Z.to_nat
(BinInt.Z.modulo
(BinInt.Z.opp
(BinInt.Z.add (BinInt.Z.add BlockSize (Zcomplements.Zlength l))
9)) 64)).
remember (BinInt.Z.to_nat
(BinInt.Z.modulo
(BinInt.Z.opp
(BinInt.Z.add
(BinInt.Z.add BlockSize (Zcomplements.Zlength (a :: l))) 9))
64)).
simpl. simpl in HK.
assert ((BinInt.Z.add
(BinInt.Z.add BlockSize (Zcomplements.Zlength (a :: l))) 9) =
BinInt.Z.add 1 (BinInt.Z.add
(BinInt.Z.add BlockSize (Zcomplements.Zlength l)) 9)).
rewrite BinInt.Z.add_assoc. f_equal.
rewrite BinInt.Z.add_assoc. rewrite (BinInt.Z.add_comm 1). rewrite <- (BinInt.Z.add_assoc _ 1).
f_equal.
repeat rewrite Zcomplements.Zlength_correct.
apply (Znat.Nat2Z.inj_add 1 (length l)).
rewrite H in Heqn0; clear H.
remember (BinInt.Z.add (BinInt.Z.add BlockSize (Zcomplements.Zlength l)) 9). clear Heqz.
subst n n0. rewrite Z.opp_add_distr. rewrite <- (Z.add_comm (-z)). remember (-z) as zz. clear Heqzz.
simpl.
destruct (zeq (zz mod 64) 0).
rewrite e in HK.
assert ((zz+-1) mod 64 = 63). clear - e. apply Zmod_divides in e. 2:lia.
destruct e. subst. rewrite Zplus_mod. rewrite Z.mul_comm. rewrite Z_mod_mult. simpl.
rewrite Zmod_mod. apply Zmod_unique with (a:=(-1)). lia. lia.
rewrite H. clear H e. simpl in *. exists (S k). lia.
assert ((zz + -1) mod 64 = (zz mod 64) - 1 /\ 0 <= (zz mod 64) - 1).
clear -n. rewrite Zplus_mod. assert (0 <= zz mod 64 < 64). apply Z.mod_pos_bound. lia.
split. 2: lia.
symmetry. eapply Z.mod_unique. left. lia.
assert (63 = -1 mod 64). eapply Z.mod_unique. left; lia. instantiate (1:=-1). lia.
rewrite <- H0. instantiate (1:=1). lia.
destruct H. rewrite H. clear H.
assert (Z.to_nat (zz mod 64 - 1) = minus (Z.to_nat (zz mod 64)) 1).
clear - n H0. remember (zz mod 64). clear Heqz. rewrite Z2Nat.inj_sub. reflexivity. lia.
rewrite H; clear H. rewrite <- NPeano.Nat.add_sub_swap. rewrite minus_Sn_m. simpl. exists k. lia.
lia. apply (Z2Nat.inj_le 1). lia. lia. lia.
Qed.
Lemma sha_splitandpad_inc_length: forall m, exists k,
(0<k /\ length (sha_splitandpad_inc m) = k * 512)%nat.
Proof. intros. unfold sha_splitandpad_inc.
destruct (pad_inc_length (bitsToBytes m)) as [k [K HK]].
rewrite bytesToBits_len, HK. exists k. split. trivial. lia.
Qed.
Lemma sha_splitandpad_inc_InBlocks m : InBlocks 512 (sha_splitandpad_inc m).
Proof. intros. apply InBlocks_len.
destruct (sha_splitandpad_inc_length m) as [k [K HK]].
rewrite HK. exists k. trivial.
Qed.
Lemma sha_iv_length: length sha_iv = 256%nat.
Proof. reflexivity. Qed.
Lemma hash_blocks_bits_len: forall r l, length r = 256%nat ->
InBlocks 512 l ->
length (hash_blocks_bits sha_h r l) = 256%nat.
Proof. intros r l.
apply hash_blocks_bits_ind.
intros. trivial.
intros. destruct _x. contradiction. subst msg; clear y.
inv H1.
apply H; clear H. unfold sha_h, intsToBits.
rewrite bytesToBits_len, length_intlist_to_Zlist.
rewrite length_hash_block. lia.
unfold bitsToInts. erewrite length_Zlist_to_intlist. reflexivity.
rewrite bitsToBytes_len_gen with (n:=32%nat). reflexivity. apply H0.
unfold bitsToInts. erewrite length_Zlist_to_intlist. reflexivity.
erewrite bitsToBytes_len_gen with (n:=64%nat). reflexivity.
rewrite H3, firstn_exact. apply H2. apply H2.
rewrite H3, skipn_exact. assumption. apply H2.
Qed.
Lemma sha_h_length iv blk: length iv = c -> length blk = b ->
length (sha_h iv blk) = c.
Proof. intros.
unfold sha_h, intsToBits.
rewrite bytesToBits_len, pure_lemmas.length_intlist_to_Zlist.
rewrite common_lemmas.length_hash_block. reflexivity.
unfold bitsToInts. erewrite pure_lemmas.length_Zlist_to_intlist. reflexivity.
erewrite bitsToBytes_len_gen. reflexivity.
rewrite H; reflexivity.
unfold bitsToInts. erewrite pure_lemmas.length_Zlist_to_intlist. reflexivity.
erewrite bitsToBytes_len_gen. reflexivity.
rewrite H0; reflexivity.
Qed.
(*******Injectivity of pad_inc*************************)
Lemma pad_injective_aux (l1 l2: list Z) k
(K : k * Int.modulus + (BlockSize + Zlength l1) * 8 =
(BlockSize + Zlength l2) * 8)
(N : k <> 0):
- (BlockSize + Zlength l2 + 9) mod 64 = - (BlockSize + Zlength l1 + 9) mod 64.
Proof. repeat rewrite <- Z.add_assoc. unfold BlockSize.
repeat rewrite Z.opp_add_distr.
rewrite (Zplus_mod (-(64))).
assert (- (64) mod 64 = 0). reflexivity. rewrite H.
rewrite (Zplus_mod (-(64))). rewrite H. simpl.
repeat rewrite Zmod_mod.
rewrite Zplus_mod. rewrite (Zplus_mod (- Zlength l1)).
assert (Z12: - Zlength l2 mod 64 = - Zlength l1 mod 64).
{ clear H. repeat rewrite Z.mul_add_distr_r in K.
assert (k * Int.modulus + Zlength l1 * 8 = Zlength l2 * 8). lia.
clear K.
assert (KK: k * (Int.modulus/8) + Zlength l1 = Zlength l2).
rewrite <- (Zdiv_unique (k * Int.modulus + Zlength l1 * 8) 8 (Zlength l2) 0).
2: rewrite Z.add_0_r; trivial. 2: lia.
clear H. remember (Zlength l1) as z; clear Heqz.
remember ((Int.modulus / 8)).
assert (Int.modulus = z0 * 8). subst.
rewrite <- max_unsigned_modulus, int_max_unsigned_eq. trivial.
rewrite H; clear H Heqz0. rewrite Z.mul_assoc.
rewrite (Z_div_plus_full_l (k*z0) 8 (z*8)). 2: lia.
rewrite Z_div_mult_full. trivial. lia.
rewrite <- KK; clear H KK.
rewrite Z.opp_add_distr.
rewrite Zplus_mod.
assert (KM: - (k * (Int.modulus / 8)) mod 64 = 0).
apply Zmod_unique with (a:=-k * 8388608). 2: lia. rewrite Zplus_0_r.
rewrite <- max_unsigned_modulus, int_max_unsigned_eq. simpl.
rewrite Zopp_mult_distr_l, <- Z.mul_assoc. reflexivity.
rewrite KM. simpl. apply Z.mod_mod. lia.
}
rewrite Z12; trivial.
Qed.
Lemma pad_injective_Case5 l1 l2
(H0 : (l1 ++ 128 :: nil) ++
repeat 0 (Z.to_nat (- (BlockSize + Zlength l1 + 9) mod 64)) =
(l2 ++ 128 :: nil) ++
repeat 0 (Z.to_nat (- (BlockSize + Zlength l2 + 9) mod 64)))
(H : (BlockSize + Zlength l1) * 8 =
((BlockSize + Zlength l2) * 8) mod Int.modulus)
(Nonneg1 : 0 <= (BlockSize + Zlength l1) * 8)
(l : (BlockSize + Zlength l1) * 8 < Int.modulus):
length l1 = length l2.
Proof. symmetry in H.
destruct (mod_exists _ _ _ H) as [k K].
specialize Int.modulus_pos; intros; lia.
destruct (zeq k 0).
subst. clear - K.
assert (Zlength l1 = Zlength l2). lia.
repeat rewrite Zlength_correct in H.
rewrite <- (Nat2Z.id (length l1)).
rewrite <- (Nat2Z.id (length l2)).
rewrite H. reflexivity.
clear H.
assert (length ((l1 ++ 128 :: nil) ++
repeat 0 (Z.to_nat (- (BlockSize + Zlength l1 + 9) mod 64)))
= length ((l2 ++ 128 :: nil) ++
repeat 0 (Z.to_nat (- (BlockSize + Zlength l2 + 9) mod 64)))).
rewrite H0; trivial.
clear H0. repeat rewrite app_length in H.
repeat rewrite repeat_length in H.
clear - K n H.
rewrite (pad_injective_aux l1 l2 k K n) in H. lia.
Qed.
Lemma pad_inc_injective: forall l1 l2, pad_inc l1 = pad_inc l2 -> l1=l2.
Proof. intros.
remember (beq_nat (length l1) (length l2)) as d.
destruct d.
{ apply beq_nat_eq in Heqd.
unfold pad_inc in H. repeat rewrite Zlength_correct in H.
rewrite <- Heqd in H.
eapply app_inv_tail. apply H. }
{ symmetry in Heqd; apply beq_nat_false in Heqd.
unfold pad_inc in H.
repeat rewrite app_assoc in H.
destruct (app_inv_length2 _ _ _ _ H); clear H. reflexivity.
apply pure_lemmas.intlist_to_Zlist_inj in H1.
apply cons_inv in H1. destruct H1 as [_ Y].
apply cons_inv in Y. destruct Y as [Y _].
assert (Int.unsigned (Int.repr ((BlockSize + Zlength l1) * 8)) = Int.unsigned (Int.repr ((BlockSize + Zlength l2) * 8))).
rewrite Y; trivial.
elim Heqd; clear Heqd Y.
repeat rewrite Int.unsigned_repr_eq in H.
assert (Nonneg1: 0 <= (BlockSize + Zlength l1) * 8).
specialize (Zlength_nonneg l1). intros; unfold BlockSize; lia.
assert (Nonneg2: 0 <= (BlockSize + Zlength l2) * 8).
specialize (Zlength_nonneg l2). intros; unfold BlockSize; lia.
remember (zlt ((BlockSize + Zlength l1) * 8) Int.modulus).
destruct s; clear Heqs.
{ rewrite Zmod_small in H. 2: split; assumption.
remember (zlt ((BlockSize + Zlength l2) * 8) Int.modulus).
destruct s; clear Heqs.
{ (*Case 3*)
rewrite Zmod_small in H. 2: split; assumption.
clear - H.
assert (Zlength l1 = Zlength l2). lia.
repeat rewrite Zlength_correct in H0.
rewrite <- (Nat2Z.id (length l1)).
rewrite <- (Nat2Z.id (length l2)).
rewrite H0. reflexivity. }
{ (*Case 5*) clear g Nonneg2.
apply pad_injective_Case5; assumption. } }
{ clear g Nonneg1.
remember (zlt ((BlockSize + Zlength l2) * 8) Int.modulus).
destruct s; clear Heqs.
{ (*Case 5, symmetric version*)
rewrite (Zmod_small ((BlockSize + Zlength l2) * 8)) in H. 2: split; assumption.
symmetry. symmetry in H. symmetry in H0.
apply pad_injective_Case5; assumption. }
{ clear Nonneg2 g.
remember ((BlockSize + Zlength l1) * 8) as z1.
remember ((BlockSize + Zlength l2) * 8) as z2.
rewrite Zmod_eq in H. 2: apply Int.modulus_pos. remember (z1 / Int.modulus) as k1; clear Heqk1.
rewrite Zmod_eq in H. 2: apply Int.modulus_pos. remember (z2 / Int.modulus) as k2; clear Heqk2.
destruct (zeq k1 k2).
{ subst. clear -H.
assert (Zlength l1 = Zlength l2). lia.
repeat rewrite Zlength_correct in H0.
rewrite <- (Nat2Z.id (length l1)).
rewrite <- (Nat2Z.id (length l2)).
rewrite H0. reflexivity. }
{ assert (length ((l1 ++ 128 :: nil) ++
repeat 0 (Z.to_nat (- (BlockSize + Zlength l1 + 9) mod 64)))
= length ((l2 ++ 128 :: nil) ++
repeat 0 (Z.to_nat (- (BlockSize + Zlength l2 + 9) mod 64)))).
rewrite H0; trivial.
clear H0. repeat rewrite app_length in H1.
repeat rewrite repeat_length in H1.
rewrite (pad_injective_aux l2 l1 (k1-k2)) in H1.
lia.
rewrite Z.mul_sub_distr_r; lia.
lia. } } } }
Qed.
(********************************************************************)
Lemma block_8 A (l:list A): length l = b -> InBlocks 8 l.
Proof.
intros len. apply InBlocks_len. exists 64%nat. apply len.
Qed.
Lemma xor_equiv_byte: forall xpad XPAD k K, isbyteZ XPAD ->
bytes_bits_lists xpad (HP.HMAC_SHA256.sixtyfour XPAD) ->
bytes_bits_lists k (map Byte.unsigned K) ->
bytes_bits_lists (BLxor k xpad) (HP.HMAC_SHA256.mkArgZ K (Byte.repr XPAD)).
Proof. intros. apply inner_general_mapByte; try assumption.
rewrite <- SF_ByteRepr; trivial.
Qed.
Definition hf_c := (32 * 8)%nat.
Definition hf_p := (32 * 8)%nat.
Definition hf_b := (hf_c + hf_p)%nat.
Definition hf_iv := intsToBits SHA256.init_registers.
Definition hf_h := sha_h.
(* Definition hf_pad_inc := pad_inc.
Definition hf_splitandpad_inc (msg : Blist) : Blist := bytesToBits (hf_pad_inc (bitsToBytes msg)).
Definition hf_pad_inc_injective := pad_inc_injective.*)
Definition hf_iv_length := sha_iv_length.
Definition hf_h_length := sha_h_length.
Definition hf_block_8 := block_8.
End SHAHF.
*)
|
Formal statement is: lemma (in ring_of_sets) range_disjointed_sets: assumes A: "range A \<subseteq> M" shows "range (disjointed A) \<subseteq> M" Informal statement is: If $A$ is a collection of subsets of a set $X$, then the range of the collection of disjoint sets of $A$ is a subset of $X$. |
function inputString = writeLineFromVar(defaultClass, variableName, maskVars, maskViz, classNum, structName)
% This function creates a string that is written to a wecSimInputFile.m
% line based on a class abbreviation, variable name and its mask value
%
% It is possible to write the input file with a long list of fprintf lines
% such as:
% fprintf(fid,'simu.rampTime = %s; \r\n',maskVars.rampTime);
% fprintf(fid,'simu.endTime = %s; \r\n',maskVars.endTime);
% However this doesn't allow the maskVariable to be checked against a
% default value or its visibility (its necessity) without an excessive
% number of if statements in writeInputFromBlocks.m. Comparing against
% these parameters before writing reduces the number of extraneous values written to the input file.
%
% Parameters
% ------------
% defaultClass : WEC-Sim Object
% Default instance of a WEC-Sim class. Must contain the variableName that is
% being written to the input file
%
% variableName : string
% Name of the variable within defaultClass that is being written to
% the input file.
%
% maskVars : struct
% Structure containing all mask parameter values
%
% maskViz : string
% Structure containing all mask parameter visibilities
%
% classNum : int
% Number specifying the index of a class being written
% i.e. 1 for body(1), 4 for pto(4), 7 for constraint(7), ...
%
% structName : string
% Structure containing all mask parameter visibilities
%
% Returns
% -------
% inputString : string
% string to write to the input file
%
% TODO
% ----
% Link mask tool tips with input line comments
%
% Track if variable should be written
hasStruct = ~isempty(structName); % check if variable is in a class' struct (correspond to a mask tab)
isVisible = strcmp(maskViz.(variableName),'on'); % check if mask variable is visible
% Get the default value of the variable within its WEC-Sim class
if hasStruct
isDefault = isequal(defaultClass.(structName).(variableName), eval(maskVars.(variableName)));
else
isDefault = isequal(defaultClass.(variableName), eval(maskVars.(variableName)));
end
% Only write parameters if they are visible (turned on and relevant) and
% are different from the class default
if isVisible && ~isDefault
% Append the class index if necessary. E.g. 'body' --> 'body(1)'
classAbbrev = inputname(1);
if ~isempty(classNum)
classAbbrev = [classAbbrev '(' num2str(classNum) ')'];
end
if hasStruct
% e.g. 'body(1).initial.displacement = [1 1 1]; \r\n'
inputString = [classAbbrev '.' structName '.' variableName ' = ' maskVars.(variableName) '; \r\n'];
else
% e.g. 'simu.stateSpace = 'on'; \r\n'
inputString = [classAbbrev '.' variableName ' = ' maskVars.(variableName) '; \r\n'];
end
else
% Write nothing to input file
inputString = '';
end
end
|
-- Run this test case in safe mode
-- {-# OPTIONS --safe #-} -- does not parse (2012-03-12 Andreas)
module Issue586 where
Foo : Set1
Foo = Set
|
// Copyright (c) 2018 by University Paris-Est Marne-la-Vallee
// Geometric.hpp
// This file is part of the Garamon for project_namespace.
// Authors: Stephane Breuils and Vincent Nozick
// Contact: [email protected]
//
// Licence MIT
// A a copy of the MIT License is given along with this program
/// \file Geometric.hpp
/// \author Stephane Breuils, Vincent Nozick
/// \brief Recursive geometric product for project_namespace.
#ifndef project_inclusion_guard
#define project_inclusion_guard
#pragma once
#include <Eigen/Core>
#include "project_namespace/Mvec.hpp"
#include "project_namespace/Constants.hpp"
/*!
* @namespace project_namespace
*/
namespace project_namespace {
template<typename T> class Mvec;
/// \brief Recursively compute the geometric product between two multivectors mv1 and mv2, the result is put into the multivector mv3
/// \tparam the type of value that we manipulate, either float or double or something.
/// \param mv1 - the first multivector
/// \param mv2 - the second multivector
/// \param mv3 - the multivector that will content the result of the operation mv3 = mv1 * mv2
/// \param grade_mv1 - the grade of the first multivector
/// \param grade_mv2 - the grade of the second multivector
/// \param grade_mv3 - could be the grade of the result, however here it is useless due to the fact that the resulting multivector may not be homogeneous
/// \param currentGradeMv1 - the current grade of the traversed tree of mv1
/// \param currentGradeMv2 - the current grade of the traversed tree of mv2
/// \param currentGradeMv3 - the current grade of the traversed tree of mv3
/// \param sign - compute the sign of the geometric product between two blades
/// \param complement - activate the flip of sign
/// \param indexLastVector_mv1 - last vector traversed in the multivector mv1
/// \param indexLastVector_mv2 - last vector traversed in the multivector mv2
/// \param indexLastVector_mv3 - last vector traversed in the multivector mv3
/// \param currentMetricCoefficient - coefficient that is used for handling the metric in the recursive formula
/// \param depth - depth in the resulting multivector tree
template<typename T>
void geoProduct(const Eigen::Matrix<T, Eigen::Dynamic, 1> &mv1,
const Eigen::Matrix<T, Eigen::Dynamic, 1> &mv2,
Mvec<T> &mv3, // multivectors to be processed
const unsigned int grade_mv1,
const unsigned int grade_mv2,
const unsigned int grade_mv3, // grade of the k-vectors
unsigned int currentXorIdx1=0, unsigned int currentXorIdx2=0, unsigned int currentXorIdx3=0, // position in the prefix tree
unsigned int currentGradeMv1=0, unsigned int currentGradeMv2=0, unsigned int currentGradeMv3=0, // grade relative to the position in the prefix tree
int sign=1, int complement=1,
unsigned int indexLastVector_mv1=0, unsigned int indexLastVector_mv2=0, unsigned int indexLastVector_mv3=0,
double currentMetricCoefficient=1.0, int depth=0) {
// sign updating
int tmpSign = sign;
if(complement == -1) {
tmpSign = -tmpSign;
}
// when we reach the grade of mv1 and mv2
if( (currentGradeMv1==grade_mv1) && (currentGradeMv2==grade_mv2) ){
// do the required computation
mv3.at(currentGradeMv3, xorIndexToHomogeneousIndex[currentXorIdx3]) += sign * currentMetricCoefficient * mv1(xorIndexToHomogeneousIndex[currentXorIdx1]) * mv2(xorIndexToHomogeneousIndex[currentXorIdx2]);
}else {
// if position in the tree for mv3 is not yet of grade of mv3, just call the recursive calls, without computation
// for each possible children of the current node whose index is given by depth
for (unsigned int i = (unsigned int) (1 << depth);
i < (1 << algebraDimension); i *= 2) {
unsigned int xorIndexMv1Child = currentXorIdx1 + i; // xor index of the child of the first tree multivector
unsigned int xorIndexMv2Child = currentXorIdx2 + i; // xor index of the child of the second tree multivector
unsigned int xorIndexMv3Child = currentXorIdx3 + i; // xor index of the child of the third tree multivector
// if we reach neither the grade of mv1 nor the grade of mv2 AND if the child of the node of mv1 lead to at least one node whose grade is grade_mv1
// AND if the child of the node of mv2 lead to at least one node whose grade is grade_mv2
if ((currentGradeMv1 < grade_mv1) &&
((i << (grade_mv1 - (currentGradeMv1 + 1))) < (1 << algebraDimension)) &&
(currentGradeMv2 < grade_mv2) &&
((i << (grade_mv2 - (currentGradeMv2 + 1))) < (1 << algebraDimension))) {
geoProduct<T>(mv1, mv2, mv3,
grade_mv1, grade_mv2, grade_mv3,
xorIndexMv1Child, xorIndexMv2Child, currentXorIdx3,
currentGradeMv1 + 1, currentGradeMv2 + 1, currentGradeMv3,
tmpSign, -complement,
i, i << 1, indexLastVector_mv3,
diagonalMetric<T>(depth) * currentMetricCoefficient,
depth + 1); // scalar product part of the geometric product
}
// if we do not reach the grade of mv1 AND if the child of the node of mv1 lead to at least one node whose grade is grade_mv1
if ((currentGradeMv1 < grade_mv1) &&
((i << (grade_mv1 - (currentGradeMv1 + 1))) < (1 << algebraDimension))) {
geoProduct<T>(mv1, mv2, mv3,
grade_mv1, grade_mv2, grade_mv3,
xorIndexMv1Child, currentXorIdx2, xorIndexMv3Child,
currentGradeMv1 + 1, currentGradeMv2, currentGradeMv3 + 1,
tmpSign, complement,
i, i << 1, indexLastVector_mv3,
currentMetricCoefficient, depth + 1); // outer part of the geometric product to CHECK
}
// if we do not reach the grade of mv2 AND if the child of the node of mv2 lead to at least one node whose grade is grade_mv2
if ((currentGradeMv2 < grade_mv2) &&
((i << (grade_mv2 - (currentGradeMv2 + 1))) < (1 << algebraDimension))) {
geoProduct<T>(mv1, mv2, mv3,
grade_mv1, grade_mv2, grade_mv3,
currentXorIdx1, xorIndexMv2Child, xorIndexMv3Child,
currentGradeMv1, currentGradeMv2 + 1, currentGradeMv3 + 1,
sign, -complement,
indexLastVector_mv1, i << 1, i,
currentMetricCoefficient, depth + 1); // outer part of the geometric product
}
depth++;
}
}
}
}/// End of Namespace
#endif // project_inclusion_guard |
/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
import Lean.Data.Options
/- Basic support for auto bound implicit local names -/
namespace Lean.Elab
register_builtin_option autoBoundImplicitLocal : Bool := {
defValue := true
descr := "Unbound local variables in declaration headers become implicit arguments if they are a lower case or greek letter followed by numeric digits. For example, `def f (x : Vector Ξ± n) : Vector Ξ± n :=` automatically introduces the implicit variables {Ξ± n}."
}
private def isValidAutoBoundSuffix (s : String) : Bool :=
s.toSubstring.drop 1 |>.all fun c => c.isDigit || isSubScriptAlnum c || c == '_' || c == '\''
/-
Remark: Issue #255 exposed a nasty interaction between macro scopes and auto-bound-implicit names.
```
local notation "A" => id x
theorem test : A = A := sorry
```
We used to use `n.eraseMacroScopes` at `isValidAutoBoundImplicitName` and `isValidAutoBoundLevelName`.
Thus, in the example above, when `A` is expanded, a `x` with a fresh macro scope is created.
`x`+macros-scope is not in scope and is a valid auto-bound implicit name after macro scopes are erased.
So, an auto-bound exception would be thrown, and `x`+macro-scope would be added as a new implicit.
When, we try again, a `x` with a new macro scope is created and this process keeps repeating.
Therefore, we do consider identifier with macro scopes anymore.
-/
def isValidAutoBoundImplicitName (n : Name) : Bool :=
match n with
| Name.str Name.anonymous s _ => s.length > 0 && (isGreek s[0] || s[0].isLower) && isValidAutoBoundSuffix s
| _ => false
def isValidAutoBoundLevelName (n : Name) : Bool :=
match n with
| Name.str Name.anonymous s _ => s.length > 0 && s[0].isLower && isValidAutoBoundSuffix s
| _ => false
end Lean.Elab
|
{--
Copyright 2021 Joel Berkeley
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.
--}
||| This module contains error types.
module Error
||| An `Error` indicates a runtime error.
public export
interface Error exc where
||| Show the error in a human readable format.
format : exc -> String
||| Indicates a value is invalid.
public export
data ValueError = MkValueError String
export
Error ValueError where
format (MkValueError msg) = msg
|
/-
Copyright (c) 2020 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import data.polynomial.algebra_map
import data.polynomial.monic
/-!
# Polynomials that lift
Given semirings `R` and `S` with a morphism `f : R β+* S`, we define a subsemiring `lifts` of
`polynomial S` by the image of `ring_hom.of (map f)`.
Then, we prove that a polynomial that lifts can always be lifted to a polynomial of the same degree
and that a monic polynomial that lifts can be lifted to a monic polynomial (of the same degree).
## Main definition
* `lifts (f : R β+* S)` : the subsemiring of polynomials that lift.
## Main results
* `lifts_and_degree_eq` : A polynomial lifts if and only if it can be lifted to a polynomial
of the same degree.
* `lifts_and_degree_eq_and_monic` : A monic polynomial lifts if and only if it can be lifted to a
monic polynomial of the same degree.
* `lifts_iff_alg` : if `R` is commutative, a polynomial lifts if and only if it is in the image of
`map_alg`, where `map_alg : R[X] ββ[R] S[X]` is the only `R`-algebra map
that sends `X` to `X`.
## Implementation details
In general `R` and `S` are semiring, so `lifts` is a semiring. In the case of rings, see
`lifts_iff_lifts_ring`.
Since we do not assume `R` to be commutative, we cannot say in general that the set of polynomials
that lift is a subalgebra. (By `lift_iff` this is true if `R` is commutative.)
-/
open_locale classical big_operators polynomial
noncomputable theory
namespace polynomial
universes u v w
section semiring
variables {R : Type u} [semiring R] {S : Type v} [semiring S] {f : R β+* S}
/-- We define the subsemiring of polynomials that lifts as the image of `ring_hom.of (map f)`. -/
def lifts (f : R β+* S) : subsemiring S[X] := ring_hom.srange (map_ring_hom f)
lemma mem_lifts (p : S[X]) : p β lifts f β β (q : R[X]), map f q = p :=
by simp only [coe_map_ring_hom, lifts, ring_hom.mem_srange]
lemma lifts_iff_set_range (p : S[X]) : p β lifts f β p β set.range (map f) :=
by simp only [coe_map_ring_hom, lifts, set.mem_range, ring_hom.mem_srange]
lemma lifts_iff_ring_hom_srange (p : S[X]) : p β lifts f β p β (map_ring_hom f).srange :=
by simp only [coe_map_ring_hom, lifts, set.mem_range, ring_hom.mem_srange]
lemma lifts_iff_coeff_lifts (p : S[X]) : p β lifts f β β (n : β), p.coeff n β set.range f :=
by { rw [lifts_iff_ring_hom_srange, mem_map_srange f], refl }
/--If `(r : R)`, then `C (f r)` lifts. -/
lemma C_mem_lifts (f : R β+* S) (r : R) : (C (f r)) β lifts f :=
β¨C r, by simp only [coe_map_ring_hom, map_C, set.mem_univ, subsemiring.coe_top, eq_self_iff_true,
and_self]β©
/-- If `(s : S)` is in the image of `f`, then `C s` lifts. -/
lemma C'_mem_lifts {f : R β+* S} {s : S} (h : s β set.range f) : (C s) β lifts f :=
begin
obtain β¨r, rflβ© := set.mem_range.1 h,
use C r,
simp only [coe_map_ring_hom, map_C, set.mem_univ, subsemiring.coe_top, eq_self_iff_true,
and_self]
end
/-- The polynomial `X` lifts. -/
lemma X_mem_lifts (f : R β+* S) : (X : S[X]) β lifts f :=
β¨X, by simp only [coe_map_ring_hom, set.mem_univ, subsemiring.coe_top, eq_self_iff_true, map_X,
and_self]β©
/-- The polynomial `X ^ n` lifts. -/
lemma X_pow_mem_lifts (f : R β+* S) (n : β) : (X ^ n : S[X]) β lifts f :=
β¨X ^ n, by simp only [coe_map_ring_hom, map_pow, set.mem_univ, subsemiring.coe_top,
eq_self_iff_true, map_X, and_self]β©
/-- If `p` lifts and `(r : R)` then `r * p` lifts. -/
lemma base_mul_mem_lifts {p : S[X]} (r : R) (hp : p β lifts f) : C (f r) * p β lifts f :=
begin
simp only [lifts, ring_hom.mem_srange] at hp β’,
obtain β¨pβ, rflβ© := hp,
use C r * pβ,
simp only [coe_map_ring_hom, map_C, map_mul]
end
/-- If `(s : S)` is in the image of `f`, then `monomial n s` lifts. -/
lemma monomial_mem_lifts {s : S} (n : β) (h : s β set.range f) : (monomial n s) β lifts f :=
begin
obtain β¨r, rflβ© := set.mem_range.1 h,
use monomial n r,
simp only [coe_map_ring_hom, set.mem_univ, map_monomial, subsemiring.coe_top, eq_self_iff_true,
and_self],
end
/-- If `p` lifts then `p.erase n` lifts. -/
lemma erase_mem_lifts {p : S[X]} (n : β) (h : p β lifts f) : p.erase n β lifts f :=
begin
rw [lifts_iff_ring_hom_srange, mem_map_srange] at h β’,
intros k,
by_cases hk : k = n,
{ use 0,
simp only [hk, ring_hom.map_zero, erase_same] },
obtain β¨i, hiβ© := h k,
use i,
simp only [hi, hk, erase_ne, ne.def, not_false_iff],
end
section lift_deg
lemma monomial_mem_lifts_and_degree_eq {s : S} {n : β} (hl : monomial n s β lifts f) :
β (q : R[X]), map f q = (monomial n s) β§ q.degree = (monomial n s).degree :=
begin
by_cases hzero : s = 0,
{ use 0,
simp only [hzero, degree_zero, eq_self_iff_true, and_self, monomial_zero_right,
polynomial.map_zero] },
rw lifts_iff_set_range at hl,
obtain β¨q, hqβ© := hl,
replace hq := (ext_iff.1 hq) n,
have hcoeff : f (q.coeff n) = s,
{ simp [coeff_monomial] at hq,
exact hq },
use (monomial n (q.coeff n)),
split,
{ simp only [hcoeff, map_monomial] },
have hqzero : q.coeff n β 0,
{ intro habs,
simp only [habs, ring_hom.map_zero] at hcoeff,
exact hzero hcoeff.symm },
repeat {rw monomial_eq_C_mul_X},
simp only [hzero, hqzero, ne.def, not_false_iff, degree_C_mul_X_pow],
end
/-- A polynomial lifts if and only if it can be lifted to a polynomial of the same degree. -/
lemma mem_lifts_and_degree_eq {p : S[X]} (hlifts : p β lifts f) :
β (q : R[X]), map f q = p β§ q.degree = p.degree :=
begin
generalize' hd : p.nat_degree = d,
revert hd p,
apply nat.strong_induction_on d,
intros n hn p hlifts hdeg,
by_cases erase_zero : p.erase_lead = 0,
{ rw [β erase_lead_add_monomial_nat_degree_leading_coeff p, erase_zero, zero_add, leading_coeff],
exact monomial_mem_lifts_and_degree_eq (monomial_mem_lifts p.nat_degree
((lifts_iff_coeff_lifts p).1 hlifts p.nat_degree)) },
have deg_erase := or.resolve_right (erase_lead_nat_degree_lt_or_erase_lead_eq_zero p) erase_zero,
have pzero : p β 0,
{ intro habs,
exfalso,
rw [habs, erase_lead_zero, eq_self_iff_true, not_true] at erase_zero,
exact erase_zero },
have lead_zero : p.coeff p.nat_degree β 0,
{ rw [β leading_coeff, ne.def, leading_coeff_eq_zero]; exact pzero },
obtain β¨lead, hleadβ© := monomial_mem_lifts_and_degree_eq (monomial_mem_lifts p.nat_degree
((lifts_iff_coeff_lifts p).1 hlifts p.nat_degree)),
have deg_lead : lead.degree = p.nat_degree,
{ rw [hlead.2, monomial_eq_C_mul_X, degree_C_mul_X_pow p.nat_degree lead_zero] },
rw hdeg at deg_erase,
obtain β¨erase, heraseβ© := hn p.erase_lead.nat_degree deg_erase
(erase_mem_lifts p.nat_degree hlifts) (refl p.erase_lead.nat_degree),
use erase + lead,
split,
{ simp only [hlead, herase, polynomial.map_add],
nth_rewrite 0 erase_lead_add_monomial_nat_degree_leading_coeff p },
rw [βhdeg, erase_lead] at deg_erase,
replace deg_erase := lt_of_le_of_lt degree_le_nat_degree (with_bot.coe_lt_coe.2 deg_erase),
rw [β deg_lead, β herase.2] at deg_erase,
rw [degree_add_eq_right_of_degree_lt deg_erase, deg_lead, degree_eq_nat_degree pzero]
end
end lift_deg
section monic
/-- A monic polynomial lifts if and only if it can be lifted to a monic polynomial
of the same degree. -/
lemma lifts_and_degree_eq_and_monic [nontrivial S] {p : S[X]} (hlifts : p β lifts f)
(hp : p.monic) : β (q : R[X]), map f q = p β§ q.degree = p.degree β§ q.monic :=
begin
casesI subsingleton_or_nontrivial R with hR hR,
{ obtain β¨q, hqβ© := mem_lifts_and_degree_eq hlifts,
exact β¨q, hq.1, hq.2, monic_of_subsingleton _β© },
have H : erase p.nat_degree p + X ^ p.nat_degree = p,
{ simpa only [hp.leading_coeff, C_1, one_mul, erase_lead] using erase_lead_add_C_mul_X_pow p },
by_cases h0 : erase p.nat_degree p = 0,
{ rw [β H, h0, zero_add],
refine β¨X ^ p.nat_degree, _, _, monic_X_pow p.nat_degreeβ©,
{ rw [polynomial.map_pow, map_X] },
{ rw [degree_X_pow, degree_X_pow] } },
obtain β¨q, hqβ© := mem_lifts_and_degree_eq (erase_mem_lifts p.nat_degree hlifts),
have hdeg : q.degree < (X ^ p.nat_degree).degree,
{ rw [@degree_X_pow R, hq.2, degree_eq_nat_degree h0, with_bot.coe_lt_coe],
exact or.resolve_right (erase_lead_nat_degree_lt_or_erase_lead_eq_zero p) h0, },
refine β¨q + X ^ p.nat_degree, _, _, (monic_X_pow _).add_of_right hdegβ©,
{ rw [polynomial.map_add, hq.1, polynomial.map_pow, map_X, H], },
{ rw [degree_add_eq_right_of_degree_lt hdeg, degree_X_pow, degree_eq_nat_degree hp.ne_zero] }
end
end monic
end semiring
section ring
variables {R : Type u} [ring R] {S : Type v} [ring S] (f : R β+* S)
/-- The subring of polynomials that lift. -/
def lifts_ring (f : R β+* S) : subring S[X] := ring_hom.range (map_ring_hom f)
/-- If `R` and `S` are rings, `p` is in the subring of polynomials that lift if and only if it is in
the subsemiring of polynomials that lift. -/
lemma lifts_iff_lifts_ring (p : S[X]) : p β lifts f β p β lifts_ring f :=
by simp only [lifts, lifts_ring, ring_hom.mem_range, ring_hom.mem_srange]
end ring
section algebra
variables {R : Type u} [comm_semiring R] {S : Type v} [semiring S] [algebra R S]
/-- The map `polynomial R β S[X]` as an algebra homomorphism. -/
def map_alg (R : Type u) [comm_semiring R] (S : Type v) [semiring S] [algebra R S] :
R[X] ββ[R] S[X] := @aeval _ S[X] _ _ _ (X : S[X])
/-- `map_alg` is the morphism induced by `R β S`. -/
lemma map_alg_eq_map (p : R[X]) : map_alg R S p = map (algebra_map R S) p :=
by simp only [map_alg, aeval_def, evalβ, map, algebra_map_apply, ring_hom.coe_comp]
/-- A polynomial `p` lifts if and only if it is in the image of `map_alg`. -/
lemma mem_lifts_iff_mem_alg (R : Type u) [comm_semiring R] {S : Type v} [semiring S] [algebra R S]
(p : S[X]) :p β lifts (algebra_map R S) β p β (alg_hom.range (@map_alg R _ S _ _)) :=
by simp only [coe_map_ring_hom, lifts, map_alg_eq_map, alg_hom.mem_range,
ring_hom.mem_srange]
/-- If `p` lifts and `(r : R)` then `r β’ p` lifts. -/
lemma smul_mem_lifts {p : S[X]} (r : R) (hp : p β lifts (algebra_map R S)) :
r β’ p β lifts (algebra_map R S) :=
by { rw mem_lifts_iff_mem_alg at hp β’, exact subalgebra.smul_mem (map_alg R S).range hp r }
end algebra
end polynomial
|
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <boost/nowide/args.hpp>
#include <boost/nowide/iostream.hpp>
#include "DemoFile.hpp"
namespace nowide = boost::nowide;
void usage()
{
nowide::cout << "Usage:"
"\n\tListdemo <path to demo.dem>"
"\n\t- Shows information about the demo."
<< std::endl;
}
template<size_t N>
inline bool any_matches(const char* pattern, const char* const (&samples)[N])
{
for (size_t i = 0; i < N; ++i) {
if (!std::strcmp(pattern, samples[i]))
return true;
}
return false;
}
int main(int argc, char *argv[])
{
nowide::args a(argc, argv);
if (argc != 2) {
usage();
nowide::cin.get();
return 1;
}
try {
DemoFile demo(argv[1]);
nowide::cout << "Reading " << argv[1] << "...\n\n";
nowide::cout << "Demo protocol: " << demo.header.demoProtocol << '\n';
nowide::cout << "Net protocol: " << demo.header.netProtocol << '\n';
nowide::cout << "Map name: " << demo.header.mapName << '\n';
nowide::cout << "Game directory: " << demo.header.gameDir << "\n\n";
size_t i = 0;
for (const auto& entry : demo.directoryEntries) {
++i;
if (entry.type == 0) {
// Don't print the start segment, no useful info.
continue;
}
nowide::cout << i << ":\n";
nowide::cout << "\tType: " << (entry.type ? "normal" : "start") << " segment\n";
nowide::cout << "\tDescription: " << entry.description << '\n';
nowide::cout << "\tTime (inaccurate): " << entry.trackTime << "s\n";
nowide::cout << "\tFrames: " << entry.frameCount << '\n';
}
nowide::cout << "\nReading frames...\n" << std::endl;
demo.ReadFrames();
float frametime_min, frametime_max;
double frametime_sum = 0.0;
size_t count = 0;
uint8_t msec_min, msec_max;
long long msec_sum = 0;
bool first = true;
bool found_cam_commands = false;
for (auto& entry : demo.directoryEntries) {
for (auto& frame : entry.frames) {
if (static_cast<int>(frame->type) < 2 || static_cast<int>(frame->type) > 9) {
NetMsgFrame *f = static_cast<NetMsgFrame*>(frame.get());
frametime_sum += f->DemoInfo.RefParams.frametime;
msec_sum += f->DemoInfo.UserCmd.msec;
count++;
if (first) {
first = false;
frametime_min = f->DemoInfo.RefParams.frametime;
frametime_max = f->DemoInfo.RefParams.frametime;
msec_min = f->DemoInfo.UserCmd.msec;
msec_max = f->DemoInfo.UserCmd.msec;
} else {
frametime_min = std::min(frametime_min, f->DemoInfo.RefParams.frametime);
frametime_max = std::max(frametime_max, f->DemoInfo.RefParams.frametime);
msec_min = std::min(msec_min, f->DemoInfo.UserCmd.msec);
msec_max = std::max(msec_max, f->DemoInfo.UserCmd.msec);
}
}
if (frame->type == DemoFrameType::CONSOLE_COMMAND) {
const char* const camera_commands[] = {
"+lookup",
"+lookdown",
"+left",
"+right"
};
ConsoleCommandFrame *f = static_cast<ConsoleCommandFrame*>(frame.get());
if (!found_cam_commands && any_matches(f->command.c_str(), camera_commands)) {
found_cam_commands = true;
}
}
}
}
if (first) {
nowide::cout << "There are no demo frames.\n";
} else {
nowide::cout << "Highest FPS: " << (1 / frametime_min) << '\n';
nowide::cout << "Lowest FPS: " << (1 / frametime_max) << '\n';
nowide::cout << "Average FPS: " << (count / frametime_sum) << '\n';
nowide::cout << "Lowest msec: " << static_cast<unsigned>(msec_min) << " (" << (1000.0 / msec_min) << " FPS)\n";
nowide::cout << "Highest msec: " << static_cast<unsigned>(msec_max) << " (" << (1000.0 / msec_max) << " FPS)\n";
nowide::cout << "Average msec: " << (msec_sum / static_cast<double>(count)) << " (" << (1000.0 / (msec_sum / static_cast<double>(count))) << " FPS)\n";
if (found_cam_commands)
nowide::cout << "\nFound camera movement commands.\n";
}
} catch (const std::exception& ex) {
nowide::cout << "Error: " << ex.what() << std::endl;
}
nowide::cin.get();
return 0;
}
|
example : β n m, n + m = 1 β (n = 0 β¨ m = 0) := begin
intros n,
induction n,
intros,
simp,
intros m,
rw [nat.add_comm, nat.add_succ],
intro a,
have b : m + n_n = 0 := begin
exact nat.succ_inj a
end,
right,
exact (nat.eq_zero_of_add_eq_zero b).left
end |
"""
Alternate positional forms
"""
module Alternate
# For reference only in deference to the form below with keyword step
@static if false
"""
range( length, start = 1, stop = length; step = nothing )
Alternate one, two, and three argument range argument `range`. Compact.
"""
Base.range(length, start = 1, stop = nothing) =
start === 1 && stop === nothing ?
Base.OneTo(length) :
Base.range(start, stop; length)
"""
```julia
julia> Base.range(5)
Base.OneTo(5)
julia> Base.range(5, 2)
2:6
julia> Base.range(5, 2, 11)
2.0:2.25:11.0
```
"""
"""
range( length, start = 1, stop = length; step = nothing )
Alternate one, two, and three argument range argument `range`
"""
function Base.range(length, start = 1, stop = nothing; step = nothing)
if step === nothing
if start === 1 && stop === length
Base.OneTo(length)
else
Base._range(start, step, stop, length)
end
elseif stop === nothing
Base._range(start, step, stop, length)
else
throw(ArgumentError("Cannot specify all of length = $length, start = $start, stop = $stop, and step = $step"))
end
end
"""
```julia
julia> Base.range(5)
Base.OneTo(5)
julia> Base.range(5, 2)
2:6
julia> Base.range(5, 2, 11)
2.0:2.25:11.0
```
"""
end
end |
The space of an interval measure is the entire universe. |
(*partie1 *)
Require Import untypedLC.
(*booleans*)
Definition ctr := \ x yΒ·x.
Definition cfa := \ x yΒ· y.
(*boolean functions*)
Definition cif := \ x y zΒ· x y z.
Definition cand := \ a bΒ· \x y Β· a (b a b)y.
Compute equiv_lexp (cand cfa ctr) cfa.
Definition cor := \a bΒ·\x yΒ·a x(b x y).
Compute equiv_lexp (cor cfa ctr) ctr.
Definition cneg := \b Β· b cfa ctr.
Compute equiv_lexp (cneg cfa) ctr.
Definition test := \x Β· \y Β· cif ctr x y.
(*codage de quelques constantes 0, 1, 2, 3.*)
Definition c0 := \f xΒ·x.
Definition c1 := \f x Β·f x.
Definition c2 := \f xΒ· f ( c1 f x ).
Definition c3 := \f xΒ· f ( c2 f x ).
Definition c4 := \f xΒ· f ( c3 f x ).
Definition c5 := \f xΒ· f ( c4 f x).
(* THE REST IS JUST FOR FUN :-) *)
Definition c6 := \f xΒ· f ( c5 f x).
Definition c7 := \f xΒ· f ( c6 f x).
Definition c8 := \f xΒ· f ( c7 f x).
Definition c9 := \f xΒ· f ( c8 f x).
Definition c10 := \f xΒ· f ( c9 f x).
(*opΓ©rations successeur, addition et multiplica-tion,
et du test Γ 0*)
Definition csucc := \n Β· \ f xΒ·f(n f x).
(* succ c9 = c10 ? *)
Compute equiv_lexp (csucc c9) c10.
Definition cadd := \n mΒ·\f xΒ·n f(m f x).
(* c9 + c1 = c10 ? *)
Compute equiv_lexp (cadd c9 c1) c10.
Definition cmult := \n m Β· \fΒ· n(m f).
(* c2 * c5 = c10 ? *)
Compute equiv_lexp (cmult c2 c5) c10.
Definition ceq0 := \nΒ·\x yΒ· n(\zΒ·y) x.
(* c0 = c0 *)
Compute equiv_lexp (ceq0 c0) ctr.
(*couples*)
Definition cpl := \x1 x2 Β· \k Β· k x1 x2.
(*operation sur couples*)
(*voir tests au-dessous*)
Definition kfst := \x1 x2 Β· x1.
Definition ksnd := \x1 x2 Β· x2.
Definition fst := \c Β· c kfst.
Definition snd := \c Β· c ksnd.
(*TEST COUPLES*)
Definition cc := cpl c5 c9.
Compute equiv_lexp (cc kfst) c5.
Compute equiv_lexp (cc ksnd) c9.
Compute equiv_lexp (fst cc) c5.
Compute equiv_lexp (snd cc) c9.
(*Injection*)
Definition inj1 := \x Β· \k l Β· k x.
Definition inj2 := \x Β· \k l Β· l x.
(*INJECTION TEST *)
(*Injected value = number of occurances of the f in the right-side of the equation*)
Compute show_cbn (inj1 (cpl c1 c0) c3).
(*predecesseur*)
(* EXPLICATION :
On prend un entier N.
si N = 1 ou 0. On retourne 0.
Sinon, on ajoute +1 a notre variable SECOND jusqu'a x = n-1
C'est grace a l'usage de couples
i.e : 5 (0,0) -> 5 (0,1) -> 5 (1,2) -> 5 (2,3) -> 5 (3,4) -> 5 (4,5) <=> 4 ! *)
Definition iter := \x Β· cpl (snd x) (csucc (snd x)).
Definition cpred := \n Β· fst ( n iter (cpl c0 c0)).
Compute show_cbn (cpred ).
Compute equiv_lexp (cpred c4) c3.
Compute equiv_lexp (cpred c2) c1.
(* PRED DE 0 ?? . IL FAUT RETORUNER 0 !*)
Compute equiv_lexp (cpred c0) c0.
(*factorial*)
(*The Y combinator*)
Definition Y := \fΒ·(\xΒ·f( x x)) (\x Β· f (x x)).
(*if n = 1, return 1, else cmult n * (n-1)*)
Definition cfonc := \rΒ·\nΒ·cif (ceq0 n) c1 (cmult n (r (cpred n))) .
Definition cfact := Y cfonc.
Compute equiv_lexp (cfact c3) c6.
|
[STATEMENT]
lemma (in Group) sg_l_i:"\<lbrakk>G \<guillemotright> H; x \<in> H \<rbrakk> \<Longrightarrow> (\<rho> x) \<cdot> x = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>G \<guillemotright> H ; x \<in> H\<rbrakk> \<Longrightarrow> \<rho> x \<cdot> x = \<one>
[PROOF STEP]
by (frule sg_subset_elem[of "H" "x"], assumption+,
simp add:l_i) |
module Main where
import AI.HNN.FF.Network
import Numeric.LinearAlgebra
samples :: Samples Double
samples = [ (fromList [0, 0], fromList [0])
, (fromList [0, 1], fromList [1])
, (fromList [1, 0], fromList [1])
, (fromList [1, 1], fromList [0])
]
main :: IO ()
main = do
n <- createNetwork 2 [2] 1
mapM_ (print . output n tanh . fst) samples
putStrLn "------------------"
let n' = trainNTimes 1000 0.8 tanh tanh' n samples
mapM_ (print . output n' tanh . fst) samples
{-
OUTPUT :
[0.5835034660982111]
[0.7161238877902711]
[0.7476745582239942]
[0.7959844102953423]
------------------
[4.427877031872795e-2]
[0.9735228418859667]
[0.9544892359343744]
[-2.7925107071558753e-2]
-}
|
module Sound.Plot where
import qualified Data.Stream as S
import Numeric.LinearAlgebra
import Sound.Types
import Graphics.Rendering.Plot (Series)
import qualified Graphics.Rendering.Plot as P
import Graphics.Rendering.Plot.Gtk (PlotHandle)
import qualified Graphics.Rendering.Plot.Gtk as P
plot :: Int -> [Audio] -> IO PlotHandle
plot n audio = P.display $ do
P.plot (P.Line, map (fromList . S.take n) audio :: [Series])
P.withTextDefaults $ P.setFontFamily "Ubuntu"
P.xlabel "samples"
P.ylabel "amplitude"
P.yrange P.Linear (-1) 1
|
\chapter{Device maintenance}
\section{File system}
The \verb|show file systems| command (Figure \ref{ShowFileSystem}) lists all of the available file systems. This command provides useful information such as the amount of available and free memory, the type of file system, and its permissions. Permissions include read only (ro), write only (wo), and read and write (rw), shown in the Flags column of the command output.\\
\begin{figure}[hbtp]
\caption{The output of 'show filesystems' command}\label{ShowFileSystem}
\centering
\includegraphics[scale=0.8]{pictures/ShowFileSystem.PNG}
\end{figure}
Notice that the flash file system also has an asterisk preceding it. This indicates that flash is the current default file system. The bootable IOS is located in flash; therefore, the pound symbol (\#) is appended to the flash listing.\\
Use \verb|dir <dir-name>| to view the content of the specified directory. You can change the current directory using \verb|cd <dir>| command. The \verb|pwd| (present working directory) command shows you the name of the current directory. \\
In the \verb|flash| file system, the file with \verb|.bin| extension (usually the last listing) is the IOS file image that is running in RAM.
\section{Back up and Restore}
\subsection{Using text file}
The steps to save a configuration using Tera Term follow:
\begin{enumerate}
\item On the File menu, click Log.
\item Choose the location to save the file. Tera Term begins capturing text.
\item After capture has been started, execute the \verb|show run| or \verb|show startup| command. Text displayed in the terminal window is directed to the chosen file.
\item When the capture is complete, select Close in the Tera Term: Log window.
\item View the file to verify that it was not corrupted.
\end{enumerate}
We can restore device configuration by copying the content of a text file to the terminal. Note that the text file requires editing to ensure that encrypted passwords are in plain text. Further, at the CLI, the device must be set at the global configuration mode to receive the commands from the text file being pasted into the terminal window.\\
When using Tera Term, follow these steps:
\begin{enumerate}
\item On the File menu, click Send file.
\item Locate the file to be copied into the device and click Open.
\item Tera Term pastes the file into the device.
\end{enumerate}
\subsection{Using TFTP}
You can use a service like Trivial File Transfer Protocol (TFTP) to remotely back up and restore files. Follow these steps to back up the running configuration to a TFTP server:
\begin{enumerate}
\item Enter the \verb|copy run tftp| command.
\item Enter the IP address of the host where the configuration file will be stored.
\item Enter the name to assign to the configuration file.
\item Press Enter to confirm each choice.
\end{enumerate}
\begin{verbatim}
R1# copy running-config tftp
Address or name of remote host []? 192.168.10.254
Destination filename [r1-confg]? R1-Jan-2016
Write file R1-Jan-2016 to 192.168.10.254? [confirm]
Writing R1-Jan-2016 !!!!!! [OK]
\end{verbatim}
Use these steps to restore the running configuration from a TFTP server:
\begin{enumerate}
\item Enter the \verb|copy tftp run| command.
\item Enter the IP address of the TFTP server where the configuration file is stored.
\item Enter the name of the configuration file. For example, in the above example the file name was R1-Jan-2016.
\item Press Enter to confirm.
\end{enumerate}
\subsection{Using USB}
Images, configurations, and other files can be copied to or from the Cisco USB flash memory with the same reliability as storing and retrieving files using the Compact Flash card. In addition, modular integrated services routers can boot any Cisco IOS Software image saved on USB flash memory.
\begin{verbatim}
R1# dir usbflash0:
Directory of usbflash0:/
1 -rw- 30125020 Dec 22 2032 05:31:32 +00:00 c3825-entservicesk9-mz.123-14.T
63158272 bytes total (33033216 bytes free)
\end{verbatim}
When backing up to a USB port, it is a good idea to issue the show file systems command to verify that the USB drive is there and confirm the name (Figure \ref{USB}). In this case, the USB has a name of \verb|usbflash0|
\begin{figure}[hbtp]
\caption{Verifying the USB drive is available}\label{USB}
\centering
\includegraphics[scale=0.8]{pictures/USB.PNG}
\end{figure}
Use \verb|copy run usbflash0:/| command to copy the configuration file to the USB. To restore configuration from a USB, it is necessary to edit the file in USB with a text editor. Assuming the file name is \verb|R1-Config|, use the command \verb|copy usbflash0:/R1-Config run| to restore a running configuration.
\subsection{Password recovery}
Console access to the device using terminal emulator software on a PC is required for password recovery. With console access, a user can access the ROMMON mode by using a \emph{break sequence} during the bootup process or removing the external flash memory when the device is powered off.\\
Password recovery procedures on all devices follow the same principle:
\begin{enumerate}
\item Enter ROMMON mode
\item Change the configuration register to \verb|0x2142| (use \verb|confreg 0x2142| command) and reboot the device (use \verb|reset| command)
\begin{verbatim}
Readonly ROMMON initialized
monitor: command "boot" aborted due to user interrupt
rommon 1 > confreg 0x2142
rommon 2 > reset
System Bootstrap, Version 15.0(1r)M9, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2010 by cisco Systems, Inc.
<output omitted>
\end{verbatim}
\item After the device has finished rebooting, copy the startup configuration file to the running configuration file, use \verb|copy startup run| command. DO NOT enter \verb|copy run startup| because this command erases your original startup configuration.
\item Because you are in privileged EXEC mode, you can now configure all the necessary passwords.
\item After the new passwords are configured, change the configuration register back to \verb|0x2102| using the the following command:
\begin{verbatim}
Router(config)# config-register 0x2102
\end{verbatim}
\item Save the new configuration using \verb|copy run startup| command
\item Reload the device
\end{enumerate}
\textbf{ROMMON mode} enables an administrator to access flash memory, format the flash file system, reinstall the IOS, recover a lost password or change the configuration register. The configuration register instructs the router how to boot up. For example, when the configuration register is \verb|0x2142|, the device ignores the startup config file during startup. The default configuration register is \verb|0x2102|.
\section{IOS image}
\subsection{Naming convention}
Cisco Integrated Services Routers Generation Two (ISR G2) supports \emph{Services on Demand} through the use of software licensing. Each router is shipped with the same \emph{universal image}. The IOS features are enabled in the universal image via licensing keys.\\
There are two types of universal images supported in ISR G2:
\begin{itemize}
\item \textbf{With universalk9 in the name:} offer all Cisco IOS features
\item \textbf{With universalk9\_ npe in the name:} Not support strong cryptography such as payload cryptography.
\end{itemize}
The Cisco IOS image file has special naming convention. The \verb|show flash| command displays all files stored in flash memory including IOS image(see table \ref{Naming} for explanation):
\begin{verbatim}
c1900-universalk9-mz.SPA.152-4.M3.bin
\end{verbatim}
\begin{table}[hbtp]
\centering\caption{Cisco IOS image naming convention}\label{Naming}
\begin{tabular}{ll p{12cm} }
\toprule
\head{Part} & \head{Example} & \head{Explanation} \\
\midrule
Image name & \verb|c1900| & Identify the platform. In this example, the platform is Cisco 1900 router.\\
Image designation & \verb|universalk9| & The two designations for an ISR G2 are \verb|universalk9| and \verb|universalk9_npe|. \\
Status & \verb|mz| & Indicates where the image runs and if it is compressed. In this example, the image is running in RAM and is compressed.\\
Signature & \verb|SPA| & Digitally signed by Cisco\\
Version & \verb|152-4.M3| & Major release (15), minor release (2), maintenance release (4), maintenance rebuild number (3). The M indicates this is an extended maintenance release.\\
File extension & \verb|bin| & This extension indicates that this file is a binary executable file.\\
\bottomrule
\end{tabular}
\end{table}
The most common designation for memory location and compression format is \verb|mz|. The first letter indicates the location where the image is executed on the router. The locations can include: \verb|f| (flash), \verb|m| (RAM), \verb|r| (ROM), and \verb|l| (relocatable). The compression format can be either \verb|z| for zip or \verb|x| for mzip.
\subsection{IOS image and TFTP server}
To create a backup of the Cisco IOS image to a TFTP server, perform the following three steps:
\begin{enumerate}
\item Ping TFTP server to test connectivity
\item Use \verb|show flash0:| command to determine the size of image file
\item Verify that TFTP server has sufficient disk space to accommodate the image file
\item Copy the image to TFTP server using \verb|copy flash0: tftp:|
\item Answer the prompted questions
\end{enumerate}
We can upgrade software in Cisco router by copying IOS image from TFTP server to the device:
\begin{enumerate}
\item Ping TFTP server to test connectivity
\item Use \verb|show flash0:| command to determine the size of image file
\item Verify that TFTP server has sufficient disk space to accommodate the image file
\item Copy the image to TFTP server using \verb|copy tftp: flash0:|
\item Answer the prompted questions
\end{enumerate}
\subsection{The boot system command}
To upgrade to the copied IOS image after that image is saved on the router's flash memory, configure the router to load the new image during bootup using the \verb|boot system| command
\begin{verbatim}
R1(config)# boot system flash0://c1900-universalk9-mz.SPA.152-4.M3.bin
\end{verbatim}
After the router has booted, to verify the new image has loaded, use the \verb|show version| command.\\
Several boot system commands can be entered in sequence to provide a fault-tolerant boot plan. If there are no boot system commands in the configuration, the router defaults to loading the first valid Cisco IOS image in flash memory and running it.
\section{Software licensing}
\subsection{Licensing key}
Recall that each device ships with the same universal image. Technology packages are enabled in the
universal image via Cisco IOS Software Activation licensing keys. \\
Each licensing key is unique to a particular device and is obtained from product ID, serial number of the router and a \emph{Product Activation Key (PAK)}. Cisco provides PAK at the time of purchase. \\
The IP Base is installed by default. Other technology Data, UC (Unified Communication), and SEC (Security) are enabled using licensing keys.\\
Use the \verb|show license feature| command to view the technology package licenses and feature licenses supported on the router.
\subsection{Licensing process}
A permanent license is a license that never expires. Evaluation license, known as a temporary license, allows customers to try a new software package. If customers want to permanently activate a software package or feature on the router, they must get a new software license.\\
There are three steps to permanently activate a new feature on the router:
\begin{enumerate}
\item Purchase the feature to install. Software Claim Certificates are used for licenses that require software activation. The claim certificate provides the PAK and Cisco EULA. PAK , an 11-digit alphanumeric key, serves as a receipt to obtain a license. A PAK
is not tied to a specific device until the license is created.
\item Obtain license file using either CLM\footnote{Cisco License Manager, a free software application deploying Cisco licenses across networks} or Cisco License Registration Portal\footnote{web-based for getting and registering individual software licenses}. Then the license information is sent via email to install the license file. The license file is an XML text file with a \textbf{.lic} extension.
\item Use \verb|license install <store-location>| to install license file
\begin{verbatim}
R1# license install flash0:seck9-C1900-SPE150_K9-FHH12250057.xml
\end{verbatim}
\item Reboot the router
\item Verify license using \verb|show license| and \verb|show version| command.
\end{enumerate}
Both of these processes require a PAK number and a unique device identifier (UDI). UID is the combination of Product ID (PID), Serial number (SN) and hardware version. The SN is an 11-digit number that uniquely identifies a device. The PID identifies the type of device. The UDI can be displayed using \verb|show license udi|.\\
\subsection{Activate an Evaluation license}
Evaluation licenses are replaced with RTU\footnote{Evaluation Right-to-Use licenses} after \textbf{60 days} (i.e. expired). These licenses are available on the honor system and require customer's acceptance of EULA. The \verb|license accept end user agreement| in global configuration mode is used to configure a one-time EULA acceptance for all IOS features. \\
Suppose you want to activate Data package on a Cisco 1900 router, the following command should be executed:
\begin{verbatim}
R1(config)# license boot module c1900 technology-package datak9
\end{verbatim}
Technology package names are \verb|ipbasek9|, \verb|securityk9|, \verb|datak9|, and \verb|uck9|.\\
Remember that the device has to reboot to activate new software package.
\subsection{Back up the license}
To copy all licenses in a device and store them in flash memory with the file name \verb|all_licenses.lic|, execute the following command:
\begin{verbatim}
R1# license save flash0:all_licenses.lic
\end{verbatim}
\subsection{Uninstall a permanent license}
Perform the following steps to completely uninstall an active permanent license:
\begin{enumerate}
\item Disable technology package, then reboot
\begin{verbatim}
R1(config)# license boot module c1900 technology-package seck9 disable
R1(config)# exit
R1# reload
\end{verbatim}
\item Clear technology package license
\begin{verbatim}
R1# license clear seck9
\end{verbatim}
\item Remove the \verb|license boot module| command in step 1, and then reload.
\begin{verbatim}
R1(config)# no license boot module c1900 technology-package seck9 disable
R1(config)# exit
R1# reload
\end{verbatim}
\end{enumerate} |
import Data.List
ack : Nat -> Nat -> Nat
ack 0 n = S n
ack (S k) 0 = ack k 1
ack (S j) (S k) = ack j (ack (S j) k)
foo : Nat -> Nat
foo Z = Z
foo (S Z) = (S Z)
foo (S (S k)) = foo (S k)
data Ord = Zero | Suc Ord | Sup (Nat -> Ord)
ordElim : (x : Ord) ->
(p : Ord -> Type) ->
(p Zero) ->
((x : Ord) -> p x -> p (Suc x)) ->
((f : Nat -> Ord) -> ((n : Nat) -> p (f n)) ->
p (Sup f)) -> p x
ordElim Zero p mZ mSuc mSup = mZ
ordElim (Suc o) p mZ mSuc mSup = mSuc o (ordElim o p mZ mSuc mSup)
ordElim (Sup f) p mZ mSuc mSup =
mSup f (\n => ordElim (f n) p mZ mSuc mSup)
mutual
bar : Nat -> Lazy Nat -> Nat
bar x y = mp x y
mp : Nat -> Nat -> Nat
mp Z y = y
mp (S k) y = S (bar k y)
mutual
swapR : Nat -> Nat -> Nat
swapR x (S y) = swapL y x
swapR x Z = x
swapL : Nat -> Nat -> Nat
swapL (S x) y = swapR y (S x)
swapL Z y = y
loopy : a
loopy = loopy
data Bin = EPS | C0 Bin | C1 Bin
foom : Bin -> Nat
foom EPS = Z
foom (C0 EPS) = Z
foom (C0 (C1 x)) = S (foom (C1 x))
foom (C0 (C0 x)) = foom (C0 x)
foom (C1 x) = S (foom x)
pfoom : Bin -> Nat
pfoom EPS = Z
pfoom (C0 EPS) = Z
pfoom (C0 (C1 x)) = S (pfoom (C0 x))
pfoom (C0 (C0 x)) = pfoom (C0 x)
pfoom (C1 x) = S (foom x)
even : Nat -> Bool
even Z = True
even (S k) = odd k
where
odd : Nat -> Bool
odd Z = False
odd (S k) = even k
data Vect : Nat -> Type -> Type where
Nil : Vect Z a
(::) : a -> Vect k a -> Vect (S k) a
vtrans : Vect n a -> Vect n a -> List a
vtrans [] _ = []
vtrans (x :: xs) ys = x :: vtrans ys ys
data GTree : Type -> Type where
MkGTree : List (GTree a) -> GTree a
size : GTree a -> Nat
size (MkGTree []) = Z
size (MkGTree xs) = sizeAll xs
where
plus : Nat -> Nat -> Nat
plus Z y = y
plus (S k) y = S (plus k y)
sizeAll : List (GTree a) -> Nat
sizeAll [] = Z
sizeAll (x :: xs) = plus (size x) (sizeAll xs)
qsortBad : Ord a => List a -> List a
qsortBad [] = []
qsortBad (x :: xs)
= qsortBad (filter (< x) xs) ++ x :: qsortBad (filter (> x) xs)
qsort : Ord a => List a -> List a
qsort [] = []
qsort (x :: xs)
= qsort (assert_smaller (x :: xs) (filter (< x) xs)) ++
x :: qsort (assert_smaller (x :: xs) (filter (> x) xs))
qsort' : Ord a => List a -> List a
qsort' [] = []
qsort' (x :: xs)
= let (xs_low, xs_high) = partition x xs in
qsort' (assert_smaller (x :: xs) xs_low) ++
x :: qsort' (assert_smaller (x :: xs) xs_high)
where
partition : a -> List a -> (List a, List a)
partition x xs = (filter (< x) xs, filter (>= x) xs)
mySorted : Ord a => List a -> Bool
mySorted [] = True
mySorted (x::xs) =
case xs of
Nil => True
(y::ys) => x <= y && mySorted (y::ys)
myMergeBy : (a -> a -> Ordering) -> List a -> List a -> List a
myMergeBy order [] right = right
myMergeBy order left [] = left
myMergeBy order (x::xs) (y::ys) =
case order x y of
LT => x :: myMergeBy order xs (y::ys)
_ => y :: myMergeBy order (x::xs) ys
|
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Ξ± β Ξ²
y : Ξ²
o : Option Ξ±
β’ y β Option.map f o β β x, x β o β§ f x = y
[PROOFSTEP]
simp
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Ξ± β Ξ²
H : Function.Injective f
a : Ξ±
o : Option Ξ±
β’ f a β Option.map f o β a β o
[PROOFSTEP]
aesop
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Ξ± β Ξ²
o : Option Ξ±
p : Ξ² β Prop
β’ (β (y : Ξ²), y β Option.map f o β p y) β β (x : Ξ±), x β o β p (f x)
[PROOFSTEP]
simp
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Ξ± β Ξ²
o : Option Ξ±
p : Ξ² β Prop
β’ (β y, y β Option.map f o β§ p y) β β x, x β o β§ p (f x)
[PROOFSTEP]
simp
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Ξ± β Ξ²
Hf : Function.Injective f
aβ aβ : Ξ±
H : Option.map f (some aβ) = Option.map f (some aβ)
β’ some aβ = some aβ
[PROOFSTEP]
rw [Hf (Option.some.inj H)]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
x : Option Ξ±
f : Ξ± β Option Ξ²
b : Ξ²
β’ Option.bind x f = some b β β a, x = some a β§ f a = some b
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Ξ± β Option Ξ²
b : Ξ²
β’ Option.bind none f = some b β β a, none = some a β§ f a = some b
[PROOFSTEP]
simp
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Ξ± β Option Ξ²
b : Ξ²
valβ : Ξ±
β’ Option.bind (some valβ) f = some b β β a, some valβ = some a β§ f a = some b
[PROOFSTEP]
simp
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
o : Option Ξ±
f : Ξ± β Option Ξ²
β’ Option.bind o f = none β β (b : Ξ²) (a : Ξ±), a β o β Β¬b β f a
[PROOFSTEP]
simp only [eq_none_iff_forall_not_mem, mem_def, bind_eq_some, not_exists, not_and]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f g : Ξ± β Ξ²
h : Option.map f = Option.map g
x : Ξ±
β’ some (f x) = some (g x)
[PROOFSTEP]
simp only [β map_some', h]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
fβ : Ξ± β Ξ²
fβ : Ξ± β Ξ³
gβ : Ξ² β Ξ΄
gβ : Ξ³ β Ξ΄
h : gβ β fβ = gβ β fβ
a : Ξ±
β’ Option.map gβ (Option.map fβ (some a)) = Option.map gβ (Option.map fβ (some a))
[PROOFSTEP]
rw [map_map, h, β map_map]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
xβ : Option Ξ±
f : Ξ± β Option Ξ²
x : Option Ξ±
β’ (pbind x fun a x => f a) = Option.bind x f
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : Ξ± β Option Ξ²
β’ (pbind none fun a x => f a) = Option.bind none f
[PROOFSTEP]
simp only [pbind, none_bind', some_bind']
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : Ξ± β Option Ξ²
valβ : Ξ±
β’ (pbind (some valβ) fun a x => f a) = Option.bind (some valβ) f
[PROOFSTEP]
simp only [pbind, none_bind', some_bind']
[GOAL]
Ξ±β : Type u_1
Ξ²β : Type u_2
Ξ³β : Type u_3
Ξ΄ : Type u_4
p : Ξ±β β Prop
fβ : (a : Ξ±β) β p a β Ξ²β
xβ : Option Ξ±β
Ξ± Ξ² Ξ³ : Type u_5
f : Ξ² β Ξ³
x : Option Ξ±
g : Ξ± β Option Ξ²
β’ Option.map f (x >>= g) = do
let a β x
Option.map f (g a)
[PROOFSTEP]
simp only [β map_eq_map, β bind_pure_comp, LawfulMonad.bind_assoc]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
xβ : Option Ξ±
f : Ξ² β Ξ³
x : Option Ξ±
g : Ξ± β Option Ξ²
β’ Option.map f (Option.bind x g) = Option.bind x fun a => Option.map f (g a)
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : Ξ² β Ξ³
g : Ξ± β Option Ξ²
β’ Option.map f (Option.bind none g) = Option.bind none fun a => Option.map f (g a)
[PROOFSTEP]
simp
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : Ξ² β Ξ³
g : Ξ± β Option Ξ²
valβ : Ξ±
β’ Option.map f (Option.bind (some valβ) g) = Option.bind (some valβ) fun a => Option.map f (g a)
[PROOFSTEP]
simp
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
xβ : Option Ξ±
f : Ξ² β Ξ³
x : Option Ξ±
g : (a : Ξ±) β a β x β Option Ξ²
β’ Option.map f (pbind x g) = pbind x fun a H => Option.map f (g a H)
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : Ξ² β Ξ³
g : (a : Ξ±) β a β none β Option Ξ²
β’ Option.map f (pbind none g) = pbind none fun a H => Option.map f (g a H)
[PROOFSTEP]
simp only [pbind, map_none']
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : Ξ² β Ξ³
valβ : Ξ±
g : (a : Ξ±) β a β some valβ β Option Ξ²
β’ Option.map f (pbind (some valβ) g) = pbind (some valβ) fun a H => Option.map f (g a H)
[PROOFSTEP]
simp only [pbind, map_none']
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
xβ : Option Ξ±
f : Ξ± β Ξ²
x : Option Ξ±
g : (b : Ξ²) β b β Option.map f x β Option Ξ³
β’ pbind (Option.map f x) g = pbind x fun a h => g (f a) (_ : f a β Option.map f x)
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : Ξ± β Ξ²
g : (b : Ξ²) β b β Option.map f none β Option Ξ³
β’ pbind (Option.map f none) g = pbind none fun a h => g (f a) (_ : f a β Option.map f none)
[PROOFSTEP]
rfl
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : Ξ± β Ξ²
valβ : Ξ±
g : (b : Ξ²) β b β Option.map f (some valβ) β Option Ξ³
β’ pbind (Option.map f (some valβ)) g = pbind (some valβ) fun a h => g (f a) (_ : f a β Option.map f (some valβ))
[PROOFSTEP]
rfl
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
a : Ξ±
h : β (a : Ξ±), a β x β p a
ha : a β x
β’ f a (_ : p a) β pmap f x h
[PROOFSTEP]
rw [mem_def] at ha β’
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
a : Ξ±
h : β (a : Ξ±), a β x β p a
haβ : a β x
ha : x = some a
β’ pmap f x h = some (f a (_ : p a))
[PROOFSTEP]
subst ha
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
a : Ξ±
h : β (a_1 : Ξ±), a_1 β some a β p a_1
ha : a β some a
β’ pmap f (some a) h = some (f a (_ : p a))
[PROOFSTEP]
rfl
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
xβ : Option Ξ±
g : Ξ³ β Ξ±
x : Option Ξ³
H : β (a : Ξ±), a β Option.map g x β p a
β’ pmap f (Option.map g x) H = pmap (fun a h => f (g a) h) x (_ : β (a : Ξ³), a β x β p (g a))
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
g : Ξ³ β Ξ±
H : β (a : Ξ±), a β Option.map g none β p a
β’ pmap f (Option.map g none) H = pmap (fun a h => f (g a) h) none (_ : β (a : Ξ³), a β none β p (g a))
[PROOFSTEP]
simp only [map_none', map_some', pmap]
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
g : Ξ³ β Ξ±
valβ : Ξ³
H : β (a : Ξ±), a β Option.map g (some valβ) β p a
β’ pmap f (Option.map g (some valβ)) H = pmap (fun a h => f (g a) h) (some valβ) (_ : β (a : Ξ³), a β some valβ β p (g a))
[PROOFSTEP]
simp only [map_none', map_some', pmap]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
xβ : Option Ξ±
g : Ξ² β Ξ³
f : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
H : β (a : Ξ±), a β x β p a
β’ Option.map g (pmap f x H) = pmap (fun a h => g (f a h)) x H
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
g : Ξ² β Ξ³
f : (a : Ξ±) β p a β Ξ²
H : β (a : Ξ±), a β none β p a
β’ Option.map g (pmap f none H) = pmap (fun a h => g (f a h)) none H
[PROOFSTEP]
simp only [map_none', map_some', pmap]
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
g : Ξ² β Ξ³
f : (a : Ξ±) β p a β Ξ²
valβ : Ξ±
H : β (a : Ξ±), a β some valβ β p a
β’ Option.map g (pmap f (some valβ) H) = pmap (fun a h => g (f a h)) (some valβ) H
[PROOFSTEP]
simp only [map_none', map_some', pmap]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
pβ : Ξ± β Prop
fβ : (a : Ξ±) β pβ a β Ξ²
xβ : Option Ξ±
p : Ξ± β Prop
f : Ξ± β Ξ²
x : Option Ξ±
H : β (a : Ξ±), a β x β p a
β’ pmap (fun a x => f a) x H = Option.map f x
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
pβ : Ξ± β Prop
fβ : (a : Ξ±) β pβ a β Ξ²
x : Option Ξ±
p : Ξ± β Prop
f : Ξ± β Ξ²
H : β (a : Ξ±), a β none β p a
β’ pmap (fun a x => f a) none H = Option.map f none
[PROOFSTEP]
simp only [map_none', map_some', pmap]
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
pβ : Ξ± β Prop
fβ : (a : Ξ±) β pβ a β Ξ²
x : Option Ξ±
p : Ξ± β Prop
f : Ξ± β Ξ²
valβ : Ξ±
H : β (a : Ξ±), a β some valβ β p a
β’ pmap (fun a x => f a) (some valβ) H = Option.map f (some valβ)
[PROOFSTEP]
simp only [map_none', map_some', pmap]
[GOAL]
Ξ±β : Type u_1
Ξ²β : Type u_2
Ξ³β : Type u_3
Ξ΄ : Type u_4
pβ : Ξ±β β Prop
fβ : (a : Ξ±β) β pβ a β Ξ²β
xβ : Option Ξ±β
Ξ± Ξ² Ξ³ : Type u_5
x : Option Ξ±
g : Ξ± β Option Ξ²
p : Ξ² β Prop
f : (b : Ξ²) β p b β Ξ³
H : β (a : Ξ²), a β x >>= g β p a
H' : β (a : Ξ±) (b : Ξ²), b β g a β b β x >>= g
β’ pmap f (x >>= g) H = do
let a β x
pmap f (g a) (_ : β (b : Ξ²), b β g a β p b)
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ±β : Type u_1
Ξ²β : Type u_2
Ξ³β : Type u_3
Ξ΄ : Type u_4
pβ : Ξ±β β Prop
fβ : (a : Ξ±β) β pβ a β Ξ²β
x : Option Ξ±β
Ξ± Ξ² Ξ³ : Type u_5
g : Ξ± β Option Ξ²
p : Ξ² β Prop
f : (b : Ξ²) β p b β Ξ³
H : β (a : Ξ²), a β none >>= g β p a
H' : β (a : Ξ±) (b : Ξ²), b β g a β b β none >>= g
β’ pmap f (none >>= g) H = do
let a β none
pmap f (g a) (_ : β (b : Ξ²), b β g a β p b)
[PROOFSTEP]
simp only [pmap, bind_eq_bind, none_bind, some_bind]
[GOAL]
case some
Ξ±β : Type u_1
Ξ²β : Type u_2
Ξ³β : Type u_3
Ξ΄ : Type u_4
pβ : Ξ±β β Prop
fβ : (a : Ξ±β) β pβ a β Ξ²β
x : Option Ξ±β
Ξ± Ξ² Ξ³ : Type u_5
g : Ξ± β Option Ξ²
p : Ξ² β Prop
f : (b : Ξ²) β p b β Ξ³
valβ : Ξ±
H : β (a : Ξ²), a β some valβ >>= g β p a
H' : β (a : Ξ±) (b : Ξ²), b β g a β b β some valβ >>= g
β’ pmap f (some valβ >>= g) H = do
let a β some valβ
pmap f (g a) (_ : β (b : Ξ²), b β g a β p b)
[PROOFSTEP]
simp only [pmap, bind_eq_bind, none_bind, some_bind]
[GOAL]
Ξ±β : Type u_1
Ξ²β : Type u_2
Ξ³β : Type u_3
Ξ΄ : Type u_4
pβ : Ξ±β β Prop
fβ : (a : Ξ±β) β pβ a β Ξ²β
xβ : Option Ξ±β
Ξ± : Type u_5
Ξ² Ξ³ : Type u_6
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
g : Ξ² β Option Ξ³
H : β (a : Ξ±), a β x β p a
β’ pmap f x H >>= g = pbind x fun a h => g (f a (_ : p a))
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ±β : Type u_1
Ξ²β : Type u_2
Ξ³β : Type u_3
Ξ΄ : Type u_4
pβ : Ξ±β β Prop
fβ : (a : Ξ±β) β pβ a β Ξ²β
x : Option Ξ±β
Ξ± : Type u_5
Ξ² Ξ³ : Type u_6
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
g : Ξ² β Option Ξ³
H : β (a : Ξ±), a β none β p a
β’ pmap f none H >>= g = pbind none fun a h => g (f a (_ : p a))
[PROOFSTEP]
simp only [pmap, bind_eq_bind, none_bind, some_bind, pbind]
[GOAL]
case some
Ξ±β : Type u_1
Ξ²β : Type u_2
Ξ³β : Type u_3
Ξ΄ : Type u_4
pβ : Ξ±β β Prop
fβ : (a : Ξ±β) β pβ a β Ξ²β
x : Option Ξ±β
Ξ± : Type u_5
Ξ² Ξ³ : Type u_6
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
g : Ξ² β Option Ξ³
valβ : Ξ±
H : β (a : Ξ±), a β some valβ β p a
β’ pmap f (some valβ) H >>= g = pbind (some valβ) fun a h => g (f a (_ : p a))
[PROOFSTEP]
simp only [pmap, bind_eq_bind, none_bind, some_bind, pbind]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : (a : Ξ±) β a β x β Option Ξ²
h' : β (a : Ξ±) (H : a β x), f a H = none β x = none
β’ pbind x f = none β x = none
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
f : (a : Ξ±) β a β none β Option Ξ²
h' : β (a : Ξ±) (H : a β none), f a H = none β none = none
β’ pbind none f = none β none = none
[PROOFSTEP]
simp
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
valβ : Ξ±
f : (a : Ξ±) β a β some valβ β Option Ξ²
h' : β (a : Ξ±) (H : a β some valβ), f a H = none β some valβ = none
β’ pbind (some valβ) f = none β some valβ = none
[PROOFSTEP]
simp only [pbind, iff_false]
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
valβ : Ξ±
f : (a : Ξ±) β a β some valβ β Option Ξ²
h' : β (a : Ξ±) (H : a β some valβ), f a H = none β some valβ = none
β’ Β¬f valβ (_ : some valβ = some valβ) = none
[PROOFSTEP]
intro h
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
valβ : Ξ±
f : (a : Ξ±) β a β some valβ β Option Ξ²
h' : β (a : Ξ±) (H : a β some valβ), f a H = none β some valβ = none
h : f valβ (_ : some valβ = some valβ) = none
β’ False
[PROOFSTEP]
cases h' _ rfl h
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : (a : Ξ±) β a β x β Option Ξ²
y : Ξ²
β’ pbind x f = some y β β z H, f z H = some y
[PROOFSTEP]
rcases x with (_ | x)
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
y : Ξ²
f : (a : Ξ±) β a β none β Option Ξ²
β’ pbind none f = some y β β z H, f z H = some y
[PROOFSTEP]
simp only [pbind, false_iff, not_exists]
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
y : Ξ²
f : (a : Ξ±) β a β none β Option Ξ²
β’ β (x : Ξ±) (x_1 : x β none), Β¬f x x_1 = some y
[PROOFSTEP]
intro z h
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
y : Ξ²
f : (a : Ξ±) β a β none β Option Ξ²
z : Ξ±
h : z β none
β’ Β¬f z h = some y
[PROOFSTEP]
simp at h
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
f : (a : Ξ±) β a β some x β Option Ξ²
β’ pbind (some x) f = some y β β z H, f z H = some y
[PROOFSTEP]
simp only [pbind]
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
f : (a : Ξ±) β a β some x β Option Ξ²
β’ f x (_ : some x = some x) = some y β β z H, f z H = some y
[PROOFSTEP]
refine β¨Ξ» h => β¨x, rfl, hβ©, ?_β©
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
f : (a : Ξ±) β a β some x β Option Ξ²
β’ (β z H, f z H = some y) β f x (_ : some x = some x) = some y
[PROOFSTEP]
rintro β¨z, H, hzβ©
[GOAL]
case some.intro.intro
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
f : (a : Ξ±) β a β some x β Option Ξ²
z : Ξ±
H : z β some x
hz : f z H = some y
β’ f x (_ : some x = some x) = some y
[PROOFSTEP]
simp only [mem_def, Option.some_inj] at H
[GOAL]
case some.intro.intro
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
f : (a : Ξ±) β a β some x β Option Ξ²
z : Ξ±
Hβ : z β some x
hz : f z Hβ = some y
H : x = z
β’ f x (_ : some x = some x) = some y
[PROOFSTEP]
simpa [H] using hz
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
h : β (a : Ξ±), a β x β p a
β’ pmap f x h = none β x = none
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
h : β (a : Ξ±), a β none β p a
β’ pmap f none h = none β none = none
[PROOFSTEP]
simp
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
valβ : Ξ±
h : β (a : Ξ±), a β some valβ β p a
β’ pmap f (some valβ) h = none β some valβ = none
[PROOFSTEP]
simp
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
hf : β (a : Ξ±), a β x β p a
y : Ξ²
β’ pmap f x hf = some y β β a H, f a (_ : p a) = y
[PROOFSTEP]
rcases x with (_ | x)
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
y : Ξ²
hf : β (a : Ξ±), a β none β p a
β’ pmap f none hf = some y β β a H, f a (_ : p a) = y
[PROOFSTEP]
simp only [not_mem_none, exists_false, pmap, not_false_iff, exists_prop_of_false]
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
hf : β (a : Ξ±), a β some x β p a
β’ pmap f (some x) hf = some y β β a H, f a (_ : p a) = y
[PROOFSTEP]
constructor
[GOAL]
case some.mp
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
hf : β (a : Ξ±), a β some x β p a
β’ pmap f (some x) hf = some y β β a H, f a (_ : p a) = y
[PROOFSTEP]
intro h
[GOAL]
case some.mp
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
hf : β (a : Ξ±), a β some x β p a
h : pmap f (some x) hf = some y
β’ β a H, f a (_ : p a) = y
[PROOFSTEP]
simp only [pmap, Option.some_inj] at h
[GOAL]
case some.mp
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
hf : β (a : Ξ±), a β some x β p a
h : f x (_ : p x) = y
β’ β a H, f a (_ : p a) = y
[PROOFSTEP]
refine β¨x, rfl, hβ©
[GOAL]
case some.mpr
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
y : Ξ²
x : Ξ±
hf : β (a : Ξ±), a β some x β p a
β’ (β a H, f a (_ : p a) = y) β pmap f (some x) hf = some y
[PROOFSTEP]
rintro β¨a, H, rflβ©
[GOAL]
case some.mpr.intro.intro
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Ξ±
hf : β (a : Ξ±), a β some x β p a
a : Ξ±
H : some x = some a
β’ pmap f (some x) hf = some (f a (_ : p a))
[PROOFSTEP]
simp only [mem_def, Option.some_inj] at H
[GOAL]
case some.mpr.intro.intro
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
f : (a : Ξ±) β p a β Ξ²
x : Ξ±
hf : β (a : Ξ±), a β some x β p a
a : Ξ±
Hβ : some x = some a
H : x = a
β’ pmap f (some x) hf = some (f a (_ : p a))
[PROOFSTEP]
simp only [H, pmap]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
xβ : Option Ξ±
f : (a : Ξ±) β p a β Ξ²
x : Option (Option Ξ±)
H : β (a : Option Ξ±), a β x β β (a_2 : Ξ±), a_2 β a β p a_2
β’ join (pmap (pmap f) x H) = pmap f (join x) (_ : β (a : Ξ±), a β join x β p a)
[PROOFSTEP]
rcases x with (_ | _ | x)
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : (a : Ξ±) β p a β Ξ²
H : β (a : Option Ξ±), a β none β β (a_2 : Ξ±), a_2 β a β p a_2
β’ join (pmap (pmap f) none H) = pmap f (join none) (_ : β (a : Ξ±), a β join none β p a)
[PROOFSTEP]
simp
[GOAL]
case some.none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
x : Option Ξ±
f : (a : Ξ±) β p a β Ξ²
H : β (a : Option Ξ±), a β some none β β (a_2 : Ξ±), a_2 β a β p a_2
β’ join (pmap (pmap f) (some none) H) = pmap f (join (some none)) (_ : β (a : Ξ±), a β join (some none) β p a)
[PROOFSTEP]
simp
[GOAL]
case some.some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Ξ± β Prop
fβ : (a : Ξ±) β p a β Ξ²
xβ : Option Ξ±
f : (a : Ξ±) β p a β Ξ²
x : Ξ±
H : β (a : Option Ξ±), a β some (some x) β β (a_2 : Ξ±), a_2 β a β p a_2
β’ join (pmap (pmap f) (some (some x)) H) = pmap f (join (some (some x))) (_ : β (a : Ξ±), a β join (some (some x)) β p a)
[PROOFSTEP]
simp
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
x : Option Ξ±
β’ (Option.orElse none fun x_1 => x) = x
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
β’ (Option.orElse none fun x => none) = none
[PROOFSTEP]
rfl
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
valβ : Ξ±
β’ (Option.orElse none fun x => some valβ) = some valβ
[PROOFSTEP]
rfl
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
x : Option Ξ±
β’ (Option.orElse x fun x => none) = x
[PROOFSTEP]
cases x
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
β’ (Option.orElse none fun x => none) = none
[PROOFSTEP]
rfl
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
valβ : Ξ±
β’ (Option.orElse (some valβ) fun x => none) = some valβ
[PROOFSTEP]
rfl
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
instβ : Inhabited Ξ±
o : Option Ξ±
β’ getD o default = iget o
[PROOFSTEP]
cases o
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
instβ : Inhabited Ξ±
β’ getD none default = iget none
[PROOFSTEP]
rfl
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
instβ : Inhabited Ξ±
valβ : Ξ±
β’ getD (some valβ) default = iget (some valβ)
[PROOFSTEP]
rfl
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Prop
instβ : Decidable p
u : Unit
β’ _root_.guard p = some u β p
[PROOFSTEP]
cases u
[GOAL]
case unit
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Prop
instβ : Decidable p
β’ _root_.guard p = some PUnit.unit β p
[PROOFSTEP]
by_cases h : p
[GOAL]
case pos
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Prop
instβ : Decidable p
h : p
β’ _root_.guard p = some PUnit.unit β p
[PROOFSTEP]
simp [_root_.guard, h]
[GOAL]
case neg
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
p : Prop
instβ : Decidable p
h : Β¬p
β’ _root_.guard p = some PUnit.unit β p
[PROOFSTEP]
simp [_root_.guard, h]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Ξ± β Ξ± β Ξ±
h : β (a b : Ξ±), f a b = a β¨ f a b = b
a b : Ξ±
β’ liftOrGet f (some a) (some b) = some a β¨ liftOrGet f (some a) (some b) = some b
[PROOFSTEP]
simpa [liftOrGet] using h a b
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Option Ξ± β Ξ²
o : Option Ξ±
β’ casesOn' o (f none) (f β fun a => some a) = f o
[PROOFSTEP]
cases o
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Option Ξ± β Ξ²
β’ casesOn' none (f none) (f β fun a => some a) = f none
[PROOFSTEP]
rfl
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Option Ξ± β Ξ²
valβ : Ξ±
β’ casesOn' (some valβ) (f none) (f β fun a => some a) = f (some valβ)
[PROOFSTEP]
rfl
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
o o' : Option Ξ±
x : Ξ±
β’ (HOrElse.hOrElse o fun x => o') = some x β o = some x β¨ o = none β§ o' = some x
[PROOFSTEP]
cases o
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
o' : Option Ξ±
x : Ξ±
β’ (HOrElse.hOrElse none fun x => o') = some x β none = some x β¨ none = none β§ o' = some x
[PROOFSTEP]
simp only [true_and, false_or, eq_self_iff_true, none_orElse]
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
o' : Option Ξ±
x valβ : Ξ±
β’ (HOrElse.hOrElse (some valβ) fun x => o') = some x β some valβ = some x β¨ some valβ = none β§ o' = some x
[PROOFSTEP]
simp only [some_orElse, or_false, false_and]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
o o' : Option Ξ±
β’ (HOrElse.hOrElse o fun x => o') = none β o = none β§ o' = none
[PROOFSTEP]
cases o
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
o' : Option Ξ±
β’ (HOrElse.hOrElse none fun x => o') = none β none = none β§ o' = none
[PROOFSTEP]
simp only [true_and, none_orElse, eq_self_iff_true]
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
o' : Option Ξ±
valβ : Ξ±
β’ (HOrElse.hOrElse (some valβ) fun x => o') = none β some valβ = none β§ o' = none
[PROOFSTEP]
simp only [some_orElse, false_and]
[GOAL]
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Option Ξ± β Ξ²
o : Option Ξ±
β’ Option.elim o (f none) (f β some) = f o
[PROOFSTEP]
cases o
[GOAL]
case none
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Option Ξ± β Ξ²
β’ Option.elim none (f none) (f β some) = f none
[PROOFSTEP]
rfl
[GOAL]
case some
Ξ± : Type u_1
Ξ² : Type u_2
Ξ³ : Type u_3
Ξ΄ : Type u_4
f : Option Ξ± β Ξ²
valβ : Ξ±
β’ Option.elim (some valβ) (f none) (f β some) = f (some valβ)
[PROOFSTEP]
rfl
|
{-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Lists.Lists
open import Agda.Primitive using (Level; lzero; lsuc; _β_)
open import Decidable.Sets
open import Numbers.Naturals.Definition
open import Numbers.Naturals.Semiring
module Computability.LambdaCalculus.Definition where
open import UnorderedSet.Definition (βDecideEquality)
data Term : Set where
var : (v : β) β Term
lam : (x : β) β Term β Term
apply : Term β Term β Term
|
/*
* Copyright 2012 Open Source Robotics Foundation
*
* 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.
*
*/
/*
* Desc: 3D position interface for ground truth.
* Author: Sachin Chitta and John Hsu
* Date: 1 June 2008
*/
#ifndef GAZEBO_ROS_P3D_HH
#define GAZEBO_ROS_P3D_HH
#include <string>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <ros/ros.h>
#include <nav_msgs/Odometry.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <gazebo_plugins/PubQueue.h>
#include <tf2_ros/transform_broadcaster.h>
#include <geometry_msgs/TransformStamped.h>
namespace gazebo
{
class OdometrySource : public ModelPlugin
{
public:
OdometrySource();
virtual ~OdometrySource();
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
protected:
virtual void UpdateChild();
private:
physics::WorldPtr world_;
physics::ModelPtr model_;
physics::LinkPtr link_;
ros::NodeHandle* rosnode_;
ros::Publisher pub_;
PubQueue<nav_msgs::Odometry>::Ptr pub_Queue;
nav_msgs::Odometry pose_msg_;
std::string link_name_;
std::string topic_name_;
std::string odom_frame_;
std::string child_odom_frame_;
ignition::math::Pose3d offset_;
ignition::math::Pose3d odom_pose_;
// wait sensor to settle before spawning odom frame
bool settled_ = false;
double wait_to_settle_sec_ = 5.0;
double max_linear_speed_before_settle_ = 1e-3;
double max_angular_speed_before_settle_ = 1e-2;
boost::mutex lock;
common::Time last_time_;
// tf
bool publish_tf_;
geometry_msgs::TransformStamped odomTf_;
tf2_ros::TransformBroadcaster tfBroadcaster_;
// rate control
double update_rate_;
double gaussian_noise_;
double GaussianKernel(double mu, double sigma);
std::string robot_namespace_;
ros::CallbackQueue p3d_queue_;
void P3DQueueThread();
boost::thread callback_queue_thread_;
// Pointer to the update event connection
event::ConnectionPtr update_connection_;
unsigned int seed;
// ros publish multi queue, prevents publish() blocking
PubMultiQueue pmq;
};
}
#endif |
common.svh
libARstnFF.sv
libSRstnFF.sv
libCOUNTER.sv
libCOUNTER_max.sv
libHndSk.sv
libSink.sv
libDummy.sv
XFifo.sv
XMem.sv
|
subroutine foo(a, b, x, n)
real(kind=8) :: a(n), b(n), tmp
logical(kind=1) :: x
integer(kind=4) :: i, n
do i = 1, n
if (x) then
a(i) = b(i)
end if
b(i) = b(i) + 10
end do
end subroutine
|
integer*4 function lrflct(idx)
integer*4 idx
c.....this function treats (-1)*<element>.
c.....function porduce 1*<-element> ic core.
c.....and returns a value of index for <-element>.
c.....following line is temporaly one.
lrflct=idx
return
end
|
%*******************************************************
% Declaration
%*******************************************************
\refstepcounter{dummy}
\pdfbookmark[0]{Declaration}{declaration}
\null\vfill
\section*{Declaration}
\thispagestyle{empty}
I declare that this thesis is my own personal effort. I have not already obtained a degree on the basis of this work. Furthermore, I took reasonable care to ensure that the work is original, and, to the best of my knowledge, does not breach copyright law, and has not been taken from other sources except where such work has been cited and acknowledged within the text.
\bigskip
\noindent\textit{Heidelberg, \today}
\smallskip
\begin{flushright}
\begin{tabular}{m{5cm}}
\\ \hline
\\
\vspace*{-\baselineskip}
\centering {\color{darkergray}Dion HΓ€fner}
\end{tabular}
\end{flushright}
\vfill |
function s = sct(V,varargin)
% SCT
%
% s = sct(V,varargin)
%
% Shorthand for:
% s = scatter(V(:,1),V(:,2), ...
switch size(V,2)
case 3
ss = scatter3(V(:,1),V(:,2),V(:,3),varargin{:});
case 2
ss = scatter(V(:,1),V(:,2),varargin{:});
end
if nargout>0, s = ss; end
end
|
[STATEMENT]
lemma odsn_rrep:
"opaodv i \<Turnstile> (otherwith quality_increases {i} (orecvmsg msg_fresh),
other quality_increases {i} \<rightarrow>)
onl \<Gamma>\<^sub>A\<^sub>O\<^sub>D\<^sub>V (seql i (\<lambda>(\<xi>, l). l \<in> {PAodv-:6, PAodv-:7} \<union> {PRrep-:n|n. True} \<longrightarrow> 1 \<le> dsn \<xi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. opaodv i \<Turnstile> (otherwith quality_increases {i} (orecvmsg msg_fresh), other quality_increases {i} \<rightarrow>) onl \<Gamma>\<^sub>A\<^sub>O\<^sub>D\<^sub>V (seql i (\<lambda>(\<xi>, l). l \<in> {PAodv-:6, PAodv-:7} \<union> {PRrep-:n |n. True} \<longrightarrow> 1 \<le> dsn \<xi>))
[PROOF STEP]
by (rule oinvariant_weakenE [OF open_seq_invariant [OF dsn_rrep initiali_aodv]])
(auto simp: seql_onl_swap) |
function identity!(args...); end;
"""
generate_random_input(n [, nrep=5][; Ο=1, seed=1]) -> u
Generate a vector ``u`` containing a random signal. The values are draw from a
zero-mean Gaussian distribution with standard deviation `Ο` and held for `nrep`
samples. The random number generator is initialized with `seed`, during the
generation.
"""
function generate_random_input(n, nrep=5; Ο=1, seed=1)
srand(seed)
u = Ο*randn(Int(n//nrep));
return repeat(u; inner=(nrep));
end
## Lag function
function lag!(result::Vector{Float64},
x::Vector{Float64}, n::Int, N::Int)
for i = 1:n
@inbounds result[i] = x[1]
end
for i = (n+1):N
@inbounds result[i] = x[i-n]
end
end
function lag(x::Vector{Float64}, n::Int)
N = length(x)
result = copy(x)
lag!(result, x, n, N)
return result
end
function lag(x::Vector{Float64}, list_n::Vector{Int})
hcat((lag(x, n) for n in list_n)...)
end
function lag(x::Matrix{Float64}, llist_n::Vector{Vector{Int}})
hcat((lag(x[:, i], list_n) for (i, list_n) in enumerate(llist_n))...)
end
## matrix2subviews
function matrix2subviews{T<:Any}(X::Matrix{T})
N, p = size(X)
X_views = Vector{Vector{T}}(p)
for i = 1:p
X_views[i] = X[:, i]
end
return X_views, N, p
end
function subviews2matrix{T<:Any}(X_views::Vector{Vector{T}}, N, p)
X = Matrix{T}(N, p)
for i = 1:p
for j = 1:N
X[j, i] = X_views[i][j]
end
end
return X
end
# Convert Compressed Predictor Matrix to matrix
if glmnet_loaded
function Base.convert(::Type{Matrix{Float64}},
X::GLMNet.CompressedPredictorMatrix)
mat = zeros(X.ni, length(X.nin))
for b = 1:size(mat, 2), i = 1:X.nin[b]
mat[X.ia[i], b] = X.ca[i, b]
end
return mat
end
end
|
# Looker API 4.0 (Beta) Reference
#
# Welcome to the future! API 4.0 co-exists with APIs 3.1 and 3.0. (3.0 should no longer be used.) The \"beta\" tag means updates for API 4.0 may include breaking changes, but as always we will work to minimize them. ### Authorization The classic method of API authorization uses Looker **API3** credentials for authorization and access control. Looker admins can create API3 credentials on Looker's **Admin/Users** page. API 4.0 adds additional ways to authenticate API requests, including OAuth and CORS requests. For details, see [Looker API Authorization](https://looker.com/docs/r/api/authorization). ### API Explorer The API Explorer is a Looker-provided utility with many new and unique features for learning and using the Looker API and SDKs. It is a replacement for the 'api-docs' page currently provided on Looker instances. For details, see the [API Explorer documentation](https://looker.com/docs/r/api/explorer). ### Looker Language SDKs The Looker API is a RESTful system that should be usable by any programming language capable of making HTTPS requests. SDKs for a variety of programming languages are also provided to streamline using the API. Looker has an OpenSource [sdk-codegen project](https://github.com/looker-open-source/sdk-codegen) that provides several language SDKs. Language SDKs generated by `sdk-codegen` have an Authentication manager that can automatically authenticate API requests when needed. For details on available Looker SDKs, see [Looker API Client SDKs](https://looker.com/docs/r/api/client_sdks). ### API Versioning Future releases of Looker expand the latest API version release-by-release to securely expose more and more of the core power of the Looker platform to API client applications. API endpoints marked as \"beta\" may receive breaking changes without warning (but we will try to avoid doing that). Stable (non-beta) API endpoints should not receive breaking changes in future releases. For details, see [Looker API Versioning](https://looker.com/docs/r/api/versioning). ### In This Release API 4.0 version was introduced so we can make adjustments to API functions, parameters, and response types to fix bugs and inconsistencies. These changes fall outside the bounds of non-breaking additive changes we can make to our stable API 3.1. One benefit of these type adjustments in API 4.0 is dramatically better support for strongly typed languages like TypeScript, Kotlin, Swift, Go, C#, and more. While API 3.1 is still the de-facto Looker API (\"current\", \"stable\", \"default\", etc), the bulk of our development activity has shifted to API 4.0, where all new features are added. The API Explorer can be used to [interactively compare](https://looker.com/docs/r/api/explorer#comparing_api_versions) the differences between API 3.1 and 4.0. ### API and SDK Support Policies Looker API versions and language SDKs have varying support levels. Please read the API and SDK [support policies](https://looker.com/docs/r/api/support-policy) for more information.
#
# OpenAPI spec version: 4.0.21.18
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' LDAPConfig Class
#'
#' @field can
#' @field alternate_email_login_allowed
#' @field auth_password
#' @field auth_requires_role
#' @field auth_username
#' @field connection_host
#' @field connection_port
#' @field connection_tls
#' @field connection_tls_no_verify
#' @field default_new_user_group_ids
#' @field default_new_user_groups
#' @field default_new_user_role_ids
#' @field default_new_user_roles
#' @field enabled
#' @field force_no_page
#' @field groups
#' @field groups_base_dn
#' @field groups_finder_type
#' @field groups_member_attribute
#' @field groups_objectclasses
#' @field groups_user_attribute
#' @field groups_with_role_ids
#' @field has_auth_password
#' @field merge_new_users_by_email
#' @field modified_at
#' @field modified_by
#' @field set_roles_from_groups
#' @field test_ldap_password
#' @field test_ldap_user
#' @field user_attribute_map_email
#' @field user_attribute_map_first_name
#' @field user_attribute_map_last_name
#' @field user_attribute_map_ldap_id
#' @field user_attributes
#' @field user_attributes_with_ids
#' @field user_bind_base_dn
#' @field user_custom_filter
#' @field user_id_attribute_names
#' @field user_objectclass
#' @field allow_normal_group_membership
#' @field allow_roles_from_normal_groups
#' @field allow_direct_roles
#' @field url
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite parse_json toJSON
#' @export
LDAPConfig <- R6::R6Class(
'LDAPConfig',
public = list(
`can` = NULL,
`alternate_email_login_allowed` = NULL,
`auth_password` = NULL,
`auth_requires_role` = NULL,
`auth_username` = NULL,
`connection_host` = NULL,
`connection_port` = NULL,
`connection_tls` = NULL,
`connection_tls_no_verify` = NULL,
`default_new_user_group_ids` = NULL,
`default_new_user_groups` = NULL,
`default_new_user_role_ids` = NULL,
`default_new_user_roles` = NULL,
`enabled` = NULL,
`force_no_page` = NULL,
`groups` = NULL,
`groups_base_dn` = NULL,
`groups_finder_type` = NULL,
`groups_member_attribute` = NULL,
`groups_objectclasses` = NULL,
`groups_user_attribute` = NULL,
`groups_with_role_ids` = NULL,
`has_auth_password` = NULL,
`merge_new_users_by_email` = NULL,
`modified_at` = NULL,
`modified_by` = NULL,
`set_roles_from_groups` = NULL,
`test_ldap_password` = NULL,
`test_ldap_user` = NULL,
`user_attribute_map_email` = NULL,
`user_attribute_map_first_name` = NULL,
`user_attribute_map_last_name` = NULL,
`user_attribute_map_ldap_id` = NULL,
`user_attributes` = NULL,
`user_attributes_with_ids` = NULL,
`user_bind_base_dn` = NULL,
`user_custom_filter` = NULL,
`user_id_attribute_names` = NULL,
`user_objectclass` = NULL,
`allow_normal_group_membership` = NULL,
`allow_roles_from_normal_groups` = NULL,
`allow_direct_roles` = NULL,
`url` = NULL,
initialize = function(`can`, `alternate_email_login_allowed`, `auth_password`, `auth_requires_role`, `auth_username`, `connection_host`, `connection_port`, `connection_tls`, `connection_tls_no_verify`, `default_new_user_group_ids`, `default_new_user_groups`, `default_new_user_role_ids`, `default_new_user_roles`, `enabled`, `force_no_page`, `groups`, `groups_base_dn`, `groups_finder_type`, `groups_member_attribute`, `groups_objectclasses`, `groups_user_attribute`, `groups_with_role_ids`, `has_auth_password`, `merge_new_users_by_email`, `modified_at`, `modified_by`, `set_roles_from_groups`, `test_ldap_password`, `test_ldap_user`, `user_attribute_map_email`, `user_attribute_map_first_name`, `user_attribute_map_last_name`, `user_attribute_map_ldap_id`, `user_attributes`, `user_attributes_with_ids`, `user_bind_base_dn`, `user_custom_filter`, `user_id_attribute_names`, `user_objectclass`, `allow_normal_group_membership`, `allow_roles_from_normal_groups`, `allow_direct_roles`, `url`){
if (!missing(`can`)) {
self$`can` <- `can`
}
if (!missing(`alternate_email_login_allowed`)) {
self$`alternate_email_login_allowed` <- `alternate_email_login_allowed`
}
if (!missing(`auth_password`)) {
stopifnot(is.character(`auth_password`), length(`auth_password`) == 1)
self$`auth_password` <- `auth_password`
}
if (!missing(`auth_requires_role`)) {
self$`auth_requires_role` <- `auth_requires_role`
}
if (!missing(`auth_username`)) {
stopifnot(is.character(`auth_username`), length(`auth_username`) == 1)
self$`auth_username` <- `auth_username`
}
if (!missing(`connection_host`)) {
stopifnot(is.character(`connection_host`), length(`connection_host`) == 1)
self$`connection_host` <- `connection_host`
}
if (!missing(`connection_port`)) {
stopifnot(is.character(`connection_port`), length(`connection_port`) == 1)
self$`connection_port` <- `connection_port`
}
if (!missing(`connection_tls`)) {
self$`connection_tls` <- `connection_tls`
}
if (!missing(`connection_tls_no_verify`)) {
self$`connection_tls_no_verify` <- `connection_tls_no_verify`
}
if (!missing(`default_new_user_group_ids`)) {
stopifnot(is.list(`default_new_user_group_ids`), length(`default_new_user_group_ids`) != 0)
lapply(`default_new_user_group_ids`, function(x) stopifnot(is.character(x)))
self$`default_new_user_group_ids` <- `default_new_user_group_ids`
}
if (!missing(`default_new_user_groups`)) {
stopifnot(is.list(`default_new_user_groups`), length(`default_new_user_groups`) != 0)
lapply(`default_new_user_groups`, function(x) stopifnot(R6::is.R6(x)))
self$`default_new_user_groups` <- `default_new_user_groups`
}
if (!missing(`default_new_user_role_ids`)) {
stopifnot(is.list(`default_new_user_role_ids`), length(`default_new_user_role_ids`) != 0)
lapply(`default_new_user_role_ids`, function(x) stopifnot(is.character(x)))
self$`default_new_user_role_ids` <- `default_new_user_role_ids`
}
if (!missing(`default_new_user_roles`)) {
stopifnot(is.list(`default_new_user_roles`), length(`default_new_user_roles`) != 0)
lapply(`default_new_user_roles`, function(x) stopifnot(R6::is.R6(x)))
self$`default_new_user_roles` <- `default_new_user_roles`
}
if (!missing(`enabled`)) {
self$`enabled` <- `enabled`
}
if (!missing(`force_no_page`)) {
self$`force_no_page` <- `force_no_page`
}
if (!missing(`groups`)) {
stopifnot(is.list(`groups`), length(`groups`) != 0)
lapply(`groups`, function(x) stopifnot(R6::is.R6(x)))
self$`groups` <- `groups`
}
if (!missing(`groups_base_dn`)) {
stopifnot(is.character(`groups_base_dn`), length(`groups_base_dn`) == 1)
self$`groups_base_dn` <- `groups_base_dn`
}
if (!missing(`groups_finder_type`)) {
stopifnot(is.character(`groups_finder_type`), length(`groups_finder_type`) == 1)
self$`groups_finder_type` <- `groups_finder_type`
}
if (!missing(`groups_member_attribute`)) {
stopifnot(is.character(`groups_member_attribute`), length(`groups_member_attribute`) == 1)
self$`groups_member_attribute` <- `groups_member_attribute`
}
if (!missing(`groups_objectclasses`)) {
stopifnot(is.character(`groups_objectclasses`), length(`groups_objectclasses`) == 1)
self$`groups_objectclasses` <- `groups_objectclasses`
}
if (!missing(`groups_user_attribute`)) {
stopifnot(is.character(`groups_user_attribute`), length(`groups_user_attribute`) == 1)
self$`groups_user_attribute` <- `groups_user_attribute`
}
if (!missing(`groups_with_role_ids`)) {
stopifnot(is.list(`groups_with_role_ids`), length(`groups_with_role_ids`) != 0)
lapply(`groups_with_role_ids`, function(x) stopifnot(R6::is.R6(x)))
self$`groups_with_role_ids` <- `groups_with_role_ids`
}
if (!missing(`has_auth_password`)) {
self$`has_auth_password` <- `has_auth_password`
}
if (!missing(`merge_new_users_by_email`)) {
self$`merge_new_users_by_email` <- `merge_new_users_by_email`
}
if (!missing(`modified_at`)) {
stopifnot(is.character(`modified_at`), length(`modified_at`) == 1)
self$`modified_at` <- `modified_at`
}
if (!missing(`modified_by`)) {
stopifnot(is.character(`modified_by`), length(`modified_by`) == 1)
self$`modified_by` <- `modified_by`
}
if (!missing(`set_roles_from_groups`)) {
self$`set_roles_from_groups` <- `set_roles_from_groups`
}
if (!missing(`test_ldap_password`)) {
stopifnot(is.character(`test_ldap_password`), length(`test_ldap_password`) == 1)
self$`test_ldap_password` <- `test_ldap_password`
}
if (!missing(`test_ldap_user`)) {
stopifnot(is.character(`test_ldap_user`), length(`test_ldap_user`) == 1)
self$`test_ldap_user` <- `test_ldap_user`
}
if (!missing(`user_attribute_map_email`)) {
stopifnot(is.character(`user_attribute_map_email`), length(`user_attribute_map_email`) == 1)
self$`user_attribute_map_email` <- `user_attribute_map_email`
}
if (!missing(`user_attribute_map_first_name`)) {
stopifnot(is.character(`user_attribute_map_first_name`), length(`user_attribute_map_first_name`) == 1)
self$`user_attribute_map_first_name` <- `user_attribute_map_first_name`
}
if (!missing(`user_attribute_map_last_name`)) {
stopifnot(is.character(`user_attribute_map_last_name`), length(`user_attribute_map_last_name`) == 1)
self$`user_attribute_map_last_name` <- `user_attribute_map_last_name`
}
if (!missing(`user_attribute_map_ldap_id`)) {
stopifnot(is.character(`user_attribute_map_ldap_id`), length(`user_attribute_map_ldap_id`) == 1)
self$`user_attribute_map_ldap_id` <- `user_attribute_map_ldap_id`
}
if (!missing(`user_attributes`)) {
stopifnot(is.list(`user_attributes`), length(`user_attributes`) != 0)
lapply(`user_attributes`, function(x) stopifnot(R6::is.R6(x)))
self$`user_attributes` <- `user_attributes`
}
if (!missing(`user_attributes_with_ids`)) {
stopifnot(is.list(`user_attributes_with_ids`), length(`user_attributes_with_ids`) != 0)
lapply(`user_attributes_with_ids`, function(x) stopifnot(R6::is.R6(x)))
self$`user_attributes_with_ids` <- `user_attributes_with_ids`
}
if (!missing(`user_bind_base_dn`)) {
stopifnot(is.character(`user_bind_base_dn`), length(`user_bind_base_dn`) == 1)
self$`user_bind_base_dn` <- `user_bind_base_dn`
}
if (!missing(`user_custom_filter`)) {
stopifnot(is.character(`user_custom_filter`), length(`user_custom_filter`) == 1)
self$`user_custom_filter` <- `user_custom_filter`
}
if (!missing(`user_id_attribute_names`)) {
stopifnot(is.character(`user_id_attribute_names`), length(`user_id_attribute_names`) == 1)
self$`user_id_attribute_names` <- `user_id_attribute_names`
}
if (!missing(`user_objectclass`)) {
stopifnot(is.character(`user_objectclass`), length(`user_objectclass`) == 1)
self$`user_objectclass` <- `user_objectclass`
}
if (!missing(`allow_normal_group_membership`)) {
self$`allow_normal_group_membership` <- `allow_normal_group_membership`
}
if (!missing(`allow_roles_from_normal_groups`)) {
self$`allow_roles_from_normal_groups` <- `allow_roles_from_normal_groups`
}
if (!missing(`allow_direct_roles`)) {
self$`allow_direct_roles` <- `allow_direct_roles`
}
if (!missing(`url`)) {
stopifnot(is.character(`url`), length(`url`) == 1)
self$`url` <- `url`
}
},
toJSON = function() {
LDAPConfigObject <- list()
if (!is.null(self$`can`)) {
LDAPConfigObject[['can']] <- self$`can`
}
if (!is.null(self$`alternate_email_login_allowed`)) {
LDAPConfigObject[['alternate_email_login_allowed']] <- self$`alternate_email_login_allowed`
}
if (!is.null(self$`auth_password`)) {
LDAPConfigObject[['auth_password']] <- self$`auth_password`
}
if (!is.null(self$`auth_requires_role`)) {
LDAPConfigObject[['auth_requires_role']] <- self$`auth_requires_role`
}
if (!is.null(self$`auth_username`)) {
LDAPConfigObject[['auth_username']] <- self$`auth_username`
}
if (!is.null(self$`connection_host`)) {
LDAPConfigObject[['connection_host']] <- self$`connection_host`
}
if (!is.null(self$`connection_port`)) {
LDAPConfigObject[['connection_port']] <- self$`connection_port`
}
if (!is.null(self$`connection_tls`)) {
LDAPConfigObject[['connection_tls']] <- self$`connection_tls`
}
if (!is.null(self$`connection_tls_no_verify`)) {
LDAPConfigObject[['connection_tls_no_verify']] <- self$`connection_tls_no_verify`
}
if (!is.null(self$`default_new_user_group_ids`)) {
LDAPConfigObject[['default_new_user_group_ids']] <- self$`default_new_user_group_ids`
}
if (!is.null(self$`default_new_user_groups`)) {
LDAPConfigObject[['default_new_user_groups']] <- lapply(self$`default_new_user_groups`, function(x) x$toJSON())
}
if (!is.null(self$`default_new_user_role_ids`)) {
LDAPConfigObject[['default_new_user_role_ids']] <- self$`default_new_user_role_ids`
}
if (!is.null(self$`default_new_user_roles`)) {
LDAPConfigObject[['default_new_user_roles']] <- lapply(self$`default_new_user_roles`, function(x) x$toJSON())
}
if (!is.null(self$`enabled`)) {
LDAPConfigObject[['enabled']] <- self$`enabled`
}
if (!is.null(self$`force_no_page`)) {
LDAPConfigObject[['force_no_page']] <- self$`force_no_page`
}
if (!is.null(self$`groups`)) {
LDAPConfigObject[['groups']] <- lapply(self$`groups`, function(x) x$toJSON())
}
if (!is.null(self$`groups_base_dn`)) {
LDAPConfigObject[['groups_base_dn']] <- self$`groups_base_dn`
}
if (!is.null(self$`groups_finder_type`)) {
LDAPConfigObject[['groups_finder_type']] <- self$`groups_finder_type`
}
if (!is.null(self$`groups_member_attribute`)) {
LDAPConfigObject[['groups_member_attribute']] <- self$`groups_member_attribute`
}
if (!is.null(self$`groups_objectclasses`)) {
LDAPConfigObject[['groups_objectclasses']] <- self$`groups_objectclasses`
}
if (!is.null(self$`groups_user_attribute`)) {
LDAPConfigObject[['groups_user_attribute']] <- self$`groups_user_attribute`
}
if (!is.null(self$`groups_with_role_ids`)) {
LDAPConfigObject[['groups_with_role_ids']] <- lapply(self$`groups_with_role_ids`, function(x) x$toJSON())
}
if (!is.null(self$`has_auth_password`)) {
LDAPConfigObject[['has_auth_password']] <- self$`has_auth_password`
}
if (!is.null(self$`merge_new_users_by_email`)) {
LDAPConfigObject[['merge_new_users_by_email']] <- self$`merge_new_users_by_email`
}
if (!is.null(self$`modified_at`)) {
LDAPConfigObject[['modified_at']] <- self$`modified_at`
}
if (!is.null(self$`modified_by`)) {
LDAPConfigObject[['modified_by']] <- self$`modified_by`
}
if (!is.null(self$`set_roles_from_groups`)) {
LDAPConfigObject[['set_roles_from_groups']] <- self$`set_roles_from_groups`
}
if (!is.null(self$`test_ldap_password`)) {
LDAPConfigObject[['test_ldap_password']] <- self$`test_ldap_password`
}
if (!is.null(self$`test_ldap_user`)) {
LDAPConfigObject[['test_ldap_user']] <- self$`test_ldap_user`
}
if (!is.null(self$`user_attribute_map_email`)) {
LDAPConfigObject[['user_attribute_map_email']] <- self$`user_attribute_map_email`
}
if (!is.null(self$`user_attribute_map_first_name`)) {
LDAPConfigObject[['user_attribute_map_first_name']] <- self$`user_attribute_map_first_name`
}
if (!is.null(self$`user_attribute_map_last_name`)) {
LDAPConfigObject[['user_attribute_map_last_name']] <- self$`user_attribute_map_last_name`
}
if (!is.null(self$`user_attribute_map_ldap_id`)) {
LDAPConfigObject[['user_attribute_map_ldap_id']] <- self$`user_attribute_map_ldap_id`
}
if (!is.null(self$`user_attributes`)) {
LDAPConfigObject[['user_attributes']] <- lapply(self$`user_attributes`, function(x) x$toJSON())
}
if (!is.null(self$`user_attributes_with_ids`)) {
LDAPConfigObject[['user_attributes_with_ids']] <- lapply(self$`user_attributes_with_ids`, function(x) x$toJSON())
}
if (!is.null(self$`user_bind_base_dn`)) {
LDAPConfigObject[['user_bind_base_dn']] <- self$`user_bind_base_dn`
}
if (!is.null(self$`user_custom_filter`)) {
LDAPConfigObject[['user_custom_filter']] <- self$`user_custom_filter`
}
if (!is.null(self$`user_id_attribute_names`)) {
LDAPConfigObject[['user_id_attribute_names']] <- self$`user_id_attribute_names`
}
if (!is.null(self$`user_objectclass`)) {
LDAPConfigObject[['user_objectclass']] <- self$`user_objectclass`
}
if (!is.null(self$`allow_normal_group_membership`)) {
LDAPConfigObject[['allow_normal_group_membership']] <- self$`allow_normal_group_membership`
}
if (!is.null(self$`allow_roles_from_normal_groups`)) {
LDAPConfigObject[['allow_roles_from_normal_groups']] <- self$`allow_roles_from_normal_groups`
}
if (!is.null(self$`allow_direct_roles`)) {
LDAPConfigObject[['allow_direct_roles']] <- self$`allow_direct_roles`
}
if (!is.null(self$`url`)) {
LDAPConfigObject[['url']] <- self$`url`
}
LDAPConfigObject
},
fromJSONObject = function(LDAPConfigJsonObject) {
LDAPConfigObject <- LDAPConfigJsonObject #jsonlite::fromJSON(LDAPConfigJson, simplifyVector = FALSE)
if (!is.null(LDAPConfigObject$`can`)) {
self$`can` <- LDAPConfigObject$`can`
}
if (!is.null(LDAPConfigObject$`alternate_email_login_allowed`)) {
self$`alternate_email_login_allowed` <- LDAPConfigObject$`alternate_email_login_allowed`
}
if (!is.null(LDAPConfigObject$`auth_password`)) {
self$`auth_password` <- LDAPConfigObject$`auth_password`
}
if (!is.null(LDAPConfigObject$`auth_requires_role`)) {
self$`auth_requires_role` <- LDAPConfigObject$`auth_requires_role`
}
if (!is.null(LDAPConfigObject$`auth_username`)) {
self$`auth_username` <- LDAPConfigObject$`auth_username`
}
if (!is.null(LDAPConfigObject$`connection_host`)) {
self$`connection_host` <- LDAPConfigObject$`connection_host`
}
if (!is.null(LDAPConfigObject$`connection_port`)) {
self$`connection_port` <- LDAPConfigObject$`connection_port`
}
if (!is.null(LDAPConfigObject$`connection_tls`)) {
self$`connection_tls` <- LDAPConfigObject$`connection_tls`
}
if (!is.null(LDAPConfigObject$`connection_tls_no_verify`)) {
self$`connection_tls_no_verify` <- LDAPConfigObject$`connection_tls_no_verify`
}
if (!is.null(LDAPConfigObject$`default_new_user_group_ids`)) {
self$`default_new_user_group_ids` <- LDAPConfigObject$`default_new_user_group_ids`
}
if (!is.null(LDAPConfigObject$`default_new_user_groups`)) {
self$`default_new_user_groups` <- lapply(LDAPConfigObject$`default_new_user_groups`, function(x) {
default_new_user_groupsObject <- Group$new()
default_new_user_groupsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
default_new_user_groupsObject
})
}
if (!is.null(LDAPConfigObject$`default_new_user_role_ids`)) {
self$`default_new_user_role_ids` <- LDAPConfigObject$`default_new_user_role_ids`
}
if (!is.null(LDAPConfigObject$`default_new_user_roles`)) {
self$`default_new_user_roles` <- lapply(LDAPConfigObject$`default_new_user_roles`, function(x) {
default_new_user_rolesObject <- Role$new()
default_new_user_rolesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
default_new_user_rolesObject
})
}
if (!is.null(LDAPConfigObject$`enabled`)) {
self$`enabled` <- LDAPConfigObject$`enabled`
}
if (!is.null(LDAPConfigObject$`force_no_page`)) {
self$`force_no_page` <- LDAPConfigObject$`force_no_page`
}
if (!is.null(LDAPConfigObject$`groups`)) {
self$`groups` <- lapply(LDAPConfigObject$`groups`, function(x) {
groupsObject <- LDAPGroupRead$new()
groupsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
groupsObject
})
}
if (!is.null(LDAPConfigObject$`groups_base_dn`)) {
self$`groups_base_dn` <- LDAPConfigObject$`groups_base_dn`
}
if (!is.null(LDAPConfigObject$`groups_finder_type`)) {
self$`groups_finder_type` <- LDAPConfigObject$`groups_finder_type`
}
if (!is.null(LDAPConfigObject$`groups_member_attribute`)) {
self$`groups_member_attribute` <- LDAPConfigObject$`groups_member_attribute`
}
if (!is.null(LDAPConfigObject$`groups_objectclasses`)) {
self$`groups_objectclasses` <- LDAPConfigObject$`groups_objectclasses`
}
if (!is.null(LDAPConfigObject$`groups_user_attribute`)) {
self$`groups_user_attribute` <- LDAPConfigObject$`groups_user_attribute`
}
if (!is.null(LDAPConfigObject$`groups_with_role_ids`)) {
self$`groups_with_role_ids` <- lapply(LDAPConfigObject$`groups_with_role_ids`, function(x) {
groups_with_role_idsObject <- LDAPGroupWrite$new()
groups_with_role_idsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
groups_with_role_idsObject
})
}
if (!is.null(LDAPConfigObject$`has_auth_password`)) {
self$`has_auth_password` <- LDAPConfigObject$`has_auth_password`
}
if (!is.null(LDAPConfigObject$`merge_new_users_by_email`)) {
self$`merge_new_users_by_email` <- LDAPConfigObject$`merge_new_users_by_email`
}
if (!is.null(LDAPConfigObject$`modified_at`)) {
self$`modified_at` <- LDAPConfigObject$`modified_at`
}
if (!is.null(LDAPConfigObject$`modified_by`)) {
self$`modified_by` <- LDAPConfigObject$`modified_by`
}
if (!is.null(LDAPConfigObject$`set_roles_from_groups`)) {
self$`set_roles_from_groups` <- LDAPConfigObject$`set_roles_from_groups`
}
if (!is.null(LDAPConfigObject$`test_ldap_password`)) {
self$`test_ldap_password` <- LDAPConfigObject$`test_ldap_password`
}
if (!is.null(LDAPConfigObject$`test_ldap_user`)) {
self$`test_ldap_user` <- LDAPConfigObject$`test_ldap_user`
}
if (!is.null(LDAPConfigObject$`user_attribute_map_email`)) {
self$`user_attribute_map_email` <- LDAPConfigObject$`user_attribute_map_email`
}
if (!is.null(LDAPConfigObject$`user_attribute_map_first_name`)) {
self$`user_attribute_map_first_name` <- LDAPConfigObject$`user_attribute_map_first_name`
}
if (!is.null(LDAPConfigObject$`user_attribute_map_last_name`)) {
self$`user_attribute_map_last_name` <- LDAPConfigObject$`user_attribute_map_last_name`
}
if (!is.null(LDAPConfigObject$`user_attribute_map_ldap_id`)) {
self$`user_attribute_map_ldap_id` <- LDAPConfigObject$`user_attribute_map_ldap_id`
}
if (!is.null(LDAPConfigObject$`user_attributes`)) {
self$`user_attributes` <- lapply(LDAPConfigObject$`user_attributes`, function(x) {
user_attributesObject <- LDAPUserAttributeRead$new()
user_attributesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
user_attributesObject
})
}
if (!is.null(LDAPConfigObject$`user_attributes_with_ids`)) {
self$`user_attributes_with_ids` <- lapply(LDAPConfigObject$`user_attributes_with_ids`, function(x) {
user_attributes_with_idsObject <- LDAPUserAttributeWrite$new()
user_attributes_with_idsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
user_attributes_with_idsObject
})
}
if (!is.null(LDAPConfigObject$`user_bind_base_dn`)) {
self$`user_bind_base_dn` <- LDAPConfigObject$`user_bind_base_dn`
}
if (!is.null(LDAPConfigObject$`user_custom_filter`)) {
self$`user_custom_filter` <- LDAPConfigObject$`user_custom_filter`
}
if (!is.null(LDAPConfigObject$`user_id_attribute_names`)) {
self$`user_id_attribute_names` <- LDAPConfigObject$`user_id_attribute_names`
}
if (!is.null(LDAPConfigObject$`user_objectclass`)) {
self$`user_objectclass` <- LDAPConfigObject$`user_objectclass`
}
if (!is.null(LDAPConfigObject$`allow_normal_group_membership`)) {
self$`allow_normal_group_membership` <- LDAPConfigObject$`allow_normal_group_membership`
}
if (!is.null(LDAPConfigObject$`allow_roles_from_normal_groups`)) {
self$`allow_roles_from_normal_groups` <- LDAPConfigObject$`allow_roles_from_normal_groups`
}
if (!is.null(LDAPConfigObject$`allow_direct_roles`)) {
self$`allow_direct_roles` <- LDAPConfigObject$`allow_direct_roles`
}
if (!is.null(LDAPConfigObject$`url`)) {
self$`url` <- LDAPConfigObject$`url`
}
},
fromJSON = function(LDAPConfigJson) {
LDAPConfigObject <- jsonlite::fromJSON(LDAPConfigJson, simplifyVector = FALSE)
self$fromJSONObject(LDAPConfigObject)
},
toJSONString = function() {
sprintf(
'{
"can": %s,
"alternate_email_login_allowed": %s,
"auth_password": %s,
"auth_requires_role": %s,
"auth_username": %s,
"connection_host": %s,
"connection_port": %s,
"connection_tls": %s,
"connection_tls_no_verify": %s,
"default_new_user_group_ids": [%s],
"default_new_user_groups": [%s],
"default_new_user_role_ids": [%s],
"default_new_user_roles": [%s],
"enabled": %s,
"force_no_page": %s,
"groups": [%s],
"groups_base_dn": %s,
"groups_finder_type": %s,
"groups_member_attribute": %s,
"groups_objectclasses": %s,
"groups_user_attribute": %s,
"groups_with_role_ids": [%s],
"has_auth_password": %s,
"merge_new_users_by_email": %s,
"modified_at": %s,
"modified_by": %s,
"set_roles_from_groups": %s,
"test_ldap_password": %s,
"test_ldap_user": %s,
"user_attribute_map_email": %s,
"user_attribute_map_first_name": %s,
"user_attribute_map_last_name": %s,
"user_attribute_map_ldap_id": %s,
"user_attributes": [%s],
"user_attributes_with_ids": [%s],
"user_bind_base_dn": %s,
"user_custom_filter": %s,
"user_id_attribute_names": %s,
"user_objectclass": %s,
"allow_normal_group_membership": %s,
"allow_roles_from_normal_groups": %s,
"allow_direct_roles": %s,
"url": %s
}',
self$`can`,
self$`alternate_email_login_allowed`,
self$`auth_password`,
self$`auth_requires_role`,
self$`auth_username`,
self$`connection_host`,
self$`connection_port`,
self$`connection_tls`,
self$`connection_tls_no_verify`,
lapply(self$`default_new_user_group_ids`, function(x) paste(paste0('"', x, '"'), sep=",")),
lapply(self$`default_new_user_groups`, function(x) paste(x$toJSON(), sep=",")),
lapply(self$`default_new_user_role_ids`, function(x) paste(paste0('"', x, '"'), sep=",")),
lapply(self$`default_new_user_roles`, function(x) paste(x$toJSON(), sep=",")),
self$`enabled`,
self$`force_no_page`,
lapply(self$`groups`, function(x) paste(x$toJSON(), sep=",")),
self$`groups_base_dn`,
self$`groups_finder_type`,
self$`groups_member_attribute`,
self$`groups_objectclasses`,
self$`groups_user_attribute`,
lapply(self$`groups_with_role_ids`, function(x) paste(x$toJSON(), sep=",")),
self$`has_auth_password`,
self$`merge_new_users_by_email`,
self$`modified_at`,
self$`modified_by`,
self$`set_roles_from_groups`,
self$`test_ldap_password`,
self$`test_ldap_user`,
self$`user_attribute_map_email`,
self$`user_attribute_map_first_name`,
self$`user_attribute_map_last_name`,
self$`user_attribute_map_ldap_id`,
lapply(self$`user_attributes`, function(x) paste(x$toJSON(), sep=",")),
lapply(self$`user_attributes_with_ids`, function(x) paste(x$toJSON(), sep=",")),
self$`user_bind_base_dn`,
self$`user_custom_filter`,
self$`user_id_attribute_names`,
self$`user_objectclass`,
self$`allow_normal_group_membership`,
self$`allow_roles_from_normal_groups`,
self$`allow_direct_roles`,
self$`url`
)
},
fromJSONString = function(LDAPConfigJson) {
LDAPConfigObject <- jsonlite::fromJSON(LDAPConfigJson, simplifyVector = FALSE)
self$`can` <- LDAPConfigObject$`can`
self$`alternate_email_login_allowed` <- LDAPConfigObject$`alternate_email_login_allowed`
self$`auth_password` <- LDAPConfigObject$`auth_password`
self$`auth_requires_role` <- LDAPConfigObject$`auth_requires_role`
self$`auth_username` <- LDAPConfigObject$`auth_username`
self$`connection_host` <- LDAPConfigObject$`connection_host`
self$`connection_port` <- LDAPConfigObject$`connection_port`
self$`connection_tls` <- LDAPConfigObject$`connection_tls`
self$`connection_tls_no_verify` <- LDAPConfigObject$`connection_tls_no_verify`
self$`default_new_user_group_ids` <- LDAPConfigObject$`default_new_user_group_ids`
self$`default_new_user_groups` <- lapply(LDAPConfigObject$`default_new_user_groups`, function(x) Group$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`default_new_user_role_ids` <- LDAPConfigObject$`default_new_user_role_ids`
self$`default_new_user_roles` <- lapply(LDAPConfigObject$`default_new_user_roles`, function(x) Role$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`enabled` <- LDAPConfigObject$`enabled`
self$`force_no_page` <- LDAPConfigObject$`force_no_page`
self$`groups` <- lapply(LDAPConfigObject$`groups`, function(x) LDAPGroupRead$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`groups_base_dn` <- LDAPConfigObject$`groups_base_dn`
self$`groups_finder_type` <- LDAPConfigObject$`groups_finder_type`
self$`groups_member_attribute` <- LDAPConfigObject$`groups_member_attribute`
self$`groups_objectclasses` <- LDAPConfigObject$`groups_objectclasses`
self$`groups_user_attribute` <- LDAPConfigObject$`groups_user_attribute`
self$`groups_with_role_ids` <- lapply(LDAPConfigObject$`groups_with_role_ids`, function(x) LDAPGroupWrite$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`has_auth_password` <- LDAPConfigObject$`has_auth_password`
self$`merge_new_users_by_email` <- LDAPConfigObject$`merge_new_users_by_email`
self$`modified_at` <- LDAPConfigObject$`modified_at`
self$`modified_by` <- LDAPConfigObject$`modified_by`
self$`set_roles_from_groups` <- LDAPConfigObject$`set_roles_from_groups`
self$`test_ldap_password` <- LDAPConfigObject$`test_ldap_password`
self$`test_ldap_user` <- LDAPConfigObject$`test_ldap_user`
self$`user_attribute_map_email` <- LDAPConfigObject$`user_attribute_map_email`
self$`user_attribute_map_first_name` <- LDAPConfigObject$`user_attribute_map_first_name`
self$`user_attribute_map_last_name` <- LDAPConfigObject$`user_attribute_map_last_name`
self$`user_attribute_map_ldap_id` <- LDAPConfigObject$`user_attribute_map_ldap_id`
self$`user_attributes` <- lapply(LDAPConfigObject$`user_attributes`, function(x) LDAPUserAttributeRead$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`user_attributes_with_ids` <- lapply(LDAPConfigObject$`user_attributes_with_ids`, function(x) LDAPUserAttributeWrite$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`user_bind_base_dn` <- LDAPConfigObject$`user_bind_base_dn`
self$`user_custom_filter` <- LDAPConfigObject$`user_custom_filter`
self$`user_id_attribute_names` <- LDAPConfigObject$`user_id_attribute_names`
self$`user_objectclass` <- LDAPConfigObject$`user_objectclass`
self$`allow_normal_group_membership` <- LDAPConfigObject$`allow_normal_group_membership`
self$`allow_roles_from_normal_groups` <- LDAPConfigObject$`allow_roles_from_normal_groups`
self$`allow_direct_roles` <- LDAPConfigObject$`allow_direct_roles`
self$`url` <- LDAPConfigObject$`url`
}
)
)
|
Add LoadPath "bezier-functions".
Require Import recursive.
Require Import auxiliary.
Require Import QArith.
Require Import Coq.Setoids.Setoid.
Require Import Coq.Classes.RelationClasses.
Lemma bezier_curve_recursive_symm_fstdegree :
forall (P0 P1 : point) (q : Q),
calc_bezier_recursive (P0 :: [P1]) q == calc_bezier_recursive (rev (P0 :: [P1])) (1 - q).
Proof.
intros P0 P1 q.
unfold calc_bezier_recursive. unfold rev. simpl.
destruct P0 as [x0 y0]. destruct P1 as [x1 y1].
unfold "==". simpl. split.
{ ring. }
{ ring. }
Qed.
Theorem bezier_curve_recursive_symm : forall (b : bezier_curve) (q : Q),
calc_bezier_recursive b q == calc_bezier_recursive (rev b) (1 - q).
Proof.
intros b Qed.
induction b as [h| h b'].
{
unfold calc_bezier_recursive. unfold rev. simpl.
destruct h as [xh yh]. unfold "==". simpl.
split.
{ ring. }
{ ring. }
}
{
unfold calc_bezier_recursive in IHb'. unfold rev in IHb'. simpl.
unfold calc_bezier_recursive. unfold rev. simpl.
admit.
}
Admitted. |
(*
Author: RenΓ© Thiemann
Akihisa Yamada
License: BSD
*)
section \<open>Preliminaries\<close>
subsection \<open>Missing Multiset\<close>
text \<open>This theory provides some definitions and lemmas on multisets which we did not find in the
Isabelle distribution.\<close>
theory Missing_Multiset
imports
"HOL-Library.Multiset"
Missing_List
begin
lemma remove_nth_soundness:
assumes "n < length as"
shows "mset (remove_nth n as) = mset as - {#(as!n)#}"
using assms
proof (induct as arbitrary: n)
case (Cons a as)
note [simp] = remove_nth_def
show ?case
proof (cases n)
case (Suc n)
with Cons have n_bd: "n < length as" by auto
with Cons have "mset (remove_nth n as) = mset as - {#as ! n#}" by auto
hence G: "mset (remove_nth (Suc n) (a # as)) = mset as - {#as ! n#} + {#a#}"
by simp
thus ?thesis
proof (cases "a = as!n")
case True
with G and Suc and insert_DiffM2[symmetric]
and insert_DiffM2[of _ "{#as ! n#}"]
and nth_mem_mset[of n as] and n_bd
show ?thesis by auto
next
case False
from G and Suc and diff_union_swap[OF this[symmetric], symmetric] show ?thesis by simp
qed
qed auto
qed auto
lemma multiset_subset_insert: "{ps. ps \<subseteq># add_mset x xs} =
{ps. ps \<subseteq># xs} \<union> add_mset x ` {ps. ps \<subseteq># xs}" (is "?l = ?r")
proof -
{
fix ps
have "(ps \<in> ?l) = (ps \<subseteq># xs + {# x #})" by auto
also have "\<dots> = (ps \<in> ?r)"
proof (cases "x \<in># ps")
case True
then obtain qs where ps: "ps = qs + {#x#}" by (metis insert_DiffM2)
show ?thesis unfolding ps mset_subset_eq_mono_add_right_cancel
by (auto dest: mset_subset_eq_insertD)
next
case False
hence id: "(ps \<subseteq># xs + {#x#}) = (ps \<subseteq># xs)"
by (simp add: subset_mset.inf.absorb_iff2 inter_add_left1)
show ?thesis unfolding id using False by auto
qed
finally have "(ps \<in> ?l) = (ps \<in> ?r)" .
}
thus ?thesis by auto
qed
lemma multiset_of_subseqs: "mset ` set (subseqs xs) = { ps. ps \<subseteq># mset xs}"
proof (induct xs)
case (Cons x xs)
show ?case (is "?l = ?r")
proof -
have id: "?r = {ps. ps \<subseteq># mset xs} \<union> (add_mset x) ` {ps. ps \<subseteq># mset xs}"
by (simp add: multiset_subset_insert)
show ?thesis unfolding id Cons[symmetric]
by (auto simp add: Let_def) (metis UnCI image_iff mset.simps(2))
qed
qed simp
lemma fold_remove1_mset: "mset ws \<subseteq># mset vs \<Longrightarrow> mset (fold remove1 ws vs) + mset ws = mset vs"
proof (induct ws arbitrary: vs)
case (Cons w ws vs)
from Cons(2) have "w \<in> set vs" using set_mset_mono by force
from remove1_mset[OF this] have vs: "mset vs = mset (remove1 w vs) + {#w#}" by simp
from Cons(2)[unfolded vs] have "mset ws \<subseteq># mset (remove1 w vs)" by auto
from Cons(1)[OF this,symmetric]
show ?case unfolding vs by (simp add: ac_simps)
qed simp
lemma subseqs_sub_mset: "ws \<in> set (subseqs vs) \<Longrightarrow> mset ws \<subseteq># mset vs"
proof (induct vs arbitrary: ws)
case (Cons v vs Ws)
note mem = Cons(2)
note IH = Cons(1)
show ?case
proof (cases Ws)
case (Cons w ws)
show ?thesis
proof (cases "v = w")
case True
from mem Cons have "ws \<in> set (subseqs vs)" by (auto simp: Let_def Cons_in_subseqsD[of _ ws vs])
from IH[OF this]
show ?thesis unfolding Cons True by simp
next
case False
with mem Cons have "Ws \<in> set (subseqs vs)" by (auto simp: Let_def Cons_in_subseqsD[of _ ws vs])
note IH = mset_subset_eq_count[OF IH[OF this]]
with IH[of v] show ?thesis by (intro mset_subset_eqI, auto, linarith)
qed
qed simp
qed simp
lemma filter_mset_inequality: "filter_mset f xs \<noteq> xs \<Longrightarrow> \<exists> x \<in># xs. \<not> f x"
by (induct xs, auto)
end
|
PROGRAM MAIN
IMPLICIT NONE
REAL EPS
EPS=1.0
DO WHILE (1.0+EPS.GT.1.0)
EPS=EPS/2.0
END DO
EPS=EPS*2
PRINT *, EPS
END PROGRAM MAIN |
Formal statement is: lemma continuous_prod [continuous_intros]: fixes f :: "'a \<Rightarrow> 'b::t2_space \<Rightarrow> 'c::{real_normed_algebra,comm_ring_1}" shows "(\<And>i. i \<in> S \<Longrightarrow> continuous F (f i)) \<Longrightarrow> continuous F (\<lambda>x. \<Prod>i\<in>S. f i x)" Informal statement is: If $f_i$ is continuous for each $i \in S$, then the product $\prod_{i \in S} f_i$ is continuous. |
A polynomial $p$ has a root $a$ if and only if $p = 0$ or the order of $a$ as a root of $p$ is nonzero. |
From Coq Require Import ssreflect.
From stdpp Require Import base gmap.
From iris.proofmode Require Import tactics.
From aneris.prelude Require Import gset_map.
From aneris.aneris_lang.lib Require Import list_proof.
From aneris.aneris_lang.lib.serialization Require Import serialization_proof.
From aneris.aneris_lang Require Import aneris_lifting proofmode.
From aneris.examples.crdt.spec Require Import crdt_base crdt_time crdt_events crdt_denot crdt_resources.
From aneris.examples.crdt.oplib Require Import oplib_code.
From aneris.examples.crdt.oplib.spec Require Import model spec.
From aneris.examples.crdt.oplib.examples.pncounter Require Import pncounter_code pncounter_proof.
From aneris.examples.crdt.oplib.examples.map_comb Require Import map_comb_code map_comb_proof.
From aneris.examples.crdt.oplib.examples.table_of_counters Require Import table_of_counters_code.
Section table_of_counters_proof.
Context `{!anerisG M Ξ£, !CRDT_Params, !OpLib_Res (mapOp CtrOp)}.
Lemma table_of_counters_init_st_fn_spec :
β’ @init_st_fn_spec _ _ _ _ _ _ _ map_OpLib_Params table_of_counters_init_st.
Proof.
iIntros (addr).
iIntros "!#" (Φ) "_ HΦ".
rewrite /table_of_counters_init_st.
wp_pure _.
wp_apply map_init_st_fn_spec; done.
Qed.
Lemma table_of_counters_effect_spec :
β’ @effect_spec _ _ _ _ _ _ _ map_OpLib_Params table_of_counters_effect.
Proof.
iIntros (addr ev st s log_ev log_st).
iIntros "!#" (Φ) "(%Hev & %Hst & %Hs & %Hevs) HΦ".
rewrite /table_of_counters_effect.
wp_pures.
rewrite /map_comb_effect.
do 4 wp_pure _.
wp_apply map_effect_spec; [iApply Ctr_init_st_fn_spec|iApply Ctr_effect_spec|done|done].
Qed.
Lemma table_of_counters_crdt_fun_spec :
β’ @crdt_fun_spec _ _ _ _ _ _ _ map_OpLib_Params table_of_counters_crdt.
Proof.
iIntros (addr).
iIntros "!#" (Φ) "_ HΦ".
rewrite /table_of_counters_crdt.
wp_pures.
iApply "HΦ".
iExists _, _; iSplit; first done.
iSplit.
- iApply table_of_counters_init_st_fn_spec; done.
- iApply table_of_counters_effect_spec; done.
Qed.
Notation oplib_init' :=
(oplib_init
(s_ser (s_serializer (@OpLib_Serialization _ _ _ _ map_OpLib_Params)))
(s_deser (s_serializer (@OpLib_Serialization _ _ _ _ map_OpLib_Params)))).
Lemma table_of_counters_init_spec :
@init_spec _ _ _ _ _ _ _ map_OpLib_Params _ _ oplib_init' -β
@init_spec_for_specific_crdt _ _ _ _ _ _ _ map_OpLib_Params _ _ table_of_counters_init.
Proof.
iIntros "#Hinit" (repId addr addrs_val).
iIntros (Φ) "!# (%Haddrs & %Hrepid & Hprotos & Hskt & Hfr & Htoken) HΦ".
rewrite /table_of_counters_init /table_of_counters_crdt.
wp_pures.
wp_apply ("Hinit" with "[$Hprotos $Htoken $Hskt $Hfr]").
{ do 2 (iSplit; first done). iApply table_of_counters_crdt_fun_spec; done. }
iIntros (get update) "(HLS & #Hget & #Hupdate)".
wp_pures.
iApply "HΦ"; eauto.
Qed.
End table_of_counters_proof.
|
[STATEMENT]
lemma box_associative:
"|x * y]z = a(x * y * a(z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. | x * y ] z = a (x * y * a z)
[PROOF STEP]
by (simp add: box_def) |
% !TeX spellcheck = en_GB
\documentclass[a4paper,11pt, UKenglish,twoside]{report}
% ********** Preamble: Contains packages and user-defined commands and settings ****************************
\input{Preamble/preamble}
% ******** Thesis Inforamtion such as Title, author, and date *****
\input{thesis_info}
% ******** to only print particular chapters with references *******
%\includeonly{title_page,Abstract/abstract,Introduction/introduction,Summary/summary}
%\includeonly{title_page,Introduction/introduction}
%\includeonly{Introduction/introduction}
%\includeonly{%title_page,
% Results/results}%,Summary/summary,./Appendix/SWC_1h,./Appendix/all_vert_ens_memb}
%\includeonly{Data_Instrument_Methods/data_instruments_methods}
%\includeonly{Weather_Situation/weather_situation}%,Results/results}
%\includeonly{Summary/summary}
\begin{document}
% ******** Title page ******************
\include{title_page}
% ********** Abstract *****************
\include{Abstract/abstract}
\thispagestyle{empty}
\clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a blank page
\normalsize
% ******* Table of contents, List of Figures, Tables **************
{\hypersetup{linkcolor=black} % sets the regularly red color to black
\newpage
\pagenumbering{roman}
\setcounter{page}{1}
\renewcommand{\contentsname}{Table of Contents}
\tableofcontents
\thispagestyle{empty}
% \newpage
% \addcontentsline{toc}{chapter}{List of Figures}
% \listoffigures
% \thispagestyle{empty}
%
% \newpage
% \addcontentsline{toc}{chapter}{List of Tables}
% \listoftables
% \thispagestyle{empty}
%
}
% ******* Main Matter ********************
\newpage\pagenumbering{arabic}\setcounter{page}{1}
\include{Introduction/introduction}
% \include{Theory/theory}
\clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a blank page
\include{Data_Instrument_Methods/data_instruments_methods}
%% \addcontentsline{toc}{part}{Results and Discussion}
\include{Weather_Situation/weather_situation}
\clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a blank
\include{Results/results}
\clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to
\include{Summary/summary}
%
%
\cleardoublepage
% \clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to
% ********** List of Abreviations **************
\newpage
\addcontentsline{toc}{chapter}{List of Abbreviations}
\include{Nomenclature/nomenclature}
\printnomenclature[1in] %%% add width here.
\thispagestyle{empty}
% \clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a blank page
% ******* Bibliography *******************************
% \clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a blank page
\newpage
\cleardoublepage
% \phantomsection
\addcontentsline{toc}{chapter}{References}
\renewcommand{\bibname}{References}
\bibliography{./References/MasterThesis,./References/Names,./References/unpublished}
\bibliographystyle{plainnat_reversed}
\newpage
%\clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a
% ******* Appendices *********************************
% \clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a blank page
% \pagestyle{plain}
% \begin{appendices}
\appendix
% \chapter{}
% \include{./Appendix/sounding}
\include{./Appendix/B6pr_2_dimensional_and_mass_oriented_24.0GHz}
% \chapter{Results}
% \include{./Appendix/surface_obs}
% \include{./Appendix/error_var_sfc}
\include{./Appendix/SWC_1h}
\include{./Appendix/all_vert_ens_memb}
% \end{appendices}
%\clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a
% ********** Acknowledgment **************
\include{Acknowledgment/acknowledgement}
\clearpage\thispagestyle{empty}\hbox{}\newpage %whole line needed to insert a
% ********** Declaration **************
\include{Declaration/declaration}
\end{document} |
Faced with the siege of Ciudad JuΓ‘rez and the outbreak of rebellion in Morelos , DΓaz and members of his cabinet became more willing to negotiate and launched a " skillful peace offensive " aimed at Madero . This was largely a result of panic among the large landowners associated with the DΓaz regime ( the hacendados ) and the financial elite , which represented a " moderate " wing within the government . Some among the <unk> in fact , expected that Zapata would soon march on Mexico City itself , unless peace was concluded with Madero .
|
(**
Formalizing Simulation Relations in Coq by Elaheh Ghassabani
University of Minnesota
**)
Require Export SfLib.
Require Import ClassicalChoice.
(**
Semantically, Atoms are variables like a b c, and so on.
Atomic propositions state simple facts about a state.
States are distinguished by the fact that which atoms they have or
which atoms they satisfy.
So, we can model states as a function atom -> bool.
**)
(** Atomic Proposition : a single atom **)
Definition atom := Type.
(**
With this assumption that we have a defined set of atoms, each state
maps an atom in the set to true or false.
**)
Definition state := atom -> bool.
(******* Formulating Transition Systems *******)
Definition initial_states := state -> Prop.
Definition transition_relation := state -> state -> Prop.
(**
We think of Atoms as a set of atomic propositions: if [A : Atoms],
[A] includes a set of atomic propositions.
**)
Definition Atoms := atom -> Prop.
(** Transition System **)
Definition complete_tr (tr: transition_relation) : Prop :=
forall (s : state) , exists (s' : state) , tr s s'.
Inductive TS : Type :=
trans_sys (ap : Atoms) (i : initial_states) (tr : transition_relation):
complete_tr (tr) -> (exists s, i s) -> TS.
Definition Ap (ts : TS) : Atoms :=
match ts with
| trans_sys x _ _ _ _ => x
end.
Definition Init (ts : TS) : initial_states :=
match ts with
| trans_sys _ y _ _ _ => y
end.
Definition TRL (ts : TS) : transition_relation :=
match ts with
| trans_sys _ _ z _ _ => z
end.
(*Notation "( x , y , z )" := (trans_sys x y z).*)
(**************** LTL Syntax ****************)
Inductive LTL_exp : Type :=
| TRUE : LTL_exp
| FALSE : LTL_exp
| AP : atom -> LTL_exp
| AND : LTL_exp -> LTL_exp -> LTL_exp
| IMP : LTL_exp -> LTL_exp -> LTL_exp
| OR : LTL_exp -> LTL_exp -> LTL_exp
| NOT : LTL_exp -> LTL_exp
| F : LTL_exp -> LTL_exp
| G : LTL_exp -> LTL_exp
| U : LTL_exp -> LTL_exp -> LTL_exp
| X : LTL_exp -> LTL_exp
| W : LTL_exp -> LTL_exp -> LTL_exp.
(**************** Trace ****************)
(*
a trace can be modeled as a sequence of states. So, it has to show
the order of states. Thus, we can model a Trace as a map from nat to
state.
*)
Definition Trace := nat -> state.
(* returns trace tn...*)
Definition suffix (t : Trace) (n : nat) : Trace := fun i => t (i + n).
Check suffix.
(*
Trace -> nat -> Trace : [suffix returns a Trace]
*)
Axiom functional_extensionality : forall {X Y: Type} {f g : X -> Y},
(forall (x: X), f x = g x) -> f = g.
(* It says:
(fun i : nat => t (i + m + n)) = (fun i : nat => t (i + (m + n))
*)
Theorem plus_assoc_in_trace : forall (t : Trace) (n m : nat),
suffix (suffix t n) m = suffix t (m + n).
Proof.
intros. apply functional_extensionality.
intros. unfold suffix. rewrite plus_assoc.
reflexivity.
Qed.
Theorem subtrace0 : forall (n : nat) (t : Trace),
suffix t n = suffix (suffix t n) 0.
Proof.
intros. apply functional_extensionality.
intros. unfold suffix.
rewrite <- plus_assoc.
rewrite plus_O_n. reflexivity.
Qed.
(* a sub-case of subtrace0 *)
Lemma t0 : forall(t : Trace), (suffix t 0) = t.
Proof.
intros. rewrite subtrace0.
unfold suffix.
apply functional_extensionality.
intros.
repeat (rewrite <- plus_assoc; rewrite <- plus_comm; rewrite plus_O_n).
reflexivity.
Qed.
(***********************************************************************************************************)
(** LTL Semantics **** OPERATORS **)
(***********************************************************************************************************)
Fixpoint LTL_sat (prop : LTL_exp) (t : Trace) :=
match prop with
| TRUE => True
| FALSE => False
| AP ap => (t 0) ap = true
| AND p q => (LTL_sat p t) /\ (LTL_sat q t)
| IMP p q => (LTL_sat p t) -> (LTL_sat q t)
| OR p q => (LTL_sat p t) \/ (LTL_sat q t)
| NOT p => not(LTL_sat p t)
| U p q => exists n, LTL_sat q (suffix t n) /\
(forall (m : nat) (c: m < n), LTL_sat p (suffix t m))
| F p => exists n, LTL_sat p (suffix t n)
| G p => forall (n : nat) , LTL_sat p (suffix t n)
| X p => LTL_sat p (suffix t 1)
| W p q => (exists n, LTL_sat q (suffix t n) /\
(forall (m : nat) (c: m < n), LTL_sat p (suffix t m))) \/
(forall (m : nat), LTL_sat p (suffix t m))
end.
(**********************************************************************************************************)
Axiom not_not : forall (p : LTL_exp) (t : Trace),
~~ LTL_sat p t <-> LTL_sat p t.
Definition state_equiv (apA : Atoms)(sa sc : state) : Prop :=
forall p, apA p -> sa p = sc p.
Definition trace_of_ts (t : Trace) (ts : TS) :=
(exists s, (Init ts) s /\ state_equiv (Ap ts) s (t 0)) /\
(forall (i : nat), exists s s', (TRL ts) s s' /\
state_equiv (Ap ts) s (t i) /\
state_equiv (Ap ts) s' (t (i+1))).
Definition subtrace_of_ts (t : Trace) (ts : TS) (max: nat) :=
(exists s, (Init ts) s /\ state_equiv (Ap ts) s (t 0)) /\
(forall (i : nat), (i <= max) ->
exists s s', (TRL ts) s s' /\
state_equiv (Ap ts) s (t i) /\
state_equiv (Ap ts) s' (t (i+1))).
Theorem s_has_trace : forall T, complete_tr T->
forall s, exists t, t 0 = s /\
forall n, T (t n) (t (S n)).
Proof.
intros.
apply choice in H as [f Hf].
exists (fix p n := match n with
| 0 => s
| S n' => f (p n')
end).
auto.
Qed.
Lemma state_equiv_trans : forall (sa sc s' : state) (apA apC : Atoms),
(forall (p : atom), apA p -> apC p) ->
state_equiv apA sa sc -> state_equiv apC sc s' ->
state_equiv apA sa s'.
Proof.
intros.
unfold state_equiv in H0.
unfold state_equiv in H1.
unfold state_equiv.
intros.
assert (apA p) by assumption.
apply H0 in H2.
apply H in H3.
apply H1 in H3.
rewrite <- H2 in H3.
assumption.
Qed.
Lemma state_equiv_sub : forall (sa sc : state) (apA apC : Atoms),
(forall (p : atom), apA p -> apC p) ->
state_equiv apC sa sc -> state_equiv apA sa sc.
Proof.
intros.
unfold state_equiv in H0.
unfold state_equiv.
intros.
apply H in H1. apply H0 in H1. assumption.
Qed.
Lemma state_equiv_comm : forall (s s' : state) (ap : Atoms),
state_equiv ap s s' <-> state_equiv ap s' s.
Proof.
intros. split; unfold state_equiv; intros;
apply H in H0; rewrite H0; reflexivity.
Qed.
Lemma state_equiv_imp : forall (sa sc s : state) (apA apC : Atoms),
(forall (p : atom), apA p -> apC p) ->
state_equiv apA sa s /\ state_equiv apC sc s ->
state_equiv apA sa sc.
Proof.
intros. unfold state_equiv. intros.
unfold state_equiv in H0. inversion H0. clear H0.
assert (apA p) by assumption.
apply H2 in H1.
apply H in H0. apply H3 in H0. rewrite <- H1 in H0.
symmetry. assumption.
Qed.
Lemma state_equiv_red : forall (sa sc s : state) (apA apC : Atoms),
(forall (p : atom), apA p -> apC p) ->
state_equiv apC sa s /\ state_equiv apC sc s ->
state_equiv apA sa sc.
Proof.
intros.
unfold state_equiv in H0.
unfold state_equiv.
intros.
inversion H0.
apply H in H1.
assert (apC p) by assumption.
apply H2 in H1.
apply H3 in H4. rewrite <- H4 in H1.
assumption.
Qed.
Lemma state_equiv_imp2 : forall (sa sc s : state) (ap : Atoms),
state_equiv ap sa s /\ state_equiv ap sc s ->
state_equiv ap sa sc.
Proof.
unfold state_equiv.
intros. inversion H.
assert (ap p) by apply H0.
apply H1 in H0. apply H2 in H3.
rewrite <- H3 in H0. assumption.
Qed.
(**----------------------------------------------------------------------------------***)
(**
The meaning of the notion that transition system [ts] satisfies
LTL property [p]:
**)
Definition TS_sat_LTLp (prop : LTL_exp)(ts : TS) :=
(forall (trc : Trace), trace_of_ts trc ts -> LTL_sat prop trc).
(*
Definition of Simulation Relations
*)
Definition SR (apA : Atoms)(sa sc : state) := state_equiv apA sa sc.
(*----------------------------------------------*)
(* Make this explicit: this is Strong Simulation *)
Definition Strong_SimRel (TSa TSc : TS) :=
(forall (p : atom), (Ap TSa) p -> (Ap TSc) p) /\
(forall (sc : state), (Init TSc) sc -> exists sa,
(Init TSa) sa /\ SR (Ap TSa) sa sc) /\
(forall (sa sc sc' : state),(SR (Ap TSa) sa sc) /\ (TRL TSc) sc sc' ->
(exists sa', (TRL TSa) sa sa' /\ SR (Ap TSa) sa' sc')).
(*
If [A] simulate5 [C], every trace of [C] has an equivalent
trace in [A].
*)
Lemma trace_inclusion_strong : forall (TSa TSc : TS),
Strong_SimRel TSa TSc ->
(forall (t : Trace), trace_of_ts t TSc ->
trace_of_ts t TSa).
Proof.
intros. destruct TSa as [APa INITa TRa] eqn:A.
destruct TSc as [APc INITc TRc] eqn:C.
unfold trace_of_ts.
unfold trace_of_ts in H0.
inversion H. clear H.
inversion H2. clear H2.
inversion H0.
clear H0. inversion H2. clear H2.
inversion H0.
apply H in H2. inversion H2.
split.
Case "left" .
exists x0. split.
SCase "left".
apply H6.
SCase "right".
apply state_equiv_trans with (sc := x) (apC := APc).
assumption. apply H6. assumption.
Case "right".
intros.
induction i.
SCase "i is O".
exists x0.
assert (exists s s', TRc s s' /\ state_equiv APc s (t 0) /\
state_equiv APc s' (t 1)) by apply H4.
inversion H7. inversion H8; clear H8 H7.
inversion H9. inversion H8; clear H8 H9.
assert (SR APa x0 x1 /\ TRc x1 x2 ->
exists s, TRa x0 s /\ SR APa s x2) by apply H3; clear H3.
assert (TC: TRc x1 x2) by assumption.
inversion H0.
assert (SR APa x0 x1).
SSCase "Proof_of_assertion".
inversion H6.
assert (state_equiv APa x0 (t 0)).
SSSCase "Proof_of_assertion".
apply state_equiv_trans with (apC := APc)
(sa := x0) (sc := x) (s' := (t 0));
assumption.
apply state_equiv_imp with (apC := APc)
(sa := x0) (sc := x1) (s := (t 0)). assumption.
split; assumption.
assert (SR APa x0 x1 /\ TRc x1 x2) by (split; assumption).
apply H8 in H13. clear H8. inversion H13; clear H13.
exists x3. split.
SSCase "left".
apply H8.
SSCase "right".
split.
SSSCase "left".
apply state_equiv_trans with (sa := x0) (apA := APa)
(sc := x1) (s' := (t 0)) (apC := APc) in H10;
try (apply H3 in H9); assumption.
SSSCase "right".
rewrite plus_O_n.
apply state_equiv_imp with (sa := x3) (apA := APa)
(s := x2) (sc := (t 1)) (apC := APc).
assumption. split. apply H8. apply state_equiv_comm. assumption.
SCase "i is S i'".
inversion IHi; inversion H7; clear IHi H7.
inversion H8. inversion H9; clear H9.
exists x2.
assert (exists s s', TRc s s' /\ state_equiv APc s (t (S i)) /\
state_equiv APc s' (t (S i + 1))) by apply H4; clear H4.
inversion H9. inversion H4; clear H9 H4.
inversion H12; clear H12.
assert (SR APa x2 x3 /\ TRc x3 x4 ->
exists s, TRa x2 s /\ SR APa s x4) by apply H3; clear H3.
assert (TCx : TRc x3 x4) by assumption.
assert (SR APa x2 x3).
SSCase "Proof_of_assertion".
inversion H6.
apply state_equiv_imp with (apC := APc)
(sa := x2) (sc := x3) (s := (t (S i))). assumption.
split. replace (S i) with (i + 1). assumption.
apply plus_comm. apply H9.
assert (SR APa x2 x3 /\ TRc x3 x4) by (split; assumption).
apply H12 in H13. clear H12.
inversion H13; clear H13.
exists x5. split.
SSCase "left".
apply H12.
SSCase "right".
split.
SSSCase "left".
replace (S i) with (i + 1); try (apply H7);
rewrite plus_comm.
SSCase "right".
inversion H12.
rewrite plus_comm. apply H11.
reflexivity.
apply state_equiv_trans with (sa := x5) (apA := APa)
(sc := x4) (s' := (t (S i + 1))) (apC := APc);
try (assumption). apply H12. apply H9.
Qed.
(*
if [A] simulates [C],
every LTL properties satisfied by [A] is also satisfied by [C].
*)
Theorem strong_simulation_relations :
forall (prop : LTL_exp)(TSa TSc: TS),
Strong_SimRel TSa TSc ->
TS_sat_LTLp prop TSa ->
TS_sat_LTLp prop TSc.
Proof.
intros.
unfold TS_sat_LTLp. intros.
unfold TS_sat_LTLp in H1.
destruct TSa as [APa INITa TRa] eqn:A.
destruct TSc as [APc INITc TRc] eqn:C.
apply trace_inclusion_strong with (t := trc) in H;
try (assumption).
apply H0; try (assumption).
Qed.
(*----------------------------------------------*)
Definition reachable (s : state) (ts : TS) :=
exists t i, trace_of_ts t ts /\
state_equiv (Ap ts) s (t i).
Fixpoint evenb (n:nat) : bool :=
match n with
| O => true
| S O => false
| S (S n') => evenb n'
end.
Lemma ev_od_tf : forall n, evenb n = true -> evenb (S n) = false.
Proof.
intros. induction n as [| n'].
reflexivity.
destruct (evenb (S (S n'))) eqn: HD.
inversion HD.
assert (HF: evenb n' = true) by apply H1.
apply IHn' in H1. rewrite H in H1. inversion H1.
reflexivity.
Qed.
Lemma ev_od_ft : forall n, evenb n = false -> evenb (S n) = true.
Proof.
intros. induction n as [| n'].
inversion H.
destruct (evenb (S (S n'))) eqn: HD.
inversion HD.
reflexivity.
simpl in HD.
assert (HF: evenb n' = false) by apply HD.
apply IHn' in HF. rewrite H in HF. inversion HF.
Qed.
Lemma trace_is_subtrace : forall t s ts i,
trace_of_ts t ts ->
state_equiv (Ap ts) s (t i) ->
subtrace_of_ts t ts i.
Proof.
intros.
unfold subtrace_of_ts.
split.
apply H.
intros.
apply H.
Qed.
Lemma le_ble_nat : forall n m,
n <= m ->
ble_nat n m = true.
Proof.
intros.
generalize dependent n.
induction m.
Case "m is O".
intros.
inversion H. reflexivity.
Case "m is S m'".
destruct n.
SCase "n is O".
reflexivity.
SCase "n is S n'".
simpl. intros.
inversion H.
assert (m <= m -> ble_nat m m = true) by apply IHm.
apply H0. rewrite -> H1 in H.
omega.
assert (n <= m -> ble_nat n m = true) by apply IHm.
apply H2. omega.
Qed.
Theorem le_ble_nat2 : forall n m,
(n > m) -> ble_nat n m = false.
Proof.
intros.
generalize dependent n.
induction m.
Case "m is O".
intros.
inversion H. reflexivity.
reflexivity.
Case "m is S m'".
destruct n.
SCase "n is O".
intros. inversion H.
SCase "n is S n'".
simpl. intros.
simpl in H. apply gt_S_n in H.
apply IHm. assumption.
Qed.
Lemma map_trace : forall t t' ts max,
subtrace_of_ts t ts max ->
state_equiv (Ap ts) (t' 0) (t max) ->
(forall n, exists x x', (TRL ts) x x' /\
state_equiv (Ap ts) x (t' n) /\
state_equiv (Ap ts) x' (t' (S n))) ->
exists T, trace_of_ts T ts /\
forall j, j <= max -> t j = T j /\
forall k, k > max -> t' (k - max) = T k.
Proof.
intros.
destruct ts as [ap ini tr] eqn:tsd.
exists (fun n : nat => match n with
| 0 => t n
| S n' => match ble_nat n max with
| true => t n
| false => t' (n - max)
end
end).
unfold subtrace_of_ts in H.
split.
Case "left".
unfold trace_of_ts. simpl. split.
SCase "left".
apply H.
SCase "right".
induction H.
generalize dependent max.
induction i as [ |i'].
SSCase "i is O".
simpl in H1.
simpl. destruct max.
SSSCase "left".
assert (exists x x', tr x x' /\ state_equiv ap x (t' 0) /\
state_equiv ap x' (t' 1)) by apply H1.
repeat (induction H3).
exists x. exists x0.
split. apply H3. split.
apply state_equiv_imp2 with (s := (t' 0)).
split. apply H4.
apply state_equiv_comm. assumption. apply H4.
SSSCase "right".
simpl in H2.
apply H2. omega.
SSCase "i is S i'".
simpl. destruct max eqn:M; simpl in IHi'.
SSSCase "left".
replace (i' + 1) with (S i').
apply H1. omega.
SSSCase "right".
destruct (ble_nat i' n) eqn:Heq1.
destruct (ble_nat (i' + 1) n) eqn:Heq2.
SSSSCase "both if are ture".
apply ble_nat_true in Heq1.
apply H2. omega.
SSSSCase "true&false".
apply ble_nat_true in Heq1.
apply ble_nat_false in Heq2.
unfold not in Heq2.
destruct i' eqn: I'. simpl in IHi'.
assert (n = 0). omega.
rewrite H3. simpl.
rewrite H3 in H0.
assert (exists x x', tr x x' /\ state_equiv ap x (t' 0) /\
state_equiv ap x' (t' 1)) by apply H1.
repeat (induction H4).
exists x. exists x0.
split. apply H4. split.
apply state_equiv_imp2 with (s := (t' 0)).
split. apply H5.
apply state_equiv_comm. assumption. apply H5.
assert (n0 <= n). omega.
assert (n0 + 1 <= n). omega.
subst. assert (S n0 +1 - n = 1). omega.
assert (S (S n0) = S n). omega.
rewrite H5. rewrite H6.
assert (exists x x', tr x x' /\ state_equiv ap x (t' 0) /\
state_equiv ap x' (t' 1)) by apply H1.
repeat (induction H7).
exists x. exists x0.
split. apply H7. split.
apply state_equiv_imp2 with (s := (t' 0)).
split. apply H8.
apply state_equiv_comm. assumption. apply H8.
destruct (ble_nat (i' + 1) n) eqn:Heq2.
SSSSCase "false&true".
apply ble_nat_false in Heq1.
apply ble_nat_true in Heq2.
unfold not in Heq1.
assert (i' > n). omega.
rewrite plus_comm in Heq2.
simpl in Heq2.
assert (False). apply Heq1. omega.
inversion H4.
SSSSCase "false&false".
replace (i' + 1 - n) with (S (i' - n)).
apply H1. rewrite plus_comm.
rewrite minus_Sn_m. reflexivity.
apply ble_nat_false in Heq1.
apply ble_nat_false in Heq2.
apply NPeano.Nat.nlt_ge. omega.
SCase "left".
split. destruct j. reflexivity.
replace (ble_nat (S j) max) with true. reflexivity.
symmetry.
apply le_ble_nat. assumption.
intros.
assert (k > O). omega. simpl.
inversion H4. simpl.
assert (max = O). omega. inversion H6. reflexivity.
replace (ble_nat (S m) max) with false. reflexivity.
symmetry. apply le_ble_nat2. omega.
Qed.
Lemma extend_subtrace : forall t ts max,
subtrace_of_ts t ts max ->
exists t', trace_of_ts t' ts /\
forall j, j <= max -> t j = t' j.
Proof.
intros.
destruct ts as [ap ini tr] eqn:tsd.
assert (Hc: complete_tr tr) by apply c.
apply s_has_trace with (s := (t max)) in Hc.
inversion Hc.
exists (fun n : nat => match n with
| 0 => t n
| S n' => match ble_nat n max with
| true => t n
| false => x (n - max)
end
end).
unfold subtrace_of_ts in H.
split.
Case "left".
unfold trace_of_ts. simpl. split.
SCase "left".
apply H.
SCase "right".
induction H.
generalize dependent max.
induction i as [ |i'].
SSCase "i is O".
simpl in H1.
simpl. destruct max.
SSSCase "left".
induction H0. rewrite <- H0.
exists (x 0). exists (x 1).
split. apply H2.
unfold state_equiv; split; reflexivity.
SSSCase "right".
apply H1. apply le_O_n.
SSCase "i is S i'".
simpl. destruct max eqn:M; simpl in IHi'.
SSSCase "left".
exists (x (S i')). exists (x (S (i' + 1))).
split.
replace (i' + 1) with (S i'). apply H0.
rewrite plus_comm. reflexivity.
unfold state_equiv; split; reflexivity.
SSSCase "right".
destruct (ble_nat i' n) eqn:Heq1.
destruct (ble_nat (i' + 1) n) eqn:Heq2.
SSSSCase "both if are ture".
apply ble_nat_true in Heq1.
apply H1. omega.
SSSSCase "true&false".
apply ble_nat_true in Heq1.
apply ble_nat_false in Heq2.
unfold not in Heq2.
destruct i' eqn: I'. simpl in IHi'.
assert (n = 0). omega.
rewrite H2. simpl.
rewrite H2 in H0. induction H0. rewrite <- H0.
exists (x 0). exists (x 1).
split. apply H3.
unfold state_equiv; split; reflexivity.
assert (n0 <= n). omega.
assert (n0 + 1 <= n). omega.
subst. assert (S n0 +1 - n = 1). omega.
assert (S (S n0) = S n). omega.
rewrite H5. rewrite H4.
induction H0. rewrite <- H0.
exists (x 0). exists (x 1).
split. apply H6.
unfold state_equiv; split; reflexivity.
destruct (ble_nat (i' + 1) n) eqn:Heq2.
SSSSCase "false&true".
apply ble_nat_false in Heq1.
apply ble_nat_true in Heq2.
unfold not in Heq1.
assert (i' > n). omega.
rewrite plus_comm in Heq2.
simpl in Heq2.
assert (False). apply Heq1. omega.
inversion H3.
SSSSCase "false&false".
exists (x (i' -n)). exists (x (i' + 1 - n)).
split.
replace (i' +1 - n) with (S (i' - n)).
apply H0.
rewrite plus_comm.
rewrite minus_Sn_m. reflexivity.
apply ble_nat_false in Heq1.
apply ble_nat_false in Heq2.
apply NPeano.Nat.nlt_ge. omega.
unfold state_equiv; split; intros; reflexivity.
SCase "left".
intros.
destruct j as [| j']. reflexivity.
replace (ble_nat (S j') max) with true. reflexivity.
symmetry.
apply le_ble_nat. assumption.
Qed.
Lemma s_s'_has_trace : forall s s' tr ap,
complete_tr tr /\ tr s s' ->
(exists (t : Trace),
state_equiv ap s (t 0) /\ state_equiv ap s' (t 1) /\
forall k, exists x x', tr x x' /\
state_equiv ap x (t k) /\ state_equiv ap x' (t (S k))).
Proof.
intros. induction H.
apply choice in H as [f Hf].
exists (fix p n := match n with
| 0 => s
| 1 => s'
| S n' => f (p n')
end).
split.
unfold state_equiv; reflexivity. split.
unfold state_equiv; reflexivity.
destruct k as [| k'].
exists s. exists s'.
split.
apply H0.
split; unfold state_equiv; reflexivity.
simpl.
exists (match k' with
| 0 => s'
| S _ =>
f ((fix p (n0 : nat) : state :=
match n0 with
| 0 => s
| 1 => s'
| S (S _ as n') => f (p n')
end) k')
end).
exists (f (match k' with
| 0 => s'
| S _ =>
f ((fix p (n0 : nat) : state :=
match n0 with
| 0 => s
| 1 => s'
| S (S _ as n') => f (p n')
end) k')
end)).
split. apply Hf.
split; unfold state_equiv; reflexivity.
Qed.
Lemma tr_reachable : forall (ts : TS) (s s': state),
reachable s ts /\ (TRL ts) s s'
-> reachable s' ts .
Proof.
intros.
assert (Hh: reachable s ts /\ (TRL ts) s s') by apply H.
induction H.
induction H. induction H. induction H.
destruct ts as [ap ini tr] eqn:tsd.
assert (Hc: complete_tr tr) by apply c.
apply trace_is_subtrace with (i := x0) (s := (x x0)) in H.
assert (complete_tr tr /\ tr s s'). split; assumption.
apply s_s'_has_trace with (s := s) (s' := s') (ap := ap) in H2.
induction H2.
apply map_trace with (t' := x1) (max := x0) in H.
unfold reachable.
induction H. induction H. exists x2. exists (S x0).
split. assumption.
induction H3 with (j := x0).
assert ((x1 1) = (x2 (S x0))).
replace 1 with (S x0 - x0).
apply H5. omega. omega.
rewrite <- H6.
unfold state_equiv. intros.
induction H2.
induction H8. rewrite H8. reflexivity.
assumption. reflexivity.
apply state_equiv_imp with (s := s) (apC := ap).
intros. assumption.
split; apply state_equiv_comm. apply H2. assumption.
apply H2.
unfold state_equiv; reflexivity.
Qed.
Lemma all_trace_states_reachable :
(forall (t: Trace) (ts: TS) i, trace_of_ts t ts -> (reachable (t i) ts)) .
Proof.
intros. unfold reachable.
exists t. exists i.
split. assumption.
unfold state_equiv. intros. reflexivity.
Qed.
(* Here is the definition: note that we don't need to bring in the reachability of the
post states in the consequent, because we can immediately derive this using trans_reachable.
I think this definition should not present any substantial difficulty in the trace
inclusion statement, because of the lemma all_trace_states_reachable.
*)
Definition Weak_SimRel (TSa TSc : TS) :=
(forall (p : atom), (Ap TSa) p -> (Ap TSc) p) /\
(forall (sc : state), (Init TSc) sc -> exists sa,
(Init TSa) sa /\ SR (Ap TSa) sa sc) /\
(forall (sa sc sc' : state),
(reachable sc TSc /\ (SR (Ap TSa) sa sc)
/\ (TRL TSc) sc sc' ->
(exists sa', (TRL TSa) sa sa' /\
SR (Ap TSa) sa' sc'))).
Lemma trace_inclusion_weak : forall (TSa TSc : TS),
Weak_SimRel TSa TSc ->
(forall (t : Trace), trace_of_ts t TSc ->
trace_of_ts t TSa).
Proof.
intros.
unfold trace_of_ts.
inversion H0.
induction H.
destruct TSa as [APa Ia TRa] eqn:tsd.
destruct TSc as [APc Ic TRc] eqn:tsd'.
simpl.
simpl in H3. induction H3.
split.
Case "left".
induction H1. simpl in H1. induction H1.
apply H3 in H1. induction H1.
exists x0. split. apply H1.
apply state_equiv_trans with (sc := x) (apC := APc).
assumption. apply H1. apply H5.
Case "right".
induction i.
SCase "i is O".
simpl in H2.
assert (exists s s', TRc s s' /\ state_equiv APc s (t 0) /\
state_equiv APc s' (t 1)) by apply H2. clear H2.
induction H5. induction H2.
assert (reachable x TSc).
SSCase "Proof_of_assertion".
unfold reachable.
exists t. exists 0. split;
rewrite tsd'. apply H0.
simpl. apply H2.
induction H1. simpl in H1.
induction H1. apply H3 in H1.
induction H1.
assert (SR APa x2 x).
SSCase "Proof_of_assertion".
unfold SR.
assert (state_equiv APa x2 (t 0)).
SSSCase "Proof_of_assertion".
induction H1.
unfold SR in H7.
apply state_equiv_trans with (sa := x2) (s' := (t 0)) (sc := x1) (apC := APc);
assumption.
induction H2. induction H8.
apply state_equiv_imp with (sa := x2) (sc := x) (s := (t 0)) (apC := APc).
assumption. split; assumption.
rewrite <- tsd' in H4.
assert (reachable x TSc /\ SR APa x2 x /\ TRc x x0).
split. assumption. split. assumption. apply H2.
apply H4 in H8.
induction H8.
exists x2. exists x3.
split. apply H8.
induction H2. induction H9.
split.
apply state_equiv_trans with (sa := x2) (sc := x1) (s' := (t 0)) (apC := APc).
assumption. apply H1. assumption.
simpl.
apply state_equiv_trans with (sa := x3) (sc := x0) (s' := (t 1)) (apC := APc).
assumption. apply H8. assumption.
SCase "i is S i".
induction IHi. induction H5.
inversion H5. induction H7.
exists x0.
assert (exists s s', TRc s s' /\ state_equiv APc s (t (S i)) /\
state_equiv APc s' (t (S i + 1))) by apply H2; clear H2.
induction H9. induction H2. induction H2.
assert (reachable x1 TSc).
SSCase "Proof_of_assertion".
unfold reachable.
exists t. exists (S i). split;
rewrite tsd'. apply H0.
simpl. apply H9.
rewrite <- tsd' in H4.
assert (reachable x1 TSc /\ SR APa x0 x1 /\ TRc x1 x2 ->
exists s, TRa x0 s /\ SR APa s x2) by apply H4.
induction H11.
exists x3.
split. apply H11.
split. replace (S i) with (i + 1). apply H8. omega.
induction H11.
unfold SR in H12.
apply state_equiv_trans with (sa := x3) (sc := x2) (s' := t (S i + 1)) (apC := APc).
assumption. assumption. apply H9.
split. assumption. split.
unfold SR.
apply state_equiv_imp with (sa := x0) (sc := x1) (s := t (S i)) (apC := APc).
assumption.
split. replace (S i) with (i + 1). assumption. omega.
apply H9. assumption.
Qed.
Lemma mapping_to_reachable_states :
forall TSa TSc, Weak_SimRel TSa TSc ->
forall s, reachable s TSc ->
forall x, SR (Ap TSa) x s ->
reachable x TSa.
Proof.
intros.
unfold reachable.
assert (W : Weak_SimRel TSa TSc) by apply H.
induction H.
induction H0.
induction H0.
exists x0. exists x1.
split.
apply trace_inclusion_weak with (TSc := TSc).
assumption. apply H0.
apply state_equiv_trans with (sa := x) (sc := s) (s' := (x0 x1)) (apC := (Ap TSc)).
assumption. assumption. apply H0.
Theorem weak_simulation_relations :
forall (prop : LTL_exp)(TSa TSc: TS),
Weak_SimRel TSa TSc ->
TS_sat_LTLp prop TSa ->
TS_sat_LTLp prop TSc.
Proof.
intros.
unfold TS_sat_LTLp. intros.
unfold TS_sat_LTLp in H1.
destruct TSa as [APa INITa TRa] eqn:A.
destruct TSc as [APc INITc TRc] eqn:C.
apply trace_inclusion_weak with (t := trc) in H;
try (assumption).
apply H0; try (assumption).
Qed.
|
{- Category of sets -}
module CategoryTheory.Instances.Sets where
open import CategoryTheory.Categories
open import CategoryTheory.BCCCs
import Function as F using (_β_)
open import Data.Unit using () renaming (β€ to top) public
open import Data.Product public
open import Data.Empty using (β₯-elim) renaming (β₯ to bot) public
open import Data.Sum
-- Category of sets.
πet : Category lzero
πet = record
{ obj = Set
; _~>_ = Ξ» a b -> (a -> b)
; id = Ξ» a -> a
; _β_ = Ξ» g f a -> g (f a)
; _β_ = Ξ» f g -> β {a} -> f a β‘ g a
; id-left = refl
; id-right = refl
; β-assoc = refl
; β-equiv = record { refl = refl
; sym = Ξ» p β sym p
; trans = Ξ» p q β trans p q }
; β-cong = β-cong-π
}
where
β-cong-π : β{A B C : Set} {f fβ² : A -> B} {g gβ² : B -> C}
-> (β {a} -> f a β‘ fβ² a)
-> (β {b} -> g b β‘ gβ² b)
-> (β {a} -> g (f a) β‘ gβ² (fβ² a))
β-cong-π {fβ² = fβ²} fe ge {aβ²} rewrite fe {aβ²} | ge {fβ² aβ²} = refl
-- Bicartesian closed structure
πet-BCCC : BicartesianClosed πet
πet-BCCC = record
{ cart = record
{ term = record
{ β€ = top
; ! = Ξ» {A} _ β top.tt
; !-unique = Ξ» m β refl
}
; prod = Ξ» A B β record
{ AβB = A Γ B
; Οβ = projβ
; Οβ = projβ
; β¨_,_β© = <_,_>
; Οβ-comm = refl
; Οβ-comm = refl
; β-unique = Ξ» pr1 pr2 β unique-cart (ext Ξ» x β pr1 {x}) (ext Ξ» x β pr2 {x})
}
}
; cocart = record
{ init = record
{ β₯ = bot
; Β‘ = β₯-elim
; Β‘-unique = Ξ» {A} m β Ξ» {}
}
; sum = Ξ» A B β record
{ AβB = A β B
; ΞΉβ = injβ
; ΞΉβ = injβ
; [_β_] = [_,_]
; ΞΉβ-comm = Ξ» {S} {iβ} {iβ} {a} β refl
; ΞΉβ-comm = Ξ» {S} {iβ} {iβ} {a} β refl
; β-unique = Ξ» {S} {iβ} {iβ} {m} pr1 pr2
-> unique-cocart {m = m} (ext Ξ» x β pr1 {x}) (ext Ξ» x β pr2 {x})
}
}
; closed = record
{ exp = Ξ» A B β record
{ AβB = A -> B
; eval = Ξ» fa β projβ fa (projβ fa)
; Ξ = Ξ» f a b β f (a , b)
; Ξ-comm = refl
; Ξ-unique = Ξ» pr β Ξ» {a} -> unique-closed (ext Ξ» x β pr {x})
; Ξ-cong = Ξ» pr β ext (Ξ» _ β pr)
}
}
}
where
unique-cart : β{A B P : Set}{a}
-> {pβ : P -> A} {pβ : P -> B} {m : P -> A Γ B}
-> projβ F.β m β‘ pβ -> projβ F.β m β‘ pβ
-> < pβ , pβ > a β‘ m a
unique-cart refl refl = refl
unique-cocart : β{A B S : Set}{a}
-> {iβ : A -> S} {iβ : B -> S} {m : A β B -> S}
-> m F.β injβ β‘ iβ -> m F.β injβ β‘ iβ
-> [ iβ , iβ ] a β‘ m a
unique-cocart {a = injβ x} refl refl = refl
unique-cocart {a = injβ y} refl refl = refl
open Category πet
unique-closed : β{A B E : Set}{a}
-> {e : E Γ A -> B} {m : E -> (A -> B)}
-> (Ξ» fa β projβ fa (projβ fa)) β < m β projβ , projβ > β‘ e
-> (Ξ» b β e (a , b)) β‘ m a
unique-closed refl = refl
|
Formal statement is: lemma Im_i_times [simp]: "Im (\<i> * z) = Re z" Informal statement is: The imaginary part of $\iota z$ is equal to the real part of $z$. |
Random.seed!(1)
const d = 2
const Point = SArray{Tuple{d},Float32,1,d}
using Makie
T = (0:0.001f0:2)[2:end]
n = 200
Ο = 0.01f0
ΞΌ = 0.2f0
a = 4*0.8f0
b = 4*0.15f0
B = sparse((-ΞΌ - a + b)*I, n, n)
B1 = sparse(-1f0*I, n, n)
B2 = sparse(1f0*I, n, n)
for i in 1:n
k1 = rand(1:n-1)
k1 += (i <= k1)
k2 = rand(1:n-2)
k2 += (min(i, k1) <= k2)
k2 += (max(i, k1) <= k2)
@assert i β k1
@assert i β k2
@assert k1 β k2
B[i, k1] = a
B[i, k2] = -b
B1[i,k1] = 1
B2[i, k2] = -1
end
#x0 = 0.1*randn(Point, n)
x = copy(x0)
xs = [x]
ts = [0.0]
t = 0.0
xp = Node(x)
r = .5
p1 = scatter(xp, markersize=3, color=1:n)
xlims!( -r, r)
ylims!( -r, r)
display(p1)
nlz(x) = x/norm(x)
for i in eachindex(T)
global t, x, xs
local dt = T[i] - t
@assert dt > 0
x = x + (B*x)*dt + Ο*sqrt(dt)*randn(Point, n)
xp[] = x
t = T[i]
yield()
sleep(0.0001)
push!(ts, t)
push!(xs, copy(x))
end
error("stop")
p1 = scatter(xp, markersize=3, color=1:n)
xlims!( -r, r)
ylims!( -r, r)
using Base.Iterators: take
framerate=30
record(p1, "boids_animation.mp4", 1:200; framerate = framerate) do i
xp[] = xs[i*10]
end
|
lemma trivial_limit_at_infinity: "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,perfect_space}) filter)" |
# # Linear regression
# We estimate simple linear regression model with a half-T prior.
# First, we load the packages we use.
using TransformVariables, LogDensityProblems, DynamicHMC, MCMCDiagnostics,
Parameters, Statistics, Distributions
# Then define a structure to hold the data: observables, covariates, and the degrees of freedom for the prior.
"""
Linear regression model ``y βΌ XΞ² + Ο΅``, where ``Ο΅ βΌ N(0, ΟΒ²)`` IID.
Flat prior for `Ξ²`, half-T for `Ο`.
"""
struct LinearRegressionProblem{TY <: AbstractVector, TX <: AbstractMatrix,
TΞ½ <: Real}
"Observations."
y::TY
"Covariates"
X::TX
"Degrees of freedom for prior."
Ξ½::TΞ½
end
# Then make the type callable with the parameters *as a single argument*.
function (problem::LinearRegressionProblem)(ΞΈ)
@unpack y, X, Ξ½ = problem # extract the data
@unpack Ξ², Ο = ΞΈ # works on the named tuple too
loglikelihood(Normal(0, Ο), y .- X*Ξ²) + logpdf(TDist(Ξ½), Ο)
end
# We should test this, also, this would be a good place to benchmark and
# optimize more complicated problems.
N = 100
X = hcat(ones(N), randn(N, 2));
Ξ² = [1.0, 2.0, -1.0]
Ο = 0.5
y = X*Ξ² .+ randn(N) .* Ο;
p = LinearRegressionProblem(y, X, 1.0);
p((Ξ² = Ξ², Ο = Ο))
# For this problem, we write a function to return the transformation (as it varies with the number of covariates).
problem_transformation(p::LinearRegressionProblem) =
as((Ξ² = as(Array, size(p.X, 2)), Ο = asββ))
# Wrap the problem with a transformation, then use Flux for the gradient.
P = TransformedLogDensity(problem_transformation(p), p)
βP = FluxGradientLogDensity(P);
# Finally, we sample from the posterior. `chain` holds the chain (positions and
# diagnostic information), while the second returned value is the tuned sampler
# which would allow continuation of sampling.
chain, NUTS_tuned = NUTS_init_tune_mcmc(βP, 1000);
# We use the transformation to obtain the posterior from the chain.
posterior = transform.(Ref(βP.transformation), get_position.(chain));
# Extract the parameter posterior means: `Ξ²`,
posterior_Ξ² = mean(first, posterior)
# then `Ο`:
posterior_Ο = mean(last, posterior)
# Effective sample sizes (of untransformed draws)
ess = mapslices(effective_sample_size,
get_position_matrix(chain); dims = 1)
# NUTS-specific statistics
NUTS_statistics(chain)
|
module Data.String.Extra
%access public export
parseInteger : List Char -> Integer -> Maybe Integer
parseInteger [] acc = Just acc
parseInteger (c :: cs) acc =
if (c >= '0' && c <= '9')
then parseInteger cs ((acc * 10) + (cast ((ord c) - (ord '0'))))
else Nothing
|
The sequence of floors of the natural numbers converges to infinity. |
Any fan of Downton Abbey will be familiar with the unmistakeable faΓ§ade and stunning interiors of Highclere Castle, which plays the role of the imposing family home of Lord and Lady Grantham at the centre of the fictional Downton Abbey estate in the Yorkshire Dales.
Highclere takes its name from the village and civil parish it's located in, some 90km south-west of London in the county of Hampshire. The house and its grounds have a long and illustrious history stretching back several centuries. The first recorded structure on the site of the present house was a mediaeval palace belonging to the original owners of the parish, the Bishops of Winchester (thought to be the reason Julian Fellowes included "Abbey" in the fictional name of the estate).The estate passed into Crown hands in the 16th century when Henry VIII appropriated the land from the Catholic Church.
The Attorney General for England and Wales, Sir Robert Sawyer, owned Highclere in the late 17th century and on his death in 1692 he bequeathed the property to his son-in-law, Thomas Herbert, the 8th Earl of Pembroke (who was married to Sawyer's only child, Margaret, pictured left), and the estate has remained in the Herbert family ever since.
On the death of Robert Herbert in 1769 the estate passed to his nephew, Henry (pictured below Margaret Sawyer). Henry was made 1st Earl of Carnarvon (in the title's 3rd creation) by George III in 1793, which marked the beginning of the association between the Carnarvons and Highclere.
The house that we see on Downton Abbey today was built between 1839 and 1842 when the 3rd Earl of Carnarvon resided at Highclere. The architect was Sir Charles Barry, whose most famous work is London's Houses of Parliament. Sir Charles Barry also designed country estate, Clivedon, made infamous in the 1960's by the Profumo affair. The original house is pictured below, to the left of images of Westminster Palace and Clivedon.
Highclere remains the private estate of the Carnarvon family, whose current owners open the home to the public over the Easter long weekend and during the summer months, and it is these visitors that help support the upkeep of one of Britain's finest buildings.
The 5,000 acre Highclere estate is 5 times the size of New York's Central Park and the house itself is the largest mansion in Hampshire.
It makes Australia's most expensive home at $57,500,000 seem a bargain (the Saunders Street Mansion in Perth).
The number of rooms in Highclere has been estimated by the current owners to be between 250 and 300. Around 50 of the rooms on the upper floors remain unusable (I wonder what secrets lie behind those locked doors!).
The system of bells depicted in the television series would have had a different tone for each room, enabling the servants to know who was calling wherever they were "downstairs".
At the height of its Edwardian splendour some 80 staff were employed at the estate. This figure is close to today's number of employees, although the majority now work on ensuring tourists visiting Highclere are well looked after.
In 1914 Highclere was converted into a hospital for wounded soldiers by the 5th Countess of Carnarvon (Lady Almina, pictured below the image of Highclere taken during WWI). The home contained a fully functioning operating theatre, even more impressive than the convalescent home depicted in Season 2 of Downton Abbey.
Speaking of Lady Almina, she was married to the 5th Earl of Carnarvon in 1895. At the time the Earl was deeply in debt and it was rumoured the marriage was one of convenience; Almina came with a Β£500,000 dowry (AU$45,000,000 in today's money), while Almina gained a title; strangely reminiscent of Lord and Lady Grantham's early marriage stories in Downton Abbey.
The current Lady Carnarvon believes Highclere is haunted by numerous ghosts, and claims to have seen the ghost of a footman who committed suicide at the house in the Victorian era. Not surprisingly, actress Shirley MacLaine who plays Lady Grantham's mother Martha Levinson in Downton Abbey is also on record as saying the home is haunted.
Downton Abbey is not the first time Highclere has been used as a location set. It also features in the films The Secret Garden (1987), Stanley Kubrick's controversial final film Eyes Wide Shut (a scene set in the familiar Saloon is pictured below left), and in the 2010 adaptation of Pride and Prejudice.
Visitor numbers to Highclere are strictly controlled, and group visits are fully booked out this year and in 2015. However Golden Compass has secured access to the home and grounds as part of its 18 night "Britain's Downton Era" program next year, and with Golden Compass receiving timed entry to the house there will be no waiting in line for our participants.
We have also created a YouTube channel where you can watch some short films on the History of Highclere, including interviews with the present Lady Carnarvon about the house and Lady Almina. Access the films here.
Find out about our 19 day tour of Britain's Downton Era departing August 2015. One highlight of the program is a guided tour of Highclere, which is already fully booked for group visits in both 2014 and 2015.
Visit Get Up & Go magazine for your chance to win two places on this unique tour !
Keep visiting our blog to read more stories about "Britain's Downton Era".
Next: The devastating impact of the Great War on the British Aristocracy. |
The Bulls advanced to the NBA Finals for the first time in franchise history to face Magic Johnson and James Worthy and beat the Los Angeles Lakers four games to one , compiling an outstanding 15 β 2 playoff record along the way . Perhaps the best known moment of the series came in Game 2 when , attempting a dunk , Jordan avoided a potential Sam Perkins block by switching the ball from his right hand to his left in mid @-@ air to lay the shot in . In his first Finals appearance , Jordan posted per game averages of 31 @.@ 2 points on 56 % shooting from the field , 11 @.@ 4 assists , 6 @.@ 6 rebounds , 2 @.@ 8 steals and 1 @.@ 4 blocks . Jordan won his first NBA Finals MVP award , and he cried while holding the NBA Finals trophy .
|
/-
Copyright (c) 2019 Seul Baek. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Seul Baek
-/
/-
Linear natural number arithmetic preformulas in pre-normalized preform.
-/
import tactic.omega.nat.preterm
namespace omega
namespace nat
/-- Intermediate shadow syntax for LNA formulas that includes unreified exprs -/
meta inductive exprform
| eq : exprterm β exprterm β exprform
| le : exprterm β exprterm β exprform
| not : exprform β exprform
| or : exprform β exprform β exprform
| and : exprform β exprform β exprform
/-- Intermediate shadow syntax for LNA formulas that includes non-canonical terms -/
@[derive has_reflect, derive inhabited]
inductive preform
| eq : preterm β preterm β preform
| le : preterm β preterm β preform
| not : preform β preform
| or : preform β preform β preform
| and : preform β preform β preform
localized "notation (name := preform.eq) x ` =* ` y := omega.nat.preform.eq x y" in omega.nat
localized "notation (name := preform.le) x ` β€* ` y := omega.nat.preform.le x y" in omega.nat
localized "notation (name := preform.not) `Β¬* ` p := omega.nat.preform.not p" in omega.nat
localized "notation (name := preform.or) p ` β¨* ` q := omega.nat.preform.or p q" in omega.nat
localized "notation (name := preform.and) p ` β§* ` q := omega.nat.preform.and p q" in omega.nat
namespace preform
/-- Evaluate a preform into prop using the valuation `v`. -/
@[simp] def holds (v : nat β nat) : preform β Prop
| (t =* s) := t.val v = s.val v
| (t β€* s) := t.val v β€ s.val v
| (Β¬* p) := Β¬ p.holds
| (p β¨* q) := p.holds β¨ q.holds
| (p β§* q) := p.holds β§ q.holds
end preform
/-- `univ_close p n` := `p` closed by prepending `n` universal quantifiers -/
@[simp] def univ_close (p : preform) : (nat β nat) β nat β Prop
| v 0 := p.holds v
| v (k+1) := β i : nat, univ_close (update_zero i v) k
namespace preform
/-- Argument is free of negations -/
def neg_free : preform β Prop
| (t =* s) := true
| (t β€* s) := true
| (p β¨* q) := neg_free p β§ neg_free q
| (p β§* q) := neg_free p β§ neg_free q
| _ := false
/-- Return expr of proof that argument is free of subtractions -/
def sub_free : preform β Prop
| (t =* s) := t.sub_free β§ s.sub_free
| (t β€* s) := t.sub_free β§ s.sub_free
| (Β¬* p) := p.sub_free
| (p β¨* q) := p.sub_free β§ q.sub_free
| (p β§* q) := p.sub_free β§ q.sub_free
/-- Fresh de Brujin index not used by any variable in argument -/
def fresh_index : preform β nat
| (t =* s) := max t.fresh_index s.fresh_index
| (t β€* s) := max t.fresh_index s.fresh_index
| (Β¬* p) := p.fresh_index
| (p β¨* q) := max p.fresh_index q.fresh_index
| (p β§* q) := max p.fresh_index q.fresh_index
lemma holds_constant {v w : nat β nat} :
β p : preform,
( (β x < p.fresh_index, v x = w x) β
(p.holds v β p.holds w) )
| (t =* s) h1 :=
begin
simp only [holds],
apply pred_mono_2;
apply preterm.val_constant;
intros x h2; apply h1 _ (lt_of_lt_of_le h2 _),
apply le_max_left, apply le_max_right
end
| (t β€* s) h1 :=
begin
simp only [holds],
apply pred_mono_2;
apply preterm.val_constant;
intros x h2; apply h1 _ (lt_of_lt_of_le h2 _),
apply le_max_left, apply le_max_right
end
| (Β¬* p) h1 :=
begin
apply not_iff_not_of_iff,
apply holds_constant p h1
end
| (p β¨* q) h1 :=
begin
simp only [holds],
apply pred_mono_2';
apply holds_constant;
intros x h2; apply h1 _ (lt_of_lt_of_le h2 _),
apply le_max_left, apply le_max_right
end
| (p β§* q) h1 :=
begin
simp only [holds],
apply pred_mono_2';
apply holds_constant;
intros x h2; apply h1 _ (lt_of_lt_of_le h2 _),
apply le_max_left, apply le_max_right
end
/-- All valuations satisfy argument -/
def valid (p : preform) : Prop :=
β v, holds v p
/-- There exists some valuation that satisfies argument -/
def sat (p : preform) : Prop :=
β v, holds v p
/-- `implies p q` := under any valuation, `q` holds if `p` holds -/
def implies (p q : preform) : Prop :=
β v, (holds v p β holds v q)
/-- `equiv p q` := under any valuation, `p` holds iff `q` holds -/
def equiv (p q : preform) : Prop :=
β v, (holds v p β holds v q)
lemma sat_of_implies_of_sat {p q : preform} :
implies p q β sat p β sat q :=
begin intros h1 h2, apply exists_imp_exists h1 h2 end
lemma sat_or {p q : preform} :
sat (p β¨* q) β sat p β¨ sat q :=
begin
constructor; intro h1,
{ cases h1 with v h1, cases h1 with h1 h1;
[left,right]; refine β¨v,_β©; assumption },
{ cases h1 with h1 h1; cases h1 with v h1;
refine β¨v,_β©; [left,right]; assumption }
end
/-- There does not exist any valuation that satisfies argument -/
def unsat (p : preform) : Prop := Β¬ sat p
def repr : preform β string
| (t =* s) := "(" ++ t.repr ++ " = " ++ s.repr ++ ")"
| (t β€* s) := "(" ++ t.repr ++ " β€ " ++ s.repr ++ ")"
| (Β¬* p) := "Β¬" ++ p.repr
| (p β¨* q) := "(" ++ p.repr ++ " β¨ " ++ q.repr ++ ")"
| (p β§* q) := "(" ++ p.repr ++ " β§ " ++ q.repr ++ ")"
instance has_repr : has_repr preform := β¨reprβ©
meta instance has_to_format : has_to_format preform := β¨Ξ» x, x.reprβ©
end preform
lemma univ_close_of_valid {p : preform} :
β {m : nat} {v : nat β nat}, p.valid β univ_close p v m
| 0 v h1 := h1 _
| (m+1) v h1 := Ξ» i, univ_close_of_valid h1
lemma valid_of_unsat_not {p : preform} : (Β¬*p).unsat β p.valid :=
begin
simp only [preform.sat, preform.unsat, preform.valid, preform.holds],
rw not_exists_not, intro h, assumption
end
/-- Tactic for setting up proof by induction over preforms. -/
meta def preform.induce (t : tactic unit := tactic.skip) : tactic unit :=
`[ intro p, induction p with t s t s p ih p q ihp ihq p q ihp ihq; t ]
end nat
end omega
|
section \<open>Relations on Deterministic Rabin Automata\<close>
theory DRA_Refine
imports
"DRA"
"../../Basic/Acceptance_Refine"
"../../Transition_Systems/Transition_System_Refine"
begin
definition dra_rel :: "('label\<^sub>1 \<times> 'label\<^sub>2) set \<Rightarrow> ('state\<^sub>1 \<times> 'state\<^sub>2) set \<Rightarrow>
(('label\<^sub>1, 'state\<^sub>1) dra \<times> ('label\<^sub>2, 'state\<^sub>2) dra) set" where
[to_relAPP]: "dra_rel L S \<equiv> {(A\<^sub>1, A\<^sub>2).
(alphabet A\<^sub>1, alphabet A\<^sub>2) \<in> \<langle>L\<rangle> set_rel \<and>
(initial A\<^sub>1, initial A\<^sub>2) \<in> S \<and>
(transition A\<^sub>1, transition A\<^sub>2) \<in> L \<rightarrow> S \<rightarrow> S \<and>
(condition A\<^sub>1, condition A\<^sub>2) \<in> \<langle>rabin_rel S\<rangle> list_rel}"
lemma dra_param[param]:
"(dra, dra) \<in> \<langle>L\<rangle> set_rel \<rightarrow> S \<rightarrow> (L \<rightarrow> S \<rightarrow> S) \<rightarrow> \<langle>rabin_rel S\<rangle> list_rel \<rightarrow>
\<langle>L, S\<rangle> dra_rel"
"(alphabet, alphabet) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> \<langle>L\<rangle> set_rel"
"(initial, initial) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> S"
"(transition, transition) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> L \<rightarrow> S \<rightarrow> S"
"(condition, condition) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> \<langle>rabin_rel S\<rangle> list_rel"
unfolding dra_rel_def fun_rel_def by auto
lemma dra_rel_id[simp]: "\<langle>Id, Id\<rangle> dra_rel = Id" unfolding dra_rel_def using dra.expand by auto
lemma dra_rel_comp[trans]:
assumes [param]: "(A, B) \<in> \<langle>L\<^sub>1, S\<^sub>1\<rangle> dra_rel" "(B, C) \<in> \<langle>L\<^sub>2, S\<^sub>2\<rangle> dra_rel"
shows "(A, C) \<in> \<langle>L\<^sub>1 O L\<^sub>2, S\<^sub>1 O S\<^sub>2\<rangle> dra_rel"
proof -
have "(condition A, condition B) \<in> \<langle>rabin_rel S\<^sub>1\<rangle> list_rel" by parametricity
also have "(condition B, condition C) \<in> \<langle>rabin_rel S\<^sub>2\<rangle> list_rel" by parametricity
finally have 1: "(condition A, condition C) \<in> \<langle>rabin_rel S\<^sub>1 O rabin_rel S\<^sub>2\<rangle> list_rel" by simp
have 2: "rabin_rel S\<^sub>1 O rabin_rel S\<^sub>2 \<subseteq> rabin_rel (S\<^sub>1 O S\<^sub>2)" by (force simp: fun_rel_def)
have 3: "(condition A, condition C) \<in> \<langle>rabin_rel (S\<^sub>1 O S\<^sub>2)\<rangle> list_rel" using 1 2 list_rel_mono by blast
have "(transition A, transition B) \<in> L\<^sub>1 \<rightarrow> S\<^sub>1 \<rightarrow> S\<^sub>1" by parametricity
also have "(transition B, transition C) \<in> L\<^sub>2 \<rightarrow> S\<^sub>2 \<rightarrow> S\<^sub>2" by parametricity
finally have 4: "(transition A, transition C) \<in> L\<^sub>1 O L\<^sub>2 \<rightarrow> S\<^sub>1 O S\<^sub>2 \<rightarrow> S\<^sub>1 O S\<^sub>2" by this
show ?thesis
unfolding dra_rel_def mem_Collect_eq prod.case set_rel_compp
using 3 4
using dra_param(2 - 5)[THEN fun_relD, OF assms(1)]
using dra_param(2 - 5)[THEN fun_relD, OF assms(2)]
by auto
qed
lemma dra_rel_converse[simp]: "(\<langle>L, S\<rangle> dra_rel)\<inverse> = \<langle>L\<inverse>, S\<inverse>\<rangle> dra_rel"
proof -
have 1: "\<langle>L\<rangle> set_rel = (\<langle>L\<inverse>\<rangle> set_rel)\<inverse>" by simp
have 2: "\<langle>S\<rangle> set_rel = (\<langle>S\<inverse>\<rangle> set_rel)\<inverse>" by simp
have 3: "L \<rightarrow> S \<rightarrow> S = (L\<inverse> \<rightarrow> S\<inverse> \<rightarrow> S\<inverse>)\<inverse>" by simp
have 4: "\<langle>rabin_rel S\<rangle> list_rel = (\<langle>rabin_rel (S\<inverse>)\<rangle> list_rel)\<inverse>" by simp
show ?thesis unfolding dra_rel_def unfolding 3 unfolding 1 2 4 by fastforce
qed
lemma dra_rel_eq: "(A, A) \<in> \<langle>Id_on (alphabet A), Id_on (nodes A)\<rangle> dra_rel"
unfolding dra_rel_def prod_rel_def using list_all2_same[to_set] by auto
lemma enableds_param[param]: "(dra.enableds, dra.enableds) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> S \<rightarrow> \<langle>L\<rangle> set_rel"
unfolding dra.enableds_def Collect_mem_eq by parametricity
lemma paths_param[param]: "(dra.paths, dra.paths) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> S \<rightarrow> \<langle>\<langle>L\<rangle> list_rel\<rangle> set_rel"
using enableds_param[param_fo] by parametricity
lemma runs_param[param]: "(dra.runs, dra.runs) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> S \<rightarrow> \<langle>\<langle>L\<rangle> stream_rel\<rangle> set_rel"
using enableds_param[param_fo] by parametricity
lemma reachable_param[param]: "(reachable, reachable) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> S \<rightarrow> \<langle>S\<rangle> set_rel"
proof -
have 1: "reachable A p = (\<lambda> w. target A w p) ` dra.paths A p" for A :: "('label, 'state) dra" and p
unfolding dra.reachable_alt_def dra.paths_def by auto
show ?thesis unfolding 1 using enableds_param[param_fo] by parametricity
qed
lemma nodes_param[param]: "(nodes, nodes) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> \<langle>S\<rangle> set_rel"
proof -
have 1: "nodes A = reachable A (initial A)" for A :: "('label, 'state) dra"
unfolding dra.nodes_alt_def by simp
show ?thesis unfolding 1 by parametricity
qed
lemma language_param[param]: "(language, language) \<in> \<langle>L, S\<rangle> dra_rel \<rightarrow> \<langle>\<langle>L\<rangle> stream_rel\<rangle> set_rel"
proof -
have 1: "language A = (\<Union> w \<in> dra.runs A (initial A).
if cogen rabin (condition A) (initial A ## trace A w (initial A)) then {w} else {})"
for A :: "('label, 'state) dra"
unfolding dra.language_def dra.runs_def by auto
show ?thesis unfolding 1 using enableds_param[param_fo] by parametricity
qed
end |
m <- 10
n <- 10
mat <- matrix(sample(1:20L, m*n, replace=TRUE), nrow=m); mat
done <- FALSE
for(i in seq_len(m))
{
for(j in seq_len(n))
{
cat(mat[i,j])
if(mat[i,j] == 20)
{
done <- TRUE
break
}
cat(", ")
}
if(done)
{
cat("\n")
break
}
}
|
program altret07
C Check link-edit issues
i = 0
call foo(*123, i)
print *, "First standard return from foo"
call foo(*123, i)
C This should not happen!
print *, "Second standard return from foo"
print *, 'STOP 0 in ALTRET07'
stop 0
123 continue
print *, 'STOP 1 in ALTRET07'
stop '1 in ALTRET07'
end
subroutine foo(*, i)
print *, "foo is entered with ", i
if(i.gt.0) then
print *, 'RETURN 1 in FOO'
return 1
endif
i = i + 1
end
subroutine SET_I_PIPS_RETURN_CODE_(irc)
common /PIPS_RETURN_CODE_COMMON/irc_shared
irc_shared = irc
end
subroutine GET_I_PIPS_RETURN_CODE_(irc)
common /PIPS_RETURN_CODE_COMMON/irc_shared
irc = irc_shared
end
|
[STATEMENT]
lemma widen_Iface_Iface_eq [simp]: "G\<turnstile>Iface I\<preceq> Iface J = G\<turnstile>I\<preceq>I J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. G\<turnstile>Iface I\<preceq>Iface J = G\<turnstile>I\<preceq>I J
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. G\<turnstile>Iface I\<preceq>Iface J \<Longrightarrow> G\<turnstile>I\<preceq>I J
2. G\<turnstile>I\<preceq>I J \<Longrightarrow> G\<turnstile>Iface I\<preceq>Iface J
[PROOF STEP]
apply (erule widen_Iface_Iface)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. G\<turnstile>I\<preceq>I J \<Longrightarrow> G\<turnstile>Iface I\<preceq>Iface J
[PROOF STEP]
apply (erule widen.subint)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done |
[STATEMENT]
lemma DBM_reset_sound':
assumes "clock_numbering' v n" "v c \<le> n" "DBM_reset M n (v c) d M'" "DBM_val_bounded v u M' n"
"DBM_val_bounded v u'' M n"
obtains d' where "DBM_val_bounded v (u(c := d')) M n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>c. 0 < v c \<and> (\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y)
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
goal (1 subgoal):
1. (\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (auto, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
note A = this
[PROOF STATE]
proof (state)
this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
obtain S_Min_Le where S_Min_Le:
"S_Min_Le = {u c' - d | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Le d}
\<union> {-d | d. M 0 (v c) = Le d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>S_Min_Le. S_Min_Le = {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Le d} \<union> {- d |d. M 0 (v c) = Le d} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S_Min_Le = {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Le d} \<union> {- d |d. M 0 (v c) = Le d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
obtain S_Min_Lt where S_Min_Lt:
"S_Min_Lt = {u c' - d | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Lt d}
\<union> {-d | d. M 0 (v c) = Lt d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>S_Min_Lt. S_Min_Lt = {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Lt d} \<union> {- d |d. M 0 (v c) = Lt d} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S_Min_Lt = {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Lt d} \<union> {- d |d. M 0 (v c) = Lt d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
obtain S_Max_Le where S_Max_Le:
"S_Max_Le = {u c' + d | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Le d}
\<union> {d | d. M (v c) 0 = Le d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>S_Max_Le. S_Max_Le = {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Le d} \<union> {d |d. M (v c) 0 = Le d} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S_Max_Le = {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Le d} \<union> {d |d. M (v c) 0 = Le d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
obtain S_Max_Lt where S_Max_Lt:
"S_Max_Lt = {u c' + d | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Lt d}
\<union> {d | d. M (v c) 0 = Lt d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>S_Max_Lt. S_Max_Lt = {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Lt d} \<union> {d |d. M (v c) 0 = Lt d} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S_Max_Lt = {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Lt d} \<union> {d |d. M (v c) 0 = Lt d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "finite {c. 0 < v c \<and> v c \<le> n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite {c. 0 < v c \<and> v c \<le> n}
[PROOF STEP]
using A(6,7)
[PROOF STATE]
proof (prove)
using this:
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. finite {c. 0 < v c \<and> v c \<le> n}
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> 0 \<and> v y \<le> 0 \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> 0}
2. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
\<forall>c. 0 < v c
\<forall>x y. v x \<le> 0 \<and> v y \<le> 0 \<and> v x = v y \<longrightarrow> x = y
goal (2 subgoals):
1. \<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> 0 \<and> v y \<le> 0 \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> 0}
2. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>c. 0 < v c
\<forall>x y. v x \<le> 0 \<and> v y \<le> 0 \<and> v x = v y \<longrightarrow> x = y
[PROOF STEP]
have "{c. 0 < v c \<and> v c \<le> 0} = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>c. 0 < v c
\<forall>x y. v x \<le> 0 \<and> v y \<le> 0 \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. {c. 0 < v c \<and> v c \<le> 0} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{c. 0 < v c \<and> v c \<le> 0} = {}
goal (2 subgoals):
1. \<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> 0 \<and> v y \<le> 0 \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> 0}
2. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{c. 0 < v c \<and> v c \<le> 0} = {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
{c. 0 < v c \<and> v c \<le> 0} = {}
goal (1 subgoal):
1. finite {c. 0 < v c \<and> v c \<le> 0}
[PROOF STEP]
by (metis finite.emptyI)
[PROOF STATE]
proof (state)
this:
finite {c. 0 < v c \<and> v c \<le> 0}
goal (1 subgoal):
1. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}
\<forall>c. 0 < v c
\<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}
\<forall>c. 0 < v c
\<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y
[PROOF STEP]
have "finite {c. 0 < v c \<and> v c \<le> n}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}
\<forall>c. 0 < v c
\<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. finite {c. 0 < v c \<and> v c \<le> n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {c. 0 < v c \<and> v c \<le> n}
goal (1 subgoal):
1. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {c. 0 < v c \<and> v c \<le> n}
goal (1 subgoal):
1. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
have "{c. 0 < v c \<and> v c \<le> Suc n} = {c. 0 < v c \<and> v c \<le> n} \<union> {c. v c = Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. {c. 0 < v c \<and> v c \<le> Suc n} = {c. 0 < v c \<and> v c \<le> n} \<union> {c. v c = Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{c. 0 < v c \<and> v c \<le> Suc n} = {c. 0 < v c \<and> v c \<le> n} \<union> {c. v c = Suc n}
goal (1 subgoal):
1. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{c. 0 < v c \<and> v c \<le> Suc n} = {c. 0 < v c \<and> v c \<le> n} \<union> {c. v c = Suc n}
goal (1 subgoal):
1. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
have "finite {c. v c = Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite {c. v c = Suc n}
[PROOF STEP]
proof (cases "{c. v c = Suc n} = {}", auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>x. v x = Suc n \<Longrightarrow> finite {c. v c = Suc n}
[PROOF STEP]
fix c
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>x. v x = Suc n \<Longrightarrow> finite {c. v c = Suc n}
[PROOF STEP]
assume "v c = Suc n"
[PROOF STATE]
proof (state)
this:
v c = Suc n
goal (1 subgoal):
1. \<And>x. v x = Suc n \<Longrightarrow> finite {c. v c = Suc n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v c = Suc n
[PROOF STEP]
have "{c. v c = Suc n} = {c}"
[PROOF STATE]
proof (prove)
using this:
v c = Suc n
goal (1 subgoal):
1. {c. v c = Suc n} = {c}
[PROOF STEP]
using Suc.prems(2)
[PROOF STATE]
proof (prove)
using this:
v c = Suc n
\<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. {c. v c = Suc n} = {c}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{c. v c = Suc n} = {c}
goal (1 subgoal):
1. \<And>x. v x = Suc n \<Longrightarrow> finite {c. v c = Suc n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{c. v c = Suc n} = {c}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{c. v c = Suc n} = {c}
goal (1 subgoal):
1. finite {c. v c = Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {c. v c = Suc n}
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite {c. v c = Suc n}
goal (1 subgoal):
1. \<And>n. \<lbrakk>\<lbrakk>\<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> n}; \<forall>c. 0 < v c; \<forall>x y. v x \<le> Suc n \<and> v y \<le> Suc n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {c. 0 < v c \<and> v c \<le> n}
{c. 0 < v c \<and> v c \<le> Suc n} = {c. 0 < v c \<and> v c \<le> n} \<union> {c. v c = Suc n}
finite {c. v c = Suc n}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite {c. 0 < v c \<and> v c \<le> n}
{c. 0 < v c \<and> v c \<le> Suc n} = {c. 0 < v c \<and> v c \<le> n} \<union> {c. v c = Suc n}
finite {c. v c = Suc n}
goal (1 subgoal):
1. finite {c. 0 < v c \<and> v c \<le> Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {c. 0 < v c \<and> v c \<le> Suc n}
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite {c. 0 < v c \<and> v c \<le> n}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {c. 0 < v c \<and> v c \<le> n}
[PROOF STEP]
have "\<forall> f. finite {(c,b) | c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}"
[PROOF STATE]
proof (prove)
using this:
finite {c. 0 < v c \<and> v c \<le> n}
goal (1 subgoal):
1. \<forall>f. finite {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>f. finite {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>f. finite {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have
"\<forall> f K. {(c,K d) | c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
\<subseteq> {(c,b) | c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>f K. {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} \<subseteq> {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>f K. {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} \<subseteq> {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>f. finite {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
\<forall>f K. {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} \<subseteq> {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
[PROOF STEP]
have B:
"\<forall> f K. finite {(c,K d) | c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}"
[PROOF STATE]
proof (prove)
using this:
\<forall>f. finite {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
\<forall>f K. {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} \<subseteq> {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
goal (1 subgoal):
1. \<forall>f K. finite {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
using finite_subset
[PROOF STATE]
proof (prove)
using this:
\<forall>f. finite {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
\<forall>f K. {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} \<subseteq> {(c, b) |c b. 0 < v c \<and> v c \<le> n \<and> f M (v c) = b}
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
goal (1 subgoal):
1. \<forall>f K. finite {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<forall>f K. finite {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "\<forall> f K. theLe o K = id \<longrightarrow> finite {(c,d) | c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>f K. theLe \<circ> K = id \<longrightarrow> finite {(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
proof (auto, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {(c, d). 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
case (1 f K)
[PROOF STATE]
proof (state)
this:
theLe \<circ> K = id
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {(c, d). 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
theLe \<circ> K = id
[PROOF STEP]
have
"{(c,d) | c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
= (\<lambda> (c,b). (c, theLe b)) ` {(c,K d) | c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}"
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
goal (1 subgoal):
1. {(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} = (\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
proof (auto simp add: pointfree_idE, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>a b. \<lbrakk>theLe \<circ> K = id; 0 < v a; v a \<le> n; f M (v a) = K b\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<lambda>x. case x of (c, b) \<Rightarrow> (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
case (1 a b)
[PROOF STATE]
proof (state)
this:
theLe \<circ> K = id
0 < v a
v a \<le> n
f M (v a) = K b
goal (1 subgoal):
1. \<And>a b. \<lbrakk>theLe \<circ> K = id; 0 < v a; v a \<le> n; f M (v a) = K b\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<lambda>x. case x of (c, b) \<Rightarrow> (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
theLe \<circ> K = id
0 < v a
v a \<le> n
f M (v a) = K b
[PROOF STEP]
have "(a, K b) \<in> {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}"
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
0 < v a
v a \<le> n
f M (v a) = K b
goal (1 subgoal):
1. (a, K b) \<in> {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a, K b) \<in> {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal (1 subgoal):
1. \<And>a b. \<lbrakk>theLe \<circ> K = id; 0 < v a; v a \<le> n; f M (v a) = K b\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<lambda>x. case x of (c, b) \<Rightarrow> (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(a, K b) \<in> {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal (1 subgoal):
1. \<And>a b. \<lbrakk>theLe \<circ> K = id; 0 < v a; v a \<le> n; f M (v a) = K b\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<lambda>x. case x of (c, b) \<Rightarrow> (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
from 1(1)
[PROOF STATE]
proof (chain)
picking this:
theLe \<circ> K = id
[PROOF STEP]
have "theLe (K b) = b"
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
goal (1 subgoal):
1. theLe (K b) = b
[PROOF STEP]
by (simp add: pointfree_idE)
[PROOF STATE]
proof (state)
this:
theLe (K b) = b
goal (1 subgoal):
1. \<And>a b. \<lbrakk>theLe \<circ> K = id; 0 < v a; v a \<le> n; f M (v a) = K b\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<lambda>x. case x of (c, b) \<Rightarrow> (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(a, K b) \<in> {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
theLe (K b) = b
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(a, K b) \<in> {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
theLe (K b) = b
goal (1 subgoal):
1. (a, b) \<in> (\<lambda>x. case x of (c, b) \<Rightarrow> (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(a, b) \<in> (\<lambda>x. case x of (c, b) \<Rightarrow> (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} = (\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {(c, d). 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} = (\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {(c, d). 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
from B
[PROOF STATE]
proof (chain)
picking this:
\<forall>f K. finite {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
have
"finite ((\<lambda> (c,b). (c, theLe b)) ` {(c,K d) | c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d})"
[PROOF STATE]
proof (prove)
using this:
\<forall>f K. finite {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal (1 subgoal):
1. finite ((\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d})
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {(c, d). 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} = (\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
finite ((\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
{(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d} = (\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
finite ((\<lambda>(c, b). (c, theLe b)) ` {(c, K d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d})
goal (1 subgoal):
1. finite {(c, d). 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {(c, d). 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>f K. theLe \<circ> K = id \<longrightarrow> finite {(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>f K. theLe \<circ> K = id \<longrightarrow> finite {(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
[PROOF STEP]
have finI:
"\<And> f g K. theLe o K = id \<Longrightarrow> finite (g ` {(c',d) | c' d. 0 < v c' \<and> v c' \<le> n \<and> f M (v c') = K d})"
[PROOF STATE]
proof (prove)
using this:
\<forall>f K. theLe \<circ> K = id \<longrightarrow> finite {(c, d) |c d. 0 < v c \<and> v c \<le> n \<and> f M (v c) = K d}
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> f M (v c') = K d})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
theLe \<circ> ?K4 = id \<Longrightarrow> finite (?g4 ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> ?f4 M (v c') = ?K4 d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have finI1:
"\<And> f g K. theLe o K = id \<Longrightarrow> finite (g ` {(c',d) | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})
[PROOF STEP]
proof goal_cases
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})
[PROOF STEP]
case (1 f g K)
[PROOF STATE]
proof (state)
this:
theLe \<circ> K = id
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})
[PROOF STEP]
have
"g ` {(c',d) | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d}
\<subseteq> g ` {(c',d) | c' d. 0 < v c' \<and> v c' \<le> n \<and> f M (v c') = K d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d} \<subseteq> g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> f M (v c') = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d} \<subseteq> g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> f M (v c') = K d}
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})
[PROOF STEP]
from finite_subset[OF this finI[OF 1, of g f]]
[PROOF STATE]
proof (chain)
picking this:
finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})
goal (1 subgoal):
1. finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite (g ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> f M (v c') = K d})
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
theLe \<circ> ?K5 = id \<Longrightarrow> finite (?g5 ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> ?f5 M (v c') = ?K5 d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "\<forall> f. finite {b. f M (v c) = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>f. finite {b. f M (v c) = b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>f. finite {b. f M (v c) = b}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>f. finite {b. f M (v c) = b}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "\<forall> f K. {K d | d. f M (v c) = K d} \<subseteq> {b. f M (v c) = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>f K. {K d |d. f M (v c) = K d} \<subseteq> {b. f M (v c) = b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>f K. {K d |d. f M (v c) = K d} \<subseteq> {b. f M (v c) = b}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>f. finite {b. f M (v c) = b}
\<forall>f K. {K d |d. f M (v c) = K d} \<subseteq> {b. f M (v c) = b}
[PROOF STEP]
have B: "\<forall> f K. finite {K d | d. f M (v c) = K d}"
[PROOF STATE]
proof (prove)
using this:
\<forall>f. finite {b. f M (v c) = b}
\<forall>f K. {K d |d. f M (v c) = K d} \<subseteq> {b. f M (v c) = b}
goal (1 subgoal):
1. \<forall>f K. finite {K d |d. f M (v c) = K d}
[PROOF STEP]
using finite_subset
[PROOF STATE]
proof (prove)
using this:
\<forall>f. finite {b. f M (v c) = b}
\<forall>f K. {K d |d. f M (v c) = K d} \<subseteq> {b. f M (v c) = b}
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
goal (1 subgoal):
1. \<forall>f K. finite {K d |d. f M (v c) = K d}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<forall>f K. finite {K d |d. f M (v c) = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "\<forall> f K. theLe o K = id \<longrightarrow> finite {d | d. f M (v c) = K d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>f K. theLe \<circ> K = id \<longrightarrow> finite {d |d. f M (v c) = K d}
[PROOF STEP]
proof (auto, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {uu_. f M (v c) = K uu_}
[PROOF STEP]
case (1 f K)
[PROOF STATE]
proof (state)
this:
theLe \<circ> K = id
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {uu_. f M (v c) = K uu_}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
theLe \<circ> K = id
[PROOF STEP]
have "{d | d. f M (v c) = K d} = theLe ` {K d | d. f M (v c) = K d}"
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
goal (1 subgoal):
1. {d |d. f M (v c) = K d} = theLe ` {K d |d. f M (v c) = K d}
[PROOF STEP]
proof (auto simp add: pointfree_idE, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>x. \<lbrakk>theLe \<circ> K = id; f M (v c) = K x\<rbrakk> \<Longrightarrow> x \<in> theLe ` {K d |d. K x = K d}
[PROOF STEP]
case (1 x)
[PROOF STATE]
proof (state)
this:
theLe \<circ> K = id
f M (v c) = K x
goal (1 subgoal):
1. \<And>x. \<lbrakk>theLe \<circ> K = id; f M (v c) = K x\<rbrakk> \<Longrightarrow> x \<in> theLe ` {K d |d. K x = K d}
[PROOF STEP]
have "K x \<in> {K d |d. K x = K d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. K x \<in> {K d |d. K x = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
K x \<in> {K d |d. K x = K d}
goal (1 subgoal):
1. \<And>x. \<lbrakk>theLe \<circ> K = id; f M (v c) = K x\<rbrakk> \<Longrightarrow> x \<in> theLe ` {K d |d. K x = K d}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
K x \<in> {K d |d. K x = K d}
goal (1 subgoal):
1. \<And>x. \<lbrakk>theLe \<circ> K = id; f M (v c) = K x\<rbrakk> \<Longrightarrow> x \<in> theLe ` {K d |d. K x = K d}
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
theLe \<circ> K = id
f M (v c) = K x
[PROOF STEP]
have "theLe (K x) = x"
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
f M (v c) = K x
goal (1 subgoal):
1. theLe (K x) = x
[PROOF STEP]
by (simp add: pointfree_idE)
[PROOF STATE]
proof (state)
this:
theLe (K x) = x
goal (1 subgoal):
1. \<And>x. \<lbrakk>theLe \<circ> K = id; f M (v c) = K x\<rbrakk> \<Longrightarrow> x \<in> theLe ` {K d |d. K x = K d}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
K x \<in> {K d |d. K x = K d}
theLe (K x) = x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
K x \<in> {K d |d. K x = K d}
theLe (K x) = x
goal (1 subgoal):
1. x \<in> theLe ` {K d |d. K x = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> theLe ` {K d |d. K x = K d}
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{d |d. f M (v c) = K d} = theLe ` {K d |d. f M (v c) = K d}
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {uu_. f M (v c) = K uu_}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{d |d. f M (v c) = K d} = theLe ` {K d |d. f M (v c) = K d}
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {uu_. f M (v c) = K uu_}
[PROOF STEP]
from B
[PROOF STATE]
proof (chain)
picking this:
\<forall>f K. finite {K d |d. f M (v c) = K d}
[PROOF STEP]
have "finite {K d |d. f M (v c) = K d}"
[PROOF STATE]
proof (prove)
using this:
\<forall>f K. finite {K d |d. f M (v c) = K d}
goal (1 subgoal):
1. finite {K d |d. f M (v c) = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {K d |d. f M (v c) = K d}
goal (1 subgoal):
1. \<And>f K. theLe \<circ> K = id \<Longrightarrow> finite {uu_. f M (v c) = K uu_}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{d |d. f M (v c) = K d} = theLe ` {K d |d. f M (v c) = K d}
finite {K d |d. f M (v c) = K d}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
{d |d. f M (v c) = K d} = theLe ` {K d |d. f M (v c) = K d}
finite {K d |d. f M (v c) = K d}
goal (1 subgoal):
1. finite {uu_. f M (v c) = K uu_}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {uu_. f M (v c) = K uu_}
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>f K. theLe \<circ> K = id \<longrightarrow> finite {d |d. f M (v c) = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>f K. theLe \<circ> K = id \<longrightarrow> finite {d |d. f M (v c) = K d}
[PROOF STEP]
have C: "\<forall> f g K. theLe o K = id \<longrightarrow> finite (g ` {d | d. f M (v c) = K d})"
[PROOF STATE]
proof (prove)
using this:
\<forall>f K. theLe \<circ> K = id \<longrightarrow> finite {d |d. f M (v c) = K d}
goal (1 subgoal):
1. \<forall>f g K. theLe \<circ> K = id \<longrightarrow> finite (g ` {d |d. f M (v c) = K d})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>f g K. theLe \<circ> K = id \<longrightarrow> finite (g ` {d |d. f M (v c) = K d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have finI2: "\<And> f g K. theLe o K = id \<Longrightarrow> finite ({g d | d. f M (v c) = K d})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite {g d |d. f M (v c) = K d}
[PROOF STEP]
proof goal_cases
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite {g d |d. f M (v c) = K d}
[PROOF STEP]
case (1 f g K)
[PROOF STATE]
proof (state)
this:
theLe \<circ> K = id
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite {g d |d. f M (v c) = K d}
[PROOF STEP]
have "{g d |d. f M (v c) = K d} = g ` {d | d. f M (v c) = K d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. {g d |d. f M (v c) = K d} = g ` {d |d. f M (v c) = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{g d |d. f M (v c) = K d} = g ` {d |d. f M (v c) = K d}
goal (1 subgoal):
1. \<And>f g K. theLe \<circ> K = id \<Longrightarrow> finite {g d |d. f M (v c) = K d}
[PROOF STEP]
with C 1
[PROOF STATE]
proof (chain)
picking this:
\<forall>f g K. theLe \<circ> K = id \<longrightarrow> finite (g ` {d |d. f M (v c) = K d})
theLe \<circ> K = id
{g d |d. f M (v c) = K d} = g ` {d |d. f M (v c) = K d}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>f g K. theLe \<circ> K = id \<longrightarrow> finite (g ` {d |d. f M (v c) = K d})
theLe \<circ> K = id
{g d |d. f M (v c) = K d} = g ` {d |d. f M (v c) = K d}
goal (1 subgoal):
1. finite {g d |d. f M (v c) = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {g d |d. f M (v c) = K d}
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
theLe \<circ> ?K11 = id \<Longrightarrow> finite {?g11 d |d. ?f11 M (v c) = ?K11 d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
theLe \<circ> ?K11 = id \<Longrightarrow> finite {?g11 d |d. ?f11 M (v c) = ?K11 d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
fix K :: "'b \<Rightarrow> 'b DBMEntry"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume A: "theLe o K = id"
[PROOF STATE]
proof (state)
this:
theLe \<circ> K = id
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
theLe \<circ> K = id
[PROOF STEP]
have
"finite ((\<lambda>(c,d). u c - d) ` {(c',d) | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d})"
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
goal (1 subgoal):
1. finite ((\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d})
[PROOF STEP]
by (intro finI1, auto)
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have
"{u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
= ((\<lambda>(c,d). u c - d) ` {(c',d) | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d} = (\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d} = (\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite ((\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d})
{u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d} = (\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
[PROOF STEP]
have "finite {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}"
[PROOF STATE]
proof (prove)
using this:
finite ((\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d})
{u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d} = (\<lambda>(c, d). u c - d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
goal (1 subgoal):
1. finite {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "finite {- d |d. M 0 (v c) = K d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite {- d |d. M 0 (v c) = K d}
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
goal (1 subgoal):
1. finite {- d |d. M 0 (v c) = K d}
[PROOF STEP]
by (intro finI2, auto)
[PROOF STATE]
proof (state)
this:
finite {- d |d. M 0 (v c) = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
finite {- d |d. M 0 (v c) = K d}
[PROOF STEP]
have
"finite ({u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
\<union> {- d |d. M 0 (v c) = K d})"
[PROOF STATE]
proof (prove)
using this:
finite {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d}
finite {- d |d. M 0 (v c) = K d}
goal (1 subgoal):
1. finite ({u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d} \<union> {- d |d. M 0 (v c) = K d})
[PROOF STEP]
by (auto simp: S_Min_Le)
[PROOF STATE]
proof (state)
this:
finite ({u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = K d} \<union> {- d |d. M 0 (v c) = K d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
theLe \<circ> ?K14 = id \<Longrightarrow> finite ({u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = ?K14 d} \<union> {- d |d. M 0 (v c) = ?K14 d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
note fin1 = this
[PROOF STATE]
proof (state)
this:
theLe \<circ> ?K14 = id \<Longrightarrow> finite ({u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = ?K14 d} \<union> {- d |d. M 0 (v c) = ?K14 d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have fin_min_le: "finite S_Min_Le"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite S_Min_Le
[PROOF STEP]
unfolding S_Min_Le
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite ({u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Le d} \<union> {- d |d. M 0 (v c) = Le d})
[PROOF STEP]
by (rule fin1, auto)
[PROOF STATE]
proof (state)
this:
finite S_Min_Le
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have fin_min_lt: "finite S_Min_Lt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite S_Min_Lt
[PROOF STEP]
unfolding S_Min_Lt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite ({u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Lt d} \<union> {- d |d. M 0 (v c) = Lt d})
[PROOF STEP]
by (rule fin1, auto)
[PROOF STATE]
proof (state)
this:
finite S_Min_Lt
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite S_Min_Lt
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
fix K :: "'b \<Rightarrow> 'b DBMEntry"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume A: "theLe o K = id"
[PROOF STATE]
proof (state)
this:
theLe \<circ> K = id
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
theLe \<circ> K = id
[PROOF STEP]
have "finite ((\<lambda>(c,d). u c + d) ` {(c',d) | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d})"
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
goal (1 subgoal):
1. finite ((\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d})
[PROOF STEP]
by (intro finI1, auto)
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have
"{u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
= ((\<lambda>(c,d). u c + d) ` {(c',d) | c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d} = (\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d} = (\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite ((\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d})
{u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d} = (\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
[PROOF STEP]
have "finite {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}"
[PROOF STATE]
proof (prove)
using this:
finite ((\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d})
{u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d} = (\<lambda>(c, d). u c + d) ` {(c', d) |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
goal (1 subgoal):
1. finite {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "finite {d |d. M (v c) 0 = K d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite {d |d. M (v c) 0 = K d}
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
theLe \<circ> K = id
goal (1 subgoal):
1. finite {d |d. M (v c) 0 = K d}
[PROOF STEP]
by (intro finI2, auto)
[PROOF STATE]
proof (state)
this:
finite {d |d. M (v c) 0 = K d}
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
finite {d |d. M (v c) 0 = K d}
[PROOF STEP]
have
"finite ({u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
\<union> {d |d. M (v c) 0 = K d})"
[PROOF STATE]
proof (prove)
using this:
finite {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d}
finite {d |d. M (v c) 0 = K d}
goal (1 subgoal):
1. finite ({u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d} \<union> {d |d. M (v c) 0 = K d})
[PROOF STEP]
by (auto simp: S_Min_Le)
[PROOF STATE]
proof (state)
this:
finite ({u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = K d} \<union> {d |d. M (v c) 0 = K d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
theLe \<circ> ?K14 = id \<Longrightarrow> finite ({u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = ?K14 d} \<union> {d |d. M (v c) 0 = ?K14 d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
note fin2 = this
[PROOF STATE]
proof (state)
this:
theLe \<circ> ?K14 = id \<Longrightarrow> finite ({u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = ?K14 d} \<union> {d |d. M (v c) 0 = ?K14 d})
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have fin_max_le: "finite S_Max_Le"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite S_Max_Le
[PROOF STEP]
unfolding S_Max_Le
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite ({u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Le d} \<union> {d |d. M (v c) 0 = Le d})
[PROOF STEP]
by (rule fin2, auto)
[PROOF STATE]
proof (state)
this:
finite S_Max_Le
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have fin_max_lt: "finite S_Max_Lt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite S_Max_Lt
[PROOF STEP]
unfolding S_Max_Lt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite ({u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Lt d} \<union> {d |d. M (v c) 0 = Lt d})
[PROOF STEP]
by (rule fin2, auto)
[PROOF STATE]
proof (state)
this:
finite S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
fix l r
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "l \<in> S_Min_Le" "r \<in> S_Max_Le"
[PROOF STATE]
proof (state)
this:
l \<in> S_Min_Le
r \<in> S_Max_Le
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l \<in> S_Min_Le
r \<in> S_Max_Le
[PROOF STEP]
have "l \<le> r"
[PROOF STATE]
proof (prove)
using this:
l \<in> S_Min_Le
r \<in> S_Max_Le
goal (1 subgoal):
1. l \<le> r
[PROOF STEP]
proof (auto simp: S_Min_Le S_Max_Le, goal_cases)
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d \<le> u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
case (1 c1 d1 c2 d2)
[PROOF STATE]
proof (state)
this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d \<le> u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
[PROOF STEP]
have
"dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d \<le> u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d \<le> u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
have
"M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
using A(3,7) 1
[PROOF STATE]
proof (prove)
using this:
DBM_reset M n (v c) d M'
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d \<le> u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
have
"dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
using dbm_entry_dbm_min'
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) ?a
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d \<le> u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
have "u c1 - u c2 \<le> d1 + d2"
[PROOF STATE]
proof (prove)
using this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
goal (1 subgoal):
1. u c1 - u c2 \<le> d1 + d2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c1 - u c2 \<le> d1 + d2
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d \<le> u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
u c1 - u c2 \<le> d1 + d2
goal (1 subgoal):
1. u c1 - d1 \<le> u c2 + d2
[PROOF STEP]
by (metis (opaque_lifting, no_types) add_diff_cancel_left diff_0_right diff_add_cancel diff_eq_diff_less_eq)
[PROOF STATE]
proof (state)
this:
u c1 - d1 \<le> u c2 + d2
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
case (2 c' d)
[PROOF STATE]
proof (state)
this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
[PROOF STEP]
have
"(\<forall>i\<le>n. i \<noteq> v c \<and> i > 0 \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0))"
"v c' \<noteq> v c"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0) &&& v c' \<noteq> v c
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0) &&& v c' \<noteq> v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
hence "(M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
from A 2
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
[PROOF STEP]
have "dbm_entry_val u (Some c') None (M' (v c') 0)"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
have "dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))"
[PROOF STATE]
proof (prove)
using this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
using dbm_entry_dbm_min3'
[PROOF STATE]
proof (prove)
using this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
dbm_entry_val ?u (Some ?c) None (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c) None ?a
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
with 2
[PROOF STATE]
proof (chain)
picking this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
have "u c' \<le> d + r"
[PROOF STATE]
proof (prove)
using this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Le r
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
goal (1 subgoal):
1. u c' \<le> d + r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c' \<le> d + r
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d \<le> r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
u c' \<le> d + r
goal (1 subgoal):
1. u c' - d \<le> r
[PROOF STEP]
by (metis add_diff_cancel_left add_le_cancel_right diff_0_right diff_add_cancel)
[PROOF STATE]
proof (state)
this:
u c' - d \<le> r
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
case (3 d c' d')
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
[PROOF STEP]
have
"(\<forall>i\<le>n. i \<noteq> v c \<and> i > 0 \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i))"
"v c' \<noteq> v c"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i) &&& v c' \<noteq> v c
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i) &&& v c' \<noteq> v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
hence "(M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c')))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
from A 3
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
[PROOF STEP]
have "dbm_entry_val u None (Some c') (M' 0 (v c'))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
have "dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))"
[PROOF STATE]
proof (prove)
using this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
using dbm_entry_dbm_min2'
[PROOF STATE]
proof (prove)
using this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
dbm_entry_val ?u None (Some ?c) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u None (Some ?c) ?a
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
have "-u c' \<le> d + d'"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Le d
l = - d
r = u c' + d'
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le d'
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
goal (1 subgoal):
1. - u c' \<le> d + d'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u c' \<le> d + d'
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d \<le> u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- u c' \<le> d + d'
goal (1 subgoal):
1. - d \<le> u c' + d'
[PROOF STEP]
by (metis add_uminus_conv_diff diff_le_eq minus_add_distrib minus_le_iff)
[PROOF STATE]
proof (state)
this:
- d \<le> u c' + d'
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
case (4 d)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Le d
l = - d
M (v c) 0 = Le r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
text \<open>
Here is the reason we need the assumption that the zone was not empty before the reset.
We cannot deduce anything from the current value of \<open>c\<close> itself because we reset it.
We can only ensure that we can reset the value of \<open>c\<close> by using the value from the
alternative assignment.
This case is only relevant if the tightest bounds for \<open>d\<close> were given by its original
lower and upper bounds. If they would overlap, the original zone would be empty.
\<close>
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Le d
l = - d
M (v c) 0 = Le r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
from A(2,5)
[PROOF STATE]
proof (chain)
picking this:
v c \<le> n
u'' \<turnstile>\<^bsub>v,n\<^esub> M
[PROOF STEP]
have
"dbm_entry_val u'' None (Some c) (M 0 (v c))"
"dbm_entry_val u'' (Some c) None (M (v c) 0)"
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
u'' \<turnstile>\<^bsub>v,n\<^esub> M
goal (1 subgoal):
1. dbm_entry_val u'' None (Some c) (M 0 (v c)) &&& dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
goal (1 subgoal):
1. dbm_entry_val u'' None (Some c) (M 0 (v c)) &&& dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
with 4
[PROOF STATE]
proof (chain)
picking this:
M 0 (v c) = Le d
l = - d
M (v c) 0 = Le r
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
have "- u'' c \<le> d" "u'' c \<le> r"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Le d
l = - d
M (v c) 0 = Le r
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
goal (1 subgoal):
1. - u'' c \<le> d &&& u'' c \<le> r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u'' c \<le> d
u'' c \<le> r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d \<le> r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- u'' c \<le> d
u'' c \<le> r
goal (1 subgoal):
1. - d \<le> r
[PROOF STEP]
by (metis minus_le_iff order.trans)
[PROOF STATE]
proof (state)
this:
- d \<le> r
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l \<le> r
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Le; ?r14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> ?l14 \<le> ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
note EE = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Le; ?r14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> ?l14 \<le> ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Le; ?r14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> ?l14 \<le> ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
fix l r
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "l \<in> S_Min_Le" "r \<in> S_Max_Lt"
[PROOF STATE]
proof (state)
this:
l \<in> S_Min_Le
r \<in> S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l \<in> S_Min_Le
r \<in> S_Max_Lt
[PROOF STEP]
have "l < r"
[PROOF STATE]
proof (prove)
using this:
l \<in> S_Min_Le
r \<in> S_Max_Lt
goal (1 subgoal):
1. l < r
[PROOF STEP]
proof (auto simp: S_Min_Le S_Max_Lt, goal_cases)
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (1 c1 d1 c2 d2)
[PROOF STATE]
proof (state)
this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
[PROOF STEP]
have "dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
have "M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
using A(3,7) 1
[PROOF STATE]
proof (prove)
using this:
DBM_reset M n (v c) d M'
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
have "dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
using dbm_entry_dbm_min'
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) ?a
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
have "u c1 - u c2 < d1 + d2"
[PROOF STATE]
proof (prove)
using this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Le d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
goal (1 subgoal):
1. u c1 - u c2 < d1 + d2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c1 - u c2 < d1 + d2
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u c1 - u c2 < d1 + d2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
u c1 - u c2 < d1 + d2
goal (1 subgoal):
1. u c1 - d1 < u c2 + d2
[PROOF STEP]
by (metis add.assoc add.commute diff_less_eq)
[PROOF STATE]
proof (state)
this:
u c1 - d1 < u c2 + d2
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (2 c' d)
[PROOF STATE]
proof (state)
this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
[PROOF STEP]
have
"(\<forall>i\<le>n. i \<noteq> v c \<and> i > 0 \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0))"
"v c' \<noteq> v c"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0) &&& v c' \<noteq> v c
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0) &&& v c' \<noteq> v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
hence "(M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A 2
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
[PROOF STEP]
have "dbm_entry_val u (Some c') None (M' (v c') 0)"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
have "dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))"
[PROOF STATE]
proof (prove)
using this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
using dbm_entry_dbm_min3'
[PROOF STATE]
proof (prove)
using this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
dbm_entry_val ?u (Some ?c) None (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c) None ?a
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 2
[PROOF STATE]
proof (chain)
picking this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
have "u c' < d + r"
[PROOF STATE]
proof (prove)
using this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Le d
M (v c) 0 = Lt r
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
goal (1 subgoal):
1. u c' < d + r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c' < d + r
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Le d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
u c' < d + r
goal (1 subgoal):
1. u c' - d < r
[PROOF STEP]
by (metis add_less_imp_less_right diff_add_cancel gt_swap)
[PROOF STATE]
proof (state)
this:
u c' - d < r
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (3 d c' da)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
[PROOF STEP]
have
"(\<forall>i\<le>n. i \<noteq> v c \<and> i > 0 \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i))"
"v c' \<noteq> v c"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i) &&& v c' \<noteq> v c
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i) &&& v c' \<noteq> v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
hence "(M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c')))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A 3
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
[PROOF STEP]
have "dbm_entry_val u None (Some c') (M' 0 (v c'))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
have "dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))"
[PROOF STATE]
proof (prove)
using this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
using dbm_entry_dbm_min2'
[PROOF STATE]
proof (prove)
using this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
dbm_entry_val ?u None (Some ?c) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u None (Some ?c) ?a
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
have "-u c' < d + da"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Le d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
goal (1 subgoal):
1. - u c' < d + da
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u c' < d + da
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Le d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- u c' < d + da
goal (1 subgoal):
1. - d < u c' + da
[PROOF STEP]
by (metis add.commute diff_less_eq uminus_add_conv_diff)
[PROOF STATE]
proof (state)
this:
- d < u c' + da
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (4 d)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Le d
l = - d
M (v c) 0 = Lt r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A(2,5)
[PROOF STATE]
proof (chain)
picking this:
v c \<le> n
u'' \<turnstile>\<^bsub>v,n\<^esub> M
[PROOF STEP]
have
"dbm_entry_val u'' None (Some c) (M 0 (v c))"
"dbm_entry_val u'' (Some c) None (M (v c) 0)"
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
u'' \<turnstile>\<^bsub>v,n\<^esub> M
goal (1 subgoal):
1. dbm_entry_val u'' None (Some c) (M 0 (v c)) &&& dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
goal (1 subgoal):
1. dbm_entry_val u'' None (Some c) (M 0 (v c)) &&& dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 4
[PROOF STATE]
proof (chain)
picking this:
M 0 (v c) = Le d
l = - d
M (v c) 0 = Lt r
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
have "- u'' c \<le> d" "u'' c < r"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Le d
l = - d
M (v c) 0 = Lt r
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
goal (1 subgoal):
1. - u'' c \<le> d &&& u'' c < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u'' c \<le> d
u'' c < r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Le d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- u'' c \<le> d
u'' c < r
goal (1 subgoal):
1. - d < r
[PROOF STEP]
by (metis minus_le_iff neq_iff not_le order.strict_trans)
[PROOF STATE]
proof (state)
this:
- d < r
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l < r
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Le; ?r14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> ?l14 < ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
note EL = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Le; ?r14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> ?l14 < ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Le; ?r14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> ?l14 < ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
fix l r
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "l \<in> S_Min_Lt" "r \<in> S_Max_Le"
[PROOF STATE]
proof (state)
this:
l \<in> S_Min_Lt
r \<in> S_Max_Le
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l \<in> S_Min_Lt
r \<in> S_Max_Le
[PROOF STEP]
have "l < r"
[PROOF STATE]
proof (prove)
using this:
l \<in> S_Min_Lt
r \<in> S_Max_Le
goal (1 subgoal):
1. l < r
[PROOF STEP]
proof (auto simp: S_Min_Lt S_Max_Le, goal_cases)
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (1 c1 d1 c2 d2)
[PROOF STATE]
proof (state)
this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
[PROOF STEP]
have "dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
have "M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
using A(3,7) 1
[PROOF STATE]
proof (prove)
using this:
DBM_reset M n (v c) d M'
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
have "dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
using dbm_entry_dbm_min'
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) ?a
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
have "u c1 - u c2 < d1 + d2"
[PROOF STATE]
proof (prove)
using this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Le d2
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
goal (1 subgoal):
1. u c1 - u c2 < d1 + d2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c1 - u c2 < d1 + d2
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Le da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
u c1 - u c2 < d1 + d2
goal (1 subgoal):
1. u c1 - d1 < u c2 + d2
[PROOF STEP]
by (metis add.assoc add.commute diff_less_eq)
[PROOF STATE]
proof (state)
this:
u c1 - d1 < u c2 + d2
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (2 c' d)
[PROOF STATE]
proof (state)
this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
[PROOF STEP]
have
"(\<forall>i\<le>n. i \<noteq> v c \<and> i > 0 \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0))"
"v c' \<noteq> v c"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0) &&& v c' \<noteq> v c
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0) &&& v c' \<noteq> v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
hence "(M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A 2
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
[PROOF STEP]
have "dbm_entry_val u (Some c') None (M' (v c') 0)"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
have "dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))"
[PROOF STATE]
proof (prove)
using this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
using dbm_entry_dbm_min3'
[PROOF STATE]
proof (prove)
using this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
dbm_entry_val ?u (Some ?c) None (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c) None ?a
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 2
[PROOF STATE]
proof (chain)
picking this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
have "u c' < d + r"
[PROOF STATE]
proof (prove)
using this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Le r
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
goal (1 subgoal):
1. u c' < d + r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c' < d + r
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
u c' < d + r
goal (1 subgoal):
1. u c' - d < r
[PROOF STEP]
by (metis add_less_imp_less_right diff_add_cancel gt_swap)
[PROOF STATE]
proof (state)
this:
u c' - d < r
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (3 d c' da)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
[PROOF STEP]
have
"(\<forall>i\<le>n. i \<noteq> v c \<and> i > 0 \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i))"
"v c' \<noteq> v c"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i) &&& v c' \<noteq> v c
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i) &&& v c' \<noteq> v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
hence "(M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c')))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A 3
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
[PROOF STEP]
have "dbm_entry_val u None (Some c') (M' 0 (v c'))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
have "dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))"
[PROOF STATE]
proof (prove)
using this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
using dbm_entry_dbm_min2'
[PROOF STATE]
proof (prove)
using this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
dbm_entry_val ?u None (Some ?c) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u None (Some ?c) ?a
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
have "-u c' < d + da"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Le da
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
goal (1 subgoal):
1. - u c' < d + da
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u c' < d + da
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Le da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- u c' < d + da
goal (1 subgoal):
1. - d < u c' + da
[PROOF STEP]
by (metis add.commute diff_less_eq uminus_add_conv_diff)
[PROOF STATE]
proof (state)
this:
- d < u c' + da
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (4 d)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Lt d
l = - d
M (v c) 0 = Le r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A(2,5)
[PROOF STATE]
proof (chain)
picking this:
v c \<le> n
u'' \<turnstile>\<^bsub>v,n\<^esub> M
[PROOF STEP]
have
"dbm_entry_val u'' None (Some c) (M 0 (v c))"
"dbm_entry_val u'' (Some c) None (M (v c) 0)"
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
u'' \<turnstile>\<^bsub>v,n\<^esub> M
goal (1 subgoal):
1. dbm_entry_val u'' None (Some c) (M 0 (v c)) &&& dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
goal (1 subgoal):
1. dbm_entry_val u'' None (Some c) (M 0 (v c)) &&& dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 4
[PROOF STATE]
proof (chain)
picking this:
M 0 (v c) = Lt d
l = - d
M (v c) 0 = Le r
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
have "- u'' c < d" "u'' c \<le> r"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Lt d
l = - d
M (v c) 0 = Le r
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
goal (1 subgoal):
1. - u'' c < d &&& u'' c \<le> r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u'' c < d
u'' c \<le> r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Le r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- u'' c < d
u'' c \<le> r
goal (1 subgoal):
1. - d < r
[PROOF STEP]
by (meson less_le_trans minus_less_iff)
[PROOF STATE]
proof (state)
this:
- d < r
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l < r
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Lt; ?r14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> ?l14 < ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
note LE = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Lt; ?r14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> ?l14 < ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Lt; ?r14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> ?l14 < ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
fix l r
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "l \<in> S_Min_Lt" "r \<in> S_Max_Lt"
[PROOF STATE]
proof (state)
this:
l \<in> S_Min_Lt
r \<in> S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l \<in> S_Min_Lt
r \<in> S_Max_Lt
[PROOF STEP]
have "l < r"
[PROOF STATE]
proof (prove)
using this:
l \<in> S_Min_Lt
r \<in> S_Max_Lt
goal (1 subgoal):
1. l < r
[PROOF STEP]
proof (auto simp: S_Min_Lt S_Max_Lt, goal_cases)
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (1 c1 d1 c2 d2)
[PROOF STATE]
proof (state)
this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
[PROOF STEP]
have "dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
have "M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
using A(3,7) 1
[PROOF STATE]
proof (prove)
using this:
DBM_reset M n (v c) d M'
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
have "dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
using dbm_entry_dbm_min'
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) ?a
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
[PROOF STEP]
have "u c1 - u c2 < d1 + d2"
[PROOF STATE]
proof (prove)
using this:
l = u c1 - d1
0 < v c1
v c1 \<le> n
c \<noteq> c1
M (v c1) (v c) = Lt d1
r = u c2 + d2
0 < v c2
v c2 \<le> n
c \<noteq> c2
M (v c) (v c2) = Lt d2
dbm_entry_val u (Some c1) (Some c2) (dbm_add (M (v c1) (v c)) (M (v c) (v c2)))
goal (1 subgoal):
1. u c1 - u c2 < d1 + d2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c1 - u c2 < d1 + d2
goal (4 subgoals):
1. \<And>c' d c'a da. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; r = u c'a + da; 0 < v c'a; v c'a \<le> n; c \<noteq> c'a; M (v c) (v c'a) = Lt da\<rbrakk> \<Longrightarrow> u c' - d < u c'a + da
2. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
3. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
4. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u c1 - u c2 < d1 + d2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
u c1 - u c2 < d1 + d2
goal (1 subgoal):
1. u c1 - d1 < u c2 + d2
[PROOF STEP]
by (metis add.assoc add.commute diff_less_eq)
[PROOF STATE]
proof (state)
this:
u c1 - d1 < u c2 + d2
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (2 c' d)
[PROOF STATE]
proof (state)
this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
[PROOF STEP]
have
"(\<forall>i\<le>n. i \<noteq> v c \<and> i > 0\<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0))"
"v c' \<noteq> v c"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0) &&& v c' \<noteq> v c
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0) &&& v c' \<noteq> v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
hence "(M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' i 0 = min (dbm_add (M i (v c)) (M (v c) 0)) (M i 0)
v c' \<noteq> v c
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A 2
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
[PROOF STEP]
have "dbm_entry_val u (Some c') None (M' (v c') 0)"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
have "dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))"
[PROOF STATE]
proof (prove)
using this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
using dbm_entry_dbm_min3'
[PROOF STATE]
proof (prove)
using this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
dbm_entry_val ?u (Some ?c) None (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c) None ?a
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 2
[PROOF STATE]
proof (chain)
picking this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
[PROOF STEP]
have "u c' < d + r"
[PROOF STATE]
proof (prove)
using this:
l = u c' - d
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c') (v c) = Lt d
M (v c) 0 = Lt r
dbm_entry_val u (Some c') None (dbm_add (M (v c') (v c)) (M (v c) 0))
goal (1 subgoal):
1. u c' < d + r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c' < d + r
goal (3 subgoals):
1. \<And>c' d. \<lbrakk>l = u c' - d; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c') (v c) = Lt d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> u c' - d < r
2. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
3. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
u c' < d + r
goal (1 subgoal):
1. u c' - d < r
[PROOF STEP]
by (metis add_less_imp_less_right diff_add_cancel gt_swap)
[PROOF STATE]
proof (state)
this:
u c' - d < r
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (3 d c' da)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
[PROOF STEP]
have
"(\<forall>i\<le>n. i \<noteq> v c \<and> i > 0 \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i))"
"v c' \<noteq> v c"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i) &&& v c' \<noteq> v c
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. \<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i) &&& v c' \<noteq> v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
hence "(M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c')))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. i \<noteq> v c \<and> 0 < i \<longrightarrow> M' 0 i = min (dbm_add (M 0 (v c)) (M (v c) i)) (M 0 i)
v c' \<noteq> v c
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A 3
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
[PROOF STEP]
have "dbm_entry_val u None (Some c') (M' 0 (v c'))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
have "dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))"
[PROOF STATE]
proof (prove)
using this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
using dbm_entry_dbm_min2'
[PROOF STATE]
proof (prove)
using this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
dbm_entry_val ?u None (Some ?c) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u None (Some ?c) ?a
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
[PROOF STEP]
have "-u c' < d + da"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Lt d
l = - d
r = u c' + da
0 < v c'
v c' \<le> n
c \<noteq> c'
M (v c) (v c') = Lt da
dbm_entry_val u None (Some c') (dbm_add (M 0 (v c)) (M (v c) (v c')))
goal (1 subgoal):
1. - u c' < d + da
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u c' < d + da
goal (2 subgoals):
1. \<And>d c' da. \<lbrakk>M 0 (v c) = Lt d; l = - d; r = u c' + da; 0 < v c'; v c' \<le> n; c \<noteq> c'; M (v c) (v c') = Lt da\<rbrakk> \<Longrightarrow> - d < u c' + da
2. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- u c' < d + da
goal (1 subgoal):
1. - d < u c' + da
[PROOF STEP]
by (metis ab_group_add_class.ab_diff_conv_add_uminus add.commute diff_less_eq)
[PROOF STATE]
proof (state)
this:
- d < u c' + da
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
case (4 d)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Lt d
l = - d
M (v c) 0 = Lt r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
from A(2,5)
[PROOF STATE]
proof (chain)
picking this:
v c \<le> n
u'' \<turnstile>\<^bsub>v,n\<^esub> M
[PROOF STEP]
have
"dbm_entry_val u'' None (Some c) (M 0 (v c))"
"dbm_entry_val u'' (Some c) None (M (v c) 0)"
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
u'' \<turnstile>\<^bsub>v,n\<^esub> M
goal (1 subgoal):
1. dbm_entry_val u'' None (Some c) (M 0 (v c)) &&& dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
goal (1 subgoal):
1. dbm_entry_val u'' None (Some c) (M 0 (v c)) &&& dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
with 4
[PROOF STATE]
proof (chain)
picking this:
M 0 (v c) = Lt d
l = - d
M (v c) 0 = Lt r
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
[PROOF STEP]
have "- u'' c \<le> d" "u'' c < r"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Lt d
l = - d
M (v c) 0 = Lt r
dbm_entry_val u'' None (Some c) (M 0 (v c))
dbm_entry_val u'' (Some c) None (M (v c) 0)
goal (1 subgoal):
1. - u'' c \<le> d &&& u'' c < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u'' c \<le> d
u'' c < r
goal (1 subgoal):
1. \<And>d. \<lbrakk>M 0 (v c) = Lt d; l = - d; M (v c) 0 = Lt r\<rbrakk> \<Longrightarrow> - d < r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- u'' c \<le> d
u'' c < r
goal (1 subgoal):
1. - d < r
[PROOF STEP]
by (metis minus_le_iff neq_iff not_le order.strict_trans)
[PROOF STATE]
proof (state)
this:
- d < r
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l < r
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Lt; ?r14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> ?l14 < ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
note LL = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l14 \<in> S_Min_Lt; ?r14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> ?l14 < ?r14
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
obtain d' where d':
"\<forall> t \<in> S_Min_Le. d' \<ge> t" "\<forall> t \<in> S_Min_Lt. d' > t"
"\<forall> t \<in> S_Max_Le. d' \<le> t" "\<forall> t \<in> S_Max_Lt. d' < t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>d'. \<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> d'; \<forall>t\<in>S_Min_Lt. t < d'; \<forall>t\<in>S_Max_Le. d' \<le> t; \<forall>t\<in>S_Max_Lt. d' < t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (\<And>d'. \<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> d'; \<forall>t\<in>S_Min_Lt. t < d'; \<forall>t\<in>S_Max_Le. d' \<le> t; \<forall>t\<in>S_Max_Lt. d' < t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
assume m:
"\<And>d'. \<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> d'; \<forall>t\<in>S_Min_Lt. t < d'; \<forall>t\<in>S_Max_Le. d' \<le> t; \<forall>t\<in>S_Max_Lt. d' < t\<rbrakk>
\<Longrightarrow> thesis"
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> ?d'12; \<forall>t\<in>S_Min_Lt. t < ?d'12; \<forall>t\<in>S_Max_Le. ?d'12 \<le> t; \<forall>t\<in>S_Max_Lt. ?d'12 < t\<rbrakk> \<Longrightarrow> thesis
goal (1 subgoal):
1. (\<And>d'. \<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> d'; \<forall>t\<in>S_Min_Lt. t < d'; \<forall>t\<in>S_Max_Le. d' \<le> t; \<forall>t\<in>S_Max_Lt. d' < t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?min_le = "Max S_Min_Le"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (\<And>d'. \<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> d'; \<forall>t\<in>S_Min_Lt. t < d'; \<forall>t\<in>S_Max_Le. d' \<le> t; \<forall>t\<in>S_Max_Lt. d' < t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?min_lt = "Max S_Min_Lt"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (\<And>d'. \<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> d'; \<forall>t\<in>S_Min_Lt. t < d'; \<forall>t\<in>S_Max_Le. d' \<le> t; \<forall>t\<in>S_Max_Lt. d' < t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?max_le = "Min S_Max_Le"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (\<And>d'. \<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> d'; \<forall>t\<in>S_Min_Lt. t < d'; \<forall>t\<in>S_Max_Le. d' \<le> t; \<forall>t\<in>S_Max_Lt. d' < t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?max_lt = "Min S_Max_Lt"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (\<And>d'. \<lbrakk>\<forall>t\<in>S_Min_Le. t \<le> d'; \<forall>t\<in>S_Min_Lt. t < d'; \<forall>t\<in>S_Max_Le. d' \<le> t; \<forall>t\<in>S_Max_Lt. d' < t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
proof (cases "S_Min_Le = {} \<and> S_Min_Lt = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Min_Le = {} \<and> S_Min_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Min_Le = {} \<and> S_Min_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S_Min_Le = {} \<and> S_Min_Lt = {}
goal (2 subgoals):
1. S_Min_Le = {} \<and> S_Min_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Min_Le = {} \<and> S_Min_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note T = this
[PROOF STATE]
proof (state)
this:
S_Min_Le = {} \<and> S_Min_Lt = {}
goal (2 subgoals):
1. S_Min_Le = {} \<and> S_Min_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Min_Le = {} \<and> S_Min_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
proof (cases "S_Max_Le = {} \<and> S_Max_Lt = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S_Max_Le = {} \<and> S_Max_Lt = {}
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
let ?d' = "0 :: 't :: time"
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
using True T
[PROOF STATE]
proof (prove)
using this:
S_Max_Le = {} \<and> S_Max_Lt = {}
S_Min_Le = {} \<and> S_Min_Lt = {}
goal (1 subgoal):
1. thesis
[PROOF STEP]
by (intro m[of ?d']) auto
[PROOF STATE]
proof (state)
this:
thesis
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
let ?d =
"if S_Max_Le \<noteq> {}
then if S_Max_Lt \<noteq> {} then min ?max_lt ?max_le else ?max_le
else ?max_lt"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
obtain a :: "'b" where a: "a < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>a. a < (0::'b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using non_trivial_neg
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x < (0::?'a)
goal (1 subgoal):
1. (\<And>a. a < (0::'b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a < (0::'b)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
let ?d' = "min 0 (?d + a)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume "x \<in> S_Max_Le"
[PROOF STATE]
proof (state)
this:
x \<in> S_Max_Le
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
with fin_max_le a
[PROOF STATE]
proof (chain)
picking this:
finite S_Max_Le
a < (0::'b)
x \<in> S_Max_Le
[PROOF STEP]
have "min 0 (Min S_Max_Le + a) \<le> x"
[PROOF STATE]
proof (prove)
using this:
finite S_Max_Le
a < (0::'b)
x \<in> S_Max_Le
goal (1 subgoal):
1. min (0::'b) (Min S_Max_Le + a) \<le> x
[PROOF STEP]
by (metis Min.boundedE add_le_same_cancel1 empty_iff less_imp_le min.coboundedI2)
[PROOF STATE]
proof (state)
this:
min (0::'b) (Min S_Max_Le + a) \<le> x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
min (0::'b) (Min S_Max_Le + a) \<le> x
[PROOF STEP]
have "min 0 (Min S_Max_Le + a) \<le> x"
[PROOF STATE]
proof (prove)
using this:
min (0::'b) (Min S_Max_Le + a) \<le> x
goal (1 subgoal):
1. min (0::'b) (Min S_Max_Le + a) \<le> x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
min (0::'b) (Min S_Max_Le + a) \<le> x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Max_Le \<Longrightarrow> min (0::'b) (Min S_Max_Le + a) \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 1 = this
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Max_Le \<Longrightarrow> min (0::'b) (Min S_Max_Le + a) \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Max_Le \<Longrightarrow> min (0::'b) (Min S_Max_Le + a) \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Max_Lt"
[PROOF STATE]
proof (state)
this:
x \<in> S_Max_Lt
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
have "min 0 (min (Min S_Max_Lt) (Min S_Max_Le) + a) < ?max_lt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < Min S_Max_Lt
[PROOF STEP]
by (meson a add_less_same_cancel1 min.cobounded1 min.strict_coboundedI2 order.strict_trans2)
[PROOF STATE]
proof (state)
this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < Min S_Max_Lt
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < Min S_Max_Lt
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
from fin_max_lt x
[PROOF STATE]
proof (chain)
picking this:
finite S_Max_Lt
x \<in> S_Max_Lt
[PROOF STEP]
have "\<dots> \<le> x"
[PROOF STATE]
proof (prove)
using this:
finite S_Max_Lt
x \<in> S_Max_Lt
goal (1 subgoal):
1. Min S_Max_Lt \<le> x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Min S_Max_Lt \<le> x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < x
[PROOF STEP]
have "min 0 (min (Min S_Max_Lt) (Min S_Max_Le) + a) < x"
[PROOF STATE]
proof (prove)
using this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < x
goal (1 subgoal):
1. min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 2 = this
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Max_Le"
[PROOF STATE]
proof (state)
this:
x \<in> S_Max_Le
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
have "min 0 (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> ?max_le"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> Min S_Max_Le
[PROOF STEP]
by (metis le_add_same_cancel1 linear not_le a min_le_iff_disj)
[PROOF STATE]
proof (state)
this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> Min S_Max_Le
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> Min S_Max_Le
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
from fin_max_le x
[PROOF STATE]
proof (chain)
picking this:
finite S_Max_Le
x \<in> S_Max_Le
[PROOF STEP]
have "\<dots> \<le> x"
[PROOF STATE]
proof (prove)
using this:
finite S_Max_Le
x \<in> S_Max_Le
goal (1 subgoal):
1. Min S_Max_Le \<le> x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Min S_Max_Le \<le> x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> x
[PROOF STEP]
have "min 0 (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> x"
[PROOF STATE]
proof (prove)
using this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> x
goal (1 subgoal):
1. min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Max_Le \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 3 = this
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Max_Le \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
using False T a 1 2 3
[PROOF STATE]
proof (prove)
using this:
\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})
S_Min_Le = {} \<and> S_Min_Lt = {}
a < (0::'b)
?x14 \<in> S_Max_Le \<Longrightarrow> min (0::'b) (Min S_Max_Le + a) \<le> ?x14
?x14 \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) < ?x14
?x14 \<in> S_Max_Le \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min S_Max_Le) + a) \<le> ?x14
goal (1 subgoal):
1. thesis
[PROOF STEP]
proof ((intro m[of ?d']), auto, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>x xa xb. \<lbrakk>a < (0::'b); \<And>x. x \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min {}) + a) < x; S_Min_Le = {}; S_Min_Lt = {}; S_Max_Le = {}; x \<in> S_Max_Lt; \<not> min (0::'b) (Min S_Max_Lt + a) < x; xa \<in> S_Max_Lt; xb \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
a < (0::'b)
?x12 \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min {}) + a) < ?x12
S_Min_Le = {}
S_Min_Lt = {}
S_Max_Le = {}
x_ \<in> S_Max_Lt
\<not> min (0::'b) (Min S_Max_Lt + a) < x_
xa_ \<in> S_Max_Lt
xb_ \<in> S_Max_Lt
goal (1 subgoal):
1. \<And>x xa xb. \<lbrakk>a < (0::'b); \<And>x. x \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min {}) + a) < x; S_Min_Le = {}; S_Min_Lt = {}; S_Max_Le = {}; x \<in> S_Max_Lt; \<not> min (0::'b) (Min S_Max_Lt + a) < x; xa \<in> S_Max_Lt; xb \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < (0::'b)
?x12 \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min {}) + a) < ?x12
S_Min_Le = {}
S_Min_Lt = {}
S_Max_Le = {}
x_ \<in> S_Max_Lt
\<not> min (0::'b) (Min S_Max_Lt + a) < x_
xa_ \<in> S_Max_Lt
xb_ \<in> S_Max_Lt
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a < (0::'b)
?x12 \<in> S_Max_Lt \<Longrightarrow> min (0::'b) (min (Min S_Max_Lt) (Min {}) + a) < ?x12
S_Min_Le = {}
S_Min_Lt = {}
S_Max_Le = {}
x_ \<in> S_Max_Lt
\<not> min (0::'b) (Min S_Max_Lt + a) < x_
xa_ \<in> S_Max_Lt
xb_ \<in> S_Max_Lt
goal (1 subgoal):
1. False
[PROOF STEP]
by (metis Min.in_idem add.commute fin_max_lt leD le_add_same_cancel2 min.orderI
min_less_iff_disj not_less_iff_gr_or_eq)
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis
goal (1 subgoal):
1. \<not> (S_Min_Le = {} \<and> S_Min_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Min_Le = {} \<and> S_Min_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})
goal (1 subgoal):
1. \<not> (S_Min_Le = {} \<and> S_Min_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note F = this
[PROOF STATE]
proof (state)
this:
\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})
goal (1 subgoal):
1. \<not> (S_Min_Le = {} \<and> S_Min_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
proof (cases "S_Max_Le = {} \<and> S_Max_Lt = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S_Max_Le = {} \<and> S_Max_Lt = {}
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
let ?l =
"if S_Min_Le \<noteq> {}
then if S_Min_Lt \<noteq> {} then max ?min_lt ?min_le else ?min_le
else ?min_lt"
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
obtain a :: "'b" where "a < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>a. a < (0::'b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using non_trivial_neg
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x < (0::?'a)
goal (1 subgoal):
1. (\<And>a. a < (0::'b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a < (0::'b)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < (0::'b)
[PROOF STEP]
have a: "-a > 0"
[PROOF STATE]
proof (prove)
using this:
a < (0::'b)
goal (1 subgoal):
1. (0::'b) < - a
[PROOF STEP]
using non_trivial_neg
[PROOF STATE]
proof (prove)
using this:
a < (0::'b)
\<exists>x. x < (0::?'a)
goal (1 subgoal):
1. (0::'b) < - a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'b) < - a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(0::'b) < - a
[PROOF STEP]
obtain a :: "'b" where a: "a > 0"
[PROOF STATE]
proof (prove)
using this:
(0::'b) < - a
goal (1 subgoal):
1. (\<And>a. (0::'b) < a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(0::'b) < a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
let ?d' = "?l + a"
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Min_Le"
[PROOF STATE]
proof (state)
this:
x \<in> S_Min_Le
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S_Min_Le
[PROOF STEP]
have "x \<le> max ?min_lt ?min_le" "x \<le> ?min_le"
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Min_Le
goal (1 subgoal):
1. x \<le> max (Max S_Min_Lt) (Max S_Min_Le) &&& x \<le> Max S_Min_Le
[PROOF STEP]
using fin_min_le
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Min_Le
finite S_Min_Le
goal (1 subgoal):
1. x \<le> max (Max S_Min_Lt) (Max S_Min_Le) &&& x \<le> Max S_Min_Le
[PROOF STEP]
by (simp add: max.coboundedI2)+
[PROOF STATE]
proof (state)
this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le)
x \<le> Max S_Min_Le
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le)
x \<le> Max S_Min_Le
[PROOF STEP]
have "x \<le> max ?min_lt ?min_le + a" "x \<le> ?min_le + a"
[PROOF STATE]
proof (prove)
using this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le)
x \<le> Max S_Min_Le
goal (1 subgoal):
1. x \<le> max (Max S_Min_Lt) (Max S_Min_Le) + a &&& x \<le> Max S_Min_Le + a
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le)
x \<le> Max S_Min_Le
(0::'b) < a
goal (1 subgoal):
1. x \<le> max (Max S_Min_Lt) (Max S_Min_Le) + a &&& x \<le> Max S_Min_Le + a
[PROOF STEP]
by (simp add: add_increasing2)+
[PROOF STATE]
proof (state)
this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le) + a
x \<le> Max S_Min_Le + a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Min_Le \<Longrightarrow> ?x14 \<le> max (Max S_Min_Lt) (Max S_Min_Le) + a
?x14 \<in> S_Min_Le \<Longrightarrow> ?x14 \<le> Max S_Min_Le + a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 1 = this
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Min_Le \<Longrightarrow> ?x14 \<le> max (Max S_Min_Lt) (Max S_Min_Le) + a
?x14 \<in> S_Min_Le \<Longrightarrow> ?x14 \<le> Max S_Min_Le + a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Min_Le \<Longrightarrow> ?x14 \<le> max (Max S_Min_Lt) (Max S_Min_Le) + a
?x14 \<in> S_Min_Le \<Longrightarrow> ?x14 \<le> Max S_Min_Le + a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Min_Lt"
[PROOF STATE]
proof (state)
this:
x \<in> S_Min_Lt
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S_Min_Lt
[PROOF STEP]
have "x \<le> max ?min_lt ?min_le" "x \<le> ?min_lt"
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Min_Lt
goal (1 subgoal):
1. x \<le> max (Max S_Min_Lt) (Max S_Min_Le) &&& x \<le> Max S_Min_Lt
[PROOF STEP]
using fin_min_lt
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Min_Lt
finite S_Min_Lt
goal (1 subgoal):
1. x \<le> max (Max S_Min_Lt) (Max S_Min_Le) &&& x \<le> Max S_Min_Lt
[PROOF STEP]
by (simp add: max.coboundedI1)+
[PROOF STATE]
proof (state)
this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le)
x \<le> Max S_Min_Lt
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le)
x \<le> Max S_Min_Lt
[PROOF STEP]
have "x < ?d'"
[PROOF STATE]
proof (prove)
using this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le)
x \<le> Max S_Min_Lt
goal (1 subgoal):
1. x < (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) + a
[PROOF STEP]
using a x
[PROOF STATE]
proof (prove)
using this:
x \<le> max (Max S_Min_Lt) (Max S_Min_Le)
x \<le> Max S_Min_Lt
(0::'b) < a
x \<in> S_Min_Lt
goal (1 subgoal):
1. x < (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) + a
[PROOF STEP]
by (auto simp add: add.commute add_strict_increasing)
[PROOF STATE]
proof (state)
this:
x < (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) + a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Min_Lt \<Longrightarrow> ?x14 < (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) + a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 2 = this
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Min_Lt \<Longrightarrow> ?x14 < (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) + a
goal (2 subgoals):
1. S_Max_Le = {} \<and> S_Max_Lt = {} \<Longrightarrow> thesis
2. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
using True F a 1 2
[PROOF STATE]
proof (prove)
using this:
S_Max_Le = {} \<and> S_Max_Lt = {}
\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})
(0::'b) < a
?x14 \<in> S_Min_Le \<Longrightarrow> ?x14 \<le> max (Max S_Min_Lt) (Max S_Min_Le) + a
?x14 \<in> S_Min_Le \<Longrightarrow> ?x14 \<le> Max S_Min_Le + a
?x14 \<in> S_Min_Lt \<Longrightarrow> ?x14 < (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) + a
goal (1 subgoal):
1. thesis
[PROOF STEP]
by ((intro m[of ?d']), auto)
[PROOF STATE]
proof (state)
this:
thesis
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
let ?r =
"if S_Max_Le \<noteq> {}
then if S_Max_Lt \<noteq> {} then min ?max_lt ?max_le else ?max_le
else ?max_lt"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
let ?l =
"if S_Min_Le \<noteq> {}
then if S_Min_Lt \<noteq> {} then max ?min_lt ?min_le else ?min_le
else ?min_lt"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
have 1: "x \<le> max ?min_lt ?min_le" "x \<le> ?min_le" if "x \<in> S_Min_Le" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. x \<le> max (Max S_Min_Lt) (Max S_Min_Le) &&& x \<le> Max S_Min_Le
[PROOF STEP]
by (simp add: max.coboundedI2 that fin_min_le)+
[PROOF STATE]
proof (state)
this:
?x12 \<in> S_Min_Le \<Longrightarrow> ?x12 \<le> max (Max S_Min_Lt) (Max S_Min_Le)
?x12 \<in> S_Min_Le \<Longrightarrow> ?x12 \<le> Max S_Min_Le
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?x12 \<in> S_Min_Le \<Longrightarrow> ?x12 \<le> max (Max S_Min_Lt) (Max S_Min_Le)
?x12 \<in> S_Min_Le \<Longrightarrow> ?x12 \<le> Max S_Min_Le
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Max_Le" "y \<in> S_Min_Lt"
[PROOF STATE]
proof (state)
this:
x \<in> S_Max_Le
y \<in> S_Min_Lt
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S_Max_Le
y \<in> S_Min_Lt
[PROOF STEP]
have "S_Min_Lt \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Max_Le
y \<in> S_Min_Lt
goal (1 subgoal):
1. S_Min_Lt \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S_Min_Lt \<noteq> {}
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
from LE[OF Max_in[OF fin_min_lt], OF this, OF x(1)]
[PROOF STATE]
proof (chain)
picking this:
Max S_Min_Lt < x
[PROOF STEP]
have "?min_lt \<le> x"
[PROOF STATE]
proof (prove)
using this:
Max S_Min_Lt < x
goal (1 subgoal):
1. Max S_Min_Lt \<le> x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Lt \<le> x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Le; ?y14 \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 3 = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Le; ?y14 \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Le; ?y14 \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Max_Le" "y \<in> S_Min_Le"
[PROOF STATE]
proof (state)
this:
x \<in> S_Max_Le
y \<in> S_Min_Le
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
with EE[OF Max_in[OF fin_min_le], OF _ x(1)]
[PROOF STATE]
proof (chain)
picking this:
S_Min_Le \<noteq> {} \<Longrightarrow> Max S_Min_Le \<le> x
x \<in> S_Max_Le
y \<in> S_Min_Le
[PROOF STEP]
have "?min_le \<le> x"
[PROOF STATE]
proof (prove)
using this:
S_Min_Le \<noteq> {} \<Longrightarrow> Max S_Min_Le \<le> x
x \<in> S_Max_Le
y \<in> S_Min_Le
goal (1 subgoal):
1. Max S_Min_Le \<le> x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Le \<le> x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Le; ?y14 \<in> S_Min_Le\<rbrakk> \<Longrightarrow> Max S_Min_Le \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 4 = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Le; ?y14 \<in> S_Min_Le\<rbrakk> \<Longrightarrow> Max S_Min_Le \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Le; ?y14 \<in> S_Min_Le\<rbrakk> \<Longrightarrow> Max S_Min_Le \<le> ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Max_Lt" "y \<in> S_Min_Lt"
[PROOF STATE]
proof (state)
this:
x \<in> S_Max_Lt
y \<in> S_Min_Lt
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S_Max_Lt
y \<in> S_Min_Lt
[PROOF STEP]
have "S_Min_Lt \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Max_Lt
y \<in> S_Min_Lt
goal (1 subgoal):
1. S_Min_Lt \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S_Min_Lt \<noteq> {}
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
from LL[OF Max_in[OF fin_min_lt], OF this, OF x(1)]
[PROOF STATE]
proof (chain)
picking this:
Max S_Min_Lt < x
[PROOF STEP]
have "?min_lt < x"
[PROOF STATE]
proof (prove)
using this:
Max S_Min_Lt < x
goal (1 subgoal):
1. Max S_Min_Lt < x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Lt < x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Lt; ?y14 \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 5 = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Lt; ?y14 \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Lt; ?y14 \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Max_Lt" "y \<in> S_Min_Le"
[PROOF STATE]
proof (state)
this:
x \<in> S_Max_Lt
y \<in> S_Min_Le
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S_Max_Lt
y \<in> S_Min_Le
[PROOF STEP]
have "S_Min_Le \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Max_Lt
y \<in> S_Min_Le
goal (1 subgoal):
1. S_Min_Le \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S_Min_Le \<noteq> {}
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
from EL[OF Max_in[OF fin_min_le], OF this, OF x(1)]
[PROOF STATE]
proof (chain)
picking this:
Max S_Min_Le < x
[PROOF STEP]
have "?min_le < x"
[PROOF STATE]
proof (prove)
using this:
Max S_Min_Le < x
goal (1 subgoal):
1. Max S_Min_Le < x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Le < x
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Lt; ?y14 \<in> S_Min_Le\<rbrakk> \<Longrightarrow> Max S_Min_Le < ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
note 6 = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Max_Lt; ?y14 \<in> S_Min_Le\<rbrakk> \<Longrightarrow> Max S_Min_Le < ?x14
goal (1 subgoal):
1. \<not> (S_Max_Le = {} \<and> S_Max_Lt = {}) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
proof (cases "?l < ?r")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
[PROOF STEP]
have *: "S_Max_Le \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (1 subgoal):
1. S_Max_Le \<noteq> {}
[PROOF STEP]
proof (auto, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with \<open>\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
[PROOF STEP]
obtain y where y:"y \<in> S_Max_Lt"
[PROOF STATE]
proof (prove)
using this:
\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
goal (1 subgoal):
1. (\<And>y. y \<in> S_Max_Lt \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
note 1 = 1 this
[PROOF STATE]
proof (state)
this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
y \<in> S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
y \<in> S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume A: "x \<in> S_Min_Le" "y \<in> S_Max_Lt"
[PROOF STATE]
proof (state)
this:
x \<in> S_Min_Le
y \<in> S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with EL[OF Max_in[OF fin_min_le] Min_in[OF fin_max_lt]]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>S_Min_Le \<noteq> {}; S_Max_Lt \<noteq> {}\<rbrakk> \<Longrightarrow> Max S_Min_Le < Min S_Max_Lt
x \<in> S_Min_Le
y \<in> S_Max_Lt
[PROOF STEP]
have "Max S_Min_Le < Min S_Max_Lt"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>S_Min_Le \<noteq> {}; S_Max_Lt \<noteq> {}\<rbrakk> \<Longrightarrow> Max S_Min_Le < Min S_Max_Lt
x \<in> S_Min_Le
y \<in> S_Max_Lt
goal (1 subgoal):
1. Max S_Min_Le < Min S_Max_Lt
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Le < Min S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Le; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Le < Min S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
note ** = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Le; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Le < Min S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Le; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Le < Min S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume A: "x \<in> S_Min_Lt" "y \<in> S_Max_Lt"
[PROOF STATE]
proof (state)
this:
x \<in> S_Min_Lt
y \<in> S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with LL[OF Max_in[OF fin_min_lt] Min_in[OF fin_max_lt]]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>S_Min_Lt \<noteq> {}; S_Max_Lt \<noteq> {}\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
x \<in> S_Min_Lt
y \<in> S_Max_Lt
[PROOF STEP]
have "Max S_Min_Lt < Min S_Max_Lt"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>S_Min_Lt \<noteq> {}; S_Max_Lt \<noteq> {}\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
x \<in> S_Min_Lt
y \<in> S_Max_Lt
goal (1 subgoal):
1. Max S_Min_Lt < Min S_Max_Lt
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Lt < Min S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Lt; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
note *** = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Lt; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
goal (1 subgoal):
1. \<lbrakk>\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt; S_Max_Le = {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. False
[PROOF STEP]
proof (cases "S_Min_Le \<noteq> {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Min_Le \<noteq> {} \<Longrightarrow> False
2. \<not> S_Min_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S_Min_Le \<noteq> {}
goal (2 subgoals):
1. S_Min_Le \<noteq> {} \<Longrightarrow> False
2. \<not> S_Min_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
note T = this
[PROOF STATE]
proof (state)
this:
S_Min_Le \<noteq> {}
goal (2 subgoals):
1. S_Min_Le \<noteq> {} \<Longrightarrow> False
2. \<not> S_Min_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. False
[PROOF STEP]
proof (cases "S_Min_Lt \<noteq> {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Min_Lt \<noteq> {} \<Longrightarrow> False
2. \<not> S_Min_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S_Min_Lt \<noteq> {}
goal (2 subgoals):
1. S_Min_Lt \<noteq> {} \<Longrightarrow> False
2. \<not> S_Min_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S_Min_Lt \<noteq> {}
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
S_Min_Lt \<noteq> {}
goal (1 subgoal):
1. False
[PROOF STEP]
using 1 T True ** ***
[PROOF STATE]
proof (prove)
using this:
S_Min_Lt \<noteq> {}
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
y \<in> S_Max_Lt
S_Min_Le \<noteq> {}
S_Min_Lt \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Le; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Le < Min S_Max_Lt
\<lbrakk>?x14 \<in> S_Min_Lt; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal (1 subgoal):
1. \<not> S_Min_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> S_Min_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> S_Min_Lt \<noteq> {}
goal (1 subgoal):
1. \<not> S_Min_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
with 1 T **
[PROOF STATE]
proof (chain)
picking this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
y \<in> S_Max_Lt
S_Min_Le \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Le; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Le < Min S_Max_Lt
\<not> S_Min_Lt \<noteq> {}
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
y \<in> S_Max_Lt
S_Min_Le \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Le; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Le < Min S_Max_Lt
\<not> S_Min_Lt \<noteq> {}
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
False
goal (1 subgoal):
1. \<not> S_Min_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> S_Min_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> S_Min_Le \<noteq> {}
goal (1 subgoal):
1. \<not> S_Min_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
with 1 False *** \<open>\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
y \<in> S_Max_Lt
\<not> S_Min_Le \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Lt; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})
\<not> S_Min_Le \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < Min S_Max_Lt
S_Max_Le = {}
y \<in> S_Max_Lt
\<not> S_Min_Le \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Lt; ?ya14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})
\<not> S_Min_Le \<noteq> {}
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
S_Max_Le \<noteq> {}
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
S_Max_Le \<noteq> {}
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
assume A: "x \<in> S_Min_Lt" "y \<in> S_Max_Lt"
[PROOF STATE]
proof (state)
this:
x \<in> S_Min_Lt
y \<in> S_Max_Lt
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
with LL[OF Max_in[OF fin_min_lt] Min_in[OF fin_max_lt]]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>S_Min_Lt \<noteq> {}; S_Max_Lt \<noteq> {}\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
x \<in> S_Min_Lt
y \<in> S_Max_Lt
[PROOF STEP]
have "Max S_Min_Lt < Min S_Max_Lt"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>S_Min_Lt \<noteq> {}; S_Max_Lt \<noteq> {}\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
x \<in> S_Min_Lt
y \<in> S_Max_Lt
goal (1 subgoal):
1. Max S_Min_Lt < Min S_Max_Lt
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Lt < Min S_Max_Lt
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
note *** = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
assume A: "x \<in> S_Min_Lt" "y \<in> S_Max_Le"
[PROOF STATE]
proof (state)
this:
x \<in> S_Min_Lt
y \<in> S_Max_Le
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
with LE[OF Max_in[OF fin_min_lt] Min_in[OF fin_max_le]]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>S_Min_Lt \<noteq> {}; S_Max_Le \<noteq> {}\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Le
x \<in> S_Min_Lt
y \<in> S_Max_Le
[PROOF STEP]
have "Max S_Min_Lt < Min S_Max_Le"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>S_Min_Lt \<noteq> {}; S_Max_Le \<noteq> {}\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Le
x \<in> S_Min_Lt
y \<in> S_Max_Le
goal (1 subgoal):
1. Max S_Min_Lt < Min S_Max_Le
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Lt < Min S_Max_Le
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Le
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
note **** = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Le
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
from F False
[PROOF STATE]
proof (chain)
picking this:
\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
[PROOF STEP]
have **: "S_Min_Le \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (1 subgoal):
1. S_Min_Le \<noteq> {}
[PROOF STEP]
proof (auto, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<not> Max S_Min_Lt < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt); S_Min_Le = {}; x \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
\<not> Max S_Min_Lt < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
S_Min_Le = {}
x_ \<in> S_Min_Lt
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<not> Max S_Min_Lt < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt); S_Min_Le = {}; x \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. False
[PROOF STEP]
proof (cases "S_Max_Le \<noteq> {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Le \<noteq> {} \<Longrightarrow> False
2. \<not> S_Max_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S_Max_Le \<noteq> {}
goal (2 subgoals):
1. S_Max_Le \<noteq> {} \<Longrightarrow> False
2. \<not> S_Max_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
note T = this
[PROOF STATE]
proof (state)
this:
S_Max_Le \<noteq> {}
goal (2 subgoals):
1. S_Max_Le \<noteq> {} \<Longrightarrow> False
2. \<not> S_Max_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. False
[PROOF STEP]
proof (cases "S_Max_Lt \<noteq> {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Lt \<noteq> {} \<Longrightarrow> False
2. \<not> S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S_Max_Lt \<noteq> {}
goal (2 subgoals):
1. S_Max_Lt \<noteq> {} \<Longrightarrow> False
2. \<not> S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S_Max_Lt \<noteq> {}
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
S_Max_Lt \<noteq> {}
goal (1 subgoal):
1. False
[PROOF STEP]
using 1 T True **** ***
[PROOF STATE]
proof (prove)
using this:
S_Max_Lt \<noteq> {}
\<not> Max S_Min_Lt < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
S_Min_Le = {}
x_ \<in> S_Min_Lt
S_Max_Le \<noteq> {}
S_Max_Lt \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Le
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal (1 subgoal):
1. \<not> S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> S_Max_Lt \<noteq> {}
goal (1 subgoal):
1. \<not> S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
with 1 T ****
[PROOF STATE]
proof (chain)
picking this:
\<not> Max S_Min_Lt < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
S_Min_Le = {}
x_ \<in> S_Min_Lt
S_Max_Le \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Le
\<not> S_Max_Lt \<noteq> {}
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> Max S_Min_Lt < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
S_Min_Le = {}
x_ \<in> S_Min_Lt
S_Max_Le \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Le\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Le
\<not> S_Max_Lt \<noteq> {}
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
False
goal (1 subgoal):
1. \<not> S_Max_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> S_Max_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> S_Max_Le \<noteq> {}
goal (1 subgoal):
1. \<not> S_Max_Le \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
with 1 False *** \<open>\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> Max S_Min_Lt < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
S_Min_Le = {}
x_ \<in> S_Min_Lt
\<not> S_Max_Le \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})
\<not> S_Max_Le \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> Max S_Min_Lt < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
S_Min_Le = {}
x_ \<in> S_Min_Lt
\<not> S_Max_Le \<noteq> {}
\<lbrakk>?x14 \<in> S_Min_Lt; ?y14 \<in> S_Max_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
\<not> (S_Max_Le = {} \<and> S_Max_Lt = {})
\<not> S_Max_Le \<noteq> {}
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
S_Min_Le \<noteq> {}
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
S_Min_Le \<noteq> {}
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
assume x: "x \<in> S_Min_Lt"
[PROOF STATE]
proof (state)
this:
x \<in> S_Min_Lt
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S_Min_Lt
[PROOF STEP]
have "x \<le> ?min_lt"
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Min_Lt
goal (1 subgoal):
1. x \<le> Max S_Min_Lt
[PROOF STEP]
using fin_min_lt
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Min_Lt
finite S_Min_Lt
goal (1 subgoal):
1. x \<le> Max S_Min_Lt
[PROOF STEP]
by (simp add: max.coboundedI2)
[PROOF STATE]
proof (state)
this:
x \<le> Max S_Min_Lt
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<le> Max S_Min_Lt
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
have "?min_lt < ?min_le"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Max S_Min_Lt < Max S_Min_Le
[PROOF STEP]
proof (rule ccontr, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<not> Max S_Min_Lt < Max S_Min_Le \<Longrightarrow> False
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
\<not> Max S_Min_Lt < Max S_Min_Le
goal (1 subgoal):
1. \<not> Max S_Min_Lt < Max S_Min_Le \<Longrightarrow> False
[PROOF STEP]
with x **
[PROOF STATE]
proof (chain)
picking this:
x \<in> S_Min_Lt
S_Min_Le \<noteq> {}
\<not> Max S_Min_Lt < Max S_Min_Le
[PROOF STEP]
have 1: "?l = ?min_lt"
[PROOF STATE]
proof (prove)
using this:
x \<in> S_Min_Lt
S_Min_Le \<noteq> {}
\<not> Max S_Min_Lt < Max S_Min_Le
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) = Max S_Min_Lt
[PROOF STEP]
by (auto simp: max.absorb1)
[PROOF STATE]
proof (state)
this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) = Max S_Min_Lt
goal (1 subgoal):
1. \<not> Max S_Min_Lt < Max S_Min_Le \<Longrightarrow> False
[PROOF STEP]
have 2: "?min_lt < ?max_le"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Max S_Min_Lt < Min S_Max_Le
[PROOF STEP]
using * ****[OF x]
[PROOF STATE]
proof (prove)
using this:
S_Max_Le \<noteq> {}
?y14 \<in> S_Max_Le \<Longrightarrow> Max S_Min_Lt < Min S_Max_Le
goal (1 subgoal):
1. Max S_Min_Lt < Min S_Max_Le
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Lt < Min S_Max_Le
goal (1 subgoal):
1. \<not> Max S_Min_Lt < Max S_Min_Le \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. False
[PROOF STEP]
proof (cases "S_Max_Lt = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. S_Max_Lt = {} \<Longrightarrow> False
2. S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S_Max_Lt \<noteq> {}
goal (2 subgoals):
1. S_Max_Lt = {} \<Longrightarrow> False
2. S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S_Max_Lt \<noteq> {}
[PROOF STEP]
have "?min_lt < ?max_lt"
[PROOF STATE]
proof (prove)
using this:
S_Max_Lt \<noteq> {}
goal (1 subgoal):
1. Max S_Min_Lt < Min S_Max_Lt
[PROOF STEP]
using * ***[OF x]
[PROOF STATE]
proof (prove)
using this:
S_Max_Lt \<noteq> {}
S_Max_Le \<noteq> {}
?y14 \<in> S_Max_Lt \<Longrightarrow> Max S_Min_Lt < Min S_Max_Lt
goal (1 subgoal):
1. Max S_Min_Lt < Min S_Max_Lt
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max S_Min_Lt < Min S_Max_Lt
goal (2 subgoals):
1. S_Max_Lt = {} \<Longrightarrow> False
2. S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
with 1 2
[PROOF STATE]
proof (chain)
picking this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) = Max S_Min_Lt
Max S_Min_Lt < Min S_Max_Le
Max S_Min_Lt < Min S_Max_Lt
[PROOF STEP]
have "?l < ?r"
[PROOF STATE]
proof (prove)
using this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) = Max S_Min_Lt
Max S_Min_Lt < Min S_Max_Le
Max S_Min_Lt < Min S_Max_Lt
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (2 subgoals):
1. S_Max_Lt = {} \<Longrightarrow> False
2. S_Max_Lt \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
with \<open>\<not> ?l < ?r\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal (1 subgoal):
1. S_Max_Lt = {} \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. S_Max_Lt = {} \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S_Max_Lt = {}
goal (1 subgoal):
1. S_Max_Lt = {} \<Longrightarrow> False
[PROOF STEP]
with 1 2
[PROOF STATE]
proof (chain)
picking this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) = Max S_Min_Lt
Max S_Min_Lt < Min S_Max_Le
S_Max_Lt = {}
[PROOF STEP]
have "?l < ?r"
[PROOF STATE]
proof (prove)
using this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) = Max S_Min_Lt
Max S_Min_Lt < Min S_Max_Le
S_Max_Lt = {}
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (1 subgoal):
1. S_Max_Lt = {} \<Longrightarrow> False
[PROOF STEP]
with \<open>\<not> ?l < ?r\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Max S_Min_Lt < Max S_Min_Le
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x < Max S_Min_Le
[PROOF STEP]
have "x < max ?min_lt ?min_le"
[PROOF STATE]
proof (prove)
using this:
x < Max S_Min_Le
goal (1 subgoal):
1. x < max (Max S_Min_Lt) (Max S_Min_Le)
[PROOF STEP]
by (simp add: max.strict_coboundedI2)
[PROOF STATE]
proof (state)
this:
x < max (Max S_Min_Lt) (Max S_Min_Le)
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Min_Lt \<Longrightarrow> ?x14 < max (Max S_Min_Lt) (Max S_Min_Le)
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
note 2 = this
[PROOF STATE]
proof (state)
this:
?x14 \<in> S_Min_Lt \<Longrightarrow> ?x14 < max (Max S_Min_Lt) (Max S_Min_Le)
goal (2 subgoals):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
2. \<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
using F False 1 2 3 4 5 6 * **
[PROOF STATE]
proof (prove)
using this:
\<not> (S_Min_Le = {} \<and> S_Min_Lt = {})
\<not> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
?x12 \<in> S_Min_Le \<Longrightarrow> ?x12 \<le> max (Max S_Min_Lt) (Max S_Min_Le)
?x12 \<in> S_Min_Le \<Longrightarrow> ?x12 \<le> Max S_Min_Le
?x14 \<in> S_Min_Lt \<Longrightarrow> ?x14 < max (Max S_Min_Lt) (Max S_Min_Le)
\<lbrakk>?x14 \<in> S_Max_Le; ?y14 \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt \<le> ?x14
\<lbrakk>?x14 \<in> S_Max_Le; ?y14 \<in> S_Min_Le\<rbrakk> \<Longrightarrow> Max S_Min_Le \<le> ?x14
\<lbrakk>?x14 \<in> S_Max_Lt; ?y14 \<in> S_Min_Lt\<rbrakk> \<Longrightarrow> Max S_Min_Lt < ?x14
\<lbrakk>?x14 \<in> S_Max_Lt; ?y14 \<in> S_Min_Le\<rbrakk> \<Longrightarrow> Max S_Min_Le < ?x14
S_Max_Le \<noteq> {}
S_Min_Le \<noteq> {}
goal (1 subgoal):
1. thesis
[PROOF STEP]
by ((intro m[of ?l]), auto)
[PROOF STATE]
proof (state)
this:
thesis
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
[PROOF STEP]
obtain d where d: "?l < d" "d < ?r"
[PROOF STATE]
proof (prove)
using this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (1 subgoal):
1. (\<And>d. \<lbrakk>(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d; d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using dense
[PROOF STATE]
proof (prove)
using this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
?x < ?y \<Longrightarrow> \<exists>z>?x. z < ?y
goal (1 subgoal):
1. (\<And>d. \<lbrakk>(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d; d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
let ?d' = "d"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
assume "t \<in> S_Min_Le"
[PROOF STATE]
proof (state)
this:
t \<in> S_Min_Le
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> S_Min_Le
[PROOF STEP]
have "t \<le> ?l"
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Min_Le
goal (1 subgoal):
1. t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Min_Le
?x12 \<in> S_Min_Le \<Longrightarrow> ?x12 \<le> max (Max S_Min_Lt) (Max S_Min_Le)
?x12 \<in> S_Min_Le \<Longrightarrow> ?x12 \<le> Max S_Min_Le
goal (1 subgoal):
1. t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
with d
[PROOF STATE]
proof (chain)
picking this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
[PROOF STEP]
have "t \<le> d"
[PROOF STATE]
proof (prove)
using this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
goal (1 subgoal):
1. t \<le> d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<le> d
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Min_Le \<Longrightarrow> ?t14 \<le> d
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Min_Le \<Longrightarrow> ?t14 \<le> d
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Min_Le \<Longrightarrow> ?t14 \<le> d
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
assume t: "t \<in> S_Min_Lt"
[PROOF STATE]
proof (state)
this:
t \<in> S_Min_Lt
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> S_Min_Lt
[PROOF STEP]
have "t \<le> max ?min_lt ?min_le"
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Min_Lt
goal (1 subgoal):
1. t \<le> max (Max S_Min_Lt) (Max S_Min_Le)
[PROOF STEP]
using fin_min_lt
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Min_Lt
finite S_Min_Lt
goal (1 subgoal):
1. t \<le> max (Max S_Min_Lt) (Max S_Min_Le)
[PROOF STEP]
by (simp add: max.coboundedI1)
[PROOF STATE]
proof (state)
this:
t \<le> max (Max S_Min_Lt) (Max S_Min_Le)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
with t
[PROOF STATE]
proof (chain)
picking this:
t \<in> S_Min_Lt
t \<le> max (Max S_Min_Lt) (Max S_Min_Le)
[PROOF STEP]
have "t \<le> ?l"
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Min_Lt
t \<le> max (Max S_Min_Lt) (Max S_Min_Le)
goal (1 subgoal):
1. t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
[PROOF STEP]
using fin_min_lt
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Min_Lt
t \<le> max (Max S_Min_Lt) (Max S_Min_Le)
finite S_Min_Lt
goal (1 subgoal):
1. t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
with d
[PROOF STATE]
proof (chain)
picking this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
[PROOF STEP]
have "t < d"
[PROOF STATE]
proof (prove)
using this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
t \<le> (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt)
goal (1 subgoal):
1. t < d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t < d
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Min_Lt \<Longrightarrow> ?t14 < d
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Min_Lt \<Longrightarrow> ?t14 < d
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Min_Lt \<Longrightarrow> ?t14 < d
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
assume t: "t \<in> S_Max_Le"
[PROOF STATE]
proof (state)
this:
t \<in> S_Max_Le
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> S_Max_Le
[PROOF STEP]
have "min ?max_lt ?max_le \<le> t"
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Max_Le
goal (1 subgoal):
1. min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
[PROOF STEP]
using fin_max_le
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Max_Le
finite S_Max_Le
goal (1 subgoal):
1. min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
[PROOF STEP]
by (simp add: min.coboundedI2)
[PROOF STATE]
proof (state)
this:
min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
[PROOF STEP]
have "?r \<le> t"
[PROOF STATE]
proof (prove)
using this:
min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
goal (1 subgoal):
1. (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
[PROOF STEP]
using fin_max_le t
[PROOF STATE]
proof (prove)
using this:
min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
finite S_Max_Le
t \<in> S_Max_Le
goal (1 subgoal):
1. (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
with d
[PROOF STATE]
proof (chain)
picking this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
(if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
[PROOF STEP]
have "d \<le> t"
[PROOF STATE]
proof (prove)
using this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
(if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
goal (1 subgoal):
1. d \<le> t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d \<le> t
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d \<le> t
[PROOF STEP]
have "d \<le> t"
[PROOF STATE]
proof (prove)
using this:
d \<le> t
goal (1 subgoal):
1. d \<le> t
[PROOF STEP]
by (simp add: min.coboundedI2)
[PROOF STATE]
proof (state)
this:
d \<le> t
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Max_Le \<Longrightarrow> d \<le> ?t14
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Max_Le \<Longrightarrow> d \<le> ?t14
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Max_Le \<Longrightarrow> d \<le> ?t14
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
assume t: "t \<in> S_Max_Lt"
[PROOF STATE]
proof (state)
this:
t \<in> S_Max_Lt
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> S_Max_Lt
[PROOF STEP]
have "min ?max_lt ?max_le \<le> t"
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Max_Lt
goal (1 subgoal):
1. min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
[PROOF STEP]
using fin_max_lt
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Max_Lt
finite S_Max_Lt
goal (1 subgoal):
1. min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
[PROOF STEP]
by (simp add: min.coboundedI1)
[PROOF STATE]
proof (state)
this:
min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
[PROOF STEP]
have "?r \<le> t"
[PROOF STATE]
proof (prove)
using this:
min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
goal (1 subgoal):
1. (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
[PROOF STEP]
using fin_max_lt t
[PROOF STATE]
proof (prove)
using this:
min (Min S_Max_Lt) (Min S_Max_Le) \<le> t
finite S_Max_Lt
t \<in> S_Max_Lt
goal (1 subgoal):
1. (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
with d
[PROOF STATE]
proof (chain)
picking this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
(if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
[PROOF STEP]
have "d < t"
[PROOF STATE]
proof (prove)
using this:
(if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < d
d < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt)
(if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<le> t
goal (1 subgoal):
1. d < t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d < t
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d < t
[PROOF STEP]
have "d < t"
[PROOF STATE]
proof (prove)
using this:
d < t
goal (1 subgoal):
1. d < t
[PROOF STEP]
by (simp add: min.strict_coboundedI2)
[PROOF STATE]
proof (state)
this:
d < t
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?t14 \<in> S_Max_Lt \<Longrightarrow> d < ?t14
goal (1 subgoal):
1. (if S_Min_Le \<noteq> {} then if S_Min_Lt \<noteq> {} then max (Max S_Min_Lt) (Max S_Min_Le) else Max S_Min_Le else Max S_Min_Lt) < (if S_Max_Le \<noteq> {} then if S_Max_Lt \<noteq> {} then min (Min S_Max_Lt) (Min S_Max_Le) else Min S_Max_Le else Min S_Max_Lt) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?t14 \<in> S_Min_Le \<Longrightarrow> ?t14 \<le> d
?t14 \<in> S_Min_Lt \<Longrightarrow> ?t14 < d
?t14 \<in> S_Max_Le \<Longrightarrow> d \<le> ?t14
?t14 \<in> S_Max_Lt \<Longrightarrow> d < ?t14
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
?t14 \<in> S_Min_Le \<Longrightarrow> ?t14 \<le> d
?t14 \<in> S_Min_Lt \<Longrightarrow> ?t14 < d
?t14 \<in> S_Max_Le \<Longrightarrow> d \<le> ?t14
?t14 \<in> S_Max_Lt \<Longrightarrow> d < ?t14
goal (1 subgoal):
1. thesis
[PROOF STEP]
by ((intro m[of ?d']), auto)
[PROOF STATE]
proof (state)
this:
thesis
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "DBM_val_bounded v (u(c := d')) M n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2)))
[PROOF STEP]
proof (auto, goal_cases)
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. Le (0::'b) \<preceq> M 0 0
2. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some ca) (M 0 (v ca))
3. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)
4. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
goal (4 subgoals):
1. Le (0::'b) \<preceq> M 0 0
2. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some ca) (M 0 (v ca))
3. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)
4. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. Le (0::'b) \<preceq> M 0 0
[PROOF STEP]
unfolding DBM_reset_def DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
goal (1 subgoal):
1. Le (0::'b) \<preceq> M 0 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Le (0::'b) \<preceq> M 0 0
goal (3 subgoals):
1. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some ca) (M 0 (v ca))
2. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)
3. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some ca) (M 0 (v ca))
2. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)
3. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case (2 c')
[PROOF STATE]
proof (state)
this:
v c' \<le> n
goal (3 subgoals):
1. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some ca) (M 0 (v ca))
2. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)
3. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
proof (cases "c = c'")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> c'
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
with A(2,7)
[PROOF STATE]
proof (chain)
picking this:
v c \<le> n
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
c \<noteq> c'
[PROOF STEP]
have "v c \<noteq> v c'"
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
c \<noteq> c'
goal (1 subgoal):
1. v c \<noteq> v c'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v c \<noteq> v c'
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
hence *:"M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))"
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c'
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
using A(2,3,6,7) 2
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c'
v c \<le> n
DBM_reset M n (v c) d M'
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c' \<le> n
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c'
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c' \<le> n
goal (1 subgoal):
1. M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
from 2 A(2,4)
[PROOF STATE]
proof (chain)
picking this:
v c' \<le> n
v c \<le> n
u \<turnstile>\<^bsub>v,n\<^esub> M'
[PROOF STEP]
have "dbm_entry_val u None (Some c') (M' 0 (v c'))"
[PROOF STATE]
proof (prove)
using this:
v c' \<le> n
v c \<le> n
u \<turnstile>\<^bsub>v,n\<^esub> M'
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
v c' \<le> n
v c \<le> n
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
with dbm_entry_dbm_min2 *
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val ?u None (Some ?c) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u None (Some ?c) ?b
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
[PROOF STEP]
have "dbm_entry_val u None (Some c') (M 0 (v c'))"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val ?u None (Some ?c) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u None (Some ?c) ?b
M' 0 (v c') = min (dbm_add (M 0 (v c)) (M (v c) (v c'))) (M 0 (v c'))
dbm_entry_val u None (Some c') (M' 0 (v c'))
goal (1 subgoal):
1. dbm_entry_val u None (Some c') (M 0 (v c'))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u None (Some c') (M 0 (v c'))
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u None (Some c') (M 0 (v c'))
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u None (Some c') (M 0 (v c'))
c \<noteq> c'
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
goal (1 subgoal):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = c'
goal (1 subgoal):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
[PROOF STEP]
proof (simp add: True[symmetric], cases "M 0 (v c)", goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>x1. M 0 (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
3. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
case (1 t)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Le t
goal (3 subgoals):
1. \<And>x1. M 0 (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
3. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
hence "-t \<in> S_Min_Le"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Le t
goal (1 subgoal):
1. - t \<in> S_Min_Le
[PROOF STEP]
unfolding S_Min_Le
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Le t
goal (1 subgoal):
1. - t \<in> {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Le d} \<union> {- d |d. M 0 (v c) = Le d}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
- t \<in> S_Min_Le
goal (3 subgoals):
1. \<And>x1. M 0 (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
3. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
hence "d' \<ge> -t"
[PROOF STATE]
proof (prove)
using this:
- t \<in> S_Min_Le
goal (1 subgoal):
1. - t \<le> d'
[PROOF STEP]
using d'
[PROOF STATE]
proof (prove)
using this:
- t \<in> S_Min_Le
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. - t \<le> d'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- t \<le> d'
goal (3 subgoals):
1. \<And>x1. M 0 (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
3. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- t \<le> d'
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
- t \<le> d'
M 0 (v c) = Le t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
by (auto simp: minus_le_iff)
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
goal (2 subgoals):
1. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
case (2 t)
[PROOF STATE]
proof (state)
this:
M 0 (v c) = Lt t
goal (2 subgoals):
1. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
hence "-t \<in> S_Min_Lt"
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Lt t
goal (1 subgoal):
1. - t \<in> S_Min_Lt
[PROOF STEP]
unfolding S_Min_Lt
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = Lt t
goal (1 subgoal):
1. - t \<in> {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Lt d} \<union> {- d |d. M 0 (v c) = Lt d}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
- t \<in> S_Min_Lt
goal (2 subgoals):
1. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
hence "d' > -t"
[PROOF STATE]
proof (prove)
using this:
- t \<in> S_Min_Lt
goal (1 subgoal):
1. - t < d'
[PROOF STEP]
using d'
[PROOF STATE]
proof (prove)
using this:
- t \<in> S_Min_Lt
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. - t < d'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- t < d'
goal (2 subgoals):
1. \<And>x2. M 0 (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
2. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- t < d'
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
- t < d'
M 0 (v c) = Lt t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
by (auto simp: minus_less_iff)
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
goal (1 subgoal):
1. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
case 3
[PROOF STATE]
proof (state)
this:
M 0 (v c) = \<infinity>
goal (1 subgoal):
1. M 0 (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
M 0 (v c) = \<infinity>
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) None (Some c) (M 0 (v c))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) None (Some c') (M 0 (v c'))
goal (2 subgoals):
1. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)
2. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)
2. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case (3 c')
[PROOF STATE]
proof (state)
this:
v c' \<le> n
goal (2 subgoals):
1. \<And>ca. v ca \<le> n \<Longrightarrow> dbm_entry_val (u(c := d')) (Some ca) None (M (v ca) 0)
2. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
proof (cases "c = c'")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> c'
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
with A(2,7)
[PROOF STATE]
proof (chain)
picking this:
v c \<le> n
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
c \<noteq> c'
[PROOF STEP]
have "v c \<noteq> v c'"
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
c \<noteq> c'
goal (1 subgoal):
1. v c \<noteq> v c'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v c \<noteq> v c'
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
hence *:"M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)"
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c'
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
using A(2,3,6,7) 3
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c'
v c \<le> n
DBM_reset M n (v c) d M'
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c' \<le> n
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c'
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c' \<le> n
goal (1 subgoal):
1. M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
from 3 A(2,4)
[PROOF STATE]
proof (chain)
picking this:
v c' \<le> n
v c \<le> n
u \<turnstile>\<^bsub>v,n\<^esub> M'
[PROOF STEP]
have "dbm_entry_val u (Some c') None (M' (v c') 0)"
[PROOF STATE]
proof (prove)
using this:
v c' \<le> n
v c \<le> n
u \<turnstile>\<^bsub>v,n\<^esub> M'
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
v c' \<le> n
v c \<le> n
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
with dbm_entry_dbm_min3 *
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val ?u (Some ?c) None (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c) None ?b
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
[PROOF STEP]
have "dbm_entry_val u (Some c') None (M (v c') 0)"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val ?u (Some ?c) None (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c) None ?b
M' (v c') 0 = min (dbm_add (M (v c') (v c)) (M (v c) 0)) (M (v c') 0)
dbm_entry_val u (Some c') None (M' (v c') 0)
goal (1 subgoal):
1. dbm_entry_val u (Some c') None (M (v c') 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c') None (M (v c') 0)
goal (2 subgoals):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
2. c \<noteq> c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c') None (M (v c') 0)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c') None (M (v c') 0)
c \<noteq> c'
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
goal (1 subgoal):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = c'
goal (1 subgoal):
1. c = c' \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
[PROOF STEP]
proof (simp add: True[symmetric], cases "M (v c) 0", goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>x1. M (v c) 0 = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
3. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
case (1 t)
[PROOF STATE]
proof (state)
this:
M (v c) 0 = Le t
goal (3 subgoals):
1. \<And>x1. M (v c) 0 = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
3. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
hence "t \<in> S_Max_Le"
[PROOF STATE]
proof (prove)
using this:
M (v c) 0 = Le t
goal (1 subgoal):
1. t \<in> S_Max_Le
[PROOF STEP]
unfolding S_Max_Le
[PROOF STATE]
proof (prove)
using this:
M (v c) 0 = Le t
goal (1 subgoal):
1. t \<in> {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Le d} \<union> {d |d. M (v c) 0 = Le d}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
t \<in> S_Max_Le
goal (3 subgoals):
1. \<And>x1. M (v c) 0 = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
3. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
hence "d' \<le> t"
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Max_Le
goal (1 subgoal):
1. d' \<le> t
[PROOF STEP]
using d'
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Max_Le
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. d' \<le> t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d' \<le> t
goal (3 subgoals):
1. \<And>x1. M (v c) 0 = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
3. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
d' \<le> t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
d' \<le> t
M (v c) 0 = Le t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
by (auto simp: minus_le_iff)
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
goal (2 subgoals):
1. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
case (2 t)
[PROOF STATE]
proof (state)
this:
M (v c) 0 = Lt t
goal (2 subgoals):
1. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
hence "t \<in> S_Max_Lt"
[PROOF STATE]
proof (prove)
using this:
M (v c) 0 = Lt t
goal (1 subgoal):
1. t \<in> S_Max_Lt
[PROOF STEP]
unfolding S_Max_Lt
[PROOF STATE]
proof (prove)
using this:
M (v c) 0 = Lt t
goal (1 subgoal):
1. t \<in> {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Lt d} \<union> {d |d. M (v c) 0 = Lt d}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
t \<in> S_Max_Lt
goal (2 subgoals):
1. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
hence "d' < t"
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Max_Lt
goal (1 subgoal):
1. d' < t
[PROOF STEP]
using d'
[PROOF STATE]
proof (prove)
using this:
t \<in> S_Max_Lt
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. d' < t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d' < t
goal (2 subgoals):
1. \<And>x2. M (v c) 0 = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
2. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
d' < t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
d' < t
M (v c) 0 = Lt t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
by (auto simp: minus_less_iff)
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
goal (1 subgoal):
1. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
case 3
[PROOF STATE]
proof (state)
this:
M (v c) 0 = \<infinity>
goal (1 subgoal):
1. M (v c) 0 = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
M (v c) 0 = \<infinity>
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c) None (M (v c) 0)
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c') None (M (v c') 0)
goal (1 subgoal):
1. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case (4 c1 c2)
[PROOF STATE]
proof (state)
this:
v c1 \<le> n
v c2 \<le> n
goal (1 subgoal):
1. \<And>c1 c2. \<lbrakk>v c1 \<le> n; v c2 \<le> n\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
proof (cases "c = c1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. c = c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> c1
goal (2 subgoals):
1. c = c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
note F1 = this
[PROOF STATE]
proof (state)
this:
c \<noteq> c1
goal (2 subgoals):
1. c = c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
proof (cases "c = c2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> c2
goal (2 subgoals):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
with A(2,6,7) F1
[PROOF STATE]
proof (chain)
picking this:
v c \<le> n
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
c \<noteq> c1
c \<noteq> c2
[PROOF STEP]
have "v c \<noteq> v c1" "v c \<noteq> v c2"
[PROOF STATE]
proof (prove)
using this:
v c \<le> n
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
c \<noteq> c1
c \<noteq> c2
goal (1 subgoal):
1. v c \<noteq> v c1 &&& v c \<noteq> v c2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v c \<noteq> v c1
v c \<noteq> v c2
goal (2 subgoals):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
hence *:"M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))"
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c1
v c \<noteq> v c2
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
using A(2,3,6,7) 4
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c1
v c \<noteq> v c2
v c \<le> n
DBM_reset M n (v c) d M'
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c1 \<le> n
v c2 \<le> n
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
unfolding DBM_reset_def
[PROOF STATE]
proof (prove)
using this:
v c \<noteq> v c1
v c \<noteq> v c2
v c \<le> n
(\<forall>j\<le>n. 0 < j \<and> v c \<noteq> j \<longrightarrow> M' (v c) j = \<infinity> \<and> M' j (v c) = \<infinity>) \<and> M' (v c) 0 = Le d \<and> M' 0 (v c) = Le (- d) \<and> M' (v c) (v c) = M (v c) (v c) \<and> (\<forall>i\<le>n. \<forall>j\<le>n. i \<noteq> v c \<and> j \<noteq> v c \<longrightarrow> M' i j = min (dbm_add (M i (v c)) (M (v c) j)) (M i j))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c1 \<le> n
v c2 \<le> n
goal (1 subgoal):
1. M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
goal (2 subgoals):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
from 4 A(2,4)
[PROOF STATE]
proof (chain)
picking this:
v c1 \<le> n
v c2 \<le> n
v c \<le> n
u \<turnstile>\<^bsub>v,n\<^esub> M'
[PROOF STEP]
have "dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))"
[PROOF STATE]
proof (prove)
using this:
v c1 \<le> n
v c2 \<le> n
v c \<le> n
u \<turnstile>\<^bsub>v,n\<^esub> M'
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
v c1 \<le> n
v c2 \<le> n
v c \<le> n
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (2 subgoals):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
with dbm_entry_dbm_min *
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) ?b
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
[PROOF STEP]
have "dbm_entry_val u (Some c1) (Some c2) (M (v c1) (v c2))"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) (min ?a ?b) \<Longrightarrow> dbm_entry_val ?u (Some ?c1.0) (Some ?c2.0) ?b
M' (v c1) (v c2) = min (dbm_add (M (v c1) (v c)) (M (v c) (v c2))) (M (v c1) (v c2))
dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2))
goal (1 subgoal):
1. dbm_entry_val u (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u (Some c1) (Some c2) (M (v c1) (v c2))
goal (2 subgoals):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M (v c1) (v c2))
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
using F1 False
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u (Some c1) (Some c2) (M (v c1) (v c2))
c \<noteq> c1
c \<noteq> c2
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal (1 subgoal):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = c2
goal (1 subgoal):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
proof (simp add: True[symmetric], cases "M (v c1) (v c)", goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>x1. M (v c1) (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
3. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
case (1 t)
[PROOF STATE]
proof (state)
this:
M (v c1) (v c) = Le t
goal (3 subgoals):
1. \<And>x1. M (v c1) (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
3. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
hence "u c1 - t \<in> S_Min_Le"
[PROOF STATE]
proof (prove)
using this:
M (v c1) (v c) = Le t
goal (1 subgoal):
1. u c1 - t \<in> S_Min_Le
[PROOF STEP]
unfolding S_Min_Le
[PROOF STATE]
proof (prove)
using this:
M (v c1) (v c) = Le t
goal (1 subgoal):
1. u c1 - t \<in> {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Le d} \<union> {- d |d. M 0 (v c) = Le d}
[PROOF STEP]
using A F1 4
[PROOF STATE]
proof (prove)
using this:
M (v c1) (v c) = Le t
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
c \<noteq> c1
v c1 \<le> n
v c2 \<le> n
goal (1 subgoal):
1. u c1 - t \<in> {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Le d} \<union> {- d |d. M 0 (v c) = Le d}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u c1 - t \<in> S_Min_Le
goal (3 subgoals):
1. \<And>x1. M (v c1) (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
3. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
hence "d' \<ge> u c1 - t"
[PROOF STATE]
proof (prove)
using this:
u c1 - t \<in> S_Min_Le
goal (1 subgoal):
1. u c1 - t \<le> d'
[PROOF STEP]
using d'
[PROOF STATE]
proof (prove)
using this:
u c1 - t \<in> S_Min_Le
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. u c1 - t \<le> d'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c1 - t \<le> d'
goal (3 subgoals):
1. \<And>x1. M (v c1) (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
3. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
hence "t + d' \<ge> u c1"
[PROOF STATE]
proof (prove)
using this:
u c1 - t \<le> d'
goal (1 subgoal):
1. u c1 \<le> t + d'
[PROOF STEP]
by (metis le_swap add_le_cancel_right diff_add_cancel)
[PROOF STATE]
proof (state)
this:
u c1 \<le> t + d'
goal (3 subgoals):
1. \<And>x1. M (v c1) (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
3. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
hence "u c1 - d' \<le> t"
[PROOF STATE]
proof (prove)
using this:
u c1 \<le> t + d'
goal (1 subgoal):
1. u c1 - d' \<le> t
[PROOF STEP]
by (metis add_le_imp_le_right diff_add_cancel)
[PROOF STATE]
proof (state)
this:
u c1 - d' \<le> t
goal (3 subgoals):
1. \<And>x1. M (v c1) (v c) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
3. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
u c1 - d' \<le> t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
using 1 F1
[PROOF STATE]
proof (prove)
using this:
u c1 - d' \<le> t
M (v c1) (v c) = Le t
c \<noteq> c1
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
goal (2 subgoals):
1. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
case (2 t)
[PROOF STATE]
proof (state)
this:
M (v c1) (v c) = Lt t
goal (2 subgoals):
1. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
hence "u c1 - t \<in> S_Min_Lt"
[PROOF STATE]
proof (prove)
using this:
M (v c1) (v c) = Lt t
goal (1 subgoal):
1. u c1 - t \<in> S_Min_Lt
[PROOF STEP]
unfolding S_Min_Lt
[PROOF STATE]
proof (prove)
using this:
M (v c1) (v c) = Lt t
goal (1 subgoal):
1. u c1 - t \<in> {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Lt d} \<union> {- d |d. M 0 (v c) = Lt d}
[PROOF STEP]
using A 4 F1
[PROOF STATE]
proof (prove)
using this:
M (v c1) (v c) = Lt t
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c1 \<le> n
v c2 \<le> n
c \<noteq> c1
goal (1 subgoal):
1. u c1 - t \<in> {u c' - d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c') (v c) = Lt d} \<union> {- d |d. M 0 (v c) = Lt d}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u c1 - t \<in> S_Min_Lt
goal (2 subgoals):
1. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
hence "d' > u c1 - t"
[PROOF STATE]
proof (prove)
using this:
u c1 - t \<in> S_Min_Lt
goal (1 subgoal):
1. u c1 - t < d'
[PROOF STEP]
using d'
[PROOF STATE]
proof (prove)
using this:
u c1 - t \<in> S_Min_Lt
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. u c1 - t < d'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u c1 - t < d'
goal (2 subgoals):
1. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
hence "d' + t > u c1"
[PROOF STATE]
proof (prove)
using this:
u c1 - t < d'
goal (1 subgoal):
1. u c1 < d' + t
[PROOF STEP]
by (metis add_strict_right_mono diff_add_cancel)
[PROOF STATE]
proof (state)
this:
u c1 < d' + t
goal (2 subgoals):
1. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
hence "u c1 - d' < t"
[PROOF STATE]
proof (prove)
using this:
u c1 < d' + t
goal (1 subgoal):
1. u c1 - d' < t
[PROOF STEP]
by (metis gt_swap add_less_cancel_right diff_add_cancel)
[PROOF STATE]
proof (state)
this:
u c1 - d' < t
goal (2 subgoals):
1. \<And>x2. M (v c1) (v c) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
2. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
u c1 - d' < t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
using 2 F1
[PROOF STATE]
proof (prove)
using this:
u c1 - d' < t
M (v c1) (v c) = Lt t
c \<noteq> c1
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
goal (1 subgoal):
1. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
case 3
[PROOF STATE]
proof (state)
this:
M (v c1) (v c) = \<infinity>
goal (1 subgoal):
1. M (v c1) (v c) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
M (v c1) (v c) = \<infinity>
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c) (M (v c1) (v c))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal (1 subgoal):
1. c = c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. c = c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = c1
goal (1 subgoal):
1. c = c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
note T = this
[PROOF STATE]
proof (state)
this:
c = c1
goal (1 subgoal):
1. c = c1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
proof (cases "c = c2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> c2
goal (2 subgoals):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. c \<noteq> c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
proof (cases "M (v c) (v c2)", goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>x1. M (v c) (v c2) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
3. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case (1 t)
[PROOF STATE]
proof (state)
this:
M (v c) (v c2) = Le t
goal (3 subgoals):
1. \<And>x1. M (v c) (v c2) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
3. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
hence "u c2 + t \<in> S_Max_Le"
[PROOF STATE]
proof (prove)
using this:
M (v c) (v c2) = Le t
goal (1 subgoal):
1. u c2 + t \<in> S_Max_Le
[PROOF STEP]
unfolding S_Max_Le
[PROOF STATE]
proof (prove)
using this:
M (v c) (v c2) = Le t
goal (1 subgoal):
1. u c2 + t \<in> {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Le d} \<union> {d |d. M (v c) 0 = Le d}
[PROOF STEP]
using A 4 False
[PROOF STATE]
proof (prove)
using this:
M (v c) (v c2) = Le t
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c1 \<le> n
v c2 \<le> n
c \<noteq> c2
goal (1 subgoal):
1. u c2 + t \<in> {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Le d} \<union> {d |d. M (v c) 0 = Le d}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u c2 + t \<in> S_Max_Le
goal (3 subgoals):
1. \<And>x1. M (v c) (v c2) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
3. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
hence "d' \<le> u c2 + t"
[PROOF STATE]
proof (prove)
using this:
u c2 + t \<in> S_Max_Le
goal (1 subgoal):
1. d' \<le> u c2 + t
[PROOF STEP]
using d'
[PROOF STATE]
proof (prove)
using this:
u c2 + t \<in> S_Max_Le
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. d' \<le> u c2 + t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d' \<le> u c2 + t
goal (3 subgoals):
1. \<And>x1. M (v c) (v c2) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
3. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
hence "d' - u c2 \<le> t"
[PROOF STATE]
proof (prove)
using this:
d' \<le> u c2 + t
goal (1 subgoal):
1. d' - u c2 \<le> t
[PROOF STEP]
by (metis (opaque_lifting, no_types) add_diff_cancel_left add_ac(1) add_le_cancel_right
add_right_cancel diff_add_cancel)
[PROOF STATE]
proof (state)
this:
d' - u c2 \<le> t
goal (3 subgoals):
1. \<And>x1. M (v c) (v c2) = Le x1 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
3. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
d' - u c2 \<le> t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
using 1 T False
[PROOF STATE]
proof (prove)
using this:
d' - u c2 \<le> t
M (v c) (v c2) = Le t
c = c1
c \<noteq> c2
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal (2 subgoals):
1. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case (2 t)
[PROOF STATE]
proof (state)
this:
M (v c) (v c2) = Lt t
goal (2 subgoals):
1. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
hence "u c2 + t \<in> S_Max_Lt"
[PROOF STATE]
proof (prove)
using this:
M (v c) (v c2) = Lt t
goal (1 subgoal):
1. u c2 + t \<in> S_Max_Lt
[PROOF STEP]
unfolding S_Max_Lt
[PROOF STATE]
proof (prove)
using this:
M (v c) (v c2) = Lt t
goal (1 subgoal):
1. u c2 + t \<in> {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Lt d} \<union> {d |d. M (v c) 0 = Lt d}
[PROOF STEP]
using A 4 False
[PROOF STATE]
proof (prove)
using this:
M (v c) (v c2) = Lt t
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c1 \<le> n
v c2 \<le> n
c \<noteq> c2
goal (1 subgoal):
1. u c2 + t \<in> {u c' + d |c' d. 0 < v c' \<and> v c' \<le> n \<and> c \<noteq> c' \<and> M (v c) (v c') = Lt d} \<union> {d |d. M (v c) 0 = Lt d}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u c2 + t \<in> S_Max_Lt
goal (2 subgoals):
1. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
hence "d' < u c2 + t"
[PROOF STATE]
proof (prove)
using this:
u c2 + t \<in> S_Max_Lt
goal (1 subgoal):
1. d' < u c2 + t
[PROOF STEP]
using d'
[PROOF STATE]
proof (prove)
using this:
u c2 + t \<in> S_Max_Lt
\<forall>t\<in>S_Min_Le. t \<le> d'
\<forall>t\<in>S_Min_Lt. t < d'
\<forall>t\<in>S_Max_Le. d' \<le> t
\<forall>t\<in>S_Max_Lt. d' < t
goal (1 subgoal):
1. d' < u c2 + t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d' < u c2 + t
goal (2 subgoals):
1. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
hence "d' - u c2 < t"
[PROOF STATE]
proof (prove)
using this:
d' < u c2 + t
goal (1 subgoal):
1. d' - u c2 < t
[PROOF STEP]
by (metis gt_swap add_less_cancel_right diff_add_cancel)
[PROOF STATE]
proof (state)
this:
d' - u c2 < t
goal (2 subgoals):
1. \<And>x2. M (v c) (v c2) = Lt x2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
2. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
d' - u c2 < t
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
using 2 T False
[PROOF STATE]
proof (prove)
using this:
d' - u c2 < t
M (v c) (v c2) = Lt t
c = c1
c \<noteq> c2
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal (1 subgoal):
1. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case 3
[PROOF STATE]
proof (state)
this:
M (v c) (v c2) = \<infinity>
goal (1 subgoal):
1. M (v c) (v c2) = \<infinity> \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
M (v c) (v c2) = \<infinity>
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
using T
[PROOF STATE]
proof (prove)
using this:
M (v c) (v c2) = \<infinity>
c = c1
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal (1 subgoal):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = c2
goal (1 subgoal):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
from A 4
[PROOF STATE]
proof (chain)
picking this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c1 \<le> n
v c2 \<le> n
[PROOF STEP]
have *:"dbm_entry_val u'' (Some c1) (Some c1) (M (v c1) (v c1))"
[PROOF STATE]
proof (prove)
using this:
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
u \<turnstile>\<^bsub>v,n\<^esub> M'
u'' \<turnstile>\<^bsub>v,n\<^esub> M
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c1 \<le> n
v c2 \<le> n
goal (1 subgoal):
1. dbm_entry_val u'' (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
unfolding DBM_val_bounded_def
[PROOF STATE]
proof (prove)
using this:
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>ca. v ca \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) None (Some ca) (M 0 (v ca)) \<and> dbm_entry_val (u(c := ?d')) (Some ca) None (M (v ca) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val (u(c := ?d')) (Some c1) (Some c2) (M (v c1) (v c2))) \<Longrightarrow> thesis
v c \<le> n
DBM_reset M n (v c) d M'
Le (0::'b) \<preceq> M' 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u None (Some c) (M' 0 (v c)) \<and> dbm_entry_val u (Some c) None (M' (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u (Some c1) (Some c2) (M' (v c1) (v c2)))
Le (0::'b) \<preceq> M 0 0 \<and> (\<forall>c. v c \<le> n \<longrightarrow> dbm_entry_val u'' None (Some c) (M 0 (v c)) \<and> dbm_entry_val u'' (Some c) None (M (v c) 0)) \<and> (\<forall>c1 c2. v c1 \<le> n \<and> v c2 \<le> n \<longrightarrow> dbm_entry_val u'' (Some c1) (Some c2) (M (v c1) (v c2)))
\<forall>c. 0 < v c
\<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y
v c1 \<le> n
v c2 \<le> n
goal (1 subgoal):
1. dbm_entry_val u'' (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val u'' (Some c1) (Some c1) (M (v c1) (v c1))
goal (1 subgoal):
1. c = c2 \<Longrightarrow> dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
using True T
[PROOF STATE]
proof (prove)
using this:
c = c2
c = c1
goal (1 subgoal):
1. dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
[PROOF STEP]
proof (simp add: True T, cases "M (v c1) (v c1)", goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>x1. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Le x1\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
2. \<And>x2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Lt x2\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
3. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
case (1 t)
[PROOF STATE]
proof (state)
this:
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = Le t
goal (3 subgoals):
1. \<And>x1. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Le x1\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
2. \<And>x2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Lt x2\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
3. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val u'' (Some c1) (Some c1) (M (v c1) (v c1))
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = Le t
[PROOF STEP]
have "0 \<le> t"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u'' (Some c1) (Some c1) (M (v c1) (v c1))
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = Le t
goal (1 subgoal):
1. (0::'b) \<le> t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'b) \<le> t
goal (3 subgoals):
1. \<And>x1. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Le x1\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
2. \<And>x2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Lt x2\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
3. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(0::'b) \<le> t
goal (1 subgoal):
1. dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
(0::'b) \<le> t
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = Le t
goal (1 subgoal):
1. dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
goal (2 subgoals):
1. \<And>x2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Lt x2\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>x2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Lt x2\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
case (2 t)
[PROOF STATE]
proof (state)
this:
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = Lt t
goal (2 subgoals):
1. \<And>x2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Lt x2\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
dbm_entry_val u'' (Some c1) (Some c1) (M (v c1) (v c1))
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = Lt t
[PROOF STEP]
have "0 < t"
[PROOF STATE]
proof (prove)
using this:
dbm_entry_val u'' (Some c1) (Some c1) (M (v c1) (v c1))
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = Lt t
goal (1 subgoal):
1. (0::'b) < t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'b) < t
goal (2 subgoals):
1. \<And>x2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = Lt x2\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
2. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(0::'b) < t
goal (1 subgoal):
1. dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
(0::'b) < t
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = Lt t
goal (1 subgoal):
1. dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
goal (1 subgoal):
1. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
case 3
[PROOF STATE]
proof (state)
this:
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = \<infinity>
goal (1 subgoal):
1. \<lbrakk>c2 = c1; c = c2; c = c1; M (v c1) (v c1) = \<infinity>\<rbrakk> \<Longrightarrow> dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
c2 = c1
c = c2
c = c1
M (v c1) (v c1) = \<infinity>
goal (1 subgoal):
1. dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c1 := d')) (Some c1) (Some c1) (M (v c1) (v c1))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dbm_entry_val (u(c := d')) (Some c1) (Some c2) (M (v c1) (v c2))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M
goal (1 subgoal):
1. \<lbrakk>\<And>d'. u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis; v c \<le> n; DBM_reset M n (v c) d M'; u \<turnstile>\<^bsub>v,n\<^esub> M'; u'' \<turnstile>\<^bsub>v,n\<^esub> M; \<forall>c. 0 < v c; \<forall>x y. v x \<le> n \<and> v y \<le> n \<and> v x = v y \<longrightarrow> x = y\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M
goal (1 subgoal):
1. thesis
[PROOF STEP]
using A(1)
[PROOF STATE]
proof (prove)
using this:
u(c := d') \<turnstile>\<^bsub>v,n\<^esub> M
u(c := ?d') \<turnstile>\<^bsub>v,n\<^esub> M \<Longrightarrow> thesis
goal (1 subgoal):
1. thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
thesis
goal:
No subgoals!
[PROOF STEP]
qed |
------------------------------------------------------------------------
-- A universe for stream programs
------------------------------------------------------------------------
module Stream.Programs where
open import Codata.Musical.Notation renaming (β to β_)
import Stream as S
open S using (Stream; _β_; _βΊ_; head; tail)
open import Relation.Binary.PropositionalEquality
open import Data.Vec using (Vec; []; _β·_)
------------------------------------------------------------------------
-- Stream programs
infix 8 _β
infixr 7 _Β·_
infix 6 _β¨_β©_
infixr 5 _βΊ_ _β_ _βΊβΊ_
data Prog (A : Set) : Set1 where
_βΊ_ : (x : A) (xs : β (Prog A)) β Prog A
_β : (x : A) β Prog A
_Β·_ : β {B} (f : B β A) (xs : Prog B) β Prog A
_β¨_β©_ : β {B C} (xs : Prog B) (_β_ : B β C β A) (ys : Prog C) β
Prog A
_β_ : (xs ys : Prog A) β Prog A
iterate : (f : A β A) (x : A) β Prog A
_βΊβΊ_ : β {n} (xs : Vec A n) (ys : Prog A) β Prog A
data WHNF A : Set1 where
_βΊ_ : (x : A) (xs : Prog A) β WHNF A
------------------------------------------------------------------------
-- Conversion
whnf : β {A} β Prog A β WHNF A
whnf (x βΊ xs) = x βΊ β xs
whnf (x β) = x βΊ x β
whnf (f Β· xs) with whnf xs
whnf (f Β· xs) | x βΊ xsβ² = f x βΊ f Β· xsβ²
whnf (xs β¨ _β_ β© ys) with whnf xs | whnf ys
whnf (xs β¨ _β_ β© ys) | x βΊ xsβ² | y βΊ ysβ² = (x β y) βΊ xsβ² β¨ _β_ β© ysβ²
whnf (xs β ys) with whnf xs
whnf (xs β ys) | x βΊ xsβ² = x βΊ ys β xsβ²
whnf (iterate f x) = x βΊ iterate f (f x)
whnf ([] βΊβΊ ys) = whnf ys
whnf ((x β· xs) βΊβΊ ys) = x βΊ xs βΊβΊ ys
mutual
value : β {A} β WHNF A β Stream A
value (x βΊ xs) = x βΊ β― β¦ xs β§
β¦_β§ : β {A} β Prog A β Stream A
β¦ xs β§ = value (whnf xs)
fromStream : β {A} β Stream A β Prog A
fromStream (x βΊ xs) = x βΊ β― fromStream (β xs)
lift : β {A} β (Prog A β Prog A) β Stream A β Stream A
lift f xs = β¦ f (fromStream xs) β§
------------------------------------------------------------------------
-- Some abbreviations
infixr 5 _βΊβ―_
_βΊβ―_ : β {A} β A β Prog A β Prog A
x βΊβ― xs = x βΊ β― xs
headP : β {A} β Prog A β A
headP xs = head β¦ xs β§
tailP : β {A} β Prog A β Prog A
tailP xs with whnf xs
tailP xs | x βΊ xsβ² = xsβ²
|
Base.promote_rule(::Type{Constant{name,S,D,SU}},
::Type{Quantity{T,D,TU}}) where {name,S,T,D,SU,TU} =
promote_type(Quantity{S,D,SU}, Quantity{T,D,TU})
Base.promote_rule(::Type{Quantity{T,D,TU}},
::Type{Constant{name,S,D,SU}}) where {name,S,T,D,SU,TU} =
promote_type(Quantity{S,D,SU}, Quantity{T,D,TU})
Base.promote_rule(::Type{Constant{name,S,NoDims,U}},
::Type{T}) where {name,S,U,T<:Number} =
promote_type(S, T)
Base.promote_rule(::Type{Constant{name,S,NoDims,U}},
::Type{Quantity{T,NoDims,TU}}) where {name,S,U,T,TU} =
promote_type(S, T)
Base.convert(::Type{T},
x::Constant{name,S,NoDims,U}) where {T<:AbstractFloat,name,S,U} =
float(T, x)
Unitful.uconvert(u::Unitful.Units, c::Constant{name,T,D,TU}) where {name,T,D,TU} =
uconvert(u, float(T, c))
|
From Coq Require Import ZArith Reals Psatz.
From Flocq Require Import Binary.
From mathcomp Require Import ssreflect ssralg all_algebra seq.
From Iterative Require Import dot_prod_defn.
Import Coq.Lists.List Coq.Lists.List.ListNotations.
From vcfloat Require Import FPLang FPLangOpt RAux Rounding Reify Float_notations Automate.
Set Bullet Behavior "Strict Subproofs".
Section WITHNANS.
Context {NANS: Nans}.
Lemma real_lt_1 :
forall a b c,
a <= b -> b < c -> a < c.
Proof. intros; apply Rle_lt_trans with b; auto. Qed.
Lemma x_pow_gt_0:
forall (x:R) (n:nat),
0 < x -> 0 < x^n.
Proof.
intros. induction n.
+ simpl. nra.
+ simpl. apply Rmult_lt_0_compat; nra.
Qed.
Print prove_roundoff_bound.
Lemma prove_rndoff' :
forall (a b : ftype Tsingle) vmap n,
(1 < n )%nat ->
let u := / 2 * Raux.bpow Zaux.radix2 (3 - femax Tsingle - fprec Tsingle) in
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
prove_roundoff_bound (@bmap Tsingle n) (vmap a b) (@sum_expr Tsingle a b)
( Rabs (rval (env_ (vmap a b)) (@sum_expr Tsingle a b)) * u0 + u).
Proof.
intros.
prove_roundoff_bound.
- (* first subgoal requires that we
show no overflow for all subexpressions *)
prove_rndval.
set (ty := Tsingle).
set (nr := INR n) .
(*
we need to show that |(a+b)*(1+d)+e|< overflow by
appropriately bounding |a| and |b| in bmap.
|a| + |b| < (overflow - e) / (1+d)
*)
try apply Rabs_le in BOUND, BOUND0.
assert (Rabs (1 + u2) <= 1 + u0) as Hu2.
{ unfold u0. simpl.
apply Rle_trans with
(Rabs 1 + Rabs u2).
+ apply Rabs_triang.
+ rewrite Rabs_R1. apply Rplus_le_compat_l. nra.
}
apply Rlt_Rminus.
rewrite Rmult_1_l.
eapply real_lt_1; [eapply Rabs_triang |
rewrite Rabs_mult; eapply real_lt_1; [ eapply Rplus_le_compat;
[eapply Rmult_le_compat; try apply Rabs_pos;
[eapply Rle_trans; [apply Rabs_triang | eapply Rplus_le_compat;
[apply BOUND0| apply BOUND]]
| eapply Rle_trans; [ apply Hu2 | apply Rle_refl] ] | apply H0 ] | ]].
apply Rle_lt_trans with
(((F' / INR n + 2* u/ u0) + (F' * (INR n -1)/ INR n + 2* u / u0)) * (1+ u0) +
/ 2 *
/ 713623846352979940529142984724747568191373312).
+ assert (/ IZR (2 ^ 150) = / 2 * / 713623846352979940529142984724747568191373312).
{ nra. } rewrite H2. clear H2.
apply Rplus_le_compat_r. apply Rmult_le_compat_r.
* unfold u0; simpl; nra.
* apply Rplus_le_compat_r. unfold u,u0. simpl.
apply Rplus_le_compat_r.
assert (F' / INR n = (F' / INR n) * 1). { nra. } rewrite H2.
assert (F' / (INR n *(1 + / 2 * / IZR (Z.pow_pos 2 23)) ^ n) =
F' * / (INR n *(1 + / 2 * / IZR (Z.pow_pos 2 23)) ^ n)).
{ nra. } rewrite H3. rewrite Rinv_mult_distr.
assert (F' * (/ INR n * / (1 + / 2 * / IZR (Z.pow_pos 2 23))^ n) =
(F' * / INR n) * / (1 + / 2 * / IZR (Z.pow_pos 2 23))^ n).
{ nra. } rewrite H4. apply Rmult_le_compat_l.
++ apply Rmult_le_pos.
-- unfold F', F_max. simpl; nra.
-- apply Rlt_le, Rinv_0_lt_compat. apply lt_0_INR;lia.
++ replace 1 with (/1) by nra. apply Rlt_le, Rinv_lt_contravar.
replace (/1) with 1 by nra. apply Rmult_lt_0_compat. nra.
apply pow_lt. simpl;nra.
replace (/1) with 1 by nra. apply Rlt_pow_R1. simpl;nra.
lia.
++ apply not_0_INR. lia.
++ apply pow_nonzero. simpl;nra.
+ assert (((F' / INR n + 2* u/u0) +
(F' * (INR n - 1) / INR n + 2* u / u0)) =
F' + 4 * u / u0).
{ assert (F' * (INR n - 1) / INR n = F' * (INR n / INR n) - F' / INR n).
{ nra. } rewrite H2.
assert (INR n / INR n = 1). { apply Rinv_r. apply not_0_INR. lia. }
rewrite H3; nra.
} rewrite H2.
unfold u, u0, F', F_max; simpl; nra.
-
prove_roundoff_bound2.
try apply Rabs_le in BOUND, BOUND0.
match goal with |- context[Rabs ?a <= _] =>
field_simplify a
end.
assert (He0: Rabs e0 <= u).
{ eapply Rle_trans. apply E. subst u; simpl; nra. }
assert (Hd: Rabs d <= u0).
{ eapply Rle_trans. apply E0. subst u0; simpl; nra. }
replace (v_a * d + v_b * d + e0) with ((v_a + v_b) * d + e0) by nra.
eapply Rle_trans; [
apply Rabs_triang | eapply Rle_trans; [apply Rplus_le_compat; [rewrite Rabs_mult; eapply Rle_trans;
[apply Rmult_le_compat;
[ apply Rabs_pos | apply Rabs_pos | apply Rle_refl | apply Hd ] |
apply Rle_refl ] | apply He0 ] | ] ].
nra.
Qed.
Lemma reflect_reify_sumF :
forall a b,
fval (env_ (vmap a b)) (@sum_expr Tsingle a b) = sum Tsingle a b .
Proof. reflexivity. Qed.
Lemma reflect_reify_sumR :
forall a b,
rval (env_ (vmap a b)) (@sum_expr Tsingle a b) = FT2R a + FT2R b .
Proof. reflexivity. Qed.
Lemma prove_rndoff:
forall (a b : ftype Tsingle) (n : nat),
let ty:= Tsingle in let nr := INR n in
( 1 < n)%nat ->
let u := / 2 * Raux.bpow Zaux.radix2 (3 - femax Tsingle - fprec Tsingle) in
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
boundsmap_denote (@bmap Tsingle n) (vmap a b) ->
Rabs (FT2R (sum Tsingle a b) - (FT2R a + FT2R b)) <=
( Rabs ( FT2R a + FT2R b ) * u0 + u) .
Proof.
intros ? ? ? ? ? Hn ? ? HBMD.
pose proof prove_rndoff' a b vmap n Hn HBMD.
unfold roundoff_error_bound in H.
rewrite <- reflect_reify_sumR.
rewrite <- reflect_reify_sumF.
destruct H as (H1 & H2); eapply Rle_trans; [apply H2| subst u0 u; nra].
Qed.
Definition Flist_to_Rlist {ty} (L : list ( ftype ty)) :=
map (fun a => (FT2R a)) L.
Definition Flist_to_Rlist_abs {ty} (L : list ( ftype ty)) :=
map (fun a => Rabs (FT2R a)) L.
Lemma Rabs_list_rel {ty} (L : list ( ftype ty)):
Rabs (sum_fixR (Flist_to_Rlist L)) <= sum_fixR (Flist_to_Rlist_abs L).
Proof.
induction L.
+ simpl. rewrite Rabs_R0. nra.
+ simpl.
apply Rle_trans with
(Rabs (FT2R a) + Rabs (sum_fixR (Flist_to_Rlist L))).
apply Rabs_triang.
apply Rplus_le_compat; nra.
Qed.
Lemma INR_n_ge_1:
forall (n:nat), (1 <= n)%nat -> / INR n <= 1.
Proof.
intros.
assert (n = 1%nat \/ (1 < n)%nat).
{ lia. } destruct H0.
+ rewrite H0. simpl. nra.
+ apply Rlt_le.
assert (1 = /1). by nra.
rewrite H1. apply Rinv_1_lt_contravar.
nra. by apply lt_1_INR.
Qed.
Lemma Rlt_2 :
forall a b, 1 < b -> 0 < a -> a /b < a.
Proof.
intros.
apply (Rdiv_lt_left b a a). auto; try lra.
assert (a <= a * 1) by nra.
eapply (real_lt_1); try apply H1.
apply Rmult_lt_compat_l; auto.
Qed.
Lemma R_div_mult_eq :
forall a b c, c <> 0 -> b = c -> a/b * c = a.
Proof. intros. subst. field. auto. Qed.
Ltac simpl_overflow :=
let e:= fresh "e" in let u:= fresh "u" in let d:= fresh "d" in
set (e := (femax Tsingle)) ;
set (u:= (/ 2 * bpow Zaux.radix2 (3 - e - fprec Tsingle))) ;
set (d:=/ 2 * bpow Zaux.radix2 (- fprec Tsingle + 1)) ;
simpl in e, u, d;
subst e u d.
Lemma C_ge_0 (m n:nat):
0 <= C m n.
Proof.
unfold C. apply Rmult_le_pos.
+ apply pos_INR.
+ rewrite Rinv_mult_distr.
- apply Rmult_le_pos;
(apply Rlt_le, Rinv_0_lt_compat; apply lt_0_INR, lt_O_fact).
- apply not_0_INR. apply fact_neq_0.
- apply not_0_INR. apply fact_neq_0.
Qed.
Lemma fact_bound:
forall m n:nat,
(n <= m)%nat ->
INR (fact m) / INR (fact (m - n)) <= INR (m ^ n).
Proof.
intros.
induction n.
+ simpl.
assert ((m - 0)%nat = m). { lia. } rewrite H0.
assert (INR (fact m) / INR (fact m) = 1).
{ apply Rinv_r. apply not_0_INR. apply fact_neq_0. }
rewrite H1. nra.
+ simpl.
assert ((n <= m)%nat).
{ apply le_trans with (S n). lia. lia. } specialize (IHn H0).
rewrite mult_INR.
assert (INR (fact (m - S n)) = INR (fact (m - n)) * / INR (m - n) ).
{ assert ((m-n)%nat = S (m - S n)).
{ lia. }
assert (fact (m - n) = fact (S (m - S n))).
{ by rewrite H1. } rewrite H2. simpl.
assert ((fact (m - S n)+ (m - S n) * fact (m - S n))%nat =
((m - n) * fact (m - S n))%nat).
{ lia. } rewrite H3. rewrite mult_INR.
assert (INR (m - n) * INR (fact (m - S n)) * / INR (m - n) =
INR (fact (m - S n)) * (INR (m - n) */ INR (m - n))).
{ nra. } rewrite H4. rewrite Rinv_r. nra.
apply not_0_INR;lia.
} rewrite H1.
assert (INR (fact m) / (INR (fact (m - n)) * / INR (m - n)) =
INR (fact m) * / (INR (fact (m - n)) * / INR (m - n))).
{ nra. } rewrite H2. rewrite Rinv_mult_distr.
- rewrite Rinv_involutive.
* assert (INR (fact m) * (/ INR (fact (m - n)) * INR (m - n)) =
(INR (fact m) / INR (fact (m - n))) * INR (m - n)).
{ nra. } rewrite H3.
apply Rle_trans with
(INR (m ^ n) * INR (m - n)).
++ apply Rmult_le_compat_r.
-- apply pos_INR.
-- apply IHn.
++ rewrite Rmult_comm. apply Rmult_le_compat_r.
-- apply pos_INR.
-- apply le_INR; lia.
* apply not_0_INR;lia.
- apply not_0_INR, fact_neq_0.
- apply Rinv_neq_0_compat. apply not_0_INR;lia.
Qed.
Lemma pow_2_gt_0:
forall n:nat,
(0 < 2 ^ n)%nat.
Proof.
intros.
induction n; simpl;lia.
Qed.
Lemma fact_low_bound:
forall n:nat,
(1 < n)%nat ->
(INR (2 ^ n) < INR (fact n * (n + 1))%nat).
Proof.
intros.
induction n.
+ contradict H. lia.
+ assert (n = 1%nat \/ (1 < n)%nat). { lia. } destruct H0.
- rewrite H0. simpl. nra.
- specialize (IHn H0). simpl.
assert ((2 ^ n + 0)%nat = (2^n)%nat). { lia. } rewrite H1.
assert (((fact n + n * fact n) * S (n + 1))%nat =
((n+1) * (fact n * S (n+1)))%nat).
{ lia. } rewrite H2.
apply Rlt_trans with
(INR (2 * (fact n * (n + 1)))).
* apply lt_INR. apply INR_lt in IHn. lia.
* rewrite !mult_INR. apply Rmult_lt_compat.
++ simpl;nra.
++ apply Rmult_le_pos; apply pos_INR.
++ apply lt_INR. lia.
++ apply Rmult_lt_compat_l.
-- apply lt_0_INR. apply lt_O_fact.
-- apply lt_INR;lia.
Qed.
Lemma pow_INR:
forall (m n: nat),
INR (m ^ n) = (INR m)^n.
Proof.
intros. induction n.
+ simpl. nra.
+ simpl. rewrite mult_INR IHn. nra.
Qed.
Lemma pow_invert_1: forall x y z :R,
(0 < z) -> x <= y / z -> x * z <= y.
Proof.
intros.
replace y with (y * 1) by nra.
assert (1 = /z * z).
{ symmetry. apply Rinv_l. nra. } rewrite H1.
replace (y * (/z * z)) with ((y / z) * z) by nra.
apply Rmult_le_compat_r.
+ nra.
+ nra.
Qed.
Lemma pow_invert: forall x y z :R,
(0 < z) -> x * z <= y -> x <= y / z.
Proof.
intros.
replace x with (x * 1) by nra.
assert (1 = z * /z).
{ symmetry. apply Rinv_r. nra. } rewrite H1.
replace (x * (z * / z)) with ((x * z) / z) by nra.
apply Rmult_le_compat_r.
+ apply Rlt_le, Rinv_0_lt_compat; nra.
+ nra.
Qed.
Lemma pow_invert_eq:
forall x y z :R,
(0 <> z) -> x * z = y -> x = y / z.
Proof.
intros.
replace x with (x * 1) by nra.
assert (1 = z * /z).
{ symmetry. apply Rinv_r. nra. } rewrite H1.
replace (x * (z * / z)) with ((x * z) / z) by nra.
nra.
Qed.
Require Import Coq.ZArith.Znat.
Lemma ratio_gt_0:
forall m:nat,
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
(m < Z.to_nat (Z.pow_pos 2 23))%nat ->
0 < (1 - INR m * u0 / INR 2).
Proof.
intros.
replace (INR 2) with 2 by (simpl;nra).
assert (INR m * u0 < 2 -> 0 < 1 - INR m * u0 / 2).
{ nra. } apply H0.
unfold u0. simpl.
assert (INR m < 2 * 2 * IZR (Z.pow_pos 2 23) ->
INR m * (/ 2 * / IZR (Z.pow_pos 2 23)) < 2).
{ simpl; nra. } apply H1.
apply Rlt_trans with
(INR (Z.to_nat (Z.pow_pos 2 23))).
+ apply lt_INR;lia.
+ rewrite INR_IZR_INZ.
assert ((Z.of_nat (Z.to_nat (Z.pow_pos 2 23))) = Z.pow_pos 2 23).
{ lia. } rewrite H2. nra.
Qed.
Lemma delta_bound:
forall m:nat,
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
(m < Z.to_nat (Z.pow_pos 2 23))%nat ->
((1 + u0) ^ m - 1) < 2.
Proof.
intros.
assert ((1 + u0) ^ m < 3 -> (1 + u0) ^ m - 1 < 2).
{ nra. } apply H0.
assert (1+u0 = u0 + 1). { nra. } rewrite H1. clear H1.
rewrite binomial.
apply Rle_lt_trans with
(sum_f_R0 (fun i : nat => (INR (m ^ i) / INR (fact i)) * u0 ^ i * 1 ^ (m - i)) m).
+ apply sum_Rle. intros.
rewrite Rmult_assoc.
match goal with |-context[_ <= ?a * ?b * ?c]=>
replace (a * b * c) with (a * (b * c)) by nra
end. apply Rmult_le_compat.
- apply C_ge_0 .
- apply Rmult_le_pos. try apply Rlt_le,x_pow_gt_0;try nra.
unfold u0; simpl;nra. apply Rlt_le,x_pow_gt_0. nra.
- unfold C.
assert (INR (fact m) / (INR (fact n) * INR (fact (m - n))) =
(INR (fact m) / INR (fact (m-n))) * / INR (fact n)).
{ assert (INR (fact m) / (INR (fact n) * INR (fact (m - n))) =
INR (fact m) * / (INR (fact n) * INR (fact (m - n)))).
{ nra. } rewrite H2.
rewrite Rinv_mult_distr; try nra; try apply not_0_INR, fact_neq_0.
} rewrite H2. apply Rmult_le_compat_r.
* apply Rlt_le, Rinv_0_lt_compat. apply lt_0_INR. apply lt_O_fact.
* apply fact_bound;lia.
- nra.
+ assert (m = 0%nat \/ (0 < m)%nat). { lia. } destruct H1.
- rewrite H1. simpl. nra.
- apply Rle_lt_trans with
(1 + INR m *u0 * sum_f_R0 (fun i: nat => INR (m^i) * u0^i / INR (2^i)) (m-1)%nat).
* rewrite decomp_sum.
++ simpl.
assert (1 / 1 * 1 * 1 ^ (m - 0) = 1). { rewrite pow1. nra. }
rewrite H2. clear H2.
apply Rplus_le_compat_l.
rewrite scal_sum.
assert ((m - 1)%nat = (Init.Nat.pred m)). { lia. } rewrite H2.
apply sum_Rle. intros.
rewrite !mult_INR. rewrite pow1.
assert (INR m * INR (m ^ n) / INR (fact n + n * fact n) *
(u0 * u0 ^ n) * 1 =
( INR (m ^ n) / INR (fact n + n * fact n) * u0^n) *
(INR m * u0)).
{ nra. } rewrite H4. apply Rmult_le_compat_r.
-- apply Rmult_le_pos. apply pos_INR. unfold u0;simpl;nra.
-- rewrite Rmult_assoc.
assert (INR (m ^ n) * u0 ^ n / INR (2 ^ n) =
INR (m ^ n) * ( / INR (2 ^ n) * u0^n)).
{ nra. } rewrite H5. apply Rmult_le_compat_l.
** apply pos_INR.
** apply Rmult_le_compat_r;
first by apply Rlt_le,x_pow_gt_0; unfold u0; simpl; nra.
assert (n = 0%nat \/ (0 < n)%nat).
{ lia. } destruct H6.
+++ rewrite H6. simpl. nra.
+++ assert (n = 1%nat \/ (1 < n)%nat). { lia. } destruct H7.
--- rewrite H7. simpl. nra.
--- apply Rlt_le, Rinv_lt_contravar.
*** apply Rmult_lt_0_compat. apply lt_0_INR.
apply pow_2_gt_0. apply lt_0_INR.
assert ((fact n + n * fact n)%nat = (fact n * (n+1))%nat).
{ lia. } rewrite H8.
apply Nat.mul_pos_pos. apply lt_O_fact. lia.
*** assert ((fact n + n * fact n)%nat = (fact n * (n+1))%nat).
{ lia. } rewrite H8. apply fact_low_bound; lia.
++ lia.
* assert (sum_f_R0 (fun i : nat =>
INR (m ^ i) * u0 ^ i / INR (2 ^ i)) (m - 1) =
sum_f_R0 (fun i : nat => (INR m * u0 / INR 2)^i) (m-1)).
{ apply sum_eq. intros.
rewrite !pow_INR. rewrite [in RHS]Rpow_mult_distr.
rewrite Rpow_mult_distr. rewrite -Rinv_pow. nra.
simpl; nra.
} rewrite H2. clear H2.
assert ((m - 1)%nat = (Init.Nat.pred m)). { lia. } rewrite H2.
pose proof (GP_finite (INR m * u0 / INR 2) (Init.Nat.pred m) ).
apply pow_invert_eq in H3.
++ rewrite H3.
assert ((Init.Nat.pred m + 1)%nat = m). { lia. } rewrite H4.
assert ((INR m * u0 * / ( INR m * u0 / INR 2 - 1)) *
((INR m * u0 / INR 2) ^ m - 1) < 2 -> 1 +
INR m * u0 *
(((INR m * u0 / INR 2) ^ m - 1) /
(INR m * u0 / INR 2 - 1)) < 3).
{ intros. nra. } apply H5. clear H5.
assert (INR m * u0 * / (INR m * u0 / INR 2 - 1) *
((INR m * u0 / INR 2) ^ m - 1) =
INR m * u0 * / (1 - INR m * u0 / INR 2) *
(1 - (INR m * u0 / INR 2) ^ m )).
{ assert ((INR m * u0 / INR 2 - 1) = - ((1 - INR m * u0 / INR 2))).
{ nra. } rewrite H5.
assert (((INR m * u0 / INR 2)^m - 1) = - ((1 - (INR m * u0 / INR 2)^m))).
{ nra. } rewrite H6.
rewrite -Ropp_inv_permute.
+ nra.
+ pose proof (ratio_gt_0 m H). simpl in H7. unfold u0; simpl; nra.
} rewrite H5.
replace 2 with (2 * 1) by nra.
apply Rmult_lt_compat.
-- apply Rmult_le_pos.
** apply Rmult_le_pos; try apply pos_INR; try (unfold u0; simpl;nra).
** apply Rlt_le, Rinv_0_lt_compat. replace (1* 1) with 1 by nra. apply ratio_gt_0. lia.
-- assert ((INR m * u0 / INR 2) ^ m <= 1 ->
0 <= 1 - (INR m * u0 / INR 2) ^ m).
{ nra. } apply H6.
assert (1 = 1^m). { by rewrite pow1. } rewrite H7.
apply pow_incr. split.
** apply Rmult_le_pos.
+++ apply Rmult_le_pos; try apply pos_INR; try (unfold u0;simpl;nra).
+++ simpl;nra.
** assert (0 < (1 - INR m * u0 / INR 2) ->
INR m * u0 / INR 2 <= 1).
{ nra. } apply H8. apply ratio_gt_0. lia.
-- assert (2 = (2 * (1 - INR m * u0 / INR 2)) * / (1 - INR m * u0 / INR 2)).
{ match goal with |-context[_ = (?a * ?b) * ?c]=>
replace ((a*b)*c) with (a * (b * c)) by nra
end. rewrite Rinv_r.
nra.
pose proof (ratio_gt_0 m H). simpl in H6. unfold u0; simpl; nra.
} rewrite H6.
apply Rmult_lt_compat_r.
** apply Rinv_0_lt_compat,ratio_gt_0; lia.
** replace (INR 2) with 2 by (simpl;nra).
assert (2 * (1 - INR m * u0 / 2) = 2 - INR m * u0).
{ nra. } rewrite H7.
assert (INR m * u0 < 1 -> INR m * u0 < 2 - INR m * u0).
{ nra. } apply H8.
apply Rlt_le_trans with
(INR (Z.to_nat (Z.pow_pos 2 23)) * u0).
+++ apply Rmult_lt_compat_r. unfold u0;simpl;nra.
apply lt_INR;lia.
+++ rewrite INR_IZR_INZ.
assert ((Z.of_nat (Z.to_nat (Z.pow_pos 2 23))) = Z.pow_pos 2 23).
{ lia. } rewrite H9. unfold u0;simpl;nra.
-- assert ( 0 < (INR m * u0 / INR 2) ^ m ->
1 - (INR m * u0 / INR 2) ^ m < 1).
{ nra. } apply H6. apply x_pow_gt_0.
apply Rmult_lt_0_compat.
** apply Rmult_lt_0_compat.
+++ apply lt_0_INR. lia.
+++ unfold u0;simpl;nra.
** simpl;nra.
++ pose proof (ratio_gt_0 m H). simpl in H4. unfold u0; simpl; nra.
Qed.
(** Error bound for multiplication **)
Lemma prove_rndoff'' :
forall (a b : ftype Tsingle) vmap n,
(1 < n )%nat ->
let u := / 2 * Raux.bpow Zaux.radix2 (3 - femax Tsingle - fprec Tsingle) in
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
(n < Z.to_nat (Z.pow_pos 2 23))%nat ->
prove_roundoff_bound (@bmap_prod Tsingle n) (vmap a b) (@prod_expr Tsingle a b)
( Rabs (rval (env_ (vmap a b)) (@prod_expr Tsingle a b)) * u0 + u).
Proof.
intros ? ? ? ? ? ? ? Hn.
prove_roundoff_bound.
-
prove_rndval.
try apply Rabs_le in BOUND, BOUND0.
repeat rewrite Rmult_1_l.
assert (Rabs (1 + u2) <= 1 + u0) as Hu2.
{ unfold u0. simpl.
apply Rle_trans with
(Rabs 1 + Rabs u2).
+ apply Rabs_triang.
+ rewrite Rabs_R1. apply Rplus_le_compat_l. nra.
}
apply Rlt_Rminus.
eapply real_lt_1; [eapply Rabs_triang |
rewrite Rabs_mult; eapply real_lt_1; [ eapply Rplus_le_compat;
[eapply Rmult_le_compat; try apply Rabs_pos; [ rewrite Rabs_mult ; apply Rmult_le_compat;
try apply Rabs_pos; [ apply BOUND0 | apply BOUND ]
| apply Hu2 ] | apply H0] | idtac]].
rewrite sqrt_sqrt.
simpl in u , u0.
apply Rle_lt_trans with
((F' / (1+u0) -
/ 2 * / IZR (Z.pow_pos 2 149)) *
(1 + u0) +
/ 2 *
/ 713623846352979940529142984724747568191373312).
+ assert (/ IZR (2 ^ 150) = / 2 * / 713623846352979940529142984724747568191373312).
{ nra. } rewrite H2. clear H2.
apply Rplus_le_compat_r. apply Rmult_le_compat_r.
* unfold u0; simpl; nra.
* apply Rplus_le_compat_r.
apply Rmult_le_compat_l.
unfold F', F_max; simpl; nra.
assert (n=2%nat \/ (2 < n)%nat).
{ lia. } destruct H2.
++ rewrite H2. unfold u0; simpl; nra.
++ apply Rlt_le, Rinv_lt_contravar.
-- apply Rmult_lt_0_compat.
** unfold u0; simpl; nra.
** apply Rmult_lt_0_compat.
apply lt_0_INR. lia.
apply x_pow_gt_0. simpl; nra.
-- assert (1 + u0 = INR 1 * (1+u0)^1).
{ simpl; nra. } rewrite H3.
assert ((INR 1 * (1 + u0) ^ 1) ^ n = (1+u0)^n).
{ by rewrite -H3. } rewrite H4.
apply Rmult_lt_compat.
** simpl; nra.
** unfold u0; simpl; nra.
** apply lt_INR; lia.
** apply Rlt_pow. unfold u0;simpl;nra. lia.
+ unfold F', F_max, u0;simpl;nra.
+ apply Rge_le. apply Rge_minus. apply Rle_ge.
simpl in u, u0. fold u u0.
apply pow_invert.
* apply Rmult_lt_0_compat. apply lt_0_INR. lia.
apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rle_trans with
(u * (INR n * 3)).
++ repeat apply Rmult_le_compat_l.
-- unfold u; simpl; nra.
-- apply pos_INR.
-- apply Rlt_le.
pose proof (delta_bound n). specialize (H2 Hn).
simpl in H2. fold u0 in H2.
nra.
++ replace (u * (INR n * 3)) with (INR n * (3 * u)) by nra.
apply pow_invert_1.
-- unfold u;simpl;nra.
-- apply Rle_trans with
(IZR (Z.pow_pos 2 23)).
** apply Rlt_le. rewrite INR_IZR_INZ. apply IZR_lt. lia.
** unfold u. simpl. unfold F', F_max; simpl; nra.
-
prove_roundoff_bound2.
apply Rabs_le in BOUND.
apply Rabs_le in BOUND0.
match goal with |- context[Rabs ?a <= _] =>
field_simplify a
end.
eapply Rle_trans.
apply Rabs_triang.
eapply Rle_trans.
replace (v_a * v_b * d) with ((v_a * v_b) * d) by nra.
rewrite Rabs_mult.
apply Rplus_le_compat_l.
apply E.
eapply Rle_trans.
apply Rplus_le_compat_r.
apply Rmult_le_compat; try apply Rabs_pos.
apply Rle_refl.
apply E0.
subst u0 u.
apply Rplus_le_compat; try simpl; try field_simplify; nra.
Qed.
Lemma reflect_reify_prodF :
forall a b,
fval (env_ (vmap a b)) (@prod_expr Tsingle a b) = prod Tsingle a b .
Proof. reflexivity. Qed.
Lemma reflect_reify_prodR :
forall a b,
rval (env_ (vmap a b)) (@prod_expr Tsingle a b) = FT2R a * FT2R b .
Proof. reflexivity. Qed.
Lemma prove_rndoff_prod:
forall (a b : ftype Tsingle) (n : nat),
let ty:= Tsingle in let nr := INR n in
( 1 < n)%nat ->
let u := / 2 * Raux.bpow Zaux.radix2 (3 - femax Tsingle - fprec Tsingle) in
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
(n < Z.to_nat (Z.pow_pos 2 23))%nat ->
boundsmap_denote (@bmap_prod Tsingle n) (vmap a b) ->
Rabs (FT2R (prod Tsingle a b) - (FT2R a * FT2R b)) <=
( Rabs ( FT2R a * FT2R b ) * u0 + u) .
Proof.
intros ? ? ? ? ? Hn ? ? ? HBMD.
pose proof prove_rndoff'' a b vmap n Hn H HBMD.
unfold roundoff_error_bound in H0.
rewrite <- reflect_reify_prodR.
rewrite <- reflect_reify_prodF.
destruct H0 as (H1 & H2); try apply H2.
Qed.
Lemma sum_abs_ge_0:
forall (L1 : list (ftype Tsingle)) ,
0 <= sum_fixR (Flist_to_Rlist_abs L1).
Proof.
intros.
induction L1.
+ simpl. nra.
+ simpl. apply Rplus_le_le_0_compat.
apply Rabs_pos. apply IHL1.
Qed.
Lemma u_bound:
forall (m:nat) (u:R),
0 < u ->
(1 < m)%nat ->
u <= (1+u)^m - 1.
Proof.
intros.
induction m.
+ contradict H0. lia.
+ simpl.
assert (m = 1%nat \/ (1< m)%nat). { lia. } destruct H1.
- rewrite H1. nra.
- specialize (IHm H1).
assert ((1 + u) * ((1 + u) ^ m) - 1 =
(1 + u) * ((1 + u) ^ m - 1) + u).
{ nra. } rewrite H2.
apply Rle_trans with ((1+u) * u + u).
* nra.
* apply Rplus_le_compat_r.
apply Rmult_le_compat_l.
nra. nra.
Qed.
Lemma Rabs_ineq:
forall x a:R, Rabs x <= a -> -a <= x <= a.
Proof.
intros.
destruct H.
+ apply Rabs_def2 in H. nra.
+ pose proof (Rcase_abs x) as Hr.
destruct Hr.
- rewrite Rabs_left in H; nra.
- rewrite Rabs_right in H; nra.
Qed.
Lemma Rabs_triang_inv_impl:
forall x y z:R,
Rabs (x - y) <= z ->Rabs x - Rabs y <= z.
Proof.
intros. apply Rle_trans with (Rabs (x - y)).
apply Rabs_triang_inv . nra.
Qed.
Lemma list_sum:
forall (L1 : list (ftype Tsingle)) (x:R) (n:nat),
0 <= x ->
(forall a: ftype Tsingle,
In a L1 ->
Rabs (FT2R a) <= x / INR n) ->
sum_fixR (Flist_to_Rlist_abs L1) <= x * (INR (length L1)) / (INR n).
Proof.
intros.
induction L1.
+ simpl. nra.
+ assert (sum_fixR (Flist_to_Rlist_abs (a :: L1)) =
Rabs (FT2R a) + sum_fixR (Flist_to_Rlist_abs L1)).
{ by simpl. } rewrite H1.
assert (forall a : ftype Tsingle,
In a L1 ->
Rabs (FT2R a) <= x / INR n).
{ intros.
specialize (H0 a0).
assert (In a0 (a :: L1)). { simpl. auto. } specialize (H0 H3).
apply H0.
} specialize (IHL1 H2).
specialize (H0 a).
assert (In a (a :: L1)). { simpl. auto. } specialize (H0 H3).
apply Rle_trans with
( x / INR n + x * INR (length L1) / INR n).
- apply Rplus_le_compat; nra.
- assert (INR (length (a :: L1)) = INR (length L1) + 1).
{ simpl.
destruct (length L1).
+ simpl. nra.
+ nra.
} rewrite H4. nra.
Qed.
Lemma lenght_elem {ty : Type}:
forall (l : list ty),
length l = 1%nat ->
exists a, l = [a].
Proof.
intros. destruct l.
+ contradict H. simpl. lia.
+ exists t.
assert (l = [:: ] \/ l <> [::]).
{ destruct l.
+ by left.
+ by right.
} destruct H0.
- rewrite H0. auto.
- contradict H. simpl. destruct l.
* contradict H0. auto.
* simpl. auto.
Qed.
Lemma float_FT2R_real:
forall L1: list (ftype Tsingle),
length L1 = 1%nat ->
FT2R (sum_fixF Tsingle L1) = sum_fixR (Flist_to_Rlist L1).
Proof.
intros.
pose proof (lenght_elem L1 H).
destruct H0 as [a H0].
rewrite H0. simpl. auto. nra.
Qed.
Lemma lenght_elem_gt_1 {ty : Type}:
forall (l : list ty),
(length l > 1)%nat ->
exists a b, l = [a] ++ b /\ (length b >=1)%nat .
Proof.
intros. destruct l.
+ contradict H. simpl. lia.
+ exists t, l. simpl. split.
- auto.
- destruct l.
* simpl in H. contradict H. lia.
* simpl. lia.
Qed.
Lemma prove_rndoff_n_sum_aux :
forall (L1 : list (ftype Tsingle)) ,
let n:= length L1 in
(1 < n )%nat ->
let u := / 2 * Raux.bpow Zaux.radix2 (3 - femax Tsingle - fprec Tsingle) in
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
(n < Z.to_nat (Z.pow_pos 2 23))%nat ->
(forall a : ftype Tsingle,
In a L1 ->
Binary.is_finite (fprec Tsingle) (femax Tsingle) a = true /\
Rabs (FT2R a) <= (F' / (INR (n+1) * (1+u0)^(n+1)))) ->
is_finite (fprec Tsingle) (femax Tsingle)
(sum_fixF Tsingle L1) = true /\
Rabs (FT2R (sum_fixF Tsingle L1) - sum_fixR (Flist_to_Rlist L1)) <=
(sum_fixR (Flist_to_Rlist_abs L1)) * ((1 + u0)^(n-1) - 1) +
u * ((1 + u0)^(n-1) - 1) / u0.
Proof.
intros ? ? ? ? ? ? Ha.
induction L1.
+ simpl. rewrite Rminus_0_r. rewrite Rabs_R0.
assert ((1 - 1) = 0). { nra. } rewrite H1. nra.
+ (*simpl in IHL1. *)
remember (length L1) as m.
assert (n = (m+1)%nat). { unfold n. simpl. rewrite Heqm. lia. }
assert (L1 = [:: ] \/ L1 <> [::]).
{ destruct L1.
+ by left.
+ by right.
} destruct H2.
- rewrite H2 in Heqm. simpl in Heqm. rewrite Heqm in H1.
simpl in H1. rewrite H1 in H. contradict H. lia.
- simpl.
assert ((1 <= m)%nat).
{ rewrite Heqm. destruct L1.
+ by contradict H2.
+ simpl. lia.
} assert (m = 1%nat \/ (1 < m)%nat). { lia. }
destruct H4.
* rewrite H4 in Heqm. rewrite -Heqm. simpl.
rewrite Rmult_1_r.
pose proof (prove_rndoff a (sum_fixF Tsingle L1) 2%nat).
simpl in H5.
assert ((1 < 2)%nat). { lia. } specialize (H5 H6).
assert (boundsmap_denote (@bmap Tsingle 2)
(vmap a (sum_fixF Tsingle L1))).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ symmetry in Heqm.
pose proof (lenght_elem L1 Heqm).
destruct H7 as [b H7]. rewrite H7. simpl.
specialize (Ha b). rewrite H7 in Ha.
assert ( In b [a; b]). { simpl. auto. } specialize (Ha H8).
apply Ha.
+ apply Rabs_ineq. symmetry in Heqm.
pose proof (lenght_elem L1 Heqm).
destruct H7 as [b H7].
rewrite H7. simpl. rewrite H7 in Ha.
specialize (Ha b). simpl in u,u0. fold u u0.
assert ( In b [a; b]). { simpl; auto. }
specialize (Ha H8).
rewrite H4 in H1. simpl in H1. rewrite H1 in Ha.
apply Rle_trans with
(F' / (INR (2 + 1) * (1 + u0) ^ (2 + 1))).
- nra.
- match goal with |-context[?a <= _]=>
replace a with (a+0) by nra
end. apply Rplus_le_compat.
* assert ( F' * (1 + 1 - 1) / (1 + 1) = F' / 2).
{ nra. } rewrite H9. apply Rmult_le_compat_l.
++ unfold F', F_max; simpl; nra.
++ unfold u0; simpl; nra.
* unfold u,u0; simpl; nra.
+ specialize (Ha a).
assert (In a (a :: L1)). { simpl. auto. }
specialize (Ha H7). apply Ha.
+ apply Rabs_ineq. specialize (Ha a).
assert (In a (a :: L1)).
{ simpl; auto. } specialize (Ha H7).
assert ( n = 2%nat).
{ unfold n. simpl. auto. } rewrite H8 in Ha.
unfold u0 in Ha.
apply Rle_trans with
( F' /
(INR (2 + 1) *
(1 + / 2 * bpow Zaux.radix2 (- fprec Tsingle + 1))
^ (2 + 1))).
- nra.
- unfold F', F_max, u0. simpl; nra.
} specialize (H5 H7).
symmetry in Heqm.
pose proof (lenght_elem L1 Heqm).
destruct H8 as [b H8]. rewrite H8. simpl. rewrite H8 in H5.
simpl in H5. rewrite !Rplus_0_r.
assert( (u * (1 + u0 - 1) / u0) = (/ 2 * / IZR (Z.pow_pos 2 149))).
{ unfold u, u0. simpl; nra. } rewrite H9.
assert ((1 + u0 - 1) = (/ 2 * / IZR (Z.pow_pos 2 23))).
{ by unfold u0; simpl; nra. } rewrite H10. split.
** destruct (prove_rndoff' a b vmap 2%nat).
+++ lia.
+++ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
--- apply Ha. rewrite H8. simpl; auto.
--- apply Rabs_ineq. specialize (Ha b).
assert (In b [a; b]). { simpl; auto. } rewrite H8 in Ha. specialize (Ha H11).
destruct Ha.
apply Rle_trans with
(F' / (INR (n + 1) * (1 + u0) ^ (n + 1))).
-- nra.
-- match goal with |-context[ ?a <= _ ]=>
replace a with (a+ 0) by nra
end. apply Rplus_le_compat.
*** assert (F' * (INR 2 - 1) / INR 2 = F' *( (INR 2 - 1) / INR 2)).
{ nra. } rewrite H14.
apply Rmult_le_compat_l.
unfold F', F_max; simpl; nra.
apply Rlt_le.
assert ((INR 2 - 1) / INR 2 = / INR 2). { simpl;nra. }
rewrite H15. rewrite Rinv_mult_distr.
---- assert (/ INR 2 = / INR 2 * / 1). { nra. } rewrite H16.
apply Rmult_lt_compat.
**** apply Rlt_le, Rinv_0_lt_compat. apply lt_0_INR;lia.
**** apply Rlt_le, Rinv_0_lt_compat. apply x_pow_gt_0.
unfold u0; simpl; nra.
**** apply Rinv_lt_contravar. apply Rmult_lt_0_compat.
simpl;nra. apply lt_0_INR;lia. apply lt_INR. lia.
**** apply Rinv_lt_contravar.
apply Rmult_lt_0_compat. nra.
apply x_pow_gt_0. unfold u0;simpl;nra.
apply Rlt_pow_R1. unfold u0;simpl;nra. lia.
---- apply not_0_INR. lia.
---- apply pow_nonzero. unfold u0;simpl;nra.
*** simpl; nra.
--- apply Ha. simpl;auto.
--- apply Rabs_ineq. specialize (Ha a).
assert (In a (a :: L1)). { simpl;auto. } specialize (Ha H11).
destruct Ha as [ifHa Ha].
apply Rle_trans with
(F' / (INR (n + 1) * (1 + u0) ^ (n + 1))).
---- nra.
---- apply Rle_trans with (F' /(INR 2 *
(1 + / 2 * bpow Zaux.radix2
(- fprec Tsingle + 1)) ^ 2)).
**** apply Rmult_le_compat_l.
unfold F', F_max; simpl; nra.
apply Rlt_le.
apply Rinv_lt_contravar.
*** apply Rmult_lt_0_compat. unfold u0; simpl; nra.
apply Rmult_lt_0_compat.
apply lt_0_INR;lia.
apply x_pow_gt_0. unfold u0;simpl;nra.
*** apply Rmult_lt_compat.
simpl; nra. unfold u0; simpl; nra.
apply lt_INR;lia. apply Rlt_pow.
unfold u0;simpl;nra. lia.
**** simpl;nra.
+++ auto.
** apply Rle_trans with
(Rabs (FT2R a + FT2R b) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149)).
++ nra.
++ apply Rplus_le_compat_r. apply Rmult_le_compat_r.
nra. apply Rabs_triang.
* assert ( match L1 with
| [] => a
| (_ :: _)%SEQ =>
sum Tsingle a (sum_fixF Tsingle L1)
end = sum Tsingle a (sum_fixF Tsingle L1)).
{ pose proof (lenght_elem_gt_1 L1).
assert ((length L1 > 1)%nat). { lia. } specialize (H5 H6). clear H6.
destruct H5 as [b [L2 H5]]. destruct H5 as [H5 LH5].
rewrite H5. simpl. auto.
} rewrite H5. clear H5.
specialize (IHL1 H4).
assert ((m < Z.to_nat (Z.pow_pos 2 23))%nat).
{ apply lt_trans with n. lia. lia. } specialize (IHL1 H5).
assert (forall a : ftype Tsingle,
In a L1 ->
Binary.is_finite (fprec Tsingle)
(femax Tsingle) a = true /\
Rabs (FT2R a) <=
F' / (INR n * (1 + u0) ^ n)).
{ intros. specialize (Ha a0).
assert (In a0 (a :: L1)).
{ simpl. right. auto.
} apply Ha in H7. split. apply H7.
apply Rle_trans with
(F' / (INR (n+1) * (1 + u0) ^ (n+1))).
nra. apply Rmult_le_compat_l.
unfold F', F_max; simpl; nra.
apply Rlt_le. apply Rinv_lt_contravar.
+ rewrite Rmult_assoc. apply Rmult_lt_0_compat.
- apply lt_0_INR. lia.
- apply Rmult_lt_0_compat. apply x_pow_gt_0.
unfold u0; simpl; nra.
apply Rmult_lt_0_compat. apply lt_0_INR; lia.
apply x_pow_gt_0. unfold u0; simpl; nra.
+ apply Rmult_lt_compat.
- apply pos_INR.
- apply Rlt_le.
apply x_pow_gt_0. unfold u0; simpl; nra.
- apply lt_INR. lia.
- apply Rlt_pow. unfold u0; simpl; nra. lia.
} rewrite -H1 in IHL1. specialize (IHL1 H6).
split.
** destruct (prove_rndoff' a (sum_fixF Tsingle L1) vmap n).
+++ lia.
+++ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
--- apply IHL1.
--- apply Rabs_ineq. destruct IHL1 as [ifHL IHL1].
apply Rabs_triang_inv_impl in IHL1.
assert (forall x y z:R, x - y <= z -> x <= y + z).
{ intros. nra. } apply H7 in IHL1.
apply Rle_trans with
(sum_fixR (Flist_to_Rlist_abs L1) +
(sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0)).
*** apply Rle_trans with
(Rabs (sum_fixR (Flist_to_Rlist L1)) +
(sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0)).
++++ nra.
++++ apply Rplus_le_compat_r. apply Rabs_list_rel.
*** match goal with |-context[?a + (?a * ?b + ?c) <= _] =>
replace (a + (a * b + c)) with (a * (1+b) + c) by nra
end.
assert (sum_fixR (Flist_to_Rlist_abs L1) <=
F' /
(1 + u0) ^ n * (INR (length L1)) / (INR n)).
{ apply (list_sum L1 (F' / ( (1 + u0) ^ n)) n).
apply Rmult_le_pos. unfold F', F_max; simpl; nra.
apply Rlt_le. apply Rinv_0_lt_compat. apply x_pow_gt_0.
unfold u0; simpl; nra.
assert (F' / (1 + u0) ^ n / INR n =
F' / (INR n * (1 + u0) ^ n)).
{ assert (/ (INR n * (1 + u0) ^ n) = / INR n * / (1+u0)^n).
{ apply Rinv_mult_distr. apply not_0_INR. lia.
apply pow_nonzero . unfold u0; simpl; nra.
}
assert (F' / (INR n * (1 + u0) ^ n) = F' * /(INR n * (1 + u0) ^ n)).
{ nra. } rewrite H9. rewrite H8. nra.
} rewrite H8. auto. apply H6.
} rewrite -Heqm in H8.
apply Rplus_le_compat.
++++ assert ((1 + ((1 + u0) ^ (m-1) - 1)) = (1+u0)^(m-1)).
{ nra. } rewrite H9.
apply Rle_trans with
((F' / (1 + u0) ^ n * INR m / INR n) * (1+u0)^(m-1)).
++ apply Rmult_le_compat_r.
-- apply Rlt_le. apply x_pow_gt_0. unfold u0;simpl;nra.
-- nra.
++ assert ((INR n - 1) = INR m).
{ rewrite H1. rewrite plus_INR. simpl;nra. }
rewrite H10.
assert (F' / (1 + u0) ^ n * INR m / INR n * (1 + u0) ^ (m-1) =
(F'* (1+u0)^(m-1) / (1+u0)^n) * (INR m / INR n)).
{ nra. } rewrite H11.
match goal with |-context[_ <= ?a * ?b / ?c]=>
replace (a * b / c) with (a * (b / c)) by nra
end. apply Rmult_le_compat_r.
-- apply Rmult_le_pos. apply pos_INR.
apply Rlt_le, Rinv_0_lt_compat. apply lt_0_INR.
lia.
-- replace F' with (F' * 1) by nra.
replace (F' * 1 * (1 + u0) ^ (m-1) / (1 + u0) ^ n)
with (F' * ((1+u0)^(m-1) / (1+u0)^n)) by nra.
apply Rmult_le_compat_l. unfold F', F_max;simpl;nra.
assert (1 = (1+u0)^n / (1+u0)^n).
{ symmetry. apply Rinv_r. apply pow_nonzero.
unfold u0; simpl; nra.
} rewrite H12.
assert (((1 + u0) ^ n / (1 + u0) ^ n + u0) ^ (m-1) /
((1 + u0) ^ n / (1 + u0) ^ n + u0) ^ n =
(1+u0)^(m-1) / (1+u0)^n).
{ by rewrite -H12. } rewrite H13.
apply Rmult_le_compat_r.
apply Rlt_le, Rinv_0_lt_compat.
apply x_pow_gt_0. unfold u0; simpl; nra.
apply Rlt_le. apply Rlt_pow.
unfold u0; simpl; nra. lia.
++++ assert (u * ((1 + u0) ^ (m-1) - 1) / u0 = ((1+u0)^(m-1)-1) * (u/u0)).
{ nra. } rewrite H9. fold u u0.
assert (2 * u / u0 = 2 * (u/u0)).
{ nra. } rewrite H10. apply Rmult_le_compat_r.
unfold u, u0; simpl; nra.
apply Rlt_le, delta_bound.
apply lt_trans with m; lia.
--- apply Ha. simpl;auto.
--- apply Rabs_ineq. fold u0. specialize (Ha a).
assert (In a (a :: L1)). { simpl; auto. } specialize (Ha H7).
apply Rle_trans with
(F' / (INR (n + 1) * (1 + u0) ^ (n + 1))).
*** nra.
*** apply Rle_trans with (F' / (INR n * (1 + u0) ^ n)).
apply Rmult_le_compat_l. unfold F', F_max; simpl; nra.
apply Rlt_le. apply Rinv_lt_contravar.
++++ apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply lt_0_INR. lia.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- apply lt_0_INR. lia.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++++ apply Rmult_lt_compat.
++ apply pos_INR.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
++++ unfold u0; simpl;nra.
+++ auto.
** apply Rle_trans with
(Rabs(FT2R (sum Tsingle a (sum_fixF Tsingle L1)) -
(FT2R a + FT2R (sum_fixF Tsingle L1))) +
Rabs ((FT2R a + FT2R (sum_fixF Tsingle L1)) -
(FT2R a + sum_fixR (Flist_to_Rlist L1)))).
-- assert ((FT2R (sum Tsingle a (sum_fixF Tsingle L1)) -
(FT2R a + sum_fixR (Flist_to_Rlist L1))) =
(FT2R (sum Tsingle a (sum_fixF Tsingle L1)) -
(FT2R a + FT2R (sum_fixF Tsingle L1))) +
((FT2R a + FT2R (sum_fixF Tsingle L1)) -
(FT2R a + sum_fixR (Flist_to_Rlist L1)))).
{ nra. } rewrite H7. apply Rabs_triang.
-- destruct IHL1 as [ifH IHL1].
pose proof (prove_rndoff a (sum_fixF Tsingle L1) n).
specialize (H7 H). simpl in H7.
assert (boundsmap_denote (@bmap Tsingle n)
(vmap a (sum_fixF Tsingle L1))).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ apply Rabs_ineq.
apply Rabs_triang_inv_impl in IHL1.
assert (forall x y z:R, x - y <= z -> x <= y + z).
{ intros. nra. } apply H8 in IHL1.
apply Rle_trans with
(sum_fixR (Flist_to_Rlist_abs L1) +
(sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0)).
- apply Rle_trans with
(Rabs (sum_fixR (Flist_to_Rlist L1)) +
(sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0)).
* nra.
* apply Rplus_le_compat_r. apply Rabs_list_rel.
- match goal with |-context[?a + (?a * ?b + ?c) <= _] =>
replace (a + (a * b + c)) with (a * (1+b) + c) by nra
end.
assert (sum_fixR (Flist_to_Rlist_abs L1) <=
F' /
(1 + u0) ^ n * (INR (length L1)) / (INR n)).
{ apply (list_sum L1 (F' / ( (1 + u0) ^ n)) n).
apply Rmult_le_pos. unfold F', F_max; simpl; nra.
apply Rlt_le. apply Rinv_0_lt_compat. apply x_pow_gt_0.
unfold u0; simpl; nra.
assert (F' / (1 + u0) ^ n / INR n =
F' / (INR n * (1 + u0) ^ n)).
{ assert (/ (INR n * (1 + u0) ^ n) = / INR n * / (1+u0)^n).
{ apply Rinv_mult_distr. apply not_0_INR. lia.
apply pow_nonzero . unfold u0; simpl; nra.
}
assert (F' / (INR n * (1 + u0) ^ n) = F' * /(INR n * (1 + u0) ^ n)).
{ nra. } rewrite H10. rewrite H9. nra.
} rewrite H9. auto. apply H6.
} rewrite -Heqm in H9.
apply Rplus_le_compat.
* assert ((1 + ((1 + u0) ^ (m-1) - 1)) = (1+u0)^(m-1)).
{ nra. } rewrite H10.
apply Rle_trans with
((F' / (1 + u0) ^ n * INR m / INR n) * (1+u0)^(m-1)).
++ apply Rmult_le_compat_r.
-- apply Rlt_le. apply x_pow_gt_0. unfold u0;simpl;nra.
-- nra.
++ assert ((INR n - 1) = INR m).
{ rewrite H1. rewrite plus_INR. simpl;nra. }
rewrite H11.
assert (F' / (1 + u0) ^ n * INR m / INR n * (1 + u0) ^ (m-1) =
(F'* (1+u0)^(m-1) / (1+u0)^n) * (INR m / INR n)).
{ nra. } rewrite H12.
match goal with |-context[_ <= ?a * ?b / ?c]=>
replace (a * b / c) with (a * (b / c)) by nra
end. apply Rmult_le_compat_r.
-- apply Rmult_le_pos. apply pos_INR.
apply Rlt_le, Rinv_0_lt_compat. apply lt_0_INR.
lia.
-- replace F' with (F' * 1) by nra.
replace (F' * 1 * (1 + u0) ^ (m-1) / (1 + u0) ^ n)
with (F' * ((1+u0)^(m-1) / (1+u0)^n)) by nra.
apply Rmult_le_compat_l. unfold F', F_max;simpl;nra.
assert (1 = (1+u0)^n / (1+u0)^n).
{ symmetry. apply Rinv_r. apply pow_nonzero.
unfold u0; simpl; nra.
} rewrite H13.
assert (((1 + u0) ^ n / (1 + u0) ^ n + u0) ^ (m-1) /
((1 + u0) ^ n / (1 + u0) ^ n + u0) ^ n =
(1+u0)^(m-1) / (1+u0)^n).
{ by rewrite -H13. } rewrite H14.
apply Rmult_le_compat_r.
apply Rlt_le, Rinv_0_lt_compat.
apply x_pow_gt_0. unfold u0; simpl; nra.
apply Rlt_le. apply Rlt_pow.
unfold u0; simpl; nra. lia.
* assert (u * ((1 + u0) ^ (m-1) - 1) / u0 = ((1+u0)^(m-1)-1) * (u/u0)).
{ nra. } rewrite H10. fold u u0.
assert (2 * u / u0 = 2 * (u/u0)).
{ nra. } rewrite H11. apply Rmult_le_compat_r.
unfold u, u0; simpl; nra.
apply Rlt_le, delta_bound.
apply lt_trans with m; lia.
+ specialize (Ha a). apply Ha. simpl; auto.
+ apply Rabs_ineq. fold u0. specialize (Ha a).
assert (In a (a :: L1)). { simpl; auto. } specialize (Ha H8).
apply Rle_trans with
(F' / (INR (n + 1) * (1 + u0) ^ (n + 1))).
- nra.
- apply Rle_trans with (F' / (INR n * (1 + u0) ^ n)).
apply Rmult_le_compat_l. unfold F', F_max; simpl; nra.
apply Rlt_le. apply Rinv_lt_contravar.
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply lt_0_INR. lia.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- apply lt_0_INR. lia.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply pos_INR.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
* unfold u0;simpl;nra.
} specialize (H7 H8).
apply Rle_trans with
( (Rabs (FT2R a + FT2R (sum_fixF Tsingle L1)) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149)) +
( sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0)).
*** apply Rplus_le_compat.
+++ apply H7.
+++ assert ((FT2R a + FT2R (sum_fixF Tsingle L1) -
(FT2R a + sum_fixR (Flist_to_Rlist L1))) =
FT2R (sum_fixF Tsingle L1) -
sum_fixR (Flist_to_Rlist L1)).
{ nra. } rewrite H9. apply IHL1.
*** apply Rle_trans with
((Rabs (FT2R a) + Rabs (FT2R (sum_fixF Tsingle L1))) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149) +
(sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0)).
+++ repeat apply Rplus_le_compat. apply Rmult_le_compat_r.
nra. apply Rabs_triang. nra. nra. nra.
+++ assert (Rabs (FT2R (sum_fixF Tsingle L1)) -
Rabs (sum_fixR (Flist_to_Rlist L1)) <=
sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0).
{ apply Rle_trans with (Rabs
(FT2R (sum_fixF Tsingle L1) -
sum_fixR (Flist_to_Rlist L1))).
apply Rabs_triang_inv. nra.
}
assert (Rabs (FT2R (sum_fixF Tsingle L1)) <=
Rabs (sum_fixR (Flist_to_Rlist L1)) +
sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0).
{ nra. }
assert (Rabs (FT2R (sum_fixF Tsingle L1)) <=
sum_fixR (Flist_to_Rlist_abs L1) +
sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0).
{ apply Rle_trans with
(Rabs (sum_fixR (Flist_to_Rlist L1)) +
sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0).
+ nra.
+ repeat apply Rplus_le_compat_r. apply Rabs_list_rel.
}
apply Rle_trans with
((Rabs (FT2R a) +
(sum_fixR (Flist_to_Rlist_abs L1) +
sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0))*
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149) +
(sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0)).
--- repeat apply Rplus_le_compat_r. apply Rmult_le_compat_r; nra.
--- assert ((Rabs (FT2R a) +
(sum_fixR (Flist_to_Rlist_abs L1) +
sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0)) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149) +
(sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ (m-1) - 1) +
u * ((1 + u0) ^ (m-1) - 1) / u0) =
(Rabs (FT2R a) * (/ 2 * / IZR (Z.pow_pos 2 23))) +
(sum_fixR (Flist_to_Rlist_abs L1) *
((/ 2 * / IZR (Z.pow_pos 2 23)) +
(/ 2 * / IZR (Z.pow_pos 2 23)) * ((1 + u0) ^ (m-1) - 1)+
((1 + u0) ^ (m-1) - 1)) +
(((/ 2 * / IZR (Z.pow_pos 2 149)) + u * ((1 + u0) ^ (m-1) - 1) / u0) +
(/ 2 * / IZR (Z.pow_pos 2 23)) * (u * ((1 + u0) ^ (m-1) - 1) / u0)))).
{ nra. } rewrite -Heqm H12. clear H12.
assert ((m-0)%nat = m). { lia. } rewrite H12. clear H12.
assert ((Rabs (FT2R a) + sum_fixR (Flist_to_Rlist_abs L1)) *
((1 + u0) ^ m - 1) +
u * ((1 + u0) ^ m - 1) / u0 =
(Rabs (FT2R a) * ((1 + u0) ^ m - 1)) +
(sum_fixR (Flist_to_Rlist_abs L1) * ((1 + u0) ^ m - 1) +
u * ((1 + u0) ^ m - 1) / u0)).
{ nra. } rewrite H12. clear H12.
repeat apply Rplus_le_compat.
**** apply Rmult_le_compat_l.
apply Rabs_pos.
simpl in u, u0. rewrite -/u -/u0.
apply u_bound. unfold u0. nra. lia.
**** apply Rmult_le_compat_l.
---- apply sum_abs_ge_0.
---- simpl in u, u0. fold u u0.
assert (u0 + u0 * ((1 + u0) ^ (m - 1) - 1) =
u0 * (1+u0)^(m-1)). { nra. } rewrite H12.
assert (u0 * (1 + u0) ^ (m - 1) + ((1 + u0) ^ (m - 1) - 1) =
(1+u0) * (1+u0)^(m-1) - 1).
{ nra. } rewrite H13.
assert ( m = S (m-1)). { lia. } rewrite H14. simpl.
assert ((m - 1 - 0)%nat = (m-1)%nat). { lia. } rewrite H15.
nra.
**** simpl in u, u0. fold u u0.
assert ( m = S (m-1)). { lia. } rewrite H12. simpl.
assert ((m - 1 - 0)%nat = (m-1)%nat). { lia. } rewrite H13.
assert (u + u * ((1 + u0) ^ (m - 1) - 1) / u0 +
u0 * (u * ((1 + u0) ^ (m - 1) - 1) / u0) =
u + u * ((1+u0) * ((1 + u0) ^ (m - 1) - 1)) / u0).
{ nra. } rewrite H14.
assert (u + u * ((1 + u0) * ((1 + u0) ^ (m - 1) - 1)) / u0 =
(u * u0) / u0 + u * ((1 + u0) * ((1 + u0) ^ (m - 1) - 1)) / u0).
{ assert ( (u * u0) / u0 = u). { unfold u, u0; simpl; nra. }
rewrite H15. nra.
} rewrite H15.
assert (u * u0 / u0 +
u * ((1 + u0) * ((1 + u0) ^ (m - 1) - 1)) / u0 =
u * (u0 + ((1 + u0) * ((1 + u0) ^ (m - 1) - 1))) / u0).
{ nra. } rewrite H16. nra.
Qed.
Lemma x_pow: forall (x:R) (n:nat),
0 <= x ->
0 <= x^n.
Proof.
intros.
induction n.
+ simpl. nra.
+ simpl. apply Rmult_le_pos; nra.
Qed.
Lemma x_pow_minus_1: forall (x:R) (n:nat),
1 <= x ->
0 <= x^n - 1.
Proof.
intros.
induction n.
+ simpl. nra.
+ simpl.
assert (x * x ^ n - 1 = x * (x^n - 1) + (x - 1)).
{ nra. } rewrite H0.
apply Rplus_le_le_0_compat.
- apply Rmult_le_pos. nra. nra.
- nra.
Qed.
Definition Flist_to_Rlist_pair {ty} (L : list ( (ftype ty) * (ftype ty))) :=
map (fun a => (FT2R (fst a), FT2R (snd a))) L.
Definition Flist_to_Rlist_pair_abs {ty} (L : list ( (ftype ty) * (ftype ty))) :=
map (fun a => (Rabs (FT2R (fst a)), Rabs (FT2R (snd a)))) L.
Lemma x_bound_S:
forall (x:R) (m:nat),
0 < x ->
x * x + 2 * x <= (1 + x) * (1 + x) ^ (m + 1) - 1.
Proof.
intros.
induction m.
+ simpl. nra.
+ apply Rle_trans with ((1 + x) * (1 + x) ^ (m + 1) - 1).
- apply IHm.
- apply Rplus_le_compat_r.
assert ((1 + x) * (1 + x) ^ (m + 1) =
1* ((1 + x) * (1 + x) ^ (m + 1))).
{ nra. } rewrite H0.
assert ((1 + x) * (1 + x) ^ (S m + 1) =
(1+x) * ((1 + x) * (1 + x) ^ (m + 1))).
{ simpl. nra. } rewrite H1. apply Rmult_le_compat_r.
nra. nra.
Qed.
Lemma sum_abs_pair_rel:
forall (L: list ((ftype Tsingle) * (ftype Tsingle))),
0 <= sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)).
Proof.
intros.
induction L.
+ simpl. nra.
+ simpl.
apply Rplus_le_le_0_compat.
apply Rmult_le_pos; apply Rabs_pos.
apply IHL.
Qed.
Lemma sum_abs_pair_le:
forall (L: list ((ftype Tsingle) * (ftype Tsingle))),
Rabs (dot_prodR (Flist_to_Rlist_pair L)) <=
dot_prodR (Flist_to_Rlist_pair_abs L).
Proof.
intros.
induction L.
+ simpl. unfold dot_prodR. simpl.
rewrite Rabs_R0. nra.
+ simpl. unfold dot_prodR. simpl.
apply Rle_trans with
(Rabs (FT2R (fst a) * FT2R (snd a)) +
Rabs (dot_prodR (Flist_to_Rlist_pair L))).
- apply Rabs_triang.
- apply Rplus_le_compat. rewrite Rabs_mult. nra.
apply IHL.
Qed.
Lemma side_switch:
forall (x y z:R),
x - y <= z -> x <= y+z.
Proof.
intros. nra.
Qed.
Lemma list_sum_pair:
forall (L1 : list ((ftype Tsingle) * (ftype Tsingle)) ) (x:R),
0 <= x ->
(forall a: (ftype Tsingle) *(ftype Tsingle) ,
In a L1 ->
Binary.is_finite (fprec Tsingle) (femax Tsingle) (fst a) = true /\
Binary.is_finite (fprec Tsingle) (femax Tsingle) (snd a) = true /\
Rabs (FT2R (fst a)) <= x /\
Rabs (FT2R (snd a)) <= x ) ->
sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L1)) <= x^2 * (INR (length L1)).
Proof.
intros.
induction L1.
+ simpl. nra.
+ assert (sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs (a :: L1))) =
Rabs (FT2R (fst a)) * Rabs (FT2R (snd a)) +
sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L1))).
{ simpl; nra. } rewrite H1. clear H1.
assert (forall a : ftype Tsingle * ftype Tsingle,
In a L1 ->
Binary.is_finite (fprec Tsingle)
(femax Tsingle) (fst a) = true /\
Binary.is_finite (fprec Tsingle)
(femax Tsingle) (snd a) = true /\
Rabs (FT2R (fst a)) <= x /\
Rabs (FT2R (snd a)) <= x ).
{ intros. specialize (H0 a0).
assert (In a0 (a :: L1)).
{ simpl; auto. } specialize (H0 H2). apply H0.
} specialize (IHL1 H1).
specialize (H0 a).
assert (In a (a :: L1)). { simpl; auto. } specialize (H0 H2).
destruct H0 as [Ha1 Ha2].
apply Rle_trans with
( x^2 + x ^ 2 * INR (length L1)).
- apply Rplus_le_compat. simpl. rewrite Rmult_1_r.
apply Rmult_le_compat; try nra;try apply Rabs_pos.
nra.
- assert (INR (length (a :: L1)) = INR (length L1) + 1).
{ simpl.
destruct (length L1).
+ simpl. nra.
+ nra.
} rewrite H0. nra.
Qed.
Lemma F_bound_rel:
let u := / 2 * Raux.bpow Zaux.radix2 (3 - femax Tsingle - fprec Tsingle) in
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u <=
F' / (INR 2 * (1 + u0) ^ 2) - u.
Proof.
intros.
unfold F',F_max,u,u0;simpl;nra.
Qed.
Lemma two_lt_n:
(2 < Pos.to_nat 8388608)%nat.
lia.
Qed.
(**
l1, l2 of size n
1 < n < 2^p -1
(forall a \in L1 /\ b \in L2,
a & b are finite and
a,b <= sqrt (F' / (n+1 * (1+d)^(n+1)))
) ,
\rnd_error (fl (l1 * l2) - rl(l1 *l2)) <=
rl(l1 *l2) * ((1+d)^(n-1) - 1) + n * e * (1+d)^(n-1) +
e /d * ((1+d)^(n-1) - 1) /\
fl(l1* l2) is finite
**)
Lemma forward_error_dot_aux:
forall (L: list ((ftype Tsingle) * (ftype Tsingle))),
let ty := Tsingle in
let n:= length L in
let nr := INR n in
(1 < n)%nat ->
let u := / 2 * Raux.bpow Zaux.radix2 (3 - femax Tsingle - fprec Tsingle) in
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
(n < Z.to_nat (Z.pow_pos 2 23) - 1)%nat ->
(forall a b : ftype Tsingle,
In (a,b) L ->
Binary.is_finite (fprec Tsingle)
(femax Tsingle) a = true /\
Binary.is_finite (fprec Tsingle)
(femax Tsingle) b = true /\
Rabs (FT2R a) <= sqrt( F' / ((nr+1) * (1+u0)^(n+1)) - u ) /\
Rabs (FT2R b) <= sqrt( F' / ((nr+1) * (1+u0)^(n+1)) - u )) ->
is_finite (fprec Tsingle) (femax Tsingle)
(dot_prodF _ L) = true /\
Rabs (FT2R (dot_prodF _ L) - dot_prodR (Flist_to_Rlist_pair L)) <=
(dot_prodR (Flist_to_Rlist_pair_abs L)) * ((1 + u0)^n -1) +
nr * u * (1+u0)^(n-1) + u * ((1+u0)^(n-1) -1) / u0.
Proof.
intros.
induction L.
+ simpl in n. rewrite /n in H. contradict H. lia.
+ unfold dot_prodF, dot_prodR. simpl.
remember (length L) as m.
assert (n = (m+1)%nat). { unfold n. simpl. rewrite Heqm. lia. }
assert (L = [:: ] \/ L <> [::]).
{ destruct L.
+ by left.
+ by right.
} destruct H3.
- rewrite H3 //= in Heqm. rewrite Heqm //= in H2.
rewrite H2 in H. contradict H. lia.
- unfold dot_prodF, dot_prodR. simpl.
assert ( match prod_fixF Tsingle L with
| [] => prod Tsingle (fst a) (snd a)
| (_ :: _)%SEQ =>
sum Tsingle (prod Tsingle (fst a) (snd a))
(sum_fixF Tsingle (prod_fixF Tsingle L))
end = sum Tsingle (prod Tsingle (fst a) (snd a))
(sum_fixF Tsingle (prod_fixF Tsingle L))).
{ destruct L.
+ contradict H3. auto.
+ simpl. auto.
} rewrite H4. clear H4.
assert ((1 <= m)%nat).
{ rewrite Heqm. destruct L.
+ contradict H3. auto.
+ simpl. lia.
} destruct H4.
* symmetry in Heqm.
pose proof (lenght_elem L Heqm).
destruct H4 as [b H4].
rewrite H4. simpl. rewrite !Rplus_0_r. split.
++ destruct (prove_rndoff' (prod Tsingle (fst a) (snd a))
(prod Tsingle (fst b) (snd b)) vmap 2%nat).
-- lia.
-- apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
** destruct (prove_rndoff'' (fst b) (snd b) vmap 2%nat).
+++ lia.
+++ apply two_lt_n.
+++ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
--- specialize (H1 (fst b) (snd b)).
rewrite H4 in H1.
assert (In (fst b, snd b) [a; b]).
{ destruct b. simpl. auto. } specialize (H1 H5).
apply H1.
--- apply Rabs_ineq.
rewrite H4 in H1. specialize (H1 (fst b) (snd b)).
assert (In (fst b, snd b) [a; b]).
{ destruct b. simpl. auto. } specialize (H1 H5).
fold u u0. destruct H1 as [Hfb1 [Hfb2 [Hb1 Hb2]]].
unfold nr in Hb2.
simpl in H2. rewrite H2 in Hb2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
*** apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
*** apply sqrt_le_1_alt. apply F_bound_rel.
--- specialize (H1 (fst b) (snd b)).
rewrite H4 in H1.
assert (In (fst b, snd b) [a; b]).
{ destruct b. simpl. auto. } specialize (H1 H5).
apply H1.
--- apply Rabs_ineq.
rewrite H4 in H1. specialize (H1 (fst b) (snd b)).
assert (In (fst b, snd b) [a; b]).
{ destruct b. simpl. auto. } specialize (H1 H5).
fold u u0. destruct H1 as [Hfb1 [Hfb2 [Hb1 Hb2]]].
unfold nr in Hb1.
simpl in H2. rewrite H2 in Hb1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
*** apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
*** apply sqrt_le_1_alt. apply F_bound_rel.
+++ auto.
** apply Rabs_ineq.
remember (fst b) as b1.
remember (snd b) as b2.
specialize (H1 b1 b2).
assert (In (b1, b2) (a :: L)).
{ rewrite H4. rewrite Heqb1 Heqb2. destruct b. simpl; auto. }
specialize (H1 H5).
destruct H1 as [Hfb1 [Hfb2 [Hb1 Hb2]]].
assert ((1<2)%nat). { lia. }
pose proof (prove_rndoff_prod b1 b2 2%nat H1).
simpl in H6.
assert ((2 < Pos.to_nat 8388608)%nat). { apply two_lt_n. }
specialize (H6 H7).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap b1 b2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ apply Rabs_ineq. fold u u0. unfold nr in Hb2.
simpl in H2. rewrite H2 in Hb2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt.
apply F_bound_rel.
+ apply Rabs_ineq. fold u u0. unfold nr in Hb1.
simpl in H2. rewrite H2 in Hb1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt.
apply F_bound_rel.
} specialize (H6 H8).
apply Rabs_triang_inv_impl in H6.
apply side_switch in H6.
apply Rle_trans with
(Rabs (FT2R b1 * FT2R b2) +
(Rabs (FT2R b1 * FT2R b2) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149))).
+++ nra.
+++ fold u u0. simpl in u,u0. fold u u0.
assert (Rabs (FT2R b1 * FT2R b2) +
(Rabs (FT2R b1 * FT2R b2) * u0 + u) =
(Rabs (FT2R b1) * Rabs (FT2R b2)) * (1+u0) + u).
{ rewrite !Rabs_mult. nra. } rewrite H9.
apply Rle_trans with
( (sqrt (F' / (nr * (1 + u0) ^ (n+1)) - u) * sqrt (F' / (nr * (1 + u0) ^ (n+1)) - u))
* (1 + u0) + u ).
--- apply Rplus_le_compat_r. apply Rmult_le_compat_r.
unfold u0; simpl; nra.
apply Rmult_le_compat.
*** apply Rabs_pos.
*** apply Rabs_pos.
*** apply Rle_trans with
(sqrt (F' / ((nr + 1) * (1 + u0) ^ (n + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt . apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max; simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
----- apply Rmult_lt_0_compat.
***** apply Rmult_lt_0_compat. unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
***** apply Rmult_lt_0_compat.
unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
----- apply Rmult_lt_compat_r . apply x_pow_gt_0.
unfold u0; simpl; nra. nra.
*** apply Rle_trans with
(sqrt (F' / ((nr + 1) * (1 + u0) ^ (n + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt . apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max; simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
----- apply Rmult_lt_0_compat.
***** apply Rmult_lt_0_compat. unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
***** apply Rmult_lt_0_compat.
unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
----- apply Rmult_lt_compat_r . apply x_pow_gt_0.
unfold u0; simpl; nra. nra.
--- rewrite sqrt_def;
unfold nr; rewrite H2; unfold F', F_max, u, u0; simpl; nra.
** destruct (prove_rndoff'' (fst a) (snd a) vmap 2%nat).
+++ lia.
+++ apply two_lt_n.
+++ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
--- specialize (H1 (fst a) (snd a)).
rewrite H4 in H1.
assert (In (fst a, snd a) [a; b]).
{ destruct a. simpl. auto. } specialize (H1 H5).
apply H1.
--- apply Rabs_ineq.
rewrite H4 in H1. specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) [a; b]).
{ destruct a. simpl. auto. } specialize (H1 H5).
fold u u0. destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
unfold nr in Ha2.
simpl in H2. rewrite H2 in Ha2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
*** apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
*** apply sqrt_le_1_alt. apply F_bound_rel.
--- specialize (H1 (fst a) (snd a)).
rewrite H4 in H1.
assert (In (fst a, snd a) [a; b]).
{ destruct a. simpl. auto. } specialize (H1 H5).
apply H1.
--- apply Rabs_ineq.
rewrite H4 in H1. specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) [a; b]).
{ destruct a. simpl. auto. } specialize (H1 H5).
fold u u0. destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
unfold nr in Ha1.
simpl in H2. rewrite H2 in Ha1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
*** apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
*** apply sqrt_le_1_alt. apply F_bound_rel.
+++ auto.
** apply Rabs_ineq.
remember (fst a) as a1.
remember (snd a) as a2.
specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ rewrite H4. rewrite Heqa1 Heqa2. destruct a. simpl; auto. }
specialize (H1 H5).
destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
assert ((1<2)%nat). { lia. }
pose proof (prove_rndoff_prod a1 a2 2%nat H1).
simpl in H6.
assert ((2 < Pos.to_nat 8388608)%nat). { apply two_lt_n. }
specialize (H6 H7).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap a1 a2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ apply Rabs_ineq. fold u u0. unfold nr in Ha2.
simpl in H2. rewrite H2 in Ha2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt.
apply F_bound_rel.
+ apply Rabs_ineq. fold u u0. unfold nr in Ha1.
simpl in H2. rewrite H2 in Ha1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt.
apply F_bound_rel.
} specialize (H6 H8).
apply Rabs_triang_inv_impl in H6.
apply side_switch in H6.
apply Rle_trans with
(Rabs (FT2R a1 * FT2R a2) +
(Rabs (FT2R a1 * FT2R a2) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149))).
+++ nra.
+++ fold u u0. simpl in u,u0. fold u u0.
assert (Rabs (FT2R a1 * FT2R a2) +
(Rabs (FT2R a1 * FT2R a2) * u0 + u) =
(Rabs (FT2R a1) * Rabs (FT2R a2)) * (1+u0) + u).
{ rewrite !Rabs_mult. nra. } rewrite H9.
apply Rle_trans with
( (sqrt (F' / (nr * (1 + u0) ^ (n+1)) - u) * sqrt (F' / (nr * (1 + u0) ^ (n+1)) - u))
* (1 + u0) + u ).
--- apply Rplus_le_compat_r. apply Rmult_le_compat_r.
unfold u0; simpl; nra.
apply Rmult_le_compat.
*** apply Rabs_pos.
*** apply Rabs_pos.
*** apply Rle_trans with
(sqrt (F' / ((nr + 1) * (1 + u0) ^ (n + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt . apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max; simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
----- apply Rmult_lt_0_compat.
***** apply Rmult_lt_0_compat. unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
***** apply Rmult_lt_0_compat.
unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
----- apply Rmult_lt_compat_r . apply x_pow_gt_0.
unfold u0; simpl; nra. nra.
*** apply Rle_trans with
(sqrt (F' / ((nr + 1) * (1 + u0) ^ (n + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt . apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max; simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
----- apply Rmult_lt_0_compat.
***** apply Rmult_lt_0_compat. unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
***** apply Rmult_lt_0_compat.
unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
----- apply Rmult_lt_compat_r . apply x_pow_gt_0.
unfold u0; simpl; nra. nra.
--- rewrite sqrt_def;
unfold nr; rewrite H2; unfold F', F_max, u, u0; simpl; nra.
-- auto.
++ pose proof (prove_rndoff (prod Tsingle (fst a) (snd a))
(prod Tsingle (fst b) (snd b)) 2%nat).
assert ((1 < 2)%nat). { lia. } specialize (H5 H6).
simpl in H5.
assert (boundsmap_denote (@bmap Tsingle 2)
(vmap (prod Tsingle (fst a) (snd a))
(prod Tsingle (fst b) (snd b)))).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ destruct (prove_rndoff'' (fst b) (snd b) vmap 2%nat).
+++ lia.
+++ apply two_lt_n.
+++ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
--- specialize (H1 (fst b) (snd b)).
rewrite H4 in H1.
assert (In (fst b, snd b) [a; b]).
{ destruct b. simpl. auto. } specialize (H1 H7).
apply H1.
--- apply Rabs_ineq.
rewrite H4 in H1. specialize (H1 (fst b) (snd b)).
assert (In (fst b, snd b) [a; b]).
{ destruct b. simpl. auto. } specialize (H1 H7).
fold u u0. destruct H1 as [Hfb1 [Hfb2 [Hb1 Hb2]]].
unfold nr in Hb2.
simpl in H2. rewrite H2 in Hb2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
*** apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
*** apply sqrt_le_1_alt. apply F_bound_rel.
--- specialize (H1 (fst b) (snd b)).
rewrite H4 in H1.
assert (In (fst b, snd b) [a; b]).
{ destruct b. simpl. auto. } specialize (H1 H7).
apply H1.
--- apply Rabs_ineq.
rewrite H4 in H1. specialize (H1 (fst b) (snd b)).
assert (In (fst b, snd b) [a; b]).
{ destruct b. simpl. auto. } specialize (H1 H7).
fold u u0. destruct H1 as [Hfb1 [Hfb2 [Hb1 Hb2]]].
unfold nr in Hb1.
simpl in H2. rewrite H2 in Hb1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
*** apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
*** apply sqrt_le_1_alt. apply F_bound_rel.
+++ auto.
+ apply Rabs_ineq.
remember (fst b) as b1.
remember (snd b) as b2.
specialize (H1 b1 b2).
assert (In (b1, b2) (a :: L)).
{ rewrite H4. rewrite Heqb1 Heqb2. destruct b. simpl; auto. }
specialize (H1 H7).
destruct H1 as [Hfb1 [Hfb2 [Hb1 Hb2]]].
pose proof (prove_rndoff_prod b1 b2 2%nat H6).
simpl in H1.
assert ((2 < Pos.to_nat 8388608)%nat). { apply two_lt_n. }
specialize (H1 H8).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap b1 b2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ apply Rabs_ineq. fold u u0. unfold nr in Hb2.
simpl in H2. rewrite H2 in Hb2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt.
apply F_bound_rel.
+ apply Rabs_ineq. fold u u0. unfold nr in Hb1.
simpl in H2. rewrite H2 in Hb1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt.
apply F_bound_rel.
} specialize (H1 H9).
apply Rabs_triang_inv_impl in H1.
apply side_switch in H1.
apply Rle_trans with
(Rabs (FT2R b1 * FT2R b2) +
(Rabs (FT2R b1 * FT2R b2) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149))).
++ nra.
++ fold u u0. simpl in u,u0. fold u u0.
assert (Rabs (FT2R b1 * FT2R b2) +
(Rabs (FT2R b1 * FT2R b2) * u0 + u) =
(Rabs (FT2R b1) * Rabs (FT2R b2)) * (1+u0) + u).
{ rewrite !Rabs_mult. nra. } rewrite H10.
apply Rle_trans with
( (sqrt (F' / (nr * (1 + u0) ^ (n+1)) - u) * sqrt (F' / (nr * (1 + u0) ^ (n+1)) - u))
* (1 + u0) + u ).
-- apply Rplus_le_compat_r. apply Rmult_le_compat_r.
unfold u0; simpl; nra.
apply Rmult_le_compat.
** apply Rabs_pos.
** apply Rabs_pos.
** apply Rle_trans with
(sqrt (F' / ((nr + 1) * (1 + u0) ^ (n + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt . apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max; simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
----- apply Rmult_lt_0_compat.
***** apply Rmult_lt_0_compat. unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
***** apply Rmult_lt_0_compat.
unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
----- apply Rmult_lt_compat_r . apply x_pow_gt_0.
unfold u0; simpl; nra. nra.
** apply Rle_trans with
(sqrt (F' / ((nr + 1) * (1 + u0) ^ (n + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt . apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max; simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
----- apply Rmult_lt_0_compat.
***** apply Rmult_lt_0_compat. unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
***** apply Rmult_lt_0_compat.
unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
----- apply Rmult_lt_compat_r . apply x_pow_gt_0.
unfold u0; simpl; nra. nra.
-- rewrite sqrt_def;
unfold nr; rewrite H2; unfold F', F_max, u, u0; simpl; nra.
+ destruct (prove_rndoff'' (fst a) (snd a) vmap 2%nat).
+++ lia.
+++ apply two_lt_n.
+++ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
--- specialize (H1 (fst a) (snd a)).
rewrite H4 in H1.
assert (In (fst a, snd a) [a; b]).
{ destruct a. simpl. auto. } specialize (H1 H7).
apply H1.
--- apply Rabs_ineq.
rewrite H4 in H1. specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) [a; b]).
{ destruct a. simpl. auto. } specialize (H1 H7).
fold u u0. destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
unfold nr in Ha2.
simpl in H2. rewrite H2 in Ha2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
*** apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
*** apply sqrt_le_1_alt. apply F_bound_rel.
--- specialize (H1 (fst a) (snd a)).
rewrite H4 in H1.
assert (In (fst a, snd a) [a; b]).
{ destruct a. simpl. auto. } specialize (H1 H7).
apply H1.
--- apply Rabs_ineq.
rewrite H4 in H1. specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) [a; b]).
{ destruct a. simpl. auto. } specialize (H1 H7).
fold u u0. destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
unfold nr in Ha1.
simpl in H2. rewrite H2 in Ha1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
*** apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
*** apply sqrt_le_1_alt. apply F_bound_rel.
+++ auto.
+ apply Rabs_ineq.
remember (fst a) as a1.
remember (snd a) as a2.
specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ left. rewrite Heqa1 Heqa2. destruct a. simpl. auto. }
specialize (H1 H7).
destruct H1 as [Haf1 [Haf2 [Ha1 Ha2]]].
pose proof (prove_rndoff_prod a1 a2 2%nat H6).
simpl in H1.
assert ((2 < Pos.to_nat 8388608)%nat). { apply two_lt_n. }
specialize (H1 H8).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap a1 a2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ apply Rabs_ineq. fold u u0. unfold nr in Ha2.
simpl in H2. rewrite H2 in Ha2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt. apply F_bound_rel.
+ apply Rabs_ineq. fold u u0. unfold nr in Ha1.
simpl in H2. rewrite H2 in Ha1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt. apply F_bound_rel.
} specialize (H1 H9).
apply Rabs_triang_inv_impl in H1.
apply side_switch in H1.
apply Rle_trans with
(Rabs (FT2R a1 * FT2R a2) +
(Rabs (FT2R a1 * FT2R a2) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149))).
++ nra.
++ fold u u0. simpl in u,u0. fold u u0.
assert (Rabs (FT2R a1 * FT2R a2) +
(Rabs (FT2R a1 * FT2R a2) * u0 + u) =
(Rabs (FT2R a1) * Rabs (FT2R a2)) * (1+u0) + u).
{ rewrite !Rabs_mult. nra. } rewrite H10.
apply Rle_trans with
( (sqrt (F' / (nr * (1 + u0) ^ (n+1)) - u) * sqrt (F' / (nr * (1 + u0) ^ (n+1)) - u))
* (1 + u0) + u ).
-- apply Rplus_le_compat_r. apply Rmult_le_compat_r.
unfold u0; simpl; nra.
apply Rmult_le_compat.
** apply Rabs_pos.
** apply Rabs_pos.
** apply Rle_trans with
(sqrt (F' / ((nr + 1) * (1 + u0) ^ (n + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt . apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max; simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
----- apply Rmult_lt_0_compat.
***** apply Rmult_lt_0_compat. unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
***** apply Rmult_lt_0_compat.
unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
----- apply Rmult_lt_compat_r . apply x_pow_gt_0.
unfold u0; simpl; nra. nra.
** apply Rle_trans with
(sqrt (F' / ((nr + 1) * (1 + u0) ^ (n + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt . apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max; simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
----- apply Rmult_lt_0_compat.
***** apply Rmult_lt_0_compat. unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
***** apply Rmult_lt_0_compat.
unfold nr.
rewrite H2. simpl; nra. apply x_pow_gt_0.
unfold u0; simpl; nra.
----- apply Rmult_lt_compat_r . apply x_pow_gt_0.
unfold u0; simpl; nra. nra.
-- rewrite sqrt_def;
unfold nr; rewrite H2; unfold F', F_max, u, u0; simpl; nra.
} specialize (H5 H7).
apply Rle_trans with
(Rabs
(FT2R
(sum Tsingle (prod Tsingle (fst a) (snd a)) (prod Tsingle (fst b) (snd b))) -
(FT2R (prod Tsingle (fst a) (snd a)) + FT2R (prod Tsingle (fst b) (snd b)))) +
Rabs ((FT2R (prod Tsingle (fst a) (snd a)) + FT2R (prod Tsingle (fst b) (snd b))) -
(FT2R (fst a) * FT2R (snd a) + FT2R (fst b) * FT2R (snd b)))).
-- assert ((FT2R
(sum Tsingle (prod Tsingle (fst a) (snd a))
(prod Tsingle (fst b) (snd b))) -
(FT2R (fst a) * FT2R (snd a) +
FT2R (fst b) * FT2R (snd b))) =
(FT2R
(sum Tsingle (prod Tsingle (fst a) (snd a))
(prod Tsingle (fst b) (snd b))) -
(FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (prod Tsingle (fst b) (snd b)))) +
(FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (prod Tsingle (fst b) (snd b)) -
(FT2R (fst a) * FT2R (snd a) +
FT2R (fst b) * FT2R (snd b)))).
{ nra. } rewrite H8. clear H8. apply Rabs_triang.
-- apply Rle_trans with
(( Rabs
(FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (prod Tsingle (fst b) (snd b))) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
/ 2 * / IZR (Z.pow_pos 2 149)) + Rabs
(FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (prod Tsingle (fst b) (snd b)) -
(FT2R (fst a) * FT2R (snd a) +
FT2R (fst b) * FT2R (snd b)))).
** by apply Rplus_le_compat_r.
** pose proof (prove_rndoff_prod (fst a) (snd a) 2%nat).
specialize (H8 H6).
simpl in H8.
assert ((2 < Pos.to_nat 8388608)%nat). { apply two_lt_n. }
specialize (H8 H9).
remember (fst a) as a1.
remember (snd a) as a2.
assert (Rabs (FT2R a1) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) /\
Rabs (FT2R a2) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
{ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ left. rewrite Heqa1 Heqa2. destruct a. simpl. auto. }
specialize (H1 H10). nra.
} destruct H10 as [Ha1 Ha2].
pose proof (prove_rndoff_prod a1 a2 2%nat H6).
assert ((2 < Pos.to_nat 8388608)%nat). { apply two_lt_n. }
specialize (H10 H11).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap a1 a2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ specialize (H1 a1 a2).
rewrite H4 in H1.
assert (In (a1, a2) [a; b]).
{ destruct a. rewrite Heqa1 Heqa2. simpl. auto. } specialize (H1 H12).
apply H1.
+ apply Rabs_ineq. fold u u0. unfold nr in Ha2.
simpl in H2. rewrite H2 in Ha2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt. apply F_bound_rel.
+ specialize (H1 a1 a2).
rewrite H4 in H1.
assert (In (a1, a2) [a; b]).
{ destruct a. rewrite Heqa1 Heqa2. simpl. auto. } specialize (H1 H12).
apply H1.
+ apply Rabs_ineq. fold u u0. unfold nr in Ha1.
simpl in H2. rewrite H2 in Ha1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt.
apply F_bound_rel.
} specialize (H10 H12).
pose proof (prove_rndoff_prod (fst b) (snd b) 2%nat).
specialize (H13 H6).
simpl in H13.
specialize (H13 H11).
remember (fst b) as b1.
remember (snd b) as b2.
assert (Rabs (FT2R b1) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) /\
Rabs (FT2R b2) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
{ specialize (H1 b1 b2).
assert (In (b1, b2) (a :: L)).
{ rewrite H4. rewrite Heqb1 Heqb2. destruct b. simpl; auto. }
specialize (H1 H14). nra.
} destruct H14 as [Hb1 Hb2].
pose proof (prove_rndoff_prod b1 b2 2%nat H6).
specialize (H14 H9).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap b1 b2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ specialize (H1 b1 b2).
rewrite H4 in H1.
assert (In (b1, b2) [a; b]).
{ destruct b. rewrite Heqb1 Heqb2. simpl. auto. } specialize (H1 H15).
apply H1.
+ apply Rabs_ineq. fold u u0. unfold nr in Hb2.
simpl in H2. rewrite H2 in Hb2.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt. apply F_bound_rel.
+ specialize (H1 b1 b2).
rewrite H4 in H1.
assert (In (b1, b2) [a; b]).
{ destruct b. rewrite Heqb1 Heqb2. simpl. auto. } specialize (H1 H15).
apply H1.
+ apply Rabs_ineq. fold u u0. unfold nr in Hb1.
simpl in H2. rewrite H2 in Hb1.
apply Rle_trans with
(sqrt (F' / (INR 2 * (1 + u0) ^ (2 + 1)) - u)).
- apply Rle_trans with
(sqrt (F' / ((INR 2 + 1) * (1 + u0) ^ (2 + 1)) - u)).
++++ nra.
++++ apply sqrt_le_1_alt. unfold F',F_max,u,u0; simpl; nra.
- apply sqrt_le_1_alt.
apply F_bound_rel.
} specialize (H14 H15).
apply Rle_trans with (((Rabs (FT2R (prod Tsingle a1 a2)) + Rabs (FT2R (prod Tsingle b1 b2))) *
(/ 2 * / IZR (Z.pow_pos 2 23)) + / 2 * / IZR (Z.pow_pos 2 149)) +
( Rabs (FT2R (prod Tsingle a1 a2) - FT2R a1 * FT2R a2) +
Rabs (FT2R (prod Tsingle b1 b2) - FT2R b1 * FT2R b2))).
*** apply Rplus_le_compat.
+++ apply Rplus_le_compat_r. apply Rmult_le_compat_r.
nra. apply Rabs_triang.
+++ assert ((FT2R (prod Tsingle a1 a2) + FT2R (prod Tsingle b1 b2) -
(FT2R a1 * FT2R a2 + FT2R b1 * FT2R b2)) =
(FT2R (prod Tsingle a1 a2) - FT2R a1 * FT2R a2) +
(FT2R (prod Tsingle b1 b2) - FT2R b1 * FT2R b2)).
{ nra. } rewrite H16. apply Rabs_triang.
*** fold u u0 in H10, H14.
apply Rle_trans with
((((Rabs (FT2R a1 * FT2R a2) * (1+ u0) + u) +
(Rabs (FT2R b1 * FT2R b2) * (1+ u0) + u)) *
(/ 2 * / IZR (Z.pow_pos 2 23)) +
(/ 2 * / IZR (Z.pow_pos 2 149))) +
((Rabs (FT2R a1 * FT2R a2) * u0 + u) +
(Rabs (FT2R b1 * FT2R b2) * u0 + u))).
++++ apply Rplus_le_compat.
---- apply Rplus_le_compat_r. apply Rmult_le_compat_r.
nra. apply Rplus_le_compat.
**** apply Rabs_triang_inv_impl in H10. nra.
**** apply Rabs_triang_inv_impl in H14. nra.
---- apply Rplus_le_compat;nra.
++++ unfold nr. simpl in H2. rewrite H2.
simpl in u, u0. fold u u0.
rewrite !Rabs_mult.
change (INR 2) with 2.
assert (u * ((1 + u0) * 1 - 1) / u0 = u).
{ unfold u, u0; simpl; nra. } rewrite H16. nra.
* split.
++ destruct (prove_rndoff' (prod Tsingle (fst a) (snd a))
(sum_fixF Tsingle (prod_fixF Tsingle L)) vmap n).
-- lia.
-- apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
** apply IHL. lia. lia.
intros. specialize (H1 a0 b).
assert (In (a0, b) (a :: L)).
{ simpl;auto. } specialize (H1 H6).
repeat split; try apply H1.
+++ apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
--- nra.
--- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
*** apply Rmult_lt_0_compat.
++++ apply Rmult_lt_0_compat.
---- apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
---- apply x_pow_gt_0. unfold u0; simpl; nra.
++++ apply Rmult_lt_0_compat.
---- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
---- apply x_pow_gt_0. unfold u0; simpl; nra.
*** apply Rmult_lt_compat.
++++ apply Rplus_le_le_0_compat. apply pos_INR. nra.
++++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++++ unfold nr. apply Rplus_lt_compat_r. apply lt_INR. lia.
++++ apply Rlt_pow. unfold u0; simpl; nra. lia.
+++ apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
--- nra.
--- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
*** apply Rmult_lt_0_compat.
++++ apply Rmult_lt_0_compat.
---- apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
---- apply x_pow_gt_0. unfold u0; simpl; nra.
++++ apply Rmult_lt_0_compat.
---- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
---- apply x_pow_gt_0. unfold u0; simpl; nra.
*** apply Rmult_lt_compat.
++++ apply Rplus_le_le_0_compat. apply pos_INR. nra.
++++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++++ unfold nr. apply Rplus_lt_compat_r. apply lt_INR. lia.
++++ apply Rlt_pow. unfold u0; simpl; nra. lia.
** apply Rabs_ineq.
assert ((1 < S m)%nat). { lia. }
specialize (IHL H5).
assert ((S m < Z.to_nat (Z.pow_pos 2 23) - 1)%nat).
{ apply lt_trans with n; lia. }
specialize (IHL H6).
assert ((forall a b : ftype Tsingle,
In (a, b) L ->
Binary.is_finite (fprec Tsingle)
(femax Tsingle) a = true /\
Binary.is_finite (fprec Tsingle)
(femax Tsingle) b = true /\
Rabs (FT2R a) <=
sqrt (F' / ((INR (S m) +1) * (1 + u0) ^ (S m + 1)) - u) /\
Rabs (FT2R b) <=
sqrt (F' / ((INR (S m) +1) * (1 + u0) ^ (S m + 1)) - u))).
{ intros. specialize (H1 a0 b).
assert (In (a0, b) (a :: L)).
{ simpl. auto.
} specialize (H1 H8). destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]]. split. auto.
split. auto. split.
+ apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- nra.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply Rplus_le_le_0_compat. apply pos_INR. nra.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr. apply Rplus_lt_compat_r. apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
+ apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- nra.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply Rplus_le_le_0_compat. apply pos_INR. nra.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr. apply Rplus_lt_compat_r. apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
} specialize (IHL H7). clear H7. destruct IHL as [ifHL IHL].
unfold dot_prodF, dot_prodR in IHL.
apply Rabs_triang_inv_impl in IHL. apply side_switch in IHL.
apply Rle_trans with
(Rabs (sum_fixR (prod_fixR (Flist_to_Rlist_pair L))) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)).
+++ nra.
+++ apply Rle_trans with
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) + INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)).
*** apply Rplus_le_compat_r. apply sum_abs_pair_le.
*** assert (sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) + INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0) =
sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) * (1 + u0) ^ S m +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0).
{ nra. } rewrite H7. clear H7.
apply Rle_trans with
(((sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u))^2 * INR (length L)) *
(1 + u0) ^ S m + INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0).
++++ apply Rplus_le_compat_r. apply Rplus_le_compat_r.
apply Rmult_le_compat_r.
---- apply Rlt_le, x_pow_gt_0. unfold u0;simpl; nra.
---- apply (list_sum_pair L (sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u))).
apply sqrt_pos. intros.
specialize (H1 (fst a0) (snd a0)).
assert (In (fst a0, snd a0) (a :: L)).
{ simpl. destruct a0. simpl; auto. }
specialize (H1 H8). apply H1.
++++ assert (sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) ^ 2 =
(F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
{ assert (forall x:R, x^2 = x * x). { intros. nra. } rewrite H7.
apply sqrt_sqrt.
apply Rge_le. apply Rge_minus. apply Rle_ge.
apply pow_invert.
* apply Rmult_lt_0_compat. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rle_trans with
(u * ((INR n + 1) * 3)).
+++ repeat apply Rmult_le_compat_l.
--- unfold u; simpl; nra.
--- apply Rplus_le_le_0_compat. apply pos_INR. nra.
--- apply Rlt_le.
pose proof (delta_bound (n+1)%nat).
assert ( (n + 1 < Z.to_nat (Z.pow_pos 2 23))%nat).
{ lia. } specialize (H8 H9).
fold u0 in H8.
nra.
+++ replace (u * ((INR n+1) * 3)) with ((INR n+1) * (3 * u)) by nra.
apply pow_invert_1.
--- unfold u;simpl;nra.
--- apply Rle_trans with
(IZR (Z.pow_pos 2 23) + 1).
*** apply Rlt_le. rewrite INR_IZR_INZ. apply Rplus_lt_compat_r. apply IZR_lt. lia.
*** unfold u. simpl. unfold F', F_max; simpl; nra.
} rewrite H7. rewrite -Heqm.
assert (S m = (n-1)%nat). { lia. } rewrite H8.
assert ((n - 1 - 1)%nat = (n-2)%nat). { lia. } rewrite H9.
clear H8 H9.
assert ((F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) * INR (n - 1) *
(1 + u0) ^ (n - 1) + INR (n - 1) * u * (1 + u0) ^ (n - 2) +
u * ((1 + u0) ^ (n - 2) - 1) / u0 =
(F' / ((nr+1) * (1 + u0) ^ (n + 1)) * INR (n-1) *(1 + u0) ^ (n - 1)) +
((INR (n - 1) * u * (1 + u0) ^ (n - 2) - INR (n - 1) * u * (1 + u0) ^ (n - 1)) +
u * ((1 + u0) ^ (n - 2) - 1) / u0)).
{ nra. } rewrite H8. clear H8.
apply Rplus_le_compat.
---- unfold nr.
assert (F' / ((INR n+1) * (1 + u0) ^ (n + 1)) * INR (n - 1) *
(1 + u0) ^ (n - 1) =
(F' * / ((INR n+1) * (1 + u0) ^ (n + 1))) * INR (n - 1) *
(1 + u0) ^ (n - 1)). { nra. } rewrite H8. clear H8.
rewrite Rinv_mult_distr.
replace (F' * (INR n - 1) / INR n) with ((F' * (INR n - 1) / INR n) * 1) by nra.
assert (F' * (/ (INR n +1) * / (1 + u0) ^ (n + 1)) * INR (n - 1) *
(1 + u0) ^ (n - 1) =
(F' * (INR n - 1) / (INR n + 1)) * ((1 + u0) ^ (n - 1) /(1 + u0) ^ (n + 1))).
{ rewrite minus_INR. simpl; nra. lia. } rewrite H8. clear H8.
apply Rmult_le_compat.
**** apply Rmult_le_pos.
+++++ apply Rmult_le_pos; try (unfold F', F_max; simpl; nra); try apply pos_INR.
apply Rge_le. apply Rge_minus. apply Rle_ge.
replace 1 with (INR 1) by (simpl; nra). apply le_INR;lia.
+++++ apply Rlt_le. apply Rinv_0_lt_compat. apply Rplus_lt_0_compat. apply lt_0_INR; lia. nra.
**** apply Rmult_le_pos.
+++++ apply pow_le. unfold u0; simpl; nra.
+++++ apply Rlt_le, Rinv_0_lt_compat. apply x_pow_gt_0.
unfold u0;simpl;nra.
**** repeat apply Rmult_le_compat_l.
+++++ apply Rmult_le_pos. unfold F',F_max;simpl;nra.
apply Rge_le, Rge_minus, Rle_ge.
replace 1 with (INR 1) by (simpl;nra).
apply le_INR. lia.
+++++ apply Rlt_le, Rinv_lt_contravar. apply Rmult_lt_0_compat.
apply lt_0_INR. lia. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
nra.
**** assert (1 = (1+u0)^(n+1) / (1+u0)^(n+1)).
{ symmetry. apply Rinv_r. apply pow_nonzero .
unfold u0;simpl;nra.
}
assert ( (1 + u0) ^ (n - 1) / (1 + u0) ^ (n + 1) <=
(1+u0)^(n+1) / (1+u0)^(n+1) ->
(1 + u0) ^ (n - 1) / (1 + u0) ^ (n + 1) <= 1).
{ rewrite -H8; nra. } apply H9. apply Rmult_le_compat_r.
+++++ apply Rlt_le, Rinv_0_lt_compat. apply x_pow_gt_0. unfold u0;simpl;nra.
+++++ apply Rle_pow. unfold u0;simpl;nra. lia.
**** assert ((0 < INR n + 1) -> INR n + 1 <> 0). { nra. } apply H8.
apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
**** apply pow_nonzero. unfold u0;simpl;nra.
---- match goal with |-context[ _ <= ?a]=>
replace a with (0 + a) by nra
end. apply Rplus_le_compat.
**** assert ((n - 1)%nat = (S (n-2))%nat). { lia. }
rewrite H8.
assert (INR (S (n - 2)) * u * (1 + u0) ^ (n - 2) -
INR (S (n - 2)) * u * (1 + u0) ^ S (n - 2) =
- (u0 * INR (S (n - 2)) * u * (1 + u0) ^ (n - 2))).
{ simpl; nra. } rewrite H9.
apply Rge_le. apply Ropp_0_le_ge_contravar.
repeat apply Rmult_le_pos; try (simpl;nra); try nra; try apply pos_INR;
try (apply Rlt_le, x_pow_gt_0; unfold u0; simpl; nra).
**** rewrite -/u -/u0.
replace (u * ((1 + u0) ^ (n - 2) - 1) / u0) with
(((1 + u0) ^ (n - 2) - 1) * (u / u0)) by nra.
replace (2 * u / u0) with (2 * (u/u0)) by nra.
apply Rmult_le_compat_r.
+++++ unfold u,u0; simpl; nra.
+++++ apply Rlt_le. apply (delta_bound (n-2)%nat).
apply lt_trans with n; lia.
** destruct (prove_rndoff'' (fst a) (snd a) vmap 2%nat).
+++ lia.
+++ apply two_lt_n.
+++ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
--- specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) (a :: L)).
{ destruct a. simpl;auto. } specialize (H1 H5).
apply H1.
--- apply Rabs_ineq.
specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) (a :: L)).
{ destruct a. simpl. auto. } specialize (H1 H5).
fold u u0. destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
*** nra.
*** apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
++++ apply Rmult_lt_0_compat.
---- apply Rmult_lt_0_compat.
**** apply lt_0_INR. lia.
**** apply x_pow_gt_0. unfold u0; simpl; nra.
---- apply Rmult_lt_0_compat.
**** unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
**** apply x_pow_gt_0. unfold u0; simpl; nra.
++++ apply Rmult_lt_compat.
---- apply pos_INR.
---- apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
---- unfold nr.
assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H1. replace 1 with (INR 1) by (simpl;nra). apply lt_INR. lia.
---- apply Rlt_pow. unfold u0; simpl; nra. lia.
--- specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) (a :: L)).
{ destruct a. simpl;auto. } specialize (H1 H5).
apply H1.
--- apply Rabs_ineq.
specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) (a :: L)).
{ destruct a. simpl. auto. } specialize (H1 H5).
fold u u0. destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
*** nra.
*** apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
++++ apply Rmult_lt_0_compat.
---- apply Rmult_lt_0_compat.
**** apply lt_0_INR. lia.
**** apply x_pow_gt_0. unfold u0; simpl; nra.
---- apply Rmult_lt_0_compat.
**** unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
**** apply x_pow_gt_0. unfold u0; simpl; nra.
++++ apply Rmult_lt_compat.
---- apply pos_INR.
---- apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
---- unfold nr.
assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H1. replace 1 with (INR 1) by (simpl;nra). apply lt_INR. lia.
---- apply Rlt_pow. unfold u0; simpl; nra. lia.
+++ auto.
** apply Rabs_ineq.
pose proof (prove_rndoff_prod (fst a) (snd a) 2%nat).
assert ((1 < 2)%nat). { lia. } specialize (H5 H6).
assert ((2 < Z.to_nat (Z.pow_pos 2 23))%nat).
{ lia. } specialize (H5 H7).
remember (fst a) as a1.
remember (snd a) as a2.
assert (Rabs (FT2R a1) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) /\
Rabs (FT2R a2) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
{ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ left. simpl. rewrite Heqa1 Heqa2. destruct a. simpl. auto. }
specialize (H1 H8). nra.
} destruct H8 as [Ha1 Ha2].
pose proof (prove_rndoff_prod a1 a2 2%nat H6).
specialize (H8 H7).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap a1 a2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ destruct a. rewrite Heqa1 Heqa2. simpl. auto. } specialize (H1 H9).
apply H1.
+ apply Rabs_ineq. fold u u0. unfold nr in Ha2.
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- apply Ha2.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply lt_0_INR. lia.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply pos_INR.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr.
assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H9. replace 1 with (INR 1) by (simpl;nra). apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
+ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ destruct a. rewrite Heqa1 Heqa2. simpl. auto. } specialize (H1 H9).
apply H1.
+ apply Rabs_ineq.
fold u u0. unfold nr in Ha2.
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- apply Ha1.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply lt_0_INR. lia.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply pos_INR.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr.
assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H9. replace 1 with (INR 1) by (simpl;nra). apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
} specialize (H8 H9).
apply Rabs_triang_inv_impl in H8. apply side_switch in H8.
fold u u0 in H8.
apply Rle_trans with
(Rabs (FT2R a1 * FT2R a2) +
(Rabs (FT2R a1 * FT2R a2) * u0 + u)).
+++ nra.
+++ rewrite -/u0.
apply Rle_trans with
((sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) *
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)) * (1 + u0) + u).
--- rewrite Rabs_mult.
assert (Rabs (FT2R a1) * Rabs (FT2R a2) +
(Rabs (FT2R a1) * Rabs (FT2R a2) * u0 + u) =
(Rabs (FT2R a1) * Rabs (FT2R a2)) * (1 +u0) + u).
{ nra. } rewrite H10. apply Rplus_le_compat_r.
apply Rmult_le_compat_r.
unfold u0; simpl; nra.
apply Rmult_le_compat; try apply Ha1; try apply Ha2.
apply Rabs_pos. apply Rabs_pos.
--- rewrite sqrt_def .
*** unfold nr.
assert ((F' / ((INR n+1) * (1 + u0) ^ (n + 1)) - u) * (1 + u0) + u =
(F' / ((INR n+1) * (1 + u0) ^ (n + 1)) * (1+u0)) - u * u0).
{ nra. } rewrite H10.
assert (F' / ((INR n+1) * (1 + u0) ^ (n + 1)) * (1 + u0) = F' / ((INR n+1) * (1 + u0) ^ n)).
{ assert (F' / ((INR n+1) * (1 + u0) ^ (n + 1)) * (1 + u0) =
F' * ( (1+u0) * / ((INR n+1) * (1 + u0) ^ (n + 1)))).
{ nra. } rewrite H11.
assert (((1 + u0) * / ((INR n+1) * (1 + u0) ^ (n + 1))) =
/ ((INR n+1) * (1 + u0) ^ n)).
{ rewrite Rinv_mult_distr.
+ rewrite Rinv_mult_distr.
- assert ((1 + u0) * (/ (INR n+1) * / (1 + u0) ^ (n + 1)) =
/ (INR n+1) * ((1+u0) * / (1+u0)^(n+1))).
{ nra. } rewrite H12.
assert (((1 + u0) * / (1 + u0) ^ (n + 1)) = / (1 + u0) ^ n).
{ assert ((n+1)%nat = S n). { lia. } rewrite H13.
assert ((1 + u0) ^ S n = (1+u0) * (1+u0)^n).
{ simpl. nra. } rewrite H14.
rewrite Rinv_mult_distr.
+ assert ((1 + u0) * (/ (1 + u0) * / (1 + u0) ^ n) =
((1 + u0) / (1+u0)) * / (1 + u0) ^ n). { nra. }
rewrite H15.
assert ((1 + u0) / (1+u0) = 1).
{ apply Rinv_r. unfold u0; simpl; nra. }
rewrite H16. nra.
+ unfold u0; simpl; nra.
+ apply pow_nonzero. unfold u0; simpl; nra.
} rewrite H13. nra.
- assert ((0 < INR n + 1) -> INR n + 1 <> 0). { nra. }
apply H12. apply Rplus_lt_0_compat.
apply lt_0_INR. lia. nra.
- apply pow_nonzero. unfold u0; simpl; nra.
+ assert ((0 < INR n + 1) -> INR n + 1 <> 0). { nra. }
apply H12. apply Rplus_lt_0_compat.
apply lt_0_INR. lia. nra.
+ apply pow_nonzero. unfold u0; simpl; nra.
} rewrite H12. nra.
} rewrite H11.
apply Rle_trans with (F' / ((INR n + 1) * (1 + u0) ^ n)).
unfold u, u0; simpl; nra. apply Rle_trans with (F' / (INR n * (1 + u0) ^ n)).
apply Rmult_le_compat_l.
unfold F',F_max;simpl;nra. apply Rlt_le. apply Rinv_lt_contravar.
++++ apply Rmult_lt_0_compat.
---- apply Rmult_lt_0_compat. apply lt_0_INR. lia. apply x_pow_gt_0.
unfold u0;simpl;nra.
---- apply Rmult_lt_0_compat. apply Rplus_lt_0_compat. apply lt_0_INR. lia.
nra. apply x_pow_gt_0. unfold u0;simpl;nra.
++++ apply Rmult_lt_compat_r. apply x_pow_gt_0. unfold u0;simpl;nra.
nra.
++++ unfold u0;simpl;nra.
*** apply Rge_le. apply Rge_minus. apply Rle_ge.
apply pow_invert.
**** apply Rmult_lt_0_compat. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
apply x_pow_gt_0. unfold u0; simpl; nra.
**** apply Rle_trans with
(u * ((INR n+1) * 3)).
++++ repeat apply Rmult_le_compat_l.
---- unfold u; simpl; nra.
---- apply Rplus_le_le_0_compat. apply pos_INR. nra.
---- apply Rlt_le.
pose proof (delta_bound (n+1)%nat).
assert ( (n + 1 < Z.to_nat (Z.pow_pos 2 23))%nat).
{ lia. } specialize (H10 H11).
fold u0 in H10.
nra.
++++ replace (u * ((INR n+1) * 3)) with ((INR n+1) * (3 * u)) by nra.
apply pow_invert_1.
---- unfold u;simpl;nra.
---- apply Rle_trans with
(IZR (Z.pow_pos 2 23) +1).
***** apply Rlt_le. rewrite INR_IZR_INZ. apply Rplus_lt_compat_r. apply IZR_lt. lia.
***** unfold u. simpl. unfold F', F_max; simpl; nra.
-- auto.
++ (** TODO: induction step **)
assert ((1 < S m)%nat). { lia. }
specialize (IHL H5).
assert ((S m < Z.to_nat (Z.pow_pos 2 23) - 1)%nat).
{ apply lt_trans with n; lia. }
specialize (IHL H6).
assert ((forall a b : ftype Tsingle,
In (a, b) L ->
Binary.is_finite (fprec Tsingle)
(femax Tsingle) a = true /\
Binary.is_finite (fprec Tsingle)
(femax Tsingle) b = true /\
Rabs (FT2R a) <=
sqrt (F' / ((INR (S m)+1) * (1 + u0) ^ (S m + 1)) - u) /\
Rabs (FT2R b) <=
sqrt (F' / ((INR (S m) +1)* (1 + u0) ^ (S m + 1)) - u))).
{ intros. specialize (H1 a0 b).
assert (In (a0, b) (a :: L)).
{ simpl. auto.
} specialize (H1 H8). destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]]. split. auto.
split. auto. split.
+ apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- nra.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply Rplus_le_le_0_compat. apply pos_INR. nra.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr. apply Rplus_lt_compat_r. apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
+ apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- nra.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply Rplus_le_le_0_compat. apply pos_INR. nra.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr. apply Rplus_lt_compat_r. apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
} specialize (IHL H7). clear H7.
apply Rle_trans with
(Rabs (FT2R
(sum Tsingle (prod Tsingle (fst a) (snd a))
(sum_fixF Tsingle (prod_fixF Tsingle L))) -
(FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (sum_fixF Tsingle (prod_fixF Tsingle L)))) +
Rabs ((FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (sum_fixF Tsingle (prod_fixF Tsingle L))) -
(FT2R (fst a) * FT2R (snd a) +
sum_fixR (prod_fixR (Flist_to_Rlist_pair L))))).
-- assert ((FT2R
(sum Tsingle (prod Tsingle (fst a) (snd a))
(sum_fixF Tsingle (prod_fixF Tsingle L))) -
(FT2R (fst a) * FT2R (snd a) +
sum_fixR (prod_fixR (Flist_to_Rlist_pair L)))) =
(FT2R
(sum Tsingle (prod Tsingle (fst a) (snd a))
(sum_fixF Tsingle (prod_fixF Tsingle L))) -
(FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (sum_fixF Tsingle (prod_fixF Tsingle L)))) +
((FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (sum_fixF Tsingle (prod_fixF Tsingle L))) -
(FT2R (fst a) * FT2R (snd a) +
sum_fixR (prod_fixR (Flist_to_Rlist_pair L))))).
{ nra. } rewrite H7. clear H7.
apply Rabs_triang.
-- pose proof (prove_rndoff (prod Tsingle (fst a) (snd a))
(sum_fixF Tsingle (prod_fixF Tsingle L))).
specialize (H7 n).
assert ((1 < n)%nat). { lia. } specialize (H7 H8).
assert (boundsmap_denote (@bmap ty n)
(vmap (prod Tsingle (fst a) (snd a))
(sum_fixF Tsingle (prod_fixF Tsingle L)))).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ apply IHL.
+ apply Rabs_ineq. unfold dot_prodF, dot_prodR in IHL.
destruct IHL as [ifHL IHL].
apply Rabs_triang_inv_impl in IHL. apply side_switch in IHL.
apply Rle_trans with
(Rabs (sum_fixR (prod_fixR (Flist_to_Rlist_pair L))) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)).
- nra.
- apply Rle_trans with
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) + INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)).
* apply Rplus_le_compat_r. apply sum_abs_pair_le.
* assert (sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) + INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0) =
sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) * (1 + u0) ^ S m +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0).
{ nra. } rewrite H9. clear H9.
apply Rle_trans with
(((sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u))^2 * INR (length L)) *
(1 + u0) ^ S m + INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0).
++ apply Rplus_le_compat_r. apply Rplus_le_compat_r.
apply Rmult_le_compat_r.
-- apply Rlt_le, x_pow_gt_0. unfold u0;simpl; nra.
-- apply (list_sum_pair L (sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u))).
apply sqrt_pos. intros.
specialize (H1 (fst a0) (snd a0)).
assert (In (fst a0, snd a0) (a :: L)).
{ simpl. destruct a0. simpl; auto. }
specialize (H1 H10). apply H1.
++ assert (sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) ^ 2 =
(F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
{ assert (forall x:R, x^2 = x * x). { intros. nra. } rewrite H9.
apply sqrt_sqrt.
apply Rge_le. apply Rge_minus. apply Rle_ge.
apply pow_invert.
* apply Rmult_lt_0_compat. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rle_trans with
(u * ((INR n+1) * 3)).
+++ repeat apply Rmult_le_compat_l.
--- unfold u; simpl; nra.
--- apply Rplus_le_le_0_compat. apply pos_INR. nra.
--- apply Rlt_le.
pose proof (delta_bound (n+1)%nat).
assert ( (n + 1 < Z.to_nat (Z.pow_pos 2 23))%nat).
{ lia. } specialize (H10 H11).
fold u0 in H10.
nra.
+++ replace (u * ((INR n+1) * 3)) with ((INR n+1) * (3 * u)) by nra.
apply pow_invert_1.
--- unfold u;simpl;nra.
--- apply Rle_trans with
(IZR (Z.pow_pos 2 23) +1 ).
*** apply Rlt_le. rewrite INR_IZR_INZ. apply Rplus_lt_compat_r. apply IZR_lt. lia.
*** unfold u. simpl. unfold F', F_max; simpl; nra.
} rewrite H9. rewrite -Heqm.
assert (S m = (n-1)%nat). { lia. } rewrite H10.
assert ((n - 1 - 1)%nat = (n-2)%nat). { lia. } rewrite H11.
clear H10 H11.
assert ((F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) * INR (n - 1) *
(1 + u0) ^ (n - 1) + INR (n - 1) * u * (1 + u0) ^ (n - 2) +
u * ((1 + u0) ^ (n - 2) - 1) / u0 =
(F' / ((nr+1) * (1 + u0) ^ (n + 1)) * INR (n-1) *(1 + u0) ^ (n - 1)) +
((INR (n - 1) * u * (1 + u0) ^ (n - 2) - INR (n - 1) * u * (1 + u0) ^ (n - 1)) +
u * ((1 + u0) ^ (n - 2) - 1) / u0)).
{ nra. } rewrite H10. clear H10.
apply Rplus_le_compat.
-- unfold nr.
assert (F' / ((INR n+1) * (1 + u0) ^ (n + 1)) * INR (n - 1) *
(1 + u0) ^ (n - 1) =
(F' * / ((INR n+1) * (1 + u0) ^ (n + 1))) * INR (n - 1) *
(1 + u0) ^ (n - 1)). { nra. } rewrite H10. clear H10.
rewrite Rinv_mult_distr.
replace (F' * (INR n - 1) / INR n) with ((F' * (INR n - 1) / INR n) * 1) by nra.
assert (F' * (/ (INR n+1) * / (1 + u0) ^ (n + 1)) * INR (n - 1) *
(1 + u0) ^ (n - 1) =
(F' * (INR n - 1) / (INR n+1)) * ((1 + u0) ^ (n - 1) /(1 + u0) ^ (n + 1))).
{ rewrite minus_INR. simpl; nra. lia. } rewrite H10. clear H10.
apply Rmult_le_compat.
** apply Rmult_le_pos.
+++ apply Rmult_le_pos; try (unfold F', F_max; simpl; nra); try apply pos_INR.
apply Rge_le. apply Rge_minus. apply Rle_ge.
replace 1 with (INR 1) by (simpl; nra). apply le_INR;lia.
+++ apply Rlt_le. apply Rinv_0_lt_compat. apply Rplus_lt_0_compat. apply lt_0_INR; lia. nra.
** apply Rmult_le_pos. apply pow_le. unfold u0;simpl;nra.
apply Rlt_le, Rinv_0_lt_compat, x_pow_gt_0. unfold u0;simpl;nra.
** repeat apply Rmult_le_compat_l.
+++ apply Rmult_le_pos. unfold F',F_max;simpl;nra.
apply Rge_le, Rge_minus,Rle_ge. replace 1 with (INR 1) by (simpl;nra).
apply le_INR. lia.
+++ apply Rlt_le. apply Rinv_lt_contravar. apply Rmult_lt_0_compat.
apply lt_0_INR. lia. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra. nra.
** assert (1 = (1+u0)^(n+1) / (1+u0)^(n+1)).
{ symmetry. apply Rinv_r. apply pow_nonzero .
unfold u0;simpl;nra.
}
assert ( (1 + u0) ^ (n - 1) / (1 + u0) ^ (n + 1) <=
(1+u0)^(n+1) / (1+u0)^(n+1) ->
(1 + u0) ^ (n - 1) / (1 + u0) ^ (n + 1) <= 1).
{ rewrite -H10; nra. } apply H11. apply Rmult_le_compat_r.
+++ apply Rlt_le, Rinv_0_lt_compat. apply x_pow_gt_0. unfold u0;simpl;nra.
+++ apply Rle_pow. unfold u0;simpl;nra. lia.
** assert (0 < INR n + 1 -> INR n + 1 <> 0). { nra. } apply H10.
apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
** apply pow_nonzero. unfold u0;simpl;nra.
-- match goal with |-context[ _ <= ?a]=>
replace a with (0 + a) by nra
end. apply Rplus_le_compat.
** assert ((n - 1)%nat = (S (n-2))%nat). { lia. }
rewrite H10.
assert (INR (S (n - 2)) * u * (1 + u0) ^ (n - 2) -
INR (S (n - 2)) * u * (1 + u0) ^ S (n - 2) =
- (u0 * INR (S (n - 2)) * u * (1 + u0) ^ (n - 2))).
{ simpl; nra. } rewrite H11.
apply Rge_le. apply Ropp_0_le_ge_contravar.
repeat apply Rmult_le_pos; try (simpl;nra); try nra; try apply pos_INR;
try (apply Rlt_le, x_pow_gt_0; unfold u0; simpl; nra).
** rewrite -/u -/u0.
replace (u * ((1 + u0) ^ (n - 2) - 1) / u0) with
(((1 + u0) ^ (n - 2) - 1) * (u / u0)) by nra.
replace (2 * u / u0) with (2 * (u/u0)) by nra.
apply Rmult_le_compat_r.
+++ unfold u,u0; simpl; nra.
+++ apply Rlt_le. apply (delta_bound (n-2)%nat).
apply lt_trans with n; lia.
+ destruct (prove_rndoff'' (fst a) (snd a) vmap 2%nat).
+++ lia.
+++ apply two_lt_n.
+++ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
--- specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) (a :: L)).
{ destruct a. simpl;auto. } specialize (H1 H9).
apply H1.
--- apply Rabs_ineq.
specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) (a :: L)).
{ destruct a. simpl. auto. } specialize (H1 H9).
fold u u0. destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
*** nra.
*** apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
++++ apply Rmult_lt_0_compat.
---- apply Rmult_lt_0_compat.
**** apply lt_0_INR. lia.
**** apply x_pow_gt_0. unfold u0; simpl; nra.
---- apply Rmult_lt_0_compat.
**** unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
**** apply x_pow_gt_0. unfold u0; simpl; nra.
++++ apply Rmult_lt_compat.
---- apply pos_INR.
---- apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
---- unfold nr.
assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H1. replace 1 with (INR 1) by (simpl;nra). apply lt_INR. lia.
---- apply Rlt_pow. unfold u0; simpl; nra. lia.
--- specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) (a :: L)).
{ destruct a. simpl;auto. } specialize (H1 H9).
apply H1.
--- apply Rabs_ineq.
specialize (H1 (fst a) (snd a)).
assert (In (fst a, snd a) (a :: L)).
{ destruct a. simpl. auto. } specialize (H1 H9).
fold u u0. destruct H1 as [Hfa1 [Hfa2 [Ha1 Ha2]]].
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
*** nra.
*** apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
++++ apply Rmult_lt_0_compat.
---- apply Rmult_lt_0_compat.
**** apply lt_0_INR. lia.
**** apply x_pow_gt_0. unfold u0; simpl; nra.
---- apply Rmult_lt_0_compat.
**** unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
**** apply x_pow_gt_0. unfold u0; simpl; nra.
++++ apply Rmult_lt_compat.
---- apply pos_INR.
---- apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
---- unfold nr.
assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H1. replace 1 with (INR 1) by (simpl;nra). apply lt_INR. lia.
---- apply Rlt_pow. unfold u0; simpl; nra. lia.
+++ auto.
+ apply Rabs_ineq.
pose proof (prove_rndoff_prod (fst a) (snd a) 2%nat).
assert ((1 < 2)%nat). { lia. } specialize (H9 H10).
assert ((2 < Z.to_nat (Z.pow_pos 2 23))%nat).
{ lia. } specialize (H9 H11).
remember (fst a) as a1.
remember (snd a) as a2.
assert (Rabs (FT2R a1) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) /\
Rabs (FT2R a2) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
{ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ left. simpl. rewrite Heqa1 Heqa2. destruct a. simpl. auto. }
specialize (H1 H12). nra.
} destruct H12 as [Ha1 Ha2].
pose proof (prove_rndoff_prod a1 a2 2%nat H10).
specialize (H12 H11).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap a1 a2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ destruct a. rewrite Heqa1 Heqa2. simpl. auto. } specialize (H1 H13).
apply H1.
+ apply Rabs_ineq. fold u u0. unfold nr in Ha2.
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- apply Ha2.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply lt_0_INR. lia.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply pos_INR.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr.
assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H13. replace 1 with (INR 1) by (simpl;nra). apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
+ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ destruct a. rewrite Heqa1 Heqa2. simpl. auto. } specialize (H1 H13).
apply H1.
+ apply Rabs_ineq.
fold u u0. unfold nr in Ha2.
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- apply Ha1.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar .
* apply Rmult_lt_0_compat.
++ apply Rmult_lt_0_compat.
-- apply lt_0_INR. lia.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
++ apply Rmult_lt_0_compat.
-- unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
-- apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rmult_lt_compat.
++ apply pos_INR.
++ apply Rlt_le, x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr.
assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H13. replace 1 with (INR 1) by (simpl;nra). apply lt_INR. lia.
++ apply Rlt_pow. unfold u0; simpl; nra. lia.
} specialize (H12 H13).
apply Rabs_triang_inv_impl in H12. apply side_switch in H12.
fold u u0 in H12.
apply Rle_trans with
(Rabs (FT2R a1 * FT2R a2) +
(Rabs (FT2R a1 * FT2R a2) * u0 + u)).
++ nra.
++ rewrite -/u0.
apply Rle_trans with
((sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) *
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)) * (1 + u0) + u).
-- rewrite Rabs_mult.
assert (Rabs (FT2R a1) * Rabs (FT2R a2) +
(Rabs (FT2R a1) * Rabs (FT2R a2) * u0 + u) =
(Rabs (FT2R a1) * Rabs (FT2R a2)) * (1 +u0) + u).
{ nra. } rewrite H14. apply Rplus_le_compat_r.
apply Rmult_le_compat_r.
unfold u0; simpl; nra.
apply Rmult_le_compat; try apply Ha1; try apply Ha2.
apply Rabs_pos. apply Rabs_pos.
-- rewrite sqrt_def .
** unfold nr.
assert ((F' / ((INR n+1) * (1 + u0) ^ (n + 1)) - u) * (1 + u0) + u =
(F' / ((INR n+1) * (1 + u0) ^ (n + 1)) * (1+u0)) - u * u0).
{ nra. } rewrite H14.
assert (F' / ((INR n +1)* (1 + u0) ^ (n + 1)) * (1 + u0) = F' / ((INR n+1) * (1 + u0) ^ n)).
{ assert (F' / ((INR n+1) * (1 + u0) ^ (n + 1)) * (1 + u0) =
F' * ( (1+u0) * / ((INR n+1) * (1 + u0) ^ (n + 1)))).
{ nra. } rewrite H15.
assert (((1 + u0) * / ((INR n+1) * (1 + u0) ^ (n + 1))) =
/ ((INR n+1) * (1 + u0) ^ n)).
{ rewrite Rinv_mult_distr.
+ rewrite Rinv_mult_distr.
- assert ((1 + u0) * (/ (INR n+1) * / (1 + u0) ^ (n + 1)) =
/ (INR n+1) * ((1+u0) * / (1+u0)^(n+1))).
{ nra. } rewrite H16.
assert (((1 + u0) * / (1 + u0) ^ (n + 1)) = / (1 + u0) ^ n).
{ assert ((n+1)%nat = S n). { lia. } rewrite H17.
assert ((1 + u0) ^ S n = (1+u0) * (1+u0)^n).
{ simpl. nra. } rewrite H18.
rewrite Rinv_mult_distr.
+ assert ((1 + u0) * (/ (1 + u0) * / (1 + u0) ^ n) =
((1 + u0) / (1+u0)) * / (1 + u0) ^ n). { nra. }
rewrite H19.
assert ((1 + u0) / (1+u0) = 1).
{ apply Rinv_r. unfold u0; simpl; nra. }
rewrite H20. nra.
+ unfold u0; simpl; nra.
+ apply pow_nonzero. unfold u0; simpl; nra.
} rewrite H17. nra.
- assert (0 < INR n +1 -> INR n + 1 <> 0). { nra. } apply H16.
apply Rplus_lt_0_compat. apply lt_0_INR;lia. nra.
- apply pow_nonzero. unfold u0; simpl; nra.
+ assert (0 < INR n +1 -> INR n + 1 <> 0). { nra. } apply H16.
apply Rplus_lt_0_compat. apply lt_0_INR;lia. nra.
+ apply pow_nonzero. unfold u0; simpl; nra.
} rewrite H16. nra.
} rewrite H15.
apply Rle_trans with (F' / ((INR n + 1) * (1 + u0) ^ n)).
+++ unfold u, u0; simpl; nra.
+++ apply Rle_trans with (F' / (INR n * (1 + u0) ^ n)).
apply Rmult_le_compat_l. unfold F',F_max;simpl;nra.
apply Rlt_le. apply Rinv_lt_contravar.
--- apply Rmult_lt_0_compat.
*** apply Rmult_lt_0_compat. apply lt_0_INR;lia.
apply x_pow_gt_0. unfold u0;simpl;nra.
*** apply Rmult_lt_0_compat. apply Rplus_lt_0_compat.
apply lt_0_INR. lia. nra. apply x_pow_gt_0. unfold u0;simpl;nra.
--- apply Rmult_lt_compat_r. apply x_pow_gt_0. unfold u0;simpl;nra. nra.
--- unfold u0;simpl;nra.
** apply Rge_le. apply Rge_minus. apply Rle_ge.
apply pow_invert.
* apply Rmult_lt_0_compat. apply Rplus_lt_0_compat. apply lt_0_INR. lia. nra.
apply x_pow_gt_0. unfold u0; simpl; nra.
* apply Rle_trans with
(u * ((INR n+1) * 3)).
+++ repeat apply Rmult_le_compat_l.
--- unfold u; simpl; nra.
--- apply Rplus_le_le_0_compat. apply pos_INR. nra.
--- apply Rlt_le.
pose proof (delta_bound (n+1)%nat).
assert ( (n + 1 < Z.to_nat (Z.pow_pos 2 23))%nat).
{ lia. } specialize (H14 H15).
fold u0 in H14.
nra.
+++ replace (u * ((INR n+1) * 3)) with ((INR n+1) * (3 * u)) by nra.
apply pow_invert_1.
--- unfold u;simpl;nra.
--- apply Rle_trans with
(IZR (Z.pow_pos 2 23) +1 ).
*** apply Rlt_le. rewrite INR_IZR_INZ. apply Rplus_lt_compat_r. apply IZR_lt. lia.
*** unfold u. simpl. unfold F', F_max; simpl; nra.
} specialize (H7 H9). fold u u0 in H7.
apply Rle_trans with
((Rabs (FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (sum_fixF Tsingle (prod_fixF Tsingle L))) * u0 + u) +
(Rabs (FT2R (prod Tsingle (fst a) (snd a)) - FT2R (fst a) * FT2R (snd a)) +
Rabs (FT2R (sum_fixF Tsingle (prod_fixF Tsingle L)) -
sum_fixR (prod_fixR (Flist_to_Rlist_pair L))) )).
** apply Rplus_le_compat.
+++ nra.
+++ assert ((FT2R (prod Tsingle (fst a) (snd a)) +
FT2R (sum_fixF Tsingle (prod_fixF Tsingle L)) -
(FT2R (fst a) * FT2R (snd a) +
sum_fixR (prod_fixR (Flist_to_Rlist_pair L)))) =
(FT2R (prod Tsingle (fst a) (snd a)) - FT2R (fst a) * FT2R (snd a)) +
(FT2R (sum_fixF Tsingle (prod_fixF Tsingle L)) -
sum_fixR (prod_fixR (Flist_to_Rlist_pair L)))).
{ nra. } rewrite H10. apply Rabs_triang.
** pose proof (prove_rndoff_prod (fst a) (snd a) 2%nat).
assert ((1 < 2)%nat). { lia. } specialize (H10 H11).
assert ((2 < Z.to_nat (Z.pow_pos 2 23))%nat).
{ lia. } specialize (H10 H12).
remember (fst a) as a1.
remember (snd a) as a2.
assert (Rabs (FT2R a1) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u) /\
Rabs (FT2R a2) <=
sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
{ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ rewrite Heqa1 Heqa2. destruct a. simpl. auto. }
specialize (H1 H13). nra.
} destruct H13 as [Ha1 Ha2].
pose proof (prove_rndoff_prod a1 a2 2%nat H11 H12).
assert (boundsmap_denote (@bmap_prod Tsingle 2) (vmap a1 a2)).
{ apply boundsmap_denote_i.
2: repeat apply list_forall_cons; try apply list_forall_nil; simpl; auto.
repeat apply list_forall_cons; try apply list_forall_nil;
(eexists; split; [|split;[|split]]; try reflexivity; auto;
try unfold List.nth; try nra; auto).
+ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ rewrite Heqa1 Heqa2. destruct a. simpl; auto. }
apply H1. auto.
+ apply Rabs_ineq. fold u u0. unfold nr in Ha2.
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- apply Ha2.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r. apply Rmult_le_compat_l.
unfold F', F_max; simpl; nra.
assert (n= 2%nat \/ (2 < n)%nat). { lia. } destruct H14.
* unfold nr. rewrite H14. rewrite Rinv_mult_distr.
++ rewrite Rinv_mult_distr. apply Rmult_le_compat. simpl; nra.
apply Rlt_le. apply Rinv_0_lt_compat.
try (unfold u0;simpl;nra). simpl;nra. try (unfold u0;simpl;nra).
simpl;nra. unfold u0; simpl; nra.
++ simpl; nra.
++ unfold u0; simpl; nra.
* apply Rlt_le. apply Rinv_lt_contravar.
++ apply Rmult_lt_0_compat.
-- unfold u0; simpl; nra.
-- apply Rmult_lt_0_compat.
** unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR; lia. nra.
** apply x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr. apply Rmult_lt_compat.
-- simpl; nra.
-- unfold u0; simpl; nra.
-- assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H15. replace 1 with (INR 1) by (simpl;nra). apply lt_INR; lia.
-- apply Rlt_pow. unfold u0; simpl; nra. lia.
+ specialize (H1 a1 a2).
assert (In (a1, a2) (a :: L)).
{ rewrite Heqa1 Heqa2. destruct a. simpl; auto. }
apply H1. auto.
+ apply Rabs_ineq. fold u u0. unfold nr in Ha1.
apply Rle_trans with
(sqrt (F' / ((nr+1) * (1 + u0) ^ (n + 1)) - u)).
- apply Ha1.
- apply sqrt_le_1_alt. apply Rplus_le_compat_r. apply Rmult_le_compat_l.
unfold F', F_max; simpl; nra.
assert (n= 2%nat \/ (2 < n)%nat). { lia. } destruct H14.
* unfold nr. rewrite H14. rewrite Rinv_mult_distr.
++ rewrite Rinv_mult_distr. unfold u0; simpl; nra.
simpl; nra. unfold u0; simpl; nra.
++ simpl; nra.
++ unfold u0; simpl; nra.
* apply Rlt_le. apply Rinv_lt_contravar.
++ apply Rmult_lt_0_compat.
-- unfold u0; simpl; nra.
-- apply Rmult_lt_0_compat.
** unfold nr. apply Rplus_lt_0_compat. apply lt_0_INR; lia. nra.
** apply x_pow_gt_0. unfold u0; simpl; nra.
++ unfold nr. apply Rmult_lt_compat.
-- simpl; nra.
-- unfold u0; simpl; nra.
-- assert (1 < INR n -> INR 2 < INR n + 1). { simpl;nra. }
apply H15. replace 1 with (INR 1) by (simpl;nra). apply lt_INR; lia.
-- apply Rlt_pow. unfold u0; simpl; nra. lia.
} specialize (H13 H14). fold u u0 in H13.
unfold dot_prodF, dot_prodR in IHL.
apply Rle_trans with
((Rabs
(FT2R (prod Tsingle a1 a2) +
FT2R (sum_fixF Tsingle (prod_fixF Tsingle L))) * u0 + u) +
((Rabs (FT2R a1 * FT2R a2) * u0 + u) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0))).
+++ apply Rplus_le_compat_l. apply Rplus_le_compat; nra.
+++ apply Rabs_triang_inv_impl in H13. apply side_switch in H13.
apply Rle_trans with
((((Rabs (FT2R a1 * FT2R a2)* (1+u0) + u) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) * (1 + u0) ^ S m +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0))* u0 + u) +
(Rabs (FT2R a1 * FT2R a2) * u0 + u +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0))).
--- apply Rplus_le_compat_r.
apply Rle_trans with
((Rabs (FT2R (prod Tsingle a1 a2)) +
Rabs (FT2R (sum_fixF Tsingle (prod_fixF Tsingle L)))) * u0 + u).
*** apply Rplus_le_compat_r. apply Rmult_le_compat_r.
unfold u0; simpl; nra. apply Rabs_triang.
*** apply Rplus_le_compat_r. apply Rmult_le_compat_r.
unfold u0;simpl;nra. apply Rplus_le_compat.
nra. destruct IHL as [ifHL IHL].
apply Rabs_triang_inv_impl in IHL. apply side_switch in IHL.
apply Rle_trans with
(Rabs (sum_fixR (prod_fixR (Flist_to_Rlist_pair L))) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)).
++++ nra.
++++ apply Rle_trans with
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) + INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)).
---- apply Rplus_le_compat_r. apply sum_abs_pair_le.
---- nra.
--- rewrite Rabs_mult.
assert ((Rabs (FT2R a1) * Rabs (FT2R a2) * (1 + u0) + u +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
(1 + u0) ^ S m + INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)) * u0 + u +
(Rabs (FT2R a1) * Rabs (FT2R a2) * u0 + u +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
((1 + u0) ^ S m - 1) +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)) =
((Rabs (FT2R a1) * Rabs (FT2R a2)) * (u0 * (1+u0) + u0) +
((sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) *
(u0 * (1 + u0) ^ S m + ((1 + u0) ^ S m - 1))) +
(u * u0 + u0 * INR (S m) * u * (1 + u0) ^ (S m - 1) +
u0 * u * ((1 + u0) ^ (S m - 1) - 1) / u0 + 2* u +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0)))). { nra. }
rewrite H15. clear H15.
assert ((Rabs (FT2R a1) * Rabs (FT2R a2) +
sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L))) *
((1 + u0) * (1 + u0) ^ S m - 1) +
nr * u * (1 + u0) ^ (S m - 0) +
u * ((1 + u0) ^ (S m - 0) - 1) / u0 =
((Rabs (FT2R a1) * Rabs (FT2R a2)) * ((1 + u0) * (1 + u0) ^ S m - 1) +
(sum_fixR (prod_fixR (Flist_to_Rlist_pair_abs L)) * ((1 + u0) * (1 + u0) ^ S m - 1) +
(nr * u * (1 + u0) ^ (S m - 0) +
u * ((1 + u0) ^ (S m - 0) - 1) / u0)))). { nra. } rewrite H15.
apply Rplus_le_compat.
++++ apply Rmult_le_compat_l.
*** repeat apply Rmult_le_pos; apply Rabs_pos.
*** assert (u0 * (1 + u0) + u0 = (1+u0)^2 - 1).
{ nra. } rewrite H16. apply Rplus_le_compat_r.
assert ((1 + u0) * (1 + u0) ^ S m = (1+u0)^(S m +1)).
{ simpl. assert (S m = (m+1)%nat). { lia. } rewrite -H17. simpl. nra. }
rewrite H17. apply Rle_pow. unfold u0; simpl; nra. lia.
++++ apply Rplus_le_compat.
*** apply Rmult_le_compat_l.
---- apply sum_abs_pair_rel.
---- nra.
*** unfold nr.
assert ((S m - 0)%nat = S m). { lia. } rewrite H16.
rewrite H2. rewrite plus_INR. change (INR 1) with 1.
assert (u * u0 + u0 * INR (S m) * u * (1 + u0) ^ (S m - 1) +
u0 * u * ((1 + u0) ^ (S m - 1) - 1) / u0 + 2 * u +
INR (S m) * u * (1 + u0) ^ (S m - 1) +
u * ((1 + u0) ^ (S m - 1) - 1) / u0 =
u * u0 + (INR (S m) * u * (1+u0)* (1+u0)^(S m -1)) +
u0 * u * ((1 + u0) ^ (S m - 1) - 1) / u0 + 2 * u +
u * ((1 + u0) ^ (S m - 1) - 1) / u0).
{ nra. } rewrite H17. clear H17.
assert (INR (S m) * u * (1 + u0) * (1 + u0) ^ (S m - 1) =
INR (S m) * u * (1+u0)^(S m)).
{ assert (S m = S (S m -1)). { lia. }
assert (INR (S m) * u * (1 + u0) ^ S m = INR (S m) * u * (1 + u0) ^ S (S m -1)).
{ by rewrite -H17. } rewrite H18. simpl. nra.
} rewrite H17.
assert (u * u0 + INR (S m) * u * (1 + u0) ^ S m +
u0 * u * ((1 + u0) ^ (S m - 1) - 1) / u0 +
2 * u + u * ((1 + u0) ^ (S m - 1) - 1) / u0 =
u * u0 + INR (S m) * u * (1 + u0) ^ S m +
u * (1+u0)* ((1 + u0) ^ (S m - 1) - 1) / u0 + 2 * u).
{ nra. } rewrite H18. clear H18.
assert (u * (1 + u0) * ((1 + u0) ^ (S m - 1) - 1) / u0 =
u * (1+u0) * (1 + u0) ^ (S m - 1) / u0 - u * (1+u0) / u0).
{ nra. } rewrite H18. clear H18.
assert ( u * (1+u0) * (1 + u0) ^ (S m - 1) / u0 =
u * (1+u0)^(S m) / u0).
{ assert (S m = S (S m -1)). { lia. }
assert (u * (1+u0)^(S m) / u0 = u * (1+u0)^(S (S m -1)) / u0).
{ by rewrite -H18. } rewrite H19. simpl. nra.
} rewrite H18.
assert (u * ((1 + u0) ^ S m - 1) / u0 =
(u * (1 + u0) ^ S m) / u0 - u / u0).
{ nra. } rewrite H19.
assert ((INR (S m) + 1) * u * (1 + u0) ^ S m =
INR (S m) * u * (1 + u0) ^ S m + u * (1 + u0) ^ S m).
{ nra. } rewrite H20.
assert (u * u0 + INR (S m) * u * (1 + u0) ^ S m +
(u * (1 + u0) ^ S m / u0 - u * (1 + u0) / u0) +
2 * u =
(INR (S m) * u * (1 + u0) ^ S m + u * (1 + u0) ^ S m / u0) +
(u * (1 + u0) - u / u0)).
{ unfold u, u0; simpl; nra. } rewrite H21.
assert (INR (S m) * u * (1 + u0) ^ S m + u * (1 + u0) ^ S m +
(u * (1 + u0) ^ S m / u0 - u / u0) =
(INR (S m) * u * (1 + u0) ^ S m + u * (1 + u0) ^ S m / u0) +
(u * (1 + u0) ^ S m - u / u0)).
{ nra. } rewrite H22.
apply Rplus_le_compat_l. apply Rplus_le_compat_r.
apply Rmult_le_compat_l. unfold u; simpl; nra.
assert (1 + u0 = (1+u0)^1). { nra. } rewrite H23.
assert (((1 + u0) ^ 1) ^ S m = (1+u0)^ S m).
{ simpl. rewrite Rmult_1_r. nra. } rewrite H24.
apply Rle_pow. unfold u0; simpl; nra. lia.
Qed.
(** Using Coq's combine function to combibe two lists to get a
list of pairs
**)
Lemma forward_error_dot_precise:
forall (L1 L2: list (ftype Tsingle)),
let L := combine L1 L2 in
let ty := Tsingle in
let n:= length L in
let nr := INR n in
(1 < n)%nat ->
let u := / 2 * Raux.bpow Zaux.radix2 (3 - femax Tsingle - fprec Tsingle) in
let u0 := / 2 * Raux.bpow Zaux.radix2 (- fprec Tsingle + 1) in
(n < Z.to_nat (Z.pow_pos 2 23) - 1)%nat ->
(forall a b : ftype Tsingle,
In (a,b) L ->
Binary.is_finite (fprec Tsingle)
(femax Tsingle) a = true /\
Binary.is_finite (fprec Tsingle)
(femax Tsingle) b = true /\
Rabs (FT2R a) <= sqrt( F' / ((nr+1) * (1+u0)^(n+1)) - u ) /\
Rabs (FT2R b) <= sqrt( F' / ((nr+1) * (1+u0)^(n+1)) - u )) ->
is_finite (fprec Tsingle) (femax Tsingle)
(dot_prodF _ L) = true /\
Rabs (FT2R (dot_prodF _ L) - dot_prodR (Flist_to_Rlist_pair L)) <=
(dot_prodR (Flist_to_Rlist_pair_abs L)) * ((1 + u0)^n -1) +
nr * u * (1+u0)^(n-1) + u * ((1+u0)^(n-1) -1) / u0.
Proof.
intros.
by apply forward_error_dot_aux.
Qed.
End WITHNANS. |
-- |
-- Module : Foreign.CUDA.Solver.Internal.C2HS
-- Copyright : [2017] Trevor L. McDonell
-- License : BSD3
--
-- Maintainer : Trevor L. McDonell <[email protected]>
-- Stability : experimental
-- Portability : non-portable (GHC extensions)
--
module Foreign.CUDA.Solver.Internal.C2HS (
-- * Conversion between C and Haskell types
cIntConv, cFloatConv, cToBool, cFromBool, cToEnum, cFromEnum,
-- * Composite marshalling functions
withComplex,
peekIntConv, peekFloatConv,
) where
-- system
import Control.Monad
import Data.Complex
import Foreign
import Foreign.C
import Foreign.Storable.Complex ()
-- Conversions -----------------------------------------------------------------
--
-- | Integral conversion
--
{-# INLINE cIntConv #-}
cIntConv :: (Integral a, Integral b) => a -> b
cIntConv = fromIntegral
-- | Floating conversion
--
{-# INLINE [1] cFloatConv #-}
cFloatConv :: (RealFloat a, RealFloat b) => a -> b
cFloatConv = realToFrac
-- As this conversion by default goes via `Rational', it can be very slow...
{-# RULES
"cFloatConv/Float->Float" forall (x::Float). cFloatConv x = x;
"cFloatConv/Double->Double" forall (x::Double). cFloatConv x = x;
"cFloatConv/Float->CFloat" forall (x::Float). cFloatConv x = CFloat x;
"cFloatConv/CFloat->Float" forall (x::Float). cFloatConv CFloat x = x;
"cFloatConv/Double->CDouble" forall (x::Double). cFloatConv x = CDouble x;
"cFloatConv/CDouble->Double" forall (x::Double). cFloatConv CDouble x = x
#-}
-- | Obtain C value from Haskell 'Bool'.
--
{-# INLINE cFromBool #-}
cFromBool :: Num a => Bool -> a
cFromBool = fromBool
-- | Obtain Haskell 'Bool' from C value.
--
{-# INLINE cToBool #-}
cToBool :: (Eq a, Num a) => a -> Bool
cToBool = toBool
-- | Convert a C enumeration to Haskell.
--
{-# INLINE cToEnum #-}
cToEnum :: (Integral i, Enum e) => i -> e
cToEnum = toEnum . cIntConv
-- | Convert a Haskell enumeration to C.
--
{-# INLINE cFromEnum #-}
cFromEnum :: (Enum e, Integral i) => e -> i
cFromEnum = cIntConv . fromEnum
-- | Marshalling of complex numbers
--
{-# INLINE withComplex #-}
withComplex :: Storable a => Complex a -> (Ptr () -> IO b) -> IO b
withComplex c f = with c (f . castPtr)
-- | Marshalling of numerals
--
{-# INLINE peekIntConv #-}
peekIntConv :: (Storable a, Integral a, Integral b) => Ptr a -> IO b
peekIntConv = liftM cIntConv . peek
{-# INLINE peekFloatConv #-}
peekFloatConv :: (Storable a, RealFloat a, RealFloat b) => Ptr a -> IO b
peekFloatConv = liftM cFloatConv . peek
|
```python
import sympy as sy
sy.init_printing(use_unicode=False)
```
```python
x,y=sy.symbols('x y')
```
```python
lam=sy.symbols("\lambda")
```
```python
g=x*x+y*y-1.0
f=x+y
phi=f-lam*g
```
```python
[sy.diff(phi,x),
sy.diff(phi,y),
sy.diff(phi,lam)]
```
```python
```
```python
```
|
# TASI Lecture: Quantum teleportation in a quantum circuit
Author: J. Lykken
This notebook goes with Lecture One, June 23 2020, of
"Quantum Information for Particle Theorists"
at the TASI summer school.
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
https://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.
[Cirq](https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_quantumlib_cirq&d=DwIGaQ&c=gRgGjJ3BkIsb5y6s49QqsA&r=Gl74vKKu9i-SToN0SgQC_w&m=ED3KJ2syYM_OQ64L0CIWSMP_ROvlcoHv83uHUp3_ryg&s=9kHGNyGghHB2ir0kC36e0CFYGNmbEIOnUVnvOrAausM&e=) is a framework for writing quantum algorithms for noisy intermediate scale quantum (NISQ) devices.
---
### Connect to the Google Colab cloud GPU service
```python
#### GOOGLE COLAB SPECIFIC ##########################
# You will need a free Google Colab account or a paid Colab Pro account
# Put this notebook in your Google Drive, then open it using Colab
#
# CODE SNIPPET TO ACCESS THE FILES IN YOUR GOOGLE DRIVE
# IT WILL ASK YOU FOR AUTHORIZATION VIA YOUR GOOGLE ACCOUNT
# Load the Drive helper and mount
from google.colab import drive
# This will prompt for authorization.
# drive.mount('/content/drive')
drive.mount("/content/drive", force_remount=True)
# After executing the cell above, Drive
# files will be present in "/content/drive/My Drive".
# !ls "/content/drive/My Drive"
```
Mounted at /content/drive
### Installing cirq
Executing the following cell will attempt to install cirq. On Google Colab it may then ask you to restart the runtime; do so.
```python
!pip install cirq --quiet
```
[K |ββββββββββββββββββββββββββββββββ| 1.6MB 2.7MB/s
[?25h
To verify that Cirq is installed in your environment, try to `import cirq` and print out a diagram of the 22-qubit Foxtail chip. It should produce a 2x11 grid of qubits.
```python
import cirq
print(cirq.google.Foxtail)
```
(0, 0)βββ(0, 1)βββ(0, 2)βββ(0, 3)βββ(0, 4)βββ(0, 5)βββ(0, 6)βββ(0, 7)βββ(0, 8)βββ(0, 9)βββ(0, 10)
β β β β β β β β β β β
β β β β β β β β β β β
(1, 0)βββ(1, 1)βββ(1, 2)βββ(1, 3)βββ(1, 4)βββ(1, 5)βββ(1, 6)βββ(1, 7)βββ(1, 8)βββ(1, 9)βββ(1, 10)
### Import things we might need and define path to our Google Drive directory
```python
# Define a googlepath to your googledrive to load/save files.
# Modify the example below as needed
googlepath = "drive/My Drive/Colab Notebooks/TASI"
from cirq.circuits import InsertStrategy
import tensorflow as tf
import numpy as np
from numpy import around, log2, isreal, all, trace, conj, outer
from math import factorial, sqrt, pi
from cmath import exp
from numpy import matrix, eye, count_nonzero, around, sum, save
import scipy, sympy
from scipy import interpolate
from sympy import Symbol
import matplotlib.pyplot as plt
from matplotlib import gridspec
import gc, random, timeit
from timeit import default_timer as timer
from IPython.display import Markdown, display
def printmd(string):
display(Markdown(string))
```
### Experiment 1: Simplest single qubit circuit in Cirq
From Cirq tutorial and Jack Hidary's book Chapt 6
```python
# Get a qubit and a circuit
qbit = cirq.LineQubit(0)
circuit = cirq.Circuit()
# Add an X gate: acts like the Pauli Matrix sigma_x
circuit.append(cirq.X(qbit))
# Run a simple simulation that extracts the wavefunction of this state
sim = cirq.Simulator()
result = sim.simulate(circuit)
printmd("\n**Bloch Sphere of the qubit in the final state:**")
state = cirq.bloch_vector_from_state_vector(result.final_state_vector,0)
print("x: ", around(state[0], 4), " y: ", around(state[1], 4),
" z: ", around(state[2], 4))
# Add a measurement at the end of the circuit:
circuit.append(cirq.measure(qbit, key="Final state"))
# Display the circuit:
printmd("\n**Cirq circuit:**")
print(circuit)
# Invoke the Cirq quantum simulator to execute the circuit:
simulator = cirq.Simulator()
# Simulate the circuit several times:
result = simulator.run(circuit, repetitions=10)
# Print the results:
printmd("\n**Results of 10 trials:**")
print(result)
```
**Bloch Sphere of the qubit in the final state:**
x: 0.0 y: 0.0 z: -1.0
**Cirq circuit:**
0: βββXβββM('Final state')βββ
**Results of 10 trials:**
Final state=1111111111
### Experiment 2: Circuit to create a Bell state in Cirq
From Jack Hidary's book Chapt 6
```python
# Get two qubits and a circuit
qubit = [cirq.LineQubit(x) for x in range(2)]
circuit = cirq.Circuit()
# Add a Hadamard gate to qubit 0, then a CNOT gate from qubit 0 to qubit 1:
circuit.append([cirq.H(qubit[0]),
cirq.CNOT(qubit[0], qubit[1])])
# Run a simple simulation that extracts the actual final states
sim = cirq.Simulator()
result = sim.simulate(circuit)
printmd("\n**Bloch Sphere of the qubit 0 in the final state:**")
state = cirq.bloch_vector_from_state_vector(result.final_state_vector,0)
print("x: ", around(state[0], 4), " y: ", around(state[1], 4),
" z: ", around(state[2], 4))
printmd("\n**Bloch Sphere of the qubit 1 in the final state:**")
state = cirq.bloch_vector_from_state_vector(result.final_state_vector,1)
print("x: ", around(state[0], 4), " y: ", around(state[1], 4),
" z: ", around(state[2], 4))
# Add a measurement at the end of the circuit:
circuit.append(cirq.measure(*qubit, key="Final state"))
# Display the circuit:
printmd("\n**Cirq circuit:**")
print(circuit)
# Invoke the Cirq quantum simulator to execute the circuit:
simulator = cirq.Simulator()
# Simulate the circuit several times:
result = simulator.run(circuit, repetitions=10)
# Print the results:
printmd("\n**Results:**")
print(result)
```
**Bloch Sphere of the qubit 0 in the final state:**
x: 0.0 y: 0.0 z: 0.0
**Bloch Sphere of the qubit 1 in the final state:**
x: 0.0 y: 0.0 z: 0.0
**Cirq circuit:**
0: βββHβββ@βββM('Final state')βββ
β β
1: βββββββXβββMββββββββββββββββββ
**Results:**
Final state=1000111111, 1000111111
### Experiment 3: Circuit to SWAP two qubit states
```python
# Get two qubits and a circuit
qubit = [cirq.LineQubit(x) for x in range(2)]
circuit = cirq.Circuit()
# Add a Hadamard gate to make the initial state of qubit 0:
circuit.append([cirq.H(qubit[0])])
# Get a symbol
symbol = Symbol("t")
# Add a parameterized XPowGate to make the initial state of qubit 1:
circuit.append([cirq.XPowGate(exponent=symbol)(qubit[1])])
# Add three CNOT gates to make a SWAP gate:
circuit.append([cirq.CNOT(qubit[0], qubit[1]),
cirq.CNOT(qubit[1], qubit[0]),
cirq.CNOT(qubit[0], qubit[1])])
# Measure qubit 1 first, then measure qubit 0:
circuit.append(cirq.measure(qubit[1], key='q1'))
circuit.append(cirq.measure(qubit[0], key='q0'), strategy=InsertStrategy.NEW)
# Display the circuit:
printmd("\n**Cirq circuit:**")
print(circuit)
# Get a sweep over parameter values
sweep = cirq.Linspace(key=symbol.name, start=0.0, stop=1.0, length=3)
# Execute the circuit for all values in the sweep
sim = cirq.Simulator()
results = sim.run_sweep(circuit, sweep, repetitions=50)
printmd("\n**Results for t = 0:**")
print(results[0])
printmd("\n**Results for t = 1:**")
print(results[2])
printmd("\n**Results for t = 0.5:**")
print(results[1])
```
**Cirq circuit:**
0: βββHβββββ@βββXβββ@βββββββββββββM('q0')βββ
β β β
1: βββX^tβββXβββ@βββXβββM('q1')βββββββββββββ
**Results for t = 0:**
q0=00000000000000000000000000000000000000000000000000
q1=10110011100101111100100001001100101011100011110110
**Results for t = 1:**
q0=11111111111111111111111111111111111111111111111111
q1=00010001001010010011010001000011000010000001111001
**Results for t = 0.5:**
q0=00111110100111110101100000110001100001000011001010
q1=00010001110100101110111001111110001011100101000110
### Experiment 4: Quantum Teleportation
Quantum Teleportation is a process by which a quantum state can be transmitted
by sending only two classical bits of information. This is accomplished by
pre-sharing an entangled state between the sender (Alice) and the receiver
(Bob). This entangled state allows the receiver (Bob) of the two classical
bits of information to possess a qubit with the same state as the one held by
the sender (Alice).
In the following example output, qubit 0 (the Message) is set to a random state
by applying X and Y gates. By sending two classical bits of information after
a Bell State Measurement of qubit 0 (the Message) and qubit 1 (Alice's entangled qubit), the
final state of qubit 2 (Bob's entangled qubit) will be identical to the
original random state of qubit 0 (the Message). This is only possible given
that an entangled state is pre-shared between Alice and Bob.
Example adapted from the Cirq tutorials
```python
# Define three qubits: msg = qubit[0], qalice = qubit[1], qbob = qubit[2]
qubit=[0]*(3)
qubit[0] = cirq.NamedQubit('msg')
qubit[1] = cirq.NamedQubit('qalice')
qubit[2] = cirq.NamedQubit('qbob')
circuit = cirq.Circuit()
# Create a Bell state entangled pair to be shared between Alice and Bob.
circuit.append([cirq.H(qubit[1]), cirq.CNOT(qubit[1], qubit[2])])
# Creates a random state for the Message.
ranX = random.random()
ranY = random.random()
circuit.append([cirq.X(qubit[0])**ranX, cirq.Y(qubit[0])**ranY])
# Unitary operator rotating the two-qubit basis of the Message and Alice's entangled qubit;
# rotates the Bell state basis to the computational basis:
circuit.append([cirq.CNOT(qubit[0], qubit[1]), cirq.H(qubit[0])])
# Combining now with a measurment in the computational basis,
# we effectively have projected this two-qubit state onto one of the four states of
# the Bell state basis:
circuit.append(cirq.measure(qubit[0], qubit[1]))
# Use the two classical bits from the Bell measurement to recover the
# original quantum Message on Bob's entangled qubit.
circuit.append([cirq.CNOT(qubit[1], qubit[2]), cirq.CZ(qubit[0], qubit[2])])
printmd("\n**Cirq circuit:**")
print(circuit)
sim = cirq.Simulator()
# Run a simple simulation that applies the random X and Y gates that
# create our message.
q0 = cirq.LineQubit(0)
message = sim.simulate(cirq.Circuit([cirq.X(q0)**ranX, cirq.Y(q0)**ranY]))
printmd("\n**Bloch Sphere of the Message qubit in the initial state:**")
expected = cirq.bloch_vector_from_state_vector(message.final_state_vector,0)
print("x: ", around(expected[0], 4), " y: ", around(expected[1], 4),
" z: ", around(expected[2], 4))
# Records the final state of the simulation.
final_results = sim.simulate(circuit)
printmd("\n**Bloch Sphere of Bob's qubit in the final state:**")
teleported = cirq.bloch_vector_from_state_vector(
final_results.final_state_vector, 2)
print("x: ", around(teleported[0], 4), " y: ",
around(teleported[1], 4), " z: ", around(teleported[2], 4))
printmd("\n**Bloch Sphere of the Message qubit in the final state:**")
message_final = cirq.bloch_vector_from_state_vector(
final_results.final_state_vector, 0)
print("x: ", around(message_final[0], 4), " y: ",
around(message_final[1], 4), " z: ", around(message_final[2], 4))
```
**Cirq circuit:**
msg: ββββββX^0.565βββY^0.176βββ@βββHβββMβββββββ@βββ
β β β
qalice: βββHβββββββββ@βββββββββXβββββββMβββ@ββββΌβββ
β β β
qbob: βββββββββββββββXβββββββββββββββββββββXβββ@βββ
**Bloch Sphere of the Message qubit in the initial state:**
x: -0.1066 y: -0.9793 z: -0.1721
**Bloch Sphere of Bob's qubit in the final state:**
x: -0.1066 y: -0.9793 z: -0.1721
**Bloch Sphere of the Message qubit in the final state:**
x: 0.0 y: 0.0 z: -1.0
### Experiment 5: Quantum Teleportation without measurement
```python
# Define three qubits: msg = qubit[0], qalice = qubit[1], qbob = qubit[2]
qubit=[0]*(3)
qubit[0] = cirq.NamedQubit('msg')
qubit[1] = cirq.NamedQubit('qalice')
qubit[2] = cirq.NamedQubit('qbob')
circuit = cirq.Circuit()
# Create a Bell state entangled pair to be shared between Alice and Bob.
circuit.append([cirq.H(qubit[1]), cirq.CNOT(qubit[1], qubit[2])])
# Creates a random state for the Message.
ranX = random.random()
ranY = random.random()
circuit.append([cirq.X(qubit[0])**ranX, cirq.Y(qubit[0])**ranY])
# Unitary operator rotating the two-qubit basis of the Message and Alice's entangled qubit;
# rotates the Bell state basis to the computational basis:
circuit.append([cirq.CNOT(qubit[0], qubit[1]), cirq.H(qubit[0])])
# But this time skip the measurement
# circuit.append(cirq.measure(qubit[0], qubit[1]))
# Use the same operations as before to recover the
# original quantum Message on Bob's entangled qubit.
circuit.append([cirq.CNOT(qubit[1], qubit[2]), cirq.CZ(qubit[0], qubit[2])])
printmd("**Cirq circuit:**")
print(circuit)
sim = cirq.Simulator()
# Run a simple simulation that applies the random X and Y gates that
# create our message.
q0 = cirq.LineQubit(0)
message = sim.simulate(cirq.Circuit([cirq.X(q0)**ranX, cirq.Y(q0)**ranY]))
printmd("\n**Bloch Sphere of the Message qubit in the initial state:**")
expected = cirq.bloch_vector_from_state_vector(message.final_state_vector,0)
print("x: ", around(expected[0], 4), " y: ", around(expected[1], 4),
" z: ", around(expected[2], 4))
# Records the final state of the simulation.
final_results = sim.simulate(circuit)
printmd("\n**Bloch Sphere of Bob's qubit in the final state:**")
bob_final = cirq.bloch_vector_from_state_vector(
final_results.final_state_vector, 2)
print("x: ", around(bob_final[0], 4), " y: ",
around(bob_final[1], 4), " z: ", around(bob_final[2], 4))
printmd("\n**Bloch Sphere of the Message qubit in the final state:**")
message_final = cirq.bloch_vector_from_state_vector(
final_results.final_state_vector, 0)
print("x: ", around(message_final[0], 4), " y: ",
around(message_final[1], 4), " z: ", around(message_final[2], 4))
printmd("\n**Bloch Sphere of the Alice qubit in the final state:**")
alice_final = cirq.bloch_vector_from_state_vector(
final_results.final_state_vector, 1)
print("x: ", around(alice_final[0], 4), " y: ",
around(alice_final[1], 4), " z: ", around(alice_final[2], 4))
```
**Cirq circuit:**
msg: ββββββX^0.531βββY^0.277βββ@βββHβββ@βββ
β β
qalice: βββHβββββββββ@βββββββββXβββ@ββββΌβββ
β β β
qbob: βββββββββββββββXβββββββββββββXβββ@βββ
**Bloch Sphere of the Message qubit in the initial state:**
x: -0.0732 y: -0.9954 z: -0.0618
**Bloch Sphere of Bob's qubit in the final state:**
x: -0.0732 y: -0.9954 z: -0.0618
**Bloch Sphere of the Message qubit in the final state:**
x: 1.0 y: 0.0 z: 0.0
**Bloch Sphere of the Alice qubit in the final state:**
x: 1.0 y: 0.0 z: 0.0
|
#include <boost/beast/websocket/rfc6455.hpp>
|
## Author: Sergio GarcΓa Prado
## Title: Statistical Inference - Non parametric Tests - Exercise 03
rm(list = ls())
##Β H0: T(x) >= C(x)
## H1: T(x) < C(x)
n.c <- 9
n.t <- 9
(n <- n.c + n.t)
# 18
(W.t <- sum(1:8) + 18)
# 54
(W.t.mean <- n.t * (n + 1) / 2)
# 85.5
(W.t.var <- n.t * n.c * (n + 1) / 12)
# 128.25
(W.tc <- W.t - n.t * (n.t + 1) / 2)
# 9
(W.tc.mean <- n.t * n.c / 2)
# 40.5
(W.tc.var <- n.t * n.c * (n + 1) / 12)
# 128.25
pnorm((W.tc + 0.5 - W.tc.mean) / sqrt(W.tc.var))
# 0.00309665908702214
pwilcox(W.tc, n.t, n.c)
# 0.00199506375976964
## We'll reject H0 due to there aren't enough evidences in favor of T >= C,
## so we assume that T < C
|
subroutine checkversion(inpunit,filename)
************************************************************************
* Checks that the version of MCFM specified in the next line of unit *
* "inpunit" agrees with the version number of the code *
************************************************************************
implicit none
include 'codeversion.f'
integer inpunit,j,dat
character*6 fileversion
character*(*) filename
read(inpunit,*) fileversion
if (fileversion .ne. codeversion) then
dat=18
do j=1,20
if (filename(j:j) .eq. 'D') dat=j
enddo
write(6,*)
write(6,*) 'Sorry, the version of this input file does not'
write(6,*) 'match with the code version number. Please refer'
write(6,*) 'to the documentation and adjust accordingly.'
write(6,*)
write(6,*) ' Filename: ',filename(1:dat+2)
write(6,*) ' File version: ',fileversion
write(6,*) ' Code version: ',codeversion
write(6,*)
stop
endif
return
end
|
Through the sad heart of Ruth , when , sick for home ,
|
-- Martin-LΓΆf identity type
{-# OPTIONS --without-K --safe #-}
module TypeTheory.Identity where
open import Level renaming (zero to lzero; suc to lsuc)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as P using (refl; _β‘_)
renaming (trans to β‘-trans; sym to β‘-sym; cong to β‘-cong)
import Relation.Binary.Reasoning.Setoid as SetoidReasoning
record JBundle a : Set (lsuc a) where
field
Carrier : Set a
_β_ : Rel Carrier a
β-refl : β {x} β x β x
J : (C : β x y β x β y β Set a) β (β x β C x x β-refl) β
β x y (p : x β y) β C x y p
J-Ξ² : β (C : β x y β x β y β Set a) (c : β x β C x x β-refl) x β
J C c x x β-refl β‘ c x
module JBundleProperties {a} (jBundle : JBundle a) where
open JBundle jBundle renaming (Carrier to A)
sym : β {x y} β x β y β y β x
sym {x} {y} xβy = J (Ξ» xβ yβ xββyβ β yβ β xβ) (Ξ» _ β β-refl) x y xβy
sym-β-refl : β x β sym (β-refl {x}) β‘ β-refl
sym-β-refl x = J-Ξ² (Ξ» xβ yβ xββyβ β yβ β xβ) (Ξ» _ β β-refl) x
sym-involutive : β {x y} (p : x β y) β sym (sym p) β‘ p
sym-involutive {x} {y} p =
J (Ξ» xβ yβ xββyβ β sym (sym xββyβ) β‘ xββyβ)
(Ξ» z β β‘-trans (β‘-cong sym (sym-β-refl z)) (sym-β-refl z)) x y p
sym-injective : β {x y} {p q : x β y} β sym p β‘ sym q β p β‘ q
sym-injective {p = p} {q} eq = begin
p β‘β¨ β‘-sym (sym-involutive p) β©
sym (sym p) β‘β¨ β‘-cong sym eq β©
sym (sym q) β‘β¨ sym-involutive q β©
q β
where open P.β‘-Reasoning
{-
trans : β {x y z} β x β y β y β z β x β z
trans {x} {y} {z} xβy yβz = J D (Ξ» u β Ξ» w q β q) x y xβy z yβz
where
D : β u v β u β v β Set _
D u v uβv = β w β (q : v β w) β u β w
-}
trans : β {x y z} β x β y β y β z β x β z
trans {x} {y} {z} xβy yβz = J D (Ξ» u β Ξ» w q β J E (Ξ» _ β β-refl) u w q) x y xβy z yβz
where
D : β u v β u β v β Set _
D u v uβv = β w β v β w β u β w
E : β u v β u β v β Set _
E u v q = u β v
|
{-# LANGUAGE CPP #-}
{-# LANGUAGE UndecidableInstances #-}
module Numeric.PRIMME.Types
( PrimmeException (..),
BlasDatatype (..),
BlasRealPart,
BlasDatatypeTag (..),
MBlock (..),
Block (..),
PrimmeOperator,
PrimmeTarget (..),
PrimmeMethod (..),
PrimmeInfo (..),
PrimmeStats (..),
PrimmeEventInfo (..),
PrimmeMonitor (..),
PrimmeOptions (..),
PrimmeInt,
Cprimme_params,
CmatrixMatvec,
CmonitorFun,
)
where
import Control.Exception.Safe
import Control.Monad.ST (RealWorld)
import Data.Complex
import Data.Int (Int32, Int64)
import Data.Kind
import Data.Text
import Data.Vector.Storable (MVector, Vector)
import Foreign.C.Types (CChar, CDouble, CInt, CLong)
import Foreign.Ptr (Ptr)
import Foreign.Storable
#if !defined(PRIMME_INT_SIZE) || PRIMME_INT_SIZE == 64
type PrimmeInt = CLong -- Int64
#elif PRIMME_INT_SIZE == 0
type PrimmeInt = CInt
#elif PRIMME_INT_SIZE == 32
type PrimmeInt = Int32
#else
#error "invalid value of PRIMME_INT_SIZE"
#endif
data Cprimme_params
-- | Type of blocked matrix-vector product accepted by PRIMME C library.
-- @
-- void (*matrixMatvec)
-- ( void *x, PRIMME_INT *ldx, void *y, PRIMME_INT *ldy, int *blockSize,
-- struct primme_params *primme, int *ierr);
-- @
type CmatrixMatvec = Ptr () -> Ptr PrimmeInt -> Ptr () -> Ptr PrimmeInt -> Ptr CInt -> Ptr Cprimme_params -> Ptr CInt -> IO ()
-- | Type of logging function.
-- @
-- void (*monitorFun)(void *basisEvals, int *basisSize, int *basisFlags, int *iblock,
-- int *blockSize, void *basisNorms, int *numConverged, void *lockedEvals,
-- int *numLocked, int *lockedFlags, void *lockedNorms, int *inner_its,
-- void *LSRes, const char *msg, double *time, primme_event *event,
-- struct primme_params *primme, int *ierr)
-- @
type CmonitorFun =
Ptr () ->
Ptr CInt ->
Ptr CInt ->
Ptr CInt ->
Ptr CInt ->
Ptr () ->
Ptr CInt ->
Ptr () ->
Ptr CInt ->
Ptr CInt ->
Ptr () ->
Ptr CInt ->
Ptr () ->
Ptr CChar ->
Ptr CDouble ->
Ptr CInt ->
Ptr Cprimme_params ->
Ptr CInt ->
IO ()
-- | Exceptions thrown by this package.
data PrimmeException
= PrimmeMaximumIterationsReached
| PrimmeUserFailure
| PrimmeLapackFailure
| PrimmeOtherFailure {-# UNPACK #-} !CInt
deriving stock (Show)
instance Exception PrimmeException
-- | A GADT which allows to dispatch between BLAS types at runtime.
data BlasDatatypeTag :: (Type -> Type) where
FloatTag :: BlasDatatypeTag Float
DoubleTag :: BlasDatatypeTag Double
ComplexFloatTag :: BlasDatatypeTag (Complex Float)
ComplexDoubleTag :: BlasDatatypeTag (Complex Double)
type family BlasRealPart a where
BlasRealPart Float = Float
BlasRealPart Double = Double
BlasRealPart (Complex Float) = Float
BlasRealPart (Complex Double) = Double
-- | BLAS datatype.
class
( Storable a,
Storable (BlasRealPart a),
Floating a,
Floating (BlasRealPart a),
Show a,
Show (BlasRealPart a)
) =>
BlasDatatype a
where
blasTag :: proxy a -> BlasDatatypeTag a
instance BlasDatatype Float where blasTag _ = FloatTag
instance BlasDatatype Double where blasTag _ = DoubleTag
instance BlasDatatype (Complex Float) where blasTag _ = ComplexFloatTag
instance BlasDatatype (Complex Double) where blasTag _ = ComplexDoubleTag
-- | Mutable dense matrix in column-major order.
data MBlock s a = MBlock
{ -- | Shape of the matrix as @(number of rows, number of columns)@
mutableBlockShape :: {-# UNPACK #-} !(Int, Int),
-- | Stride along the second dimension (typically called @ldim@ or "leading
-- dimension" in BLAS-like libraries). Since the matrix is in column-major
-- order, stride along the first dimension is always 1.
mutableBlockStride :: {-# UNPACK #-} !Int,
-- | The actual data buffer of length @number of columns * mutableBlockStride@
mutableBlockData :: {-# UNPACK #-} !(MVector s a)
}
-- | Dense matrix in column-major order.
data Block a = Block
{ -- | Shape of the matrix as @(number of rows, number of columns)@
blockShape :: {-# UNPACK #-} !(Int, Int),
-- | Stride along the second dimension (typically called @ldim@ or "leading
-- dimension" in BLAS-like libraries). Since the matrix is in column-major
-- order, stride along the first dimension is always 1.
blockStride :: {-# UNPACK #-} !Int,
-- | The actual data buffer of length @#columns * blockStride@
blockData :: {-# UNPACK #-} !(Vector a)
}
deriving stock (Show)
-- | Matrix-matrix product which defines an operator @A@.
type PrimmeOperator a =
-- | Matrix @x@ to which we apply @A@
Block a ->
-- | Where to store @Ax@
MBlock RealWorld a ->
-- | Procedure is run in 'IO' since it will typically involve FFI calls.
IO ()
-- | Which eigenpairs to target.
--
-- /Note:/ PRIMME C library also supports computing non-extremal eigenvalues.
-- Wrappers for it may be added in the future.
data PrimmeTarget
= -- | Target smallest algebraic eigenvalues
PrimmeSmallest
| -- | Target largest algebraic eigenvalues
PrimmeLargest
deriving stock (Read, Show, Eq)
-- | Which method to use.
data PrimmeMethod
= PrimmeDynamic
| -- | GD+k
PrimmeGDOlsenPlusK
| -- | JDQMR
PrimmeJDQMRETol
deriving stock (Read, Show, Eq)
newtype PrimmeMonitor = PrimmeMonitor
{ unPrimmeMonitor :: forall a. BlasDatatype a => PrimmeInfo a -> IO Bool
}
data PrimmeInfo a = PrimmeInfo (PrimmeEventInfo a) PrimmeStats
deriving stock instance BlasDatatype a => Show (PrimmeInfo a)
data PrimmeStats = PrimmeStats
{ pStatsNumOuterIterations :: !Int,
pStatsNumRestarts :: !Int,
pStatsNumMatvecs :: !Int,
pStatsTimeMatvec :: !Double,
pStatsTimeOrtho :: !Double,
pStatsTimeDense :: !Double
}
deriving stock (Show)
data PrimmeEventInfo a
= PrimmeOuterInfo !(Vector (BlasRealPart a)) !(Vector (BlasRealPart a))
| PrimmeInnerInfo
| PrimmeLockedInfo
| PrimmeConvergedInfo !Int !(BlasRealPart a) !(BlasRealPart a)
| PrimmeMessageInfo !Text
deriving stock instance BlasDatatype a => Show (PrimmeEventInfo a)
-- | Specify some more information about the eigenvalue problem at hand.
--
-- /Warning:/ it is of utmost importance to use the correct dimension! If your
-- 'PrimmeOperator' has a different dimension than specified here, stuff will
-- break with segmentation faults...
data PrimmeOptions = PrimmeOptions
{ -- | Dimension of the operator. Please, set it carefully!
pDim :: !Int,
-- | Number of eigenpairs to compute
pNumEvals :: !Int,
-- | Which eigenpairs to target
pTarget :: !PrimmeTarget,
-- | Which algorithm to use
pMethod :: !PrimmeMethod,
-- | Tolerance
pEps :: !Double,
-- | Maximal basis size. [See also](http://www.cs.wm.edu/~andreas/software/doc/appendix.html#c.primme_params.maxBasisSize)
pMaxBasisSize :: !Int,
-- | Maximum number of Ritz vectors kept after restarting the basis.
-- [See also](http://www.cs.wm.edu/~andreas/software/doc/appendix.html#c.primme_params.minRestartSize)
pMinRestartSize :: !Int,
-- | Maximal block size. [See also](http://www.cs.wm.edu/~andreas/software/doc/appendix.html#c.primme_params.maxBlockSize)
pMaxBlockSize :: !Int,
-- | Logging
pLogAction :: !(Either Int PrimmeMonitor)
}
|
Win 1 of 10 Full Sets of BookLifeβs Exciting New Series, Game On!
Enter for your chance to win β and go from noob to know-it-all!
Inspiring creativity in the classroom with Fellowes.
An award-winning monthly science magazine for children with accompanying downloadable lesson plans for Y2-6. |
\chapter{Parameterization of Human Knee Joints}
\label{sec:KneeParams}
The proposed and prototyped knee joint requires a specific input of patient parameters to achieve its goal of matching a person's knee movement. Therefore, a system must be developed to non-invasively identify a relationship between the flexion of the patient's knee joint and the linear movement of the shank away from the knee's joint center. There have been several attempts to parameterize the human knee joint using many different methods, including \cite{3DKinKneeJointOldStabby}, \cite{MRIKneeShape_Unloaded}, \cite{MRIKneeShape_Loaded}, and \cite{ModelAnalysisDeepKneeFlexion}. All of these studies focus on the tibiofemoral relationship, i.e. the bone movement within the lower limbs. However, rehabilitation exoskeletons connect to the skin of its user. Other studies have identified a difference between identifying knee kinematics through skin markers and bone pins \cite{reinschmidt1997effect}, suggesting there is in fact a distinct difference between tibiofemoral movement and skin movement around the knee. Therefore, an imaging workflow and software processing program needs to be developed to be able to parameterize a patient's knee movement with consideration to skin movement.
To identify the knee relationship, an imaging workflow as well as an accompanying software analysis tool is proposed and tested with pilot data. This imaging method uses a motion capture system to identify movement of specific markers attached to a person's skin. This will all be processed using a custom software workflow consisting of both Vicon image processing and custom Python scripts that will extract the parameters from the data. To test this workflow, an experiment is proposed using medical MR imaging to identify the kinematics of the knee joint, compare the developed knee joint to a traditional pin joint, and determine the relationship between the knee joint kinematics and the skin movement surrounding the knee.
\section{Proposed Method of Imaging}
\label{sec:ImaginKneeProcedure}
\begin{figure}[ht!]
\centering
\includegraphics[width=0.65\textwidth]{Figures/Param/StudyPatientPositioning.jpg}
\caption{Depicts the patient position during motion capture. The patient will then flex and extend their knee while keeping the heel on the table.}
\label{fig:ParamPatientPosition}
\end{figure}
The proposed imaging workflow can be split up into two major parts: the imaging session and the software processing. For flexibility and speed, the usage of a motion capture system is proposed, which can develop accurately track the position of motion dots. In this study, the motion capture system used was a 10-camera Vicon Vantage 5 \footnote{See Vicon system here: \url{https://www.vicon.com/hardware/cameras/vantage/}}, but any motion capture system is usable given enough precision.
To measure the knee flexion, a patient is placed on their back, shown in \autoref{fig:ParamPatientPosition}.Motion capture dots are then placed on the patient using double-sided tape to track the positions where the exoskeleton will attach to the skin. Two additional points can be placed on the knee for extra feedback and the final joint position, but are not necessary for the software system. Then, the patient will flex and extend their knee joint while keeping the heel on the table to stabilize the knee and prevent shanking. The placement of the patient should allow for a technician to help the patient bend their knee if their condition does not allow them to do so themselves. Once the data is collected, it can be processed by the parameterization software system.
\section{Parameterization Software}
% TODO: Add software flowchart
The collected data first goes through a Vicon workflow for processing. This will properly format the data, create virtual joints, and determine joint centers. This is done using the built-in tools called SCoRE (Symmetrical Center of Rotation Estimation) and SARA (Symmetrical Axis of Rotation Analysis). Additionally, a built-in tool will determine the angle of the knee joint using the four dots on each section of the patient's leg. This Vicon specific workflow can be exported, shared, and reused for others who are using a similar system. The output of the workflow is a CSV file which can be parsed by a custom script.
To finish the parameterization of the knee, custom software was developed and written in Python. This software utilizes the AiM Vicon Python module \footnote{The AiM Vicon Python module is an open-source project found here: \url{https://github.com/WPI-AIM/AIM_Vicon}} which parses the CSV file from above. The joint angle, SARA, SCoRE, and marker positions are extracted from the data and placed in their specified datatypes. Since the AiM Vicon module did not have all the tools needed for this project, I developed and contributed to the Python module. Additional features added include SARA and SCoRE support, a new 3D visualizer, and stability improvements when importing different workflows.
\begin{figure}[ht!]
\centering
\includegraphics[width=\textwidth]{Figures/Param/3D_Marker_Animation.png}
\caption{An example of a possible output from the Parameterization Software System shown in a visualizer}
\label{fig:SoftwareSampleData}
\end{figure}
With the data parsed and imported, the final step is to calculate the final joint angles and determine the linear extension between the thigh and shank. The axis of rotation from SCoRE and all marker positions are projected onto a plane, which is calculated to be approximately the same as the plane of the manufactured joint. Then the final distance and angle are calculated by drawing two virtual lines as shown in \autoref{fig:SoftwareSampleData}: 1. from the projected primary thigh marker to the projected SCoRE location and 2. from the projected SCoRE location to the projected primary shank marker. The lengths of these lines then become the calculated linear extension and the angle between these two lines become the flexion. These two metrics are then combined into a dataset, and a best fit quartic curve is selected to become the patient's knee parameters.
\section{Testing with Pilot Data}
Due to time constraints, IRB (Internal Review Board) approval was not obtained to run a full study. However, some data was used to develop the software platform that will analyze the data. The graphs in \autoref{fig:Subj1KneeParams} and \autoref{fig:Subj2KneeParams} show the relationships between the knee joint flexion (angle of the knee) and the linear extension (distance of the shank to the joint center).
\begin{figure}[ht!]
\centering
\includegraphics[width=\textwidth]{Figures/Param/Subj1_KneeProfile.png}
\caption{A visualization of the angular flexion and linear extension of the shank from the joint center of the first dataset with subject 1. Subject bent and extended their knee joint 4 times.}
\label{fig:Subj1KneeParams}
\end{figure}
\begin{figure}[ht!]
\centering
\includegraphics[width=\textwidth]{Figures/Param/Subj2_KneeProfile.png}
\caption{A visualization of the angular flexion and linear extension of the shank from the joint center of the second dataset with subject 2. Subject bent and extended their knee joint 3 times.}
\label{fig:Subj2KneeParams}
\end{figure}
The data displayed in \autoref{fig:Subj1KneeParams} has a variation of up to \(7mm\) for any given angle. However, what is most interesting is the difference in the direction of the flexion. When the knee joint angle is increasing (knee is being bent), the markers are closer together, compared to when the knee joint is decreasing. In any given direction of movement, variation is less than \(2mm\), suggesting that this seemingly cyclical trajectory is not due to measurement variations or inaccuracies.
\autoref{fig:Subj2KneeParams}'s data is seemingly less dependent on the knee joint angular velocity direction. All data is within a \(3mm\) variation at any given angle. The notable exception is the \(7mm\) spike that can be seen at roughly \(25^\circ\) mark. This can likely be explained by either an accidental shift in the markers or a slight measurement error in the motion capture system. However, there is not sufficient data to make a conclusion as to the reasoning.
The data analyzed both show that the maximum variation in skin movement through the flexion of the knee never exceeded \(7mm\), even with the outlier event from \autoref{fig:Subj2KneeParams}. In comparison, studies presented in \autoref{sec:KneeModel} describe a tibio\-femoral relationship that varies over \(40mm\) throughout the joint flexion. While these two data points are not statistically significant enough to make a conclusion for all human knees, the preliminary pilot data suggests that the skin movement is different than the tibiofemoral movement. An in-depth study is needed to make a definitive conclusion.
\section{Study Outline}
As a part of this thesis, an study was designed to test the developed parameterization software as well as the knee joint's capability to be customized to a specific person. However, due to time constraints, IRB (Internal Review Board) approval to run the human study was not obtained, and therefore the study was not run. The study's methodology is outlined below, and the IRB proposal documents are attached in \autoref{apx:ParamStudyDocs}.
Up to 6 subjects are to be selected to partake in this study. Each subject should not have any prior severe knee injury, and should be cleared to be imaged with an MRI. The study will start with imaging the knee using the motion capture procedures outlined in \autoref{sec:ImaginKneeProcedure}, and parameters will be selected using the parameterization software developed. These parameters will be used to manufacture an MRI safe personalized knee joint. Additionally, a second non-personalized pin joint will be manufactured and used as a control.
The second stage of the study will compare the fit of the two joints. The subject will undergo MR scans at up to 3 different knee angles, first with no joint and then subsequently with each type of joint. The movement (if any) of the joint in reference to the subjects body will be measured. A successful experiment should demonstrate that the customized knee joint moves less than a non-customized pin joint. Additionally, the tibiofemoral movement can be compared to the measured parameters to determine how much the skin moves relative to the knee joint.
|
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../")
try:
from utils.priority_queue import PriorityQueue
except:
raise
from pathfinding.heuristic import euclidean_cost
from math import sqrt, inf
from itertools import product
import numpy as np
def reconstruct_path_to_destination(prev, end):
"""
Constructs an in-order sequence of (x,y) coordinates (list of tuples)
to the end destination using the mapping from nodes to their predecessors
(prev).
"""
path = [end]
curr = end
while curr in prev.keys():
curr = prev[curr]
path.insert(0, curr)
return path
# A* Search
def get_successors(node, grid):
"""
The neighbors of a cell (node) in the grid are the 8-surrounding cells.
"""
successors = []
node_x, node_y = node
n_rows = len(grid)
n_cols = len(grid[0])
for dx, dy in product([-1,0,1],[-1,0,1]):
# skip the current node itself
if (dx == 0 and dy == 0):
continue
x = node_x + dx
y = node_y + dy
if (0 <= x < n_rows and 0 <= y < n_cols):
cost = grid[y][x]
else:
# put infinite penalty on successors that would take us off the edge of the grid
cost = inf
successors.append( ((x, y), cost) )
return successors
def node_with_min_fscore(open_set, f_cost): # open_set is a set (of cell) and f_cost is a dict (with cells as keys)
"""
Find the cell in open set with the smallest f score.
"""
f_cost_open = dict([a for a in f_cost.items() if a[0] in open_set])
return min(f_cost_open, key=f_cost_open.get)
def a_star_search(grid, start, end, heuristic_cost=euclidean_cost):
"""
Implementation of A Star over a 2D grid. Returns a list of waypoints
as a list of (x,y) tuples.
Input:
: grid, 2D matrix
: start, (x,y) tuple, start position
: end, (x,y) tuple, end destination
Output:
: waypoints, list of (x,y) tuples
"""
# the set of cells already evaluated
closed_set = set()
# the set of cells already discovered
open_set = set()
open_set.add(start)
# for each cell, mapping to its least-cost incoming cell
prev = {}
# for each node, cost of reaching it from start (g_cost)
# for each node, cost of getting from start to dest via that node (f_cost)
# note: cell->dest component of f_cost will be estimated using a heuristic
g_cost = {}
f_cost = {}
for cell in product(range(len(grid)), range(len(grid[0]))):
g_cost[cell] = inf
f_cost[cell] = inf
g_cost[start] = 0
f_cost[start] = heuristic_cost(start, end)
while open_set:
# node in open set with min fscore
curr = node_with_min_fscore(open_set, f_cost)
# if we've reached the destination
if curr == end:
return reconstruct_path_to_destination(prev, curr)
open_set.remove(curr)
closed_set.add(curr)
for neighbor, cost in get_successors(curr, grid):
# ignore neighbors which have already been evaluated
if neighbor in closed_set:
continue
curr_g_score = g_cost[curr] + cost
# add neighbor to newly discovered nodes
if neighbor not in open_set:
open_set.add(neighbor)
# if we've already got a lower g_score for neighbor, then move on
elif curr_g_score >= g_cost[neighbor]:
continue
prev[neighbor] = curr
g_cost[neighbor] = curr_g_score
f_cost[neighbor] = g_cost[neighbor] + heuristic_cost(neighbor, end)
# if we get to this point, it's not possible to reach the end destination
return [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.